refactor: enhance MCP server configuration tooltips and validation messages

--bug=1054206 --user=刘瑞斌 【应用】MCP节点不配置Server config,不选择工具,可以发布应用,对话时报错 https://www.tapd.cn/57709429/s/1679457
This commit is contained in:
CaptainB 2025-04-02 11:31:33 +08:00
parent 5b2baaf04d
commit fb0fdb9c85
4 changed files with 20 additions and 6 deletions

View File

@ -228,6 +228,7 @@ export default {
tool: 'Tool',
toolParam: 'Tool Params',
mcpServerTip: 'Please enter the JSON format of the MCP server config',
mcpToolTip: 'Please select a tool',
configLabel: 'MCP Server Config (Only supports SSE call method)',
},
imageGenerateNode: {

View File

@ -227,7 +227,8 @@ export default {
getTool: '获取工具',
tool: '工具',
toolParam: '工具参数',
mcpServerTip: '请输入 JSON 格式的 MCP 服务器配置',
mcpServerTip: '请输入JSON格式的MCP服务器配置',
mcpToolTip: '请选择工具',
configLabel: 'MCP Server Config (仅支持SSE调用方式)'
},
imageGenerateNode: {

View File

@ -227,7 +227,8 @@ export default {
getTool: '獲取工具',
tool: '工具',
toolParam: '工具變數',
mcpServerTip: '請輸入 JSON 格式的 MCP 服務器配置',
mcpServerTip: '請輸入JSON格式的MCP服務器配置',
mcpToolTip: '請選擇工具',
configLabel: 'MCP Server Config (僅支持SSE調用方式)',
},
imageGenerateNode: {

View File

@ -343,10 +343,21 @@ const validate = async () => {
}
}
}
let ps = [replyNodeFormRef.value?.validate()]
return Promise.all(ps).catch((err: any) => {
return Promise.reject({ node: props.nodeModel, errMessage: err })
})
if (replyNodeFormRef.value) {
const form = cloneDeep(form_data.value)
if (!form.mcp_servers) {
return Promise.reject({
node: props.nodeModel,
errMessage: t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip')
})
}
if (!form.mcp_tool) {
return Promise.reject({
node: props.nodeModel,
errMessage: t('views.applicationWorkflow.nodes.mcpNode.mcpToolTip')
})
}
}
}
onMounted(() => {