mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:29:49 +08:00
Ship folder-based workspaces and data migration, daily practice, redesigned provider and model settings, and streaming conversation improvements. Synchronize README translations and document the archive/permanent-delete upgrade behavior in assets/releases/ver1-6-9.md. Reduce initial JavaScript by deduplicating English resources and loading animation features after hydration. Keep the existing route size budgets. Update regression fixtures and browser audits for scoped URLs and the new settings and learning interfaces.
16 lines
731 B
TypeScript
16 lines
731 B
TypeScript
import { apiFetch, apiUrl } from '@/lib/api'
|
|
import { scopedUrl } from '@/lib/workspace-scope'
|
|
|
|
export interface LearningOrigin {
|
|
content_workspace_id?: string
|
|
content_workspace_name?: string
|
|
}
|
|
export const libraryItemKey = (row: LearningOrigin, id: string | number) =>
|
|
JSON.stringify([row.content_workspace_id ?? '', id])
|
|
|
|
export async function learningLibrary<T extends LearningOrigin>(kind: string) {
|
|
const response = await apiFetch(apiUrl(scopedUrl(`/api/dashboard/learning-library/${kind}`, '')), { cache: 'no-store' })
|
|
if (!response.ok) throw new Error(`Could not load learning library (${response.status})`)
|
|
return await response.json() as { items: T[]; unavailable_workspaces: string[]; can_create: boolean }
|
|
}
|