Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Feat: Displaying the file option in the webhook's request body #10427 (#11928)

balibabu0fcb1680fd33
diff --git a/web/src/pages/agent/constant/index.tsx b/web/src/pages/agent/constant/index.tsx
index f1c4bab1bd..d096afa5fc 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 f84e26d165..15418a1f8a 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)}
></SelectWithSearch>
)}
</RAGFlowFormItem>
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 6fe78e60b1..9ab77b9d07 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() {
></DynamicRequest>
<DynamicRequest
name="schema.body"
+ isObject
label={t('flow.webhook.requestBodyParameters')}
></DynamicRequest>
</section>