Fix: Meta-Bar zeigt initial 'Bereit', Chain-Meta-Badges korrekt positioniert

This commit is contained in:
Meleki committed 2026-02-28 18:36:30 +01:00
1 parent 873e40b5d1
commit 8f4fe8a504
2 files changed
+16 -6

No files matched your search

+15 -6
View File
@@ -30,6 +30,7 @@ const messages = [];
let isStreaming = false;
let pendingFiles = []; // [{ name, type, base64 }]
let pendingRefs = []; // [{ path, from, to }] - Workspace-Dateireferenzen
let _lastDoneChainData = null; // Chain-Daten vom letzten done-Event
async function clearChat() {
const archive = await apiArchive(getCurrentSessionId());
@@ -161,12 +162,16 @@ 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)
_lastDoneChainData = null;
if (data.model) {
addChainMetaBubble(data, false);
_lastDoneChainData = data;
addChainMetaBubble(data, true);
} else if (data.chainId) {
apiGetChain(data.chainId).then(chain => {
if (chain) addChainMetaBubble(chain, false);
}).catch(() => {});
try {
const chain = await apiGetChain(data.chainId);
if (chain) { _lastDoneChainData = chain; addChainMetaBubble(chain, true); }
} catch (_) {}
}
setMeta('Bereit');
break;
@@ -196,9 +201,13 @@ async function sendMessage() {
}
endStreamBubble();
// Erst neue aus DB laden, dann gestreamte Elemente ersetzen
await pollHistory();
// Gestreamte Elemente entfernen, dann aus DB laden, dann Chain-Meta anhängen
removeStreamedElements();
await pollHistory();
if (_lastDoneChainData) {
addChainMetaBubble(_lastDoneChainData, false);
_lastDoneChainData = null;
}
}
}
+1
View File
@@ -21,6 +21,7 @@ async function loadHistory() {
}
scrollDown();
setMeta('Bereit');
startHistoryPolling();
} catch (e) {
console.error('History laden fehlgeschlagen:', e);