🐛 fix(chatComponent): fix condition to check if parsedData.input_keys is not undefined

 feat(chatComponent): add logic to close the connection and finish when end_of_stream event is received
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-08-07 20:31:59 -03:00
commit 16666426f7

View file

@ -82,13 +82,15 @@ export default function BuildTrigger({
const parsedData = JSON.parse(event.data);
// if the event is the end of the stream, close the connection
if (parsedData.end_of_stream) {
// Close the connection and finish
finished = true;
eventSource.close();
return;
} else if (parsedData.log) {
// If the event is a log, log it
setSuccessData({ title: parsedData.log });
} else if (parsedData.input_keys) {
} else if (parsedData.input_keys !== undefined) {
setTabsState((old) => {
return {
...old,