feat: Chain-Meta Anzeige-Einstellung + Darstellung verbessern
- Settings: 'Chain-Info' Dropdown (Immer/Manchmal/Nie), Default 'Manchmal' - Manchmal-Regeln: In+Out >= 10k Tokens, >= 25 Iterationen, >= 90s Dauer - Model-Name: claude-opus-4-6 → Opus 4.6, Unbekanntes → 'Unbekannt' - Tokens: In/Out zu einem Badge zusammengeführt - Cache: Read/Write zu einem Badge zusammengeführt - Iterations → Iterationen
This commit is contained in:
1 parent
7490d483c2
commit
38bdb4408c
5 files changed
+64
-8
No files matched your search
+24
-6
@@ -1,13 +1,30 @@
|
||||
// ── Helpers ──
|
||||
|
||||
function _prettyModelName(model) {
|
||||
if (!model) return '?';
|
||||
// claude-sonnet-4-20250514 → Sonnet 4
|
||||
// claude-opus-4-6 → Opus 4.6
|
||||
// claude-haiku-3-5 → Haiku 3.5
|
||||
const m = model.match(/claude-(\w+)-(\d+)(?:-(\d+))?/);
|
||||
if (m) {
|
||||
const family = m[1].charAt(0).toUpperCase() + m[1].slice(1);
|
||||
const major = m[2];
|
||||
const minor = m[3];
|
||||
// minor > 20000000 ist ein Datums-Suffix, kein Minor-Version
|
||||
if (minor && minor.length <= 2) return family + ' ' + major + '.' + minor;
|
||||
return family + ' ' + major;
|
||||
}
|
||||
return 'Unbekannt';
|
||||
}
|
||||
|
||||
function buildMetaBadges(d) {
|
||||
const badges = [];
|
||||
badges.push(d.model || '?');
|
||||
badges.push('In: ' + (d.inputTokens || 0));
|
||||
badges.push('Out: ' + (d.outputTokens || 0));
|
||||
if (d.cacheCreationTokens > 0) badges.push('Cache-Write: ' + d.cacheCreationTokens);
|
||||
if (d.cacheReadTokens > 0) badges.push('Cache-Read: ' + d.cacheReadTokens);
|
||||
if ((d.iterations || 0) > 1) badges.push('Iterations: ' + d.iterations);
|
||||
badges.push(_prettyModelName(d.model));
|
||||
badges.push('Tokens: ' + (d.inputTokens || 0) + ' / ' + (d.outputTokens || 0));
|
||||
if (d.cacheCreationTokens > 0 || d.cacheReadTokens > 0) {
|
||||
badges.push('Cache: ' + (d.cacheReadTokens || 0) + ' / ' + (d.cacheCreationTokens || 0));
|
||||
}
|
||||
if ((d.iterations || 0) > 1) badges.push('Iterationen: ' + d.iterations);
|
||||
if (d.durationMs) badges.push((d.durationMs / 1000).toFixed(1) + 's');
|
||||
if (d.stopReason && d.stopReason !== 'end_turn' && d.stopReason !== 'tool_use') badges.push('Stop: ' + d.stopReason);
|
||||
return badges;
|
||||
@@ -17,6 +34,7 @@ function addChainMetaBubble(d, streamed) {
|
||||
if (!d || !d.model) return;
|
||||
// Chain noch nicht finalisiert (läuft noch) → nicht anzeigen
|
||||
if (!d.inputTokens && !d.outputTokens && !d.durationMs) return;
|
||||
if (!isChainMetaVisible(d)) return;
|
||||
const badges = buildMetaBadges(d);
|
||||
const div = document.createElement('div');
|
||||
div.className = 'chain-meta';
|
||||
|
||||
Reference in new issue
Block a user