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