mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-03 14:34:40 +00:00
feat(video): generate transcripts with the local embedding server
This commit is contained in:
@@ -26,6 +26,7 @@ export * from './search'
|
||||
export * from './share'
|
||||
export * from './skill'
|
||||
export * from './team'
|
||||
export * from './transcript'
|
||||
export * from './upload'
|
||||
export * from './user-metadata'
|
||||
export * from './versionStack'
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const transcriptLanguageCodeSchema = z.string().regex(/^[a-z]{2,3}$/)
|
||||
|
||||
export const generateTranscriptRequestSchema = z.object({
|
||||
language: transcriptLanguageCodeSchema.optional(),
|
||||
})
|
||||
|
||||
export const transcriptLanguagesSchema = z.object({
|
||||
model: z.string().min(1),
|
||||
languages: z.array(z.object({ code: transcriptLanguageCodeSchema, name: z.string().min(1) })),
|
||||
})
|
||||
|
||||
export const transcriptionErrors = {
|
||||
noAudio: 'The video does not contain an audio track',
|
||||
tooLarge: 'Audio exceeds the embedding server upload limit',
|
||||
} as const
|
||||
|
||||
export type GenerateTranscriptResult =
|
||||
| { kind: 'queued' | 'busy'; taskId: string }
|
||||
| { kind: 'existing'; transcriptId: string; language: string }
|
||||
| { kind: 'no_speech' }
|
||||
|
||||
export type TranscriptJobStatus =
|
||||
| { status: 'pending' | 'processing' | 'completed' | 'no_speech'; taskId: string }
|
||||
| { status: 'failed'; taskId: string; reason: keyof typeof transcriptionErrors | 'unknown' }
|
||||
Reference in New Issue
Block a user