v0.16.19: 修复日志面板清空、URL误传文件工具、网络工具超时、结果截断
This commit is contained in:
@@ -583,6 +583,25 @@ export function appendAssistantPlaceholder(): void {
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
/**
|
||||
* 确保 loading 占位符存在 — 如果当前没有 loading 占位符,创建一个。
|
||||
* 用于中间轮次 THINKING 开始前,确保用户看到"正在思考..."状态。
|
||||
*/
|
||||
export function ensureLoadingPlaceholder(): void {
|
||||
if (currentPlaceholder && currentPlaceholder.classList.contains('loading') && currentPlaceholder.isConnected) {
|
||||
return;
|
||||
}
|
||||
// 当前 placeholder 不存在或不是 loading 状态 → 清理旧 placeholder 并创建新的
|
||||
if (currentPlaceholder && !currentPlaceholder.classList.contains('loading') && currentPlaceholder.isConnected) {
|
||||
// 上一轮的 placeholder 已经被 updateLastAssistantMessage 转为正常消息但未通过 renderMessages 固化
|
||||
// 不需要移除,直接追加新的 loading
|
||||
}
|
||||
if (currentPlaceholder && !currentPlaceholder.isConnected) {
|
||||
currentPlaceholder = null;
|
||||
}
|
||||
appendAssistantPlaceholder();
|
||||
}
|
||||
|
||||
// R34: 加载提示旋转动画
|
||||
const LOADING_HINTS = [
|
||||
'正在思考...',
|
||||
|
||||
@@ -9,7 +9,7 @@ import { getSelectedModel, isThinkEnabled, isVisionAvailable, isToolCallingSuppo
|
||||
import {
|
||||
renderMessages, clearMessagesDOM, appendAssistantPlaceholder, appendSystemMessage,
|
||||
updateLastAssistantMessage, clearMessages, safeMarkdown, enableAutoScroll, resetAutoScroll,
|
||||
resetCurrentPlaceholder, removeCurrentPlaceholder
|
||||
resetCurrentPlaceholder, removeCurrentPlaceholder, ensureLoadingPlaceholder
|
||||
} from './chat-area.js';
|
||||
import { showToast } from './toast.js';
|
||||
import { addToolCard, startToolCard, updateToolCard, clearToolCardsExternal, clearTerminalExternal, getWorkspaceDirPath, hasActiveCards, showWorkingHint, clearWorkingHint } from './workspace-panel.js';
|
||||
@@ -590,6 +590,9 @@ async function handleRetry(): Promise<void> {
|
||||
retryContent = '';
|
||||
retryIterations++;
|
||||
},
|
||||
onThinkingStart: () => {
|
||||
ensureLoadingPlaceholder();
|
||||
},
|
||||
onThinking: (thinking) => { retryThinkContent = thinking; updateLastAssistantMessage(retryContent, thinking, null, getSelectedModel()); },
|
||||
onContent: (content) => { retryContent = content; updateLastAssistantMessage(content, retryThinkContent || null, null, getSelectedModel()); },
|
||||
onToolCallStart: (call) => {
|
||||
@@ -1289,6 +1292,9 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
|
||||
assistantContent = '';
|
||||
thinkContent = '';
|
||||
},
|
||||
onThinkingStart: () => {
|
||||
ensureLoadingPlaceholder();
|
||||
},
|
||||
onThinking: (thinking) => {
|
||||
thinkContent = thinking;
|
||||
updateLastAssistantMessage(assistantContent, thinkContent || null, null, getSelectedModel());
|
||||
|
||||
Reference in New Issue
Block a user