feat(loras): warn when widget strength leaves the usage-tips range

The cycler-list payload now carries usage_tips, and the LORAS widget
parses strength_min/strength_max/strength_range into a cached lookup.
Strength inputs (model and clip) turn amber with an explanatory tooltip
when dragged, typed, or stepped outside the recommended range.

Related: https://github.com/willmiao/ComfyUI-Lora-Manager/issues/1090
This commit is contained in:
Will Miao
2026-09-19 05:49:01 +08:00
parent 3b9e8efb3d
commit c8c84bfc54
7 changed files with 584 additions and 8 deletions
+6 -1
View File
@@ -1,7 +1,7 @@
import { api } from "../../scripts/api.js";
import { app } from "../../scripts/app.js";
import { createMenuItem, createDropIndicator } from "./loras_widget_components.js";
import { parseLoraValue, formatLoraValue, syncClipStrengthIfCollapsed, saveRecipeDirectly, copyToClipboard, showToast, moveLoraByDirection, getDropTargetIndex } from "./loras_widget_utils.js";
import { parseLoraValue, formatLoraValue, syncClipStrengthIfCollapsed, saveRecipeDirectly, copyToClipboard, showToast, moveLoraByDirection, getDropTargetIndex, getLoraStrengthRange, applyStrengthRangeCue } from "./loras_widget_utils.js";
// Function to handle strength adjustment via dragging
export function handleStrengthDrag(name, initialStrength, initialX, event, widget, isClipStrength = false, updateWidget = true) {
@@ -194,6 +194,7 @@ export function initDrag(
const strengthInput = currentDragElement.querySelector('.lm-lora-strength-input');
if (strengthInput && typeof newStrength === 'number') {
strengthInput.value = newStrength.toFixed(2);
applyStrengthRangeCue(strengthInput, newStrength, getLoraStrengthRange(name));
}
// Prevent showing the preview tooltip during drag
@@ -335,6 +336,10 @@ export function initHeaderDrag(headerEl, widget, renderFunction) {
if (lorasData[index]) {
input.value = lorasData[index].strength.toFixed(2);
}
const entryEl = input.closest('[data-lora-name]');
if (entryEl) {
applyStrengthRangeCue(input, input.value, getLoraStrengthRange(entryEl.dataset.loraName));
}
});
});