Feat: Hide the autoplay switch for message operators in webhook mode. #10427 (#12216)

### 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:
balibabu
2025-12-25 19:44:03 +08:00
committed by GitHub
parent c7b5bfb809
commit fd53b83190
2 changed files with 10 additions and 7 deletions

View File

@ -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')}>

View File

@ -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 };
} }