DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix: frontend error handling, submit debounce, i18n, API format adaptation
unknownc6faab4dfcad
diff --git a/web/app/(workspace)/book/page.tsx b/web/app/(workspace)/book/page.tsxindex 48f5eb598..4f68d5a54 100644--- a/web/app/(workspace)/book/page.tsx+++ b/web/app/(workspace)/book/page.tsx@@ -243,7 +243,7 @@ function BookPageInner() {const handleLearn = useCallback(async (book: Book) => {try {const allProgress = await fetchAllProgress();- const existing = allProgress.find((p: { book_id: string }) => p.book_id === book.id);+ const existing = allProgress.summaries.find((p: { book_id: string }) => p.book_id === book.id);if (existing && existing.modules_count > 0) {router.push(`/learning/${book.id}`);return;diff --git a/web/app/(workspace)/learning/[bookId]/page.tsx b/web/app/(workspace)/learning/[bookId]/page.tsxindex 80198b655..36279a7a4 100644--- a/web/app/(workspace)/learning/[bookId]/page.tsx+++ b/web/app/(workspace)/learning/[bookId]/page.tsx@@ -60,6 +60,7 @@ export default function LearningBookPage() {const modulesLengthRef = useRef(0);const moduleSelectedRef = useRef(false);const currentModuleIdRef = useRef("");+ const submittingRef = useRef(false);const handleModuleClick = useCallback((moduleId: string) => {if (moduleId === currentModuleId) return;@@ -80,7 +81,9 @@ export default function LearningBookPage() {setMasteryLevels(data.mastery_levels ?? {});setCurrentModuleId(data.current_module_id ?? "");})- .catch(() => {});+ .catch((err) => {+ console.warn("Failed to fetch progress:", err);+ });}, [params.bookId]);const fetchProgressRef = useRef(fetchProgress);@@ -333,8 +336,8 @@ export default function LearningBookPage() {return (<div className="flex items-center justify-center h-full"><div className="text-center max-w-md">- <h2 className="text-xl font-bold mb-2">Select a Module</h2>- <p className="text-sm text-[var(--muted-foreground)] mb-6">Choose a module to start guided learning</p>+ <h2 className="text-xl font-bold mb-2">{t("guidedLearning.selectModule")}</h2>+ <p className="text-sm text-[var(--muted-foreground)] mb-6">{t("guidedLearning.selectModuleDesc")}</p><div className="flex flex-col gap-3">{modules.map(m => (<button@@ -344,7 +347,7 @@ export default function LearningBookPage() {><div className="font-medium">{m.name}</div><div className="text-xs text-[var(--muted-foreground)] mt-1">- {m.knowledge_points.length} knowledge points+ {m.knowledge_points.length} {t("guidedLearning.knowledgePoints")}</div></button>))}@@ -425,7 +428,7 @@ export default function LearningBookPage() {) : waitingForLLM ? (<div className="flex flex-col items-center gap-2"><Loader2 className="w-8 h-8 animate-spin" />- <p className="text-sm">Generating diagnostic questions...</p>+ <p className="text-sm">{t("guidedLearning.generatingDiagnostic")}</p></div>) : (t("guidedLearning.ready")@@ -444,7 +447,8 @@ export default function LearningBookPage() {/><buttononClick={() => {- if (!currentTurnRef.current) return;+ if (!currentTurnRef.current || submittingRef.current) return;+ submittingRef.current = true;wsRef.current?.send(JSON.stringify({type: "user_input",turn_id: currentTurnRef.current,@@ -452,6 +456,7 @@ export default function LearningBookPage() {}));setWaitingForInput(false);setUserInput("");+ setTimeout(() => { submittingRef.current = false; }, 500);}}className="mt-2 px-4 py-2 rounded bg-[var(--primary)] text-[var(--primary-foreground)] text-sm hover:opacity-90">diff --git a/web/app/(workspace)/learning/page.tsx b/web/app/(workspace)/learning/page.tsxindex e85d000d2..aeb0ebb6d 100644--- a/web/app/(workspace)/learning/page.tsx+++ b/web/app/(workspace)/learning/page.tsx@@ -32,7 +32,11 @@ export default function LearningPage() {const loadProgress = useCallback(async () => {try {- setItems(await fetchAllProgress());+ const result = await fetchAllProgress();+ setItems(result.summaries ?? []);+ if (result.errors?.length) {+ console.warn("Some progress failed to load:", result.errors);+ }} catch {setToast(t("guidedLearning.connectionError"));} finally {diff --git a/web/lib/learning-api.ts b/web/lib/learning-api.tsindex b293405a3..089949c2b 100644--- a/web/lib/learning-api.ts+++ b/web/lib/learning-api.ts@@ -52,7 +52,12 @@ export interface ProgressSummary {updated_at: number;}-export async function fetchAllProgress(): Promise<ProgressSummary[]> {+export interface ProgressListResult {+ summaries: ProgressSummary[];+ errors: { book_id: string; error: string }[];+}++export async function fetchAllProgress(): Promise<ProgressListResult> {const res = await apiFetch(apiUrl("/api/v1/learning/progress"));if (!res.ok) throw new Error(`Failed to fetch all progress: ${res.status}`);return res.json();diff --git a/web/locales/en/app.json b/web/locales/en/app.jsonindex d78807877..9ba64c943 100644--- a/web/locales/en/app.json+++ b/web/locales/en/app.json@@ -1618,6 +1618,9 @@"guidedLearning.mastered": "mastered","guidedLearning.stages": "Learning Stages","guidedLearning.ready": "Ready to start learning",+ "guidedLearning.selectModule": "Select a Module",+ "guidedLearning.selectModuleDesc": "Choose a module to start guided learning",+ "guidedLearning.generatingDiagnostic": "Generating diagnostic questions...","guidedLearning.connectionError": "Connection error","guidedLearning.stageFailed": "Stage execution failed. Progress saved, will retry this stage.","guidedLearning.moduleProgress": "{{count}} knowledge point(s)",diff --git a/web/locales/zh/app.json b/web/locales/zh/app.jsonindex 8acdf7085..023a05db4 100644--- a/web/locales/zh/app.json+++ b/web/locales/zh/app.json@@ -1618,6 +1618,9 @@"guidedLearning.mastered": "已掌握","guidedLearning.stages": "学习阶段","guidedLearning.ready": "准备开始学习",+ "guidedLearning.selectModule": "选择模块",+ "guidedLearning.selectModuleDesc": "选择一个模块开始引导学习",+ "guidedLearning.generatingDiagnostic": "正在生成诊断题...","guidedLearning.connectionError": "连接错误","guidedLearning.stageFailed": "阶段执行失败。进度已保存,将重试该阶段。","guidedLearning.moduleProgress": "{{count}} 个知识点",