feat: Explicitly set and default TTS response format to MP3.
This commit is contained in:
parent
f5cd3b262a
commit
6e442e8dba
2 changed files with 4 additions and 1 deletions
|
|
@ -252,12 +252,14 @@ export async function POST(req: NextRequest) {
|
|||
: voice
|
||||
) as SpeechCreateParams['voice'];
|
||||
|
||||
const resolvedFormat = format || 'mp3';
|
||||
|
||||
const createParams: ExtendedSpeechParams = {
|
||||
model: model,
|
||||
voice: normalizedVoice,
|
||||
input: text,
|
||||
speed: speed,
|
||||
response_format: format,
|
||||
response_format: resolvedFormat,
|
||||
};
|
||||
// Only add instructions if model is gpt-4o-mini-tts and instructions are provided
|
||||
if ((model as string) === 'gpt-4o-mini-tts' && instructions) {
|
||||
|
|
|
|||
|
|
@ -1036,6 +1036,7 @@ export function TTSProvider({ children }: { children: ReactNode }): ReactElement
|
|||
text: sentence,
|
||||
voice,
|
||||
speed,
|
||||
format: 'mp3',
|
||||
model: ttsModel,
|
||||
instructions: ttsModel === 'gpt-4o-mini-tts' ? ttsInstructions : undefined,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue