diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 479cafb64..56cfad0fe 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1910,6 +1910,15 @@ Important structured information may include: names, dates, locations, events, k removeFirst: 'Remove first', removeLast: 'Remove last', }, + webhook: { + name: 'Webhook', + methods: 'Methods', + contentTypes: 'Content types', + security: 'Security', + schema: 'Schema', + response: 'Response', + executionMode: 'Execution mode', + }, }, llmTools: { bad_calculator: { diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 4179557c3..1c8e0be7b 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -1755,6 +1755,14 @@ Tokenizer 会根据所选方式将内容存储为对应的数据结构。`, removeFirst: '移除第一个', removeLast: '移除最后一个', }, + webhook: { + methods: '方法', + contentTypes: '内容类型', + security: '安全配置', + schema: 'Schema', + response: '响应内容', + executionMode: '执行模式', + }, }, footer: { profile: 'All rights reserved @ React', diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index abef76ab3..66082c30f 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -25,6 +25,7 @@ export * from './pipeline'; export enum AgentDialogueMode { Conversational = 'conversational', Task = 'task', + Webhook = 'Webhook', } import { ModelVariableType } from '@/constants/knowledge'; @@ -930,3 +931,25 @@ export enum AgentVariableType { Begin = 'begin', Conversation = 'conversation', } + +export enum WebhookMethod { + Post = 'POST', + Get = 'GET', + Put = 'PUT', + Patch = 'PATCH', + Delete = 'DELETE', + Head = 'HEAD', +} + +export enum WebhookContentType { + ApplicationJson = 'application/json', + MultipartFormData = 'multipart/form-data', + ApplicationXWwwFormUrlencoded = 'application/x-www-form-urlencoded', + TextPlain = 'text/plain', + ApplicationOctetStream = 'application/octet-stream', +} + +export enum WebhookExecutionMode { + Immediately = 'Immediately', + Streaming = 'Streaming', +} diff --git a/web/src/pages/agent/form/begin-form/index.tsx b/web/src/pages/agent/form/begin-form/index.tsx index ad4eb9d3e..18e2b2454 100644 --- a/web/src/pages/agent/form/begin-form/index.tsx +++ b/web/src/pages/agent/form/begin-form/index.tsx @@ -26,10 +26,12 @@ import { QueryTable } from './query-table'; import { useEditQueryRecord } from './use-edit-query'; import { useValues } from './use-values'; import { useWatchFormChange } from './use-watch-change'; +import { WebHook } from './webhook'; const ModeOptions = [ { value: AgentDialogueMode.Conversational, label: t('flow.conversational') }, { value: AgentDialogueMode.Task, label: t('flow.task') }, + { value: AgentDialogueMode.Webhook, label: t('flow.webhook.name') }, ]; function BeginForm({ node }: INextOperatorForm) { @@ -53,6 +55,12 @@ function BeginForm({ node }: INextOperatorForm) { }), ) .optional(), + methods: z.string().optional(), + content_types: z.string().optional(), + security: z.string().optional(), + schema: z.string().optional(), + response: z.string().optional(), + execution_mode: z.string().optional(), }); const form = useForm({ @@ -158,6 +166,7 @@ function BeginForm({ node }: INextOperatorForm) { )} /> )} + {mode === AgentDialogueMode.Webhook && } {/* Create a hidden field to make Form instance record this */} + + + + + + + + + + + + + + + + + + + + ); +}