fix: improve formatting and add JSON validation in McpServersDialog
--bug=1060753 --user=刘瑞斌 【应用】AI对话节点的MCP使用自定义方式,配置格式错误依然可以保存成功 https://www.tapd.cn/62980211/s/1760128v3.2
parent
1e05eb18e1
commit
c39d7a4102
|
|
@ -49,7 +49,7 @@
|
||||||
>
|
>
|
||||||
<div class="flex align-center">
|
<div class="flex align-center">
|
||||||
<el-avatar shape="square" :size="20" class="mr-8">
|
<el-avatar shape="square" :size="20" class="mr-8">
|
||||||
<img src="@/assets/workflow/icon_mcp.svg" style="width: 75%" alt="" />
|
<img src="@/assets/workflow/icon_mcp.svg" style="width: 75%" alt=""/>
|
||||||
</el-avatar>
|
</el-avatar>
|
||||||
<span>{{ mcpTool.name }}</span>
|
<span>{{ mcpTool.name }}</span>
|
||||||
<el-tag v-if="mcpTool.scope === 'SHARED'" type="info" class="info-tag ml-8 mt-4">
|
<el-tag v-if="mcpTool.scope === 'SHARED'" type="info" class="info-tag ml-8 mt-4">
|
||||||
|
|
@ -96,9 +96,9 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, inject, onMounted, ref, watch } from 'vue'
|
import {ref, watch} from 'vue'
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts'
|
import {MsgError} from "@/utils/message.ts";
|
||||||
import { useRoute } from 'vue-router'
|
import {t} from "@/locales";
|
||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ function mcpSourceChange() {
|
||||||
|
|
||||||
|
|
||||||
const open = (data: any, selectOptions: any) => {
|
const open = (data: any, selectOptions: any) => {
|
||||||
form.value = { ...form.value, ...data }
|
form.value = {...form.value, ...data}
|
||||||
form.value.mcp_source = data.mcp_source || 'referencing'
|
form.value.mcp_source = data.mcp_source || 'referencing'
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
mcpToolSelectOptions.value = selectOptions || []
|
mcpToolSelectOptions.value = selectOptions || []
|
||||||
|
|
@ -153,12 +153,18 @@ const open = (data: any, selectOptions: any) => {
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
paramFormRef.value.validate((valid: any) => {
|
paramFormRef.value.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
try {
|
||||||
|
JSON.parse(form.value.mcp_servers)
|
||||||
|
} catch (e) {
|
||||||
|
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
|
||||||
|
return
|
||||||
|
}
|
||||||
emit('refresh', form.value)
|
emit('refresh', form.value)
|
||||||
dialogVisible.value = false
|
dialogVisible.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ open })
|
defineExpose({open})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue