Quest Type: Recurring Layer: Forge (cross-cutting: Atlas, Agora, UI) Priority: 78
Add AI image generation as a first-class capability in SciDEX. Today, all figures are programmatic matplotlib SVGs (pathway diagrams, score comparisons, heatmaps). The target state is rich AI-generated visual artifacts — infographics, illustrated pathway diagrams, hypothesis summary cards, entity portraits — that make scientific content more accessible and engaging.
Generated images are registered as artifacts with provenance tracking, and their quality is automatically evaluated by vision models.
image_generator.py) works with MiniMax image-01 and GLM CogView-4data/metrics/image_quality.json> Quality evaluation scores images on: scientific accuracy (does the visual match the claim?), clarity (legible, on-theme), informativeness (shows non-obvious structure), and aesthetics (professional appearance). Threshold: accuracy >0.7 AND clarity >0.7, else regenerate. Images below threshold after 3 regeneration attempts are not published.
┌─────────────────────────────────────────────────────────┐
│ IMAGE GENERATION SERVICE │
│ image_generator.py │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐ │
│ │ MiniMax │ │ GLM CogView │ │ Prompt │ │
│ │ image-01 │ │ CogView-4 │ │ Templates │ │
│ │ (primary,$0) │ │ (fallback) │ │ (5 types) │ │
│ └──────┬───────┘ └──────┬───────┘ └───────┬───────┘ │
│ └─────────┬───────┘ │ │
│ v │ │
│ ┌─────────────────┐ │ │
│ │ generate_image │<──────────────────┘ │
│ │ (unified API) │ │
│ └────────┬────────┘ │
│ │ │
│ ┌────────v────────┐ ┌──────────────────┐ │
│ │ Save to disk │────>│ Register artifact │ │
│ │ site/figures/ │ │ artifact_registry │ │
│ └────────┬────────┘ └──────────────────┘ │
│ │ │
│ ┌────────v────────┐ │
│ │ Quality eval │ Vision model scores: │
│ │ (GLM-4.6V-Flash)│ accuracy, clarity, │
│ │ │ informativeness, aesthetics │
│ └─────────────────┘ │
└─────────────────────────────────────────────────────────┘Build image_generator.py with provider abstraction over MiniMax and GLM.
Provider: MiniMax image-01 (primary)
POST https://api.minimax.io/v1/image_generationMINIMAX_API_KEYmodel, prompt, aspect_ratio, response_format: "base64"data.image_base64 array of base64-encoded imagesGLM_API_KEYgenerate_image(prompt, aspect_ratio="16:9", provider="minimax", context_id=None)
→ {"artifact_id": "figure-...", "path": "site/figures/.../img.jpg", "provider": "minimax"}5 prompt template types, each with a builder function that takes structured data and produces a detailed image prompt:
generate_pathway_infographic(entity_name, kg_edges)generate_hypothesis_visual(hypothesis_id)generate_protocol_illustration(protocol_text, title)generate_debate_card(analysis_id)generate_entity_portrait(entity_name, entity_type, summary)Use a vision model to evaluate generated images on 4 dimensions (1-5 scale):
Evaluator options:quality_evaldata/metrics/image_quality.jsonPOST /api/images/generate — generate image by type, entity_ids, contextsite/figures/, same provenance system[Artifacts] Ensure all 18 spotlight notebooks have rich, executed content [task:4873cc51-d403-4726-b101-5143c6ddd918]nb_sea_ad_001: Had HTML with embedded figures but IPYNB had 0/16 executed cells → executed all 16 code cells via nbconvert --allow-errors, regenerated HTML (373KB, 101 embedded images)nb-SEA-AD-gene-expression-analysis: DB entry existed but file path was non-existent duplicate of SEA-AD-gene-expression-analysis → removed is_spotlight=1 flag (content already present under primary ID)nb-aging_mouse_brain_atlas_analysis: Same issue — duplicate entry with wrong path → removed is_spotlight=1 flag
nb-SEA-AD-gene-expression-analysis and nb-aging_mouse_brain_atlas_analysis DB entries had absolute paths /home/ubuntu/scidex/site/notebooks/... instead of site/notebooks/... → correctednb_sea_ad_001 DB rendered_html_path was absolute path → corrected to relative site/notebooks/nb_sea_ad_001.htmlnb-SDA-2026-04-03-gap-aging-mouse-brain-v3-20260402, nb-SDA-2026-04-03-gap-crispr-neurodegeneration-20260402) have fewer embedded images (5 vs 100+) but still above 50KB threshold — low figure count is due to notebook content type (not all notebooks generate many plots)sqlite3.connect('/home/ubuntu/scidex/scidex.db') → patched to use scidex.core.database.get_db() (PostgreSQL)notebook-SDA-2026-04-02-26abc5e5f9f2, nb-SDA-2026-04-02-gap-seaad-v3-20260402063622, nb-SDA-2026-04-02-gap-seaad-v4-20260402065846, nb-top5-SDA-2026-04-02-gap-aging-mouse-brain-20260402, nb-top5-SDA-2026-04-02-gap-aging-mouse-brain-v5-20260402, nb-top5-SDA-2026-04-02-gap-epigenetic-reprog-b685190e, nb-top5-SDA-2026-04-02-gap-ev-ad-biomarkers, nb-top5-SDA-2026-04-02-gap-seaad-v4-20260402065846, nb-spotlight-tau-propagation-2026, nb-spotlight-mitochondria-neurodegeneration-2026
rendered_html_path = NULL in DB → set to correct pathfile_path, ipynb_path, rendered_html_path in DB (relative paths site/notebooks/...)scripts/patch_notebooks_sqlite_to_pg.py and scripts/fix_spotlight_notebooks.py for reproducibilityplt.savefig('/tmp/...') (not inline) so HTML has no embedded PNG figures — this is a known notebook authoring pattern, not a quality issue