fix: 未登录对话id逻辑玩优化
This commit is contained in:
@@ -2,7 +2,12 @@ import type { ChatMessageVo, GetChatListParams, SendDTO } from './types';
|
|||||||
import { get, post } from '@/utils/request';
|
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) {
|
export function addChat(data: ChatMessageVo) {
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ async function startSSE(chatContent: string) {
|
|||||||
? `${item.content.substring(0, 2000)}...(内容过长,已省略)`
|
? `${item.content.substring(0, 2000)}...(内容过长,已省略)`
|
||||||
: item.content,
|
: 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,
|
stream: true,
|
||||||
userId: userStore.userInfo?.userId,
|
userId: userStore.userInfo?.userId,
|
||||||
model: modelStore.currentModelInfo.modelId ?? '',
|
model: modelStore.currentModelInfo.modelId ?? '',
|
||||||
|
|||||||
Reference in New Issue
Block a user