feat: 工具卡片从聊天区域迁移到工作空间面板

- 工作空间新增「🔧 工具」页签,专门展示工具调用卡片
- 工具执行时自动切换到工具页签
- run_command 执行时自动切换到终端页签
- AI 回复消息不再显示工具卡片,保持聊天区域简洁
- 工具页签支持清空、自动滚动、状态统计
This commit is contained in:
thzxx
2026-04-19 19:01:43 +08:00
parent b81bb4dd60
commit c7f2fe0c27
5 changed files with 390 additions and 32 deletions
-16
View File
@@ -157,22 +157,6 @@ export function appendMessageDOM(msg: ChatMessage, index: number): void {
contentHtml = contentHtml.replace('<div class="msg-content"></div>', '');
}
// v5.1.2 工具卡片移至文字上方(先展示工具执行过程,再展示最终回答)
if (msg.role === 'assistant' && msg.toolCalls && msg.toolCalls.length > 0) {
let toolHtml = '<div class="tool-calls-container">';
for (const tc of msg.toolCalls) {
toolHtml += renderToolCallCard(tc);
}
toolHtml += '</div>';
// 插入到 msg-content 之前
const contentIdx = contentHtml.indexOf('<div class="msg-content">');
if (contentIdx >= 0) {
contentHtml = contentHtml.slice(0, contentIdx) + toolHtml + contentHtml.slice(contentIdx);
} else {
contentHtml = toolHtml + contentHtml;
}
}
const stats: string[] = [];
const statClasses: string[] = [];
if (msg.timestamp) { stats.push(formatTime(msg.timestamp)); statClasses.push(''); }