Dateien nach "scripts" hochladen
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s

This commit is contained in:
Lars 2025-11-08 15:29:32 +01:00
parent c0b96f7c05
commit 7cde2462ec

View File

@ -2,18 +2,13 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Script: scripts/import_markdown.py Markdown Qdrant (Notes, Chunks, Edges) Script: scripts/import_markdown.py Markdown Qdrant (Notes, Chunks, Edges)
Version: 3.8.0 Version: 3.8.1
Datum: 2025-11-08 Datum: 2025-11-08
Erweiterung (WP-03 Type-Registry) Änderung in 3.8.1
--------------------------------- ------------------
- Lädt optional config/types.yaml. - Abwärtskompatibler Import von `ensure_payload_indexes`:
- Unbekannte/fehlende Typen Fallback "concept" (Warnung, kein Abbruch). Fallback auf `ensure_payload_indices` oder No-Op, falls beides fehlt.
- chunk_profile des Typs wird an make_chunk_payloads(...) übergeben (optional).
- retriever_weight wird falls vorhanden als Feld im Note-Payload gespeichert.
- edge_defaults["references"] aktiviert *additiv* Note-Scope-References/Backlinks.
Abwärtskompatibel: Ohne Registry/Typ bleibt das Verhalten identisch zum Stand 20251105.
""" """
from __future__ import annotations from __future__ import annotations
@ -38,12 +33,25 @@ try:
from app.core.derive_edges import build_edges_for_note from app.core.derive_edges import build_edges_for_note
except Exception: # pragma: no cover except Exception: # pragma: no cover
from app.core.edges import build_edges_for_note # type: ignore from app.core.edges import build_edges_for_note # type: ignore
# Qdrant-Basics
from app.core.qdrant import ( from app.core.qdrant import (
QdrantConfig, QdrantConfig,
get_client, get_client,
ensure_collections, ensure_collections,
ensure_payload_indexes,
) )
# Abwärtskompatibler Import für Payload-Index-Erzeugung
try:
from app.core.qdrant import ensure_payload_indexes as _ensure_payload_indexes
except Exception:
try:
from app.core.qdrant import ensure_payload_indices as _ensure_payload_indexes # älterer Funktionsname
except Exception:
def _ensure_payload_indexes(*_args, **_kwargs):
# No-Op: ältere Releases ohne dedizierte Index-Funktion
return None
from app.core.qdrant_points import ( from app.core.qdrant_points import (
points_for_chunks, points_for_chunks,
points_for_note, points_for_note,
@ -214,7 +222,8 @@ def main() -> None:
cfg.prefix = args.prefix.strip() cfg.prefix = args.prefix.strip()
client = get_client(cfg) client = get_client(cfg)
ensure_collections(client, cfg.prefix, cfg.dim) ensure_collections(client, cfg.prefix, cfg.dim)
ensure_payload_indexes(client, cfg.prefix) # abwärtskompatible Index-Erstellung
_ensure_payload_indexes(client, cfg.prefix)
# Type-Registry laden (optional) # Type-Registry laden (optional)
reg = None reg = None
@ -414,7 +423,7 @@ def main() -> None:
merged_hashes = {} merged_hashes = {}
merged_hashes.update(old_hashes) merged_hashes.update(old_hashes)
merged_hashes.update(note_pl.get("hashes") or {}) merged_hashes.update(note_pl.get("hashes") or {})
if old_payload: if has_old and old_payload:
note_pl["hash_fulltext"] = old_payload.get("hash_fulltext", note_pl.get("hash_fulltext")) 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["hash_signature"] = old_payload.get("hash_signature", note_pl.get("hash_signature"))
note_pl["hashes"] = merged_hashes note_pl["hashes"] = merged_hashes