File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 537537 console .log (' Unknown message type' , data );
538538 }
539539
540- history .messages [event .message_id ] = message ;
540+ if (type === ' chat:message:delta' || type === ' message' || type === ' status' ) {
541+ scheduleHistoryFlush ();
542+ } else {
543+ cancelAnimationFrame (historyRAF );
544+ historyRAF = null ;
545+ history .messages [event .message_id ] = message ;
546+ }
541547 }
542548 } else {
543549 // Non-active chat completion: queue stays in the global store.
12811287
12821288 let scrollRAF = null ;
12831289 let contentsRAF = null ;
1290+ let historyRAF = null ;
1291+ const scheduleHistoryFlush = () => {
1292+ if (! historyRAF ) {
1293+ historyRAF = requestAnimationFrame (() => {
1294+ historyRAF = null ;
1295+ history = history ;
1296+ });
1297+ }
1298+ };
12841299 const scheduleScrollToBottom = () => {
12851300 if (! scrollRAF ) {
12861301 scrollRAF = requestAnimationFrame (async () => {
You can’t perform that action at this time.
0 commit comments