fix(conversation): 修复实时会话 TTS/回复被离屏 WS 抢占
- 列表预热仅预取消息缓存,避免后台 WebSocket 覆盖服务端连接 - RealtimeSession UI 回调按 owner 独占,防止 offscreen 覆盖聊天页 - 列表页聚焦时再 prewarm,会话页 TTS 入队优先 base64 - 管线下发 TTS 同时带 audio_base64 与 audio_url;协议说明同步 - 移除 TTS 排查用前后端调试日志,保留错误/告警 - 补充 WS / RealtimeSession / entry-warmup / 播放器相关单测 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { QueryClient } from '@tanstack/react-query';
|
||||
|
||||
import {
|
||||
prewarmConversationSession,
|
||||
prefetchConversationMessages,
|
||||
warmupConversationOpening,
|
||||
} from '@/features/conversation/entry-warmup';
|
||||
@@ -90,6 +91,20 @@ describe('conversation entry warmup', () => {
|
||||
).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
test('prewarms existing conversations without opening an offscreen websocket', async () => {
|
||||
const existing = assistantMessage();
|
||||
mockLoadMessages.mockResolvedValueOnce([existing]);
|
||||
|
||||
prewarmConversationSession(queryClient, 'conv-1');
|
||||
await new Promise((r) => setImmediate(r));
|
||||
|
||||
expect(mockLoadMessages).toHaveBeenCalledWith('conv-1');
|
||||
expect(mockSessions).toHaveLength(0);
|
||||
expect(
|
||||
queryClient.getQueryData(conversationKeys.messages('conv-1')),
|
||||
).toEqual([existing]);
|
||||
});
|
||||
|
||||
test('uses refreshed history and skips websocket when opening is already cached', async () => {
|
||||
const existing = assistantMessage();
|
||||
mockLoadMessages.mockResolvedValueOnce([existing]);
|
||||
|
||||
Reference in New Issue
Block a user