@@ -71,9 +71,9 @@ const MemoizedMessage = React.memo(
7171 : { textAlign : "right" }
7272 }
7373 >
74- { message . role === "bot" && app ?. config ?. assistant_image && (
74+ { message . role === "bot" && app ?. data ?. config ?. assistant_image && (
7575 < Avatar
76- src = { app . config . assistant_image }
76+ src = { app . data ?. config ? .assistant_image }
7777 alt = "Bot"
7878 style = { { margin : "16px 8px 16px 0px" } }
7979 />
@@ -108,7 +108,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
108108 const [ errors , setErrors ] = useState ( null ) ;
109109 const [ showChat , setShowChat ] = useState ( ! embed ) ;
110110 const [ chatBubbleStyle , setChatBubbleStyle ] = useState ( {
111- backgroundColor : app ?. config ?. window_color ,
111+ backgroundColor : app ?. data ?. config ?. window_color ,
112112 color : "white" ,
113113 position : "fixed" ,
114114 right : 16 ,
@@ -138,7 +138,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
138138 root : {
139139 "& .MuiOutlinedInput-root" : {
140140 "& > fieldset" : {
141- border : `1px solid ${ app ?. config . window_color || "#ccc" } ` ,
141+ border : `1px solid ${ app ?. data ?. config . window_color || "#ccc" } ` ,
142142 } ,
143143 "&.Mui-focused > fieldset" : { border : "1px solid #0f477e" } ,
144144 "&:hover > fieldset" : { border : "1px solid #0f477e" } ,
@@ -204,22 +204,22 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
204204 } , [ embed , showChat ] ) ;
205205
206206 useEffect ( ( ) => {
207- if ( app ?. config ?. welcome_message && messages . length === 0 ) {
207+ if ( app ?. data ?. config ?. welcome_message && messages . length === 0 ) {
208208 setMessages ( [
209209 {
210210 role : "bot" ,
211- content : app . config . welcome_message ,
211+ content : app . data ?. config ? .welcome_message ,
212212 } ,
213213 ] ) ;
214214 }
215215
216216 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 &&
219219 messages . length === 0
220220 ) {
221221 try {
222- const style = JSON . parse ( app ?. config ?. chat_bubble_style ) ;
222+ const style = JSON . parse ( app ?. data ?. config ?. chat_bubble_style ) ;
223223 setChatBubbleStyle ( ( prevBubbleStyle ) => ( {
224224 ...prevBubbleStyle ,
225225 ...style ,
@@ -315,13 +315,15 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
315315 < Fab
316316 style = { chatBubbleStyle }
317317 onClick = { ( ) => setShowChat ( ! showChat ) }
318- variant = { app ?. config ?. chat_bubble_text ? "extended" : "circular" }
318+ variant = {
319+ app ?. data ?. config ?. chat_bubble_text ? "extended" : "circular"
320+ }
319321 ref = { chatBubbleRef }
320322 >
321323 { showChat ? (
322324 < 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 >
325327 ) : (
326328 < QuestionAnswerIcon />
327329 ) }
@@ -339,13 +341,13 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
339341 < div
340342 style = { {
341343 display : "flex" ,
342- backgroundColor : app ?. config . window_color ,
344+ backgroundColor : app ?. data ?. config . window_color ,
343345 borderRadius : "8px 8px 0px 0px" ,
344346 } }
345347 >
346- { app ?. config ?. assistant_image && (
348+ { app ?. data ?. config ?. assistant_image && (
347349 < Avatar
348- src = { app . config . assistant_image }
350+ src = { app . data ?. config ? .assistant_image }
349351 alt = "Bot"
350352 style = { { margin : "10px 8px" , border : "solid 1px #ccc" } }
351353 />
@@ -356,7 +358,9 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
356358 fontWeight : 600 ,
357359 fontSize : "18px" ,
358360 color : "white" ,
359- padding : app ?. config ?. assistant_image ? "inherit" : "16px" ,
361+ padding : app ?. data ?. config ?. assistant_image
362+ ? "inherit"
363+ : "16px" ,
360364 } }
361365 >
362366 { app ?. name }
@@ -365,7 +369,7 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
365369 ) }
366370 < Stack sx = { { padding : "10px" , overflow : "auto" } } >
367371 < LexicalRenderer
368- text = { app . config ?. input_template ?. replaceAll (
372+ text = { app . data ?. config ?. input_template ?. replaceAll (
369373 "<a href" ,
370374 "<a target='_blank' href" ,
371375 ) }
@@ -401,9 +405,9 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
401405 padding : 3 ,
402406 } }
403407 >
404- { app ?. config ?. assistant_image && (
408+ { app ?. data ?. config ?. assistant_image && (
405409 < Avatar
406- src = { app . config . assistant_image }
410+ src = { app . data ?. config ? .assistant_image }
407411 alt = "Bot"
408412 style = { { margin : "16px 8px 16px 0px" } }
409413 />
@@ -418,29 +422,31 @@ export function WebChatRender({ app, isMobile, embed = false, ws }) {
418422 { errors && < Errors runError = { errors } /> }
419423 { messages . filter ( ( message ) => message . role === "user" ) . length ===
420424 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 && (
423427 < Grid
424428 sx = { {
425429 alignSelf : "flex-end" ,
426430 textAlign : "right" ,
427431 marginTop : "auto" ,
428432 } }
429433 >
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+ ) }
444450 </ Grid >
445451 ) }
446452 </ div >
0 commit comments