From bbe9aa6cdd4e8f099dd0427bf628af8d19479954 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Fri, 15 Nov 2024 14:56:51 +0100 Subject: [PATCH] move actions --- types/src/front/assistant/actions/browse.ts | 32 +++++++++++++++ .../front/assistant/actions/dust_app_run.ts | 40 ++++++++++++++++++ .../{lib/api => }/assistant/actions/index.ts | 7 +++- types/src/front/assistant/actions/process.ts | 34 +++++++++++++++ .../src/front/assistant/actions/retrieval.ts | 37 ++++++++++++++++- .../front/assistant/actions/tables_query.ts | 39 ++++++++++++++++++ .../src/front/assistant/actions/websearch.ts | 32 +++++++++++++++ .../{lib/api => }/assistant/generation.ts | 0 .../front/lib/api/assistant/actions/browse.ts | 29 ------------- .../lib/api/assistant/actions/dust_app_run.ts | 41 ------------------- .../lib/api/assistant/actions/process.ts | 35 ---------------- .../lib/api/assistant/actions/retrieval.ts | 33 --------------- .../lib/api/assistant/actions/tables_query.ts | 36 ---------------- .../lib/api/assistant/actions/websearch.ts | 33 --------------- types/src/index.ts | 10 +---- 15 files changed, 219 insertions(+), 219 deletions(-) rename types/src/front/{lib/api => }/assistant/actions/index.ts (76%) rename types/src/front/{lib/api => }/assistant/generation.ts (100%) delete mode 100644 types/src/front/lib/api/assistant/actions/browse.ts delete mode 100644 types/src/front/lib/api/assistant/actions/dust_app_run.ts delete mode 100644 types/src/front/lib/api/assistant/actions/process.ts delete mode 100644 types/src/front/lib/api/assistant/actions/retrieval.ts delete mode 100644 types/src/front/lib/api/assistant/actions/tables_query.ts delete mode 100644 types/src/front/lib/api/assistant/actions/websearch.ts diff --git a/types/src/front/assistant/actions/browse.ts b/types/src/front/assistant/actions/browse.ts index 2a0d13e603f7c..5fb38f171e857 100644 --- a/types/src/front/assistant/actions/browse.ts +++ b/types/src/front/assistant/actions/browse.ts @@ -38,3 +38,35 @@ export interface BrowseActionType extends BaseAction { step: number; type: "browse_action"; } + +/** + * Browse Action Events + */ + +// Event sent before the execution with the finalized params to be used. +export type BrowseParamsEvent = { + type: "browse_params"; + created: number; + configurationId: string; + messageId: string; + action: BrowseActionType; +}; + +export type BrowseErrorEvent = { + type: "browse_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: string; + message: string; + }; +}; + +export type BrowseSuccessEvent = { + type: "browse_success"; + created: number; + configurationId: string; + messageId: string; + action: BrowseActionType; +}; diff --git a/types/src/front/assistant/actions/dust_app_run.ts b/types/src/front/assistant/actions/dust_app_run.ts index 0a3f060b0bfad..5fb738bf1d32c 100644 --- a/types/src/front/assistant/actions/dust_app_run.ts +++ b/types/src/front/assistant/actions/dust_app_run.ts @@ -35,3 +35,43 @@ export interface DustAppRunActionType extends BaseAction { step: number; type: "dust_app_run_action"; } + +/** + * DustAppRun Action Events + */ + +// Event sent before the execution of a dust app run with the finalized params to be used. +export type DustAppRunParamsEvent = { + type: "dust_app_run_params"; + created: number; + configurationId: string; + messageId: string; + action: DustAppRunActionType; +}; + +export type DustAppRunErrorEvent = { + type: "dust_app_run_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: string; + message: string; + }; +}; + +export type DustAppRunBlockEvent = { + type: "dust_app_run_block"; + created: number; + configurationId: string; + messageId: string; + action: DustAppRunActionType; +}; + +export type DustAppRunSuccessEvent = { + type: "dust_app_run_success"; + created: number; + configurationId: string; + messageId: string; + action: DustAppRunActionType; +}; diff --git a/types/src/front/lib/api/assistant/actions/index.ts b/types/src/front/assistant/actions/index.ts similarity index 76% rename from types/src/front/lib/api/assistant/actions/index.ts rename to types/src/front/assistant/actions/index.ts index 28a0da1f2b295..0862b7ca2fb4a 100644 --- a/types/src/front/lib/api/assistant/actions/index.ts +++ b/types/src/front/assistant/actions/index.ts @@ -1,5 +1,8 @@ -import { ModelId } from "../../../../../shared/model_id"; -import { FunctionCallType, FunctionMessageTypeModel } from "../generation"; +import { + FunctionCallType, + FunctionMessageTypeModel, +} from "../../../front/assistant/generation"; +import { ModelId } from "../../../shared/model_id"; type BaseActionType = | "dust_app_run_action" diff --git a/types/src/front/assistant/actions/process.ts b/types/src/front/assistant/actions/process.ts index 9392f2588c755..f626df9539e7f 100644 --- a/types/src/front/assistant/actions/process.ts +++ b/types/src/front/assistant/actions/process.ts @@ -91,3 +91,37 @@ export interface ProcessActionType extends BaseAction { step: number; type: "process_action"; } + +/** + * Process Action Events + */ + +// Event sent before the execution with the finalized params to be used. +export type ProcessParamsEvent = { + type: "process_params"; + created: number; + configurationId: string; + messageId: string; + dataSources: DataSourceConfiguration[]; + action: ProcessActionType; +}; + +export type ProcessErrorEvent = { + type: "process_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: string; + message: string; + }; +}; + +export type ProcessSuccessEvent = { + type: "process_success"; + created: number; + configurationId: string; + messageId: string; + action: ProcessActionType; +}; + diff --git a/types/src/front/assistant/actions/retrieval.ts b/types/src/front/assistant/actions/retrieval.ts index 44ceb6d784674..ff4192c5f33e0 100644 --- a/types/src/front/assistant/actions/retrieval.ts +++ b/types/src/front/assistant/actions/retrieval.ts @@ -2,11 +2,11 @@ * Data Source configuration */ +import { ConnectorProvider } from "../../../front/data_source"; +import { DataSourceViewType } from "../../../front/data_source_view"; import { BaseAction } from "../../../front/lib/api/assistant/actions/index"; import { ModelId } from "../../../shared/model_id"; import { ioTsEnum } from "../../../shared/utils/iots_utils"; -import { ConnectorProvider } from "../../data_source"; -import { DataSourceViewType } from "../../data_source_view"; export const TIME_FRAME_UNITS = [ "hour", @@ -143,3 +143,36 @@ export interface RetrievalActionType extends BaseAction { step: number; type: "retrieval_action"; } + +/** + * Retrieval Action Events + */ + +// Event sent during retrieval with the finalized query used to retrieve documents. +export type RetrievalParamsEvent = { + type: "retrieval_params"; + created: number; + configurationId: string; + messageId: string; + dataSources: DataSourceConfiguration[]; + action: RetrievalActionType; +}; + +export type RetrievalErrorEvent = { + type: "retrieval_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: string; + message: string; + }; +}; + +export type RetrievalSuccessEvent = { + type: "retrieval_success"; + created: number; + configurationId: string; + messageId: string; + action: RetrievalActionType; +}; diff --git a/types/src/front/assistant/actions/tables_query.ts b/types/src/front/assistant/actions/tables_query.ts index 8265795eeb58d..70c2fe04b36e0 100644 --- a/types/src/front/assistant/actions/tables_query.ts +++ b/types/src/front/assistant/actions/tables_query.ts @@ -67,3 +67,42 @@ export function getTablesQueryResultsFileAttachment({ return `${attachment}>\n${resultsFileSnippet}\n`; } + +/** + * TablesQuey Events + */ + +export type TablesQueryErrorEvent = { + type: "tables_query_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: "tables_query_error" | "too_many_result_rows"; + message: string; + }; +}; + +export type TablesQueryStartedEvent = { + type: "tables_query_started"; + created: number; + configurationId: string; + messageId: string; + action: TablesQueryActionType; +}; + +export type TablesQueryModelOutputEvent = { + type: "tables_query_model_output"; + created: number; + configurationId: string; + messageId: string; + action: TablesQueryActionType; +}; + +export type TablesQueryOutputEvent = { + type: "tables_query_output"; + created: number; + configurationId: string; + messageId: string; + action: TablesQueryActionType; +}; diff --git a/types/src/front/assistant/actions/websearch.ts b/types/src/front/assistant/actions/websearch.ts index 4dc22a5954aba..97d7a24cd970a 100644 --- a/types/src/front/assistant/actions/websearch.ts +++ b/types/src/front/assistant/actions/websearch.ts @@ -60,3 +60,35 @@ export interface WebsearchActionType extends BaseAction { step: number; type: "websearch_action"; } + +/** + * WebSearch Action Events + */ + +// Event sent before the execution with the finalized params to be used. +export type WebsearchParamsEvent = { + type: "websearch_params"; + created: number; + configurationId: string; + messageId: string; + action: WebsearchActionType; +}; + +export type WebsearchErrorEvent = { + type: "websearch_error"; + created: number; + configurationId: string; + messageId: string; + error: { + code: string; + message: string; + }; +}; + +export type WebsearchSuccessEvent = { + type: "websearch_success"; + created: number; + configurationId: string; + messageId: string; + action: WebsearchActionType; +}; diff --git a/types/src/front/lib/api/assistant/generation.ts b/types/src/front/assistant/generation.ts similarity index 100% rename from types/src/front/lib/api/assistant/generation.ts rename to types/src/front/assistant/generation.ts diff --git a/types/src/front/lib/api/assistant/actions/browse.ts b/types/src/front/lib/api/assistant/actions/browse.ts deleted file mode 100644 index 7ebc94b1b5f04..0000000000000 --- a/types/src/front/lib/api/assistant/actions/browse.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { BrowseActionType } from "../../../../assistant/actions/browse"; - -// Event sent before the execution with the finalized params to be used. -export type BrowseParamsEvent = { - type: "browse_params"; - created: number; - configurationId: string; - messageId: string; - action: BrowseActionType; -}; - -export type BrowseErrorEvent = { - type: "browse_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: string; - message: string; - }; -}; - -export type BrowseSuccessEvent = { - type: "browse_success"; - created: number; - configurationId: string; - messageId: string; - action: BrowseActionType; -}; diff --git a/types/src/front/lib/api/assistant/actions/dust_app_run.ts b/types/src/front/lib/api/assistant/actions/dust_app_run.ts deleted file mode 100644 index aece0cabdb5ac..0000000000000 --- a/types/src/front/lib/api/assistant/actions/dust_app_run.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Action execution. - */ - -import { DustAppRunActionType } from "../../../../../front/assistant/actions/dust_app_run"; - -// Event sent before the execution of a dust app run with the finalized params to be used. -export type DustAppRunParamsEvent = { - type: "dust_app_run_params"; - created: number; - configurationId: string; - messageId: string; - action: DustAppRunActionType; -}; - -export type DustAppRunErrorEvent = { - type: "dust_app_run_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: string; - message: string; - }; -}; - -export type DustAppRunBlockEvent = { - type: "dust_app_run_block"; - created: number; - configurationId: string; - messageId: string; - action: DustAppRunActionType; -}; - -export type DustAppRunSuccessEvent = { - type: "dust_app_run_success"; - created: number; - configurationId: string; - messageId: string; - action: DustAppRunActionType; -}; diff --git a/types/src/front/lib/api/assistant/actions/process.ts b/types/src/front/lib/api/assistant/actions/process.ts deleted file mode 100644 index 3a384845bee19..0000000000000 --- a/types/src/front/lib/api/assistant/actions/process.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Action execution. - */ - -import { ProcessActionType } from "../../../../../front/assistant/actions/process"; -import { DataSourceConfiguration } from "../../../../../front/assistant/actions/retrieval"; - -// Event sent before the execution with the finalized params to be used. -export type ProcessParamsEvent = { - type: "process_params"; - created: number; - configurationId: string; - messageId: string; - dataSources: DataSourceConfiguration[]; - action: ProcessActionType; -}; - -export type ProcessErrorEvent = { - type: "process_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: string; - message: string; - }; -}; - -export type ProcessSuccessEvent = { - type: "process_success"; - created: number; - configurationId: string; - messageId: string; - action: ProcessActionType; -}; diff --git a/types/src/front/lib/api/assistant/actions/retrieval.ts b/types/src/front/lib/api/assistant/actions/retrieval.ts deleted file mode 100644 index 5435b05c1a1e3..0000000000000 --- a/types/src/front/lib/api/assistant/actions/retrieval.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { - DataSourceConfiguration, - RetrievalActionType, -} from "../../../../../front/assistant/actions/retrieval"; - -// Event sent during retrieval with the finalized query used to retrieve documents. -export type RetrievalParamsEvent = { - type: "retrieval_params"; - created: number; - configurationId: string; - messageId: string; - dataSources: DataSourceConfiguration[]; - action: RetrievalActionType; -}; - -export type RetrievalErrorEvent = { - type: "retrieval_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: string; - message: string; - }; -}; - -export type RetrievalSuccessEvent = { - type: "retrieval_success"; - created: number; - configurationId: string; - messageId: string; - action: RetrievalActionType; -}; diff --git a/types/src/front/lib/api/assistant/actions/tables_query.ts b/types/src/front/lib/api/assistant/actions/tables_query.ts deleted file mode 100644 index 941507ed054a2..0000000000000 --- a/types/src/front/lib/api/assistant/actions/tables_query.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { TablesQueryActionType } from "../../../../../front/assistant/actions/tables_query"; - -export type TablesQueryErrorEvent = { - type: "tables_query_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: "tables_query_error" | "too_many_result_rows"; - message: string; - }; -}; - -export type TablesQueryStartedEvent = { - type: "tables_query_started"; - created: number; - configurationId: string; - messageId: string; - action: TablesQueryActionType; -}; - -export type TablesQueryModelOutputEvent = { - type: "tables_query_model_output"; - created: number; - configurationId: string; - messageId: string; - action: TablesQueryActionType; -}; - -export type TablesQueryOutputEvent = { - type: "tables_query_output"; - created: number; - configurationId: string; - messageId: string; - action: TablesQueryActionType; -}; diff --git a/types/src/front/lib/api/assistant/actions/websearch.ts b/types/src/front/lib/api/assistant/actions/websearch.ts deleted file mode 100644 index 648ca7099dbd8..0000000000000 --- a/types/src/front/lib/api/assistant/actions/websearch.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Action execution. - */ - -import { WebsearchActionType } from "../../../../assistant/actions/websearch"; - -// Event sent before the execution with the finalized params to be used. -export type WebsearchParamsEvent = { - type: "websearch_params"; - created: number; - configurationId: string; - messageId: string; - action: WebsearchActionType; -}; - -export type WebsearchErrorEvent = { - type: "websearch_error"; - created: number; - configurationId: string; - messageId: string; - error: { - code: string; - message: string; - }; -}; - -export type WebsearchSuccessEvent = { - type: "websearch_success"; - created: number; - configurationId: string; - messageId: string; - action: WebsearchActionType; -}; diff --git a/types/src/index.ts b/types/src/index.ts index 06b2bc8d74fea..88cbe464bd711 100644 --- a/types/src/index.ts +++ b/types/src/index.ts @@ -23,6 +23,7 @@ export * from "./front/app"; export * from "./front/assistant/actions/browse"; export * from "./front/assistant/actions/dust_app_run"; export * from "./front/assistant/actions/guards"; +export * from "./front/assistant/actions/index"; export * from "./front/assistant/actions/process"; export * from "./front/assistant/actions/retrieval"; export * from "./front/assistant/actions/tables_query"; @@ -31,6 +32,7 @@ export * from "./front/assistant/agent"; export * from "./front/assistant/avatar"; export * from "./front/assistant/builder"; export * from "./front/assistant/conversation"; +export * from "./front/assistant/generation"; export * from "./front/assistant/pubsub"; export * from "./front/assistant/templates"; export * from "./front/assistant/visualization"; @@ -44,14 +46,6 @@ export * from "./front/files"; export * from "./front/groups"; export * from "./front/key"; export * from "./front/lib/actions/types"; -export * from "./front/lib/api/assistant/actions/browse"; -export * from "./front/lib/api/assistant/actions/dust_app_run"; -export * from "./front/lib/api/assistant/actions/index"; -export * from "./front/lib/api/assistant/actions/process"; -export * from "./front/lib/api/assistant/actions/retrieval"; -export * from "./front/lib/api/assistant/actions/tables_query"; -export * from "./front/lib/api/assistant/actions/websearch"; -export * from "./front/lib/api/assistant/generation"; export * from "./front/lib/api/credentials"; export * from "./front/lib/assistant"; export * from "./front/lib/connectors_api";