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,