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