From c34df96839ca178c36427a64255b8e6c709bc8ae Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 9 Sep 2025 11:15:19 +0200 Subject: [PATCH] app/core/chunk_payload.py aktualisiert --- app/core/chunk_payload.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/app/core/chunk_payload.py b/app/core/chunk_payload.py index 014f144..3ef8377 100644 --- a/app/core/chunk_payload.py +++ b/app/core/chunk_payload.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ Modul: app/core/chunk_payload.py -Version: 1.1.0 +Version: 1.1.1 Datum: 2025-09-09 Kurzbeschreibung @@ -29,11 +29,6 @@ Abhängigkeiten Beispiele (CLI – Sichtprüfung) ------------------------------ python3 -m app.core.chunk_payload --from-file ./vault/demo.md --print - -Hinweis -------- -Die CLI ist ein Hilfsmittel zur Sichtprüfung. Im Produktpfad ruft der -Importer ``make_chunk_payloads(...)`` direkt auf. """ from __future__ import annotations @@ -44,11 +39,11 @@ import os try: # Projektinterne Imports - from app.core.chunker import Chunk - from app.core.parser import extract_wikilinks, parse_markdown + from app.core.chunker import Chunk, chunk_markdown + from app.core.parser import extract_wikilinks, read_markdown except Exception: # pragma: no cover - Fallback für relative Ausführung - from .chunker import Chunk # type: ignore - from .parser import extract_wikilinks, parse_markdown # type: ignore + from .chunker import Chunk, chunk_markdown # type: ignore + from .parser import extract_wikilinks, read_markdown # type: ignore # --------------------------------------------------------------------------- @@ -98,7 +93,7 @@ def make_chunk_payloads(note_meta: Dict[str, Any], path: str, chunks: List[Chunk "section_path": getattr(ch, "section_path", None), "lang": note_meta.get("lang"), "wikilinks": wikilinks, - "external_links": [], # kann später ergänzt werden + "external_links": [], "references": [{"target_id": w, "kind": "wikilink"} for w in wikilinks], "neighbors": { "prev": getattr(ch, "neighbors_prev", None), @@ -121,7 +116,7 @@ def _cli() -> None: ap.add_argument("--print", dest="do_print", action="store_true", help="Payload auf stdout ausgeben") args = ap.parse_args() - note = parse_markdown(args.src) + note = read_markdown(args.src) note_meta = { "id": note.frontmatter.get("id") or note.frontmatter.get("note_id"), "title": note.frontmatter.get("title"), @@ -132,8 +127,6 @@ def _cli() -> None: "lang": note.frontmatter.get("lang"), } - # Chunking (benötigt app.core.chunker) - from app.core.chunker import chunk_markdown # lazy import chunks = chunk_markdown(note.body or "") # Vault-Root heuristisch relativieren (nur für Demo)