From 26ae2655eb8f92f380563d4a56e0a24b21ee5c9f Mon Sep 17 00:00:00 2001 From: Priyanka Punukollu Date: Sat, 28 Feb 2026 10:05:02 -0600 Subject: [PATCH] =?UTF-8?q?fix:=20persist=20chat=20history=20across=20page?= =?UTF-8?q?=20reload=20=E2=80=94=20messages=20saved=20to=20localStorage=20?= =?UTF-8?q?per=20session,=20restored=20on=20load,=20meta=20included=20for?= =?UTF-8?q?=20metadata=20panel=20on=20restore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made-with: Cursor --- agent/chat_ui.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/agent/chat_ui.html b/agent/chat_ui.html index e1cfbd4b2..b4a56141f 100644 --- a/agent/chat_ui.html +++ b/agent/chat_ui.html @@ -5554,7 +5554,7 @@ const u = hist[i]; const a = hist[i + 1]; if (u) addMessage('user', u.content, null, true); - if (a) addMessage('agent', a.content, null, true); + if (a) addMessage('agent', a.content, (a && a.meta) ? a.meta : null, true); } } catch { /* silently skip */ @@ -5772,7 +5772,7 @@ // Extract tickers from response into memory extractTickersIntoMemory(responseText); history.push({ role: 'user', content: query }); - history.push({ role: 'assistant', content: responseText }); + history.push({ role: 'assistant', content: responseText, meta: metaData || null }); sessionStats.messages++; saveSession(); saveCurrentSession(); @@ -6444,7 +6444,10 @@ emptyEl.style.display = 'none'; for (let i = 0; i < history.length; i += 2) { if (history[i]) addMessage('user', history[i].content, null, true); - if (history[i + 1]) addMessage('agent', history[i + 1].content, null, true); + if (history[i + 1]) { + const a = history[i + 1]; + addMessage('agent', a.content, (a && a.meta) ? a.meta : null, true); + } } document.title = sess.title + ' — Ghostfolio'; if (typeof updateHeaderTitle === 'function') updateHeaderTitle(); @@ -7046,7 +7049,10 @@ emptyEl.style.display = 'none'; for (let i = 0; i < history.length; i += 2) { if (history[i]) addMessage('user', history[i].content, null, true); - if (history[i + 1]) addMessage('agent', history[i + 1].content, null, true); + if (history[i + 1]) { + const a = history[i + 1]; + addMessage('agent', a.content, (a && a.meta) ? a.meta : null, true); + } } document.title = target.title + ' — Ghostfolio'; updateHeaderTitle();