From 97ee455ab48d6290fa105bfabc718d3d34d278b6 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Fri, 3 Jul 2026 02:26:50 +0200 Subject: [PATCH] =?UTF-8?q?fix(diagnostic):=20chat=5Fhistory=20traegt=20pr?= =?UTF-8?q?oject=5Fid=20=E2=80=94=20getaggte=20Bubbles=20landen=20im=20Pro?= =?UTF-8?q?jekt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der Reload-Pfad des Dashboards warf die Kontext-Zuordnung an ZWEI Stellen weg, weshalb nach jedem Reload alles im Hauptchat lag (Projekte leer) — unabhaengig davon ob chat_backup korrekt getaggt war: - server.js (History-Builder): pushte {type,text,meta,ts} ohne project_id. Jetzt projectId aus obj.project_id fuer sent/received/aria_file mitgegeben. - index.html (chat_history-Renderer): setzte dataset.ts aber nie dataset.projectId → jede Bubble galt als Hauptchat. Jetzt gesetzt, und nach dem Neuaufbau updateChatVisibilityByFocus() aufgerufen damit der aktuelle Kontext-Focus sofort greift. Zusammen mit der Backfill-Migration (8b567e1) erscheinen alt-getaggte Turns jetzt beim Dashboard-Reload im richtigen Projekt. Co-Authored-By: Claude Opus 4.8 (1M context) --- diagnostic/index.html | 8 ++++++++ diagnostic/server.js | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/diagnostic/index.html b/diagnostic/index.html index 91e43e4..93790fe 100644 --- a/diagnostic/index.html +++ b/diagnostic/index.html @@ -1928,6 +1928,11 @@ const el = document.createElement('div'); el.className = `chat-msg ${m.type}`; if (m.ts) el.dataset.ts = String(m.ts); + // Multi-Threading: Kontext-Zuordnung fuer den Focus-Filter. + // Ohne das landete beim Reload JEDE Bubble im Hauptchat + // (dataset.projectId undefined → '' → nur bei Hauptchat-Focus + // sichtbar), Projekte blieben leer. + el.dataset.projectId = m.projectId || ''; el.innerHTML = innerHtml; b.appendChild(el); } @@ -1949,6 +1954,9 @@ } for (const b of boxes) b.scrollTop = b.scrollHeight; } + // Nach dem Neuaufbau den aktuellen Kontext-Focus anwenden: Bubbles + // die nicht zum fokussierten Projekt gehoeren ausblenden. + updateChatVisibilityByFocus(); if (errorCount > 0) { console.warn(`chat_history: ${errorCount} Bubble(s) konnten nicht gerendert werden`); } diff --git a/diagnostic/server.js b/diagnostic/server.js index 69d3915..b989ce0 100644 --- a/diagnostic/server.js +++ b/diagnostic/server.js @@ -2746,8 +2746,9 @@ async function handleLoadChatHistory(clientWs) { if (obj.role !== "user" && obj.role !== "assistant") continue; const ts = obj.ts || 0; const text = String(obj.text || ""); + const projectId = String(obj.project_id || ""); // Multi-Threading: Kontext-Zuordnung if (obj.role === "user") { - if (text) messages.push({ type: "sent", text, meta: "Gateway direkt", ts }); + if (text) messages.push({ type: "sent", text, meta: "Gateway direkt", ts, projectId }); continue; } // assistant: nach FILE-Markern scannen, eigene aria_file-Eintraege pro Datei @@ -2769,9 +2770,10 @@ async function handleLoadChatHistory(clientWs) { size, ts, deleted: wasDeleted || !exists, + projectId, }); } - if (text) messages.push({ type: "received", text, meta: "chat:final", ts }); + if (text) messages.push({ type: "received", text, meta: "chat:final", ts, projectId }); } clientWs.send(JSON.stringify({ type: "chat_history", messages }));