Skip to content

Commit

Permalink
Forgot to commit this
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Sep 8, 2023
1 parent 46d29b4 commit 15b4c72
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions front/lib/api/assistant/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,12 @@ export async function createAgentActionConfiguration(
throw new Error("Cannot create AgentActionConfiguration: no workspace");
}

return await front_sequelize.transaction(async (t) => {
let retrievalConfig: AgentRetrievalConfiguration | null = null;
let dataSourcesConfig: AgentDataSourceConfiguration[] = [];

if (type !== "retrieval_configuration") {
throw new Error("Cannot create AgentActionConfiguration: unknow type");
}
if (type !== "retrieval_configuration") {
throw new Error("Cannot create AgentActionConfiguration: unknow type");
}

// Create Retrieval & Datasources configs
retrievalConfig = await AgentRetrievalConfiguration.create(
return await front_sequelize.transaction(async (t) => {
const retrievalConfig = await AgentRetrievalConfiguration.create(
{
query: isTemplatedQuery(query) ? "templated" : query,
queryTemplate: isTemplatedQuery(query) ? query.template : null,
Expand All @@ -378,7 +374,7 @@ export async function createAgentActionConfiguration(
},
{ transaction: t }
);
dataSourcesConfig = await _createAgentDataSourcesConfigData(
const dataSourcesConfig = await _createAgentDataSourcesConfigData(
t,
dataSources,
retrievalConfig.id
Expand Down Expand Up @@ -599,7 +595,7 @@ async function _createAgentDataSourcesConfigData(
// Now will want to group the datasource names by workspaceId to do only one query per workspace.
// We want this:
// [
// { workspaceId: 1, dataSourceNames: [""managed-notion", "managed-slack"] },
// { workspaceId: 1, dataSourceNames: ["managed-notion", "managed-slack"] },
// { workspaceId: 2, dataSourceNames: ["managed-notion"] }
// ]
type _DsNamesPerWorkspaceIdType = {
Expand Down

0 comments on commit 15b4c72

Please sign in to comment.