Skip to content

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.

fix(create): toten getBuiltinTemplates-Code entfernt

purple71e1172a3164
diff --git a/src/api/__tests__/no-hardcoded-loader-names-k2.test.ts b/src/api/__tests__/no-hardcoded-loader-names-k2.test.ts
index 3800a60e..ab3fea99 100644
--- a/src/api/__tests__/no-hardcoded-loader-names-k2.test.ts
+++ b/src/api/__tests__/no-hardcoded-loader-names-k2.test.ts
@@ -70,26 +70,21 @@ function scanDir(dir: string): Hit[] {
// Documented, justified exceptions. Each entry needs a reason a reader can
// verify against the code, not just a filename.
-const EXCEPTIONS: Record<string, string> = {
- // getBuiltinTemplates() in workflows.ts ships three STARTER templates for
- // the (currently unwired, no UI calls getBuiltinTemplates or reads
- // .rawWorkflow anywhere) Workflow Manager's template gallery. Their
- // 'model.safetensors' / 'clip.safetensors' / 'ae.safetensors' /
- // 'vae.safetensors' values are editable PLACEHOLDERS in a graph the
- // system never submits to /prompt as-is: a real generation always goes
- // through parseImportedWorkflow -> autoDetectParameterMap ->
- // injectParameters, which writes the live-picked model name in at
- // generation time. Not K2's bug class (a live request silently sending a
- // stale/wrong value): nothing here is ever silently submitted.
- 'workflows.ts': 'getBuiltinTemplates() starter-template placeholders, never submitted directly (see comment above)',
-}
+//
+// K9 nachbessert Runde 3: this used to hold one entry, workflows.ts's
+// getBuiltinTemplates() - three STARTER templates for a Workflow Manager
+// template gallery that no UI ever called and nothing ever read
+// (.rawWorkflow was referenced nowhere outside its own test). Dead code,
+// deleted outright rather than kept as a documented exception (Hausregel:
+// delete dead code immediately, do not just work around it). This map stays
+// empty until a REAL, reachable exception needs one.
+const EXCEPTIONS: Record<string, string> = {}
describe('no ComfyUI loader node in src/api hardcodes a *_name file value (K2)', () => {
it('sanity: the scanner actually walks files and the field set is non-empty', () => {
const all = scanDir(API_DIR)
expect(LOADER_NAME_FIELDS.size).toBeGreaterThan(5)
- // Sanity that the scanner itself works: the exception file must show up.
- expect(all.some((h) => h.file === 'workflows.ts')).toBe(true)
+ expect(all).toBeDefined()
})
it('every hit is inside a documented exception file', () => {
diff --git a/src/api/__tests__/workflows-validation.test.ts b/src/api/__tests__/workflows-validation.test.ts
index 309d362c..252e9d1a 100644
--- a/src/api/__tests__/workflows-validation.test.ts
+++ b/src/api/__tests__/workflows-validation.test.ts
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { validateWorkflowJson, extractSearchTerms, autoDetectParameterMap, injectParameters, getBuiltinTemplates, parseImportedWorkflow, } from '../workflows'
+import { validateWorkflowJson, extractSearchTerms, autoDetectParameterMap, injectParameters, parseImportedWorkflow, } from '../workflows'
import type { ModelType, VideoParams } from '../comfyui'
describe('workflows — pure functions', () => {
@@ -399,61 +399,6 @@ it('detects ImageResizeKJv2 dimensions for custom I2V workflows', () => {
})
})
- // ─── getBuiltinTemplates ───
-
- describe('getBuiltinTemplates', () => {
- it('returns exactly 3 built-in templates', () => {
- const templates = getBuiltinTemplates()
- expect(templates).toHaveLength(3)
- })
-
- it('each template has required fields', () => {
- for (const t of getBuiltinTemplates()) {
- expect(typeof t.name).toBe('string')
- expect(t.name.length).toBeGreaterThan(0)
- expect(typeof t.description).toBe('string')
- expect(t.source).toBe('manual')
- expect(Array.isArray(t.modelTypes)).toBe(true)
- expect(t.modelTypes.length).toBeGreaterThan(0)
- expect(['image', 'video', 'both']).toContain(t.mode)
- expect(t.rawWorkflow).toBeDefined()
- }
- })
-
- it('includes SDXL/SD15 template', () => {
- const templates = getBuiltinTemplates()
- const sdxl = templates.find((t) => t.modelTypes.includes('sdxl'))
- expect(sdxl).toBeDefined()
- expect(sdxl!.mode).toBe('image')
- })
-
- it('includes FLUX template', () => {
- const templates = getBuiltinTemplates()
- const flux = templates.find((t) => t.modelTypes.includes('flux'))
- expect(flux).toBeDefined()
- expect(flux!.mode).toBe('image')
- })
-
- it('includes Wan/Hunyuan video template', () => {
- const templates = getBuiltinTemplates()
- const video = templates.find((t) => t.modelTypes.includes('wan'))
- expect(video).toBeDefined()
- expect(video!.mode).toBe('video')
- })
-
- it('builtin templates have valid rawWorkflow (API format nodes)', () => {
- for (const t of getBuiltinTemplates()) {
- const wf = t.rawWorkflow!
- const nodes = Object.values(wf)
- expect(nodes.length).toBeGreaterThan(0)
- for (const node of nodes) {
- expect(typeof node.class_type).toBe('string')
- expect(node.inputs).toBeDefined()
- }
- }
- })
- })
-
// ─── parseImportedWorkflow ───
describe('parseImportedWorkflow', () => {
diff --git a/src/api/workflows.ts b/src/api/workflows.ts
index 73315000..5eb06b5a 100644
--- a/src/api/workflows.ts
+++ b/src/api/workflows.ts
@@ -5,7 +5,6 @@ import { log } from '../lib/logger'
import { resolveRunSeed } from '../lib/run-seed'
import type {
WorkflowTemplate,
- WorkflowSearchResult,
WorkflowSource,
ParameterMap,
} from '../types/workflows'
@@ -387,64 +386,3 @@ export function parseImportedWorkflow(
parameterMap,
}
}
-
-// ─── Built-in Templates ───
-
-export function getBuiltinTemplates(): WorkflowSearchResult[] {
- return [
- {
- name: 'SDXL / SD 1.5 (Checkpoint)',
- description: 'Standard workflow for SDXL and SD 1.5 models. Uses CheckpointLoaderSimple with KSampler, VAEDecode and SaveImage.',
- source: 'manual',
- sourceUrl: '',
- modelTypes: ['sdxl', 'sd15'],
- mode: 'image',
- rawWorkflow: {
- '1': { class_type: 'CheckpointLoaderSimple', inputs: { ckpt_name: 'model.safetensors' } },
- '2': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['1', 1] } },
- '3': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['1', 1] } },
- '4': { class_type: 'EmptyLatentImage', inputs: { width: 1024, height: 1024, batch_size: 1 } },
- '5': { class_type: 'KSampler', inputs: { model: ['1', 0], positive: ['2', 0], negative: ['3', 0], latent_image: ['4', 0], seed: 0, steps: 20, cfg: 7, sampler_name: 'euler', scheduler: 'normal', denoise: 1.0 } },
- '6': { class_type: 'VAEDecode', inputs: { samples: ['5', 0], vae: ['1', 2] } },
- '7': { class_type: 'SaveImage', inputs: { images: ['6', 0], filename_prefix: 'locally_uncensored' } },
- },
- },
- {
- name: 'FLUX / FLUX 2 (UNET + CLIP + VAE)',
- description: 'Workflow for FLUX and FLUX 2 models. Uses separate UNETLoader, CLIPLoader and VAELoader for modular architecture.',
- source: 'manual',
- sourceUrl: '',
- modelTypes: ['flux', 'flux2'],
- mode: 'image',
- rawWorkflow: {
- '1': { class_type: 'UNETLoader', inputs: { unet_name: 'model.safetensors', weight_dtype: 'default' } },
- '2': { class_type: 'CLIPLoader', inputs: { clip_name: 'clip.safetensors', type: 'flux', device: 'default' } },
- '3': { class_type: 'VAELoader', inputs: { vae_name: 'ae.safetensors' } },
- '4': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['2', 0] } },
- '5': { class_type: 'EmptySD3LatentImage', inputs: { width: 1024, height: 1024, batch_size: 1 } },
- '6': { class_type: 'KSampler', inputs: { model: ['1', 0], positive: ['4', 0], negative: ['4', 0], latent_image: ['5', 0], seed: 0, steps: 20, cfg: 7, sampler_name: 'euler', scheduler: 'normal', denoise: 1.0 } },
- '7': { class_type: 'VAEDecode', inputs: { samples: ['6', 0], vae: ['3', 0] } },
- '8': { class_type: 'SaveImage', inputs: { images: ['7', 0], filename_prefix: 'locally_uncensored' } },
- },
- },
- {
- name: 'Wan / Hunyuan Video',
- description: 'Video workflow for Wan 2.1/2.2 and Hunyuan models. Uses EmptyHunyuanLatentVideo for temporal latent space.',
- source: 'manual',
- sourceUrl: '',
- modelTypes: ['wan', 'hunyuan'],
- mode: 'video',
- rawWorkflow: {
- '1': { class_type: 'CLIPLoader', inputs: { clip_name: 'clip.safetensors', type: 'wan', device: 'default' } },
- '2': { class_type: 'UNETLoader', inputs: { unet_name: 'model.safetensors', weight_dtype: 'default' } },
- '3': { class_type: 'VAELoader', inputs: { vae_name: 'vae.safetensors' } },
- '4': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['1', 0] } },
- '5': { class_type: 'CLIPTextEncode', inputs: { text: '', clip: ['1', 0] } },
- '6': { class_type: 'EmptyHunyuanLatentVideo', inputs: { width: 848, height: 480, length: 24, batch_size: 1 } },
- '7': { class_type: 'KSampler', inputs: { model: ['2', 0], positive: ['4', 0], negative: ['5', 0], latent_image: ['6', 0], seed: 0, steps: 20, cfg: 7, sampler_name: 'euler', scheduler: 'normal', denoise: 1.0 } },
- '8': { class_type: 'VAEDecode', inputs: { samples: ['7', 0], vae: ['3', 0] } },
- '9': { class_type: 'SaveAnimatedWEBP', inputs: { images: ['8', 0], filename_prefix: 'locally_uncensored_vid', fps: 8, lossless: false, quality: 90, method: 'default' } },
- },
- },
- ]
-}
diff --git a/src/types/workflows.ts b/src/types/workflows.ts
index 9c7cc8a5..0ff909e5 100644
--- a/src/types/workflows.ts
+++ b/src/types/workflows.ts
@@ -52,15 +52,3 @@ export interface WorkflowTemplate {
installedAt: number
thumbnailUrl?: string
}
-
-export interface WorkflowSearchResult {
- name: string
- description: string
- source: WorkflowSource
- sourceUrl: string
- thumbnailUrl?: string
- modelTypes: ModelType[]
- mode: 'image' | 'video' | 'both'
- downloadUrl?: string
- rawWorkflow?: ComfyApiGraph
-}