feat: Carte mentale interactive avec vérification IA et export PDFfeat: add mindmap PDF export and agent verification - #277
Conversation
|
The PR description is well structured (user story, testing steps, screenshots) - that part is solid. What's missing: there's no documentation file in docs/ for this feature (mind map generation, AI verification, PDF export). Per the project rule, this needs at least a technical doc (endpoints, data models for mind maps) and a user guide, since there's a UI for students. Could you add these before this is ready for review? |
|
Thanks for the feedback! I've added both documentation files as requested:
Both are pushed now. Ready for review 🙏 |
|
Hi, thk for contuning dev. |
|
@pr-elhajji Thanks! I'll update the design to better match the OpenTutorAI style. |
There was a problem hiding this comment.
Pull request overview
Adds a new “Mind Map” learning workflow that lets students build a concept map for a chat session, request AI-based verification/feedback, and export the result as a PDF. This spans a new FastAPI router, a new frontend API client, and a dedicated student UI page, with supporting documentation and a backend PDF dependency.
Changes:
- Added new backend
/api/v1/mindmap/*endpoints for context extraction, verification, and PDF export. - Added a frontend API client and a new student mind map editor page.
- Added initial user/technical docs and introduced
reportlabfor PDF generation.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| gateway/http/routers/mindmap.py | Implements mindmap context extraction, verification, and PDF export endpoints (currently needs cleanup + wiring). |
| ui/src/lib/apis/mindmap.ts | Adds UI fetch wrappers for mindmap context/verify/export endpoints. |
| ui/src/routes/student/mindmap/[id]/+page.svelte | New interactive mind map editor UI with verification overlay and PDF download trigger. |
| requirements.txt | Adds reportlab dependency for backend PDF generation. |
| docs/mindmap-user-guide.md | Adds end-user guidance for the mind map feature. |
| docs/mindmap-technical.md | Adds technical/API documentation for the new endpoints and payloads. |
| import { getMindmapContext, verifyMindmap, exportMindmapPDF } from '$lib/apis/mindmap'; | ||
| import { getMindmapContext, verifyMindmap, exportMindmapPDF } from '$lib/apis/mindmap'; |
| <input | ||
| class="node-input" | ||
| bind:value={editValue} | ||
| on:blur={finishEdit} | ||
| on:keydown={(e) => { | ||
| if (e.key === 'Enter' || e.key === 'Escape') finishEdit(); | ||
| }} | ||
| autofocus | ||
| /> |
| on:dblclick|stopPropagation={() => startEdit(node.id)} | ||
| role="button" | ||
| tabindex="0" | ||
| > |
| from fastapi.responses import StreamingResponse | ||
| import io |
| class ExportRequest(BaseModel): | ||
| nodes: List[MindMapNode] | ||
| edges: List[MindMapEdge] | ||
| title: str = "Carte Mentale" | ||
|
|
| | color | string | Node color | | ||
| | position | {x, y} | Canvas coordinates | |
| ### MindMapEdge | ||
| | Field | Type | Description | | ||
| |---|---|---| | ||
| | source | string | Source node ID | | ||
| | target | string | Target node ID | |
|
|
||
| ## Tips | ||
| - Try to have at least 4 well-connected concepts for validation | ||
| - Screenshots: [insert relevant screenshots from your PR here] No newline at end of file |
| ```json | ||
| { | ||
| "validated": true/false, | ||
| "score": ..., | ||
| "covered_concepts": [...], | ||
| "missing_concepts": [...], | ||
| "feedback": "..." | ||
| } |
| from reportlab.lib.pagesizes import A4 | ||
| from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer | ||
| from reportlab.lib.styles import getSampleStyleSheet | ||
| from reportlab.lib import colors |
|
Salam @YassineElbaite I went through this after @baaki-hicham's review and Copilot's automated pass, both of which are thorough and still fully open — checked the current code and nothing on either list has been addressed yet (the last commit is from before both reviews landed). Please work through baaki-hicham's 3 blockers (duplicate frontend import, duplicate Two things on top of that, not previously flagged: The mindmap router isn't registered anywhere. Checked Zero i18n in the new page. Also worth a mention: Given how much is still open, probably worth doing a full pass against baaki-hicham's and Copilot's comments plus the two above before requesting another review. |

New Feature — Interactive Mind Map
What this contribution adds:
Mind map generation from concepts studied
during the chat session with the AI tutor
AI Agent Verification — the agent compares
the student's mind map with the concepts covered
in the conversation and provides a score + feedback
PDF Export — the student can download
their mind map as a PDF after validation
Files changed:
gateway/http/routers/mindmap.py→ Backend API endpointsui/src/lib/apis/mindmap.ts→ Frontend API clientui/src/routes/student/mindmap/[id]/+page.svelte→ UI Interfacerequirements.txt→ Added reportlab dependencyHow to test:
/student/mindmap/[chat_id]User Story:
As a student, I want a visual and interactive mind map
to be generated from my learning session concepts,
verified by an AI agent, and downloadable as PDF,
so that I can visualize and memorize the course structure.
Screenshots
1. Chat interface — "Carte Mentale" button

Students can launch the mind map feature directly from their tutoring session.
2. Mind map editor — initial loading




⚠️ Improvement overlay — missing concepts

The interactive canvas loads the session context (nodes, colors, drag & drop tips).
3. Suggested concepts from the session
Concepts automatically extracted from the chat are suggested as starting nodes.
4. Completed mind map example
Example of a student-built mind map on Object-Oriented Programming (OOP).
5. Success overlay — AI verification passed
When the map is validated by the AI agent, the student gets positive feedback and can download the PDF.
6.
If the map is incomplete, the agent suggests adding more concepts, with the option to improve manually or let the agent complete it.
Contributors:
Yassine EL BAITE