feat:【ai 大模型】支持 Chat Role 的 mcp 配置

pull/788/MERGE
YunaiV 2025-08-28 23:30:20 +08:00
parent 93e3428982
commit da9c6799c8
3 changed files with 22 additions and 8 deletions

View File

@ -15,6 +15,7 @@ export interface ChatRoleVO {
status: number // 状态
knowledgeIds?: number[] // 引用的知识库 ID 列表
toolIds?: number[] // 引用的工具 ID 列表
mcpClientNames?: string[] // 引用的 MCP Client 名字列表
}
// AI 聊天角色 分页请求 vo
@ -57,26 +58,26 @@ export const ChatRoleApi = {
// 获取 my role
getMyPage: async (params: ChatRolePageReqVO) => {
return await request.get({ url: `/ai/chat-role/my-page`, params})
return await request.get({ url: `/ai/chat-role/my-page`, params })
},
// 获取角色分类
getCategoryList: async () => {
return await request.get({ url: `/ai/chat-role/category-list`})
return await request.get({ url: `/ai/chat-role/category-list` })
},
// 创建角色
createMy: async (data: ChatRoleVO) => {
return await request.post({ url: `/ai/chat-role/create-my`, data})
return await request.post({ url: `/ai/chat-role/create-my`, data })
},
// 更新角色
updateMy: async (data: ChatRoleVO) => {
return await request.put({ url: `/ai/chat-role/update-my`, data})
return await request.put({ url: `/ai/chat-role/update-my`, data })
},
// 删除角色 my
deleteMy: async (id: number) => {
return await request.delete({ url: `/ai/chat-role/delete-my?id=` + id })
},
}
}

View File

@ -227,6 +227,7 @@ export enum DICT_TYPE {
AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式
AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气
AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言
AI_MCP_CLIENT_NAME = 'ai_mcp_client_name', // AI MCP Client 名字
// ========== IOT - 物联网模块 ==========
IOT_NET_TYPE = 'iot_net_type', // IOT 联网方式

View File

@ -47,6 +47,16 @@
<el-option v-for="item in toolList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="引用 MCP" prop="toolIds">
<el-select v-model="formData.mcpClientNames" placeholder="请选择 MCP" clearable multiple>
<el-option
v-for="dict in getStrDictOptions(DICT_TYPE.AI_MCP_CLIENT_NAME)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否公开" prop="publicStatus" v-if="!isUser">
<el-radio-group v-model="formData.publicStatus">
<el-radio
@ -80,7 +90,7 @@
</Dialog>
</template>
<script setup lang="ts">
import { getIntDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
import { getIntDictOptions, getBoolDictOptions, DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { ChatRoleApi, ChatRoleVO } from '@/api/ai/model/chatRole'
import { CommonStatusEnum } from '@/utils/constants'
import { ModelApi, ModelVO } from '@/api/ai/model/model'
@ -111,7 +121,8 @@ const formData = ref({
publicStatus: true,
status: CommonStatusEnum.ENABLE,
knowledgeIds: [] as number[],
toolIds: [] as number[]
toolIds: [] as number[],
mcpClientNames: [] as string[]
})
const formRef = ref() // Ref
const models = ref([] as ModelVO[]) //
@ -204,7 +215,8 @@ const resetForm = () => {
publicStatus: true,
status: CommonStatusEnum.ENABLE,
knowledgeIds: [],
toolIds: []
toolIds: [],
mcpClientNames: []
}
formRef.value?.resetFields()
}