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: Help menu items and a Go menu for desktop Help search (#12002)
Michael Han350ed9af8fae
diff --git a/studio/frontend/src/app/app-menu-chords.ts b/studio/frontend/src/app/app-menu-chords.tsindex 82b6934fbfb..5e1fb66565b 100644--- a/studio/frontend/src/app/app-menu-chords.ts+++ b/studio/frontend/src/app/app-menu-chords.ts@@ -11,9 +11,16 @@ import {resolveBinding,shortcutOwningBinding,} from "@/features/settings/stores/keyboard-shortcuts-store";+import type { HelpAction } from "@/components/help-actions";+import type { SettingsTab } from "@/features/settings";-/** Actions the desktop File and View menus send (src-tauri/src/app_menu.rs). */+/** Go > Settings opens each page of the Settings dialog. */+export type SettingsMenuAction = `settings-${SettingsTab}`;++/** Actions the desktop File, View, Go and Help menus send (src-tauri/src/app_menu.rs). */export type AppMenuAction =+ | HelpAction+ | SettingsMenuAction| "new-chat"| "new-temporary-chat"| "open-folder"@@ -25,11 +32,24 @@ export type AppMenuAction =| "forward"| "zoom-in"| "zoom-out"- | "actual-size";+ | "actual-size"+ | "go-chat"+ | "go-projects"+ | "go-library"+ | "go-hub"+ | "go-train"+ | "go-recipes"+ | "go-images"+ | "go-video"+ | "go-audio"+ | "go-export";/** The chord each item shows (as in src-tauri/src/app_menu.rs). An item for a web shortcut follows- * that shortcut's binding; the others keep theirs unless a web shortcut has taken it. */-export const MENU_CHORDS: Record<AppMenuAction, { shortcut?: ShortcutId; chord: string }> = {+ * that shortcut's binding; the others keep theirs unless a web shortcut has taken it. An item+ * left out, as the Settings pages are, has none. */+export const MENU_CHORDS: Partial<+ Record<AppMenuAction, { shortcut?: ShortcutId; chord?: string }>+> = {"new-chat": { shortcut: "newChat", chord: "Mod+KeyN" },"new-temporary-chat": { shortcut: "newTemporaryChat", chord: "Mod+Shift+KeyN" },"open-folder": { chord: "Mod+KeyO" },@@ -42,6 +62,22 @@ export const MENU_CHORDS: Record<AppMenuAction, { shortcut?: ShortcutId; chord:"zoom-in": { chord: "Mod+Equal" },"zoom-out": { chord: "Mod+Minus" },"actual-size": { chord: "Mod+Digit0" },+ "go-chat": { shortcut: "switchToChat", chord: "Ctrl+Digit1" },+ "go-projects": { shortcut: "switchToProjects", chord: "Ctrl+Digit2" },+ "go-library": {},+ "go-hub": { shortcut: "switchToHub", chord: "Ctrl+Digit3" },+ "go-train": { shortcut: "switchToTrain", chord: "Ctrl+Digit4" },+ "go-recipes": { shortcut: "switchToRecipes", chord: "Ctrl+Digit5" },+ "go-images": { shortcut: "switchToImages", chord: "Ctrl+Digit6" },+ "go-video": { shortcut: "switchToVideo", chord: "Ctrl+Digit7" },+ "go-audio": { shortcut: "switchToAudio", chord: "Ctrl+Digit8" },+ "go-export": { shortcut: "switchToExport", chord: "Ctrl+Digit9" },+ "help-documentation": {},+ "help-keyboard-shortcuts": { shortcut: "openKeyboardShortcuts", chord: "Mod+Slash" },+ "help-whats-new": {},+ "help-troubleshooting": {},+ "help-system-status": {},+ "help-send-feedback": {},};/** Chords the native macOS menu keeps (Quit, Close, Minimize, Hide, Hide Others, Edit, Enter@@ -81,19 +117,22 @@ function toAccelerator(value: string | null): string | null {/** What each menu item should show for these shortcut overrides. */export function menuAccelerators(overrides: Parameters<typeof resolveBinding>[0],-): Record<AppMenuAction, string | null> {- const out = {} as Record<AppMenuAction, string | null>;- for (const action of Object.keys(MENU_CHORDS) as AppMenuAction[]) {- const { shortcut, chord } = MENU_CHORDS[action];+): Partial<Record<AppMenuAction, string | null>> {+ const out: Partial<Record<AppMenuAction, string | null>> = {};+ for (const [action, { shortcut, chord }] of Object.entries(MENU_CHORDS) as [+ AppMenuAction,+ { shortcut?: ShortcutId; chord?: string },+ ][]) {if (!shortcut) {- out[action] = shortcutOwningBinding(overrides, chord) ? null : toAccelerator(chord);+ out[action] =+ !chord || shortcutOwningBinding(overrides, chord) ? null : toAccelerator(chord);continue;}const owned = SHORTCUT_SLOTS.map((slot) => resolveBinding(overrides, shortcut, slot)).filter((value): value is string =>Boolean(value) && shortcutOwningBinding(overrides, value) === shortcut,);- const shown = owned.includes(chord) ? chord : owned.find((value) => toAccelerator(value));+ const shown = chord && owned.includes(chord) ? chord : owned.find((value) => toAccelerator(value));out[action] = toAccelerator(shown ?? null);}return out;diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsxindex 79c746692b5..b938364f02b 100644--- a/studio/frontend/src/app/routes/__root.tsx+++ b/studio/frontend/src/app/routes/__root.tsx@@ -13,6 +13,7 @@ import {AUTH_SESSION_CLEARED_EVENT,AUTH_SESSION_STORED_EVENT,hasAuthToken,+ useIsAccountOwner,} from "@/features/auth";import {ChatPage,@@ -32,7 +33,9 @@ import { backfillModelOverrides } from "@/features/model-picker/api/migrate-modeimport { usePersonalizationSync } from "@/features/profile";import { RemoteCodeConsentDialog } from "@/features/security";import {+ SETTINGS_TABS,SettingsDialogMount,+ settingsTabVisible,stepInterfaceScale,triggerShortcut,useInterfaceScaleStore,@@ -72,6 +75,8 @@ import {} from "react";import { AppProvider } from "../provider";import { useDesktopShellReady } from "../desktop-shell-ready";+import { type HelpAction, helpActionAvailable, runHelpAction } from "@/components/help-actions";+import type { SettingsMenuAction } from "../app-menu-chords";import { useAppMenuActions } from "../use-app-menu-actions";declare module "@tanstack/react-router" {@@ -527,6 +532,23 @@ function RootLayout() {const scale = useInterfaceScaleStore.getState();scale.setScale(stepInterfaceScale(scale.scale, direction));};+ // Help opens settings or a web page, so it works anywhere past sign-in.+ // Pages this account cannot open stay disabled, as in Go > Settings.+ const isOwner = useIsAccountOwner();+ const helpAction = (action: HelpAction) =>+ isAuthFlowRoute || !helpActionAvailable(action, isOwner) ? null : () => runHelpAction(action);+ // Workspaces for the Go menu, gated like their chords below.+ const goTo = (to: string) => () => void navigate({ to });+ const goAction = (enabled: boolean, go: () => void) => (enabled ? go : null);+ // Go > Settings: the pages this account can open.+ const settingsActions = Object.fromEntries(+ SETTINGS_TABS.map((tab) => [+ `settings-${tab}`,+ !isAuthFlowRoute && settingsTabVisible(tab, isOwner)+ ? () => useSettingsDialogStore.getState().openDialog(tab)+ : null,+ ]),+ ) as Record<SettingsMenuAction, (() => void) | null>;useAppMenuActions({"new-chat": routeShortcutEnabled ? () => startNewChat() : null,"new-temporary-chat": routeShortcutEnabled@@ -552,10 +574,29 @@ function RootLayout() {"zoom-in": zoomBy(1),"zoom-out": zoomBy(-1),"actual-size": () => useInterfaceScaleStore.getState().reset(),+ "help-documentation": helpAction("help-documentation"),+ "help-keyboard-shortcuts": helpAction("help-keyboard-shortcuts"),+ "help-whats-new": helpAction("help-whats-new"),+ "help-troubleshooting": helpAction("help-troubleshooting"),+ "help-system-status": helpAction("help-system-status"),+ "help-send-feedback": helpAction("help-send-feedback"),+ "go-chat": goAction(+ routeShortcutEnabled,+ () => void navigate({ to: "/chat", search: chatSearch }),+ ),+ "go-projects": goAction(routeShortcutEnabled, goTo("/projects")),+ "go-library": goAction(routeShortcutEnabled, goTo("/library")),+ "go-hub": goAction(routeShortcutEnabled, goTo("/hub")),+ "go-train": goAction(routeShortcutEnabled && !chatOnlyMeasured, goTo("/studio")),+ "go-recipes": goAction(routeShortcutEnabled, goTo("/data-recipes")),+ "go-images": goAction(routeShortcutEnabled, goTo("/images")),+ "go-video": goAction(routeShortcutEnabled && !videoDisabled, goTo("/video")),+ "go-audio": goAction(routeShortcutEnabled, goTo("/audio")),+ "go-export": goAction(routeShortcutEnabled, goTo("/export")),+ ...settingsActions,}, desktopShellReady);// Workspaces. The shell is mounted on every route, so the chords live here.- const goTo = (to: string) => () => void navigate({ to });// Carry the frozen search back: a bare /chat is a fresh chat, so switching// away and back would drop the thread, compare pair or project.useShortcut(diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsxindex c0871ae8616..6507aaf4c51 100644--- a/studio/frontend/src/components/app-sidebar.tsx+++ b/studio/frontend/src/components/app-sidebar.tsx@@ -46,6 +46,12 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { NonModalDropdownMenu } from "@/components/ui/non-modal-dropdown-menu";+import {+ HELP_GROUPS,+ HELP_ITEMS,+ helpActionAvailable,+ runHelpAction,+} from "@/components/help-actions";import {Dialog,DialogContent,@@ -210,7 +216,12 @@ import { useEffectiveProfile, UserAvatar } from "@/features/profile";import { resolveNavRowState } from "@/components/nav-row-state";import { fetchDeviceType, usePlatformStore } from "@/config/env";import { videoNavHint } from "@/config/hardware-verdict";-import { AUTH_SESSION_ENDING_EVENT, clearAuthTokens, logout } from "@/features/auth";+import {+ AUTH_SESSION_ENDING_EVENT,+ clearAuthTokens,+ logout,+ useIsAccountOwner,+} from "@/features/auth";import { TOUR_OPEN_EVENT, getTourId, useTourAvailable } from "@/features/tour";import {deleteTrainingRun,@@ -811,6 +822,8 @@ export function AppSidebar() {// leave the hint advertising a dead chord. Both already render in the platform's own notation.const searchShortcutLabel = useShortcutLabel("searchChats");const settingsShortcutLabel = useShortcutLabel("openSettings");+ const keyboardShortcutsLabel = useShortcutLabel("openKeyboardShortcuts");+ const isOwner = useIsAccountOwner();const { pathname, search, href } = useRouterState({select: (s) => ({pathname: s.location.pathname,@@ -4989,12 +5002,45 @@ export function AppSidebar() {})}</DropdownMenuGroup><DropdownMenuSeparator className="mx-1! my-2.5! h-0! border-t border-border/70 bg-transparent! dark:border-[rgb(255_255_255_/_calc(0.15*var(--contrast-edge-gain,1)))]" />- <DropdownMenuItem- onSelect={() => useSettingsDialogStore.getState().openDialog("about")}- >- <HugeiconsIcon icon={HelpCircleIcon} strokeWidth={1.75} className="size-icon" />- <span>{t("common.help")}</span>- </DropdownMenuItem>+ <DropdownMenuSub>+ <DropdownMenuSubTrigger>+ <HugeiconsIcon icon={HelpCircleIcon} strokeWidth={1.75} className="size-icon" />+ <span>{t("common.help")}</span>+ </DropdownMenuSubTrigger>+ <DropdownMenuSubContent+ sideOffset={8}+ alignOffset={-4}+ className="unsloth-plus-menu sidebar-row-menu w-56"+ >+ {HELP_GROUPS.map((group, index) => (+ <DropdownMenuGroup key={group[0]}>+ {index > 0 && <DropdownMenuSeparator />}+ {group+ .filter((action) => helpActionAvailable(action, isOwner))+ .map((action) => (+ <DropdownMenuItem key={action} onSelect={() => runHelpAction(action)}>+ <HugeiconsIcon+ icon={HELP_ITEMS[action].icon}+ strokeWidth={1.75}+ className="size-icon"+ />+ <span>{t(HELP_ITEMS[action].label)}</span>+ {action === "help-keyboard-shortcuts" && keyboardShortcutsLabel && (+ <DropdownMenuShortcut>{keyboardShortcutsLabel}</DropdownMenuShortcut>+ )}+ </DropdownMenuItem>+ ))}+ </DropdownMenuGroup>+ ))}+ <DropdownMenuSeparator />+ <DropdownMenuItem+ onSelect={() => useSettingsDialogStore.getState().openDialog("about")}+ >+ <HugeiconsIcon icon={BadgeInfoIcon} strokeWidth={1.75} className="size-icon" />+ <span>{t("shell.helpMenu.about")}</span>+ </DropdownMenuItem>+ </DropdownMenuSubContent>+ </DropdownMenuSub>{!isTauri && (<DropdownMenuItemonSelect={async () => {diff --git a/studio/frontend/src/components/help-actions.ts b/studio/frontend/src/components/help-actions.tsnew file mode 100644index 00000000000..882ee76bac1--- /dev/null+++ b/studio/frontend/src/components/help-actions.ts@@ -0,0 +1,73 @@+// 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 { type SettingsTab, settingsTabVisible, useSettingsDialogStore } from "@/features/settings";+import type { TranslationKey } from "@/i18n";+import { openLink } from "@/lib/open-link";+import {+ ActivityIcon,+ Book03Icon,+ KeyboardIcon,+ MessageNotification01Icon,+ NewReleasesIcon,+ Wrench01Icon,+} from "@hugeicons/core-free-icons";+import type { IconSvgElement } from "@hugeicons/react";++/** The Help menu: the sidebar's account menu and the desktop app's Help menu list the same items+ * (src-tauri/src/app_menu.rs, HELP_ROWS), grouped the same way. */+export type HelpAction =+ | "help-documentation"+ | "help-keyboard-shortcuts"+ | "help-whats-new"+ | "help-troubleshooting"+ | "help-system-status"+ | "help-send-feedback";++export const HELP_GROUPS: HelpAction[][] = [+ ["help-documentation", "help-keyboard-shortcuts", "help-whats-new"],+ ["help-troubleshooting", "help-system-status", "help-send-feedback"],+];++export const HELP_ITEMS: Record<HelpAction, { label: TranslationKey; icon: IconSvgElement }> = {+ "help-documentation": { label: "shell.helpMenu.documentation", icon: Book03Icon },+ "help-keyboard-shortcuts": { label: "shell.helpMenu.keyboardShortcuts", icon: KeyboardIcon },+ "help-whats-new": { label: "shell.helpMenu.whatsNew", icon: NewReleasesIcon },+ "help-troubleshooting": { label: "shell.helpMenu.troubleshooting", icon: Wrench01Icon },+ "help-system-status": { label: "shell.helpMenu.systemStatus", icon: ActivityIcon },+ "help-send-feedback": { label: "shell.helpMenu.sendFeedback", icon: MessageNotification01Icon },+};++/** The Settings page an action opens. */+const HELP_SETTINGS_TABS: Partial<Record<HelpAction, SettingsTab>> = {+ "help-keyboard-shortcuts": "keyboard-shortcuts",+ // The server log, where a failed load or generation usually says why.+ "help-troubleshooting": "debugging",+ // Live hardware, memory and storage for this server.+ "help-system-status": "resources",+};++/** False when the action's Settings page is owner-only and this account cannot open it. */+export function helpActionAvailable(action: HelpAction, isOwner: boolean): boolean {+ const tab = HELP_SETTINGS_TABS[action];+ return !tab || settingsTabVisible(tab, isOwner);+}++export function runHelpAction(action: HelpAction): void {+ const tab = HELP_SETTINGS_TABS[action];+ if (tab) {+ useSettingsDialogStore.getState().openDialog(tab);+ return;+ }+ switch (action) {+ case "help-documentation":+ openLink("https://unsloth.ai/docs");+ return;+ case "help-whats-new":+ openLink("https://unsloth.ai/docs/new/changelog");+ return;+ case "help-send-feedback":+ openLink("https://github.com/unslothai/unsloth/issues");+ return;+ }+}diff --git a/studio/frontend/src/features/settings/index.ts b/studio/frontend/src/features/settings/index.tsindex 413945499d5..370eba407de 100644--- a/studio/frontend/src/features/settings/index.ts+++ b/studio/frontend/src/features/settings/index.ts@@ -93,7 +93,8 @@ export {useKeyboardShortcutsStore,} from "./stores/keyboard-shortcuts-store";export type { ShortcutId } from "./lib/keyboard-shortcuts";-export { useSettingsDialogStore } from "./stores/settings-dialog-store";+export { SETTINGS_TABS, useSettingsDialogStore } from "./stores/settings-dialog-store";+export { settingsTabVisible } from "./settings-tab-visibility";export type { SettingsTab } from "./stores/settings-dialog-store";export { requestSttDownload } from "./stores/stt-download-prompt-store";export {diff --git a/studio/frontend/src/features/settings/settings-dialog.tsx b/studio/frontend/src/features/settings/settings-dialog.tsxindex fe18ae88d9e..ae6a523e0d2 100644--- a/studio/frontend/src/features/settings/settings-dialog.tsx+++ b/studio/frontend/src/features/settings/settings-dialog.tsx@@ -15,6 +15,7 @@ import { type TranslationKey, useT } from "@/i18n";import { isTauri } from "@/lib/api-base";import { MicIcon } from "@/lib/mic-icon";import { cn } from "@/lib/utils";+import { useScrollFades } from "@/hooks/use-scroll-fades";import { useUiSpaceScale } from "@/hooks/use-ui-space-scale";import { scheduleIdleTask } from "@/lib/schedule-idle-task";import {@@ -296,6 +297,7 @@ export function SettingsDialog() {const t = useT();const isOwner = useIsAccountOwner();const stacked = useStackedLayout();+ const { attach: attachRail, onScroll: onRailScroll, className: railFadeClass } = useScrollFades();const visibleTabs = useMemo(() => TABS.filter((tab) => settingsTabVisible(tab.id, isOwner)), [isOwner]);const open = useSettingsDialogStore((s) => s.open);const requestedTab = useSettingsDialogStore((s) => s.activeTab);@@ -591,11 +593,14 @@ export function SettingsDialog() {{t("settings.dialog.title")}</p><nav+ ref={attachRail}+ onScroll={onRailScroll}className={cn(// The tab list is the sidebar's flexible row: a short window// leaves it taller than the sidebar, and the dialog clips its// overflow, so scroll it rather than losing the last tabs.- "hover-scrollbar flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-1 py-1",+ "hover-scrollbar settings-rail-fade flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-1 py-1",+ railFadeClass,"group-data-stacked/settings:flex-none group-data-stacked/settings:flex-row group-data-stacked/settings:overflow-x-auto group-data-stacked/settings:py-0",results !== null && "group-data-stacked/settings:flex hidden",)}diff --git a/studio/frontend/src/hooks/use-scroll-fades.ts b/studio/frontend/src/hooks/use-scroll-fades.tsindex bf0310bf68e..800a731c99c 100644--- a/studio/frontend/src/hooks/use-scroll-fades.ts+++ b/studio/frontend/src/hooks/use-scroll-fades.ts@@ -12,7 +12,7 @@ import { cn } from "@/lib/utils";*/export function useScrollFades() {// The node is state, not a ref, so the observer re-attaches when it changes.- const [node, setNode] = useState<HTMLDivElement | null>(null);+ const [node, setNode] = useState<HTMLElement | null>(null);const [scrolled, setScrolled] = useState(false);const [moreBelow, setMoreBelow] = useState(false);diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 97468c589af..35067ffe072 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -120,6 +120,16 @@ export const ar = {shutdown: "إيقاف التشغيل",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "الوثائق",+ keyboardShortcuts: "اختصارات لوحة المفاتيح",+ whatsNew: "ما الجديد",+ troubleshooting: "استكشاف الأخطاء وإصلاحها",+ systemStatus: "حالة النظام",+ sendFeedback: "إرسال ملاحظات",+ about: "حول Unsloth",+ },find: {label: "البحث في الصفحة",previous: "التطابق السابق",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 7a7ddf49dc4..a07ec7d877c 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -123,6 +123,16 @@ export const de = {shutdown: "Herunterfahren",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Dokumentation",+ keyboardShortcuts: "Tastenkürzel",+ whatsNew: "Neuigkeiten",+ troubleshooting: "Fehlerbehebung",+ systemStatus: "Systemstatus",+ sendFeedback: "Feedback senden",+ about: "Über Unsloth",+ },find: {label: "Auf der Seite suchen",previous: "Vorheriger Treffer",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex a3494b4c0dc..b4959d08111 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -121,6 +121,16 @@ export const en = {shutdown: "Shutdown",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Documentation",+ keyboardShortcuts: "Keyboard Shortcuts",+ whatsNew: "What's New",+ troubleshooting: "Troubleshooting",+ systemStatus: "System Status",+ sendFeedback: "Send Feedback",+ about: "About Unsloth",+ },find: {label: "Find in page",previous: "Previous match",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 5bf21fd1bf1..10de1fe6108 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -122,6 +122,16 @@ export const es = {shutdown: "Apagar",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Documentación",+ keyboardShortcuts: "Atajos de teclado",+ whatsNew: "Novedades",+ troubleshooting: "Solución de problemas",+ systemStatus: "Estado del sistema",+ sendFeedback: "Enviar comentarios",+ about: "Acerca de Unsloth",+ },find: {label: "Buscar en la página",previous: "Coincidencia anterior",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex da65d076389..630283ae3ea 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -123,6 +123,16 @@ export const fr = {shutdown: "Arrêter",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Documentation",+ keyboardShortcuts: "Raccourcis clavier",+ whatsNew: "Nouveautés",+ troubleshooting: "Dépannage",+ systemStatus: "État du système",+ sendFeedback: "Envoyer des commentaires",+ about: "À propos d'Unsloth",+ },find: {label: "Rechercher dans la page",previous: "Résultat précédent",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 3092381ad60..cf2113a6d6d 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -123,6 +123,16 @@ export const hi = {shutdown: "शटडाउन",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "दस्तावेज़",+ keyboardShortcuts: "कीबोर्ड शॉर्टकट",+ whatsNew: "नया क्या है",+ troubleshooting: "समस्या निवारण",+ systemStatus: "सिस्टम स्थिति",+ sendFeedback: "फ़ीडबैक भेजें",+ about: "Unsloth के बारे में",+ },find: {label: "पेज में खोजें",previous: "पिछला मिलान",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 26ada571168..42d23916874 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -87,6 +87,16 @@ export const it = {shutdown: "Arresta",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Documentazione",+ keyboardShortcuts: "Scorciatoie da tastiera",+ whatsNew: "Novità",+ troubleshooting: "Risoluzione dei problemi",+ systemStatus: "Stato del sistema",+ sendFeedback: "Invia feedback",+ about: "Informazioni su Unsloth",+ },find: {label: "Trova nella pagina",previous: "Risultato precedente",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 2ab9faacf4e..69863a690b5 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -122,6 +122,16 @@ export const ja = {shutdown: "シャットダウン",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "ドキュメント",+ keyboardShortcuts: "キーボードショートカット",+ whatsNew: "新機能",+ troubleshooting: "トラブルシューティング",+ systemStatus: "システムの状態",+ sendFeedback: "フィードバックを送信",+ about: "Unsloth について",+ },find: {label: "ページ内検索",previous: "前の一致",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex c26674de6dd..c401847281a 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -120,6 +120,16 @@ export const ko = {shutdown: "종료",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "문서",+ keyboardShortcuts: "키보드 단축키",+ whatsNew: "새로운 기능",+ troubleshooting: "문제 해결",+ systemStatus: "시스템 상태",+ sendFeedback: "피드백 보내기",+ about: "Unsloth 정보",+ },find: {label: "페이지에서 찾기",previous: "이전 결과",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 18f2140b8f6..8cdcfad5dbb 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -122,6 +122,16 @@ export const ptBR = {shutdown: "Desligar",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Documentação",+ keyboardShortcuts: "Atalhos de teclado",+ whatsNew: "Novidades",+ troubleshooting: "Solução de problemas",+ systemStatus: "Status do sistema",+ sendFeedback: "Enviar feedback",+ about: "Sobre o Unsloth",+ },find: {label: "Localizar na página",previous: "Ocorrência anterior",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex f19945a9481..d795be570af 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -122,6 +122,16 @@ export const ru = {shutdown: "Выключить",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "Документация",+ keyboardShortcuts: "Сочетания клавиш",+ whatsNew: "Что нового",+ troubleshooting: "Устранение неполадок",+ systemStatus: "Состояние системы",+ sendFeedback: "Отправить отзыв",+ about: "Об Unsloth",+ },find: {label: "Поиск на странице",previous: "Предыдущее совпадение",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex d105f30e92f..f496f03ad69 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -118,6 +118,16 @@ export const zhCN = {shutdown: "关闭服务",},shell: {+ // The Help submenu of the account menu, and the desktop app's Help menu.+ helpMenu: {+ documentation: "文档",+ keyboardShortcuts: "键盘快捷键",+ whatsNew: "新功能",+ troubleshooting: "故障排除",+ systemStatus: "系统状态",+ sendFeedback: "发送反馈",+ about: "关于 Unsloth",+ },find: {label: "在页面中查找",previous: "上一个匹配项",diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 227cd4327e1..8c6a3d5d6bc 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -77,14 +77,16 @@rgb(from var(--sidebar-surface) r g b / 0));}- /* Model picker list: once scrolled, the top edge fades so rows dissolve as- they pass under the pinned search / tab bar. */- .model-list-scroll.is-scrolled {+ /* Model picker list and the Settings tab rail: once scrolled, the top edge fades so+ rows dissolve as they pass under the pinned search / tab bar or title. */+ .model-list-scroll.is-scrolled,+ .settings-rail-fade.is-scrolled {-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px);mask-image: linear-gradient(to bottom, transparent 0, #000 14px);}/* Bottom edge fades while more rows sit below the fold. */- .model-list-scroll.is-bottom-faded {+ .model-list-scroll.is-bottom-faded,+ .settings-rail-fade.is-bottom-faded {-webkit-mask-image: linear-gradient(to bottom,#000 calc(100% - 16px),@@ -93,7 +95,8 @@mask-image: linear-gradient(to bottom, #000 calc(100% - 16px), transparent);}/* Both edges fade when scrolled with rows above and below. */- .model-list-scroll.is-scrolled.is-bottom-faded {+ .model-list-scroll.is-scrolled.is-bottom-faded,+ .settings-rail-fade.is-scrolled.is-bottom-faded {-webkit-mask-image: linear-gradient(to bottom,transparent 0,diff --git a/studio/frontend/tests/desktop-app-menus.test.ts b/studio/frontend/tests/desktop-app-menus.test.tsindex 7c1ec5c5f08..07d432dcf47 100644--- a/studio/frontend/tests/desktop-app-menus.test.ts+++ b/studio/frontend/tests/desktop-app-menus.test.ts@@ -20,10 +20,18 @@ const rowsOf = (table: string) =>)].map((m) => m[1]);const fileActions = rowsOf("FILE_ROWS");const viewActions = rowsOf("VIEW_ROWS");-const rustActions = [...fileActions, ...viewActions];-const hookActions = [...CHORDS.match(/export type AppMenuAction =([^;]+);/)![1].matchAll(/"([a-z-]+)"/g)].map(- (m) => m[1],-);+const goActions = rowsOf("GO_ROWS");+const settingsActions = rowsOf("SETTINGS_ROWS");+const helpActions = rowsOf("HELP_ROWS");+const rustActions = [...fileActions, ...viewActions, ...goActions, ...helpActions];+const HELP = readSrc("components/help-actions.ts");+const actionsOf = (source: string, type: string) =>+ [...source.match(new RegExp(`export type ${type} =([^;]+);`))![1].matchAll(/"([a-z-]+)"/g)].map(+ (m) => m[1],+ );+// The Help actions are typed beside the Help menu the sidebar shares.+assert.match(CHORDS, /export type AppMenuAction =\s*\| HelpAction/);+const hookActions = [...actionsOf(CHORDS, "AppMenuAction"), ...actionsOf(HELP, "HelpAction")];test("the menus and the renderer name the same actions", () => {assert.deepEqual(fileActions, ["new-chat", "new-temporary-chat", "open-folder"]);@@ -38,13 +46,53 @@ test("the menus and the renderer name the same actions", () => {"zoom-out","actual-size",]);+ assert.deepEqual(helpActions, [+ "help-documentation",+ "help-keyboard-shortcuts",+ "help-whats-new",+ "help-troubleshooting",+ "help-system-status",+ "help-send-feedback",+ ]);+ const helpGroups = [...HELP.match(/HELP_GROUPS[^=]*=([\s\S]*?);/)![1].matchAll(/"([a-z-]+)"/g)].map(+ (m) => m[1],+ );+ assert.deepEqual(helpGroups, helpActions, "the sidebar's Help lists the menu's items in order");+ assert.deepEqual(goActions, [+ "go-chat",+ "go-projects",+ "go-library",+ "go-hub",+ "go-train",+ "go-recipes",+ "go-images",+ "go-video",+ "go-audio",+ "go-export",+ ]);+ assert.match(APP_MENU, /Row::Submenu\("Settings", SETTINGS_ROWS\)/);assert.deepEqual([...hookActions].sort(), [...rustActions].sort());});+test("Go > Settings lists every Settings page, in the dialog's order", () => {+ const dialog = readSrc("features/settings/settings-dialog.tsx");+ const tabs = [...dialog.slice(dialog.indexOf("const TABS")).matchAll(/id: "([a-z-]+)"/g)].map((m) => m[1]);+ assert.deepEqual(settingsActions, tabs.slice(0, settingsActions.length).map((tab) => `settings-${tab}`));+ const store = readSrc("features/settings/stores/settings-dialog-store.ts");+ const known = [...store.match(/SETTINGS_TABS = \[([\s\S]*?)\]/)![1].matchAll(/"([a-z-]+)"/g)].map((m) => m[1]);+ assert.deepEqual([...settingsActions].sort(), known.map((tab) => `settings-${tab}`).sort());+ assert.match(CHORDS, /export type SettingsMenuAction = `settings-\$\{SettingsTab\}`;/);+ // Only the pages this account can open are live, as in the dialog's own tab rail.+ assert.match(ROOT, /`settings-\$\{tab\}`,\s*!isAuthFlowRoute && settingsTabVisible\(tab, isOwner\)/);+});+test("every action is handled in the app shell", () => {for (const action of rustActions) {assert.ok(ROOT.includes(`"${action}":`), `__root.tsx handles ${action}`);}+ // Help items for owner-only pages are off for managed accounts, in both menus.+ assert.match(ROOT, /isAuthFlowRoute \|\| !helpActionAvailable\(action, isOwner\)/);+ assert.match(readSrc("components/app-sidebar.tsx"), /\.filter\(\(action\) => helpActionAvailable\(action, isOwner\)\)/);});test("both sides use the same event and command names", () => {@@ -203,9 +251,12 @@ test("menu chords follow the user's bindings and never steal a web shortcut's ch.replace("+[", "+BracketLeft").replace("+]", "+BracketRight").replace("+=", "+Equal")- .replace(/\+-$/, "+Minus");+ .replace(/\+-$/, "+Minus")+ .replace("+/", "+Slash");for (const action of rustActions) {- assert.equal(defaults[action as keyof typeof defaults], native(rustAccel(action)!), action);+ // An empty accelerator is an item with no chord.+ const accel = rustAccel(action);+ assert.equal(defaults[action as keyof typeof defaults], accel ? native(accel) : null, action);}// Rebound: the item shows the new chord.assert.equal(diff --git a/studio/src-tauri/src/app_menu.rs b/studio/src-tauri/src/app_menu.rsindex 38264767d04..71a3309c9e7 100644--- a/studio/src-tauri/src/app_menu.rs+++ b/studio/src-tauri/src/app_menu.rs@@ -1,5 +1,6 @@-//! The macOS File and View menus. Their actions run in the renderer, which enables only the ones-//! it can handle right now, so they stay disabled through install, login and startup.+//! The macOS File, View, Go and Help menus. Their actions run in the renderer, which enables only+//! the ones it can handle right now, so they stay disabled through install, login and startup.+//! macOS searches every item from Help > Search, so Go lists each workspace and Settings page.#[cfg(target_os = "macos")]use tauri::{menu::MenuItem, Manager};@@ -8,12 +9,13 @@ use tauri::{menu::MenuItem, Manager};#[cfg(target_os = "macos")]pub const APP_MENU_ACTION_EVENT: &str = "app-menu-action";-/// A menu row: an action or a separator.+/// A menu row: an action, a separator or a submenu of rows.#[cfg(target_os = "macos")]enum Row {- /// (action sent to the renderer, label, accelerator)+ /// (action sent to the renderer, label, accelerator; "" for none)Action(&'static str, &'static str, &'static str),Separator,+ Submenu(&'static str, &'static [Row]),}#[cfg(target_os = "macos")]@@ -46,6 +48,58 @@ const VIEW_ROWS: &[Row] = &[Row::Separator,];+#[cfg(target_os = "macos")]+const GO_ROWS: &[Row] = &[+ Row::Action("go-chat", "Chat", "Ctrl+1"),+ Row::Action("go-projects", "Projects", "Ctrl+2"),+ Row::Action("go-library", "Library", ""),+ Row::Action("go-hub", "Model Hub", "Ctrl+3"),+ Row::Action("go-train", "Train", "Ctrl+4"),+ Row::Action("go-recipes", "Recipes", "Ctrl+5"),+ Row::Action("go-images", "Images", "Ctrl+6"),+ Row::Action("go-video", "Video", "Ctrl+7"),+ Row::Action("go-audio", "Audio", "Ctrl+8"),+ Row::Action("go-export", "Export", "Ctrl+9"),+ Row::Separator,+ Row::Submenu("Settings", SETTINGS_ROWS),+];++/// The Settings pages, in the order and with the names of the dialog's tabs.+#[cfg(target_os = "macos")]+const SETTINGS_ROWS: &[Row] = &[+ Row::Action("settings-general", "General", ""),+ Row::Action("settings-profile", "Profile", ""),+ Row::Action("settings-appearance", "Appearance", ""),+ Row::Action("settings-resources", "System", ""),+ Row::Action("settings-chat", "Chat", ""),+ Row::Action("settings-api-keys", "API", ""),+ Row::Action("settings-remote-lan", "Remote & LAN", ""),+ Row::Action("settings-connections", "Connections", ""),+ Row::Action("settings-accounts", "Accounts", ""),+ Row::Action("settings-agents", "Agents", ""),+ Row::Action("settings-voice", "Voice", ""),+ Row::Action("settings-library", "Library", ""),+ Row::Action("settings-data", "Data", ""),+ Row::Action("settings-keyboard-shortcuts", "Shortcuts", ""),+ Row::Action("settings-debugging", "Logs", ""),+ Row::Action("settings-about", "About", ""),+];++#[cfg(target_os = "macos")]+const HELP_ROWS: &[Row] = &[+ Row::Action("help-documentation", "Documentation", ""),+ Row::Action(+ "help-keyboard-shortcuts",+ "Keyboard Shortcuts",+ "CmdOrCtrl+/",+ ),+ Row::Action("help-whats-new", "What's New", ""),+ Row::Separator,+ Row::Action("help-troubleshooting", "Troubleshooting", ""),+ Row::Action("help-system-status", "System Status", ""),+ Row::Action("help-send-feedback", "Send Feedback", ""),+];+/// Menu ids are the action names, prefixed so they cannot collide with other menu ids.#[cfg(target_os = "macos")]const ID_PREFIX: &str = "app-menu:";@@ -63,45 +117,45 @@ struct ActionItem {#[cfg(target_os = "macos")]pub struct AppMenuActions(std::sync::Mutex<Vec<ActionItem>>);-/// Put the Unsloth rows at the top of the File and View menus, keeping each menu's native items-/// (Close, Enter Full Screen) below them.+/// Put the Unsloth rows at the top of the File, View and Help menus, keeping each menu's native+/// items (Close, Enter Full Screen) below them, and add Go after View. Help keeps its role, so+/// macOS still adds Search.#[cfg(target_os = "macos")]pub fn setup_app_menus(app: &tauri::App,menu: &tauri::menu::Menu<tauri::Wry>,) -> Result<(), Box<dyn std::error::Error>> {- use tauri::menu::{MenuItemBuilder, PredefinedMenuItem};+ use tauri::menu::{PredefinedMenuItem, SubmenuBuilder};++ let find = |title: &str| -> tauri::Result<Option<(usize, tauri::menu::Submenu<tauri::Wry>)>> {+ Ok(menu+ .items()?+ .into_iter()+ .enumerate()+ .find_map(|(index, item)| {+ let submenu = item.as_submenu()?.clone();+ (submenu.text().ok()? == title).then_some((index, submenu))+ }))+ };+ if let Some((view, _)) = find("View")? {+ menu.insert(&SubmenuBuilder::new(app, "Go").build()?, view + 1)?;+ }let mut actions = Vec::new();- for (title, rows) in [("File", FILE_ROWS), ("View", VIEW_ROWS)] {- let Some(submenu) = menu.items()?.into_iter().find_map(|item| {- let submenu = item.as_submenu()?.clone();- (submenu.text().ok()? == title).then_some(submenu)- }) else {+ for (title, rows) in [+ ("File", FILE_ROWS),+ ("View", VIEW_ROWS),+ ("Go", GO_ROWS),+ ("Help", HELP_ROWS),+ ] {+ let Some((_, submenu)) = find(title)? else {continue;};let native = submenu.items()?;for item in &native {submenu.remove(item)?;}- for row in rows {- match row {- Row::Action(action, label, accelerator) => {- let item = MenuItemBuilder::with_id(format!("{ID_PREFIX}{action}"), *label)- .accelerator(*accelerator)- .enabled(false)- .build(app)?;- submenu.append(&item)?;- actions.push(ActionItem {- action,- item,- submenu: submenu.clone(),- accelerator: Some(accelerator.to_string()),- });- }- Row::Separator => submenu.append(&PredefinedMenuItem::separator(app)?)?,- }- }+ append_rows(app, &submenu, rows, &mut actions)?;if title == "File" {// The native close, so Cmd+W still goes through the window's close handling.submenu.append(&PredefinedMenuItem::close_window(app, Some("Close"))?)?;@@ -115,6 +169,43 @@ pub fn setup_app_menus(Ok(())}+#[cfg(target_os = "macos")]+fn append_rows(+ app: &tauri::App,+ submenu: &tauri::menu::Submenu<tauri::Wry>,+ rows: &[Row],+ actions: &mut Vec<ActionItem>,+) -> tauri::Result<()> {+ use tauri::menu::{MenuItemBuilder, PredefinedMenuItem, SubmenuBuilder};++ for row in rows {+ match row {+ Row::Action(action, label, accelerator) => {+ let mut builder =+ MenuItemBuilder::with_id(format!("{ID_PREFIX}{action}"), *label).enabled(false);+ if !accelerator.is_empty() {+ builder = builder.accelerator(*accelerator);+ }+ let item = builder.build(app)?;+ submenu.append(&item)?;+ actions.push(ActionItem {+ action,+ item,+ submenu: submenu.clone(),+ accelerator: (!accelerator.is_empty()).then(|| accelerator.to_string()),+ });+ }+ Row::Separator => submenu.append(&PredefinedMenuItem::separator(app)?)?,+ Row::Submenu(label, rows) => {+ let child = SubmenuBuilder::new(app, *label).build()?;+ append_rows(app, &child, rows, actions)?;+ submenu.append(&child)?;+ }+ }+ }+ Ok(())+}+/// Forward a menu click to the renderer. Ignores ids this module does not own.#[cfg(target_os = "macos")]pub fn handle_menu_event(app: &tauri::AppHandle, id: &str) {