From e11933164563236d8e65401c3f014e2a90819f14 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 26 Feb 2026 22:34:54 -0500 Subject: [PATCH] Phase 21: Intent-first pipeline, visible ack, KV-stable system prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pipeline changes (generation_task.py, intent.py): - Remove optimistic streaming queue/race (_drain_queue deleted) - Remove _generate_acknowledgment — ack now embedded in intent JSON - Round 0: await intent (~400ms), stream ack immediately as TTFT, then execute tool sequentially; chat-only streams directly - IntentResult.ack: one-sentence acknowledgment, intent max_tokens 200→350 - _parse_intent extracts and trims ack field KV cache stability (llm.py, generation_buffer.py, generation_task.py): - build_context: replace cached_note_ids with include_note_ids - Auto-found notes populate context_meta["auto_notes"] for sidebar but are NOT injected into system prompt (--- Related Notes --- removed) - Explicitly included notes injected as --- Included Notes --- - _conv_note_cache dict + get/set/clear functions removed from generation_buffer.py - All clear_conv_note_cache() calls removed Cold model retry (llm.py): - generate_completion (used by classify_intent) retries on HTTP 500: 3 attempts with 3s/6s delays — prevents intent failure during cold load API + frontend (routes/chat.py, stores/chat.ts, views/ChatView.vue, components/ChatPanel.vue): - exclude_note_ids → include_note_ids throughout - ChatView sidebar: Suggested (auto-found, + to include) + In Context (× to remove) - ChatPanel: remove exclude button from context pills; no IDs passed to sendMessage Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/components/ChatPanel.vue | 20 +- frontend/src/stores/chat.ts | 4 +- frontend/src/views/ChatView.vue | 115 +++++++--- src/fabledassistant/routes/chat.py | 4 +- .../services/generation_buffer.py | 20 -- .../services/generation_task.py | 216 +++--------------- src/fabledassistant/services/intent.py | 14 +- src/fabledassistant/services/llm.py | 143 ++++++------ summary.md | 54 +++-- 9 files changed, 237 insertions(+), 353 deletions(-) diff --git a/frontend/src/components/ChatPanel.vue b/frontend/src/components/ChatPanel.vue index b869043..d8290f2 100644 --- a/frontend/src/components/ChatPanel.vue +++ b/frontend/src/components/ChatPanel.vue @@ -29,8 +29,6 @@ const noteSearchResults = ref<{ id: number; title: string }[]>([]); const noteSearchLoading = ref(false); let noteSearchTimer: ReturnType | null = null; -// Exclude tracking -const excludedNoteIds = ref>(new Set()); const streamingRendered = computed(() => { if (!store.streamingContent) return ""; @@ -65,11 +63,7 @@ async function sendMessage() { messageInput.value = ""; resetTextareaHeight(); scrollToBottom(); - await store.sendMessage( - content, - contextNoteId, - excludedNoteIds.value.size ? [...excludedNoteIds.value] : undefined, - ); + await store.sendMessage(content, contextNoteId); scrollToBottom(); } @@ -151,10 +145,6 @@ function removeAttachedNote() { function promoteAutoNote(note: { id: number; title: string }) { attachedNote.value = note; } - -function excludeAutoNote(noteId: number) { - excludedNoteIds.value = new Set([...excludedNoteIds.value, noteId]); -}