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; }