feat(archivar): Phase 1-3 — RoomMap + thematischer Router
Phase 1 (Datenmodell):
- plugin/archivar/room_map.py: RoomMap, RoomEntry, RoomMapValidationError
- room-map.schema.json: JSON-Schema für room-map.json
- room-map.json: Echte Raum-IDs (RC, BAT, LAN-Doku, DM Andreas)
- config.py: LLM_ROOM_PROMPT, ROOM_MAP_PATH, deprecated-Marker
Phase 2 (Router-Umbau):
- router.py: MessageRouter nutzt RoomMap statt ROOM_MAPPING Env-Vars
- Neue Methode _llm_room_lookup() fragt LLM: 'In welchen Raum?'
- Keyword-Match aus RoomEntry.keywords (vor Embedding)
- Excluded rooms check via RoomMap.is_excluded()
- origin_room_id Parameter für Multi-Agent-Raum-Ausschluss
Phase 3 (Integration):
- adapter_integration.py: _load_room_map() mit Env-Var-Fallback
- validate() beim Gateway-Start
- classify_and_route() reicht origin_room_id durch
- classifier.py: _llm_raw_sync() für Room-Prompts (nicht Kategorien)
12/12 Unit-Tests bestanden ✅
This commit is contained in:
@@ -360,6 +360,30 @@ class MessageClassifier:
|
||||
logger.warning("LLM classification failed: %s", e)
|
||||
return None
|
||||
|
||||
def _llm_raw_sync(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
|
||||
FAKT/FRAGE/ALARM categories. Used by the RoomRouter for the
|
||||
``LLM_ROOM_PROMPT`` where the expected answer is a room name.
|
||||
|
||||
Args:
|
||||
prompt: The complete prompt to send.
|
||||
|
||||
Returns:
|
||||
The LLM's response text (stripped), or None on failure.
|
||||
"""
|
||||
try:
|
||||
if not self._llm_client or not self._llm_enabled:
|
||||
return None
|
||||
result = self._llm_client.classify(prompt)
|
||||
if result:
|
||||
return result.strip()
|
||||
return None
|
||||
except Exception as e:
|
||||
logger.warning("LLM raw call failed: %s", e)
|
||||
return None
|
||||
|
||||
# ── Public API ──────────────────────────────────────────────────────
|
||||
|
||||
async def initialize(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user