File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/routes/conversation/[id] Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 137
137
const encoder = new TextDecoderStream ();
138
138
const reader = response ?.body ?.pipeThrough (encoder ).getReader ();
139
139
let finalAnswer = " " ;
140
+ const messageUpdates: MessageUpdate [] = [];
140
141
141
142
// set str queue
142
143
// ex) if the last response is => {"type": "stream", "token":
172
173
try {
173
174
const update = JSON .parse (el ) as MessageUpdate ;
174
175
176
+ if (update .type !== " stream" ) {
177
+ messageUpdates .push (update );
178
+ }
179
+
175
180
if (update .type === " finalAnswer" ) {
176
181
finalAnswer = update .text ;
177
182
reader .cancel ();
224
229
});
225
230
}
226
231
227
- // reset the websearchMessages
228
232
webSearchMessages = [];
229
233
234
+ const lastMessage = messages [messages .length - 1 ];
235
+ lastMessage .updates = messageUpdates ;
236
+
230
237
await invalidate (UrlDependency .ConversationList );
231
238
} catch (err ) {
232
239
if (err instanceof Error && err .message .includes (" overloaded" )) {
You can’t perform that action at this time.
0 commit comments