diff --git a/Dockerfile b/Dockerfile index cb2f81a..1ad6a6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ gnupg \ + poppler-utils \ && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && npm install -g @anthropic-ai/claude-code opencode-ai \ diff --git a/Makefile b/Makefile index f8f752a..07e15ef 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ auth: install: pip install --break-system-packages fastapi uvicorn[standard] aiosqlite uv + @which pdftotext >/dev/null 2>&1 || sudo apt-get install -y poppler-utils cd frontend && npm install npm install -g opencode-ai @mkdir -p $(HOME)/.config/opencode diff --git a/backend/generator.py b/backend/generator.py index be6a475..a89f966 100644 --- a/backend/generator.py +++ b/backend/generator.py @@ -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: