88b7149dd1
- Add archivar/ submodule to plugin/ (5 files, relative imports) - Update adapter.py with relative Archivar import from .archivar.adapter_integration - install.sh: fix --non-interactive env-var reading (Z.316-318, Bug #7) - install.sh: recursive file copy (was 4 flat files, now entire plugin/ tree incl. submodules) - install.sh: Ollama presence check + nomic-embed-text pull - install.sh: write OLLAMA_BASE_URL to rocketchat.env - install.sh: add new message keys (collama_check, nomic_pull, nomic_ok, nomic_fail, copied) Closes: Archivar delivery gap (2026-06-03) Reviewed-by: Bernd (Advisor)
87 lines
4.1 KiB
Python
87 lines
4.1 KiB
Python
1|"""
|
|
2|Archivar-Konfiguration: Raum-Mapping, Kategorie-Texte und Ollama-Einstellungen.
|
|
3|
|
|
4|Alle Raum-IDs stammen direkt aus der Architektur-Skizze
|
|
5|(/home/bernd/Archivar_Architecture.md) und werden als kanonisch betrachtet.
|
|
6|"""
|
|
7|
|
|
8|from __future__ import annotations
|
|
9|
|
|
10|from typing import Dict
|
|
11|
|
|
12|# ── Ollama-Konfiguration ────────────────────────────────────────────────────
|
|
13|
|
|
14|OLLAMA_CONFIG: dict = {
|
|
15| "base_url": "http://localhost:11434",
|
|
16| "model": "nomic-embed-text",
|
|
17| "timeout": 5.0, # Sekunden — bei Überschreitung → Fallback
|
|
18| "embedding_dim": 768, # nomic-embed-text produziert 768-dimensionale Vektoren
|
|
19|}
|
|
20|
|
|
21|# ── Kategorie-Referenztexte (für Embedding-Vergleich) ───────────────────────
|
|
22|# Diese Texte werden einmalig beim Start vektorisiert. Neue Nachrichten werden
|
|
23|# via Kosinus-Ähnlichkeit gegen diese Vektoren verglichen.
|
|
24|
|
|
25|CATEGORY_TEXTS: Dict[str, str] = {
|
|
26| "FAKT": (
|
|
27| "Dies ist eine Information oder ein Faktenbeitrag. Es enthält objektive "
|
|
28| "Aussagen, Dokumentation oder Wissenswertes ohne Handlungsbedarf. Beispiele "
|
|
29| "sind Dokumentationsabschnitte, Systeminformationen oder allgemeine Erklärungen."
|
|
30| ),
|
|
31| "FRAGE": (
|
|
32| "Dies ist eine Frage oder ein Hilferuf. Es wird ein Wissensbeitrag oder "
|
|
33| "eine Antwort auf ein konkretes Problem erwartet. Beispiele sind "
|
|
34| "Problembeschreibungen oder Anfragen nach Lösungen."
|
|
35| ),
|
|
36| "ALARM": (
|
|
37| "Dies ist eine dringende Nachricht oder ein Alarm. Es erfordert eine "
|
|
38| "sofortige Reaktion oder Handlung. Beispiele sind Systemausfälle, "
|
|
39| "kritische Fehler oder Zeitdruck betreffende Anfragen."
|
|
40| ),
|
|
41|}
|
|
42|
|
|
43|# ── Konfidenz-Schwellenwert ─────────────────────────────────────────────────
|
|
44|
|
|
45|CONFIDENCE_THRESHOLD: float = 0.6
|
|
46|"""Nachrichten mit confidence >= 0.6 werden klassifiziert, alles darunter
|
|
47|geht an den CATCH_ALL_ROOM."""
|
|
48|
|
|
49|# ── Raum-Mapping ────────────────────────────────────────────────────────────
|
|
50|# ECHTE IDs aus der Architektur-Skizze — NICHT ERFUNDEN!
|
|
51|# FRAGE ist nested: FRAGE["default"] = string, FRAGE["project_specific"] = dict
|
|
52|
|
|
53|ROOM_MAPPING: dict = {
|
|
54| # Protonbridge-Plugin: Catch-All / Wissensdatenbank
|
|
55| "FAKT": "69f8beaef06dba03be82f9fc",
|
|
56|
|
|
57| # Fragen-Routing — default: BAT-Team, projektspezifisch weiterleitbar
|
|
58| "FRAGE": {
|
|
59| "default": "6a049d493a62ef8f1ead2320", # #BAT-Team
|
|
60| "project_specific": {
|
|
61| "plugin": "6a19b0ff02aeecd36b1aa16c", # #Rocketchat-Plugin
|
|
62| "lan": "6a1c56d4b73efec2bebec2db", # #LAN-Dokumentation
|
|
63| },
|
|
64| },
|
|
65|
|
|
66| # DM mit Andreas — direkter Alarm-Kanal
|
|
67| "ALARM": "69f4e777f06dba03be82dce7",
|
|
68|}
|
|
69|
|
|
70|# Catch-All-Raum: wohin unklassifizierbare Nachrichten gehen
|
|
71|CATCH_ALL_ROOM: str = "69f8beaef06dba03be82f9fc" # Protonbridge-Plugin
|
|
72|
|
|
73|# ── Fallback-Keyword-Heuristik ──────────────────────────────────────────────
|
|
74|
|
|
75|FALLBACK_KEYWORDS: dict = {
|
|
76| "FRAGE": ["frage", "wie", "was ist", "warum", "wieso", "weshalb",
|
|
77| "kannst du", "können sie", "help", "hilfe", "problem",
|
|
78| "funktioniert nicht", "kaputt", "erklären", "erkläre"],
|
|
79| "ALARM": ["alarm", "hilfe", "dringend", "sofort", "notfall",
|
|
80| "ausfall", "absturz", "kritisch", "emergency",
|
|
81| "feuer", "panne", "sos", "sicherheitslücke"],
|
|
82|}
|
|
83|"""
|
|
84|Bei Ollama-Down-Fallback: Enthält die Nachricht eines dieser Keywords,
|
|
85|wird sie entsprechend klassifiziert. Alles andere → FAKT.
|
|
86|"""
|
|
87| |