From 0fcb1680fd336fa820be70f709623ba20da85909 Mon Sep 17 00:00:00 2001 From: balibabu Date: Fri, 12 Dec 2025 16:16:34 +0800 Subject: [PATCH] Feat: Displaying the file option in the webhook's request body #10427 (#11928) ### What problem does this PR solve? Feat: Displaying the file option in the webhook's request body #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/pages/agent/constant/index.tsx | 7 +++++++ .../form/begin-form/webhook/dynamic-request.tsx | 17 +++++++++++++---- .../form/begin-form/webhook/request-schema.tsx | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx index f1c4bab1b..d096afa5f 100644 --- a/web/src/pages/agent/constant/index.tsx +++ b/web/src/pages/agent/constant/index.tsx @@ -1030,3 +1030,10 @@ export enum WebhookSecurityAuthType { export const RateLimitPerList = ['minute', 'hour', 'day']; export const WebhookMaxBodySize = ['10MB', '50MB', '100MB', '1000MB']; + +export enum WebhookRequestParameters { + File = VariableType.File, + String = TypesWithArray.String, + Number = TypesWithArray.Number, + Boolean = TypesWithArray.Boolean, +} diff --git a/web/src/pages/agent/form/begin-form/webhook/dynamic-request.tsx b/web/src/pages/agent/form/begin-form/webhook/dynamic-request.tsx index f84e26d16..15418a1f8 100644 --- a/web/src/pages/agent/form/begin-form/webhook/dynamic-request.tsx +++ b/web/src/pages/agent/form/begin-form/webhook/dynamic-request.tsx @@ -4,12 +4,13 @@ import { RAGFlowFormItem } from '@/components/ragflow-form'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { Switch } from '@/components/ui/switch'; +import { buildOptions } from '@/utils/form'; import { loader } from '@monaco-editor/react'; +import { omit } from 'lodash'; import { X } from 'lucide-react'; import { ReactNode } from 'react'; import { useFieldArray, useFormContext } from 'react-hook-form'; -import { TypesWithArray } from '../../../constant'; -import { buildConversationVariableSelectOptions } from '../../../utils'; +import { TypesWithArray, WebhookRequestParameters } from '../../../constant'; import { DynamicFormHeader } from '../../components/dynamic-fom-header'; loader.config({ paths: { vs: '/vs' } }); @@ -22,9 +23,16 @@ type SelectKeysProps = { operatorField?: string; requiredField?: string; nodeId?: string; + isObject?: boolean; }; -const VariableTypeOptions = buildConversationVariableSelectOptions(); +function buildParametersOptions(isObject: boolean) { + const list = isObject + ? WebhookRequestParameters + : omit(WebhookRequestParameters, ['File']); + + return buildOptions(list); +} export function DynamicRequest({ name, @@ -33,6 +41,7 @@ export function DynamicRequest({ keyField = 'key', operatorField = 'type', requiredField = 'required', + isObject = false, }: SelectKeysProps) { const form = useFormContext(); @@ -75,7 +84,7 @@ export function DynamicRequest({ onChange={(val) => { field.onChange(val); }} - options={VariableTypeOptions} + options={buildParametersOptions(isObject)} > )} diff --git a/web/src/pages/agent/form/begin-form/webhook/request-schema.tsx b/web/src/pages/agent/form/begin-form/webhook/request-schema.tsx index 6fe78e60b..9ab77b9d0 100644 --- a/web/src/pages/agent/form/begin-form/webhook/request-schema.tsx +++ b/web/src/pages/agent/form/begin-form/webhook/request-schema.tsx @@ -18,6 +18,7 @@ export function WebhookRequestSchema() { >