mirror of
https://github.com/GoodStartLabs/AI_Diplomacy.git
synced 2026-04-30 17:40:47 +00:00
added background music
This commit is contained in:
parent
30849a36e4
commit
ad3af94f72
6 changed files with 125 additions and 12 deletions
|
|
@ -404,7 +404,15 @@ function animateMessageWords(message: string, contentSpanId: string, targetPower
|
|||
setTimeout(addNextWord, delay);
|
||||
|
||||
// Scroll to ensure newest content is visible
|
||||
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
// Use requestAnimationFrame to batch DOM updates in streaming mode
|
||||
const isStreamingModeForScroll = import.meta.env.VITE_STREAMING_MODE === 'True' || import.meta.env.VITE_STREAMING_MODE === 'true';
|
||||
if (isStreamingModeForScroll) {
|
||||
requestAnimationFrame(() => {
|
||||
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
});
|
||||
} else {
|
||||
messagesContainer.scrollTop = messagesContainer.scrollHeight;
|
||||
}
|
||||
};
|
||||
|
||||
// Start animation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue