From 90e8dbe449a39c9cdd0b15026cb0149a366757a9 Mon Sep 17 00:00:00 2001 From: Gsh <15170702455@163.com> Date: Fri, 18 Jul 2025 20:33:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=B9=E8=AF=9D=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Ai.Vue3/src/api/chat/index.ts | 2 +- Yi.Ai.Vue3/src/api/chat/types.ts | 1 + Yi.Ai.Vue3/src/pages/chat/layouts/chatWithId/index.vue | 10 +++------- Yi.Ai.Vue3/types/import_meta.d.ts | 1 + 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Yi.Ai.Vue3/src/api/chat/index.ts b/Yi.Ai.Vue3/src/api/chat/index.ts index 58b37f65..d1d61553 100644 --- a/Yi.Ai.Vue3/src/api/chat/index.ts +++ b/Yi.Ai.Vue3/src/api/chat/index.ts @@ -2,7 +2,7 @@ import type { ChatMessageVo, GetChatListParams, SendDTO } from './types'; import { get, post } from '@/utils/request'; // 发送消息 -export const send = (data: SendDTO) => post('/ai-chat/send', data); +export const send = (data: SendDTO) => post(`/ai-chat/send/${data.sessionId}`, data); // 新增对应会话聊天记录 export function addChat(data: ChatMessageVo) { diff --git a/Yi.Ai.Vue3/src/api/chat/types.ts b/Yi.Ai.Vue3/src/api/chat/types.ts index 57fb29ef..c53d18e1 100644 --- a/Yi.Ai.Vue3/src/api/chat/types.ts +++ b/Yi.Ai.Vue3/src/api/chat/types.ts @@ -49,6 +49,7 @@ export interface SendDTO { * 是否携带上下文 */ usingContext?: boolean; + } /** diff --git a/Yi.Ai.Vue3/src/pages/chat/layouts/chatWithId/index.vue b/Yi.Ai.Vue3/src/pages/chat/layouts/chatWithId/index.vue index 6e50f1a8..0a3adddc 100644 --- a/Yi.Ai.Vue3/src/pages/chat/layouts/chatWithId/index.vue +++ b/Yi.Ai.Vue3/src/pages/chat/layouts/chatWithId/index.vue @@ -188,14 +188,10 @@ async function startSSE(chatContent: string) { ? `${item.content.substring(0, 2000)}...(内容过长,已省略)` : item.content, })), - // sessionId: route.params?.id !== 'not_login' ? String(route.params?.id) : undefined, - // userId: userStore.userInfo?.userId, - // model: modelStore.currentModelInfo.modelId ?? '', - - sessionId: route.query?.sessionId !== 'not_login' ? String(route.query?.sessionId) : undefined, // 修改点:sessionId 从 query 参数中获取 + sessionId: route.params?.id !== 'not_login' ? String(route.params?.id) : undefined, + stream: true, userId: userStore.userInfo?.userId, - model: modelStore.currentModelInfo.modelId ?? '', // 修改点:modelId 改为 model - + model: modelStore.currentModelInfo.modelId ?? '', })) { handleDataChunk(chunk.result as AnyObject); } diff --git a/Yi.Ai.Vue3/types/import_meta.d.ts b/Yi.Ai.Vue3/types/import_meta.d.ts index b3e9d275..d8a60d41 100644 --- a/Yi.Ai.Vue3/types/import_meta.d.ts +++ b/Yi.Ai.Vue3/types/import_meta.d.ts @@ -6,6 +6,7 @@ interface ImportMetaEnv { readonly VITE_WEB_ENV: string; readonly VITE_WEB_BASE_API: string; readonly VITE_API_URL: string; + readonly VITE_BUILD_COMPRESS: string; readonly VITE_SSO_SEVER_URL: string; readonly VITE_APP_VERSION: string; }