fix(pipeline): charts/diagrams now ship when user asks for them - #8
Merged
Merged
Conversation
Three coordinated fixes so a request like "imágenes, diagramas y gráficas
OBLIGATORIAS" produces all three in the final .docx instead of only one
image-class output.
1) Mermaid renderer
- Chromium under the unprivileged container user was crashing with
"chrome_crashpad_handler: --database is required" because HOME and
the user-data-dir were unwritable. Dockerfile now provisions a
dedicated HOME and XDG dirs for studymation and the puppeteer args
pin --user-data-dir, --disable-crashpad and friends.
- DiagramRenderer.render now cascades: local mmdc first, then a
mermaid.ink HTTPS fallback. Preflight returns True whenever any
renderer is reachable so the orchestrator stops warning when only
the local binary is broken.
2) Visual auditor
- Detects explicit user intent (gráficas/diagramas/tablas/etc.) in
user_notes; scales the placement cap up to ~1 per section and tells
the LLM in the system prompt that both types are obligatory.
- If the auditor still omits the requested type, _force_placement
reserves a slot in the best eligible section so the injector can
generate it.
- chart_extraction_system_prompt(force_generation=True) refuses to
return null when the user asked for charts: synthesises illustrative
data instead of skipping silently.
3) Image download
- upload.wikimedia.org was returning 429 for the 3rd image in a row
and we dropped it. _download_and_normalize_image now retries 429/5xx
up to 3 times with exponential backoff and honors Retry-After.
Includes regression tests for user-intent detection, scaled placement
caps and the _force_placement fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three coordinated fixes so a request like "imágenes, diagramas y gráficas
OBLIGATORIAS" produces all three in the final .docx instead of only one
image-class output.
Mermaid renderer
"chrome_crashpad_handler: --database is required" because HOME and
the user-data-dir were unwritable. Dockerfile now provisions a
dedicated HOME and XDG dirs for studymation and the puppeteer args
pin --user-data-dir, --disable-crashpad and friends.
mermaid.ink HTTPS fallback. Preflight returns True whenever any
renderer is reachable so the orchestrator stops warning when only
the local binary is broken.
Visual auditor
user_notes; scales the placement cap up to ~1 per section and tells
the LLM in the system prompt that both types are obligatory.
reserves a slot in the best eligible section so the injector can
generate it.
return null when the user asked for charts: synthesises illustrative
data instead of skipping silently.
Image download
and we dropped it. _download_and_normalize_image now retries 429/5xx
up to 3 times with exponential backoff and honors Retry-After.
Includes regression tests for user-intent detection, scaled placement
caps and the _force_placement fallback.