mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 20:03:05 +00:00
Fix export-html message stats and help bar
- Fix entry type names: branch_summary, custom_message (snake_case) - Fix toolResult role (was 'tool') - Count all entry types: user, assistant, tool results, custom, compactions, branch summaries - Use global stats for tokens/cost (all entries), not just current branch - Make help bar more prominent (12px, full opacity) - Remove Esc shortcut from help bar
This commit is contained in:
parent
9e5163c296
commit
a9da0ce3fd
1 changed files with 26 additions and 6 deletions
|
|
@ -220,10 +220,9 @@
|
|||
|
||||
/* Help bar */
|
||||
.help-bar {
|
||||
font-size: 11px;
|
||||
color: var(--dim);
|
||||
font-size: 12px;
|
||||
color: var(--text);
|
||||
margin-bottom: var(--line-height);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
|
@ -800,7 +799,7 @@
|
|||
</aside>
|
||||
<main id="content">
|
||||
<div id="header-container"></div>
|
||||
<div class="help-bar">Ctrl+T toggle thinking · Ctrl+O toggle tools · Esc reset</div>
|
||||
<div class="help-bar">Ctrl+T toggle thinking · Ctrl+O toggle tools</div>
|
||||
<div id="messages"></div>
|
||||
<div class="footer">
|
||||
Generated by {{APP_NAME}} on {{GENERATED_DATE}}
|
||||
|
|
@ -1679,6 +1678,10 @@
|
|||
function computeStats(entryList) {
|
||||
let userMessages = 0;
|
||||
let assistantMessages = 0;
|
||||
let toolResults = 0;
|
||||
let customMessages = 0;
|
||||
let compactions = 0;
|
||||
let branchSummaries = 0;
|
||||
let toolCalls = 0;
|
||||
const tokens = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
||||
const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
|
||||
|
|
@ -1707,10 +1710,17 @@
|
|||
}
|
||||
toolCalls += msg.content.filter(c => c.type === 'toolCall').length;
|
||||
}
|
||||
if (msg.role === 'toolResult') toolResults++;
|
||||
} else if (entry.type === 'compaction') {
|
||||
compactions++;
|
||||
} else if (entry.type === 'branch_summary') {
|
||||
branchSummaries++;
|
||||
} else if (entry.type === 'custom_message') {
|
||||
customMessages++;
|
||||
}
|
||||
}
|
||||
|
||||
return { userMessages, assistantMessages, toolCalls, tokens, cost, models: Array.from(models) };
|
||||
return { userMessages, assistantMessages, toolResults, customMessages, compactions, branchSummaries, toolCalls, tokens, cost, models: Array.from(models) };
|
||||
}
|
||||
|
||||
// Compute global stats once for all entries
|
||||
|
|
@ -1729,13 +1739,23 @@
|
|||
if (globalStats.tokens.cacheWrite) tokenParts.push(`W${formatTokens(globalStats.tokens.cacheWrite)}`);
|
||||
const tokensDisplay = tokenParts.join(' ') || '0';
|
||||
|
||||
// Build messages display
|
||||
const msgParts = [];
|
||||
if (globalStats.userMessages) msgParts.push(`${globalStats.userMessages} user`);
|
||||
if (globalStats.assistantMessages) msgParts.push(`${globalStats.assistantMessages} assistant`);
|
||||
if (globalStats.toolResults) msgParts.push(`${globalStats.toolResults} tool results`);
|
||||
if (globalStats.customMessages) msgParts.push(`${globalStats.customMessages} custom`);
|
||||
if (globalStats.compactions) msgParts.push(`${globalStats.compactions} compactions`);
|
||||
if (globalStats.branchSummaries) msgParts.push(`${globalStats.branchSummaries} branch summaries`);
|
||||
const messagesDisplay = msgParts.join(', ') || '0';
|
||||
|
||||
let html = `
|
||||
<div class="header">
|
||||
<h1>Session: ${escapeHtml(header?.id || 'unknown')}</h1>
|
||||
<div class="header-info">
|
||||
<div class="info-item"><span class="info-label">Date:</span><span class="info-value">${header?.timestamp ? new Date(header.timestamp).toLocaleString() : 'unknown'}</span></div>
|
||||
<div class="info-item"><span class="info-label">Models:</span><span class="info-value">${globalStats.models.join(', ') || 'unknown'}</span></div>
|
||||
<div class="info-item"><span class="info-label">Messages:</span><span class="info-value">${globalStats.userMessages} user, ${globalStats.assistantMessages} assistant</span></div>
|
||||
<div class="info-item"><span class="info-label">Messages:</span><span class="info-value">${messagesDisplay}</span></div>
|
||||
<div class="info-item"><span class="info-label">Tool Calls:</span><span class="info-value">${globalStats.toolCalls}</span></div>
|
||||
<div class="info-item"><span class="info-label">Tokens:</span><span class="info-value">${tokensDisplay}</span></div>
|
||||
<div class="info-item"><span class="info-label">Cost:</span><span class="info-value">$${totalCost.toFixed(3)}</span></div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue