mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### 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)
This commit is contained in:
@ -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,
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -18,6 +18,7 @@ export function WebhookRequestSchema() {
|
||||
></DynamicRequest>
|
||||
<DynamicRequest
|
||||
name="schema.body"
|
||||
isObject
|
||||
label={t('flow.webhook.requestBodyParameters')}
|
||||
></DynamicRequest>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user