Skip to content

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

Merge pull request #1100 from contributor

Bingxi Zhao (Frank)1fc797169b92
diff --cc web/components/reading/workspace/useReadingWorkspace.ts
index be8606b09,7fa802463..bb7c8caac
--- a/web/components/reading/workspace/useReadingWorkspace.ts
+++ b/web/components/reading/workspace/useReadingWorkspace.ts
@@@ -169,7 -171,7 +171,7 @@@ export function useReadingWorkspace
useEffect(() => {
if (!workspace || loading) return;
-- const bootKey = `${workspaceId}:${sessionIdParam ?? "new"}`;
++ const bootKey = `${workspaceId}:${sessionIdParam ?? "new"}:${courseId.trim()}`;
if (sessionBootRef.current === bootKey) return;
sessionBootRef.current = bootKey;
@@@ -186,12 -188,9 +188,16 @@@
// the backend attaches the session to this workspace when the first
// turn runs (see `turn_runtime`), so opening a collection and walking
// away no longer litters it with empty conversations.
- if (sessionIdParam) await loadSession(sessionIdParam);
- else newSession(courseSessionConfiguration({}, courseId));
- setCapability(READING_CAPABILITY);
++ const scopedSessionConfiguration = courseSessionConfiguration(
++ sessionConfiguration,
++ courseId,
++ );
+ if (sessionIdParam) {
+ await loadSession(sessionIdParam);
- configureSession(sessionConfiguration, sessionIdParam);
++ configureSession(scopedSessionConfiguration, sessionIdParam);
+ } else {
- newSession({ ...sessionConfiguration, capability: null });
++ newSession({ ...scopedSessionConfiguration, capability: null });
+ }
} catch (caught) {
setError(
caught instanceof Error
@@@ -201,7 -200,7 +207,8 @@@
}
})();
}, [
+ configureSession,
+ courseId,
loadSession,
loading,
newSession,
diff --cc web/components/space/learning/MasteryStudy.tsx
index 4f4e77548,bfd06ae28..9e33dc788
--- a/web/components/space/learning/MasteryStudy.tsx
+++ b/web/components/space/learning/MasteryStudy.tsx
@@@ -84,14 -78,10 +86,14 @@@ export function MasteryStudy(
editMessage,
switchBranch,
} = useUnifiedChat();
+ const confirmResearchOutline = useResearchOutlineContinuation();
const { topic, topicError, knowledgeBases, sessionError, sessionLoading } =
- useMasteryStudySession(pathId, routeSessionId);
+ useMasteryStudySession(pathId, routeSessionId, courseId);
const hasMessages = state.messages.length > 0;
const prefillInputRef = useRef<((text: string) => void) | null>(null);
+ const viewerPanelRef = useRef<SessionViewerPanelHandle | null>(null);
+ const [viewerOpen, setViewerOpen] = useState(false);
+ const sessionActivity = buildSessionActivity(state.messages);
/* ── Transcript scrolling ────────────────────────────────────────────
Was a bare `scrollIntoView` keyed on message count — no notion of the
user having scrolled away, so it yanked the view back to the bottom
diff --cc web/context/UnifiedChatContext.tsx
index fd9d2cc9b,0c8245361..2741a3fe4
--- a/web/context/UnifiedChatContext.tsx
+++ b/web/context/UnifiedChatContext.tsx
@@@ -55,10 -51,7 +55,11 @@@ import
normalizeBookReferences,
type BookReferencePayload,
} from "@/lib/book-references";
+ import { courseTurnConfiguration } from "@/lib/course-session-scope";
+import {
+ normalizeWorkspaceMode,
+ type WorkspaceMode,
+} from "@/lib/workspace-mode";
type SessionRuntimeStatus =
| "idle"
diff --cc web/hooks/useMasteryStudySession.ts
index 78e894533,e47ac4a43..2a8d6224b
--- a/web/hooks/useMasteryStudySession.ts
+++ b/web/hooks/useMasteryStudySession.ts
@@@ -18,7 -18,7 +18,8 @@@ import
isMasteryDraftSessionReady,
type MasteryDraftRouteGuard,
} from "@/lib/mastery-study-route";
+ import { courseSessionConfiguration } from "@/lib/course-session-scope";
+import { MASTERY_WORKSPACE_MODE } from "@/lib/workspace-mode";
/**
* Resolves which topic and which chat session a study route is showing.
@@@ -128,14 -128,14 +130,22 @@@ export function useMasteryStudySession
);
}
const cached = showCachedSession(routeSessionId);
-- if (cached) configureSession(sessionConfiguration, routeSessionId);
++ if (cached) {
++ configureSession(
++ courseSessionConfiguration(sessionConfiguration, courseId),
++ routeSessionId,
++ );
++ }
return loadSession(
routeSessionId,
cached ? { revalidate: true } : undefined,
);
})
.then(() => {
-- configureSession(sessionConfiguration, routeSessionId);
++ configureSession(
++ courseSessionConfiguration(sessionConfiguration, courseId),
++ routeSessionId,
++ );
setSessionResolution({ routeKey, error: null });
})
.catch((reason: unknown) => {