@@ -23,6 +23,7 @@ class OpenAiSettingsService {
23
23
'api_key ' => 'string ' ,
24
24
'default_completion_model_id ' => 'string ' ,
25
25
'default_stt_model_id ' => 'string ' ,
26
+ 'default_tts_model_id ' => 'string ' ,
26
27
'default_image_model_id ' => 'string ' ,
27
28
'default_image_size ' => 'string ' ,
28
29
'image_request_auth ' => 'boolean ' ,
@@ -36,8 +37,8 @@ class OpenAiSettingsService {
36
37
'llm_provider_enabled ' => 'boolean ' ,
37
38
't2i_provider_enabled ' => 'boolean ' ,
38
39
'stt_provider_enabled ' => 'boolean ' ,
39
- 'tts_provider_exists ' => 'boolean ' ,
40
- 'tts_provider_enabled ' => 'boolean ' ,
40
+ 'tts_provider_exists ' => 'boolean ' ,
41
+ 'tts_provider_enabled ' => 'boolean ' ,
41
42
'chat_endpoint_enabled ' => 'boolean ' ,
42
43
'basic_user ' => 'string ' ,
43
44
'basic_password ' => 'string ' ,
@@ -120,6 +121,10 @@ public function getAdminDefaultImageSize(): string {
120
121
return $ this ->appConfig ->getValueString (Application::APP_ID , 'default_image_size ' ) ?: Application::DEFAULT_DEFAULT_IMAGE_SIZE ;
121
122
}
122
123
124
+ public function getAdminDefaultTtsModelId (): string {
125
+ return $ this ->appConfig ->getValueString (Application::APP_ID , 'default_speech_model_id ' ) ?: Application::DEFAULT_MODEL_ID ;
126
+ }
127
+
123
128
/**
124
129
* @return string
125
130
*/
@@ -268,6 +273,7 @@ public function getAdminConfig(): array {
268
273
'api_key ' => $ this ->getAdminApiKey (),
269
274
'default_completion_model_id ' => $ this ->getAdminDefaultCompletionModelId (),
270
275
'default_stt_model_id ' => $ this ->getAdminDefaultSttModelId (),
276
+ 'default_tts_model_id ' => $ this ->getAdminDefaultTtsModelId (),
271
277
'default_image_model_id ' => $ this ->getAdminDefaultImageModelId (),
272
278
'default_image_size ' => $ this ->getAdminDefaultImageSize (),
273
279
'image_request_auth ' => $ this ->getIsImageRetrievalAuthenticated (),
@@ -284,8 +290,8 @@ public function getAdminConfig(): array {
284
290
'llm_provider_enabled ' => $ this ->getLlmProviderEnabled (),
285
291
't2i_provider_enabled ' => $ this ->getT2iProviderEnabled (),
286
292
'stt_provider_enabled ' => $ this ->getSttProviderEnabled (),
287
- 'tts_provider_exists ' => $ this ->getTtsProviderExists (),
288
- 'tts_provider_enabled ' => $ this ->getTtsProviderEnabled (),
293
+ 'tts_provider_exists ' => $ this ->getTtsProviderExists (),
294
+ 'tts_provider_enabled ' => $ this ->getTtsProviderEnabled (),
289
295
'chat_endpoint_enabled ' => $ this ->getChatEndpointEnabled (),
290
296
'basic_user ' => $ this ->getAdminBasicUser (),
291
297
'basic_password ' => $ this ->getAdminBasicPassword (),
@@ -358,19 +364,19 @@ public function getSttProviderEnabled(): bool {
358
364
return $ this ->appConfig ->getValueString (Application::APP_ID , 'stt_provider_enabled ' , '1 ' ) === '1 ' ;
359
365
}
360
366
361
- /**
362
- * @return bool
363
- */
364
- public function getTtsProviderEnabled (): bool {
365
- return $ this ->getTtsProviderExists () && $ this ->appConfig ->getValueString (Application::APP_ID , 'tts_provider_enabled ' , '1 ' ) === '1 ' ;
366
- }
367
+ /**
368
+ * @return bool
369
+ */
370
+ public function getTtsProviderEnabled (): bool {
371
+ return $ this ->getTtsProviderExists () && $ this ->appConfig ->getValueString (Application::APP_ID , 'tts_provider_enabled ' , '1 ' ) === '1 ' ;
372
+ }
367
373
368
- /**
369
- * @return bool
370
- */
371
- public function getTtsProviderExists (): bool {
372
- return class_exists ('OCP \\TaskProcessing \\TaskTypes \\TextToSpeech ' );
373
- }
374
+ /**
375
+ * @return bool
376
+ */
377
+ public function getTtsProviderExists (): bool {
378
+ return class_exists ('OCP \\TaskProcessing \\TaskTypes \\TextToSpeech ' );
379
+ }
374
380
375
381
////////////////////////////////////////////
376
382
//////////// Setters for settings //////////
@@ -443,6 +449,15 @@ public function setAdminDefaultSttModelId(string $defaultSttModelId): void {
443
449
$ this ->appConfig ->setValueString (Application::APP_ID , 'default_stt_model_id ' , $ defaultSttModelId );
444
450
}
445
451
452
+ /**
453
+ * @param string $defaultTtsModelId
454
+ * @return void
455
+ */
456
+ public function setAdminDefaultTtsModelId (string $ defaultTtsModelId ): void {
457
+ // No need to validate. As long as it's a string, we're happy campers
458
+ $ this ->appConfig ->setValueString (Application::APP_ID , 'default_speech_model_id ' , $ defaultTtsModelId );
459
+ }
460
+
446
461
/**
447
462
* @param string $defaultImageModelId
448
463
* @return void
@@ -632,6 +647,9 @@ public function setAdminConfig(array $adminConfig): void {
632
647
if (isset ($ adminConfig ['default_stt_model_id ' ])) {
633
648
$ this ->setAdminDefaultSttModelId ($ adminConfig ['default_stt_model_id ' ]);
634
649
}
650
+ if (isset ($ adminConfig ['default_tts_model_id ' ])) {
651
+ $ this ->setAdminDefaultTtsModelId ($ adminConfig ['default_tts_model_id ' ]);
652
+ }
635
653
if (isset ($ adminConfig ['default_image_model_id ' ])) {
636
654
$ this ->setAdminDefaultImageModelId ($ adminConfig ['default_image_model_id ' ]);
637
655
}
@@ -671,9 +689,9 @@ public function setAdminConfig(array $adminConfig): void {
671
689
if (isset ($ adminConfig ['stt_provider_enabled ' ])) {
672
690
$ this ->setSttProviderEnabled ($ adminConfig ['stt_provider_enabled ' ]);
673
691
}
674
- if (isset ($ adminConfig ['tts_provider_enabled ' ])) {
675
- $ this ->setTtsProviderEnabled ($ adminConfig ['tts_provider_enabled ' ]);
676
- }
692
+ if (isset ($ adminConfig ['tts_provider_enabled ' ])) {
693
+ $ this ->setTtsProviderEnabled ($ adminConfig ['tts_provider_enabled ' ]);
694
+ }
677
695
if (isset ($ adminConfig ['chat_endpoint_enabled ' ])) {
678
696
$ this ->setChatEndpointEnabled ($ adminConfig ['chat_endpoint_enabled ' ]);
679
697
}
@@ -761,13 +779,13 @@ public function setSttProviderEnabled(bool $enabled): void {
761
779
$ this ->appConfig ->setValueString (Application::APP_ID , 'stt_provider_enabled ' , $ enabled ? '1 ' : '0 ' );
762
780
}
763
781
764
- /**
765
- * @param bool $enabled
766
- * @return void
767
- */
768
- public function setTtsProviderEnabled (bool $ enabled ): void {
769
- $ this ->appConfig ->setValueString (Application::APP_ID , 'tts_provider_enabled ' , $ enabled ? '1 ' : '0 ' );
770
- }
782
+ /**
783
+ * @param bool $enabled
784
+ * @return void
785
+ */
786
+ public function setTtsProviderEnabled (bool $ enabled ): void {
787
+ $ this ->appConfig ->setValueString (Application::APP_ID , 'tts_provider_enabled ' , $ enabled ? '1 ' : '0 ' );
788
+ }
771
789
772
790
/**
773
791
* @param bool $enabled
0 commit comments