🤩 Added custom openai tts models and role variables

This commit is contained in:
Yanyutin753
2024-05-06 15:23:27 +08:00
parent e92311b4eb
commit 761c66a8d8
34 changed files with 89 additions and 7 deletions
+5 -2
View File
@@ -30,6 +30,8 @@ export const getAudioConfig = async (token: string) => {
type OpenAIConfigForm = {
url: string;
key: string;
model: string;
speaker: string;
};
export const updateAudioConfig = async (token: string, payload: OpenAIConfigForm) => {
@@ -95,7 +97,8 @@ export const transcribeAudio = async (token: string, file: File) => {
export const synthesizeOpenAISpeech = async (
token: string = '',
speaker: string = 'alloy',
text: string = ''
text: string = '',
OpenAIModel: string = 'tts-1'
) => {
let error = null;
@@ -106,7 +109,7 @@ export const synthesizeOpenAISpeech = async (
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'tts-1',
model: OpenAIModel,
input: text,
voice: speaker
})