fix: Rainer-Review Bug 3+4+5+B9 — 4 kritische Mängel behoben
Bug 5 (Datenverlust): python3-Check in install.sh unsicher - 3 Stellen: python3-Verfügbarkeit VOR room-map.json-Check prüfen - Falls python3 fehlt: Warnung + Skip (nicht überschreiben) - install.sh: Zeilen ~487, ~711, ~1103 Bug 4 (Schleife): should_stay_in_room() nicht im Bypass gelesen - Bypass-Logik prüft jetzt ArchivarState-Persistenz - Nach Gateway-Neustart: persistierte never_route/always-Entscheidungen werden gelesen → Sticky-Schleife kommt nicht zurück - adapter.py: Zeile ~952 B9 (Endlosschleife): Kein Idempotenz-Guard bei Reconnects - (a) onboarding_active-Check VOR B9-Block - (b) is_reconnect + rooms initialisiert → skip - (c) FAISS-Rebuild: RoomIndexError → _room_index=None + warnen - adapter.py: Zeilen ~622, ~1713 Bug 3 (Asymmetrie): send()-Handler ohne Fallback + _is_user_operator tot - (a) send(): Text-Fallback wenn button_template nicht gerendert werden kann (z.B. 'Antworte mit 1, 2 oder 3') - (b) _is_user_operator entfernt (toter Code, nie aufgerufen, first-touch-Bug) - adapter.py: Zeilen ~1942, ~1801
This commit is contained in:
+117
-30
@@ -117,6 +117,13 @@ load_lang() {
|
||||
[nomic_ok]="✅ nomic-embed-text ready"
|
||||
[nomic_fail]="⚠️ nomic-embed-text pull failed — Archivar will use fallback mode"
|
||||
[ollama_ok]="✅ Ollama ready"
|
||||
[ollama_installing]="📥 Installing Ollama (https://ollama.com)..."
|
||||
[ollama_install_fail]="⚠️ Ollama installation failed — Archivar will use fallback mode (keyword heuristic)"
|
||||
[ollama_wait]="⏳ Waiting for Ollama to start..."
|
||||
[ollama_qwen_pull]="📥 Pulling qwen2.5:7b (4.7 GB) — this may take several minutes..."
|
||||
[ollama_qwen_ok]="✅ qwen2.5:7b ready"
|
||||
[ollama_qwen_fail]="⚠️ qwen2.5:7b pull failed — LLM routing will use fallback"
|
||||
[ollama_sudo_hint]="ℹ️ Ollama install may require sudo — enter your password if prompted"
|
||||
[service_installed]="⚡ Gateway service installed"
|
||||
[restarting]="🔄 Restarting gateway…"
|
||||
[done]="✅ Rocket.Chat Plugin installed successfully!\n After the gateway restarts, check for a pairing code\n in the gateway logs and enter it in your home channel."
|
||||
@@ -175,6 +182,13 @@ load_lang() {
|
||||
[nomic_ok]="✅ nomic-embed-text bereit"
|
||||
[nomic_fail]="⚠️ nomic-embed-text Download fehlgeschlagen — Archivar nutzt Fallback-Modus"
|
||||
[ollama_ok]="✅ Ollama bereit"
|
||||
[ollama_installing]="📥 Installiere Ollama (https://ollama.com)..."
|
||||
[ollama_install_fail]="⚠️ Ollama-Installation fehlgeschlagen — Archivar nutzt Fallback-Modus (Keyword-Heuristik)"
|
||||
[ollama_wait]="⏳ Warte auf Ollama-Start..."
|
||||
[ollama_qwen_pull]="📥 Lade qwen2.5:7b herunter (4,7 GB) — dies kann einige Minuten dauern..."
|
||||
[ollama_qwen_ok]="✅ qwen2.5:7b bereit"
|
||||
[ollama_qwen_fail]="⚠️ qwen2.5:7b Download fehlgeschlagen — LLM-Routing nutzt Fallback"
|
||||
[ollama_sudo_hint]="ℹ️ Ollama-Installation benötigt ggf. sudo — Passwort eingeben falls abgefragt"
|
||||
[service_installed]="⚡ Gateway-Service installiert"
|
||||
[restarting]="🔄 Starte Gateway neu…"
|
||||
[done]="✅ Rocket.Chat Plugin erfolgreich installiert!\n Nach dem Gateway-Neustart bitte den Pairing-Code\n aus den Gateway-Logs im Home-Channel eingeben."
|
||||
@@ -469,8 +483,11 @@ perform_update() {
|
||||
elif [ -f "$room_map_file" ] && [ -f "$template_file" ]; then
|
||||
# Bug 5 fix: Prüfe ob die existierende room-map.json das leere Template ist
|
||||
# (keine echten Räume, nur PLACEHOLDER_VAULT_PATH)
|
||||
# SICHERHEIT: python3-Verfügbarkeit VOR dem Check prüfen.
|
||||
# Falls python3 fehlt → Warnung + Skip (nicht überschreiben!).
|
||||
local room_count
|
||||
room_count=$(python3 -c "
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
room_count=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('$room_map_file') as f:
|
||||
@@ -479,6 +496,10 @@ try:
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
else
|
||||
echo " ⚠️ python3 not found — skipping room-map.json check (will NOT overwrite existing data)"
|
||||
room_count="SKIP"
|
||||
fi
|
||||
if [ "$room_count" = "0" ]; then
|
||||
echo " ℹ️ room-map.json is empty template — will deploy fresh"
|
||||
deploy_template=true
|
||||
@@ -491,23 +512,32 @@ except: print(0)
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute backend checks directly (Ollama check from lines 429-446)
|
||||
msg ollama_check
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
msg ollama_ok
|
||||
# nomic-embed-text laden falls nicht vorhanden
|
||||
if ! ollama list 2>/dev/null | grep -q nomic-embed-text; then
|
||||
msg nomic_pull
|
||||
if ollama pull nomic-embed-text 2>/dev/null; then
|
||||
msg nomic_ok
|
||||
# M10: Ollama Prerequisites (nur bei MULTIROOM=true)
|
||||
if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
msg ollama_check
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
msg ollama_ok
|
||||
# nomic-embed-text laden falls nicht vorhanden
|
||||
if ! ollama list 2>/dev/null | grep -q nomic-embed-text; then
|
||||
msg nomic_pull
|
||||
if ollama pull nomic-embed-text 2>/dev/null; then
|
||||
msg nomic_ok
|
||||
else
|
||||
msg nomic_fail
|
||||
fi
|
||||
else
|
||||
msg nomic_fail
|
||||
msg nomic_ok
|
||||
fi
|
||||
# Optional: qwen2.5:7b
|
||||
if ! ollama list 2>/dev/null | grep -q "qwen2.5:7b"; then
|
||||
msg ollama_qwen_pull
|
||||
ollama pull qwen2.5:7b 2>/dev/null && msg ollama_qwen_ok || msg ollama_qwen_fail
|
||||
else
|
||||
msg ollama_qwen_ok
|
||||
fi
|
||||
else
|
||||
msg nomic_ok
|
||||
msg ollama_missing
|
||||
fi
|
||||
else
|
||||
msg ollama_missing
|
||||
fi
|
||||
} || {
|
||||
# Update failed, rollback
|
||||
@@ -685,7 +715,8 @@ perform_update_only() {
|
||||
deploy_template=true
|
||||
elif [ -f "$room_map_file" ] && [ -f "$template_file" ]; then
|
||||
local room_count
|
||||
room_count=$(python3 -c "
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
room_count=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('$room_map_file') as f:
|
||||
@@ -694,6 +725,10 @@ try:
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
else
|
||||
echo " ⚠️ python3 not found — skipping room-map.json check (will NOT overwrite existing data)"
|
||||
room_count="SKIP"
|
||||
fi
|
||||
if [ "$room_count" = "0" ]; then
|
||||
deploy_template=true
|
||||
fi
|
||||
@@ -921,23 +956,69 @@ with open(env_file, 'w') as f:
|
||||
chmod 600 "$ENV_FILE"
|
||||
msg env_written "$ENV_FILE"
|
||||
|
||||
# ─── Ollama Check ─────────────────────────────────────────
|
||||
msg ollama_check
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
msg ollama_ok
|
||||
# nomic-embed-text laden falls nicht vorhanden
|
||||
if ! ollama list 2>/dev/null | grep -q nomic-embed-text; then
|
||||
msg nomic_pull
|
||||
if ollama pull nomic-embed-text 2>/dev/null; then
|
||||
msg nomic_ok
|
||||
else
|
||||
msg nomic_fail
|
||||
fi
|
||||
# ─── M10: Ollama Prerequisite (nur bei MULTIROOM=true) ──────
|
||||
# Archivar braucht lokales Ollama für Embeddings (nomic-embed-text)
|
||||
# und optional LLM-Routing (qwen2.5:7b). Bei RC_MULTIROOM=false
|
||||
# wird der gesamte Block übersprungen.
|
||||
if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
msg ollama_check
|
||||
|
||||
# 1. Prüfe: ist Ollama installiert?
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
msg ollama_ok
|
||||
else
|
||||
msg nomic_ok
|
||||
# 2. Ollama nicht gefunden → installieren
|
||||
msg ollama_installing
|
||||
msg ollama_sudo_hint
|
||||
if curl -fsSL https://ollama.com/install.sh | sh 2>/dev/null; then
|
||||
msg ollama_ok
|
||||
else
|
||||
msg ollama_install_fail
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. Warte bis Ollama läuft (falls installiert)
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
msg ollama_wait
|
||||
sleep 5
|
||||
# Prüfe ob Ollama-Server antwortet
|
||||
if ! curl -s http://localhost:11434/api/tags >/dev/null 2>&1; then
|
||||
# Server läuft noch nicht — warte länger
|
||||
for i in $(seq 1 6); do
|
||||
sleep 5
|
||||
if curl -s http://localhost:11434/api/tags >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# 4. nomic-embed-text pullen (Pflicht für FAISS-Embeddings, ~270 MB)
|
||||
if ! ollama list 2>/dev/null | grep -q nomic-embed-text; then
|
||||
msg nomic_pull
|
||||
if ollama pull nomic-embed-text 2>/dev/null; then
|
||||
msg nomic_ok
|
||||
else
|
||||
msg nomic_fail
|
||||
fi
|
||||
else
|
||||
msg nomic_ok
|
||||
fi
|
||||
|
||||
# 5. Optional: qwen2.5:7b pullen (LLM-Stufe 2, ~4.7 GB)
|
||||
if ! ollama list 2>/dev/null | grep -q "qwen2.5:7b"; then
|
||||
msg ollama_qwen_pull
|
||||
if ollama pull qwen2.5:7b 2>/dev/null; then
|
||||
msg ollama_qwen_ok
|
||||
else
|
||||
msg ollama_qwen_fail
|
||||
fi
|
||||
else
|
||||
msg ollama_qwen_ok
|
||||
fi
|
||||
fi
|
||||
else
|
||||
msg ollama_missing
|
||||
# RC_MULTIROOM=false: Ollama-Prerequisites überspringen
|
||||
echo "ℹ️ Single-Room-Modus — Ollama-Prerequisites übersprungen"
|
||||
fi
|
||||
|
||||
# ─── Copy plugin files ────────────────────────────────────
|
||||
@@ -1031,7 +1112,9 @@ if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
DEPLOY_TEMPLATE=true
|
||||
elif [ -f "$ROOM_MAP_FILE" ] && [ -f "$TEMPLATE_FILE" ]; then
|
||||
# Bug 5 fix: Prüfe ob die existierende room-map.json das leere Template ist
|
||||
ROOM_COUNT=$(python3 -c "
|
||||
# SICHERHEIT: python3-Verfügbarkeit VOR dem Check prüfen.
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
ROOM_COUNT=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('$ROOM_MAP_FILE') as f:
|
||||
@@ -1040,6 +1123,10 @@ try:
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
else
|
||||
echo " ⚠️ python3 not found — skipping room-map.json check (will NOT overwrite existing data)"
|
||||
ROOM_COUNT="SKIP"
|
||||
fi
|
||||
if [ "$ROOM_COUNT" = "0" ]; then
|
||||
DEPLOY_TEMPLATE=true
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user