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 @@ - +