From 22d2df01d0bcbf8b1ce03ca3482c94277f3de189 Mon Sep 17 00:00:00 2001 From: Meleki Date: Sat, 28 Feb 2026 23:57:02 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20chain-meta=20mit=20In:0/Out:0=20nicht=20?= =?UTF-8?q?mehr=20anzeigen=20w=C3=A4hrend=20Stream=20l=C3=A4uft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - addChainMetaBubble unterdrückt Anzeige wenn inputTokens, outputTokens und durationMs alle 0 sind (Chain noch nicht finalisiert) - done-Event: chain-meta nur noch in _lastDoneChainData merken, nicht sofort als streamed-Bubble anzeigen – wird erst im finally-Block nach pollHistory eingefügt - behebt das Problem bei Chat-Navigation während laufendem Stream --- wwwroot/js/chat.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wwwroot/js/chat.js b/wwwroot/js/chat.js index d2eff4e..e889887 100644 --- a/wwwroot/js/chat.js +++ b/wwwroot/js/chat.js @@ -15,6 +15,8 @@ function buildMetaBadges(d) { 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; const badges = buildMetaBadges(d); const div = document.createElement('div'); div.className = 'chain-meta'; @@ -162,15 +164,15 @@ async function sendMessage() { if (data.stopReason === 'max_tokens') { addWarningBubble('Antwort wurde abgeschnitten (max_tokens erreicht). Bitte frage nach dem Rest.', true); } - // Chain-Meta als streamed markieren (wird im finally ersetzt) + // Chain-Meta nur merken, nicht sofort anzeigen – + // wird erst im finally nach pollHistory eingefügt _lastDoneChainData = null; if (data.model) { _lastDoneChainData = data; - addChainMetaBubble(data, true); } else if (data.chainId) { try { const chain = await apiGetChain(data.chainId); - if (chain) { _lastDoneChainData = chain; addChainMetaBubble(chain, true); } + if (chain) _lastDoneChainData = chain; } catch (_) {} } setMeta('Bereit');