Handle Object Append On Streaming Response
I have a variable that is holding all the messages for my chat bot interaction . The variable is an array of objects . Each object represents a message . The object keys are role and content role can be either bot , user , or system . When the chunks of responses are received I want to update the last (most recent ) bot object only . . . The current formula appends each chunk as a separate object instead of updating the last on . Puzzling my brain on this one 🧠 You may need to seperate this out a bit ( that 's why I did ) First I would stream the results to a variable ( let 's call that responseText ) Then I would append the object to the array once I receive the "end " trigger from the response This gives me two things that are usable . . . 1 - allows me to temporary show the text as it 's streaming 2 - once the data has finished streaming , I can set the responseText back to null which in turn will replace the data displayed from the streamed version to the version in the object within the array Just size would create a new entry


.jpeg/public)