fix: 工作流完整性和协调性修复
修复 6 个问题: 1. 新一轮对话清理上轮工具卡片和终端输出(避免越积越多) 2. 中止 Agent Loop 时保留已执行的工具记录(不再丢失) 3. 切换历史会话时清理工作空间状态 4. handleRetry 保存 think 内容(之前丢失) 5. 中止流程统一:agent-engine 抛出 AbortError 由消费方处理(消除重复消息风险) 6. 导出 clearToolCardsExternal/clearTerminalExternal 供外部调用
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { state, KEYS } from '../state/state.js';
|
||||
import { debounce, escapeHtml, formatTime } from '../utils/utils.js';
|
||||
import { exportAsMarkdown, exportAsHtml, exportAsTxt, renderMessages, clearMessages, updateTotalTokens } from './chat-area.js';
|
||||
import { clearToolCardsExternal, clearTerminalExternal } from './workspace-panel.js';
|
||||
import { showConfirm } from './prompt-modal.js';
|
||||
import { ChatDB } from '../db/chat-db.js';
|
||||
import { logSession, logWarn } from '../services/log-service.js';
|
||||
@@ -179,6 +180,10 @@ async function loadHistorySession(sessionId: string): Promise<void> {
|
||||
(document.querySelector('#historyBar') as HTMLElement).style.display = '';
|
||||
(document.querySelector('#inputArea') as HTMLElement).style.display = 'none';
|
||||
|
||||
// 切换会话时清理工作空间状态
|
||||
clearToolCardsExternal();
|
||||
clearTerminalExternal();
|
||||
|
||||
clearMessages();
|
||||
renderMessages();
|
||||
updateTotalTokens();
|
||||
|
||||
Reference in New Issue
Block a user