mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 07:12:07 +00:00
refac
This commit is contained in:
parent
d93107d1d6
commit
47419a77af
@ -1068,29 +1068,7 @@
|
|||||||
if (message.content == '' && value == '\n') {
|
if (message.content == '' && value == '\n') {
|
||||||
console.log('Empty response');
|
console.log('Empty response');
|
||||||
} else {
|
} else {
|
||||||
if ($settings?.splitLargeDeltas ?? false) {
|
message.content += value;
|
||||||
if (value.length < 5) {
|
|
||||||
message.content += value;
|
|
||||||
} else {
|
|
||||||
while (value != '') {
|
|
||||||
const chunkSize = Math.min(Math.floor(Math.random() * 3) + 1, value.length);
|
|
||||||
const chunk = value.slice(0, chunkSize);
|
|
||||||
|
|
||||||
message.content += chunk;
|
|
||||||
history.messages[message.id] = message;
|
|
||||||
|
|
||||||
// Do not sleep if the tab is hidden
|
|
||||||
// Timers are throttled to 1s in hidden tabs
|
|
||||||
if (document?.visibilityState !== 'hidden') {
|
|
||||||
await sleep(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
value = value.slice(chunkSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
message.content += value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (navigator.vibrate && ($settings?.hapticFeedback ?? false)) {
|
if (navigator.vibrate && ($settings?.hapticFeedback ?? false)) {
|
||||||
navigator.vibrate(5);
|
navigator.vibrate(5);
|
||||||
|
@ -577,7 +577,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<!-- <div>
|
||||||
<div class=" py-0.5 flex w-full justify-between">
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
<div class=" self-center text-xs">
|
<div class=" self-center text-xs">
|
||||||
{$i18n.t('Fluidly stream large external response chunks')}
|
{$i18n.t('Fluidly stream large external response chunks')}
|
||||||
@ -597,7 +597,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class=" py-0.5 flex w-full justify-between">
|
<div class=" py-0.5 flex w-full justify-between">
|
||||||
|
Loading…
Reference in New Issue
Block a user