fix: 未登录对话id逻辑玩优化

This commit is contained in:
Gsh
2025-08-03 21:56:51 +08:00
parent 71bd885bd0
commit faa8131a1b
2 changed files with 7 additions and 2 deletions

View File

@@ -2,7 +2,12 @@ import type { ChatMessageVo, GetChatListParams, SendDTO } from './types';
import { get, post } from '@/utils/request';
// 发送消息
export const send = (data: SendDTO) => post<null>(`/ai-chat/send/${data.sessionId}`, data);
export function send(data: SendDTO) {
const url = data.sessionId !== 'not_login'
? `/ai-chat/send/?sessionId=${data.sessionId}`
: '/ai-chat/send';
return post(url, data);
}
// 新增对应会话聊天记录
export function addChat(data: ChatMessageVo) {

View File

@@ -188,7 +188,7 @@ async function startSSE(chatContent: string) {
? `${item.content.substring(0, 2000)}...(内容过长,已省略)`
: item.content,
})),
sessionId: route.params?.id !== 'not_login' ? String(route.params?.id) : undefined,
sessionId: route.params?.id !== 'not_login' ? String(route.params?.id) : 'not_login',
stream: true,
userId: userStore.userInfo?.userId,
model: modelStore.currentModelInfo.modelId ?? '',