Wire AI-generated images into the UI: entity portraits in wiki page infobox area, hypothesis visual cards on hypothesis detail pages, pathway infographics and debate cards on analysis pages. Images are optional — pages work without them. Add API endpoint POST /api/images/generate for on-demand generation.
## REOPENED TASK — CRITICAL CONTEXT
This task was previously marked 'done' but the audit could not verify
the work actually landed on main. The original work may have been:
- Lost to an orphan branch / failed push
- Only a spec-file edit (no code changes)
- Already addressed by other agents in the meantime
- Made obsolete by subsequent work
**Before doing anything else:**
1. **Re-evaluate the task in light of CURRENT main state.** Read the
spec and the relevant files on origin/main NOW. The original task
may have been written against a state of the code that no longer
exists.
2. **Verify the task still advances SciDEX's aims.** If the system
has evolved past the need for this work (different architecture,
different priorities), close the task with reason "obsolete: "
instead of doing it.
3. **Check if it's already done.** Run `git log --grep=''`
and read the related commits. If real work landed, complete the
task with `--no-sha-check --summary 'Already done in '`.
4. **Make sure your changes don't regress recent functionality.** Many
agents have been working on this codebase. Before committing, run
`git log --since='24 hours ago' -- ` to see what
changed in your area, and verify you don't undo any of it.
5. **Stay scoped.** Only do what this specific task asks for. Do not
refactor, do not "fix" unrelated issues, do not add features that
weren't requested. Scope creep at this point is regression risk.
If you cannot do this task safely (because it would regress, conflict
with current direction, or the requirements no longer apply), escalate
via `orchestra escalate` with a clear explanation instead of committing.
Git Commits (2)
[Atlas] Update spec work log with corrected push info [task:8b68a328-f554-40c0-84ee-b770a9b98e7a]2026-04-17
Wire AI-generated images into the UI: entity portraits in wiki page infobox area, hypothesis visual cards on hypothesis detail pages, pathway infographics and debate cards on analysis pages. Images are optional — pages work without them. Add API endpoint POST /api/images/generate for on-demand generation.
Acceptance Criteria
☑ Concrete deliverables created
☑ Work log updated with timestamped entry
Work Log
2026-04-17 15:30 PT — Slot 64 (minimax)
Investigated existing code: scidex/forge/image_generator.py already has full image generation infrastructure (entity_portrait, hypothesis_visual, pathway_infographic, debate_card, protocol_illustration types) using MiniMax image-01 and GLM CogView-4 providers
Added helper functions in api.py: _fetch_ai_portrait_url, _fetch_hypothesis_visual_url, _fetch_analysis_figure_urls to query existing AI-generated figures from the artifacts table
Added POST /api/images/generate endpoint at line 7075 in api.py — accepts image_type, entity_name/hypothesis_id/analysis_id params, routes to appropriate generator function
Wire entity portraits into entity page: added portrait HTML block before {entity_infobox_html} in entity_detail page — shows existing portrait or "Generate portrait" button if none exists
Wire hypothesis visual cards into hypothesis_detail page: added hyp_visual_html block before {artifacts_html} — shows existing visual card or "Generate visual card" button
Wire pathway infographics and debate cards into analysis_detail_main page: added pathway_inflex_html and debate_card_html sections before {figures_html} with generate buttons for each
All UI wiring is optional — pages render without images if none exist
Initial push blocked: commit message did not explicitly mention api.py (critical file)
Fixed by soft-resetting to 8704ab71c and amending with proper message mentioning api.py
Force-pushed corrected commit 0a73e7b4c to origin/orchestra/task/8b68a328... — verified successful
Payload JSON
{
"requirements": {
"coding": 7
},
"_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
"_reset_at": "2026-04-18T06:29:22.046013+00:00",
"_reset_from_status": "done"
}