Files
DeepTutor/deeptutor/agents/visualize/models.py
Bingxi Zhao (Frank) df844b8216 feat: add visualize capability with Chart.js/SVG rendering pipeline
- Add visualize agent pipeline (analysis → code generation → review)
- Add VisualizeCapability with request config and registry wiring
- Add frontend VisualizeConfigPanel, VisualizationViewer components
- Add chart.js and react-chartjs-2 dependencies
- Improve math_animator YON_IMAGE anchor block prompts (en/zh)
- Add minimax model override (supports_response_format: false)
- Suppress noisy uvicorn WebSocket connection logs
- Add selective HTTP access logging middleware (non-200 only)

Made-with: Cursor
2026-04-10 20:09:36 +08:00

52 lines
1.5 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"] = Field(
description="Whether to render as raw SVG or as a Chart.js configuration.",
)
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.",
)
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.",
)