diff --git a/front/components/assistant_builder/AssistantBuilder.tsx b/front/components/assistant_builder/AssistantBuilder.tsx index 5b068293acfc..e8e5f29b7ab5 100644 --- a/front/components/assistant_builder/AssistantBuilder.tsx +++ b/front/components/assistant_builder/AssistantBuilder.tsx @@ -99,20 +99,23 @@ const SPIRIT_AVATAR_URLS = SPIRIT_AVATAR_FILES.map((f) => // Actions -const ACTION_MODES = [ - "GENERIC", - "RETRIEVAL_SEARCH", +const BASIC_ACTION_MODES = ["GENERIC", "RETRIEVAL_SEARCH"] as const; +const ADVANCED_ACTION_MODES = [ "RETRIEVAL_EXHAUSTIVE", "DUST_APP_RUN", "DATABASE_QUERY", ] as const; -type ActionMode = (typeof ACTION_MODES)[number]; + +type ActionMode = + | (typeof BASIC_ACTION_MODES)[number] + | (typeof ADVANCED_ACTION_MODES)[number]; + const ACTION_MODE_TO_LABEL: Record = { GENERIC: "No action", - RETRIEVAL_SEARCH: "Search Data Sources", - RETRIEVAL_EXHAUSTIVE: "Process Data Sources", - DUST_APP_RUN: "Run Dust App", - DATABASE_QUERY: "Query Database", + RETRIEVAL_SEARCH: "Search in data sources", + RETRIEVAL_EXHAUSTIVE: "Use most recent in data sources", + DUST_APP_RUN: "Run a Dust app", + DATABASE_QUERY: "Query a database", }; // Retrieval Action @@ -678,15 +681,6 @@ export default function AssistantBuilder({ return newAgentConfiguration; }; - // Hack to keep DATABASE_QUERY disabled if not Dust workspace - const actions = isActivatedStructuredDB(owner) - ? ACTION_MODE_TO_LABEL - : Object.fromEntries( - Object.entries(ACTION_MODE_TO_LABEL).filter( - ([key]) => key !== "DATABASE_QUERY" - ) - ); - return ( <> -
+
Identity
@@ -960,9 +954,7 @@ export default function AssistantBuilder({
-
- Data Sources & Actions -
+
Action
{configurableDataSources.length === 0 && Object.keys(builderState.dataSourceConfigurations).length === 0 && ( @@ -1021,13 +1013,8 @@ export default function AssistantBuilder({ )}
- You can ask the assistant to perform actions before answering, - like{" "} - - searching in your data sources - - , or use a Dust Application you have built for your specific - needs. + Choose the action the assistant will perform and take into account + before answering:
@@ -1044,23 +1031,58 @@ export default function AssistantBuilder({ size="sm" /> - - {Object.entries(actions).map(([key, value]) => ( + + {BASIC_ACTION_MODES.map((key) => ( { setEdited(true); setBuilderState((state) => ({ ...state, - actionMode: key as ActionMode, + actionMode: key, })); }} /> ))} + + + {ADVANCED_ACTION_MODES.filter((key) => { + return ( + key !== "DATABASE_QUERY" || + isActivatedStructuredDB(owner) + ); + }).map((key) => ( + { + setEdited(true); + setBuilderState((state) => ({ + ...state, + actionMode: key, + })); + }} + /> + ))} + +
+ +
+ No action is set. The assistant will use the instructions only + to answer. +
+
@@ -1213,7 +1235,7 @@ export default function AssistantBuilder({ show={builderState.actionMode === "DUST_APP_RUN"} >
- Your assistant can execute a Dust Application of your design + The assistant will execute a Dust Application of your design before answering. The output of the app (last block) is injected in context for the model to generate an answer. The inputs of the app will be automatically generated from the context of the @@ -1234,8 +1256,8 @@ export default function AssistantBuilder({ show={builderState.actionMode === "DATABASE_QUERY"} >
- Your assistant can search directly from a database built from - one of your files. + The assistant will generate a SQL query from your request, + execute it on the tables selected and retrieve the results.