This commit is contained in:
team3
2026-06-18 00:00:24 +02:00
parent 3c839861e7
commit 229880b7e6
15 changed files with 374 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
from pathlib import Path
from config import STORAGE_DIR, PROJECTS_DIR
from config import STORAGE_DIR, PROJECTS_DIR, PROJECT_ROOT
THEMEN_DIR = STORAGE_DIR / "themen"
@@ -26,6 +26,28 @@ def subbausteine_path(topic: str) -> Path:
return topic_dir(topic) / "subbausteine.json"
def quelle_path(topic: str) -> Path:
"""Persistierte Quellen-Wahl pro Thema: {type, ort, spec}."""
return topic_dir(topic) / "quelle.json"
def quelle_crawl_dir(topic: str) -> Path:
"""Zielordner für gecrawlte Link-Quellen (Seiten + PDF-.txt)."""
return topic_dir(topic) / "quelle"
def safe_ordner(ort: str) -> Path | None:
"""Ordnerpfad relativ zum Repo-Root, gesandboxt. None bei leer/Ausbruch (../, absolut außerhalb)."""
if not ort or not ort.strip():
return None
p = (PROJECT_ROOT / ort.strip()).resolve()
try:
p.relative_to(PROJECT_ROOT)
except ValueError:
return None
return p
def guide_content_path(topic: str, format_name: str) -> Path:
return topic_dir(topic) / "guides" / f"{format_name}.json"