From 56c4ed366f04477cca184fff0f7709d61979ae3b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 14 Mar 2025 21:11:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E3=80=91AI=EF=BC=9A=E5=A2=9E=E5=8A=A0=20AI=20=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=EF=BC=8C=E4=B8=8E=20tool=20=E7=9A=84=E6=89=93?= =?UTF-8?q?=E9=80=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/model/chatRole/index.ts | 3 ++- src/api/ai/model/tool/index.ts | 5 +++++ src/views/ai/model/chatRole/ChatRoleForm.vue | 15 +++++++++++++-- src/views/ai/model/chatRole/index.vue | 6 ++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/api/ai/model/chatRole/index.ts b/src/api/ai/model/chatRole/index.ts index 8969f68e..6c5511a5 100644 --- a/src/api/ai/model/chatRole/index.ts +++ b/src/api/ai/model/chatRole/index.ts @@ -13,7 +13,8 @@ export interface ChatRoleVO { welcomeMessage: string // 角色设定 publicStatus: boolean // 是否公开 status: number // 状态 - knowledgeIds?: number[] // 引用的知识库ID列表 + knowledgeIds?: number[] // 引用的知识库 ID 列表 + toolIds?: number[] // 引用的工具 ID 列表 } // AI 聊天角色 分页请求 vo diff --git a/src/api/ai/model/tool/index.ts b/src/api/ai/model/tool/index.ts index 7926fa86..bfb896a9 100644 --- a/src/api/ai/model/tool/index.ts +++ b/src/api/ai/model/tool/index.ts @@ -33,5 +33,10 @@ export const ToolApi = { // 删除工具 deleteTool: async (id: number) => { return await request.delete({ url: `/ai/tool/delete?id=` + id }) + }, + + // 获取工具简单列表 + getToolSimpleList: async () => { + return await request.get({ url: `/ai/tool/simple-list` }) } } diff --git a/src/views/ai/model/chatRole/ChatRoleForm.vue b/src/views/ai/model/chatRole/ChatRoleForm.vue index e22cb483..ebfd600c 100644 --- a/src/views/ai/model/chatRole/ChatRoleForm.vue +++ b/src/views/ai/model/chatRole/ChatRoleForm.vue @@ -42,6 +42,11 @@ /> + + + + + { @@ -145,6 +153,8 @@ const open = async (type: string, id?: number, title?: string) => { models.value = await ModelApi.getModelSimpleList(AiModelTypeEnum.CHAT) // 获取知识库列表 knowledgeList.value = await KnowledgeApi.getSimpleKnowledgeList() + // 获取工具列表 + toolList.value = await ToolApi.getToolSimpleList() } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -193,7 +203,8 @@ const resetForm = () => { systemMessage: undefined, publicStatus: true, status: CommonStatusEnum.ENABLE, - knowledgeIds: [] + knowledgeIds: [], + toolIds: [] } formRef.value?.resetFields() } diff --git a/src/views/ai/model/chatRole/index.vue b/src/views/ai/model/chatRole/index.vue index 88983cf0..d3d4e4eb 100644 --- a/src/views/ai/model/chatRole/index.vue +++ b/src/views/ai/model/chatRole/index.vue @@ -75,6 +75,12 @@ 引用 {{ scope.row.knowledgeIds.length }} 个 + + +