mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
fix(randomizer): Initialize RANDOMIZER_CONFIG widget with default config
Initialize internalValue with default RandomizerConfig object instead of undefined to prevent frontend from sending empty string to backend when widget is first created. This fixes the 'str' object has no attribute 'get' error that occurred when running a newly created Lora Randomizer node before any user interaction. Fixes #4
This commit is contained in:
@@ -147,7 +147,23 @@ function createLoraRandomizerWidget(node) {
|
||||
|
||||
forwardMiddleMouseToCanvas(container)
|
||||
|
||||
let internalValue: RandomizerConfig | undefined
|
||||
// Initialize with default config to avoid sending undefined/empty string to backend
|
||||
const defaultConfig: RandomizerConfig = {
|
||||
count_mode: 'range',
|
||||
count_fixed: 3,
|
||||
count_min: 2,
|
||||
count_max: 5,
|
||||
model_strength_min: 0.0,
|
||||
model_strength_max: 1.0,
|
||||
use_same_clip_strength: true,
|
||||
clip_strength_min: 0.0,
|
||||
clip_strength_max: 1.0,
|
||||
roll_mode: 'fixed',
|
||||
use_recommended_strength: false,
|
||||
recommended_strength_scale_min: 0.5,
|
||||
recommended_strength_scale_max: 1.0,
|
||||
}
|
||||
let internalValue: RandomizerConfig = defaultConfig
|
||||
|
||||
const widget = node.addDOMWidget(
|
||||
'randomizer_config',
|
||||
|
||||
@@ -14695,7 +14695,22 @@ function createLoraRandomizerWidget(node) {
|
||||
container.style.flexDirection = "column";
|
||||
container.style.overflow = "hidden";
|
||||
forwardMiddleMouseToCanvas(container);
|
||||
let internalValue;
|
||||
const defaultConfig = {
|
||||
count_mode: "range",
|
||||
count_fixed: 3,
|
||||
count_min: 2,
|
||||
count_max: 5,
|
||||
model_strength_min: 0,
|
||||
model_strength_max: 1,
|
||||
use_same_clip_strength: true,
|
||||
clip_strength_min: 0,
|
||||
clip_strength_max: 1,
|
||||
roll_mode: "fixed",
|
||||
use_recommended_strength: false,
|
||||
recommended_strength_scale_min: 0.5,
|
||||
recommended_strength_scale_max: 1
|
||||
};
|
||||
let internalValue = defaultConfig;
|
||||
const widget = node.addDOMWidget(
|
||||
"randomizer_config",
|
||||
"RANDOMIZER_CONFIG",
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user