fix: chain-meta mit In:0/Out:0 nicht mehr anzeigen während Stream läuft
- 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
This commit is contained in:
1 parent
c3812fbf2b
commit
22d2df01d0
1 file changed
+5
-3
+5
-3
@@ -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');
|
||||
|
||||
Reference in new issue
Block a user