From c16bcef5a615bc2a6ebd67c67ea7486e6e5d40ed Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 13 May 2024 21:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91AI=EF=BC=9A?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E8=A7=92=E8=89=B2=E7=AE=A1=E7=90=86=EF=BC=88?= =?UTF-8?q?80%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/model/apiKey/index.ts | 2 +- src/api/ai/model/chatModel/index.ts | 10 ++++ .../ai/model/chatModel/ChatModelForm.vue | 8 ++-- src/views/ai/model/chatModel/index.vue | 3 +- src/views/ai/model/chatRole/ChatRoleForm.vue | 46 +++++++++++++------ src/views/ai/model/chatRole/index.vue | 22 ++++----- 6 files changed, 55 insertions(+), 36 deletions(-) diff --git a/src/api/ai/model/apiKey/index.ts b/src/api/ai/model/apiKey/index.ts index 60d8a46c..ed94836e 100644 --- a/src/api/ai/model/apiKey/index.ts +++ b/src/api/ai/model/apiKey/index.ts @@ -18,7 +18,7 @@ export const ApiKeyApi = { }, // 获得 API 密钥列表 - getApiKeyList: async () => { + getApiKeySimpleList: async () => { return await request.get({ url: `/ai/api-key/simple-list` }) }, diff --git a/src/api/ai/model/chatModel/index.ts b/src/api/ai/model/chatModel/index.ts index 09f8d66b..c2ef4c8d 100644 --- a/src/api/ai/model/chatModel/index.ts +++ b/src/api/ai/model/chatModel/index.ts @@ -21,6 +21,16 @@ export const ChatModelApi = { return await request.get({ url: `/ai/chat-model/page`, params }) }, + // 获得聊天模型列表 + getChatModelSimpleList: async (status?: number) => { + return await request.get({ + url: `/ai/chat-model/simple-list`, + params: { + status + } + }) + }, + // 查询聊天模型详情 getChatModel: async (id: number) => { return await request.get({ url: `/ai/chat-model/get?id=` + id }) diff --git a/src/views/ai/model/chatModel/ChatModelForm.vue b/src/views/ai/model/chatModel/ChatModelForm.vue index b8651d58..cac3f772 100644 --- a/src/views/ai/model/chatModel/ChatModelForm.vue +++ b/src/views/ai/model/chatModel/ChatModelForm.vue @@ -33,10 +33,10 @@ - - + + - + { } } // 获得下拉数据 - apiKeyList.value = await ApiKeyApi.getApiKeyList(CommonStatusEnum.ENABLE) + apiKeyList.value = await ApiKeyApi.getApiKeySimpleList(CommonStatusEnum.ENABLE) } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 diff --git a/src/views/ai/model/chatModel/index.vue b/src/views/ai/model/chatModel/index.vue index 30449ea6..c5506746 100644 --- a/src/views/ai/model/chatModel/index.vue +++ b/src/views/ai/model/chatModel/index.vue @@ -109,7 +109,6 @@ diff --git a/src/views/ai/model/chatRole/ChatRoleForm.vue b/src/views/ai/model/chatRole/ChatRoleForm.vue index 1e184bff..b83dea51 100644 --- a/src/views/ai/model/chatRole/ChatRoleForm.vue +++ b/src/views/ai/model/chatRole/ChatRoleForm.vue @@ -7,29 +7,37 @@ label-width="100px" v-loading="formLoading" > - - - - + + + + + + - - - - + - + - + @@ -42,7 +50,10 @@ - + + + + import { getIntDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict' import { ChatRoleApi, ChatRoleVO } from '@/api/ai/model/chatRole' +import { CommonStatusEnum } from '@/utils/constants' +import { ChatModelApi, ChatModelVO } from '@/api/ai/model/chatModel' /** AI 聊天角色 表单 */ defineOptions({ name: 'ChatRoleForm' }) @@ -84,8 +97,8 @@ const formData = ref({ description: undefined, welcomeMessage: undefined, systemMessage: undefined, - publicStatus: undefined, - status: undefined + publicStatus: true, + status: CommonStatusEnum.ENABLE }) const formRules = reactive({ name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }], @@ -98,6 +111,7 @@ const formRules = reactive({ publicStatus: [{ required: true, message: '是否公开不能为空', trigger: 'blur' }] }) const formRef = ref() // 表单 Ref +const chatModelList = ref([] as ChatModelVO[]) // 聊天模型列表 /** 打开弹窗 */ const open = async (type: string, id?: number) => { @@ -114,6 +128,8 @@ const open = async (type: string, id?: number) => { formLoading.value = false } } + // 获得下拉数据 + chatModelList.value = await ChatModelApi.getChatModelSimpleList(CommonStatusEnum.ENABLE) } defineExpose({ open }) // 提供 open 方法,用于打开弹窗 @@ -153,8 +169,8 @@ const resetForm = () => { description: undefined, welcomeMessage: undefined, systemMessage: undefined, - publicStatus: undefined, - status: undefined + publicStatus: true, + status: CommonStatusEnum.ENABLE } formRef.value?.resetFields() } diff --git a/src/views/ai/model/chatRole/index.vue b/src/views/ai/model/chatRole/index.vue index 40759e87..552d9a68 100644 --- a/src/views/ai/model/chatRole/index.vue +++ b/src/views/ai/model/chatRole/index.vue @@ -59,13 +59,14 @@ - - - - + + + + - @@ -79,13 +80,7 @@ - +