fix(dashboard): robust tool call display and filter logic

Two fixes for tool call display in the dashboard:

1. **filterDisplayMessages includes tool_calls** (MessageBubble.js)
   Previously filtered out messages with only tool_calls (no content/thinking).
   Now correctly keeps messages that have tool_calls.

2. **Type-safe getToolSummary** (markdown.js)
   The heuristic tool summary extractor was calling .slice() without
   type checks. If a tool input had a non-string value (e.g., number),
   it would throw TypeError. Now uses a helper function to safely
   check types before calling string methods.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
teernisse
2026-02-25 15:20:26 -05:00
parent 8224acbba7
commit 2f80995f8d
2 changed files with 60 additions and 14 deletions

View File

@@ -44,11 +44,11 @@ export function MessageBubble({ msg, userBg, compact = false, formatTime }) {
}
/**
* Filter messages for display — removes tool-call-only messages
* that have no text or thinking (would render as empty bubbles).
* Filter messages for display — removes empty assistant messages
* (no content, thinking, or tool_calls) that would render as empty bubbles.
*/
export function filterDisplayMessages(messages) {
return messages.filter(msg =>
msg.content || msg.thinking || msg.role === 'user'
msg.content || msg.thinking || msg.tool_calls?.length || msg.role === 'user'
);
}