🐛 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:
parent
e1cbc0d5d4
commit
16666426f7
1 changed files with 3 additions and 1 deletions
|
|
@ -82,13 +82,15 @@ export default function BuildTrigger({
|
||||||
const parsedData = JSON.parse(event.data);
|
const parsedData = JSON.parse(event.data);
|
||||||
// if the event is the end of the stream, close the connection
|
// if the event is the end of the stream, close the connection
|
||||||
if (parsedData.end_of_stream) {
|
if (parsedData.end_of_stream) {
|
||||||
|
// Close the connection and finish
|
||||||
|
finished = true;
|
||||||
eventSource.close();
|
eventSource.close();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else if (parsedData.log) {
|
} else if (parsedData.log) {
|
||||||
// If the event is a log, log it
|
// If the event is a log, log it
|
||||||
setSuccessData({ title: parsedData.log });
|
setSuccessData({ title: parsedData.log });
|
||||||
} else if (parsedData.input_keys) {
|
} else if (parsedData.input_keys !== undefined) {
|
||||||
setTabsState((old) => {
|
setTabsState((old) => {
|
||||||
return {
|
return {
|
||||||
...old,
|
...old,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue