Skip to content

Commit

Permalink
[front] - feature: use dynamic Qdrant cluster configuration from env …
Browse files Browse the repository at this point in the history
…variables

 - Replaced the hardcoded default Qdrant cluster with a dynamic one fetched from the environment configuration
 - Updated data source creation logic to utilize the new Qdrant cluster configuration method

[types] - refactor: support multiple Qdrant cluster options in type definitions

 - Expanded the `QdrantCluster` type to support an additional cluster called "eu-cluster-0"
  • Loading branch information
JulesBelveze committed Dec 23, 2024
1 parent f49bae4 commit 34b14d5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
5 changes: 4 additions & 1 deletion front/lib/api/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EnvironmentConfig } from "@dust-tt/types";
import { EnvironmentConfig, QdrantCluster } from "@dust-tt/types";

export const PRODUCTION_DUST_API = "https://dust.tt";

Expand Down Expand Up @@ -161,6 +161,9 @@ const config = {
getStatusPageApiToken: (): string => {
return EnvironmentConfig.getEnvVariable("STATUS_PAGE_API_TOKEN");
},
getQdrantCluster: (): QdrantCluster => {
return EnvironmentConfig.getEnvVariable("QDRANT_CLUSTER") as QdrantCluster;
},
};

export default config;
3 changes: 1 addition & 2 deletions front/lib/api/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
ConnectorsAPI,
CoreAPI,
DEFAULT_EMBEDDING_PROVIDER_ID,
DEFAULT_QDRANT_CLUSTER,
dustManagedCredentials,
EMBEDDING_CONFIGS,
Err,
Expand Down Expand Up @@ -850,7 +849,7 @@ export async function createDataSourceWithoutProvider(
projectId: dustProject.value.project.project_id.toString(),
config: {
qdrant_config: {
cluster: DEFAULT_QDRANT_CLUSTER,
cluster: config.getQdrantCluster(),
shadow_write_cluster: null,
},
embedder_config: {
Expand Down
3 changes: 1 addition & 2 deletions front/pages/api/w/[wId]/data_sources/managed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ConnectorsAPI,
CoreAPI,
DEFAULT_EMBEDDING_PROVIDER_ID,
DEFAULT_QDRANT_CLUSTER,
dustManagedCredentials,
EMBEDDING_CONFIGS,
ioTsParsePayload,
Expand Down Expand Up @@ -277,7 +276,7 @@ async function handler(
},
},
qdrant_config: {
cluster: DEFAULT_QDRANT_CLUSTER,
cluster: config.getQdrantCluster(),
shadow_write_cluster: null,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
ConnectorsAPI,
CoreAPI,
DEFAULT_EMBEDDING_PROVIDER_ID,
DEFAULT_QDRANT_CLUSTER,
dustManagedCredentials,
EMBEDDING_CONFIGS,
ioTsParsePayload,
Expand Down Expand Up @@ -364,7 +363,7 @@ const handleDataSourceWithProvider = async ({
},
},
qdrant_config: {
cluster: DEFAULT_QDRANT_CLUSTER,
cluster: config.getQdrantCluster(),
shadow_write_cluster: null,
},
},
Expand Down
2 changes: 1 addition & 1 deletion types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
"hot-shots": false,
"child_process": false
}
}
}
3 changes: 1 addition & 2 deletions types/src/core/data_source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export type QdrantCluster = "cluster-0";
export const DEFAULT_QDRANT_CLUSTER: QdrantCluster = "cluster-0";
export type QdrantCluster = "cluster-0" | "eu-cluster-0";

export interface EmbedderType {
provider_id: string;
Expand Down

0 comments on commit 34b14d5

Please sign in to comment.