From 47e1cd9c1d2e9536833a13095240df3439ec4e3d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 9 Mar 2025 17:38:44 +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=E8=81=8A=E5=A4=A9=E8=A7=92=E8=89=B2?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=20knowledge=20=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/knowledge/knowledge/index.ts | 5 +++++ src/api/ai/model/chatRole/index.ts | 1 + src/views/ai/model/chatRole/ChatRoleForm.vue | 20 ++++++++++++++++++-- src/views/ai/model/chatRole/index.vue | 6 ++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/api/ai/knowledge/knowledge/index.ts b/src/api/ai/knowledge/knowledge/index.ts index 444048d5..f9d36837 100644 --- a/src/api/ai/knowledge/knowledge/index.ts +++ b/src/api/ai/knowledge/knowledge/index.ts @@ -35,5 +35,10 @@ export const KnowledgeApi = { // 删除知识库 deleteKnowledge: async (id: number) => { return await request.delete({ url: `/ai/knowledge/delete?id=` + id }) + }, + + // 获取知识库简单列表 + getSimpleKnowledgeList: async () => { + return await request.get({ url: `/ai/knowledge/simple-list` }) } } diff --git a/src/api/ai/model/chatRole/index.ts b/src/api/ai/model/chatRole/index.ts index a9fce13c..8969f68e 100644 --- a/src/api/ai/model/chatRole/index.ts +++ b/src/api/ai/model/chatRole/index.ts @@ -13,6 +13,7 @@ export interface ChatRoleVO { welcomeMessage: string // 角色设定 publicStatus: boolean // 是否公开 status: number // 状态 + knowledgeIds?: number[] // 引用的知识库ID列表 } // AI 聊天角色 分页请求 vo diff --git a/src/views/ai/model/chatRole/ChatRoleForm.vue b/src/views/ai/model/chatRole/ChatRoleForm.vue index 10d033bd..e22cb483 100644 --- a/src/views/ai/model/chatRole/ChatRoleForm.vue +++ b/src/views/ai/model/chatRole/ChatRoleForm.vue @@ -32,6 +32,16 @@ + + + + + { @@ -130,6 +143,8 @@ const open = async (type: string, id?: number, title?: string) => { } // 获得下拉数据 models.value = await ModelApi.getModelSimpleList(AiModelTypeEnum.CHAT) + // 获取知识库列表 + knowledgeList.value = await KnowledgeApi.getSimpleKnowledgeList() } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -177,7 +192,8 @@ const resetForm = () => { description: undefined, systemMessage: undefined, publicStatus: true, - status: CommonStatusEnum.ENABLE + status: CommonStatusEnum.ENABLE, + knowledgeIds: [] } formRef.value?.resetFields() } diff --git a/src/views/ai/model/chatRole/index.vue b/src/views/ai/model/chatRole/index.vue index e870a556..88983cf0 100644 --- a/src/views/ai/model/chatRole/index.vue +++ b/src/views/ai/model/chatRole/index.vue @@ -69,6 +69,12 @@ + + +