chore: audio
This commit is contained in:
@@ -10,6 +10,10 @@ export const OPENAI_MODELS = '/v1-openai/models';
|
||||
|
||||
export const RERANKER_API = '/rerank';
|
||||
|
||||
export const AUDIO_TEXT_TO_SPEECH_API = '/v1-openai/audio/speech';
|
||||
|
||||
export const AUDIO_SPEECH_TO_TEXT_API = '/v1-openai/audio/transcriptions';
|
||||
|
||||
export async function execChatCompletions(params: any) {
|
||||
return request(`${CHAT_API}`, {
|
||||
method: 'POST',
|
||||
@@ -81,3 +85,28 @@ export const createImages = async (
|
||||
}
|
||||
return res.json();
|
||||
};
|
||||
|
||||
// ============ audio ============
|
||||
export const textToSpeech = async (params: any, options?: any) => {
|
||||
const res = await fetch(AUDIO_TEXT_TO_SPEECH_API, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(params),
|
||||
signal: params.signal
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return res.json();
|
||||
};
|
||||
|
||||
export const speechToText = async (params: any, options?: any) => {
|
||||
const res = await fetch(AUDIO_SPEECH_TO_TEXT_API, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(params),
|
||||
signal: params.signal
|
||||
});
|
||||
if (!res.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
return res.json();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user