mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-06 14:10:13 -03:00
fix(workflow): accept non-string widget values and support GlobalSeed node in gen-params (#1026)
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
parseCombinedSamplerName,
|
||||
resolveSamplerScheduler,
|
||||
findMatchingWidgets,
|
||||
NODE_TYPE_WIDGET_OVERRIDES,
|
||||
} from '../../../static/js/utils/genParamsMapper.js';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -243,4 +244,53 @@ describe('findMatchingWidgets', () => {
|
||||
const updates = findMatchingWidgets(['seed', 'steps', 'cfg', 'sampler_name', 'scheduler'], resolved);
|
||||
expect(updates.map(u => u.widgetName)).toEqual(['seed', 'steps', 'cfg', 'sampler_name', 'scheduler']);
|
||||
});
|
||||
|
||||
// --- node-type-specific overrides ---
|
||||
it('matches GlobalSeed //Inspire value widget for seed param', () => {
|
||||
const updates = findMatchingWidgets(
|
||||
['value', 'mode', 'action', 'last_seed'],
|
||||
{ seed: 42 },
|
||||
'GlobalSeed //Inspire'
|
||||
);
|
||||
expect(updates).toHaveLength(1);
|
||||
expect(updates[0]).toEqual({ widgetName: 'value', value: 42 });
|
||||
});
|
||||
|
||||
it('ignores nodeType when it does not match any override entry', () => {
|
||||
const updates = findMatchingWidgets(
|
||||
['value', 'mode', 'action', 'last_seed'],
|
||||
{ seed: 42 },
|
||||
'SomeOtherNode'
|
||||
);
|
||||
expect(updates).toEqual([]);
|
||||
});
|
||||
|
||||
it('still falls back to global candidates when override candidates do not match', () => {
|
||||
// GlobalSeed override does not include steps — should use global candidate "steps"
|
||||
const updates = findMatchingWidgets(
|
||||
['steps', 'cfg', 'sampler_name'],
|
||||
{ steps: 20 },
|
||||
'GlobalSeed //Inspire'
|
||||
);
|
||||
expect(updates).toHaveLength(1);
|
||||
expect(updates[0]).toEqual({ widgetName: 'steps', value: 20 });
|
||||
});
|
||||
|
||||
it('prefers overrides when both override and global candidates match', () => {
|
||||
// If a hypothetical node has both "value" and "seed" widgets AND a
|
||||
// GlobalSeed override, the override candidate "value" should take precedence
|
||||
const updates = findMatchingWidgets(
|
||||
['seed', 'noise_seed', 'value', 'mode'],
|
||||
{ seed: 99 },
|
||||
'GlobalSeed //Inspire'
|
||||
);
|
||||
expect(updates).toHaveLength(1);
|
||||
expect(updates[0].widgetName).toBe('value');
|
||||
});
|
||||
|
||||
it('omits nodeType argument and still matches via global candidates', () => {
|
||||
const updates = findMatchingWidgets(['seed', 'steps', 'cfg'], { seed: 7 });
|
||||
expect(updates).toHaveLength(1);
|
||||
expect(updates[0]).toEqual({ widgetName: 'seed', value: 7 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user