The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(models): an LM Studio row says where it is deleted
purplecf002b8388cb
diff --git a/src/components/models/ModelCard.tsx b/src/components/models/ModelCard.tsxindex a7ba976f..98f4beee 100644--- a/src/components/models/ModelCard.tsx+++ b/src/components/models/ModelCard.tsx@@ -15,6 +15,8 @@ interface Props {onSelect: () => voidonDelete: () => voidonInfo: () => void+ /** Tooltip of the Details button, when the row has more to say there. */+ infoTitle?: stringcanDelete?: boolean/*** A16 (A14-4a): the Use button the 2.6.8 notes promise twice on this tile.@@ -54,7 +56,7 @@ const TYPE_CONFIG = {video: { label: 'Video', icon: Video, color: 'text-green-400' },}-export function ModelCard({ model, isActive, onSelect, onDelete, onInfo, canDelete = true, onUse, useBusy = false, engineStopped: luEngineRuht = false }: Props) {+export function ModelCard({ model, isActive, onSelect, onDelete, onInfo, infoTitle, canDelete = true, onUse, useBusy = false, engineStopped: luEngineRuht = false }: Props) {const typeInfo = TYPE_CONFIG[model.type] || TYPE_CONFIG.textconst TypeIcon = typeInfo.iconconst [menu, setMenu] = useState<{ x: number; y: number } | null>(null)@@ -175,7 +177,7 @@ export function ModelCard({ model, isActive, onSelect, onDelete, onInfo, canDele<buttononClick={(e) => { e.stopPropagation(); actions.info() }}className="p-1 rounded hover:bg-gray-100 dark:hover:bg-white/10 text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors"- title="Details"+ title={infoTitle ?? 'Details'}><Info size={12} /></button>diff --git a/src/components/models/ModelManager.tsx b/src/components/models/ModelManager.tsxindex 392d5a9e..96da4918 100644--- a/src/components/models/ModelManager.tsx+++ b/src/components/models/ModelManager.tsx@@ -25,6 +25,7 @@ import { customModelDirs, deleteBundledModel, stopBundledEngine } from '../../apimport { counterView } from '../../lib/inventory-counter'import { groupInstalledByProvider, needsBackendSwitchHeading, foldedRowsSentence, LU_ENGINE_GROUP } from '../../lib/lu-engine-rows'import { isBuiltinEngineEntry } from '../../lib/lmstudio-match'+import { externalDeleteHint, servesItsOwnFiles } from '../../lib/external-model-hint'import { installedRowMatchesSearch } from '../../lib/model-search'import { isLoraRow } from '../../lib/lora-rows'import { useBuiltinEngineStatus, engineIsIdle } from '../../hooks/useBuiltinEngineStatus'@@ -153,6 +154,13 @@ export function ModelManager() {const luEngineFile = (m: AIModel): m is AIModel & { path: string } =>m.type === 'text' && isBuiltinEngineEntry(m) && 'path' in m && typeof m.path === 'string' && m.path.length > 0+ // A chat model another app serves (LM Studio, any OpenAI-compatible+ // server). Neither Ollama nor LU can delete it, and Details used to ask+ // Ollama about it and then show nothing at all.+ const externalTextModel = (m: AIModel): boolean =>+ m.type === 'text' && 'provider' in m && !isBuiltinEngineEntry(m)+ && servesItsOwnFiles(m.provider, 'providerName' in m ? m.providerName : undefined)+const handleInfo = async (name: string) => {const model = models.find((m: AIModel) => m.name === name)if (model && luEngineFile(model)) {@@ -160,6 +168,12 @@ export function ModelManager() {setInfoOpen(true)return}+ if (model && externalTextModel(model)) {+ const providerName = 'providerName' in model ? model.providerName : undefined+ setModelInfo({ name, engine: providerName, deleteHint: externalDeleteHint(providerName) })+ setInfoOpen(true)+ return+ }try {const info = await showModel(name)setModelInfo({ name, ...info })@@ -579,6 +593,7 @@ export function ModelManager() {engineStopped={engineRuht}onDelete={() => setConfirmDelete(model.name)}onInfo={() => handleInfo(model.name)}+ infoTitle={externalTextModel(model) ? `Details. ${externalDeleteHint('providerName' in model ? model.providerName : undefined)}` : undefined}canDelete={// Ollama text models via the Ollama API; image/video// models are ComfyUI files we can delete from disk;@@ -665,6 +680,9 @@ export function ModelManager() {</Modal><Modal open={infoOpen} onClose={() => setInfoOpen(false)} title={modelInfo?.name || 'Model Info'}>+ {typeof modelInfo?.deleteHint === 'string' && (+ <p className="t-label text-gray-700 dark:text-gray-200 mb-3">{modelInfo.deleteHint}</p>+ )}{modelInfo && (<pre className="t-micro text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-black/30 rounded-lg p-3 overflow-auto max-h-80 scrollbar-thin font-mono">{JSON.stringify(modelInfo, null, 2)}diff --git a/src/components/models/__tests__/an-lm-studio-row-says-where-it-is-deleted.test.ts b/src/components/models/__tests__/an-lm-studio-row-says-where-it-is-deleted.test.tsnew file mode 100644index 00000000..f69d15c4--- /dev/null+++ b/src/components/models/__tests__/an-lm-studio-row-says-where-it-is-deleted.test.ts@@ -0,0 +1,146 @@+/**+ * @vitest-environment jsdom+ *+ * lapbo, Discord 2026-09-28: "DELETE BUTTON pls", with three chat rows that+ * had Bench and Details and no bin. They were LM Studio models. LM Studio has+ * no delete in its API or in `lms` and names no file, so LU cannot delete+ * them without guessing. David decided on 2026-10-01 that the row says where+ * the model is deleted. Details also asked Ollama about these rows and then+ * showed nothing at all.+ *+ * Run: npx vitest run src/components/models/__tests__/an-lm-studio-row-says-where-it-is-deleted.test.ts+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, cleanup, act, fireEvent } from '@testing-library/react'++const activateBuiltinModel = vi.fn(async () => true)+const showModel = vi.fn(async () => ({ license: 'x' }))+/** Was die Engine gerade tut. Ueberschreibbar, siehe den Fall zum toten+ * Prozess weiter unten. */+const engineStatus = vi.fn(async () => ({ running: true, healthy: true, port: 8127 }))++vi.mock('../../../api/backend', () => ({+ isTauri: () => true,+ isMacOS: () => false,+ isWindows: () => true,+ isLinux: () => false,+ backendCall: vi.fn(async () => null),+ secretGet: vi.fn().mockRejectedValue(new Error('no vault')),+ secretSet: vi.fn(),+ secretDelete: vi.fn(),+}))+vi.mock('../../../api/comfyui', async () => {+ const actual = await vi.importActual<typeof import('../../../api/comfyui')>('../../../api/comfyui')+ return {+ ...actual,+ getInstalledImageModels: vi.fn(async () => []),+ getInstalledVideoModels: vi.fn(async () => []),+ checkComfyConnection: vi.fn(async () => false),+ refreshComfyModels: vi.fn(async () => undefined),+ readModelDiskSizes: vi.fn(async () => new Map()),+ getSystemVRAM: vi.fn(async () => 0),+ }+})+vi.mock('../../../api/ollama', () => ({+ listModels: vi.fn(async () => []),+ unloadModel: vi.fn(async () => undefined),+ pullModel: vi.fn(), pullModelTauri: vi.fn(), deleteModel: vi.fn(), showModel: (...a: unknown[]) => showModel(...(a as [])),+}))+vi.mock('../../../api/providers', async () => {+ const actual = await vi.importActual<typeof import('../../../api/providers')>('../../../api/providers')+ return { ...actual, getEnabledProviders: () => [] }+})+vi.mock('../../../api/engine', async () => {+ const actual = await vi.importActual<typeof import('../../../api/engine')>('../../../api/engine')+ return {+ ...actual,+ listBundledModels: vi.fn(async () => []),+ customModelDirs: vi.fn(async () => []),+ isManagedBuiltinActive: () => true,+ bundledEngineStatus: (...a: unknown[]) => engineStatus(...(a as [])),+ bundledEmbedStatus: vi.fn(async () => ({ running: true, healthy: true, port: 8128 })),+ startBundledEmbed: vi.fn(),+ activateBuiltinModel: (...a: unknown[]) => activateBuiltinModel(...(a as [])),+ }+})++const { ModelManager } = await import('../ModelManager')+const { useModelStore } = await import('../../../stores/modelStore')+const { useProviderStore } = await import('../../../stores/providerStore')+const { __resetLuEngineSwapLockForTests } = await import('../../../api/lu-engine-swap-lock')+const { displayModelName } = await import('../../../api/providers/model-name')++const LU = 'openai::Phi-4-mini-instruct-Q4_K_M'+const LMS = 'openai::gemma-3n-e4b'+const ROUTER = 'openai::meta-llama/llama-3.3-70b-instruct'+const OLLAMA = 'llama3.2:3b'++function installedList(providerName = 'LM Studio') {+ return [+ { name: LU, model: 'Phi-4-mini-instruct-Q4_K_M', size: 1, type: 'text', provider: 'openai', providerName: 'LU Engine' },+ { name: LMS, model: 'gemma-3n-e4b', size: 1, type: 'text', provider: 'openai', providerName },+ { name: ROUTER, model: 'meta-llama/llama-3.3-70b-instruct', size: 1, type: 'text', provider: 'openai', providerName: 'OpenRouter' },+ { name: OLLAMA, model: OLLAMA, size: 1, type: 'text', provider: 'ollama', providerName: 'Ollama' },+ ] as never+}++async function openInstalled(providerName?: string) {+ render(createElement(ModelManager))+ await act(async () => { await Promise.resolve(); await Promise.resolve() })+ fireEvent.click(screen.getByText('Installed'))+ await act(async () => { for (let i = 0; i < 20; i++) await Promise.resolve() })+ await act(async () => {+ useModelStore.setState({ models: installedList(providerName), activeModel: LU })+ await Promise.resolve()+ })+}++function row(name: string): HTMLElement {+ const el = document.querySelector(`span[title="${displayModelName(name)}"]`)+ if (!el) throw new Error(`no row for ${name}`)+ return el.closest('div[class*="rounded-lg"]') as HTMLElement+}+const detailsOf = (name: string) => row(name).querySelector('button[title^="Details"]') as HTMLButtonElement++beforeEach(() => {+ showModel.mockClear()+ __resetLuEngineSwapLockForTests()+ useProviderStore.getState().resetProvidersToDefaults()+ useProviderStore.getState().setProviderConfig('openai', {+ enabled: true, managed: true, name: 'LU Engine', baseUrl: 'http://127.0.0.1:8127/v1',+ })+ useModelStore.setState({ models: installedList(), activeModel: LU, categoryFilter: 'text' })+})+afterEach(() => { cleanup(); __resetLuEngineSwapLockForTests() })++describe('a chat model LM Studio serves', () => {+ it('Details says to delete it in LM Studio, without asking Ollama', async () => {+ await openInstalled()+ expect(detailsOf(LMS).title).toContain('Delete it in LM Studio under My Models')+ await act(async () => { fireEvent.click(detailsOf(LMS)) })+ expect(screen.getByText('This model belongs to LM Studio. Delete it in LM Studio under My Models.')).toBeTruthy()+ expect(showModel).not.toHaveBeenCalled()+ })++ it('another local server is named the same way', async () => {+ await openInstalled('KoboldCpp')+ await act(async () => { fireEvent.click(detailsOf(LMS)) })+ expect(screen.getByText('This model belongs to KoboldCpp. Delete it there.')).toBeTruthy()+ })++ // Negative controls: rows that can be deleted, or have nothing to delete.+ it('an Ollama row keeps its bin and asks Ollama for its details', async () => {+ await openInstalled()+ expect(detailsOf(OLLAMA).title).toBe('Details')+ await act(async () => { fireEvent.click(detailsOf(OLLAMA)) })+ expect(showModel).toHaveBeenCalledWith(OLLAMA)+ expect(screen.queryByText(/Delete it/)).toBeNull()+ })++ it('a cloud row and an LU Engine row get no such line', async () => {+ await openInstalled()+ expect(detailsOf(ROUTER).title).toBe('Details')+ expect(detailsOf(LU).title).toBe('Details')+ })+})diff --git a/src/lib/external-model-hint.ts b/src/lib/external-model-hint.tsnew file mode 100644index 00000000..8f1317e9--- /dev/null+++ b/src/lib/external-model-hint.ts@@ -0,0 +1,23 @@+// lapbo, Discord 2026-09-28 ("DELETE BUTTON"): the chat rows without a bin+// are models another app serves, LM Studio in his screenshot. LM Studio has+// no delete in its API or in `lms`, and its model list names no file, so LU+// cannot delete them without guessing which file is meant. David decided on+// 2026-10-01: the row says where the model is deleted instead.++import { PROVIDER_PRESETS } from '../api/providers/types'++/** A local server serves files from its own disk, which only it deletes. A+ * cloud preset (OpenRouter and the like) has nothing to delete at all, and+ * a config named by hand is taken as the local server it nearly always is. */+export function servesItsOwnFiles(provider: string | undefined, providerName: string | undefined): boolean {+ if (provider !== 'openai') return false+ const preset = PROVIDER_PRESETS.find((p) => p.name === providerName?.trim())+ return preset ? preset.isLocal === true : true+}++/** The model belongs to the app that serves it, and that app deletes it. */+export function externalDeleteHint(providerName: string | undefined): string {+ const app = providerName?.trim()+ if (app && /lm ?studio/i.test(app)) return 'This model belongs to LM Studio. Delete it in LM Studio under My Models.'+ return `This model belongs to ${app || 'the app that serves it'}. Delete it there.`+}