Show per-member token usage badges on panel bubbles

memberUsage was already populated for CLI members (from the result event)
and Anthropic-API members (via the tool loop), but it was never written to
the panel_member_done SSE event or the persisted content JSON, so the
frontend had no token data to render.

Add the token fields (input/output/cacheRead/cacheCreation) to both the
SSE event and the persisted JSON, and render them via a shared
buildPanelMemberMeta helper used by both the live stream and history, so
the badge survives F5. OpenAI members (no per-turn tokens), error members,
and pre-existing history without token fields fall through to no badge.

The badge is display-only; aggregation into the worker/chain total via
seedUsage is unchanged, so there is no double counting and no DB migration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MelekiandClaude Opus 4.8 committed 2026-06-19 17:47:49 +02:00
1 parent 17ba4840dd
commit 8e5a961e94
4 files changed
+50 -2

No files matched your search

+2
View File
@@ -553,6 +553,8 @@ function _renderPanelMemberBubble(msg, archived) {
empty.innerHTML = renderMarkdown('_(keine Antwort)_');
bubble.appendChild(empty);
}
var meta = buildPanelMemberMeta(data);
if (meta) bubble.appendChild(meta);
return bubble;
}