From ae632ac23bd5f3a1ff0a661975d3389d0b7f85ab Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 3 Mar 2025 21:26:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E3=80=91AI=EF=BC=9A=E2=80=9C=E8=81=8A=E5=A4=A9=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E2=80=9D=E9=87=8D=E6=9E=84=E4=B8=BA=E2=80=9C=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E2=80=9D=EF=BC=8C=E6=94=AF=E6=8C=81=20type=20?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/image/index.ts | 5 +- src/api/ai/model/chatModel/index.ts | 53 ----------- src/api/ai/model/model/index.ts | 54 ++++++++++++ src/utils/dict.ts | 1 + .../conversation/ConversationUpdateForm.vue | 8 +- .../chat/index/components/role/RoleList.vue | 6 +- .../components/{other => common}/index.vue | 88 ++++++++++--------- .../ai/image/index/components/dall3/index.vue | 65 +++++++++++--- src/views/ai/image/index/index.vue | 52 +++++++---- src/views/ai/model/chatRole/ChatRoleForm.vue | 7 +- .../ChatModelForm.vue => model/ModelForm.vue} | 58 +++++++++--- .../ai/model/{chatModel => model}/index.vue | 29 +++--- src/views/ai/utils/constants.ts | 34 ++----- 13 files changed, 276 insertions(+), 184 deletions(-) delete mode 100644 src/api/ai/model/chatModel/index.ts create mode 100644 src/api/ai/model/model/index.ts rename src/views/ai/image/index/components/{other => common}/index.vue (72%) rename src/views/ai/model/{chatModel/ChatModelForm.vue => model/ModelForm.vue} (77%) rename src/views/ai/model/{chatModel => model}/index.vue (87%) diff --git a/src/api/ai/image/index.ts b/src/api/ai/image/index.ts index 2f276c7e..ab2bcf72 100644 --- a/src/api/ai/image/index.ts +++ b/src/api/ai/image/index.ts @@ -20,9 +20,8 @@ export interface ImageVO { } export interface ImageDrawReqVO { - platform: string // 平台 prompt: string // 提示词 - model: string // 模型 + modelId: number // 模型 style: string // 图像生成的风格 width: string // 图片宽度 height: string // 图片高度 @@ -31,7 +30,7 @@ export interface ImageDrawReqVO { export interface ImageMidjourneyImagineReqVO { prompt: string // 提示词 - model: string // 模型 mj nijj + modelId: number // 模型 base64Array: string[] // size不能为空 width: string // 图片宽度 height: string // 图片高度 diff --git a/src/api/ai/model/chatModel/index.ts b/src/api/ai/model/chatModel/index.ts deleted file mode 100644 index c2ef4c8d..00000000 --- a/src/api/ai/model/chatModel/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import request from '@/config/axios' - -// AI 聊天模型 VO -export interface ChatModelVO { - id: number // 编号 - keyId: number // API 秘钥编号 - name: string // 模型名字 - model: string // 模型标识 - platform: string // 模型平台 - sort: number // 排序 - status: number // 状态 - temperature: number // 温度参数 - maxTokens: number // 单条回复的最大 Token 数量 - maxContexts: number // 上下文的最大 Message 数量 -} - -// AI 聊天模型 API -export const ChatModelApi = { - // 查询聊天模型分页 - getChatModelPage: async (params: any) => { - 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 }) - }, - - // 新增聊天模型 - createChatModel: async (data: ChatModelVO) => { - return await request.post({ url: `/ai/chat-model/create`, data }) - }, - - // 修改聊天模型 - updateChatModel: async (data: ChatModelVO) => { - return await request.put({ url: `/ai/chat-model/update`, data }) - }, - - // 删除聊天模型 - deleteChatModel: async (id: number) => { - return await request.delete({ url: `/ai/chat-model/delete?id=` + id }) - } -} diff --git a/src/api/ai/model/model/index.ts b/src/api/ai/model/model/index.ts new file mode 100644 index 00000000..187817ce --- /dev/null +++ b/src/api/ai/model/model/index.ts @@ -0,0 +1,54 @@ +import request from '@/config/axios' + +// AI 聊天模型 VO +export interface ModelVO { + id: number // 编号 + keyId: number // API 秘钥编号 + name: string // 模型名字 + model: string // 模型标识 + platform: string // 模型平台 + type: number // 模型类型 + sort: number // 排序 + status: number // 状态 + temperature?: number // 温度参数 + maxTokens?: number // 单条回复的最大 Token 数量 + maxContexts?: number // 上下文的最大 Message 数量 +} + +// AI 模型 API +export const ModelApi = { + // 查询模型分页 + getModelPage: async (params: any) => { + return await request.get({ url: `/ai/model/page`, params }) + }, + + // 获得模型列表 + getModelSimpleList: async (type?: number) => { + return await request.get({ + url: `/ai/model/simple-list`, + params: { + type + } + }) + }, + + // 查询模型详情 + getModel: async (id: number) => { + return await request.get({ url: `/ai/model/get?id=` + id }) + }, + + // 新增模型 + createModel: async (data: ModelVO) => { + return await request.post({ url: `/ai/model/create`, data }) + }, + + // 修改聊天模型 + updateModel: async (data: ModelVO) => { + return await request.put({ url: `/ai/model/update`, data }) + }, + + // 删除聊天模型 + deleteModel: async (id: number) => { + return await request.delete({ url: `/ai/model/delete?id=` + id }) + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 1134152b..f572bbe7 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -219,6 +219,7 @@ export enum DICT_TYPE { // ========== AI - 人工智能模块 ========== AI_PLATFORM = 'ai_platform', // AI 平台 + AI_MODEL_TYPE = 'ai_model_type', // AI 模型类型 AI_IMAGE_STATUS = 'ai_image_status', // AI 图片状态 AI_MUSIC_STATUS = 'ai_music_status', // AI 音乐状态 AI_GENERATE_MODE = 'ai_generate_mode', // AI 生成模式 diff --git a/src/views/ai/chat/index/components/conversation/ConversationUpdateForm.vue b/src/views/ai/chat/index/components/conversation/ConversationUpdateForm.vue index bff094fb..d4381c0c 100644 --- a/src/views/ai/chat/index/components/conversation/ConversationUpdateForm.vue +++ b/src/views/ai/chat/index/components/conversation/ConversationUpdateForm.vue @@ -58,9 +58,9 @@