mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 01:59:46 +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.9 KiB
Python
60 lines
1.9 KiB
Python
"""Data models for the visualize pipeline."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class VisualizationAnalysis(BaseModel):
|
|
"""Output of the analysis stage."""
|
|
|
|
render_type: Literal["svg", "chartjs", "mermaid", "html"] = Field(
|
|
description=(
|
|
"Whether to render as raw SVG, a Chart.js configuration, a Mermaid "
|
|
"diagram, or a self-contained interactive HTML page."
|
|
),
|
|
)
|
|
description: str = Field(
|
|
default="",
|
|
description="High-level description of what the visualization should show.",
|
|
)
|
|
data_description: str = Field(
|
|
default="",
|
|
description="Description of the data or elements to be visualized.",
|
|
)
|
|
chart_type: str = Field(
|
|
default="",
|
|
description=(
|
|
"Chart.js chart type (bar, line, pie, doughnut, radar, etc.) when render_type is chartjs, "
|
|
"Mermaid diagram type (flowchart, sequenceDiagram, mindmap, classDiagram, stateDiagram, etc.) "
|
|
"when render_type is mermaid, or a short interaction tag (e.g. 'interactive', 'animation', "
|
|
"'walkthrough') when render_type is html."
|
|
),
|
|
)
|
|
visual_elements: list[str] = Field(
|
|
default_factory=list,
|
|
description="Key visual elements to include (shapes, labels, axes, colors, etc.).",
|
|
)
|
|
rationale: str = Field(
|
|
default="",
|
|
description="Why this render_type was chosen over the alternative.",
|
|
)
|
|
|
|
|
|
class ReviewResult(BaseModel):
|
|
"""Output of the review / optimization stage."""
|
|
|
|
optimized_code: str = Field(
|
|
description="The final (potentially optimized) visualization code.",
|
|
)
|
|
changed: bool = Field(
|
|
default=False,
|
|
description="Whether the reviewer made modifications.",
|
|
)
|
|
review_notes: str = Field(
|
|
default="",
|
|
description="Notes on what was checked or changed.",
|
|
)
|