feat: Enhance WanVideoLoraSelect with improved low_mem_load and merge_loras options for better LORA management, see #363

This commit is contained in:
Will Miao
2025-08-18 15:05:57 +08:00
parent ca692ed0f2
commit 9c45d9db6c
2 changed files with 12 additions and 7 deletions

View File

@@ -30,12 +30,12 @@ app.registerExtension({
// Restore saved value if exists
let existingLoras = [];
if (this.widgets_values && this.widgets_values.length > 0) {
// 0 for low_mem_load, 1 for text widget, 2 for loras widget
const savedValue = this.widgets_values[2];
// 0 for low_mem_load, 1 for merge_loras, 2 for text widget, 3 for loras widget
const savedValue = this.widgets_values[3];
existingLoras = savedValue || [];
}
// Merge the loras data
const mergedLoras = mergeLoras(this.widgets[1].value, existingLoras);
const mergedLoras = mergeLoras(this.widgets[2].value, existingLoras);
// Add flag to prevent callback loops
let isUpdating = false;
@@ -49,7 +49,7 @@ app.registerExtension({
try {
// Remove loras that are not in the value array
const inputWidget = this.widgets[1];
const inputWidget = this.widgets[2];
const currentLoras = value.map(l => l.name);
// Use the constant pattern here as well
@@ -79,7 +79,7 @@ app.registerExtension({
this.lorasWidget = result.widget;
// Update input widget callback
const inputWidget = this.widgets[1];
const inputWidget = this.widgets[2];
inputWidget.options.getMaxHeight = () => 100;
this.inputWidget = inputWidget;
// Wrap the callback with autocomplete setup