77 Card ,
88 CardContent ,
99 FormLabel ,
10+ Grid2 ,
1011 Stack ,
1112 Typography ,
1213} from '@mui/material' ;
@@ -33,8 +34,7 @@ const useChatbotSetting = () => {
3334 const chatbotCue = setting ?. data ?. chatbotCue ?? '' ;
3435 const chatbotName = setting ?. data ?. chatbotName ?? DEFAULT_BOT_USERNAME ;
3536
36- const initialPrompt = setting ?. data ?. initialPrompt ?? [ ] ;
37- const chatbotPrompt = initialPrompt [ 0 ] ?. content ?? '' ;
37+ const initialPrompt = setting ?. data ?. initialPrompt ?? '' ;
3838
3939 const saveSetting = useCallback (
4040 async ( data : ChatbotPromptSettings ) : Promise < void > => {
@@ -54,18 +54,17 @@ const useChatbotSetting = () => {
5454 ) ;
5555
5656 return {
57- chatbotPrompt ,
57+ initialPrompt ,
5858 chatbotCue,
5959 chatbotName,
60- initialPrompt,
6160 saveSetting,
6261 } ;
6362} ;
6463
6564function ChatbotSettings ( ) {
6665 const { t } = useTranslation ( ) ;
6766
68- const { saveSetting, chatbotCue, chatbotName, chatbotPrompt , initialPrompt } =
67+ const { saveSetting, chatbotCue, chatbotName, initialPrompt } =
6968 useChatbotSetting ( ) ;
7069
7170 const [ isEditing , setIsEditing ] = useState ( false ) ;
@@ -109,7 +108,7 @@ function ChatbotSettings() {
109108 { isEditing ? t ( 'CANCEL_LABEL' ) : t ( 'EDIT_LABEL' ) }
110109 </ Button >
111110 </ Stack >
112- { ! chatbotPrompt && (
111+ { ! initialPrompt && (
113112 < Alert severity = "warning" > { t ( 'CHATBOT_CONFIGURATION_MISSING' ) } </ Alert >
114113 ) }
115114
@@ -118,7 +117,7 @@ function ChatbotSettings() {
118117 initialValue = { {
119118 name : chatbotName ,
120119 cue : chatbotCue ,
121- prompt : chatbotPrompt ,
120+ prompt : initialPrompt ,
122121 } }
123122 onSave = { handleOnSave }
124123 />
@@ -129,44 +128,47 @@ function ChatbotSettings() {
129128 data-cy = { CHATBOT_SETTINGS_SUMMARY_CY }
130129 >
131130 < CardContent sx = { { pb : 0 } } >
132- < Stack direction = "column" spacing = { 1 } >
133- < Stack direction = "column" >
134- < Stack direction = "row" spacing = { 1 } >
135- < FormLabel >
136- < Typography > { t ( 'CHATBOT_NAME_LABEL' ) } :</ Typography >
137- </ FormLabel >
131+ < Grid2 container rowGap = { 2 } spacing = { 1 } >
132+ < Grid2 size = { { xs : 12 , sm : 4 } } >
133+ < FormLabel sx = { { fontWeight : 'bold' } } >
134+ { t ( 'CHATBOT_NAME_LABEL' ) }
135+ </ FormLabel >
136+ </ Grid2 >
137+ < Grid2 size = { { xs : 12 , sm : 8 } } >
138+ < Stack direction = "row" gap = { 1 } >
138139 < Typography > { chatbotName } </ Typography >
139- { chatbotName === DEFAULT_BOT_USERNAME ? (
140+ { chatbotName === DEFAULT_BOT_USERNAME && (
140141 < Typography color = "text.disabled" >
141- ( { t ( 'CHATBOT_NAME_DEFAULT_MESSAGE' ) } )
142+ { t ( 'CHATBOT_NAME_DEFAULT_MESSAGE' ) }
142143 </ Typography >
143- ) : undefined }
144- </ Stack >
145- < Typography variant = "caption" color = "text.secondary" >
146- { t ( 'CHATBOT_NAME_HELPER' ) }
147- </ Typography >
148- </ Stack >
149-
150- < Stack direction = "column" >
151- < FormLabel > { t ( 'CHATBOT_PROMPT_LABEL' ) } </ FormLabel >
152- < ChatbotPromptDisplay messages = { initialPrompt } />
153- </ Stack >
154- < Stack direction = "column" >
155- < Stack >
156- < FormLabel > { t ( 'CHATBOT_CUE_LABEL' ) } :</ FormLabel >
157- < Typography variant = "caption" color = "text.secondary" >
158- { t ( 'CHATBOT_CUE_HELPER' ) }
159- </ Typography >
144+ ) }
160145 </ Stack >
146+ </ Grid2 >
147+
148+ < Grid2 size = { { xs : 12 , sm : 4 } } >
149+ < FormLabel sx = { { fontWeight : 'bold' } } >
150+ { t ( 'CHATBOT_PROMPT_LABEL' ) }
151+ </ FormLabel >
152+ </ Grid2 >
153+ < Grid2 size = { { xs : 12 , sm : 8 } } >
154+ < ChatbotPromptDisplay prompt = { initialPrompt } />
155+ </ Grid2 >
156+
157+ < Grid2 size = { { xs : 12 , sm : 4 } } >
158+ < FormLabel sx = { { fontWeight : 'bold' } } >
159+ { t ( 'CHATBOT_CUE_LABEL' ) }
160+ </ FormLabel >
161+ </ Grid2 >
162+ < Grid2 size = { { xs : 12 , sm : 8 } } >
161163 { chatbotCue ? (
162164 < Typography > { chatbotCue } </ Typography >
163165 ) : (
164166 < Typography color = "text.disabled" fontStyle = "italic" >
165167 { t ( 'CHATBOT_CUE_EMPTY_MESSAGE' ) }
166168 </ Typography >
167169 ) }
168- </ Stack >
169- </ Stack >
170+ </ Grid2 >
171+ </ Grid2 >
170172 </ CardContent >
171173 </ Card >
172174 ) }
0 commit comments