update
This commit is contained in:
@@ -305,11 +305,15 @@ def _pdfs_konvertieren(project: Path) -> None:
|
||||
|
||||
Wird vor jeder Projekt-Generierung aufgerufen; konvertiert nur, wenn die
|
||||
.txt fehlt oder älter als das PDF ist. Das Original bleibt unangetastet.
|
||||
Fehlt pdftotext und das Projekt enthält PDFs → harter Fehler statt
|
||||
unzuverlässigem Direkt-Lese-Modus (MiniMax-Bilderlimit, Vision-Kosten).
|
||||
"""
|
||||
if shutil.which("pdftotext") is None:
|
||||
_log(project.name, "pdftotext nicht installiert — PDFs bleiben unkonvertiert")
|
||||
pdfs = list(project.rglob("*.pdf"))
|
||||
if not pdfs:
|
||||
return
|
||||
for pdf in project.rglob("*.pdf"):
|
||||
if shutil.which("pdftotext") is None:
|
||||
raise RuntimeError("pdftotext fehlt (poppler-utils installieren) — PDFs im Projekt können nicht gelesen werden")
|
||||
for pdf in pdfs:
|
||||
txt = pdf.with_suffix(".txt")
|
||||
if txt.exists() and txt.stat().st_mtime >= pdf.stat().st_mtime:
|
||||
continue
|
||||
@@ -317,7 +321,7 @@ def _pdfs_konvertieren(project: Path) -> None:
|
||||
subprocess.run(["pdftotext", "-layout", str(pdf), str(txt)], check=True, timeout=120)
|
||||
_log(project.name, f"PDF konvertiert: {pdf.name} → {txt.name}")
|
||||
except Exception as e:
|
||||
_log(project.name, f"PDF-Konvertierung fehlgeschlagen ({pdf.name}): {e}")
|
||||
raise RuntimeError(f"PDF-Konvertierung fehlgeschlagen ({pdf.name}): {e}") from e
|
||||
|
||||
|
||||
def _build_recherche_prompt(topic: str, out_path: Path, instructions: str = "", project: Path | None = None) -> str:
|
||||
|
||||
Reference in New Issue
Block a user