diff --git a/front/admin/db.ts b/front/admin/db.ts index 29890f3a3d0b..477b50f3b030 100644 --- a/front/admin/db.ts +++ b/front/admin/db.ts @@ -56,11 +56,10 @@ async function main() { await ExtractedEvent.sync({ alter: true }); await DocumentTrackerChangeSuggestion.sync({ alter: true }); - await AgentConfiguration.sync({ alter: true }); await AgentGenerationConfiguration.sync({ alter: true }); - await AgentRetrievalConfiguration.sync({ alter: true }); await AgentDataSourceConfiguration.sync({ alter: true }); + await AgentConfiguration.sync({ alter: true }); await AgentRetrievalAction.sync({ alter: true }); await RetrievalDocument.sync({ alter: true }); await RetrievalDocumentChunk.sync({ alter: true }); diff --git a/front/lib/api/assistant/actions/retrieval.ts b/front/lib/api/assistant/actions/retrieval.ts index 6730bef1fc89..bbe5d7762cad 100644 --- a/front/lib/api/assistant/actions/retrieval.ts +++ b/front/lib/api/assistant/actions/retrieval.ts @@ -388,8 +388,8 @@ export async function* runRetrieval( // Handle data sources list and parents/tags filtering. config.DATASOURCE.data_sources = c.dataSources.map((d) => ({ - workspace_id: d.workspaceSId, - data_source_id: d.dataSourceName, + workspace_id: d.workspaceId, + data_source_id: d.dataSourceId, })); for (const ds of c.dataSources) { diff --git a/front/lib/api/assistant/configuration.ts b/front/lib/api/assistant/configuration.ts index 0d0a896b90ad..1550a9d34a72 100644 --- a/front/lib/api/assistant/configuration.ts +++ b/front/lib/api/assistant/configuration.ts @@ -483,8 +483,8 @@ export async function _agentActionType( } dataSourcesConfigType.push({ - dataSourceName: dataSource.name, - workspaceSId: workspace.sId, + dataSourceId: dataSource.name, + workspaceId: workspace.sId, filter: { tags: dsConfig.tagsIn && dsConfig.tagsNotIn @@ -530,7 +530,7 @@ export async function _createAgentDataSourcesConfigData( // First we get the list of workspaces because we need the mapping between workspaceSId and workspaceId const workspaces = await Workspace.findAll({ where: { - sId: dataSourcesConfig.map((dsConfig) => dsConfig.workspaceSId), + sId: dataSourcesConfig.map((dsConfig) => dsConfig.workspaceId), }, attributes: ["id", "sId"], }); @@ -551,7 +551,7 @@ export async function _createAgentDataSourcesConfigData( curr: AgentDataSourceConfigurationType ) => { // First we need to get the workspaceId from the workspaceSId - const workspace = workspaces.find((w) => w.sId === curr.workspaceSId); + const workspace = workspaces.find((w) => w.sId === curr.workspaceId); if (!workspace) { throw new Error("Workspace not found"); } @@ -563,12 +563,12 @@ export async function _createAgentDataSourcesConfigData( ); if (existingEntry) { // Append dataSourceName to existing entry - existingEntry.dataSourceNames.push(curr.dataSourceName); + existingEntry.dataSourceNames.push(curr.dataSourceId); } else { // Add a new entry for this workspaceId acc.push({ workspaceId: workspace.id, - dataSourceNames: [curr.dataSourceName], + dataSourceNames: [curr.dataSourceId], }); } return acc; @@ -597,9 +597,9 @@ export async function _createAgentDataSourcesConfigData( dataSourcesConfig.map(async (dsConfig) => { const dataSource = dataSources.find( (ds) => - ds.name === dsConfig.dataSourceName && + ds.name === dsConfig.dataSourceId && ds.workspaceId === - workspaces.find((w) => w.sId === dsConfig.workspaceSId)?.id + workspaces.find((w) => w.sId === dsConfig.workspaceId)?.id ); if (!dataSource) { throw new Error("DataSource not found"); diff --git a/front/types/assistant/configuration.ts b/front/types/assistant/configuration.ts index 62d825a62beb..33c925671fc3 100644 --- a/front/types/assistant/configuration.ts +++ b/front/types/assistant/configuration.ts @@ -57,8 +57,8 @@ export function isRetrievalConfiguration( * Datasources config for Retrieval Action */ export type AgentDataSourceConfigurationType = { - workspaceSId: string; // need sId to talk with Core (external id) - dataSourceName: string; // need Datasource.name to talk with Core (external id) + workspaceId: string; // need sId to talk with Core (external id) + dataSourceId: string; // need Datasource.name to talk with Core (external id) filter: { tags: { in: string[]; not: string[] } | null; parents: { in: string[]; not: string[] } | null;