From 5e9882d15f4ad8b4d0c273327381e4a0397c4579 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Thu, 5 Nov 2026 09:55:33 +0800 Subject: [PATCH] fix: mcp setting dialog --- .../resource-setting/McpSettingDialog.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/src/workflow-canvas/nodes/ai-chat-node/component/resource-setting/McpSettingDialog.vue b/ui/src/workflow-canvas/nodes/ai-chat-node/component/resource-setting/McpSettingDialog.vue index ad14fc48334..6bde3eb995b 100644 --- a/ui/src/workflow-canvas/nodes/ai-chat-node/component/resource-setting/McpSettingDialog.vue +++ b/ui/src/workflow-canvas/nodes/ai-chat-node/component/resource-setting/McpSettingDialog.vue @@ -29,8 +29,17 @@ const formData = ref({ mcp_servers: '', mcp_source: 'referencing', m const mcpOptions = ref([]) const loading = ref(false) +// 接口可能返回对象配置;空对象表示未配置,非空对象转为 JSON 文本供输入框编辑。 +function normalizeMcpServers(value: unknown): string { + if (value == null) return '' + if (typeof value === 'string') return value + if (typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length === 0) return '' + return JSON.stringify(value, null, 2) ?? '' +} + function open(setting: McpSetting) { formData.value = cloneDeep(setting) + formData.value.mcp_servers = normalizeMcpServers(setting.mcp_servers) if (formData.value.mcp_servers) formData.value.mcp_source = 'custom' visible.value = true @@ -107,10 +116,14 @@ defineExpose({ open }) +