Skip to content

Commit

Permalink
[front] Enforce unique name for data source (#9497)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier authored Dec 18, 2024
1 parent 891b59b commit 3cea920
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions front/lib/api/data_sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,14 @@ export async function createDataSourceWithoutProvider(
});
}

if (dataSources.some((ds) => ds.name === name)) {
return new Err({
name: "dust_error",
code: "invalid_request_error",
message: "Data source with that name already exist.",
});
}

const dataSourceEmbedder =
owner.defaultEmbeddingProvider ?? DEFAULT_EMBEDDING_PROVIDER_ID;
const embedderConfig = EMBEDDING_CONFIGS[dataSourceEmbedder];
Expand Down

0 comments on commit 3cea920

Please sign in to comment.