From bd109c273aafeea8004a654d6d62ef5d647c8762 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Sat, 5 Sep 2026 21:55:17 -0400 Subject: [PATCH] fix(agent): priorite a la generation de contenu dans le mock (contexte 'collection') --- app/services/llm_client.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/services/llm_client.py b/app/services/llm_client.py index a7c7472..d6415ae 100644 --- a/app/services/llm_client.py +++ b/app/services/llm_client.py @@ -214,6 +214,14 @@ class LLMClient: model=model, ) + # Inline content-generation ("Ask AI" / "AI meeting note") — answered + # before the tool-intent heuristics and scoped to the user objective + # only, so an injected "# Contexte" that happens to mention "collection" + # can't misroute a writing request into a create-collection action. + draft = self._draft_reply(user_content.split("\n# Contexte")[0]) + if draft: + return LLMResponse(text=draft, model=model) + # Exact keyword → tool intent resolution. for regex, builder in _CREATE_PATTERNS: m = regex.search(user_content) @@ -247,10 +255,6 @@ class LLMClient: ) # Plain conversational objective → final answer (no tool). - draft = self._draft_reply(user_content) - if draft: - return LLMResponse(text=draft, model=model) - return LLMResponse( text=self._summarize(user_content), model=model,