diff --git a/scripts/reset_qdrant.py b/scripts/reset_qdrant.py index 015fa2d..de43c08 100644 --- a/scripts/reset_qdrant.py +++ b/scripts/reset_qdrant.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ Name: scripts/reset_qdrant.py -Version: v1.2.0 (2025-11-11) +Version: v1.2.1 (2025-12-11) Kurzbeschreibung: Sicheres Zurücksetzen der Qdrant-Collections für EIN Projektpräfix. Das Skript ermittelt zunächst die tatsächlich betroffenen Collections und zeigt eine @@ -39,6 +39,7 @@ Exitcodes: 0 = OK, 1 = abgebrochen/keine Aktion, 2 = Verbindungs-/Konfigurationsfehler Changelog: + v1.2.1: Fix: load_dotenv() hinzugefügt, damit VECTOR_DIM aus .env gelesen wird. v1.2.0: ensure_payload_indexes() nach wipe/truncate standardmäßig ausführen (idempotent); --no-indexes Flag ergänzt. v1.1.1: Stabilisierung & Preview (2025-09-05). v1.1.0: Interaktive Bestätigung, --yes/--dry-run hinzugefügt, Preview der betroffenen Collections. @@ -50,6 +51,9 @@ import os import sys from typing import List +# FIX: Dotenv laden +from dotenv import load_dotenv + from qdrant_client import QdrantClient from qdrant_client.http import models as rest @@ -124,6 +128,9 @@ def wipe_collections(client: QdrantClient, all_col_names: List[str], existing: L def main(): + # FIX: Umgebungsvariablen aus .env laden + load_dotenv() + ap = argparse.ArgumentParser(description="Wipe oder truncate mindnet-Collections in Qdrant (mit Bestätigung & Index-Setup).") ap.add_argument("--mode", choices=["wipe", "truncate"], required=True, help="wipe = Collections löschen & neu anlegen; truncate = nur Inhalte löschen") @@ -135,6 +142,7 @@ def main(): # Qdrant-Konfiguration try: + # Hier wird jetzt VECTOR_DIM=768 korrekt berücksichtigt cfg = QdrantConfig.from_env() except Exception as e: print(f"Konfigurationsfehler: {e}", file=sys.stderr) @@ -156,6 +164,9 @@ def main(): existing = resolve_existing_collections(client, cfg.prefix) nonexisting = [c for c in all_col_names if c not in existing] + # Debug-Info zur Dimension + print(f"Info: Nutze Vektor-Dimension: {cfg.dim}") + # Preview & Bestätigung if not confirm_or_abort(args.mode, existing, nonexisting, args.yes): print("Abgebrochen – keine Änderungen vorgenommen.") @@ -188,4 +199,4 @@ def main(): if __name__ == "__main__": - main() + main() \ No newline at end of file