fix(archivar): correct Coroutine-Bug root cause — _llm_raw_sync→async _llm_raw, direct await
OllamaLLMClient.generate() is async def — run_in_executor cannot correctly execute async functions. The coroutine was never awaited. Also fix Move-Request parser: native button '1️⃣ Rüber' was not matched against '1️⃣' — fell through to 'stay' instead of 'move'. - classifier.py: _llm_raw_sync → async _llm_raw, await generate() - router.py: remove run_in_executor, direct await _llm_raw() - adapter.py: normalize MOVE_REQ choice (extract leading digit/emoji)
This commit is contained in:
@@ -481,13 +481,15 @@ class IntentClassifier:
|
||||
logger.warning("LLM classification failed: %s", e)
|
||||
return None
|
||||
|
||||
def _llm_raw_sync(self, prompt: str) -> Optional[str]:
|
||||
async def _llm_raw(self, prompt: str) -> Optional[str]:
|
||||
"""Send a raw prompt to the LLM and return its response.
|
||||
|
||||
Unlike ``_llm_classify_sync``, this does NOT validate against
|
||||
Intent-Kategorien. Uses ``LLMClient.generate()`` for free-form
|
||||
output. Used by the router for LLM_ROOM_PROMPT.
|
||||
|
||||
Async because OllamaLLMClient.generate() is async.
|
||||
|
||||
Args:
|
||||
prompt: The complete prompt to send.
|
||||
|
||||
@@ -497,7 +499,7 @@ class IntentClassifier:
|
||||
try:
|
||||
if not self._llm_client or not self._llm_enabled:
|
||||
return None
|
||||
return self._llm_client.generate(prompt)
|
||||
return await self._llm_client.generate(prompt)
|
||||
except Exception as e:
|
||||
logger.warning("LLM raw call failed: %s", e)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user