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(create): a model in two folders is listed once, and the picker never grows a ghost row
purplec105470658cf
diff --git a/src/api/comfyui.ts b/src/api/comfyui.tsindex 10078a61..da190447 100644--- a/src/api/comfyui.ts+++ b/src/api/comfyui.ts@@ -1280,9 +1280,18 @@ async function mainModelLane(if (isStrayAddonFile(name)) continuecandidates.push({ name, type: classifyModel(name), source: 'checkpoint' })}+ // The picker offers a name once (Discord #bug-reports 30.10.2026: Edit listed+ // "krea2TurboOfficialComfy krea2TurboInt8" three times). A file that sits in+ // checkpoints/ and in diffusion_models/ (two copies, or one folder that+ // extra_model_paths.yaml names for both) came back from both loaders. Every+ // run looks a name up with `find`, which takes the checkpoint entry, so+ // that is the one kept. The inventory lanes (hidePartialDownloads false) are+ // left as they were.+ const listed = new Set(hidePartialDownloads ? candidates.map((m) => m.name) : [])for (const name of unets) {if (complete && !complete.has(name)) continueif (isStrayAddonFile(name)) continue+ if (listed.has(name)) continuecandidates.push({ name, type: classifyModel(name), source: 'diffusion_model' })}await applyHeaderSniff(candidates)diff --git a/src/components/create/ui/Select.tsx b/src/components/create/ui/Select.tsxindex aba0f253..8388ce65 100644--- a/src/components/create/ui/Select.tsx+++ b/src/components/create/ui/Select.tsx@@ -72,11 +72,17 @@ export function Select({const current = options.find((option) => option.value === value)const filtered = useMemo(() => {- if (!query.trim()) return options+ // One row per value. A row's key is its value, and two rows with one key+ // are not two rows to React: filtering them left a third, stale one behind+ // (Discord 30.10.2026, a model listed twice showed three times after+ // typing "tur"). Two rows with one value are one choice anyway.+ const seen = new Set<string>()+ const unique = options.filter((option) => !seen.has(option.value) && !!seen.add(option.value))+ if (!query.trim()) return uniqueconst normalizedQuery = query.toLowerCase()- return options.filter(+ return unique.filter((option) =>option.label.toLowerCase().includes(normalizedQuery) ||option.sublabel?.toLowerCase().includes(normalizedQuery) ||diff --git a/src/components/create/ui/__tests__/a-model-in-two-folders-is-listed-once.test.tsx b/src/components/create/ui/__tests__/a-model-in-two-folders-is-listed-once.test.tsxnew file mode 100644index 00000000..d0dfc403--- /dev/null+++ b/src/components/create/ui/__tests__/a-model-in-two-folders-is-listed-once.test.tsx@@ -0,0 +1,98 @@+// @vitest-environment jsdom+/**+ * Discord #bug-reports, 30.10.2026 (LU 3.0.8, 16 GB card): Create → Edit,+ * local model list, search "tur": "krea2TurboOfficialComfy krea2TurboInt8"+ * three times, every other Krea model once.+ *+ * Two faults behind it, both pinned here:+ * - The image lane read checkpoints/ and diffusion_models/ and never merged+ * them, so a file found by both loaders was listed twice.+ * - The picker keys its rows by value. Two rows with one key are not two rows+ * to React: typing into the search left a stale third one behind, in the+ * order of the screenshot.+ *+ * Run: npx vitest run src/components/create/ui/__tests__/a-model-in-two-folders-is-listed-once.test.tsx+ */+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'+import { cleanup, fireEvent, render, screen } from '@testing-library/react'++const localFetch = vi.fn()+const backendCall = vi.fn()+vi.mock('../../../../api/backend', async (importOriginal) => ({+ ...(await importOriginal<typeof import('../../../../api/backend')>()),+ localFetch: (...a: unknown[]) => localFetch(...a),+ backendCall: (...a: unknown[]) => backendCall(...a),+ isTauri: () => false,+ comfyuiUrl: (path: string) => `http://127.0.0.1:8188${path}`,+}))++import { getImageModels } from '../../../../api/comfyui'+import { Select } from '../Select'++const KREA = 'krea2TurboOfficialComfy_krea2TurboInt8.safetensors'+const LABEL = 'krea2TurboOfficialComfy krea2TurboInt8'++const okJson = (body: unknown) => ({ ok: true, status: 200, json: async () => body })++beforeEach(() => {+ localFetch.mockReset()+ backendCall.mockReset()+ backendCall.mockImplementation(async (_cmd: string, args: { files: Array<{ filename: string }> }) =>+ args.files.map((f) => ({ filename: f.filename, exists: true, actualBytes: 1024, complete: true })),+ )+ localFetch.mockImplementation(async (url: string) => {+ if (url.includes('CheckpointLoaderSimple')) {+ return okJson({ CheckpointLoaderSimple: { input: { required: { ckpt_name: [['krea2Turbo18For_v2.safetensors', KREA]] } } } })+ }+ if (url.includes('UnetLoaderGGUF')) return okJson({})+ if (url.includes('UNETLoader')) {+ return okJson({ UNETLoader: { input: { required: { unet_name: [[KREA, 'krealism_v31TurboBf16.safetensors']] } } } })+ }+ return okJson({})+ })+})+afterEach(cleanup)++describe('a model in two folders', () => {+ it('is offered once by the image lane', async () => {+ const names = (await getImageModels()).map((m) => m.name)+ expect(names.filter((n) => n === KREA)).toHaveLength(1)+ expect(names).toContain('krea2Turbo18For_v2.safetensors')+ expect(names).toContain('krealism_v31TurboBf16.safetensors')+ })++ it('keeps the checkpoint entry, the one every run finds first', async () => {+ const krea = (await getImageModels()).find((m) => m.name === KREA)+ expect(krea?.source).toBe('checkpoint')+ })+})++describe('the picker with one value twice', () => {+ // The order of the screenshot: both copies in the "Best" group, the other+ // Krea models between them.+ const options = [+ { value: 'krea2Turbo18For_v2.safetensors', label: 'krea2Turbo18For v2 3129121', group: 'Best' },+ { value: KREA, label: LABEL, group: 'Best' },+ { value: 'krealism_v31TurboBf16.safetensors', label: 'krealism v31TurboBf16', group: 'Best' },+ { value: KREA, label: LABEL, group: 'Best' },+ { value: 'flux1-dev.safetensors', label: 'flux1 dev', group: 'Older models' },+ ]+ const rows = () => screen.queryAllByRole('option').filter((o) => o.textContent?.includes('OfficialComfy'))++ it('shows it once, and still once after typing "tur" letter by letter', () => {+ vi.spyOn(console, 'error').mockImplementation(() => {})+ render(<Select ariaLabel="Model" searchable options={options} value={KREA} onChange={() => {}} />)+ fireEvent.click(screen.getByRole('button', { name: 'Model' }))+ expect(rows()).toHaveLength(1)+ const search = screen.getByPlaceholderText('Search...')+ for (const q of ['t', 'tu', 'tur']) {+ fireEvent.change(search, { target: { value: q } })+ expect(rows()).toHaveLength(1)+ }+ // Negative control: the search still narrows and finds the others.+ expect(screen.queryAllByRole('option').map((o) => o.textContent)).toEqual(+ expect.arrayContaining([expect.stringContaining('krea2Turbo18For'), expect.stringContaining('krealism')]),+ )+ expect(screen.queryAllByRole('option').some((o) => o.textContent?.includes('flux1'))).toBe(false)+ })+})