Преглед изворни кода

feat: browse models on the loader nodes and their component fields

Load Model and Load Upscaler took a model as free text, which only worked if you
already knew the exact file name. Both now have the Browse list.

Each component field lists its own kind rather than everything: VAE lists vaes,
CLIP-L and CLIP-G list clip models, T5-XXL lists t5, LLM lists llm, TAESD lists
taesd, ControlNet lists controlnets. Load Upscaler lists esrgan.

Load Model's own Model field is the exception - it follows that node's Model
Type setting instead of pinning a kind, so choosing diffusion lists diffusion
models. When Model Type is left on auto-detect the picker falls back to
checkpoints, which is what it already did.

Verified against the live server through the options endpoint: 22 vae models
returned for the VAE field's kind.
fszontagh пре 1 месец
родитељ
комит
50ac356d7c
2 измењених фајлова са 111 додато и 9 уклоњено
  1. 101 8
      nodes/sdcpp/sdcpp-model-load.js
  2. 10 1
      nodes/sdcpp/sdcpp-upscaler-load.js

+ 101 - 8
nodes/sdcpp/sdcpp-model-load.js

@@ -22,7 +22,16 @@ const configSchema = {
         },
         modelName: {
             type: 'string', title: 'Model',
-            description: 'File name of the model, relative to its type directory. Usually supplied by an SD.cpp Model node rather than typed here'
+            description: 'File name of the model, relative to its type directory. Browse lists what the server has of the Model Type chosen below',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
         },
         modelType: {
             type: 'string', title: 'Model Type',
@@ -30,13 +39,97 @@ const configSchema = {
             default: '',
             description: 'checkpoint bundles U-Net, CLIP and VAE and suits SD1, SD2 and SDXL. diffusion holds only the U-Net or DiT and needs its components named separately, which is how Flux, SD3, Qwen, Wan and Z-Image load'
         },
-        vae: { type: 'string', title: 'VAE', description: 'Component file name' },
-        clipL: { type: 'string', title: 'CLIP-L', description: 'Component file name' },
-        clipG: { type: 'string', title: 'CLIP-G', description: 'Component file name' },
-        t5xxl: { type: 'string', title: 'T5-XXL', description: 'Component file name' },
-        llm: { type: 'string', title: 'LLM', description: 'Component file name, used by Z-Image, Qwen, Anima and Flux2' },
-        taesd: { type: 'string', title: 'TAESD', description: 'Tiny autoencoder for progress previews' },
-        controlnet: { type: 'string', title: 'ControlNet', description: 'Component file name' },
+        vae: {
+            type: 'string', title: 'VAE',
+            description: 'Component file name',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'vae' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        clipL: {
+            type: 'string', title: 'CLIP-L',
+            description: 'Component file name',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'clip' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        clipG: {
+            type: 'string', title: 'CLIP-G',
+            description: 'Component file name',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'clip' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        t5xxl: {
+            type: 'string', title: 'T5-XXL',
+            description: 'Component file name',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 't5' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        llm: {
+            type: 'string', title: 'LLM',
+            description: 'Component file name, used by Z-Image, Qwen, Anima and Flux2',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'llm' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        taesd: {
+            type: 'string', title: 'TAESD',
+            description: 'Tiny autoencoder for progress previews',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'taesd' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
+        controlnet: {
+            type: 'string', title: 'ControlNet',
+            description: 'Component file name',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'controlnet' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
+        },
         options: {
             type: 'object', title: 'Load Options',
             description: 'Extra load options passed through, such as flash_attn, enable_mmap, weight_type, stream_layers or max_vram'

+ 10 - 1
nodes/sdcpp/sdcpp-upscaler-load.js

@@ -22,7 +22,16 @@ const configSchema = {
         },
         modelName: {
             type: 'string', title: 'Upscaler',
-            description: 'File name of the ESRGAN-family upscaler. Usually supplied by an SD.cpp Model node set to type esrgan'
+            description: 'File name of the ESRGAN-family upscaler. Browse lists what the server has',
+            dynamicOptions: {
+                source: 'node',
+                node: 'sdcpp-model',
+                config: { listOnly: true, modelType: 'esrgan' },
+                itemsPath: 'models',
+                valueKey: 'name',
+                labelKey: 'name',
+                needs: ['serverUrl', 'credentialId']
+            }
         },
         force: {
             type: 'boolean', title: 'Force Reload',