Feat: refactor STT service (#294)

* add stt hook interface

* fix crypto exported to browser

* refactor use-transcribe

* may use openai stt

* refactor: remove decprecated codes

* fix undefined method
This commit is contained in:
an-lee
2024-02-10 19:55:07 +08:00
committed by GitHub
parent a71671907e
commit bc22a5e2b4
21 changed files with 488 additions and 633 deletions

View File

@@ -213,10 +213,18 @@ type EnjoyAppType = {
setService: (
service: WhisperConfigType["service"]
) => Promise<WhisperConfigType>;
transcribeBlob: (
blob: { type: string; arrayBuffer: ArrayBuffer },
prompt?: string
) => Promise<{ file: string; content: string }>;
transcribe: (
params: {
file?: string;
blob?: { type: string; arrayBuffer: ArrayBuffer };
},
options?: {
force?: boolean;
extra?: string[];
}
) => Promise<Partial<WhisperOutputType>>;
onProgress: (callback: (event, progress: number) => void) => void;
removeProgressListeners: () => Promise<void>;
};
ffmpeg: {
config: () => Promise<FfmpegConfigType>;
@@ -245,10 +253,7 @@ type EnjoyAppType = {
};
transcriptions: {
findOrCreate: (params: any) => Promise<TranscriptionType>;
process: (params: any, options: any) => Promise<void>;
update: (id: string, params: any) => Promise<void>;
onProgress: (callback: (event, progress: number) => void) => void;
removeProgressListeners: () => Promise<void>;
};
waveforms: {
find: (id: string) => Promise<WaveFormDataType>;

View File

@@ -27,7 +27,7 @@ type NotificationType = {
};
type WhisperConfigType = {
service: "local" | "azure" | "cloudflare";
service: "local" | "azure" | "cloudflare" | "openai";
availableModels: {
type: string;
name: string;