对话接口修正

This commit is contained in:
2025-11-26 15:01:25 +08:00
parent ba53dc9c20
commit 8ad363c143

View File

@@ -5,6 +5,7 @@
*/
import { api } from '@/apis/index';
import { API_BASE_URL } from '@/config';
import type {
AiConversation,
AiMessage,
@@ -49,7 +50,7 @@ export const chatApi = {
// 第2步GET建立SSE连接
const eventSource = new EventSource(
`/api/ai/chat/stream?sessionId=${sessionId}&token=${tokenData}`
`${API_BASE_URL}/ai/chat/stream?sessionId=${sessionId}&token=${tokenData}`
);
// 通知外部EventSource已创建
@@ -304,9 +305,9 @@ export const chatApi = {
const tokenData = token ? JSON.parse(token) : null;
return new Promise((resolve, reject) => {
// 使用相对路径走Vite代理SSE流式推送
// 使用配置的baseURLSSE流式推送
const eventSource = new EventSource(
`/api/ai/chat/regenerate/${messageId}?` +
`${API_BASE_URL}/ai/chat/regenerate/${messageId}?` +
new URLSearchParams({
token: tokenData?.value || ''
})