From 22003788f58a7aaa27535d28a194490d89d1880a Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 3 Apr 2026 13:35:47 -0400 Subject: [PATCH] fix(generation): compute num_ctx in run_assist_generation --- src/fabledassistant/services/generation_task.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fabledassistant/services/generation_task.py b/src/fabledassistant/services/generation_task.py index 048fafd..fb26c1c 100644 --- a/src/fabledassistant/services/generation_task.py +++ b/src/fabledassistant/services/generation_task.py @@ -529,8 +529,10 @@ async def run_assist_generation( On each retry the accumulated content is reset so the done event always reflects only the successful generation. """ + from fabledassistant.services.llm import pick_num_ctx input_chars = sum(len(m.get("content", "")) for m in messages) - logger.info("Assist generation started: model=%s, input_chars=%d", model, input_chars) + num_ctx = pick_num_ctx(messages) + logger.info("Assist generation started: model=%s, input_chars=%d, num_ctx=%d", model, input_chars, num_ctx) last_exc: BaseException | None = None for attempt in range(3):