mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-03 02:55:29 +08:00
### What problem does this PR solve? Feat: Hide the autoplay switch for message operators in webhook mode. #10427 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -60,7 +60,8 @@ function MessageForm({ node }: INextOperatorForm) {
|
|||||||
control: form.control,
|
control: form.control,
|
||||||
});
|
});
|
||||||
|
|
||||||
const showWebhookResponseStatus = useShowWebhookResponseStatus(form);
|
const { showWebhookResponseStatus, isWebhookMode } =
|
||||||
|
useShowWebhookResponseStatus(form);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
@ -108,7 +109,7 @@ function MessageForm({ node }: INextOperatorForm) {
|
|||||||
</div>
|
</div>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{!showWebhookResponseStatus && (
|
{!isWebhookMode && (
|
||||||
<>
|
<>
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel tooltip={t('flow.downloadFileTypeTip')}>
|
<FormLabel tooltip={t('flow.downloadFileTypeTip')}>
|
||||||
|
|||||||
@ -7,18 +7,20 @@ import {
|
|||||||
WebhookExecutionMode,
|
WebhookExecutionMode,
|
||||||
} from '../../constant';
|
} from '../../constant';
|
||||||
import useGraphStore from '../../store';
|
import useGraphStore from '../../store';
|
||||||
import { BeginFormSchemaType } from '../begin-form/schema';
|
|
||||||
|
|
||||||
export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
||||||
const getNode = useGraphStore((state) => state.getNode);
|
const getNode = useGraphStore((state) => state.getNode);
|
||||||
|
|
||||||
|
const formData = getNode(BeginId)?.data.form;
|
||||||
|
|
||||||
|
const isWebhookMode = formData?.mode === AgentDialogueMode.Webhook;
|
||||||
|
|
||||||
const showWebhookResponseStatus = useMemo(() => {
|
const showWebhookResponseStatus = useMemo(() => {
|
||||||
const formData: BeginFormSchemaType = getNode(BeginId)?.data.form;
|
|
||||||
return (
|
return (
|
||||||
formData?.mode === AgentDialogueMode.Webhook &&
|
isWebhookMode &&
|
||||||
formData?.execution_mode === WebhookExecutionMode.Streaming
|
formData?.execution_mode === WebhookExecutionMode.Streaming
|
||||||
);
|
);
|
||||||
}, [getNode]);
|
}, [formData?.execution_mode, isWebhookMode]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (showWebhookResponseStatus && isEmpty(form.getValues('status'))) {
|
if (showWebhookResponseStatus && isEmpty(form.getValues('status'))) {
|
||||||
@ -26,5 +28,5 @@ export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
|||||||
}
|
}
|
||||||
}, [form, showWebhookResponseStatus]);
|
}, [form, showWebhookResponseStatus]);
|
||||||
|
|
||||||
return showWebhookResponseStatus;
|
return { showWebhookResponseStatus, isWebhookMode };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user