GNAI-023 M8-T4 Fix: Report-Download (PDF via weasyprint, /outputs-Routing im NPM)
'No pdf path provided': md2pdf im gptr-Image braucht playwright/chromium (nicht installiert) -> write_md_to_pdf faellt auf '' zurueck. sitecustomize ersetzt sie durch weasyprint (im Image funktionsfaehig). docx-404: NPM-vHost leitete /outputs/ an den Frontend-Container; neue location /outputs/ mit auth_request + Proxy auf Backend :8086 + rewrite gegen das vom Frontend verdoppelte outputs/outputs/-PREFIX. Verifiziert: PDF wird erzeugt, nginx -t ok, unauth /outputs -> 302 Keycloak, beide Playbooks idempotent. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -274,3 +274,25 @@ Internet → NPM (CT 103, 443) → auth_request-Subrequest an oauth2-proxy
|
||||
Backend-Container: `Memory("custom",…).get_embeddings().embed_query()` →
|
||||
768-dim Vektor über `llama-cpp-embed`, `OPENAI_BASE_URL` bleibt
|
||||
`llama-cpp`. research.yml idempotent (changed=0).
|
||||
|
||||
- **Befund 21.11. (Report-Download: „No pdf path provided“ / docx 404):**
|
||||
zwei unabhängige Ursachen. (a) PDF: `write_md_to_pdf` nutzt `md2pdf`
|
||||
(braucht playwright+chromium — im Image beides nicht installiert) →
|
||||
Exception wird geschluckt, Rückgabe `""` → Frontend loggt „No pdf path
|
||||
provided“ und rendert `href="#"` (Klick landet auf der Main Page).
|
||||
(b) docx/md: Backend schreibt die Dateien nach `outputs/` und mountet
|
||||
`/outputs` via StaticFiles, das gptr-nextjs-Frontend baut aber
|
||||
same-origin-Links `outputs/<pfad>` — die NPM-vHost leitete `/outputs/`
|
||||
bisher an den FRONTEND-Container (location /) → 404. Zusätzlich
|
||||
verdoppelt das Frontend das Präfix (`"outputs/" + output.pdf`, der
|
||||
Backend-Pfad enthält `outputs/` bereits) → `outputs/outputs/...`.
|
||||
- **Fix 21.11.:** (a) `sitecustomize_gnai.py` ersetzt `backend.utils.
|
||||
write_md_to_pdf` durch eine weasyprint-Implementierung (mistune → HTML →
|
||||
weasyprint 64.1, im Image vorhanden und funktionsfähig; CSS aus
|
||||
`frontend/pdf_styles.css`). Verifiziert: `write_md_to_pdf('# Test…')` →
|
||||
`outputs/verify_pdf.pdf`. (b) NPM-vHost um `location /outputs/` ergänzt
|
||||
(auth_request + proxy auf Backend :8086 + `rewrite ^/outputs/outputs/
|
||||
(.*)$ /outputs/$1 break;` gegen das doppelte Präfix). Verifiziert:
|
||||
NPM-API host research.* enthält den Block, `nginx -t` ok, unauth
|
||||
`/outputs/test.md` → 302 Keycloak. research.yml + ct103 site.yml
|
||||
idempotent (jeweils changed=0).
|
||||
|
||||
Reference in New Issue
Block a user