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>
|
</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'])
|
||||||
|
|
||||||
|
|
@ -153,6 +153,12 @@ 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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue