feat: rolling conversation summary + session continuity
- Backend emits session id in SSE; frontend sets activeChat so follow-ups reuse the same session (fixes fragmented history). - sessions.summary column; messages past RECENT_LIMIT (10) are folded into a persisted summary via a non-streaming model call. - buildMessages sends system(+summary) + last 10 messages, bounding context while preserving long-range memory. - Tests: aiMessages (capping + summary injection).
This commit is contained in:
@@ -347,7 +347,11 @@ function App() {
|
||||
|
||||
try {
|
||||
const data = JSON.parse(jsonStr);
|
||||
if (data.type === "chunk") {
|
||||
if (data.type === "session") {
|
||||
// Remember which session this conversation belongs to so
|
||||
// follow-up messages reuse it (history stays together).
|
||||
setActiveChat(data.id);
|
||||
} else if (data.type === "chunk") {
|
||||
assistantText += data.content;
|
||||
setMessages((prev) =>
|
||||
prev.map((m) =>
|
||||
|
||||
Reference in New Issue
Block a user