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
// 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 { captureFocusedElement } from "@/lib/focus";
import { create } from "zustand";
interface CommandPaletteStore {
isOpen: boolean;
// Passed to the opened dialog, since the palette unmounts before that dialog closes.
opener: HTMLElement | null;
close: () => void;
toggle: () => void;
setOpen: (open: boolean) => void;
}
export const useCommandPaletteStore = create<CommandPaletteStore>((set) => ({
isOpen: false,
opener: null,
close: () => set({ isOpen: false }),
toggle: () =>
set((s) =>
s.isOpen
? { isOpen: false }
: { isOpen: true, opener: captureFocusedElement() },
),
setOpen: (isOpen) =>
set((s) => {
if (!isOpen) return { isOpen: false };
return s.isOpen ? s : { isOpen: true, opener: captureFocusedElement() };
}),
}));