reset qdrant überarbeitet mit .env parametern
This commit is contained in:
parent
52210a91fd
commit
1fde4ed72a
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
Name: scripts/reset_qdrant.py
|
Name: scripts/reset_qdrant.py
|
||||||
Version: v1.2.0 (2025-11-11)
|
Version: v1.2.1 (2025-12-11)
|
||||||
Kurzbeschreibung:
|
Kurzbeschreibung:
|
||||||
Sicheres Zurücksetzen der Qdrant-Collections für EIN Projektpräfix. Das Skript
|
Sicheres Zurücksetzen der Qdrant-Collections für EIN Projektpräfix. Das Skript
|
||||||
ermittelt zunächst die tatsächlich betroffenen Collections und zeigt eine
|
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
|
0 = OK, 1 = abgebrochen/keine Aktion, 2 = Verbindungs-/Konfigurationsfehler
|
||||||
|
|
||||||
Changelog:
|
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.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.1: Stabilisierung & Preview (2025-09-05).
|
||||||
v1.1.0: Interaktive Bestätigung, --yes/--dry-run hinzugefügt, Preview der betroffenen Collections.
|
v1.1.0: Interaktive Bestätigung, --yes/--dry-run hinzugefügt, Preview der betroffenen Collections.
|
||||||
|
|
@ -50,6 +51,9 @@ import os
|
||||||
import sys
|
import sys
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
# FIX: Dotenv laden
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from qdrant_client import QdrantClient
|
from qdrant_client import QdrantClient
|
||||||
from qdrant_client.http import models as rest
|
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():
|
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 = argparse.ArgumentParser(description="Wipe oder truncate mindnet-Collections in Qdrant (mit Bestätigung & Index-Setup).")
|
||||||
ap.add_argument("--mode", choices=["wipe", "truncate"], required=True,
|
ap.add_argument("--mode", choices=["wipe", "truncate"], required=True,
|
||||||
help="wipe = Collections löschen & neu anlegen; truncate = nur Inhalte löschen")
|
help="wipe = Collections löschen & neu anlegen; truncate = nur Inhalte löschen")
|
||||||
|
|
@ -135,6 +142,7 @@ def main():
|
||||||
|
|
||||||
# Qdrant-Konfiguration
|
# Qdrant-Konfiguration
|
||||||
try:
|
try:
|
||||||
|
# Hier wird jetzt VECTOR_DIM=768 korrekt berücksichtigt
|
||||||
cfg = QdrantConfig.from_env()
|
cfg = QdrantConfig.from_env()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Konfigurationsfehler: {e}", file=sys.stderr)
|
print(f"Konfigurationsfehler: {e}", file=sys.stderr)
|
||||||
|
|
@ -156,6 +164,9 @@ def main():
|
||||||
existing = resolve_existing_collections(client, cfg.prefix)
|
existing = resolve_existing_collections(client, cfg.prefix)
|
||||||
nonexisting = [c for c in all_col_names if c not in existing]
|
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
|
# Preview & Bestätigung
|
||||||
if not confirm_or_abort(args.mode, existing, nonexisting, args.yes):
|
if not confirm_or_abort(args.mode, existing, nonexisting, args.yes):
|
||||||
print("Abgebrochen – keine Änderungen vorgenommen.")
|
print("Abgebrochen – keine Änderungen vorgenommen.")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user