feat(tts): add speech rate support for text-to-speech generation

This commit is contained in:
cogwheel0
2025-11-03 00:44:24 +05:30
parent 1a570f4a08
commit 715849aff3
3 changed files with 17 additions and 3 deletions

View File

@@ -1659,12 +1659,17 @@ class ApiService {
Future<({Uint8List bytes, String mimeType})> generateSpeech({
required String text,
String? voice,
double? speed,
}) async {
final textPreview = text.length > 50 ? text.substring(0, 50) : text;
_traceApi('Generating speech for text: $textPreview...');
final response = await _dio.post(
'/api/v1/audio/speech',
data: {'input': text, if (voice != null) 'voice': voice},
data: {
'input': text,
if (voice != null) 'voice': voice,
if (speed != null) 'speed': speed,
},
options: Options(responseType: ResponseType.bytes),
);