How pangyongsheng/thinkcanvas works
ThinkCanvas turns a user’s text prompt into a Manim animation, with a script-review-and-confirm stage for complex prompts and conversational refinement after generation. The documented v1 flow passes through the HTTP API and AgentService, which orchestrates the supervisor, retrieves examples and memory, and persists agent activity; routes handle rendering and expose resulting media. The v2 task API is represented separately because its task CRUD is visible, but its generation orchestration is not established by the sampled source. The graph follows the README and sampled files; unsampled subsystem wiring is omitted.
Main entry points: service.py AgentService · main.py FastAPI app · supervisor.py Supervisor · client.py LLM adapter
Components 25
User experience
- Web interface
frontend/app/page.tsx - Task interface
frontend/app/v2/page.tsx
HTTP interface
- FastAPI app
backend/app/main.py - Generation routes
backend/app/api/v1 - Task routes
backend/app/api/v2 - Render endpoint
backend/app/api/v1/render.py
Generation workflow
- AgentService
backend/app/agents/service.py - Supervisor
backend/app/agents/supervisor.py - Script Designer
backend/app/agents/script_designer.py - Code generation
backend/app/agents/react_coder.py - Code review
backend/app/agents/reviewer.py - Agent persistence
backend/app/agents/middleware/persistence.py - LLM adapter
backend/app/llm/client.py
Personalization
- Example retrieval
backend/app/agents/retriever.py - Embeddings
backend/app/services/embeddings.py - Long-term memory
backend/app/agents/memory.py - Memory curator
backend/app/agents/memory_curator.py
State and output
- Data access
backend/app/agents/dao - PostgreSQL
backend/app/db - Manim renderer
backend/app/renderers/manim.py - Generated media
backend/app/main.py - Task storage
backend/app/agent2/storage/tasks_pg.py - V2 task models
backend/app/db/models_v2/task.py
Other components
- User
- LLM provider
Connections 29
- User → Web interface: enters prompt
- Web interface → FastAPI app: sends HTTP
- FastAPI app → Generation routes: dispatches routes
- Generation routes → AgentService: invokes workflow
- AgentService → Example retrieval: retrieves examples
- AgentService → Long-term memory: builds context
- Example retrieval → Embeddings: embeds queries
- AgentService → Supervisor: runs state graph
- Supervisor → Script Designer: routes scripting
- Supervisor → Code generation: routes coding
- Supervisor → Code review: routes review
- Code review → Code generation: returns feedback
- Code generation → LLM adapter: requests completion
- Script Designer → LLM adapter: requests completion
- Code review → LLM adapter: requests completion
- LLM adapter → LLM provider: calls provider
- AgentService → Agent persistence: invokes agent
- Agent persistence → Data access: persists activity
- AgentService → Data access: reads and updates
- Data access → PostgreSQL: reads and writes
- Generation routes → Manim renderer: delegates rendering
- Manim renderer → Generated media: writes video
- FastAPI app → Generated media: serves files
- Task interface → FastAPI app: sends HTTP
- FastAPI app → Task routes: dispatches routes
- Task routes → Task storage: manages tasks
- Task storage → V2 task models: reads and writes
- V2 task models → PostgreSQL: stored in
- Memory curator → Data access: updates memories