Skip to content

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

Merge pull request #1142 from evan188199-tech/codex/feat/video-learning-transcript-notes

Bingxi Zhao (Frank)6fccf929c0af
diff --cc tests/video_learning/test_router.py
index 9e4ceb73e,e23308e4e..d78d8effb
--- a/tests/video_learning/test_router.py
+++ b/tests/video_learning/test_router.py
@@@ -8,7 -8,9 +8,9 @@@ import http
import pytest
from deeptutor.api.routers import video_learning
--from deeptutor.api.routers.auth import require_admin, require_auth
++from deeptutor.api.routers.auth import require_admin, require_learning_surface
+ from deeptutor.services.notebook.service import NotebookManager
+ from deeptutor.video_learning import notes as video_notes
from deeptutor.video_learning import service
@@@ -55,7 -67,7 +67,7 @@@ def _material(*, duration: int = 100) -
}
--def test_main_mounts_settings_as_admin_only_and_learning_as_authenticated() -> None:
++def test_main_mounts_settings_as_admin_only_and_learning_policy_scoped() -> None:
from deeptutor.api.main import app
mounts: dict[str, set[object]] = {}
@@@ -80,7 -92,7 +92,7 @@@
dependencies = route.dependant.dependencies
mounts.setdefault(key, set()).update(dependency.dependency for dependency in dependencies)
assert require_admin in mounts["/api/v1/settings/video-learning"]
-- assert require_auth in mounts["/api/v1/video-learning"]
++ assert require_learning_surface in mounts["/api/v1/video-learning"]
def test_progress_clamps_to_duration_and_unknown_material_is_404(client: TestClient) -> None:
diff --cc web/components/watching/WatchingPane.tsx
index f7904f7f2,9c7c35b43..0849aee96
--- a/web/components/watching/WatchingPane.tsx
+++ b/web/components/watching/WatchingPane.tsx
@@@ -34,13 -48,22 +49,25 @@@ export function WatchingPane({ onClose
clearError,
setActive,
} = useWatching();
++ const materialId = material?.material_id ?? null;
const [input, setInput] = useState("");
const [playerError, setPlayerError] = useState<string | null>(null);
+ const [tab, setTab] = useState<WatchTab>("transcript");
const [time, setTime] = useState(0);
const [duration, setDuration] = useState(0);
+ const [notes, setNotes] = useState<VideoNote[]>([]);
+ const [notesLoading, setNotesLoading] = useState(false);
+ const [notesError, setNotesError] = useState<string | null>(null);
+ const [noteDraft, setNoteDraft] = useState("");
+ const [editingNoteId, setEditingNoteId] = useState<string | null>(null);
+ const [editingDraft, setEditingDraft] = useState("");
+ const [noteBusy, setNoteBusy] = useState(false);
+ const [pendingDeleteId, setPendingDeleteId] = useState<string | null>(null);
const controllerRef = useRef<PlayerController | null>(null);
++ const activeMaterialIdRef = useRef(materialId);
const lastSavedRef = useRef(0);
const stateRef = useRef({ time: 0, duration: 0 });
++ activeMaterialIdRef.current = materialId;
useEffect(() => {
setActive(true);
@@@ -131,6 -154,114 +158,129 @@@
);
};
- const materialId = material?.material_id ?? null;
- const reloadNotes = useCallback(async () => {
- if (!materialId) return;
- setNotesLoading(true);
- setNotesError(null);
- try {
- setNotes(await listVideoNotes(materialId));
- } catch (caught) {
- setNotesError(
- caught instanceof Error
- ? caught.message
- : t("Notes could not be loaded."),
- );
- } finally {
- setNotesLoading(false);
- }
- }, [materialId, t]);
-
+ useEffect(() => {
++ let cancelled = false;
++ setNotes([]);
++ setNotesError(null);
++ setNoteDraft("");
++ setEditingNoteId(null);
++ setEditingDraft("");
++ setPendingDeleteId(null);
+ if (!materialId) {
- setNotes([]);
- setNotesError(null);
+ setNotesLoading(false);
- setNoteDraft("");
- setEditingNoteId(null);
- return;
++ return () => {
++ cancelled = true;
++ };
+ }
- void reloadNotes();
- }, [materialId, reloadNotes]);
++ setNotesLoading(true);
++ void (async () => {
++ try {
++ const loaded = await listVideoNotes(materialId);
++ if (!cancelled) setNotes(loaded);
++ } catch (caught) {
++ if (!cancelled) {
++ setNotesError(
++ caught instanceof Error
++ ? caught.message
++ : t("Notes could not be loaded."),
++ );
++ }
++ } finally {
++ if (!cancelled) setNotesLoading(false);
++ }
++ })();
++ return () => {
++ cancelled = true;
++ };
++ }, [materialId, t]);
+
+ const sortNotes = (rows: VideoNote[]) =>
+ [...rows].sort(
+ (left, right) =>
+ left.time_seconds - right.time_seconds ||
+ left.created_at - right.created_at ||
+ left.note_id.localeCompare(right.note_id),
+ );
+
+ const addNote = async () => {
+ if (!material || !noteDraft.trim() || noteBusy) return;
++ const requestedMaterialId = material.material_id;
+ setNoteBusy(true);
+ setNotesError(null);
+ try {
+ const saved = await createVideoNote(
- material.material_id,
++ requestedMaterialId,
+ noteDraft.trim(),
+ time,
+ );
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotes((current) => sortNotes([...current, saved]));
+ setNoteDraft("");
+ } catch (caught) {
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotesError(
+ caught instanceof Error ? caught.message : t("Note was not saved."),
+ );
+ } finally {
+ setNoteBusy(false);
+ }
+ };
+
+ const saveEditedNote = async () => {
+ if (!material || !editingNoteId || !editingDraft.trim() || noteBusy) return;
++ const requestedMaterialId = material.material_id;
+ setNoteBusy(true);
+ setNotesError(null);
+ try {
+ const saved = await updateVideoNote(
- material.material_id,
++ requestedMaterialId,
+ editingNoteId,
+ editingDraft.trim(),
+ );
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotes((current) =>
+ sortNotes(
+ current.map((note) => (note.note_id === saved.note_id ? saved : note)),
+ ),
+ );
+ setEditingNoteId(null);
+ setEditingDraft("");
+ } catch (caught) {
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotesError(
+ caught instanceof Error ? caught.message : t("Note was not saved."),
+ );
+ } finally {
+ setNoteBusy(false);
+ }
+ };
+
+ const confirmDelete = async () => {
+ if (!material || !pendingDeleteId || noteBusy) return;
++ const requestedMaterialId = material.material_id;
+ setNoteBusy(true);
+ setNotesError(null);
+ try {
- await deleteVideoNote(material.material_id, pendingDeleteId);
++ await deleteVideoNote(requestedMaterialId, pendingDeleteId);
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotes((current) =>
+ current.filter((note) => note.note_id !== pendingDeleteId),
+ );
+ if (editingNoteId === pendingDeleteId) {
+ setEditingNoteId(null);
+ setEditingDraft("");
+ }
+ setPendingDeleteId(null);
+ } catch (caught) {
++ if (activeMaterialIdRef.current !== requestedMaterialId) return;
+ setNotesError(
+ caught instanceof Error ? caught.message : t("Note was not deleted."),
+ );
+ } finally {
+ setNoteBusy(false);
+ }
+ };
+
const closePane = () => {
persist();
close();
@@@ -303,54 -429,219 +453,229 @@@
</a>
</div>
<div className="min-h-0 flex-1 overflow-y-auto p-4">
- {material.transcript.status !== "ready" ? (
- <div className="rounded-lg border border-[var(--border)] p-4 text-sm text-[var(--muted-foreground)]">
- {t(
- "Transcript learning is unavailable ({{reason}}). Playback still works, but Explain here is disabled.",
- {
- reason: material.transcript.reason || t("no captions"),
- },
+ <div
+ className="mb-3 grid w-full max-w-56 grid-cols-2 rounded-lg bg-[var(--muted)] p-1"
+ role="tablist"
+ aria-label={t("Video learning panels")}
+ >
+ {(["transcript", "notes"] as const).map((item) => (
+ <button
+ key={item}
+ type="button"
+ role="tab"
+ aria-selected={tab === item}
+ onClick={() => {
+ setTab(item);
+ setEditingNoteId(null);
+ }}
+ className={`flex items-center justify-center gap-1.5 rounded-md px-2 py-1.5 text-xs font-medium ${tab === item ? "bg-[var(--background)] shadow-sm" : "text-[var(--muted-foreground)]"}`}
+ >
+ {item === "transcript" ? (
+ <>
+ <Captions className="h-3.5 w-3.5" />
+ {t("Transcript")}
+ </>
+ ) : (
+ <>
+ <StickyNote className="h-3.5 w-3.5" />
+ {t("Video notes")}
+ </>
+ )}
+ </button>
+ ))}
+ </div>
+
+ {tab === "transcript" ? (
+ material.transcript.status !== "ready" ? (
+ <div className="rounded-lg border border-[var(--border)] p-4 text-sm text-[var(--muted-foreground)]">
+ {t(
+ "Transcript learning is unavailable ({{reason}}). Playback still works, but Explain here is disabled.",
+ {
+ reason: material.transcript.reason || t("no captions"),
+ },
+ )}
+ </div>
+ ) : (
+ <>
+ <button
+ type="button"
+ onClick={askHere}
+ disabled={!cue}
+ className="mb-3 rounded-lg bg-[var(--primary)] px-3 py-2 text-sm text-[var(--primary-foreground)] disabled:opacity-50"
+ >
+ {t("Explain here")}
+ </button>
+ <div className="space-y-1">
+ {material.transcript.cues.map((row, index) => {
+ const active = row === cue;
+ return (
+ <button
+ key={`${row.start}-${index}`}
+ type="button"
+ onClick={() => controllerRef.current?.seek(row.start)}
+ className={`flex w-full gap-3 rounded-md px-2 py-1.5 text-left text-sm ${active ? "bg-blue-500/15 ring-1 ring-blue-500/30" : "hover:bg-[var(--muted)]"}`}
+ >
+ <span className="shrink-0 tabular-nums text-blue-600">
+ {formatTime(row.start)}
+ </span>
+ <span>{row.text}</span>
+ </button>
+ );
+ })}
+ </div>
+ </>
+ )
+ ) : (
+ <div className="space-y-3">
+ <form
+ className="space-y-2"
+ onSubmit={(event) => {
+ event.preventDefault();
+ void addNote();
+ }}
+ >
+ <textarea
+ value={noteDraft}
+ onChange={(event) => setNoteDraft(event.target.value)}
+ placeholder={t("Note at {{time}}", {
+ time: formatTime(time),
+ })}
+ className="min-h-20 w-full resize-y rounded-lg border border-[var(--border)] bg-transparent px-3 py-2 text-sm"
+ />
+ <button
+ type="submit"
+ disabled={noteBusy || !noteDraft.trim()}
+ className="inline-flex items-center gap-1.5 rounded-lg bg-[var(--primary)] px-3 py-2 text-sm text-[var(--primary-foreground)] disabled:opacity-50"
+ >
+ {noteBusy ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : (
+ <Check className="h-4 w-4" />
+ )}
+ {t("Add video note")}
+ </button>
+ </form>
+
+ {notesError && (
+ <p
+ role="alert"
+ className="rounded-lg border border-[var(--border)] bg-[var(--muted)] px-3 py-2 text-sm text-[var(--destructive)]"
+ >
+ {notesError}
+ </p>
+ )}
+
+ {notesLoading ? (
+ <p className="flex items-center gap-2 text-sm text-[var(--muted-foreground)]">
+ <Loader2 className="h-4 w-4 animate-spin" />
+ {t("Loading notes.")}
+ </p>
+ ) : notes.length ? (
+ notes.map((note) => (
+ <article
+ key={`${note.notebook_id}:${note.note_id}`}
+ className="rounded-lg border border-[var(--border)] p-3"
+ >
+ <div className="flex items-start gap-2">
+ <button
+ type="button"
+ onClick={() =>
+ controllerRef.current?.seek(note.time_seconds)
+ }
+ className="shrink-0 rounded px-1.5 py-0.5 font-mono text-xs tabular-nums text-blue-600 hover:bg-blue-500/10"
+ >
+ {formatTime(note.time_seconds)}
+ </button>
+ <div className="min-w-0 flex-1">
+ {editingNoteId === note.note_id ? (
+ <textarea
+ value={editingDraft}
+ onChange={(event) =>
+ setEditingDraft(event.target.value)
+ }
+ aria-label={t("Edit note at {{time}}", {
+ time: formatTime(note.time_seconds),
+ })}
+ className="min-h-20 w-full resize-y rounded-lg border border-[var(--border)] bg-transparent px-2 py-1.5 text-sm"
+ />
+ ) : (
+ <p className="whitespace-pre-wrap text-sm">
+ {note.body}
+ </p>
+ )}
+ {note.quote && (
+ <blockquote className="mt-2 border-l-2 border-[var(--border)] pl-2 text-xs text-[var(--muted-foreground)]">
+ {note.quote}
+ </blockquote>
+ )}
+ </div>
+ <div className="flex shrink-0 items-center gap-1">
+ {editingNoteId === note.note_id ? (
+ <>
+ <button
+ type="button"
+ onClick={() => void saveEditedNote()}
+ disabled={noteBusy || !editingDraft.trim()}
+ className="rounded-md p-1.5 hover:bg-[var(--muted)] disabled:opacity-50"
+ aria-label={t("Save video note")}
+ >
+ <Check className="h-4 w-4" />
+ </button>
+ <button
+ type="button"
+ onClick={() => setEditingNoteId(null)}
+ disabled={noteBusy}
+ className="rounded-md p-1.5 hover:bg-[var(--muted)] disabled:opacity-50"
+ aria-label={t("Cancel")}
+ >
+ <X className="h-4 w-4" />
+ </button>
+ </>
+ ) : (
+ <button
+ type="button"
+ onClick={() => {
+ setEditingNoteId(note.note_id);
+ setEditingDraft(note.body);
+ }}
+ disabled={noteBusy}
+ className="rounded-md p-1.5 hover:bg-[var(--muted)] disabled:opacity-50"
+ aria-label={t("Edit note at {{time}}", {
+ time: formatTime(note.time_seconds),
+ })}
+ >
+ <Pencil className="h-4 w-4" />
+ </button>
+ )}
+ <button
+ type="button"
+ onClick={() => setPendingDeleteId(note.note_id)}
+ disabled={noteBusy}
+ className="rounded-md p-1.5 text-[var(--destructive)] hover:bg-[var(--destructive)]/10 disabled:opacity-50"
+ aria-label={t("Delete note at {{time}}", {
+ time: formatTime(note.time_seconds),
+ })}
+ >
+ <Trash2 className="h-4 w-4" />
+ </button>
+ </div>
+ </div>
+ </article>
+ ))
+ ) : (
+ !notesError && <p className="text-sm">{t("No notes yet.")}</p>
)}
+ {material.playback.provider === "invidious" && (
+ <button
+ type="button"
+ onClick={() => void retryTranscript()}
+ disabled={loading}
+ className="mt-3 rounded border border-[var(--border)] px-2 py-1 text-sm font-medium disabled:opacity-50"
+ >
+ {t("Retry captions")}
+ </button>
+ )}
</div>
- ) : (
- <>
- <button
- type="button"
- onClick={askHere}
- disabled={!cue}
- className="mb-3 rounded-lg bg-[var(--primary)] px-3 py-2 text-sm text-[var(--primary-foreground)] disabled:opacity-50"
- >
- {t("Explain here")}
- </button>
- <div className="space-y-1">
- {material.transcript.cues.map((row, index) => {
- const active = row === cue;
- return (
- <button
- key={`${row.start}-${index}`}
- type="button"
- onClick={() => controllerRef.current?.seek(row.start)}
- className={`flex w-full gap-3 rounded-md px-2 py-1.5 text-left text-sm ${active ? "bg-blue-500/15 ring-1 ring-blue-500/30" : "hover:bg-[var(--muted)]"}`}
- >
- <span className="shrink-0 tabular-nums text-blue-600">
- {formatTime(row.start)}
- </span>
- <span>{row.text}</span>
- </button>
- );
- })}
- </div>
- </>
)}
</div>
</div>
diff --cc web/locales/en/app.json
index 0360be92b,b21ee1037..9d7d5bd8f
--- a/web/locales/en/app.json
+++ b/web/locales/en/app.json
@@@ -4441,47 -4261,18 +4441,61 @@@
"YouTube Player API did not initialize.": "YouTube Player API did not initialize.",
"YouTube Player API timed out.": "YouTube Player API timed out.",
"YouTube Player API could not be loaded.": "YouTube Player API could not be loaded.",
+ "Vector index": "Vector index",
+ "Applies on the next full re-index": "Applies on the next full re-index",
+ "Exact nearest-neighbor search. Best for small and medium knowledge bases.": "Exact nearest-neighbor search. Best for small and medium knowledge bases.",
+ "Approximate graph search for large knowledge bases. Faster at scale with a small recall trade-off.": "Approximate graph search for large knowledge bases. Faster at scale with a small recall trade-off.",
+ "HNSW graph degree": "HNSW graph degree",
+ "HNSW construction candidates": "HNSW construction candidates",
+ "HNSW search candidates": "HNSW search candidates",
+ "Reranking": "Reranking",
+ "Applies on the next query": "Applies on the next query",
+ "Reranker model": "Reranker model",
+ "Leave empty to disable. Example: BAAI/bge-reranker-base. Requires the optional rag-rerank extra.": "Leave empty to disable. Example: BAAI/bge-reranker-base. Requires the optional rag-rerank extra.",
+ "Rerank candidates": "Rerank candidates",
+ "Needs Review": "Needs Review",
+ "All Sources": "All Sources",
+ "Deep Question": "Deep Question",
+ "Book": "Book",
+ "All Materials": "All Materials",
+ "Score Trend": "Score Trend",
+ "All Trends": "All Trends",
+ "First Attempt": "First Attempt",
+ "Improved": "Improved",
+ "Declined": "Declined",
+ "Unchanged": "Unchanged",
+ "Resolved": "Resolved",
+ "Mark Resolved": "Mark Resolved",
+ "Reopen Review": "Reopen Review",
+ "Account preset": "Account preset",
+ "Learner": "Learner",
+ "Preset: {{preset}}": "Preset: {{preset}}",
+ "Chat and Immersive Reading only, with uploads and tools disabled until assigned.": "Chat and Immersive Reading only, with uploads and tools disabled until assigned.",
+ "Create an ordinary account, then customize its assignments.": "Create an ordinary account, then customize its assignments.",
+ "Create an ordinary account with the default workspace behavior.": "Create an ordinary account with the default workspace behavior.",
+ "Learning policy": "Learning policy",
+ "Enable learning policy": "Enable learning policy",
+ "Teacher persona; Chat and Immersive Reading only": "Teacher persona; Chat and Immersive Reading only",
+ "Age band": "Age band",
+ "Teacher": "Teacher",
+ "Modes": "Modes",
+ "Chat · Immersive Reading": "Chat · Immersive Reading",
+ "Assigned reading materials": "Assigned reading materials",
+ "Upload books in Reading before assigning them.": "Upload books in Reading before assigning them.",
+ "Allow learner uploads": "Allow learner uploads",
- "Reading extensions": "Reading extensions"
++ "Reading extensions": "Reading extensions",
+ "Video notes": "Video notes",
+ "Add video note": "Add video note",
+ "Save video note": "Save video note",
+ "Note at {{time}}": "Note at {{time}}",
+ "Edit note at {{time}}": "Edit note at {{time}}",
+ "Delete note at {{time}}": "Delete note at {{time}}",
+ "Delete this note?": "Delete this note?",
+ "This note will be removed from Video Learning.": "This note will be removed from Video Learning.",
+ "No notes yet.": "No notes yet.",
+ "Loading notes.": "Loading notes.",
+ "Notes could not be loaded.": "Notes could not be loaded.",
+ "Note was not saved.": "Note was not saved.",
+ "Note was not deleted.": "Note was not deleted.",
+ "Video learning panels": "Video learning panels"
}
diff --cc web/locales/zh/app.json
index 59055096b,e5e4dc3e4..923536e82
--- a/web/locales/zh/app.json
+++ b/web/locales/zh/app.json
@@@ -4441,47 -4261,18 +4441,61 @@@
"YouTube Player API did not initialize.": "YouTube Player API 未能初始化。",
"YouTube Player API timed out.": "YouTube Player API 加载超时。",
"YouTube Player API could not be loaded.": "无法加载 YouTube Player API。",
+ "Vector index": "向量索引",
+ "Applies on the next full re-index": "在下次完整重建索引时生效",
+ "Exact nearest-neighbor search. Best for small and medium knowledge bases.": "精确最近邻搜索,适合中小型知识库。",
+ "Approximate graph search for large knowledge bases. Faster at scale with a small recall trade-off.": "面向大型知识库的近似图搜索,规模更大时更快,但会有少量召回损失。",
+ "HNSW graph degree": "HNSW 图连接度",
+ "HNSW construction candidates": "HNSW 构建候选数",
+ "HNSW search candidates": "HNSW 搜索候选数",
+ "Reranking": "重排序",
+ "Applies on the next query": "在下次查询时生效",
+ "Reranker model": "重排序模型",
+ "Leave empty to disable. Example: BAAI/bge-reranker-base. Requires the optional rag-rerank extra.": "留空表示禁用。示例:BAAI/bge-reranker-base。需要可选的 rag-rerank 依赖。",
+ "Rerank candidates": "重排序候选数",
+ "Needs Review": "待复习",
+ "All Sources": "全部来源",
+ "Deep Question": "深度提问",
+ "Book": "书籍",
+ "All Materials": "全部材料",
+ "Score Trend": "得分趋势",
+ "All Trends": "全部趋势",
+ "First Attempt": "首次作答",
+ "Improved": "已提升",
+ "Declined": "已下降",
+ "Unchanged": "无变化",
+ "Resolved": "已解决",
+ "Mark Resolved": "标记已解决",
+ "Reopen Review": "重新复习",
+ "Account preset": "账户预设",
+ "Learner": "学习者",
+ "Preset: {{preset}}": "预设:{{preset}}",
+ "Chat and Immersive Reading only, with uploads and tools disabled until assigned.": "仅可用 Chat 和沉浸阅读;上传与工具在分配前保持关闭。",
+ "Create an ordinary account, then customize its assignments.": "创建普通账户,之后自定义可用资源。",
+ "Create an ordinary account with the default workspace behavior.": "创建使用默认工作区行为的普通账户。",
+ "Learning policy": "学习策略",
+ "Enable learning policy": "启用学习策略",
+ "Teacher persona; Chat and Immersive Reading only": "教师人格;仅可用 Chat 和沉浸阅读",
+ "Age band": "年龄段",
+ "Teacher": "教师",
+ "Modes": "模式",
+ "Chat · Immersive Reading": "Chat · 沉浸阅读",
+ "Assigned reading materials": "已分配阅读材料",
+ "Upload books in Reading before assigning them.": "请先在阅读区上传书籍,再分配给学习者。",
+ "Allow learner uploads": "允许学习者上传",
- "Reading extensions": "阅读扩展"
++ "Reading extensions": "阅读扩展",
+ "Video notes": "视频笔记",
+ "Add video note": "添加视频笔记",
+ "Save video note": "保存视频笔记",
+ "Note at {{time}}": "{{time}} 的笔记",
+ "Edit note at {{time}}": "编辑 {{time}} 的笔记",
+ "Delete note at {{time}}": "删除 {{time}} 的笔记",
+ "Delete this note?": "删除这条笔记?",
+ "This note will be removed from Video Learning.": "这条笔记将从视频学习中移除。",
+ "No notes yet.": "暂无笔记。",
+ "Loading notes.": "正在加载笔记。",
+ "Notes could not be loaded.": "无法加载笔记。",
+ "Note was not saved.": "笔记未保存。",
+ "Note was not deleted.": "笔记未删除。",
+ "Video learning panels": "视频学习面板"
}
diff --cc web/tests/e2e/video-learning.audit.ts
index d80e18ca1,b1051821e..eb9b065f3
--- a/web/tests/e2e/video-learning.audit.ts
+++ b/web/tests/e2e/video-learning.audit.ts
@@@ -7,10 -7,20 +7,22 @@@ test("YouTube learning survives reload
}) => {
let provider: "youtube" | "invidious" = "youtube";
let invidiousOffline = false;
+ let transcriptReady = true;
+ let transcriptRefreshCount = 0;
let savedPosition = 0;
let nativeResolveCount = 0;
+ let nextNoteId = 1;
+ const notes: Array<{
+ notebook_id: string;
+ note_id: string;
+ material_id: string;
+ body: string;
+ time_seconds: number;
+ locator: number;
+ quote: string;
+ created_at: number;
+ updated_at: number;
+ }> = [];
const material = (selected: "youtube" | "invidious") => ({
version: 1,