mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 00:50:36 +08:00
- Add new `deeptutor/book/` module with multi-agent pipeline (ideation, spine, page planner, source explorer, synthesizer) and rich block system (text, code, figure, quiz, flash cards, callout, deep dive, timeline, animation, concept graph, etc.) - Add `/api/routers/book.py` and `deeptutor_cli/book.py` entry points - Add web UI under `web/app/(workspace)/book/` with sidebar, chat panel, page reader, spine editor, progress timeline, and block renderers - Move `deeptutor/agents/co_writer` -> `deeptutor/co_writer` and `deeptutor/agents/guide` -> `deeptutor/guide` (then remove guide entirely now superseded by book) - Remove legacy guide UI, hooks, types, and API router - Update visualize agents/prompts, notebook service, prompt manager, session turn runtime, and shared services to support new flows - Refresh chat composer, sidebar, notebook selector, and locales Made-with: Cursor
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
Agent Configuration API - Provides agent metadata for data-driven UI.
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
# Agent registry - single source of truth for agent UI metadata
|
|
AGENT_REGISTRY = {
|
|
"solve": {
|
|
"icon": "HelpCircle",
|
|
"color": "blue",
|
|
"label_key": "Problem Solved",
|
|
},
|
|
"question": {
|
|
"icon": "FileText",
|
|
"color": "purple",
|
|
"label_key": "Question Generated",
|
|
},
|
|
"research": {
|
|
"icon": "Search",
|
|
"color": "emerald",
|
|
"label_key": "Research Report",
|
|
},
|
|
"co_writer": {
|
|
"icon": "PenTool",
|
|
"color": "amber",
|
|
"label_key": "Co-Writer",
|
|
},
|
|
}
|
|
|
|
|
|
@router.get("/agents")
|
|
async def get_agent_config():
|
|
"""
|
|
Get agent UI configuration.
|
|
|
|
Returns:
|
|
Dict mapping agent type to UI metadata (icon, color, label_key)
|
|
"""
|
|
return AGENT_REGISTRY
|
|
|
|
|
|
@router.get("/agents/{agent_type}")
|
|
async def get_single_agent_config(agent_type: str):
|
|
"""
|
|
Get UI configuration for a specific agent.
|
|
|
|
Args:
|
|
agent_type: Agent type (solve, question, research, etc.)
|
|
|
|
Returns:
|
|
Agent UI metadata or 404 if not found
|
|
"""
|
|
if agent_type in AGENT_REGISTRY:
|
|
return AGENT_REGISTRY[agent_type]
|
|
return {"error": f"Agent type '{agent_type}' not found"}
|