Files
DeepTutor/deeptutor/agents/visualize/models.py
Bingxi Zhao (Frank) acd0d9329d feat(capabilities): unify infra, merge Animator into Visualize, split settings UI
Capability infrastructure:
- New capabilities/_shared.emit_capability_result helper fills the
  result envelope (label, summary, payload, render hints, UsageTracker
  totals) consistently across modes.
- StatusI18n loads capability status copy from
  capabilities/prompts/{en,zh}/<name>.yaml; legacy main.yaml strings
  removed.
- New capabilities_settings router + service-config module power the
  /settings/capabilities admin page (live capability list, defaults,
  per-capability overrides).

Visualize + Animator merge:
- Visualize's AnalysisAgent now picks one of six render_types:
  svg / chartjs / mermaid / html (text pipeline) or manim_video /
  manim_image (Manim subprocess). The result envelope carries
  render_type so the frontend delegates to the right viewer.
- math_animator capability is folded behind Visualize; the standalone
  MathAnimatorConfigPanel.tsx is removed. The Animator sidebar entry
  is gone, but Manim outputs and existing records remain unaffected.

Settings UI:
- /settings page split into appearance / capabilities / embedding /
  llm / mcp / memory / search / status / tools tabs with a shared
  layout and items index.
- New /settings/tools page lists chat-mountable tools and surfaces
  availability (e.g. gh for github_query) via a new tools router.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 18:06:14 +08:00

68 lines
2.1 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",
"manim_video",
"manim_image",
] = Field(
description=(
"Render output: raw SVG, a Chart.js configuration, a Mermaid "
"diagram, a self-contained interactive HTML page, or a Manim "
"animation (video) / storyboard image."
),
)
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.",
)