DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: suppress Turn cancelled error during module switch (P1-1)
unknown1224036111dd
diff --git a/web/app/(workspace)/learning/[bookId]/page.tsx b/web/app/(workspace)/learning/[bookId]/page.tsxindex 5fc2496b8..80198b655 100644--- a/web/app/(workspace)/learning/[bookId]/page.tsx+++ b/web/app/(workspace)/learning/[bookId]/page.tsx@@ -33,6 +33,7 @@ export default function LearningBookPage() {const [waitingForLLM, setWaitingForLLM] = useState(false);const [error, setError] = useState<string | null>(null);const errorRef = useRef<boolean>(false);+ const moduleSwitchRef = useRef<boolean>(false);const activeTurnRetryRef = useRef<boolean>(false);const [toast, setToast] = useState("");const wsRef = useRef<WebSocket | null>(null);@@ -156,6 +157,10 @@ export default function LearningBookPage() {clearTimeout(autoAdvanceTimerRef.current);autoAdvanceTimerRef.current = null;}+ // Suppress the "Turn cancelled" error that follows cancel_turn.+ moduleSwitchRef.current = true;+ errorRef.current = false;+ setError(null);const e = evt as unknown as Record<string, unknown>;if (e.success !== false) {setCurrentModuleId(typeof e.module_id === "string" ? e.module_id : "");@@ -241,6 +246,7 @@ export default function LearningBookPage() {fetchProgressRef.current();}} else if (evt.type === "done") {+ moduleSwitchRef.current = false;// Auto-advance after turn completes.// Skip if: terminal "completed" stage exists, any error stage exists, or errorRef is set.const hasCompletedTerminal = stagesRef.current.some(s => s.stage === "completed" && s.status === "completed");@@ -270,6 +276,10 @@ export default function LearningBookPage() {autoAdvanceTimerRef.current = setTimeout(() => sendContinue(3), 500);}} else if (evt.type === "error") {+ // Ignore cancellation errors from the old turn during module switch.+ if (moduleSwitchRef.current && evt.content?.includes("cancelled")) {+ return;+ }setError(evt.content);errorRef.current = true;// Check if this is a recoverable "active turn" error