Perf: worfklow scroll cannot wheel. Adapt wrokflow skip circle. Change tab alway output stream (#2688)

* perf: teaxtarea no wheel

* remove render error

* adapt workflow skip circle

* perf: change tab can stream output
This commit is contained in:
Archer
2024-09-12 17:22:52 +08:00
committed by GitHub
parent fde1618af2
commit 56281d92f2
11 changed files with 64 additions and 39 deletions

View File

@@ -84,7 +84,7 @@ export const streamFetch = ({
}
if (responseQueue.length > 0) {
const fetchCount = Math.max(1, Math.round(responseQueue.length / 30));
const fetchCount = Math.max(1, Math.round(responseQueue.length / 20));
for (let i = 0; i < fetchCount; i++) {
const item = responseQueue[i];
onMessage(item);
@@ -100,7 +100,9 @@ export const streamFetch = ({
return finish();
}
requestAnimationFrame(animateResponseText);
window.windowHidden
? setTimeout(animateResponseText, 16)
: requestAnimationFrame(animateResponseText);
}
// start animation
animateResponseText();

View File

@@ -13,3 +13,12 @@ export const getWebLLMModel = (model?: string) => {
const list = useSystemStore.getState().llmModelList;
return list.find((item) => item.model === model || item.name === model) ?? list[0];
};
export const watchWindowHidden = () => {
// @ts-ignore
if (document.hidden) {
window.windowHidden = true;
} else {
window.windowHidden = false;
}
};