mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 08:56:47 +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,
|
||||
});
|
||||
|
||||
const showWebhookResponseStatus = useShowWebhookResponseStatus(form);
|
||||
const { showWebhookResponseStatus, isWebhookMode } =
|
||||
useShowWebhookResponseStatus(form);
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
@ -108,7 +109,7 @@ function MessageForm({ node }: INextOperatorForm) {
|
||||
</div>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
{!showWebhookResponseStatus && (
|
||||
{!isWebhookMode && (
|
||||
<>
|
||||
<FormItem>
|
||||
<FormLabel tooltip={t('flow.downloadFileTypeTip')}>
|
||||
|
||||
@ -7,18 +7,20 @@ import {
|
||||
WebhookExecutionMode,
|
||||
} from '../../constant';
|
||||
import useGraphStore from '../../store';
|
||||
import { BeginFormSchemaType } from '../begin-form/schema';
|
||||
|
||||
export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
||||
const getNode = useGraphStore((state) => state.getNode);
|
||||
|
||||
const formData = getNode(BeginId)?.data.form;
|
||||
|
||||
const isWebhookMode = formData?.mode === AgentDialogueMode.Webhook;
|
||||
|
||||
const showWebhookResponseStatus = useMemo(() => {
|
||||
const formData: BeginFormSchemaType = getNode(BeginId)?.data.form;
|
||||
return (
|
||||
formData?.mode === AgentDialogueMode.Webhook &&
|
||||
isWebhookMode &&
|
||||
formData?.execution_mode === WebhookExecutionMode.Streaming
|
||||
);
|
||||
}, [getNode]);
|
||||
}, [formData?.execution_mode, isWebhookMode]);
|
||||
|
||||
useEffect(() => {
|
||||
if (showWebhookResponseStatus && isEmpty(form.getValues('status'))) {
|
||||
@ -26,5 +28,5 @@ export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
|
||||
}
|
||||
}, [form, showWebhookResponseStatus]);
|
||||
|
||||
return showWebhookResponseStatus;
|
||||
return { showWebhookResponseStatus, isWebhookMode };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user