Skip to content

Commit a536350

Browse files
committed
Update Langflow Chat bundle to v1.0.6 and add start_open prop to ChatWidget component
1 parent fb6f7bf commit a536350

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
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>

src/chatWidget/chatWindow/index.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)