1
- import { Divider , Form , FormInstance , Input , notification } from "antd" ;
1
+ import {
2
+ Divider ,
3
+ Form ,
4
+ FormInstance ,
5
+ Input ,
6
+ Select ,
7
+ Switch ,
8
+ notification ,
9
+ } from "antd" ;
2
10
import { AppearanceType } from "./types" ;
3
11
import { DbColorPicker } from "../../Common/DbColorPicker" ;
4
12
import { useMutation , useQueryClient } from "@tanstack/react-query" ;
@@ -16,7 +24,8 @@ export const AppearanceForm = ({
16
24
} ) => {
17
25
const botBubbleStyle = Form . useWatch ( "chat_bot_bubble_style" , form ) ;
18
26
const humanBubbleStyle = Form . useWatch ( "chat_human_bubble_style" , form ) ;
19
-
27
+ const isTTS = Form . useWatch ( "tts" , form ) ;
28
+ const ttsProvider = Form . useWatch ( "tts_provider" , form ) ;
20
29
const params = useParams < { id : string } > ( ) ;
21
30
22
31
const onFinish = async ( values : any ) => {
@@ -218,6 +227,69 @@ export const AppearanceForm = ({
218
227
</ div >
219
228
</ Form . Item >
220
229
230
+ < Divider orientation = "left" > Text to Speech (TTS) Settings</ Divider >
231
+
232
+ < Form . Item label = "Enable TTS" name = "tts" valuePropName = "checked" >
233
+ < Switch />
234
+ </ Form . Item >
235
+
236
+ { isTTS && (
237
+ < >
238
+ < Form . Item
239
+ rules = { [
240
+ {
241
+ required : true ,
242
+ message : "Please select a voice provider!" ,
243
+ } ,
244
+ ] }
245
+ label = "TTS Provider"
246
+ name = "tts_provider"
247
+ >
248
+ < Select
249
+ placeholder = "Select a TTS provider"
250
+ options = { [
251
+ {
252
+ label : "Eleven Labs" ,
253
+ value : "eleven_labs" ,
254
+ } ,
255
+ {
256
+ label : "OpenAI" ,
257
+ value : "openai" ,
258
+ } ,
259
+ ] }
260
+ />
261
+ </ Form . Item >
262
+ { ttsProvider === "openai" && (
263
+ < Form . Item
264
+ name = "tts_model"
265
+ label = "TTS Model"
266
+ rules = { [
267
+ {
268
+ required : true ,
269
+ message : "Please select a TTS model!" ,
270
+ } ,
271
+ ] }
272
+ >
273
+ < Select
274
+ placeholder = "Select a TTS model"
275
+ options = { initialData . tts_data . openai . models }
276
+ />
277
+ </ Form . Item >
278
+ ) }
279
+
280
+ < Form . Item name = "tts_voice" label = "TTS Voice" >
281
+ < Select
282
+ placeholder = "Select a TTS voice"
283
+ options = {
284
+ ttsProvider === "eleven_labs"
285
+ ? initialData . tts_data . eleven_labs . voices
286
+ : initialData . tts_data . openai . voices
287
+ }
288
+ />
289
+ </ Form . Item >
290
+ </ >
291
+ ) }
292
+
221
293
< div className = "mt-3 text-right" >
222
294
< button
223
295
type = "submit"
0 commit comments