@@ -23,13 +23,14 @@ import RadioButton from '@l3-lib/ui-core/dist/RadioButton'
23
23
24
24
import UploadAvatar from 'components/UploadAvatar'
25
25
import { StyledFormRoot , StyledFormInputWrapper } from 'styles/formStyles.css'
26
- import { StyledTextAreaWrapper } from 'pages/ApiKeys/EditApiKey/EditApiModal '
26
+ import { StyledTab } from 'styles/tabStyles.css '
27
27
28
28
type AgentFormProps = {
29
29
formik : any
30
+ isVoice ?: boolean
30
31
}
31
32
32
- const AgentForm = ( { formik } : AgentFormProps ) => {
33
+ const AgentForm = ( { formik, isVoice = true } : AgentFormProps ) => {
33
34
const { t } = useTranslation ( )
34
35
35
36
const { setFieldValue, values } = formik
@@ -49,8 +50,9 @@ const AgentForm = ({ formik }: AgentFormProps) => {
49
50
agent_voice_synthesizer,
50
51
agent_voice_transcriber,
51
52
agent_voice_input_mode,
53
+ agent_voice_response,
52
54
} = values
53
- console . log ( 'values' , values )
55
+
54
56
const onTextareaChange = ( field : string , value : string ) => {
55
57
formik . setFieldValue ( field , value )
56
58
}
@@ -59,7 +61,8 @@ const AgentForm = ({ formik }: AgentFormProps) => {
59
61
modelOptions,
60
62
datasourceOptions,
61
63
toolOptions,
62
- voiceOptions,
64
+ voiceSynthesizerOptions,
65
+ voiceTranscriberOptions,
63
66
handleUploadAvatar,
64
67
avatarIsLoading,
65
68
} = useAgentForm ( formik )
@@ -93,7 +96,7 @@ const AgentForm = ({ formik }: AgentFormProps) => {
93
96
< StyledTab onClick = { ( ) => setActiveTab ( 3 ) } >
94
97
< StyledSpan isActive = { activeTab === 3 } > Onboarding</ StyledSpan >
95
98
</ StyledTab >
96
- < StyledTab onClick = { ( ) => setActiveTab ( 4 ) } >
99
+ < StyledTab onClick = { ( ) => setActiveTab ( 4 ) } isDisabled = { ! isVoice } >
97
100
< StyledSpan isActive = { activeTab === 4 } > Voice Preferences</ StyledSpan >
98
101
</ StyledTab >
99
102
</ StyledFormTabList >
@@ -288,7 +291,7 @@ const AgentForm = ({ formik }: AgentFormProps) => {
288
291
fieldName = { 'agent_voice_synthesizer' }
289
292
setFieldValue = { setFieldValue }
290
293
fieldValue = { agent_voice_synthesizer }
291
- options = { voiceOptions }
294
+ options = { voiceSynthesizerOptions }
292
295
onChange = { ( ) => {
293
296
setFieldValue ( 'agent_voice_synthesizer' , '' )
294
297
} }
@@ -311,7 +314,7 @@ const AgentForm = ({ formik }: AgentFormProps) => {
311
314
fieldName = { 'agent_voice_transcriber' }
312
315
setFieldValue = { setFieldValue }
313
316
fieldValue = { agent_voice_transcriber }
314
- options = { voiceOptions }
317
+ options = { voiceTranscriberOptions }
315
318
onChange = { ( ) => {
316
319
setFieldValue ( 'agent_voice_transcriber' , '' )
317
320
} }
@@ -329,17 +332,24 @@ const AgentForm = ({ formik }: AgentFormProps) => {
329
332
text = { t ( 'text' ) }
330
333
name = 'agent_voice_response'
331
334
onSelect = { ( ) => setFieldValue ( 'agent_voice_response' , [ 'Text' ] ) }
332
- defaultChecked
335
+ checked = {
336
+ agent_voice_response ?. length === 1 && agent_voice_response ?. includes ( 'Text' )
337
+ }
333
338
/>
334
339
< RadioButton
335
340
text = { t ( 'voice' ) }
336
341
name = 'agent_voice_response'
337
342
onSelect = { ( ) => setFieldValue ( 'agent_voice_response' , [ 'Voice' ] ) }
343
+ checked = {
344
+ agent_voice_response ?. length === 1 &&
345
+ agent_voice_response ?. includes ( 'Voice' )
346
+ }
338
347
/>
339
348
< RadioButton
340
349
text = { `${ t ( 'text' ) } & ${ t ( 'voice' ) } ` }
341
350
name = 'agent_voice_response'
342
351
onSelect = { ( ) => setFieldValue ( 'agent_voice_response' , [ 'Text' , 'Voice' ] ) }
352
+ checked = { agent_voice_response ?. length === 2 }
343
353
/>
344
354
</ StyledFormInputWrapper >
345
355
@@ -506,8 +516,3 @@ export const StyledTabPanelInnerWrapper = styled(TabPanel)`
506
516
height: 100%;
507
517
/* max-height: 800px; */
508
518
`
509
- export const StyledTab = styled ( Tab ) `
510
- &.active .tab-inner {
511
- background-color: ${ ( { theme } ) => theme . body . detailCardBackgroundColor } ;
512
- }
513
- `
0 commit comments