This commit is contained in:
1 parent
23b1cb2966
commit
e9532e8878
30 files changed
+1835
-542
No files matched your search
@@ -1,4 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
FILE: scripts/preview_chunks.py
|
||||
VERSION: 2.1.0 (2025-12-15)
|
||||
STATUS: Active
|
||||
COMPATIBILITY: v2.9.1 (Post-WP14/WP-15b)
|
||||
|
||||
Zweck:
|
||||
-------
|
||||
Zeigt eine Vorschau der Chunk-Struktur für Notizen im Vault.
|
||||
Nützlich zur Analyse der Chunking-Strategie und Nachbarschafts-Links.
|
||||
|
||||
Funktionsweise:
|
||||
---------------
|
||||
1. Scannt alle Markdown-Dateien im Vault
|
||||
2. Für jede Datei:
|
||||
- Erzeugt Note-Payload
|
||||
- Erstellt Chunks via assemble_chunks
|
||||
- Erzeugt Chunk-Payloads
|
||||
3. Gibt JSON pro Note aus mit Chunk-Details
|
||||
|
||||
Ergebnis-Interpretation:
|
||||
------------------------
|
||||
- Ausgabe: JSON-Objekte (ein Objekt pro Note, eine Zeile pro Objekt)
|
||||
- Jedes Objekt enthält:
|
||||
* note_id, title
|
||||
* num_chunks: Anzahl der Chunks
|
||||
* avg_tokens: Durchschnittliche Token pro Chunk
|
||||
* chunks: Array mit Chunk-Details (id, tokens, section, prev, next)
|
||||
|
||||
Verwendung:
|
||||
-----------
|
||||
- Analyse der Chunk-Verteilung
|
||||
- Validierung der Nachbarschafts-Links
|
||||
- Debugging von Chunking-Problemen
|
||||
|
||||
Hinweise:
|
||||
---------
|
||||
- Nutzt synchrones assemble_chunks (kann async sein)
|
||||
- Zeigt nur Struktur, keine Inhalte
|
||||
|
||||
Aufruf:
|
||||
-------
|
||||
python3 -m scripts.preview_chunks --vault ./vault
|
||||
python3 -m scripts.preview_chunks --vault ./vault --note-id my-note-id
|
||||
|
||||
Parameter:
|
||||
----------
|
||||
--vault PATH Pfad zum Vault-Verzeichnis (erforderlich)
|
||||
--note-id ID Nur eine bestimmte Note verarbeiten (optional)
|
||||
|
||||
Änderungen:
|
||||
-----------
|
||||
v2.1.0 (2025-12-15): Dokumentation aktualisiert
|
||||
v1.0.0: Initial Release
|
||||
"""
|
||||
from __future__ import annotations
|
||||
import argparse, os, glob, json
|
||||
from app.core.parser import read_markdown, normalize_frontmatter, validate_required_frontmatter
|
||||
|
||||
Reference in new issue
Block a user