File tree Expand file tree Collapse file tree
src/chatWidget/chatWindow Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77</ head >
88< body style ="width: 100vh; height: 100vh; ">
99 < langflow-chat window_title ="Langflow Chat "
10- flow_id ="be1e92a7-b194-4b03-a36e-a95c94995bcc "
10+ flow_id ="4317421c-d4b5-4a22-bc7b-05e8af053b0e "
1111 host_url ="http://localhost:7860 "
1212 width ="700 "
1313 > </ langflow-chat >
Original file line number Diff line number Diff line change @@ -125,11 +125,21 @@ export default function ChatWindow({
125125 } ) ;
126126 } )
127127 } else {
128- addMessage ( {
129- message : "Multiple outputs were detected in the response. Please, define the output_component to specify the intended response." ,
130- isSend : false ,
131- error : true ,
132- } ) ;
128+ flowOutputs
129+ . sort ( ( a , b ) => {
130+ // Get the earliest timestamp from each flowOutput's outputs
131+ const aTimestamp = Math . min ( ...Object . values ( a . outputs ) . map ( ( output : any ) => Date . parse ( output . message ?. timestamp ) ) ) ;
132+ const bTimestamp = Math . min ( ...Object . values ( b . outputs ) . map ( ( output : any ) => Date . parse ( output . message ?. timestamp ) ) ) ;
133+ return aTimestamp - bTimestamp ; // Sort descending (newest first)
134+ } )
135+ . forEach ( ( flowOutput ) => {
136+ Object . values ( flowOutput . outputs ) . forEach ( ( output : any ) => {
137+ addMessage ( {
138+ message : extractMessageFromOutput ( output ) ,
139+ isSend : false ,
140+ } ) ;
141+ } ) ;
142+ } ) ;
133143 }
134144 }
135145 if ( res . data && res . data . session_id ) {
@@ -171,11 +181,11 @@ export default function ChatWindow({
171181 /* Refocus the User input whenever a new response is returned from the LLM */
172182
173183 useEffect ( ( ) => {
174- // after a slight delay
175- setTimeout ( ( ) => {
176- inputRef . current ?. focus ( ) ;
177- } , 100 ) ;
178- } , [ messages , open ] ) ;
184+ // after a slight delay
185+ setTimeout ( ( ) => {
186+ inputRef . current ?. focus ( ) ;
187+ } , 100 ) ;
188+ } , [ messages , open ] ) ;
179189
180190 return (
181191 < div
You can’t perform that action at this time.
0 commit comments