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,
});
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')}>

View File

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