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
|
|
@ -96,9 +96,9 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, onMounted, ref, watch } from 'vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api.ts'
|
||||
import { useRoute } from 'vue-router'
|
||||
import {ref, watch} from 'vue'
|
||||
import {MsgError} from "@/utils/message.ts";
|
||||
import {t} from "@/locales";
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
@ -153,6 +153,12 @@ const open = (data: any, selectOptions: any) => {
|
|||
const submit = () => {
|
||||
paramFormRef.value.validate((valid: any) => {
|
||||
if (valid) {
|
||||
try {
|
||||
JSON.parse(form.value.mcp_servers)
|
||||
} catch (e) {
|
||||
MsgError(t('views.applicationWorkflow.nodes.mcpNode.mcpServerTip'))
|
||||
return
|
||||
}
|
||||
emit('refresh', form.value)
|
||||
dialogVisible.value = false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue