Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: smaller scroll to bottom button, visible in dark mode, with a setting to hide it (#12417)
Michael Han747ec43de11a
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 4de852e4eec..7bd694c24bc 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -2453,17 +2453,24 @@ const ThreadScrollToBottom: FC = () => {// MutationObserver as a content change.const isAtBottom = useIsThreadAtBottom();const scrollToBottom = useScrollThreadToBottom();+ const enabled = useChatPreferencesStore(+ (state) => state.showScrollToBottomButton,+ );return (<TooltipIconButtontooltip="Scroll to bottom"variant="outline"onClick={() => scrollToBottom("auto")}className={cn(- "aui-thread-scroll-to-bottom pointer-events-auto rounded-full p-4 bg-background hover:bg-accent dark:bg-background dark:hover:bg-accent",- isAtBottom && "invisible pointer-events-none",+ // Muted in dark mode: the page background made it disappear.+ "aui-thread-scroll-to-bottom pointer-events-auto rounded-full p-0 size-[calc(28px*var(--ui-space-scale,1))] bg-background hover:bg-accent dark:bg-muted dark:hover:bg-accent",+ (isAtBottom || !enabled) && "invisible pointer-events-none",)}>- <ArrowDownIcon strokeWidth={1.75} className="size-icon" />+ <ArrowDownIcon+ strokeWidth={1.75}+ className="size-[calc(var(--ui-icon-size)*1.125)]"+ /></TooltipIconButton>);};diff --git a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts b/studio/frontend/src/features/chat/stores/chat-preferences-store.tsindex 7d15a96ccec..c9fedef7d4d 100644--- a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts+++ b/studio/frontend/src/features/chat/stores/chat-preferences-store.ts@@ -59,6 +59,8 @@ export interface ChatPreferencesState {setPastedTextMinChars: (value: number) => void;autoScrollWhileGenerating: boolean;setAutoScrollWhileGenerating: (value: boolean) => void;+ showScrollToBottomButton: boolean;+ setShowScrollToBottomButton: (value: boolean) => void;}// A stale stored value would leave the dropdown blank and unfixable.@@ -112,6 +114,9 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(autoScrollWhileGenerating: true,setAutoScrollWhileGenerating: (autoScrollWhileGenerating) =>set({ autoScrollWhileGenerating }),+ showScrollToBottomButton: true,+ setShowScrollToBottomButton: (showScrollToBottomButton) =>+ set({ showScrollToBottomButton }),}),{name: "unsloth_chat_preferences",@@ -149,6 +154,7 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(saved?.pastedTextMinChars,),autoScrollWhileGenerating: saved?.autoScrollWhileGenerating ?? true,+ showScrollToBottomButton: saved?.showScrollToBottomButton ?? true,};},},diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.tsindex b1a62926a80..55a7d89d3a6 100644--- a/studio/frontend/src/features/settings/settings-search.ts+++ b/studio/frontend/src/features/settings/settings-search.ts@@ -126,6 +126,7 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {"settings.chat.rememberParamsPerModel","settings.chat.autoCompact","settings.chat.autoScroll",+ "settings.chat.scrollToBottomButton","settings.profile.greetingSloth","settings.chat.thinking.visibility","settings.chat.tools.visibility",@@ -372,4 +373,5 @@ export const SETTINGS_SEARCH_KEYWORDS: Partial<"settings.chat.tools.visibility": "settings.chat.visibilityKeywords","settings.chat.tools.foldIntoThinking": "settings.chat.visibilityKeywords","settings.chat.autoScroll": "settings.chat.autoScrollKeywords",+ "settings.chat.scrollToBottomButton": "settings.chat.scrollToBottomButtonKeywords",};diff --git a/studio/frontend/src/features/settings/tabs/chat-tab.tsx b/studio/frontend/src/features/settings/tabs/chat-tab.tsxindex 9bfcdf694c2..2757fa1511e 100644--- a/studio/frontend/src/features/settings/tabs/chat-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/chat-tab.tsx@@ -259,6 +259,12 @@ export function ChatTab() {const setAutoScrollWhileGenerating = useChatPreferencesStore((state) => state.setAutoScrollWhileGenerating,);+ const showScrollToBottomButton = useChatPreferencesStore(+ (state) => state.showScrollToBottomButton,+ );+ const setShowScrollToBottomButton = useChatPreferencesStore(+ (state) => state.setShowScrollToBottomButton,+ );const thinkingVisibility = useChatPreferencesStore((state) => state.thinkingVisibility,);@@ -453,6 +459,16 @@ export function ChatTab() {))}</div></SettingsRow>+ <SettingsRow+ label={t("settings.chat.scrollToBottomButton")}+ description={t("settings.chat.scrollToBottomButtonDescription")}+ >+ <Switch+ aria-label={t("settings.chat.scrollToBottomButton")}+ checked={showScrollToBottomButton}+ onCheckedChange={setShowScrollToBottomButton}+ />+ </SettingsRow></SettingsSection><SettingsSection title={t("settings.chat.groups.conversations.title")}>diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 6ae67bdd4ee..15b4e2735ab 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -1845,6 +1845,11 @@ export const ar = {autoScrollManual: "يدوي",autoScrollKeywords:"تمرير تلقائي متابعة أسفل قفز بث إنشاء تثبيت scroll autoscroll follow",+ scrollToBottomButton: "زر التمرير إلى الأسفل",+ scrollToBottomButtonDescription:+ "إظهار زر للعودة إلى أحدث رسالة بعد التمرير لأعلى.",+ scrollToBottomButtonKeywords:+ "تمرير أسفل أحدث سهم زر إخفاء scroll bottom button",showResponseModel: "إظهار نموذج الاستجابة",showResponseModelDescription:"إظهار البيانات الوصفية للنموذج في ردود المساعد.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 172d7c39325..2d5fdd81a66 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -1883,6 +1883,11 @@ export const de = {autoScrollManual: "Manuell",autoScrollKeywords:"scrollen automatisch mitscrollen folgen unten springen Streaming generieren Ansicht sperren scroll autoscroll follow",+ scrollToBottomButton: "Schaltfläche „Nach unten scrollen“",+ scrollToBottomButtonDescription:+ "Eine Schaltfläche anzeigen, um nach dem Hochscrollen zur neuesten Nachricht zurückzuspringen.",+ scrollToBottomButtonKeywords:+ "scrollen unten springen neueste Pfeil Schaltfläche ausblenden scroll bottom button",showResponseModel: "Antwortmodell anzeigen",showResponseModelDescription:"Modellmetadaten in Antworten des Assistenten anzeigen.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 4120dd905c0..647df715b4c 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -1841,6 +1841,11 @@ export const en = {autoScrollManual: "Manual",autoScrollKeywords:"scroll autoscroll auto-scroll follow stick bottom jump streaming generating viewport lock hold auto manual",+ scrollToBottomButton: "Scroll to bottom button",+ scrollToBottomButtonDescription:+ "Show a button to jump back to the latest message after you scroll up.",+ scrollToBottomButtonKeywords:+ "scroll bottom jump latest newest arrow down button floating hide show",showResponseModel: "Response model",showResponseModelDescription:"Show model details in assistant responses.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 223962100e2..200f50eb8a4 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -1874,6 +1874,11 @@ export const es = {autoScrollManual: "Manual",autoScrollKeywords:"desplazamiento desplazar automático seguir abajo saltar transmisión generar vista bloquear scroll autoscroll follow",+ scrollToBottomButton: "Botón para ir al final",+ scrollToBottomButtonDescription:+ "Muestra un botón para volver al último mensaje después de desplazarte hacia arriba.",+ scrollToBottomButtonKeywords:+ "desplazar final abajo saltar último flecha botón ocultar scroll bottom button",showResponseModel: "Mostrar el modelo de respuesta",showResponseModelDescription:"Muestra los metadatos del modelo en las respuestas del asistente.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 2ebbab4fbef..3f87a74b170 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -1880,6 +1880,11 @@ export const fr = {autoScrollManual: "Manuel",autoScrollKeywords:"défilement défiler automatique suivre bas sauter diffusion génération vue verrouiller scroll autoscroll follow",+ scrollToBottomButton: "Bouton « Défiler vers le bas »",+ scrollToBottomButtonDescription:+ "Afficher un bouton pour revenir au dernier message après avoir fait défiler vers le haut.",+ scrollToBottomButtonKeywords:+ "défiler bas sauter dernier flèche bouton masquer scroll bottom button",showResponseModel: "Afficher le modèle de réponse",showResponseModelDescription:"Afficher les métadonnées du modèle dans les réponses de l’assistant.",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 2eab57514b2..c650b55e7ce 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -1851,6 +1851,11 @@ export const hi = {autoScrollManual: "मैन्युअल",autoScrollKeywords:"स्क्रॉल ऑटो-स्क्रॉल फ़ॉलो नीचे स्ट्रीमिंग जनरेट लॉक scroll autoscroll follow",+ scrollToBottomButton: "नीचे स्क्रॉल करने का बटन",+ scrollToBottomButtonDescription:+ "ऊपर स्क्रॉल करने के बाद नवीनतम संदेश पर वापस जाने के लिए बटन दिखाएँ।",+ scrollToBottomButtonKeywords:+ "स्क्रॉल नीचे नवीनतम तीर बटन छिपाएँ scroll bottom button",showResponseModel: "जवाब देने वाला मॉडल दिखाएँ",showResponseModelDescription:"असिस्टेंट के जवाबों में मॉडल का मेटाडेटा दिखाएँ।",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 060e4307700..39432265682 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -1843,6 +1843,11 @@ export const it = {autoScrollManual: "Manuale",autoScrollKeywords:"scorrimento scorrere automatico seguire fondo saltare streaming generazione vista bloccare scroll autoscroll follow",+ scrollToBottomButton: "Pulsante per scorrere in fondo",+ scrollToBottomButtonDescription:+ "Mostra un pulsante per tornare all'ultimo messaggio dopo aver scorso verso l'alto.",+ scrollToBottomButtonKeywords:+ "scorrere fondo saltare ultimo freccia pulsante nascondere scroll bottom button",showResponseModel: "Mostra il modello della risposta",showResponseModelDescription:"Mostra i metadati del modello nelle risposte dell'assistente.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex b6bbb949204..cd84e49baac 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -1830,6 +1830,11 @@ export const ja = {autoScrollManual: "手動",autoScrollKeywords:"スクロール 自動スクロール 追従 下 ジャンプ ストリーミング 生成 固定 scroll autoscroll follow",+ scrollToBottomButton: "一番下へスクロールボタン",+ scrollToBottomButtonDescription:+ "上にスクロールしたときに、最新のメッセージへ戻るボタンを表示します。",+ scrollToBottomButtonKeywords:+ "スクロール 一番下 最新 矢印 ボタン 非表示 scroll bottom button",showResponseModel: "応答モデルを表示",showResponseModelDescription:"アシスタントの応答にモデルのメタデータを表示します。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex 572421baa0f..5f4168d4ce2 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -1840,6 +1840,11 @@ export const ko = {autoScrollManual: "수동",autoScrollKeywords:"스크롤 자동 스크롤 따라가기 아래 이동 스트리밍 생성 고정 scroll autoscroll follow",+ scrollToBottomButton: "맨 아래로 스크롤 버튼",+ scrollToBottomButtonDescription:+ "위로 스크롤한 뒤 최신 메시지로 돌아가는 버튼을 표시합니다.",+ scrollToBottomButtonKeywords:+ "스크롤 맨 아래 최신 화살표 버튼 숨기기 scroll bottom button",showResponseModel: "응답 모델 표시",showResponseModelDescription:"어시스턴트 응답에 모델 메타데이터를 표시합니다.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex b724e039d4f..2dd232613e7 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -1861,6 +1861,11 @@ export const ptBR = {autoScrollManual: "Manual",autoScrollKeywords:"rolagem rolar automática acompanhar fim pular streaming gerar visualização travar scroll autoscroll follow",+ scrollToBottomButton: "Botão de rolar até o final",+ scrollToBottomButtonDescription:+ "Mostra um botão para voltar à mensagem mais recente depois de rolar para cima.",+ scrollToBottomButtonKeywords:+ "rolar final baixo pular recente seta botão ocultar scroll bottom button",showResponseModel: "Mostrar o modelo da resposta",showResponseModelDescription:"Mostra os metadados do modelo nas respostas do assistente.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex 4739fa60bd5..0920e855384 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -1857,6 +1857,11 @@ export const ru = {autoScrollManual: "Вручную",autoScrollKeywords:"прокрутка автопрокрутка следовать вниз низ поток генерация зафиксировать scroll autoscroll follow",+ scrollToBottomButton: "Кнопка «Прокрутить вниз»",+ scrollToBottomButtonDescription:+ "Показывать кнопку для возврата к последнему сообщению после прокрутки вверх.",+ scrollToBottomButtonKeywords:+ "прокрутка вниз последнее стрелка кнопка скрыть scroll bottom button",showResponseModel: "Показывать модель в ответах",showResponseModelDescription:"Показывать метаданные модели в ответах ассистента.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 4bee36c07f7..2d22d2d55d6 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -1806,6 +1806,11 @@ export const zhCN = {autoScrollManual: "手动",autoScrollKeywords:"滚动 自动滚动 跟随 底部 跳转 流式 生成 锁定 scroll autoscroll follow",+ scrollToBottomButton: "滚动到底部按钮",+ scrollToBottomButtonDescription:+ "向上滚动后显示一个按钮,用于跳回最新消息。",+ scrollToBottomButtonKeywords:+ "滚动 底部 跳转 最新 箭头 按钮 隐藏 scroll bottom button",showResponseModel: "显示回复模型",showResponseModelDescription: "在助手回复中显示模型元数据。",inlineReadAloud: "在回复上显示朗读",diff --git a/studio/frontend/tests/scroll-to-bottom-button.test.ts b/studio/frontend/tests/scroll-to-bottom-button.test.tsnew file mode 100644index 00000000000..c0aca41d3c4--- /dev/null+++ b/studio/frontend/tests/scroll-to-bottom-button.test.ts@@ -0,0 +1,75 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// thread.tsx is .tsx, which node's type stripping cannot import, so its shape is pinned from source.++import assert from "node:assert/strict";+import test from "node:test";++import { readSrc, registerBundlerResolver } from "./helpers/kit.ts";++registerBundlerResolver();+const { useChatPreferencesStore } = await import(+ "../src/features/chat/stores/chat-preferences-store.ts"+);+const { SETTINGS_SEARCH_INDEX } = await import(+ "../src/features/settings/settings-search.ts"+);++const THREAD = readSrc("components/assistant-ui/thread.tsx");+const STORE = readSrc("features/chat/stores/chat-preferences-store.ts");++function button(): string {+ const start = THREAD.indexOf("const ThreadScrollToBottom: FC");+ assert.notEqual(+ start,+ -1,+ "ThreadScrollToBottom is gone; this test needs rewriting",+ );+ return THREAD.slice(start, THREAD.indexOf("\n};", start));+}++test("the button shows by default, including installs that never saw the setting", () => {+ assert.equal(+ useChatPreferencesStore.getInitialState().showScrollToBottomButton,+ true,+ );+ assert.match(+ STORE,+ /showScrollToBottomButton: saved\?\.showScrollToBottomButton \?\? true/,+ );+});++test("turning it off hides the button without unmounting it", () => {+ const source = button();+ assert.match(source, /state\.showScrollToBottomButton/);+ // Unmounting would read as a content change to the autoscroll observer.+ assert.match(+ source,+ /\(isAtBottom \|\| !enabled\) && "invisible pointer-events-none"/,+ );+});++test("a smaller button with a larger arrow, lifted off the dark background", () => {+ const source = button();+ assert.match(source, /p-0 size-\[calc\(28px\*var\(--ui-space-scale,1\)\)\]/);+ assert.match(+ source,+ /className="size-\[calc\(var\(--ui-icon-size\)\*1\.125\)\]"/,+ );+ assert.match(source, /dark:bg-muted dark:hover:bg-accent/);+ assert.doesNotMatch(source, /dark:bg-background/);+});++test("the setting is a searchable switch in Chat settings", () => {+ const tab = readSrc("features/settings/tabs/chat-tab.tsx");+ const at = tab.indexOf('label={t("settings.chat.scrollToBottomButton")}');+ assert.notEqual(at, -1);+ const row = tab.slice(at, tab.indexOf("</SettingsRow>", at));+ assert.match(row, /<Switch/);+ assert.match(row, /checked=\{showScrollToBottomButton\}/);+ assert.match(row, /onCheckedChange=\{setShowScrollToBottomButton\}/);+ assert.ok(+ SETTINGS_SEARCH_INDEX.chat.includes("settings.chat.scrollToBottomButton"),+ );+});