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: keep the download button off the chat composer on phones (#14163)
Michael Hanf2ed00705f1d
diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.pyindex 58c3267dbed..7c0c8990d42 100644--- a/studio/backend/tests/test_video_backend.py+++ b/studio/backend/tests/test_video_backend.py@@ -9551,6 +9551,7 @@ def test_default_load_budgets_the_hosted_encoder_its_family_defaults_to(fake_run# the dense encoder, so that is what it budgets.import core.inference.diffusion_te_prequant as tpqfrom core.inference.video_families import detect_video_family+scale = _allow_te_prequant(monkeypatch)for repo in ("Wan-AI/Wan2.2-TI2V-5B-Diffusers", "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"):fam = detect_video_family(repo)diff --git a/studio/backend/tests/test_video_te_quant_default.py b/studio/backend/tests/test_video_te_quant_default.pyindex 2c2e65b0699..8d5760efe48 100644--- a/studio/backend/tests/test_video_te_quant_default.py+++ b/studio/backend/tests/test_video_te_quant_default.py@@ -436,7 +436,6 @@ def test_the_builder_quantizes_a_non_gated_t5_feed_forward():assert not pattern.match("encoder.block.3.layer.1.DenseReluDense.wix.weight")-def test_the_transformers_builder_honours_keep_dense(tmp_path):import importlib.utilfrom pathlib import Path@@ -450,17 +449,39 @@ def test_the_transformers_builder_honours_keep_dense(tmp_path):builder = importlib.util.module_from_spec(spec)spec.loader.exec_module(builder)config = transformers.T5Config(- vocab_size = 32, d_model = 64, d_kv = 16, d_ff = 128, num_layers = 1, num_heads = 4,+ vocab_size = 32,+ d_model = 64,+ d_kv = 16,+ d_ff = 128,+ num_layers = 1,+ num_heads = 4,feed_forward_proj = "gated-gelu",)src = tmp_path / "te"transformers.T5EncoderModel(config).save_pretrained(src)out = tmp_path / "te-int8.safetensors"- builder.main([- "--base", "someone/t5", "--family", "flux.1", "--src", str(src), "--out", str(out),- "--load", "transformers", "--te-class", "T5EncoderModel", "--keep-dense", "wo",- "--group", "64", "--device", "cpu",- ])+ builder.main(+ [+ "--base",+ "someone/t5",+ "--family",+ "flux.1",+ "--src",+ str(src),+ "--out",+ str(out),+ "--load",+ "transformers",+ "--te-class",+ "T5EncoderModel",+ "--keep-dense",+ "wo",+ "--group",+ "64",+ "--device",+ "cpu",+ ]+ )with safe_open(str(out), framework = "pt") as handle:keys = set(handle.keys())wo = handle.get_tensor("encoder.block.0.layer.1.DenseReluDense.wo.weight")@@ -469,6 +490,7 @@ def test_the_transformers_builder_honours_keep_dense(tmp_path):# T5 keeps ``wo`` in float32, and a dense one is stored that way.assert wo.dtype == torch.float32+def test_a_wan_load_claims_the_hosted_encoder_repo_while_it_fetches():# The hosted file lives in a third repo; without the claim the delete-cached guard admits deleting it mid-load.import inspectdiff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsxindex c1f04381032..2bceaa3f2fd 100644--- a/studio/frontend/src/app/provider.tsx+++ b/studio/frontend/src/app/provider.tsx@@ -52,6 +52,7 @@ import { useDocumentFlag } from "@/lib/document-flag";import { refreshWindowChromeTop } from "@/lib/window-chrome";import {CHAT_SETTINGS_INSET_VAR,+ COMPOSER_CLEARANCE_VAR,cornerInsetScope,getToastOffsets,insetPastChatSettings,@@ -122,6 +123,7 @@ const STACK_SHADOW_GUTTER_LEFT = 28;const STACK_CARD_INSET_RIGHT = 16;// Rail stays flush with the corner; only its padding grows past the open Run settings panel.const STACK_CARD_INSET_RIGHT_PAST_PANEL = `calc(${STACK_CARD_INSET_RIGHT}px + var(${CHAT_SETTINGS_INSET_VAR}, 0px))`;+const STACK_SHADOW_GUTTER_BOTTOM_PAST_COMPOSER = `calc(${STACK_SHADOW_GUTTER_BOTTOM}px + var(${COMPOSER_CLEARANCE_VAR}, 0px))`;function BlockingScreenFlag() {useDocumentFlag("data-blocking-screen-open", true);@@ -554,7 +556,7 @@ function TauriUpdateLayer({// Gutters in px, never a spacing utility: those are rem, and the cards would drift off the corner.style={{paddingTop: STACK_SHADOW_GUTTER_TOP,- paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,+ paddingBottom: STACK_SHADOW_GUTTER_BOTTOM_PAST_COMPOSER,paddingLeft: STACK_SHADOW_GUTTER_LEFT,paddingRight: STACK_CARD_INSET_RIGHT_PAST_PANEL,zIndex: Z_LAYER.OVERLAY_STACK,@@ -932,7 +934,7 @@ function TauriWrapper({ children }: { children: ReactNode }) {// Gutters in px, never a spacing utility: those are rem, and the cards would drift off the corner.style={{paddingTop: STACK_SHADOW_GUTTER_TOP,- paddingBottom: STACK_SHADOW_GUTTER_BOTTOM,+ paddingBottom: STACK_SHADOW_GUTTER_BOTTOM_PAST_COMPOSER,paddingLeft: STACK_SHADOW_GUTTER_LEFT,paddingRight: STACK_CARD_INSET_RIGHT_PAST_PANEL,zIndex: Z_LAYER.OVERLAY_STACK,diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 3d531ee45fc..4783cb30465 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -465,6 +465,7 @@ import { extractTaggedText, updateThreadMessage } from "@/features/chat/utils/upimport { useComposerPillFit } from "@/hooks/use-composer-pill-fit";import { useIsMobile } from "@/hooks/use-mobile";import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";+import { watchComposerClearance } from "@/lib/toast-offset";// True while a file is dragged anywhere over the chat page, so the composer// can show its "Drop files here" affordance.@@ -2571,6 +2572,13 @@ const ThreadComposerDock: FC<{};}, [onHeightChange]);+ const composerColumnRef = useRef<HTMLDivElement | null>(null);+ const uiSpaceScale = useUiSpaceScale();+ useEffect(() => {+ const column = composerColumnRef.current;+ return column ? watchComposerClearance(column, uiSpaceScale) : undefined;+ }, [uiSpaceScale]);+const dockInnerRef = useRef<HTMLDivElement | null>(null);useLayoutEffect(() => {const dock = dockRef.current;@@ -2633,7 +2641,10 @@ const ThreadComposerDock: FC<{)}/><div ref={dockInnerRef} className="unsloth-composer-dock-inner relative pb-2">- <div className="pointer-events-auto mx-auto w-full max-w-(--thread-max-width)">+ <div+ ref={composerColumnRef}+ className="pointer-events-auto mx-auto w-full max-w-(--thread-max-width)"+ ><ComposerAnimateddisabled={disabled}threadId={threadId}diff --git a/studio/frontend/src/lib/toast-offset.ts b/studio/frontend/src/lib/toast-offset.tsindex c291004d5dd..81887144761 100644--- a/studio/frontend/src/lib/toast-offset.ts+++ b/studio/frontend/src/lib/toast-offset.ts@@ -117,6 +117,45 @@ export function cornerInsetScope(};}+export const COMPOSER_CLEARANCE_VAR = "--studio-composer-clearance";+// The collapsed download button's column: 16px inset, 44px button, 16px of air.+const CORNER_RAIL_COLUMN = 76;+const composerClearances = new Map<object, number>();++function applyComposerClearance(): void {+ const lift = Math.max(0, ...composerClearances.values());+ cornerInsets.style.setProperty(COMPOSER_CLEARANCE_VAR, lift > 0 ? `${lift}px` : "");+}++/** Lifts the corner rail above `composer` while it reaches into the rail's column (#14146); compare panes each register. */+export function watchComposerClearance(+ composer: HTMLElement,+ uiSpaceScale = 1,+): () => void {+ const key = {};+ const apply = () => {+ const rect = composer.getBoundingClientRect();+ const intrudes =+ rect.height > 0 &&+ window.innerWidth - rect.right < CORNER_RAIL_COLUMN * uiSpaceScale;+ // The rail already keeps a 16px gutter; this leaves 8px between it and the composer.+ const lift = intrudes ? Math.round(window.innerHeight - rect.top - 8) : 0;+ if (lift > 0) composerClearances.set(key, lift);+ else composerClearances.delete(key);+ applyComposerClearance();+ };+ apply();+ const observer = new ResizeObserver(apply);+ observer.observe(composer);+ window.addEventListener("resize", apply);+ return () => {+ observer.disconnect();+ window.removeEventListener("resize", apply);+ composerClearances.delete(key);+ applyComposerClearance();+ };+}+type InsetPanel = {offsetWidth: number;parentElement: { clientWidth: number } | null;diff --git a/tests/studio/test_update_release_notes.py b/tests/studio/test_update_release_notes.pyindex abad0644f0b..2a85024cbd7 100644--- a/tests/studio/test_update_release_notes.py+++ b/tests/studio/test_update_release_notes.py@@ -1731,7 +1731,7 @@ def test_the_rail_gutters_come_out_of_the_cap_and_not_the_cards():assert top >= 14, f"the top gutter {top}px is inside the card shadow's 14px reach"expected = {"paddingTop": "STACK_SHADOW_GUTTER_TOP",- "paddingBottom": "STACK_SHADOW_GUTTER_BOTTOM",+ "paddingBottom": "STACK_SHADOW_GUTTER_BOTTOM_PAST_COMPOSER","paddingLeft": "STACK_SHADOW_GUTTER_LEFT","paddingRight": "STACK_CARD_INSET_RIGHT_PAST_PANEL",}@@ -1739,6 +1739,10 @@ def test_the_rail_gutters_come_out_of_the_cap_and_not_the_cards():r"const STACK_CARD_INSET_RIGHT_PAST_PANEL =\s*`calc\(\$\{STACK_CARD_INSET_RIGHT\}px \+ var\(",provider,), "the rail's right padding is no longer the px card inset plus the panel width"+ assert re.search(+ r"const STACK_SHADOW_GUTTER_BOTTOM_PAST_COMPOSER =\s*`calc\(\$\{STACK_SHADOW_GUTTER_BOTTOM\}px \+ var\(",+ provider,+ ), "the rail's bottom padding is no longer the px gutter plus the composer clearance"openings = _rail_openings(provider)assert len(openings) == 2, f"expected the browser and desktop rails, found {len(openings)}"for tag in openings: