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: move Managed accounts to the Accounts tab and drop Mark as unread from chat menus (#12120)
Michael Hanb9716be4c77c
diff --git a/studio/backend/core/inference/providers.py b/studio/backend/core/inference/providers.pyindex 8c415a179ea..e03a94e205f 100644--- a/studio/backend/core/inference/providers.py+++ b/studio/backend/core/inference/providers.py@@ -637,7 +637,7 @@ _BLOCK_PRIVATE_ENV = "UNSLOTH_STUDIO_BLOCK_PRIVATE_PROVIDER_URLS"# Named in one place: a managed account meets this refusal from save, send and recipe alike.MANAGED_PRIVATE_URL_HINT = (- " The installation owner can allow private and LAN addresses in Settings > General."+ " The installation owner can allow private and LAN addresses in Settings > Accounts.")MANAGED_PUBLIC_ONLY_TEXT = "Managed accounts may only use public-network provider base URLs."diff --git a/studio/backend/tests/test_managed_provider_url_policy.py b/studio/backend/tests/test_managed_provider_url_policy.pyindex 01665731a52..21e8448263d 100644--- a/studio/backend/tests/test_managed_provider_url_policy.py+++ b/studio/backend/tests/test_managed_provider_url_policy.py@@ -69,7 +69,7 @@ def test_a_managed_account_is_refused_by_default(monkeypatch, as_alice, url):providers.validate_provider_base_url(url)assert "public-network provider base URLs" in str(refusal.value)# The person reading this cannot lift it themselves, so it says who can.- assert "Settings > General" in str(refusal.value)+ assert "Settings > Accounts" in str(refusal.value)@pytest.mark.parametrize("url", PRIVATE_URLS)@@ -161,7 +161,7 @@ def test_the_recipe_endpoint_check_stands_down_with_the_setting_on(monkeypatch,_allow(monkeypatch, False)with pytest.raises(Exception) as refusal:service._require_public_provider_endpoint("http://192.168.1.50:8000/v1")- assert "Settings > General" in str(getattr(refusal.value, "detail", refusal.value))+ assert "Settings > Accounts" in str(getattr(refusal.value, "detail", refusal.value))_allow(monkeypatch, True)service._require_public_provider_endpoint("http://192.168.1.50:8000/v1")@@ -244,13 +244,13 @@ def test_the_refusal_stops_naming_the_switch_when_the_environment_holds_it(monkeypatch.setenv(setting.BLOCK_PRIVATE_ENV, "1")with pytest.raises(ValueError) as refusal:providers.validate_provider_base_url(url)- assert "Settings > General" not in str(refusal.value)+ assert "Settings > Accounts" not in str(refusal.value)monkeypatch.delenv(setting.BLOCK_PRIVATE_ENV)_allow(monkeypatch, False)with pytest.raises(ValueError) as refusal:providers.validate_provider_base_url(url)- assert "Settings > General" in str(refusal.value)+ assert "Settings > Accounts" in str(refusal.value)@pytest.mark.parametrize("url", ["ftp://192.168.1.50/model", "file:///etc/passwd"])diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex bb473219a94..cc1d8237e89 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -4376,9 +4376,6 @@ export function AppSidebar() {item.type === "compare"? (item.threadIds ?? []).some((id) => Boolean(runningByThreadId[id])): Boolean(runningByThreadId[item.id]);- const alreadyUnread = threadIds.some((threadId) =>- unreadThreadIds.has(threadId),- );return (<><P.Item@@ -4391,21 +4388,6 @@ export function AppSidebar() {<HugeiconsIcon icon={isPinned ? PinOffIcon : PinIcon} strokeWidth={1.75} className="size-icon" /><span>{isPinned ? "Unpin" : "Pin"}</span></P.Item>- {/* The dot a finished reply leaves, put back or taken off by hand. */}- <P.Item- onSelect={() =>- alreadyUnread- ? clearThreadsUnread(threadIds)- : markThreadsUnread(threadIds, rowIdByThreadId)- }- >- <HugeiconsIcon icon={alreadyUnread ? ViewIcon : ViewOffSlashIcon} strokeWidth={1.75} className="size-icon" />- <span>- {alreadyUnread- ? t("shell.selection.markRead")- : t("shell.selection.markUnread")}- </span>- </P.Item><P.Itemdisabled={!canForkChatRow(item) || isGenerating || forkInFlight}title="Copy this chat into a new one, from its last message"diff --git a/studio/frontend/src/features/chat/projects-page.tsx b/studio/frontend/src/features/chat/projects-page.tsxindex b3d00e57dd7..0f79bd9ccc6 100644--- a/studio/frontend/src/features/chat/projects-page.tsx+++ b/studio/frontend/src/features/chat/projects-page.tsx@@ -47,7 +47,6 @@ import {notifyChatHistoryUpdated,renameChatItem,sandboxSessionIdsHolding,- useChatNavigationStore,useChatPreferencesStore,useChatProjects,useChatRuntimeStore,@@ -75,8 +74,6 @@ import {PinOffIcon,Search01Icon,Upload01Icon,- ViewIcon,- ViewOffSlashIcon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import { ArrowDownIcon, ChevronDownIcon, MoreHorizontalIcon } from "lucide-react";@@ -159,9 +156,6 @@ export function ProjectsPage() {() => new Set(pinnedProjectIds),[pinnedProjectIds],);- const unreadThreadIds = useChatNavigationStore((s) => s.unreadThreadIds);- const markThreadsUnread = useChatNavigationStore((s) => s.markThreadsUnread);- const clearThreadsUnread = useChatNavigationStore((s) => s.clearThreadsUnread);const confirmDeleteChats = useChatPreferencesStore((s) => s.confirmDeleteChats);const alwaysDeleteChatFiles = useChatPreferencesStore((s) => s.alwaysDeleteChatFiles,@@ -1007,9 +1001,6 @@ export function ProjectsPage() {{chats.map((chat) => {const chatPinned = pinnedChatIdSet.has(chat.id);const chatThreadIds = getSidebarItemThreadIds(chat);- const chatUnread = chatThreadIds.some((id) =>- unreadThreadIds.has(id),- );// Every chat here sits in a project, so the folder is the project's.const chatSandboxId = sandboxSessionIdFor(chatThreadIds[0] ?? chat.id,@@ -1088,22 +1079,6 @@ export function ProjectsPage() {<HugeiconsIcon icon={Edit03Icon} strokeWidth={1.75} className="size-icon" /><span>Rename</span></DropdownMenuItem>- {/* The dot a finished reply leaves, put back or taken off by hand. */}- <DropdownMenuItem- onSelect={() =>- chatUnread- ? clearThreadsUnread(chatThreadIds)- : markThreadsUnread(- chatThreadIds,- Object.fromEntries(- chatThreadIds.map((id) => [id, chat.id]),- ),- )- }- >- <HugeiconsIcon icon={chatUnread ? ViewIcon : ViewOffSlashIcon} strokeWidth={1.75} className="size-icon" />- <span>{chatUnread ? "Mark as read" : "Mark as unread"}</span>- </DropdownMenuItem>{chatSandboxId ? (isTauri ? (<DropdownMenuItemdiff --git a/studio/frontend/src/features/settings/components/managed-provider-urls-section.tsx b/studio/frontend/src/features/settings/components/managed-provider-urls-section.tsxnew file mode 100644index 00000000000..c3fa046f1fe--- /dev/null+++ b/studio/frontend/src/features/settings/components/managed-provider-urls-section.tsx@@ -0,0 +1,100 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { Switch } from "@/components/ui/switch";+import { useT } from "@/i18n";+import { useEffect, useState } from "react";+import {+ type ManagedProviderUrlSettings,+ loadManagedProviderUrls,+ updateManagedProviderUrls,+} from "../api/managed-provider-urls";+import { isSettingsRouteAbsent } from "../api/settings-route-absent";+import { SettingsRow } from "./settings-row";+import { SettingsSection } from "./settings-section";++// Owner only: rendered from the Accounts tab.+export function ManagedProviderUrlsSection() {+ const t = useT();+ const [settings, setSettings] = useState<ManagedProviderUrlSettings | null>(+ null,+ );+ const [error, setError] = useState<string | null>(null);+ const [saving, setSaving] = useState(false);+ // A backend that does not serve the route has no such setting to show.+ const [absent, setAbsent] = useState(false);++ useEffect(() => {+ let cancelled = false;+ void loadManagedProviderUrls()+ .then((loaded) => {+ if (cancelled) return;+ setSettings(loaded);+ setError(null);+ })+ .catch((loadError) => {+ if (cancelled) return;+ if (isSettingsRouteAbsent(loadError)) {+ setAbsent(true);+ return;+ }+ setError(+ loadError instanceof Error+ ? loadError.message+ : t("settings.general.managedProviderUrls.loadError"),+ );+ });+ return () => {+ cancelled = true;+ };+ }, [t]);++ const save = async (allowed: boolean) => {+ setSaving(true);+ setError(null);+ try {+ setSettings(await updateManagedProviderUrls(allowed));+ } catch (saveError) {+ setError(+ saveError instanceof Error+ ? saveError.message+ : t("settings.general.managedProviderUrls.saveError"),+ );+ } finally {+ setSaving(false);+ }+ };++ if (absent) return null;++ return (+ <SettingsSection+ title={t("settings.general.managedProviderUrls.sectionTitle")}+ >+ <SettingsRow+ label={t("settings.general.managedProviderUrls.enableLabel")}+ description={t(+ "settings.general.managedProviderUrls.enableDescription",+ )}+ >+ <div className="flex flex-col items-end gap-1">+ <Switch+ checked={settings?.allowed ?? false}+ disabled={!settings || saving || settings.lockedByEnvironment}+ onCheckedChange={(allowed) => void save(allowed)}+ />+ {settings?.lockedByEnvironment ? (+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">+ {t("settings.general.managedProviderUrls.lockedByEnvironment")}+ </span>+ ) : null}+ {error ? (+ <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">+ {error}+ </span>+ ) : null}+ </div>+ </SettingsRow>+ </SettingsSection>+ );+}diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.tsindex 3b144a98118..656144872a2 100644--- a/studio/frontend/src/features/settings/settings-search.ts+++ b/studio/frontend/src/features/settings/settings-search.ts@@ -11,7 +11,12 @@ import type { SettingsTab } from "./stores/settings-dialog-store";* (profile, connections) are still reachable from search.*/export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {- accounts: ["settings.accounts.title", "settings.accounts.create"],+ accounts: [+ "settings.accounts.title",+ "settings.accounts.create",+ "settings.general.managedProviderUrls.sectionTitle",+ "settings.general.managedProviderUrls.enableLabel",+ ],general: ["settings.general.account","settings.general.password",@@ -24,8 +29,6 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {"settings.general.previewSharing.sectionTitle","settings.general.previewSharing.enableLabel","settings.general.previewSharing.revokeLabel",- "settings.general.managedProviderUrls.sectionTitle",- "settings.general.managedProviderUrls.enableLabel","settings.general.rag.sectionTitle","settings.general.rag.embeddingModel","settings.general.helperLlm.sectionTitle",diff --git a/studio/frontend/src/features/settings/tabs/accounts-tab.tsx b/studio/frontend/src/features/settings/tabs/accounts-tab.tsxindex 5d97bbbe782..41997e084c1 100644--- a/studio/frontend/src/features/settings/tabs/accounts-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/accounts-tab.tsx@@ -57,6 +57,7 @@ import {type AccountSetupCode,type StudioAccount,} from "../api/accounts";+import { ManagedProviderUrlsSection } from "../components/managed-provider-urls-section";export function AccountsTab() {const owner = useIsAccountOwner();@@ -445,6 +446,8 @@ function OwnerAccountsTab() {)}</section>+ <ManagedProviderUrlsSection />+<Dialogopen={editorOpen}onOpenChange={(open) => {diff --git a/studio/frontend/src/features/settings/tabs/general-tab.tsx b/studio/frontend/src/features/settings/tabs/general-tab.tsxindex c5c98c9930f..e26ea4979c3 100644--- a/studio/frontend/src/features/settings/tabs/general-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/general-tab.tsx@@ -46,12 +46,6 @@ import {loadHelperPrecacheSettings,updateHelperPrecacheSettings,} from "../api/helper-precache";-import {- type ManagedProviderUrlSettings,- loadManagedProviderUrls,- updateManagedProviderUrls,-} from "../api/managed-provider-urls";-import { isSettingsRouteAbsent } from "../api/settings-route-absent";import {type PreviewSharingSettings,loadPreviewSharing,@@ -229,16 +223,6 @@ export function GeneralTab() {null,);const [isSavingPreviewSharing, setIsSavingPreviewSharing] = useState(false);- const [managedProviderUrls, setManagedProviderUrls] =- useState<ManagedProviderUrlSettings | null>(null);- const [managedProviderUrlsError, setManagedProviderUrlsError] = useState<- string | null- >(null);- const [isSavingManagedProviderUrls, setIsSavingManagedProviderUrls] =- useState(false);- // A backend that does not serve the route has no such setting to show.- const [managedProviderUrlsAbsent, setManagedProviderUrlsAbsent] =- useState(false);const [revokePreviewOpen, setRevokePreviewOpen] = useState(false);const [isRevokingPreview, setIsRevokingPreview] = useState(false);const launchAtLoginSetting = useDesktopBooleanSetting({@@ -358,32 +342,6 @@ export function GeneralTab() {};}, [t, isOwner]);- useEffect(() => {- if (!isOwner) return;- let cancelled = false;- void loadManagedProviderUrls()- .then((settings) => {- if (cancelled) return;- setManagedProviderUrls(settings);- setManagedProviderUrlsError(null);- })- .catch((error) => {- if (cancelled) return;- if (isSettingsRouteAbsent(error)) {- setManagedProviderUrlsAbsent(true);- return;- }- setManagedProviderUrlsError(- error instanceof Error- ? error.message- : t("settings.general.managedProviderUrls.loadError"),- );- });- return () => {- cancelled = true;- };- }, [t, isOwner]);-const saveHelperPrecache = async (enabled: boolean) => {setIsSavingHelperPrecache(true);setHelperPrecacheError(null);@@ -420,23 +378,6 @@ export function GeneralTab() {}};- const saveManagedProviderUrls = async (allowed: boolean) => {- setIsSavingManagedProviderUrls(true);- setManagedProviderUrlsError(null);- try {- const settings = await updateManagedProviderUrls(allowed);- setManagedProviderUrls(settings);- } catch (error) {- setManagedProviderUrlsError(- error instanceof Error- ? error.message- : t("settings.general.managedProviderUrls.saveError"),- );- } finally {- setIsSavingManagedProviderUrls(false);- }- };-const revokePreviewLinks = async () => {setIsRevokingPreview(true);try {@@ -732,43 +673,6 @@ export function GeneralTab() {</SettingsRow></SettingsSection>- {managedProviderUrlsAbsent ? null : (- <SettingsSection- title={t("settings.general.managedProviderUrls.sectionTitle")}- >- <SettingsRow- label={t("settings.general.managedProviderUrls.enableLabel")}- description={t(- "settings.general.managedProviderUrls.enableDescription",- )}- >- <div className="flex flex-col items-end gap-1">- <Switch- checked={managedProviderUrls?.allowed ?? false}- disabled={- !managedProviderUrls ||- isSavingManagedProviderUrls ||- managedProviderUrls.lockedByEnvironment- }- onCheckedChange={(allowed) =>- void saveManagedProviderUrls(allowed)- }- />- {managedProviderUrls?.lockedByEnvironment ? (- <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-muted-foreground">- {t("settings.general.managedProviderUrls.lockedByEnvironment")}- </span>- ) : null}- {managedProviderUrlsError ? (- <span className="max-w-[calc(260px*var(--ui-space-scale,1))] text-right text-xs text-destructive">- {managedProviderUrlsError}- </span>- ) : null}- </div>- </SettingsRow>- </SettingsSection>- )}-<DocumentsRagSection /><HubSettingsSection />diff --git a/studio/frontend/tests/account-settings-ui.test.ts b/studio/frontend/tests/account-settings-ui.test.tsindex 80058ab9db4..34c486665c2 100644--- a/studio/frontend/tests/account-settings-ui.test.ts+++ b/studio/frontend/tests/account-settings-ui.test.ts@@ -107,6 +107,9 @@ function tab(cn: (...values: unknown[]) => values.filter(Boolean).join(" "),},"@/components/ui/spinner": { Spinner: "Spinner" },+ "../components/managed-provider-urls-section": {+ ManagedProviderUrlsSection: "ManagedProviderUrlsSection",+ },"@/components/ui/dropdown-menu": Object.fromEntries(["DropdownMenu",@@ -325,6 +328,8 @@ test("Accounts is registered, searchable, and filtered from managed navigation aassert.deepEqual(SETTINGS_SEARCH_INDEX.accounts, ["settings.accounts.title","settings.accounts.create",+ "settings.general.managedProviderUrls.sectionTitle",+ "settings.general.managedProviderUrls.enableLabel",]);const dialog = readFileSync(new URL("../src/features/settings/settings-dialog.tsx", import.meta.url),diff --git a/studio/frontend/tests/projects-page-rows.test.ts b/studio/frontend/tests/projects-page-rows.test.tsindex 9f803c95e1c..4ea9127f74f 100644--- a/studio/frontend/tests/projects-page-rows.test.ts+++ b/studio/frontend/tests/projects-page-rows.test.ts@@ -278,7 +278,8 @@ test("the chat menu carries the sidebar's items, without the move", () => {]) {assert.ok(menu.includes(label), `${label} is missing from the chat menu`);}- assert.match(menu, /chatUnread \? "Mark as read" : "Mark as unread"/);+ assert.ok(!menu.includes("Mark as unread"));+ assert.ok(!menu.includes("Mark as read"));assert.match(menu, /<span>Open chat folder<\/span>/);// Desktop opens the folder; the browser says why it cannot.assert.match(menu, /isTauri \? \(/);diff --git a/studio/frontend/tests/sidebar-row-actions.test.ts b/studio/frontend/tests/sidebar-row-actions.test.tsindex 07a72d6f853..17e44245915 100644--- a/studio/frontend/tests/sidebar-row-actions.test.ts+++ b/studio/frontend/tests/sidebar-row-actions.test.ts@@ -110,41 +110,14 @@ test("double-clicking a chat title renames it in place", () => {);});-// Marking one chat unread was only reachable by selecting it first and using the bulk menu, and-// the dot could never be taken off again: the item was disabled on the rows that carried one.-test("a chat row marks itself read or unread from its own menu", () => {- assert.match(- APP_SIDEBAR,- /onSelect=\{\(\) =>\n\s*alreadyUnread\n\s*\? clearThreadsUnread\(threadIds\)\n\s*: markThreadsUnread\(threadIds, rowIdByThreadId\)\n\s*\}/,- );- assert.ok(- !APP_SIDEBAR.includes("disabled={alreadyUnread}"),- "the item is still disabled on a row that carries the dot",- );- // The same strings the bulk menu uses, so the two cannot drift apart.- for (const key of ["markUnread", "markRead"]) {- assert.equal(- (APP_SIDEBAR.match(new RegExp(`t\\("shell\\.selection\\.${key}"\\)`, "g")) ?? [])- .length,- 2,- `the row and bulk menus no longer say the same thing for ${key}`,- );- }- // Both go by the dot the row already draws.- assert.match(- APP_SIDEBAR,- /const alreadyUnread = threadIds\.some\(\(threadId\) =>\n\s*unreadThreadIds\.has\(threadId\),\n\s*\);/,- );- // An eye that is open once the row is read, crossed out while it is not.- assert.equal(- (- APP_SIDEBAR.match(- /icon=\{(alreadyUnread|allSelectedUnread) \? ViewIcon : ViewOffSlashIcon\}/g,- ) ?? []- ).length,- 2,- "a read or unread item stopped naming the state it moves to",- );+// A single chat's menu carries no read or unread item; the bulk menu keeps it.+test("a chat row menu does not offer mark as read or unread", () => {+ const start = APP_SIDEBAR.indexOf("function renderChatRowMenuItems(");+ assert.notEqual(start, -1);+ const rowMenu = APP_SIDEBAR.slice(start, APP_SIDEBAR.indexOf("\n }\n", start));+ assert.ok(!rowMenu.includes("markThreadsUnread"));+ assert.ok(!rowMenu.includes("shell.selection.markUnread"));+ assert.ok(!rowMenu.includes("shell.selection.markRead"));});// The bulk menu only ever added dots, so a selection of read rows had no way back.@@ -239,10 +212,10 @@ test("a chat row forks from its own menu", async () => {const ROW_MENU = await readSrcAsync("features/chat/components/chat-row-menu.ts",);- // Below Mark as unread, and before the rule that sets off the rest.+ // Below Pin, and before the rule that sets off the rest.assert.match(APP_SIDEBAR,- /t\("shell\.selection\.markUnread"\)\}\n\s*<\/span>\n\s*<\/P\.Item>\n\s*<P\.Item\n\s*disabled=\{!canForkChatRow\(item\)/,+ /<span>\{isPinned \? "Unpin" : "Pin"\}<\/span>\n\s*<\/P\.Item>\n\s*<P\.Item\n\s*disabled=\{!canForkChatRow\(item\)/,);assert.match(APP_SIDEBAR, /<span>Fork<\/span>\n\s*<\/P\.Item>\n\s*\{\/\*[^]*?\*\/\}\n\s*<P\.Separator \/>/);// A comparison has two threads and no single tip to fork from.