Download src/lib/api/videoScript.ts from asnannp/DocDoeAI: direct link, hf CLI and curl.
- Browser
- Download file 1.93 kB
-
https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/lib/api/videoScript.ts
- Command line
-
hf download hf://spaces/asnannp/DocDoeAI/src/lib/api/videoScript.ts
-
curl -L -o videoScript.ts https://huggingface.co/spaces/asnannp/DocDoeAI/resolve/main/src/lib/api/videoScript.ts
1.93 kB
| // βββ Video Engine V1 β API client ββββββββββββββββββββββββββββββββββββββββββββ | |
| // Talks to the backend curriculum-aligned script endpoints. No file paths ever | |
| // cross this boundary; segment ids are opaque hashes. | |
| import { apiGet, apiPost } from "@/lib/api/client"; | |
| import type { VideoScript } from "@/lib/video/types"; | |
| export type CurriculumHints = { | |
| chapter_name?: string; | |
| topics?: string[]; | |
| formulas?: string[]; | |
| definitions?: string[]; | |
| common_mistakes?: string[]; | |
| exam_importance?: string | null; | |
| pyq_frequency?: string | null; | |
| exam_weightage_marks?: number | null; | |
| prerequisites?: string[]; | |
| }; | |
| export type VideoScriptRequest = { | |
| chapter_slug: string; | |
| subject?: string; | |
| level?: string; | |
| mode?: string; | |
| duration_minutes?: number; | |
| language_preference?: string | null; | |
| curriculum_hints?: CurriculumHints; | |
| student_progress?: Record<string, unknown> | null; | |
| }; | |
| export type SegmentAudioResponse = { | |
| segment_id: string; | |
| mode: string; | |
| audio_ready: boolean; | |
| audio_token: string | null; | |
| subtitle_text: string; | |
| message: string; | |
| }; | |
| export type VideoProgressResponse = { | |
| video_id: string; | |
| current_segment_index: number; | |
| completed_segment_ids: string[]; | |
| percent_complete: number; | |
| updated_at: string | null; | |
| }; | |
| export function generateVideoScript(payload: VideoScriptRequest) { | |
| return apiPost<VideoScript, VideoScriptRequest>("/video/generate-script", payload); | |
| } | |
| export function generateSegmentAudio( | |
| segmentId: string, | |
| body: { teacher_script: string; language?: string; voice?: string | null }, | |
| ) { | |
| return apiPost<SegmentAudioResponse, typeof body>( | |
| `/video/segment/${encodeURIComponent(segmentId)}/generate`, | |
| body, | |
| ); | |
| } | |
| export function getVideoProgress(videoId: string) { | |
| return apiGet<VideoProgressResponse>(`/video/${encodeURIComponent(videoId)}/progress`); | |
| } | |