diff --git a/plugin/adapter.py b/plugin/adapter.py index fe65365..2ed96a2 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -743,6 +743,11 @@ class RocketChatAdapter(BasePlatformAdapter): if choice.startswith("MOVE_REQ:") and "::" in choice: _, choice = choice.split("::", 1) choice = choice.strip() + # Normalisiere: "1️⃣ Rüber" → "1️⃣", "2 Hier" → "2" + if choice and choice[0] in "123": + choice = choice[0] + elif choice and choice[:2] in ("1️⃣", "2️⃣", "3️⃣"): + choice = choice[:2] # Altes Format: "1"/"2"/"3" = numerische Antwort # Neues Format: "1️⃣", "2️⃣", "3️⃣" = Emoji-Nummern elif choice in ("1", "2", "3") or choice in ("1️⃣", "2️⃣", "3️⃣"): diff --git a/plugin/archivar/classifier.py b/plugin/archivar/classifier.py index 539526c..7568841 100644 --- a/plugin/archivar/classifier.py +++ b/plugin/archivar/classifier.py @@ -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 diff --git a/plugin/archivar/router.py b/plugin/archivar/router.py index 2ea9989..275d05c 100644 --- a/plugin/archivar/router.py +++ b/plugin/archivar/router.py @@ -598,10 +598,7 @@ class BidirectionalRouter: # Try LLM — expects room ID directly # Semaphore schützt vor parallelen Ollama-Aufrufen (qwen2.5:7b = single-request) async with self._llm_semaphore: - loop = asyncio.get_running_loop() - llm_result = await loop.run_in_executor( - None, self._classifier._llm_raw_sync, prompt - ) + llm_result = await self._classifier._llm_raw(prompt) if llm_result is None: return None, True # LLM-Aufruf fehlgeschlagen