mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(dictation): bound cloud uploads, stop at the 10-minute cap, check the OpenAI key on save * refactor(dictation): share the OpenAI error reader
39 lines
1.6 KiB
TypeScript
39 lines
1.6 KiB
TypeScript
import type { SecretAtRestProtection } from '../../shared/secret-at-rest-protection'
|
|
import type {
|
|
SpeechErrorEvent,
|
|
SpeechLifecycleEvent,
|
|
SpeechModelManifest,
|
|
SpeechModelState,
|
|
SpeechTranscriptEvent
|
|
} from '../../shared/speech-types'
|
|
|
|
export type SpeechApi = {
|
|
getCatalog: () => Promise<SpeechModelManifest[]>
|
|
getModelStates: () => Promise<SpeechModelState[]>
|
|
getOpenAiApiKeyStatus: () => Promise<{
|
|
configured: boolean
|
|
protection: SecretAtRestProtection | null
|
|
}>
|
|
saveOpenAiApiKey: (apiKey: string) => Promise<{ configured: boolean }>
|
|
clearOpenAiApiKey: () => Promise<{ configured: boolean }>
|
|
downloadModel: (modelId: string) => Promise<void>
|
|
cancelDownload: (modelId: string) => Promise<void>
|
|
deleteModel: (modelId: string) => Promise<void>
|
|
startDictation: (
|
|
modelId: string,
|
|
hotwords: string[] | undefined,
|
|
sessionId: string
|
|
) => Promise<void>
|
|
/** Resolves true when this chunk filled a cloud session's upload cap. */
|
|
feedAudio: (samples: Float32Array, sampleRate: number, sessionId?: string) => Promise<boolean>
|
|
stopDictation: (sessionId?: string) => Promise<void>
|
|
onPartialTranscript: (callback: (data: SpeechTranscriptEvent) => void) => () => void
|
|
onFinalTranscript: (callback: (data: SpeechTranscriptEvent) => void) => () => void
|
|
onDownloadProgress: (
|
|
callback: (data: { modelId: string; progress: number }) => void
|
|
) => () => void
|
|
onReady: (callback: (data: SpeechLifecycleEvent) => void) => () => void
|
|
onStopped: (callback: (data: SpeechLifecycleEvent) => void) => () => void
|
|
onError: (callback: (data: SpeechErrorEvent) => void) => () => void
|
|
}
|