99 <template #header >
1010 <DrawerHeader :header =" $t('menu.config')" :back =" handleClose" />
1111 </template >
12- <el-input type =" textarea" :autosize =" { minRows: 10, maxRows: 20 }" v-model =" prettyJson" readonly />
12+ <codemirror
13+ :autofocus =" true"
14+ :placeholder =" $t('commons.msg.noneData')"
15+ :indent-with-tab =" true"
16+ :tabSize =" 4"
17+ style =" height : 300px "
18+ :lineWrapping =" true"
19+ :matchBrackets =" true"
20+ theme =" cobalt"
21+ :styleActiveLine =" true"
22+ :extensions =" extensions"
23+ v-model =" prettyJson"
24+ :disabled =" true"
25+ />
1326 <CopyButton :content =" prettyJson" class =" mt-2" />
1427 <template #footer >
1528 <el-button @click =" handleClose" >{{ $t('commons.button.cancel') }}</el-button >
2033<script lang="ts" setup>
2134import { AI } from ' @/api/interface/ai' ;
2235import { ref } from ' vue' ;
36+ import { Codemirror } from ' vue-codemirror' ;
37+ import { javascript } from ' @codemirror/lang-javascript' ;
38+ import { oneDark } from ' @codemirror/theme-one-dark' ;
39+
40+ const extensions = [javascript (), oneDark ];
2341
2442const open = ref (false );
2543const jsonObj = ref ({
@@ -35,13 +53,7 @@ const acceptParams = (mcpServer: AI.McpServer) => {
3553 jsonObj .value .mcpServers [mcpServer .name ] = {
3654 url: mcpServer .baseUrl + mcpServer .ssePath ,
3755 };
38- if (mcpServer .environments ) {
39- jsonObj .value .mcpServers [mcpServer .name ].env = {};
40- for (const env of mcpServer .environments ) {
41- jsonObj .value .mcpServers [mcpServer .name ].env [env .key ] = env .value ;
42- }
43- }
44- prettyJson .value = JSON .stringify (jsonObj .value , null , 4 );
56+ prettyJson .value = JSON .stringify (jsonObj .value , null , 2 );
4557 open .value = true ;
4658};
4759
0 commit comments