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
studiobench: seed the browser with update notifications off (#15805)
Daniel Han56278f5f658f
diff --git a/tests/studio/studiobench/runtime/lifecycle.py b/tests/studio/studiobench/runtime/lifecycle.pyindex 6ec8601ba01..e626ac9958c 100644--- a/tests/studio/studiobench/runtime/lifecycle.py+++ b/tests/studio/studiobench/runtime/lifecycle.py@@ -524,6 +524,15 @@ def authenticate(return auth+# Update offers (llama.cpp, whisper.cpp, audio.cpp, Unsloth) arrive on the network's schedule and float over+# the composer from the overlay rail, so a run that happens to get one clicks into it and times out. Mirrors+# studio/frontend/src/hooks/use-notification-frequency.ts; a selftest keeps the two in step.+QUIET_NOTIFICATION_CHANNELS = ("llama", "whisper", "audio", "unsloth")+QUIET_NOTIFICATIONS = {+ f"unsloth_{channel}_notification_frequency": "off" for channel in QUIET_NOTIFICATION_CHANNELS+}++def seed_init_script(auth: StudioAuth,providers: list[ProviderSeed],@@ -540,6 +549,7 @@ def seed_init_script({p.id: p.api_key for p in providers if p.api_key}),"unsloth_chat_connections_enabled": "true",+ **QUIET_NOTIFICATIONS,}for k, v in (extra_local_storage or {}).items():payload[k] = v if isinstance(v, str) else json.dumps(v)diff --git a/tests/studio/studiobench/runtime/selftest/test_studiobench_quiet_notifications.py b/tests/studio/studiobench/runtime/selftest/test_studiobench_quiet_notifications.pynew file mode 100644index 00000000000..21215a3ce5a--- /dev/null+++ b/tests/studio/studiobench/runtime/selftest/test_studiobench_quiet_notifications.py@@ -0,0 +1,65 @@+"""The seeded browser keeps update offers off, under the keys the frontend actually reads.++An update card in the overlay rail covers the composer; a parity cell that got one timed out clicking+through it. The mute only works while these keys match use-notification-frequency.ts.+"""++from __future__ import annotations++import json+import re+import sys+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[3]))++from studiobench.runtime.lifecycle import ( # noqa: E402+ QUIET_NOTIFICATION_CHANNELS,+ QUIET_NOTIFICATIONS,+ StudioAuth,+ seed_init_script,+)++_HOOK = (+ Path(__file__).resolve().parents[5]+ / "studio"+ / "frontend"+ / "src"+ / "hooks"+ / "use-notification-frequency.ts"+)+++def _hook() -> str:+ return _HOOK.read_text(encoding = "utf-8")+++def _const_list(name: str) -> list[str]:+ body = re.search(rf"export const {name} = \[(.*?)\] as const;", _hook(), re.S)+ assert body, f"{name} is no longer a literal list in {_HOOK.name}"+ return re.findall(r'"([^"]+)"', body.group(1))+++def test_every_frontend_channel_is_muted():+ assert sorted(QUIET_NOTIFICATION_CHANNELS) == sorted(_const_list("NOTIFICATION_CHANNELS"))+++def test_the_keys_and_value_are_the_ones_the_frontend_reads():+ assert re.search(+ r"const frequencyKey = \(channel: NotificationChannel\) =>\s*`unsloth_\$\{channel\}_notification_frequency`;",+ _hook(),+ )+ assert "off" in _const_list("NOTIFICATION_FREQUENCIES")+ assert set(QUIET_NOTIFICATIONS.values()) == {"off"}+++def test_the_seed_script_writes_them():+ script = seed_init_script(+ StudioAuth(+ access_token = "a", refresh_token = "r", base_url = "http://x", username = "u", password = "p"+ ),+ [],+ )+ seed = json.loads(script.split("const seed = ", 1)[1].split("; for (const k", 1)[0])+ for key, value in QUIET_NOTIFICATIONS.items():+ assert seed[key] == value