From 7b02cc5cfd546da46b5342bdf91f9e59eeec3df0 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 18 Feb 2026 20:22:48 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20context=20note=20truncation=20?= =?UTF-8?q?=E2=80=94=20preserve=20full=20note=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pinned note: full body restored (truncation is wrong when the user is explicitly asking about that note's content). Auto-notes: restored to 2000 chars (800 was too restrictive for useful context). Co-Authored-By: Claude Sonnet 4.6 --- src/fabledassistant/services/llm.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/fabledassistant/services/llm.py b/src/fabledassistant/services/llm.py index 55716a2..6f6929e 100644 --- a/src/fabledassistant/services/llm.py +++ b/src/fabledassistant/services/llm.py @@ -289,20 +289,16 @@ async def build_context( "auto_notes": [], } - # Include current note context if provided (cap at 4000 chars — explicitly selected - # so more generous, but very long notes would blow up the prefill phase) + # Include current note context if provided — full body, no truncation if current_note_id: note = await get_note(user_id, current_note_id) if note: context_meta["context_note_id"] = note.id context_meta["context_note_title"] = note.title - body = note.body or "" - truncated = body[:4000] - suffix = "\n[...truncated]" if len(body) > 4000 else "" system_parts.append( f"\n\n--- Current Note ---\n" f"Title: {note.title}\n" - f"Content:\n{truncated}{suffix}\n" + f"Content:\n{note.body}\n" f"--- End Note ---" ) @@ -318,9 +314,7 @@ async def build_context( ) snippets: list[str] = [] for n in notes: - # 800 chars keeps context meaningful without bloating the prefill phase. - # The user can ask follow-up questions for more detail. - body_preview = n.body[:800] if n.body else "" + body_preview = n.body[:2000] if n.body else "" snippets.append(f"- {n.title}: {body_preview}") context_meta["auto_notes"].append({"id": n.id, "title": n.title}) if snippets: