scripts/import_markdown.py aktualisiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s

This commit is contained in:
Lars 2025-11-08 15:38:21 +01:00
parent 3282f85007
commit 6c62f64784

View File

@ -2,13 +2,13 @@
# -*- coding: utf-8 -*-
"""
Script: scripts/import_markdown.py Markdown Qdrant (Notes, Chunks, Edges)
Version: 3.8.1
Version: 3.8.2
Datum: 2025-11-08
Änderung in 3.8.1
------------------
- Abwärtskompatibler Import von `ensure_payload_indexes`:
Fallback auf `ensure_payload_indices` oder No-Op, falls beides fehlt.
Änderungen gegenüber 3.8.1
--------------------------
- Behebt IndentationError bei der vorherigen Patch-Einfügung.
- Konsolidiert alle Abwärtskompatibilitäten (Qdrant-Indices, qdrant_points, dim-Ermittlung).
"""
from __future__ import annotations
@ -103,8 +103,6 @@ except Exception:
return
client.upsert(collection_name=collection_name, points=points, wait=True)
# NEU: Type-Registry (optional)
try:
from app.core.type_registry import load_type_registry, resolve_note_type, get_type_config, effective_chunk_profile
@ -219,6 +217,8 @@ def _resolve_mode(val: Optional[str]) -> str:
def _env(key: str, default: str) -> str:
return (os.environ.get(key) or default).strip().lower()
def _resolve_dim(cfg) -> int:
# Try common attribute names on QdrantConfig
@ -239,7 +239,6 @@ def _resolve_dim(cfg) -> int:
continue
# Conservative default: MiniLM 384d (im Projekt üblich)
return 384
return (os.environ.get(key) or default).strip().lower()
# ---------------------------------------------------------------------
@ -501,7 +500,7 @@ def main() -> None:
note_pl["hash_fulltext"] = old_payload.get("hash_fulltext", note_pl.get("hash_fulltext"))
note_pl["hash_signature"] = old_payload.get("hash_signature", note_pl.get("hash_signature"))
note_pl["hashes"] = merged_hashes
notes_name, note_pts = points_for_note(cfg.prefix, note_pl, None, dim)
notes_name, note_pts = _points_for_note(cfg.prefix, note_pl, None, dim)
_upsert_batch(client, notes_name, note_pts)
continue
@ -514,7 +513,7 @@ def main() -> None:
except Exception as e:
print(json.dumps({"path": path, "note_id": note_id, "warn": f"purge failed: {e}"}))
notes_name, note_pts = points_for_note(cfg.prefix, note_pl, None, dim)
notes_name, note_pts = _points_for_note(cfg.prefix, note_pl, None, dim)
_upsert_batch(client, notes_name, note_pts)
if chunk_pls:
chunks_name, chunk_pts = _points_for_chunks(cfg.prefix, chunk_pls, vecs)