Skip to content

Commit 0c7220d

Browse files
webui: minor settings reorganization and add disable autoscroll option (ggml-org#17452)
* webui: added a dedicated 'Display' settings section that groups visualization options * webui: added a Display setting to toggle automatic chat scrolling * chore: update webui build output
1 parent 96ac5a2 commit 0c7220d

File tree

4 files changed

+61
-33
lines changed

4 files changed

+61
-33
lines changed

tools/server/public/index.html.gz

118 Bytes
Binary file not shown.

tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
sendMessage,
3030
stopGeneration
3131
} from '$lib/stores/chat.svelte';
32+
import { config } from '$lib/stores/settings.svelte';
3233
import {
3334
supportsVision,
3435
supportsAudio,
@@ -47,6 +48,7 @@
4748
4849
let { showCenteredEmpty = false } = $props();
4950
51+
let disableAutoScroll = $derived(Boolean(config().disableAutoScroll));
5052
let autoScrollEnabled = $state(true);
5153
let chatScrollContainer: HTMLDivElement | undefined = $state();
5254
let dragCounter = $state(0);
@@ -149,7 +151,7 @@
149151
}
150152
151153
function handleScroll() {
152-
if (!chatScrollContainer) return;
154+
if (disableAutoScroll || !chatScrollContainer) return;
153155
154156
const { scrollTop, scrollHeight, clientHeight } = chatScrollContainer;
155157
const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
@@ -194,8 +196,10 @@
194196
const extras = result?.extras;
195197
196198
// Enable autoscroll for user-initiated message sending
197-
userScrolledUp = false;
198-
autoScrollEnabled = true;
199+
if (!disableAutoScroll) {
200+
userScrolledUp = false;
201+
autoScrollEnabled = true;
202+
}
199203
await sendMessage(message, extras);
200204
scrollChatToBottom();
201205
@@ -241,21 +245,36 @@
241245
}
242246
243247
function scrollChatToBottom(behavior: ScrollBehavior = 'smooth') {
248+
if (disableAutoScroll) return;
249+
244250
chatScrollContainer?.scrollTo({
245251
top: chatScrollContainer?.scrollHeight,
246252
behavior
247253
});
248254
}
249255
250256
afterNavigate(() => {
251-
setTimeout(() => scrollChatToBottom('instant'), INITIAL_SCROLL_DELAY);
257+
if (!disableAutoScroll) {
258+
setTimeout(() => scrollChatToBottom('instant'), INITIAL_SCROLL_DELAY);
259+
}
252260
});
253261
254262
onMount(() => {
255-
setTimeout(() => scrollChatToBottom('instant'), INITIAL_SCROLL_DELAY);
263+
if (!disableAutoScroll) {
264+
setTimeout(() => scrollChatToBottom('instant'), INITIAL_SCROLL_DELAY);
265+
}
256266
});
257267
258268
$effect(() => {
269+
if (disableAutoScroll) {
270+
autoScrollEnabled = false;
271+
if (scrollInterval) {
272+
clearInterval(scrollInterval);
273+
scrollInterval = undefined;
274+
}
275+
return;
276+
}
277+
259278
if (isCurrentConversationLoading && autoScrollEnabled) {
260279
scrollInterval = setInterval(scrollChatToBottom, AUTO_SCROLL_INTERVAL);
261280
} else if (scrollInterval) {
@@ -289,9 +308,11 @@
289308
class="mb-16 md:mb-24"
290309
messages={activeMessages()}
291310
onUserAction={() => {
292-
userScrolledUp = false;
293-
autoScrollEnabled = true;
294-
scrollChatToBottom();
311+
if (!disableAutoScroll) {
312+
userScrolledUp = false;
313+
autoScrollEnabled = true;
314+
scrollChatToBottom();
315+
}
295316
}}
296317
/>
297318

tools/server/webui/src/lib/components/app/chat/ChatSettings/ChatSettings.svelte

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Settings,
44
Funnel,
55
AlertTriangle,
6-
Brain,
76
Code,
87
Monitor,
98
Sun,
@@ -58,6 +57,33 @@
5857
label: 'Paste long text to file length',
5958
type: 'input'
6059
},
60+
{
61+
key: 'enableContinueGeneration',
62+
label: 'Enable "Continue" button',
63+
type: 'checkbox',
64+
isExperimental: true
65+
},
66+
{
67+
key: 'pdfAsImage',
68+
label: 'Parse PDF as image',
69+
type: 'checkbox'
70+
},
71+
{
72+
key: 'askForTitleConfirmation',
73+
label: 'Ask for confirmation before changing conversation title',
74+
type: 'checkbox'
75+
}
76+
]
77+
},
78+
{
79+
title: 'Display',
80+
icon: Monitor,
81+
fields: [
82+
{
83+
key: 'showThoughtInProgress',
84+
label: 'Show thought in progress',
85+
type: 'checkbox'
86+
},
6187
{
6288
key: 'showMessageStats',
6389
label: 'Show message generation statistics',
@@ -79,25 +105,14 @@
79105
type: 'checkbox'
80106
},
81107
{
82-
key: 'enableContinueGeneration',
83-
label: 'Enable "Continue" button',
84-
type: 'checkbox',
85-
isExperimental: true
86-
},
87-
{
88-
key: 'pdfAsImage',
89-
label: 'Parse PDF as image',
108+
key: 'disableAutoScroll',
109+
label: 'Disable automatic scroll',
90110
type: 'checkbox'
91111
},
92112
{
93113
key: 'renderUserContentAsMarkdown',
94114
label: 'Render user content as Markdown',
95115
type: 'checkbox'
96-
},
97-
{
98-
key: 'askForTitleConfirmation',
99-
label: 'Ask for confirmation before changing conversation title',
100-
type: 'checkbox'
101116
}
102117
]
103118
},
@@ -208,17 +223,6 @@
208223
}
209224
]
210225
},
211-
{
212-
title: 'Reasoning',
213-
icon: Brain,
214-
fields: [
215-
{
216-
key: 'showThoughtInProgress',
217-
label: 'Show thought in progress',
218-
type: 'checkbox'
219-
}
220-
]
221-
},
222226
{
223227
title: 'Import/Export',
224228
icon: Database,

tools/server/webui/src/lib/constants/settings-config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const SETTING_CONFIG_DEFAULT: Record<string, string | number | boolean> =
1414
pasteLongTextToFileLen: 2500,
1515
pdfAsImage: false,
1616
showModelInfo: false,
17+
disableAutoScroll: false,
1718
renderUserContentAsMarkdown: false,
1819
modelSelectorEnabled: false,
1920
// make sure these default values are in sync with `common.h`
@@ -93,6 +94,8 @@ export const SETTING_CONFIG_INFO: Record<string, string> = {
9394
'Ask for confirmation before automatically changing conversation title when editing the first message.',
9495
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
9596
showModelInfo: 'Display the model name used to generate each message below the message content.',
97+
disableAutoScroll:
98+
'Disable automatic scrolling while messages stream so you can control the viewport position manually.',
9699
renderUserContentAsMarkdown: 'Render user messages using markdown formatting in the chat.',
97100
modelSelectorEnabled:
98101
'Enable the model selector in the chat input to choose the inference model. Sends the associated model field in API requests.',

0 commit comments

Comments
 (0)