"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "d75200283602be6e35b0c16e0532fb2557a50eae"
Unverified Commit 9ddc243c authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #1829 from cheahjs/fix/fluid-streaming-background

fix: fluid streaming was "pausing" when tab was not visible
parents 9832e6ed ed9e99e9
...@@ -73,7 +73,11 @@ async function* streamLargeDeltasAsRandomChunks( ...@@ -73,7 +73,11 @@ async function* streamLargeDeltasAsRandomChunks(
const chunkSize = Math.min(Math.floor(Math.random() * 3) + 1, content.length); const chunkSize = Math.min(Math.floor(Math.random() * 3) + 1, content.length);
const chunk = content.slice(0, chunkSize); const chunk = content.slice(0, chunkSize);
yield { done: false, value: chunk }; yield { done: false, value: chunk };
// Do not sleep if the tab is hidden
// Timers are throttled to 1s in hidden tabs
if (document?.visibilityState !== 'hidden') {
await sleep(5); await sleep(5);
}
content = content.slice(chunkSize); content = content.slice(chunkSize);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment