@@ -71,9 +71,9 @@ const MemoizedMessage = React.memo(
71
71
: { textAlign : "right" }
72
72
}
73
73
>
74
- { message . role === "bot" && app ?. config ?. assistant_image && (
74
+ { message . role === "bot" && app ?. data ?. config ?. assistant_image && (
75
75
< Avatar
76
- src = { app . config . assistant_image }
76
+ src = { app . data ?. config ? .assistant_image }
77
77
alt = "Bot"
78
78
style = { { margin : "16px 8px 16px 0px" } }
79
79
/>
@@ -108,7 +108,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
108
108
const [ errors , setErrors ] = useState ( null ) ;
109
109
const [ showChat , setShowChat ] = useState ( ! embed ) ;
110
110
const [ chatBubbleStyle , setChatBubbleStyle ] = useState ( {
111
- backgroundColor : app ?. config ?. window_color ,
111
+ backgroundColor : app ?. data ?. config ?. window_color ,
112
112
color : "white" ,
113
113
position : "fixed" ,
114
114
right : 16 ,
@@ -138,7 +138,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
138
138
root : {
139
139
"& .MuiOutlinedInput-root" : {
140
140
"& > fieldset" : {
141
- border : `1px solid ${ app ?. config . window_color || "#ccc" } ` ,
141
+ border : `1px solid ${ app ?. data ?. config . window_color || "#ccc" } ` ,
142
142
} ,
143
143
"&.Mui-focused > fieldset" : { border : "1px solid #0f477e" } ,
144
144
"&:hover > fieldset" : { border : "1px solid #0f477e" } ,
@@ -204,22 +204,22 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
204
204
} , [ embed , showChat ] ) ;
205
205
206
206
useEffect ( ( ) => {
207
- if ( app ?. config ?. welcome_message && messages . length === 0 ) {
207
+ if ( app ?. data ?. config ?. welcome_message && messages . length === 0 ) {
208
208
setMessages ( [
209
209
{
210
210
role : "bot" ,
211
- content : app . config . welcome_message ,
211
+ content : app . data ?. config ? .welcome_message ,
212
212
} ,
213
213
] ) ;
214
214
}
215
215
216
216
if (
217
- app ?. config ?. chat_bubble_text &&
218
- app ?. config ?. chat_bubble_style &&
217
+ app ?. data ?. config ?. chat_bubble_text &&
218
+ app ?. data ?. config ?. chat_bubble_style &&
219
219
messages . length === 0
220
220
) {
221
221
try {
222
- const style = JSON . parse ( app ?. config ?. chat_bubble_style ) ;
222
+ const style = JSON . parse ( app ?. data ?. config ?. chat_bubble_style ) ;
223
223
setChatBubbleStyle ( ( prevBubbleStyle ) => ( {
224
224
...prevBubbleStyle ,
225
225
...style ,
@@ -315,13 +315,15 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
315
315
< Fab
316
316
style = { chatBubbleStyle }
317
317
onClick = { ( ) => setShowChat ( ! showChat ) }
318
- variant = { app ?. config ?. chat_bubble_text ? "extended" : "circular" }
318
+ variant = {
319
+ app ?. data ?. config ?. chat_bubble_text ? "extended" : "circular"
320
+ }
319
321
ref = { chatBubbleRef }
320
322
>
321
323
{ showChat ? (
322
324
< KeyboardArrowDownIcon />
323
- ) : app ?. config ?. chat_bubble_text ? (
324
- < span > { app ?. config ?. chat_bubble_text } </ span >
325
+ ) : app ?. data ?. config ?. chat_bubble_text ? (
326
+ < span > { app ?. data ?. config ?. chat_bubble_text } </ span >
325
327
) : (
326
328
< QuestionAnswerIcon />
327
329
) }
@@ -339,13 +341,13 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
339
341
< div
340
342
style = { {
341
343
display : "flex" ,
342
- backgroundColor : app ?. config . window_color ,
344
+ backgroundColor : app ?. data ?. config . window_color ,
343
345
borderRadius : "8px 8px 0px 0px" ,
344
346
} }
345
347
>
346
- { app ?. config ?. assistant_image && (
348
+ { app ?. data ?. config ?. assistant_image && (
347
349
< Avatar
348
- src = { app . config . assistant_image }
350
+ src = { app . data ?. config ? .assistant_image }
349
351
alt = "Bot"
350
352
style = { { margin : "10px 8px" , border : "solid 1px #ccc" } }
351
353
/>
@@ -356,7 +358,9 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
356
358
fontWeight : 600 ,
357
359
fontSize : "18px" ,
358
360
color : "white" ,
359
- padding : app ?. config ?. assistant_image ? "inherit" : "16px" ,
361
+ padding : app ?. data ?. config ?. assistant_image
362
+ ? "inherit"
363
+ : "16px" ,
360
364
} }
361
365
>
362
366
{ app ?. name }
@@ -365,7 +369,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
365
369
) }
366
370
< Stack sx = { { padding : "10px" , overflow : "auto" } } >
367
371
< LexicalRenderer
368
- text = { app . config ?. input_template ?. replaceAll (
372
+ text = { app . data ?. config ?. input_template ?. replaceAll (
369
373
"<a href" ,
370
374
"<a target='_blank' href" ,
371
375
) }
@@ -401,9 +405,9 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
401
405
padding : 3 ,
402
406
} }
403
407
>
404
- { app ?. config ?. assistant_image && (
408
+ { app ?. data ?. config ?. assistant_image && (
405
409
< Avatar
406
- src = { app . config . assistant_image }
410
+ src = { app . data ?. config ? .assistant_image }
407
411
alt = "Bot"
408
412
style = { { margin : "16px 8px 16px 0px" } }
409
413
/>
@@ -418,29 +422,31 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
418
422
{ errors && < Errors runError = { errors } /> }
419
423
{ messages . filter ( ( message ) => message . role === "user" ) . length ===
420
424
0 &&
421
- app ?. config ?. suggested_messages &&
422
- app ?. config ?. suggested_messages . length > 0 && (
425
+ app ?. data ?. config ?. suggested_messages &&
426
+ app ?. data ?. config ?. suggested_messages . length > 0 && (
423
427
< Grid
424
428
sx = { {
425
429
alignSelf : "flex-end" ,
426
430
textAlign : "right" ,
427
431
marginTop : "auto" ,
428
432
} }
429
433
>
430
- { app ?. config ?. suggested_messages . map ( ( message , index ) => (
431
- < Chip
432
- key = { index }
433
- label = { message }
434
- sx = { { margin : "5px 2px" } }
435
- onClick = { ( ) =>
436
- app ?. input_schema ?. properties &&
437
- runApp ( {
438
- [ Object . keys ( app ?. input_schema ?. properties ) [ 0 ] ] :
439
- message ,
440
- } )
441
- }
442
- />
443
- ) ) }
434
+ { app ?. data ?. config ?. suggested_messages . map (
435
+ ( message , index ) => (
436
+ < Chip
437
+ key = { index }
438
+ label = { message }
439
+ sx = { { margin : "5px 2px" } }
440
+ onClick = { ( ) =>
441
+ app ?. input_schema ?. properties &&
442
+ runApp ( {
443
+ [ Object . keys ( app ?. input_schema ?. properties ) [ 0 ] ] :
444
+ message ,
445
+ } )
446
+ }
447
+ />
448
+ ) ,
449
+ ) }
444
450
</ Grid >
445
451
) }
446
452
</ div >
0 commit comments