Skip to content

Commit a29e00c

Browse files
committed
feat: update token estimation for Mistral Vibe and enhance log viewer display
1 parent 9cab4b6 commit a29e00c

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

vscode-extension/src/extension.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,9 +3899,8 @@ class CopilotTokenTracker implements vscode.Disposable {
38993899
userMsgIndices.push(i);
39003900
}
39013901
}
3902-
const numTurns = userMsgIndices.length;
3903-
const perTurnInput = numTurns > 0 ? Math.round((tokenData.tokens * 0.7) / numTurns) : 0;
3904-
const perTurnOutput = numTurns > 0 ? Math.round((tokenData.tokens * 0.3) / numTurns) : 0;
3902+
// Mistral Vibe only has session-level token counts (not per-turn)
3903+
// Set per-turn estimates to 0; actual totals go in actualTokens
39053904

39063905
for (let t = 0; t < userMsgIndices.length; t++) {
39073906
const userIdx = userMsgIndices[t];
@@ -3941,8 +3940,8 @@ class CopilotTokenTracker implements vscode.Disposable {
39413940
toolCalls,
39423941
contextReferences: _createEmptyContextRefs(),
39433942
mcpTools: [],
3944-
inputTokensEstimate: perTurnInput,
3945-
outputTokensEstimate: perTurnOutput,
3943+
inputTokensEstimate: 0,
3944+
outputTokensEstimate: 0,
39463945
thinkingTokensEstimate: 0
39473946
});
39483947
}
@@ -3959,6 +3958,7 @@ class CopilotTokenTracker implements vscode.Disposable {
39593958
firstInteraction: details.firstInteraction,
39603959
lastInteraction: details.lastInteraction,
39613960
turns,
3961+
actualTokens: tokenData.tokens,
39623962
usageAnalysis: undefined
39633963
};
39643964
}

vscode-extension/src/webview/diagnostics/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ function getEditorIcon(editor: string): string {
396396
return "🪟";
397397
}
398398
if (lower.includes("mistral")) {
399-
return "";
399+
return "🔥";
400400
}
401401
if (lower.includes("crush")) {
402402
return "🩷";

vscode-extension/src/webview/logviewer/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ function renderTurnCard(turn: ChatTurn): string {
513513
<span class="turn-mode" style="background: ${getModeColor(turn.mode)};">${getModeIcon(turn.mode)} ${turn.mode}</span>
514514
${turn.model ? `<span class="turn-model">🎯 ${escapeHtml(turn.model)}</span>` : ''}
515515
${turn.thinkingEffort ? `<span class="turn-effort">💡 ${escapeHtml(getEffortDisplayName(turn.thinkingEffort))}</span>` : ''}
516-
<span class="turn-tokens">📊 ${formatCompact(totalTokens)} tokens (↑${turn.inputTokensEstimate}${turn.outputTokensEstimate})</span>
516+
${totalTokens > 0 ? `<span class="turn-tokens">📊 ${formatCompact(totalTokens)} tokens (↑${turn.inputTokensEstimate}${turn.outputTokensEstimate})</span>` : ''}
517517
${hasThinking ? `<span class="turn-tokens" style="color: #a78bfa;">🧠 ${formatCompact(turn.thinkingTokensEstimate)} thinking</span>` : ''}
518518
${hasActualUsage ? `<span class="turn-tokens" style="color: #22c55e;">✓ ${formatCompact(turn.actualUsage!.promptTokens + turn.actualUsage!.completionTokens)} actual</span>` : ''}
519519
${contextHeaderHtml}
@@ -651,7 +651,7 @@ function renderLayout(data: SessionLogData): void {
651651
<div class="summary-card actual-usage-card">
652652
<div class="summary-label">✅ Actual Tokens</div>
653653
<div class="summary-value">${formatCompact(sessionActualTokens)}</div>
654-
<div class="summary-sub">Total from session shutdown event</div>
654+
<div class="summary-sub">${data.editorName === 'Mistral Vibe' ? 'From session data' : 'Total from session shutdown event'}</div>
655655
</div>
656656
` : ''}
657657
${totalThinkingTokens > 0 ? `<div class="summary-card">

0 commit comments

Comments
 (0)