Skip to content

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.

Studio: load the chat runtime on use instead of in the startup bundle (#16999)

Daniel Han609ebee46d07
diff --git a/studio/frontend/src/app/provider.tsx b/studio/frontend/src/app/provider.tsx
index df6c6c8fc7b..f5ebd0879d0 100644
--- a/studio/frontend/src/app/provider.tsx
+++ b/studio/frontend/src/app/provider.tsx
@@ -25,7 +25,7 @@ import {
} from "@/config/env";
import { routeNeedsHardware } from "@/config/hardware-verdict";
import { getTauriAuthFailure, tauriAutoAuth } from "@/features/auth";
-import { resyncInferenceStatusAfterServerModelChange } from "@/features/chat/hooks/use-chat-model-runtime";
+import { resyncInferenceStatusAfterServerModelChange } from "@/features/chat/hooks/resync-inference-status-lazy";
import { DeepLinkHandler } from "@/features/deep-links";
import { receiveSharedRunConfigUrls } from "@/features/model-picker/sharing/receive-link";
import {
diff --git a/studio/frontend/src/components/llama-update-banner.tsx b/studio/frontend/src/components/llama-update-banner.tsx
index d1428a3336b..7ce64177d68 100644
--- a/studio/frontend/src/components/llama-update-banner.tsx
+++ b/studio/frontend/src/components/llama-update-banner.tsx
@@ -3,7 +3,7 @@
import { Button } from "@/components/ui/button";
import { LlamaUpdateChangelogPanel } from "@/components/update/llama-update-changelog-panel";
-import { resyncInferenceStatusAfterServerModelChange } from "@/features/chat/hooks/use-chat-model-runtime";
+import { resyncInferenceStatusAfterServerModelChange } from "@/features/chat/hooks/resync-inference-status-lazy";
import { LLAMA_BACKEND_LABELS } from "@/features/settings/lib/llama-backend-labels";
import {
llamaUpdateOffered,
diff --git a/studio/frontend/src/features/chat/hooks/resync-inference-status-lazy.ts b/studio/frontend/src/features/chat/hooks/resync-inference-status-lazy.ts
new file mode 100644
index 00000000000..640ace3d4ea
--- /dev/null
+++ b/studio/frontend/src/features/chat/hooks/resync-inference-status-lazy.ts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// For callers outside the chat page: a static import pulls the chat runtime into the startup bundle.
+export const resyncInferenceStatusAfterServerModelChange = (): Promise<void> =>
+ import("./use-chat-model-runtime").then((runtime) =>
+ runtime.resyncInferenceStatusAfterServerModelChange(),
+ );
diff --git a/studio/frontend/tests/startup-lazy-heavy-deps.test.ts b/studio/frontend/tests/startup-lazy-heavy-deps.test.ts
index 4cd6c75a9f1..cb09d481e1e 100644
--- a/studio/frontend/tests/startup-lazy-heavy-deps.test.ts
+++ b/studio/frontend/tests/startup-lazy-heavy-deps.test.ts
@@ -40,3 +40,7 @@ test("mermaid is only imported dynamically", () => {
test("the training barrel does not re-export the YAML helpers", () => {
assert.doesNotMatch(readSrc("features/training/index.ts"), /from\s+["']\.\/lib\/yaml-config["']/);
});
+
+test("the chat model runtime is only imported dynamically outside the chat feature", () => {
+ assert.deepEqual(staticValueImporters("@/features/chat/hooks/use-chat-model-runtime"), []);
+});