fix: Bug 3 (Onboarding-Buttons), Bug 4 (Move-Request-Sticky), Bug 5 (room-map.json), B9 (Auto-Onboarding)
Bug 3 — Onboarding-Buttons als Text statt interactive: - adapter.py: Neue Methode _get_build_custom_buttons() mit lokalem Fallback der korrekte Rocket.Chat Button-Dicts baut, wenn das rocketchat-Modul nicht in sys.modules ist (Race-Condition beim Import) - _start_onboarding() nutzt jetzt _get_build_custom_buttons() statt des Modul-Level-Fallbacks _build_custom_buttons (der [] liefern kann) - _onboarding_next_room() ebenfalls auf _get_build_custom_buttons() umgestellt - Operator-DM-Erkennung nicht mehr hardcoded auf 'andreas' — nimmt ersten DM - Selbsterklärende Onboarding-Nachricht mit Emoji und Kontext Bug 4 — Move-Request-Schleife, Sticky greift nicht: - Option 2 (Generell hier): Persistiert jetzt in ArchivarState (set_room_state(room_id, 'never_route', username)) — überlebt Neustarts - Option 3 (Hier bleiben): Stay-Counter — nach 3x Stay in 10 Min wird der Raum automatisch auf never_route promoted - _sticky_rooms (in-memory) bleibt als schneller Cache erhalten Bug 5 — Falsche room-map.json wird geladen: - install.sh: Alle 3 room-map.json-Deploy-Stellen prüfen jetzt, ob die existierende Datei 0 Räume enthält (leeres Template) → dann neu deployen - Verhindert dass das leere Template nach Erstinstallation für immer bleibt B9 — Auto-Onboarding ohne Vorkenntnisse: - connect(): Trigger prüft jetzt: MULTIROOM_AGENT=true + Räume ohne Map-Eintrag + Ausnahme: Nur DM → kein Onboarding - Zusätzlich: Wenn room-map.json 0 Räume hat → Onboarding für ALLE non-DM-Räume - _finish_onboarding(): FAISS-Index wird nach Onboarding neu gebaut + gespeichert - _is_user_operator(): Nicht mehr hardcoded — erster DM-User wird Operator Syntax-Check: Alle .py (20 Dateien) + install.sh → OK
This commit is contained in:
+79
-9
@@ -459,9 +459,35 @@ perform_update() {
|
||||
if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
local room_map_data_dir="$HOME/.hermes/hermes-agent/data"
|
||||
mkdir -p "$room_map_data_dir"
|
||||
if [ ! -f "$room_map_data_dir/room-map.json" ] && [ -f "$script_dir/templates/room-map.json" ]; then
|
||||
cp "$script_dir/templates/room-map.json" "$room_map_data_dir/room-map.json"
|
||||
msg room_map_deployed "$room_map_data_dir/room-map.json"
|
||||
local room_map_file="$room_map_data_dir/room-map.json"
|
||||
local template_file="$script_dir/templates/room-map.json"
|
||||
local deploy_template=false
|
||||
|
||||
if [ ! -f "$room_map_file" ]; then
|
||||
# Keine room-map.json vorhanden → Template deployen
|
||||
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
|
||||
# (keine echten Räume, nur PLACEHOLDER_VAULT_PATH)
|
||||
local room_count
|
||||
room_count=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('$room_map_file') as f:
|
||||
data = json.load(f)
|
||||
rooms = data.get('rooms', {})
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
if [ "$room_count" = "0" ]; then
|
||||
echo " ℹ️ room-map.json is empty template — will deploy fresh"
|
||||
deploy_template=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if $deploy_template && [ -f "$template_file" ]; then
|
||||
cp "$template_file" "$room_map_file"
|
||||
msg room_map_deployed "$room_map_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -651,9 +677,31 @@ perform_update_only() {
|
||||
if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
local room_map_data_dir="$HOME/.hermes/hermes-agent/data"
|
||||
mkdir -p "$room_map_data_dir"
|
||||
if [ ! -f "$room_map_data_dir/room-map.json" ] && [ -f "$script_dir/templates/room-map.json" ]; then
|
||||
cp "$script_dir/templates/room-map.json" "$room_map_data_dir/room-map.json"
|
||||
msg room_map_deployed "$room_map_data_dir/room-map.json"
|
||||
local room_map_file="$room_map_data_dir/room-map.json"
|
||||
local template_file="$script_dir/templates/room-map.json"
|
||||
local deploy_template=false
|
||||
|
||||
if [ ! -f "$room_map_file" ]; then
|
||||
deploy_template=true
|
||||
elif [ -f "$room_map_file" ] && [ -f "$template_file" ]; then
|
||||
local room_count
|
||||
room_count=$(python3 -c "
|
||||
import json
|
||||
try:
|
||||
with open('$room_map_file') as f:
|
||||
data = json.load(f)
|
||||
rooms = data.get('rooms', {})
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
if [ "$room_count" = "0" ]; then
|
||||
deploy_template=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if $deploy_template && [ -f "$template_file" ]; then
|
||||
cp "$template_file" "$room_map_file"
|
||||
msg room_map_deployed "$room_map_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -975,9 +1023,31 @@ fi
|
||||
if [ "$RC_MULTIROOM" = "true" ]; then
|
||||
ROOM_MAP_DATA_DIR="$HOME/.hermes/hermes-agent/data"
|
||||
mkdir -p "$ROOM_MAP_DATA_DIR"
|
||||
if [ ! -f "$ROOM_MAP_DATA_DIR/room-map.json" ] && [ -f "$SCRIPT_DIR/templates/room-map.json" ]; then
|
||||
cp "$SCRIPT_DIR/templates/room-map.json" "$ROOM_MAP_DATA_DIR/room-map.json"
|
||||
msg room_map_deployed "$ROOM_MAP_DATA_DIR/room-map.json"
|
||||
ROOM_MAP_FILE="$ROOM_MAP_DATA_DIR/room-map.json"
|
||||
TEMPLATE_FILE="$SCRIPT_DIR/templates/room-map.json"
|
||||
DEPLOY_TEMPLATE=false
|
||||
|
||||
if [ ! -f "$ROOM_MAP_FILE" ]; 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 "
|
||||
import json
|
||||
try:
|
||||
with open('$ROOM_MAP_FILE') as f:
|
||||
data = json.load(f)
|
||||
rooms = data.get('rooms', {})
|
||||
print(len(rooms))
|
||||
except: print(0)
|
||||
" 2>/dev/null || echo "0")
|
||||
if [ "$ROOM_COUNT" = "0" ]; then
|
||||
DEPLOY_TEMPLATE=true
|
||||
fi
|
||||
fi
|
||||
|
||||
if $DEPLOY_TEMPLATE && [ -f "$TEMPLATE_FILE" ]; then
|
||||
cp "$TEMPLATE_FILE" "$ROOM_MAP_FILE"
|
||||
msg room_map_deployed "$ROOM_MAP_FILE"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user