Skip to content

Commit 81d4dbe

Browse files
committed
better handling of model inputs
1 parent adc9782 commit 81d4dbe

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/BuiltinExtensions/ComfyUIBackend/Assets/comfy_workflow_editor_helper.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,21 @@ function comfyBuildParams(callback) {
393393
if (node.class_type.startsWith('SwarmInput') && node.class_type != 'SwarmInputGroup') {
394394
let type = '';
395395
let subtype = null;
396+
let defaultVal = node.inputs['value'];
396397
switch (node.class_type) {
397398
case 'SwarmInputInteger': type = 'integer'; break;
398399
case 'SwarmInputFloat': type = 'decimal'; break;
399400
case 'SwarmInputText': type = 'text'; break;
400-
case 'SwarmInputModelName': type = 'model'; subtype = node.inputs['subtype']; break;
401-
case 'SwarmInputCheckpoint': type = 'model'; subtype = 'Stable-Diffusion'; break;
401+
case 'SwarmInputModelName':
402+
type = 'model';
403+
subtype = node.inputs['subtype'];
404+
defaultVal = defaultVal.replaceAll('\\', '/').replaceAll('.safetensors', '');
405+
break;
406+
case 'SwarmInputCheckpoint':
407+
type = 'model';
408+
subtype = 'Stable-Diffusion';
409+
defaultVal = defaultVal.replaceAll('\\', '/').replaceAll('.safetensors', '');
410+
break;
402411
case 'SwarmInputDropdown': type = 'dropdown'; break;
403412
case 'SwarmInputBoolean': type = 'boolean'; break;
404413
case 'SwarmInputImage': type = 'image'; break;
@@ -429,7 +438,7 @@ function comfyBuildParams(callback) {
429438
type: type,
430439
subtype: subtype,
431440
description: node.inputs['description'],
432-
default: node.inputs['value'],
441+
default: defaultVal,
433442
values: type == 'dropdown' ? node.inputs['values'].split(',').map(s => s.trim()) : null,
434443
view_type: node.inputs['view_type'],
435444
min: node.inputs['min'] || 0,

0 commit comments

Comments
 (0)