Files
DeepTutor/web/components/math-animator/MathAnimatorConfigPanel.tsx
Bingxi Zhao (Frank) 5f29b508e0 refactor(prompts): externalize answer_now/notebook prompts to YAML and tidy capability/UI configs
- Move inline LLM prompts out of capabilities/agents into versioned
  prompt YAMLs under each agent's prompts/{en,zh}/:
  - notebook: analysis_agent, summarize_agent
  - question/research/solve/visualize: answer_now
- Slim down capability modules (_answer_now, deep_question,
  deep_research, deep_solve, visualize) to load prompts via the
  prompt manager instead of hard-coding strings
- Update services/prompt/manager.py to support the new prompt paths
- Refresh web config panels (quiz, research, visualize, math-animator)
  and shared types to align with the new capability options
- Update Mermaid, ChatMessages, TracePanels and settings page,
  plus en/zh locales for the new copy

Made-with: Cursor
2026-04-20 17:34:33 +08:00

76 lines
2.2 KiB
TypeScript

"use client";
import { useTranslation } from "react-i18next";
import {
summarizeMathAnimatorConfig,
type MathAnimatorFormConfig,
} from "@/lib/math-animator-types";
import {
CollapsibleConfigSection,
Field,
INPUT_CLS,
} from "@/components/chat/home/composer-field";
interface MathAnimatorConfigPanelProps {
value: MathAnimatorFormConfig;
onChange: (next: MathAnimatorFormConfig) => void;
collapsed: boolean;
onToggleCollapsed: () => void;
}
export default function MathAnimatorConfigPanel({
value,
onChange,
collapsed,
onToggleCollapsed,
}: MathAnimatorConfigPanelProps) {
const { t } = useTranslation();
const update = <K extends keyof MathAnimatorFormConfig>(
key: K,
val: MathAnimatorFormConfig[K],
) => onChange({ ...value, [key]: val });
return (
<CollapsibleConfigSection
collapsed={collapsed}
summary={summarizeMathAnimatorConfig(value, t)}
onToggleCollapsed={onToggleCollapsed}
bodyClassName="flex flex-wrap items-end gap-x-3 gap-y-2 px-3.5 pb-2.5"
>
<Field label={t("Output")} width="w-[100px]">
<select
value={value.output_mode}
onChange={(e) => update("output_mode", e.target.value as MathAnimatorFormConfig["output_mode"])}
className={`${INPUT_CLS} w-full`}
>
<option value="video">{t("Video")}</option>
<option value="image">{t("Image")}</option>
</select>
</Field>
<Field label={t("Quality")} width="w-[100px]">
<select
value={value.quality}
onChange={(e) => update("quality", e.target.value as MathAnimatorFormConfig["quality"])}
className={`${INPUT_CLS} w-full`}
>
<option value="low">{t("Low")}</option>
<option value="medium">{t("Medium")}</option>
<option value="high">{t("High")}</option>
</select>
</Field>
<Field label={t("Style Hint")} width="min-w-[160px] flex-1">
<input
type="text"
value={value.style_hint}
onChange={(e) => update("style_hint", e.target.value)}
placeholder={t("Style, pacing, color...")}
className={`${INPUT_CLS} w-full`}
/>
</Field>
</CollapsibleConfigSection>
);
}