fix: 彻底修复 TDZ 错误和用户消息不显示问题
1. agent-engine.ts: onNewIteration 改用 prevToolCalls 传递上一轮工具调用, 避免引用未声明的 toolCalls 导致 TDZ (Cannot access 'B' before initialization) 2. chat-area.ts: 新增 resetCurrentPlaceholder() 清理悬空 DOM 引用 3. input-area.ts: 错误处理器删除 placeholder 后清理 currentPlaceholder 引用, 防止后续 updateLastAssistantMessage 操作已脱离 DOM 的旧节点
This commit is contained in:
@@ -495,6 +495,13 @@ export function clearMessages(): void {
|
||||
currentPlaceholder = null;
|
||||
}
|
||||
|
||||
/** 清理 currentPlaceholder 引用(当 placeholder 从外部被移除时调用) */
|
||||
export function resetCurrentPlaceholder(): void {
|
||||
if (currentPlaceholder && !currentPlaceholder.isConnected) {
|
||||
currentPlaceholder = null;
|
||||
}
|
||||
}
|
||||
|
||||
export function enableAutoScroll(): void {
|
||||
autoScroll = true;
|
||||
if (scrollBtnEl) scrollBtnEl.style.display = 'none';
|
||||
|
||||
Reference in New Issue
Block a user