chore: move test scripts to scripts/ directory (rebuild_index, smoke_test_booster, smoke_test_faiss)
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
"""FAISS Smoke-Test: granulare Similarity mit 200-Wort-Beschreibungen."""
|
||||
import sys
|
||||
sys.path.insert(0, "plugin")
|
||||
|
||||
from archivar.room_map import RoomMap
|
||||
from archivar.classifier import OllamaEmbeddingClient
|
||||
from archivar.room_index import RoomIndexManager
|
||||
|
||||
|
||||
def main() -> int:
|
||||
room_map = RoomMap.load()
|
||||
emb = OllamaEmbeddingClient()
|
||||
idx = RoomIndexManager(room_map, emb)
|
||||
if not idx.load():
|
||||
print("FEHLER: Index nicht geladen")
|
||||
return 1
|
||||
|
||||
tests = [
|
||||
("Der Docker-Container startet nicht nach docker compose up", "BAT-Team"),
|
||||
("Die install.sh muss alle Secrets generieren", "Rocketchat-Plugin"),
|
||||
("Das Subnetz braucht eine Dokumentation", "LAN-Dokumentation"),
|
||||
("IMAP-IDLE funktioniert nicht mit der Proton Bridge", "Protonbridge-Plugin"),
|
||||
("Der Archivar routet falsch bei BUTTON_CLICK", "Rocketchat-Plugin"),
|
||||
("pg_dump scheitert an Version-Mismatch v15 vs v16", "BAT-Team"),
|
||||
("Proxmox Server hat hohe IO-Wait Zeiten", "LAN-Dokumentation"),
|
||||
("Himalaya CLI kann keine Emails via SMTP senden", "Protonbridge-Plugin"),
|
||||
]
|
||||
|
||||
print(f"FAISS Smoke-Test: {idx.size} Räume, Version {idx._version}")
|
||||
print()
|
||||
|
||||
ok = 0
|
||||
for text, expected in tests:
|
||||
hits = idx.search_text(text, k=3, min_score=0.3)
|
||||
if hits:
|
||||
top_id, top_score = hits[0]
|
||||
top_room = room_map.get_room_by_id(top_id)
|
||||
top_name = top_room.name if top_room else "?"
|
||||
match = "✅" if expected in top_name else "❌"
|
||||
others = ", ".join(
|
||||
f"{room_map.get_room_by_id(r).name}({s:.2f})"
|
||||
for r, s in hits[1:]
|
||||
)
|
||||
print(f"{match} {top_score:.3f} → {top_name:25s} | {text[:60]}")
|
||||
if match == "✅":
|
||||
ok += 1
|
||||
else:
|
||||
print(f" expected: {expected}, others: {others}")
|
||||
else:
|
||||
print(f"❌ NO HIT (score < 0.3) | {text[:60]}")
|
||||
|
||||
print(f"\n{ok}/{len(tests)} korrekt")
|
||||
return 0 if ok >= len(tests) * 0.75 else 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user