From cea5b8b138d5d7033cae4ad0419b49ea314294a9 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Tue, 14 May 2024 15:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91chat=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20modal=20=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ai/chat/conversation/index.ts | 37 +++++++++++++++++++++++++++ src/views/ai/chat/index.vue | 21 ++++++++++++--- 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 src/api/ai/chat/conversation/index.ts diff --git a/src/api/ai/chat/conversation/index.ts b/src/api/ai/chat/conversation/index.ts new file mode 100644 index 00000000..6a78377f --- /dev/null +++ b/src/api/ai/chat/conversation/index.ts @@ -0,0 +1,37 @@ +import request from '@/config/axios' + +// 聊天VO +export interface ChatConversationVO { + id: string // 会话编号 + userId: string // 用户编号 + title: string // 会话标题 + pinned: string // 是否置顶 + roleId: string // 角色编号 + model: number // 模型标志 + modelId: number // 模型编号 + temperature: string // 温度参数 + maxTokens: string // 单条回复的最大 Token 数量 + maxContexts: string // 上下文的最大 Message 数量 +} + +export interface ChatConversationUpdateVO { + id: string // 会话编号 + title: string // 会话标题 + pinned: string // 是否置顶 + modelId: number // 模型编号 + temperature: string // 温度参数 + maxTokens: string // 单条回复的最大 Token 数量 + maxContexts: string // 上下文的最大 Message 数量 +} + +// AI chat 聊天 +export const ChatConversationApi = { + // 获取 Conversation + get: async (id: number) => { + return await request.get({ url: `/ai/chat/conversation/get?id=${id}`}) + }, + // 更新 Conversation + update: async (data: ChatConversationUpdateVO) => { + return await request.put({ url: `/ai/chat/conversation/update`, data}) + }, +} diff --git a/src/views/ai/chat/index.vue b/src/views/ai/chat/index.vue index 6a5fafdc..5bbd5e91 100644 --- a/src/views/ai/chat/index.vue +++ b/src/views/ai/chat/index.vue @@ -72,11 +72,11 @@ - GPT3.5 + @@ -176,7 +176,8 @@