File tree Expand file tree Collapse file tree 2 files changed +0
-16
lines changed Expand file tree Collapse file tree 2 files changed +0
-16
lines changed Original file line number Diff line number Diff line change 1
- import { TranscriptionVerbose } from 'openai/src/resources/audio/transcriptions' ;
2
1
import OpenAI from 'openai' ;
3
2
4
3
export interface OpenAiService {
5
- whisper ( file : string ) : Promise < TranscriptionVerbose > ;
6
4
getOpenAi ( ) : OpenAI ;
7
5
}
Original file line number Diff line number Diff line change @@ -29,18 +29,4 @@ export class OpenAIServiceImpl implements OpenAiService {
29
29
} ) ;
30
30
return this . openai ;
31
31
}
32
-
33
- public async whisper ( file : string , signal ?: AbortSignal ) : Promise < TranscriptionVerbose > {
34
- const openAi = this . getOpenAi ( ) ;
35
- if ( ! openAi ) {
36
- return Promise . reject ( '未设置 OpenAI 密钥' ) ;
37
- }
38
- const transcription = await openAi . audio . transcriptions . create ( {
39
- file : fs . createReadStream ( file ) ,
40
- model : "whisper-1" ,
41
- response_format : "verbose_json" ,
42
- timestamp_granularities : [ "segment" ]
43
- } ) ;
44
- return transcription ;
45
- }
46
32
}
You can’t perform that action at this time.
0 commit comments