fix: 修复多个问题
- fix(core): 修复 todoManager 未初始化导致待办工具无法使用 - fix(core): 为 LSP 初始化添加 10 秒超时,防止 write_file 卡住 - fix(ui): 停止对话时保留已流式输出的内容
This commit is contained in:
@@ -341,7 +341,26 @@ export function useChat({ sessionId, onError, onSessionNotFound, onSessionUpdate
|
||||
})
|
||||
);
|
||||
|
||||
setState((prev) => ({ ...prev, isLoading: false, streamingMessage: null }));
|
||||
// 保留已流式输出的内容作为消息
|
||||
setState((prev) => {
|
||||
const streaming = prev.streamingMessage;
|
||||
// 如果有流式消息且有内容,保存到 messages 中
|
||||
if (streaming && (streaming.content || streaming.parts.length > 0)) {
|
||||
const cancelledMessage: Message = {
|
||||
...streaming,
|
||||
id: streaming.id || `cancelled-${Date.now()}`,
|
||||
// 标记为已取消(可选:在 content 末尾添加提示)
|
||||
content: streaming.content || '',
|
||||
};
|
||||
return {
|
||||
...prev,
|
||||
messages: [...prev.messages, cancelledMessage],
|
||||
isLoading: false,
|
||||
streamingMessage: null,
|
||||
};
|
||||
}
|
||||
return { ...prev, isLoading: false, streamingMessage: null };
|
||||
});
|
||||
}, [sessionId]);
|
||||
|
||||
// 发送权限响应
|
||||
|
||||
Reference in New Issue
Block a user