Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/js/chat/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,19 +610,32 @@ function renderChatMessage(msg) {
}
}

// Tool result content
// Tool result content — collapsed by default for consistency with the
// reasoning panel below; long tool outputs otherwise dominate the chat.
if (role === 'tool') {
const contentDiv = document.createElement('div');
contentDiv.className = 'msg-tool-result';
let content = msg.content;
try {
const parsed = JSON.parse(content);
if (parsed.summary) content = parsed.summary;
else if (parsed.results) content = JSON.stringify(parsed.results, null, 2);
else content = JSON.stringify(parsed, null, 2);
} catch {}
contentDiv.textContent = toDisplayText(content).substring(0, 2000);
div.appendChild(contentDiv);
const text = toDisplayText(content).substring(0, 2000);
const firstLine = text.split('\n')[0].slice(0, 120);
const details = document.createElement('details');
details.style.cssText = 'margin-top:4px;';
const summary = document.createElement('summary');
summary.style.cssText = 'cursor:pointer;font-size:11px;color:var(--fg-subtle);';
const labelText = msg.tool_name ? `⚡ ${msg.tool_name}` : '⚡ Tool Result';
const preview = firstLine ? ` — ${firstLine}${text.length > firstLine.length ? '…' : ''}` : '';
summary.textContent = labelText + preview;
const body = document.createElement('div');
body.className = 'msg-tool-result';
body.style.cssText = 'margin-top:4px;';
body.textContent = text;
details.appendChild(summary);
details.appendChild(body);
div.appendChild(details);
return div;
}

Expand Down
Loading