Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

Merge branch 'guide2.0' into dev: book capability + restructure

Bingxi Zhao (Frank)72a9dc9f3acd
diff --cc deeptutor/services/prompt/manager.py
index 7c355d5d9,ee1ef9e87..f0c7b80b5
--- a/deeptutor/services/prompt/manager.py
+++ b/deeptutor/services/prompt/manager.py
@@@ -25,20 -25,14 +25,24 @@@ class PromptManager
}
# Supported modules
- MODULES = ["research", "solve", "question", "co_writer", "math_animator", "book"]
+ MODULES = [
+ "research",
+ "solve",
- "guide",
+ "question",
+ "co_writer",
+ "math_animator",
++ "book",
+ "notebook",
+ "visualize",
+ "chat",
+ ]
# Modules that are not under deeptutor/agents/ directory
- NON_AGENT_MODULES: dict[str, str] = {}
+ # Map module_name → on-disk path component under deeptutor/
+ NON_AGENT_MODULES: dict[str, str] = {
+ "book": "book",
+ "co_writer": "co_writer",
+ }
def __new__(cls) -> "PromptManager":
if cls._instance is None:
diff --cc web/components/visualize/VisualizationViewer.tsx
index 77b04b71d,1778eb08f..cfe946dfd
--- a/web/components/visualize/VisualizationViewer.tsx
+++ b/web/components/visualize/VisualizationViewer.tsx
@@@ -70,8 -70,52 +71,53 @@@ function ChartJsRenderer({ config }: {
);
}
+ function HtmlRenderer({ html }: { html: string }) {
+ const iframeRef = useRef<HTMLIFrameElement>(null);
+
+ const prepared = useMemo(() => prepareIframeHtml(html || ""), [html]);
+
+ useEffect(() => {
+ const iframe = iframeRef.current;
+ if (!iframe) return;
+ iframe.srcdoc = prepared;
+ }, [prepared]);
+
+ const handleOpenInNewTab = () => {
+ try {
+ const blob = new Blob([prepared], { type: "text/html" });
+ const url = URL.createObjectURL(blob);
+ window.open(url, "_blank", "noopener,noreferrer");
+ // Best-effort cleanup; the new tab keeps its own reference.
+ setTimeout(() => URL.revokeObjectURL(url), 60_000);
+ } catch {
+ /* no-op */
+ }
+ };
+
+ return (
+ <div className="relative w-full">
+ <button
+ type="button"
+ onClick={handleOpenInNewTab}
+ className="absolute right-2 top-2 z-10 inline-flex items-center gap-1 rounded-md border border-[var(--border)] bg-[var(--background)]/90 px-2 py-1 text-[10px] font-medium text-[var(--muted-foreground)] backdrop-blur transition-colors hover:text-[var(--foreground)]"
+ title="Open in new tab"
+ >
+ <ExternalLink size={10} strokeWidth={1.8} />
+ Open
+ </button>
+ <iframe
+ ref={iframeRef}
+ title="HTML visualization"
+ sandbox="allow-scripts"
+ className="w-full rounded-lg border border-[var(--border)] bg-white"
+ style={{ minHeight: 480, height: 560 }}
+ />
+ </div>
+ );
+ }
+
function SvgRenderer({ svg }: { svg: string }) {
+ const { t } = useTranslation();
const containerRef = useRef<HTMLDivElement>(null);
const [error, setError] = useState<string | null>(null);