feat: add "Respect Recommended Strength" feature to LoRA Randomizer

Add support for respecting recommended strength values from LoRA usage_tips
when randomizing LoRA selection.

Features:
- New toggle setting to enable/disable recommended strength respect (default off)
- Scale range slider (0-2, default 0.5-1.0) to adjust recommended values
- Uses recommended strength × random(scale) when feature enabled
- Fallbacks to original Model/Clip Strength range when no recommendation exists
- Clip strength recommendations only apply when using Custom Range mode

Backend changes:
- Parse usage_tips JSON string to extract strength/clipStrength
- Apply scale factor to recommended values during randomization
- Pass new parameters through API route and node

Frontend changes:
- Update RandomizerConfig type with new properties
- Add new UI section with toggle and dual-range slider
- Wire up state management and event handlers
- No layout shift (removed description text)

Tests:
- Add tests for enabled/disabled recommended strength in API routes
- Add test verifying config passed to service
- All existing tests pass

Build: Include compiled Vue widgets
This commit is contained in:
Will Miao
2026-01-14 16:34:24 +08:00
parent 4951ff358e
commit fc8240e99e
12 changed files with 441 additions and 85 deletions

View File

@@ -152,6 +152,15 @@ class LoraRandomizerNode:
use_same_clip_strength = randomizer_config.get("use_same_clip_strength", True) use_same_clip_strength = randomizer_config.get("use_same_clip_strength", True)
clip_strength_min = randomizer_config.get("clip_strength_min", 0.0) clip_strength_min = randomizer_config.get("clip_strength_min", 0.0)
clip_strength_max = randomizer_config.get("clip_strength_max", 1.0) clip_strength_max = randomizer_config.get("clip_strength_max", 1.0)
use_recommended_strength = randomizer_config.get(
"use_recommended_strength", False
)
recommended_strength_scale_min = randomizer_config.get(
"recommended_strength_scale_min", 0.5
)
recommended_strength_scale_max = randomizer_config.get(
"recommended_strength_scale_max", 1.0
)
# Extract locked LoRAs from input # Extract locked LoRAs from input
locked_loras = [lora for lora in input_loras if lora.get("locked", False)] locked_loras = [lora for lora in input_loras if lora.get("locked", False)]
@@ -170,6 +179,9 @@ class LoraRandomizerNode:
count_mode=count_mode, count_mode=count_mode,
count_min=count_min, count_min=count_min,
count_max=count_max, count_max=count_max,
use_recommended_strength=use_recommended_strength,
recommended_strength_scale_min=recommended_strength_scale_min,
recommended_strength_scale_max=recommended_strength_scale_max,
) )
return result_loras return result_loras

View File

@@ -225,6 +225,13 @@ class LoraRoutes(BaseModelRoutes):
clip_strength_max = float(json_data.get("clip_strength_max", 1.0)) clip_strength_max = float(json_data.get("clip_strength_max", 1.0))
locked_loras = json_data.get("locked_loras", []) locked_loras = json_data.get("locked_loras", [])
pool_config = json_data.get("pool_config") pool_config = json_data.get("pool_config")
use_recommended_strength = json_data.get("use_recommended_strength", False)
recommended_strength_scale_min = float(
json_data.get("recommended_strength_scale_min", 0.5)
)
recommended_strength_scale_max = float(
json_data.get("recommended_strength_scale_max", 1.0)
)
# Determine target count # Determine target count
if count_min is not None and count_max is not None: if count_min is not None and count_max is not None:
@@ -260,6 +267,9 @@ class LoraRoutes(BaseModelRoutes):
clip_strength_max=clip_strength_max, clip_strength_max=clip_strength_max,
locked_loras=locked_loras, locked_loras=locked_loras,
pool_config=pool_config, pool_config=pool_config,
use_recommended_strength=use_recommended_strength,
recommended_strength_scale_min=recommended_strength_scale_min,
recommended_strength_scale_max=recommended_strength_scale_max,
) )
return web.json_response( return web.json_response(

View File

@@ -228,6 +228,9 @@ class LoraService(BaseModelService):
count_mode: str = "fixed", count_mode: str = "fixed",
count_min: int = 3, count_min: int = 3,
count_max: int = 7, count_max: int = 7,
use_recommended_strength: bool = False,
recommended_strength_scale_min: float = 0.5,
recommended_strength_scale_max: float = 1.0,
) -> List[Dict]: ) -> List[Dict]:
""" """
Get random LoRAs with specified strength ranges. Get random LoRAs with specified strength ranges.
@@ -244,11 +247,37 @@ class LoraService(BaseModelService):
count_mode: How to determine count ('fixed' or 'range') count_mode: How to determine count ('fixed' or 'range')
count_min: Minimum count for range mode count_min: Minimum count for range mode
count_max: Maximum count for range mode count_max: Maximum count for range mode
use_recommended_strength: Whether to use recommended strength from usage_tips
recommended_strength_scale_min: Minimum scale factor for recommended strength
recommended_strength_scale_max: Maximum scale factor for recommended strength
Returns: Returns:
List of LoRA dicts with randomized strengths List of LoRA dicts with randomized strengths
""" """
import random import random
import json
def get_recommended_strength(lora_data: Dict) -> Optional[float]:
"""Parse usage_tips JSON and extract recommended strength"""
try:
usage_tips = lora_data.get("usage_tips", "")
if not usage_tips:
return None
tips_data = json.loads(usage_tips)
return tips_data.get("strength")
except (json.JSONDecodeError, TypeError, AttributeError):
return None
def get_recommended_clip_strength(lora_data: Dict) -> Optional[float]:
"""Parse usage_tips JSON and extract recommended clip strength"""
try:
usage_tips = lora_data.get("usage_tips", "")
if not usage_tips:
return None
tips_data = json.loads(usage_tips)
return tips_data.get("clipStrength")
except (json.JSONDecodeError, TypeError, AttributeError):
return None
if locked_loras is None: if locked_loras is None:
locked_loras = [] locked_loras = []
@@ -296,10 +325,35 @@ class LoraService(BaseModelService):
# Generate random strengths for selected LoRAs # Generate random strengths for selected LoRAs
result_loras = [] result_loras = []
for lora in selected: for lora in selected:
model_str = round(random.uniform(model_strength_min, model_strength_max), 2) if use_recommended_strength:
recommended_strength = get_recommended_strength(lora)
if recommended_strength is not None:
scale = random.uniform(
recommended_strength_scale_min, recommended_strength_scale_max
)
model_str = round(recommended_strength * scale, 2)
else:
model_str = round(
random.uniform(model_strength_min, model_strength_max), 2
)
else:
model_str = round(
random.uniform(model_strength_min, model_strength_max), 2
)
if use_same_clip_strength: if use_same_clip_strength:
clip_str = model_str clip_str = model_str
elif use_recommended_strength:
recommended_clip_strength = get_recommended_clip_strength(lora)
if recommended_clip_strength is not None:
scale = random.uniform(
recommended_strength_scale_min, recommended_strength_scale_max
)
clip_str = round(recommended_clip_strength * scale, 2)
else:
clip_str = round(
random.uniform(clip_strength_min, clip_strength_max), 2
)
else: else:
clip_str = round( clip_str = round(
random.uniform(clip_strength_min, clip_strength_max), 2 random.uniform(clip_strength_min, clip_strength_max), 2

View File

@@ -51,6 +51,9 @@ def randomizer_config_fixed():
"clip_strength_min": 0.5, "clip_strength_min": 0.5,
"clip_strength_max": 1.0, "clip_strength_max": 1.0,
"roll_mode": "fixed", "roll_mode": "fixed",
"use_recommended_strength": False,
"recommended_strength_scale_min": 0.5,
"recommended_strength_scale_max": 1.0,
} }
@@ -68,6 +71,9 @@ def randomizer_config_always():
"clip_strength_min": 0.5, "clip_strength_min": 0.5,
"clip_strength_max": 1.0, "clip_strength_max": 1.0,
"roll_mode": "always", "roll_mode": "always",
"use_recommended_strength": False,
"recommended_strength_scale_min": 0.5,
"recommended_strength_scale_max": 1.0,
} }
@@ -319,3 +325,81 @@ async def test_execution_stack_always_from_input_loras_not_ui_loras(
assert execution_stack[0][2] == 0.8 assert execution_stack[0][2] == 0.8
assert execution_stack[1][1] == 0.6 assert execution_stack[1][1] == 0.6
assert execution_stack[1][2] == 0.6 assert execution_stack[1][2] == 0.6
@pytest.fixture
def randomizer_config_with_recommended_strength():
"""Randomizer config with recommended strength enabled"""
return {
"count_mode": "fixed",
"count_fixed": 3,
"count_min": 2,
"count_max": 5,
"model_strength_min": 0.5,
"model_strength_max": 1.0,
"use_same_clip_strength": True,
"clip_strength_min": 0.5,
"clip_strength_max": 1.0,
"roll_mode": "always",
"use_recommended_strength": True,
"recommended_strength_scale_min": 0.6,
"recommended_strength_scale_max": 0.8,
}
@pytest.mark.asyncio
async def test_recommended_strength_config_passed_to_service(
randomizer_node,
sample_loras,
randomizer_config_with_recommended_strength,
mock_scanner,
monkeypatch,
):
"""Test that recommended strength config is passed to service when enabled"""
from py.services.lora_service import LoraService
from unittest.mock import AsyncMock, patch
# Mock LoraService.get_random_loras to verify parameters
mock_get_random_loras = AsyncMock(
return_value=[
{
"name": "new_lora.safetensors",
"strength": 0.7,
"clipStrength": 0.7,
"active": True,
"expanded": False,
"locked": False,
}
]
)
with patch.object(LoraService, "__init__", return_value=None):
with patch.object(LoraService, "get_random_loras", mock_get_random_loras):
monkeypatch.setattr(
service_registry.ServiceRegistry,
"get_lora_scanner",
AsyncMock(return_value=mock_scanner),
)
mock_scanner._cache.raw_data = [
{
"file_name": "new_lora.safetensors",
"file_path": "/path/to/new_lora.safetensors",
"folder": "",
}
]
result = await randomizer_node.randomize(
randomizer_config_with_recommended_strength,
sample_loras,
pool_config=None,
)
# Verify service was called
assert mock_get_random_loras.called
# Verify recommended strength parameters were passed
call_kwargs = mock_get_random_loras.call_args[1]
assert call_kwargs["use_recommended_strength"] is True
assert call_kwargs["recommended_strength_scale_min"] == 0.6
assert call_kwargs["recommended_strength_scale_max"] == 0.8

View File

@@ -21,8 +21,10 @@ class StubLoraService:
def __init__(self): def __init__(self):
self.random_loras = [] self.random_loras = []
self.last_get_random_loras_kwargs = {}
async def get_random_loras(self, **kwargs): async def get_random_loras(self, **kwargs):
self.last_get_random_loras_kwargs = kwargs
return self.random_loras return self.random_loras
@@ -201,3 +203,56 @@ async def test_get_random_loras_error(routes, monkeypatch):
assert response.status == 500 assert response.status == 500
assert payload["success"] is False assert payload["success"] is False
assert "error" in payload assert "error" in payload
async def test_get_random_loras_with_recommended_strength_enabled(routes):
"""Test random LoRAs with recommended strength feature enabled"""
request = DummyRequest(
json_data={
"count": 5,
"model_strength_min": 0.5,
"model_strength_max": 1.0,
"use_same_clip_strength": True,
"use_recommended_strength": True,
"recommended_strength_scale_min": 0.6,
"recommended_strength_scale_max": 0.8,
"locked_loras": [],
}
)
response = await routes.get_random_loras(request)
payload = json.loads(response.text)
assert response.status == 200
assert payload["success"] is True
# Verify parameters were passed to service
kwargs = routes.service.last_get_random_loras_kwargs
assert kwargs["use_recommended_strength"] is True
assert kwargs["recommended_strength_scale_min"] == 0.6
assert kwargs["recommended_strength_scale_max"] == 0.8
async def test_get_random_loras_with_recommended_strength_disabled(routes):
"""Test random LoRAs with recommended strength feature disabled (default)"""
request = DummyRequest(
json_data={
"count": 5,
"model_strength_min": 0.5,
"model_strength_max": 1.0,
"use_same_clip_strength": True,
"locked_loras": [],
}
)
response = await routes.get_random_loras(request)
payload = json.loads(response.text)
assert response.status == 200
assert payload["success"] is True
# Verify default parameters were passed to service
kwargs = routes.service.last_get_random_loras_kwargs
assert kwargs["use_recommended_strength"] is False
assert kwargs["recommended_strength_scale_min"] == 0.5
assert kwargs["recommended_strength_scale_max"] == 1.0

View File

@@ -16,6 +16,9 @@
:last-used="state.lastUsed.value" :last-used="state.lastUsed.value"
:current-loras="currentLoras" :current-loras="currentLoras"
:can-reuse-last="canReuseLast" :can-reuse-last="canReuseLast"
:use-recommended-strength="state.useRecommendedStrength.value"
:recommended-strength-scale-min="state.recommendedStrengthScaleMin.value"
:recommended-strength-scale-max="state.recommendedStrengthScaleMax.value"
@update:count-mode="state.countMode.value = $event" @update:count-mode="state.countMode.value = $event"
@update:count-fixed="state.countFixed.value = $event" @update:count-fixed="state.countFixed.value = $event"
@update:count-min="state.countMin.value = $event" @update:count-min="state.countMin.value = $event"
@@ -26,6 +29,9 @@
@update:clip-strength-min="state.clipStrengthMin.value = $event" @update:clip-strength-min="state.clipStrengthMin.value = $event"
@update:clip-strength-max="state.clipStrengthMax.value = $event" @update:clip-strength-max="state.clipStrengthMax.value = $event"
@update:roll-mode="state.rollMode.value = $event" @update:roll-mode="state.rollMode.value = $event"
@update:use-recommended-strength="state.useRecommendedStrength.value = $event"
@update:recommended-strength-scale-min="state.recommendedStrengthScaleMin.value = $event"
@update:recommended-strength-scale-max="state.recommendedStrengthScaleMax.value = $event"
@generate-fixed="handleGenerateFixed" @generate-fixed="handleGenerateFixed"
@always-randomize="handleAlwaysRandomize" @always-randomize="handleAlwaysRandomize"
@reuse-last="handleReuseLast" @reuse-last="handleReuseLast"

View File

@@ -73,6 +73,40 @@
</div> </div>
</div> </div>
<!-- Recommended Strength -->
<div class="setting-section">
<div class="section-header-with-toggle">
<label class="setting-label">
Respect Recommended Strength
</label>
<button
type="button"
class="toggle-switch"
:class="{ 'toggle-switch--active': useRecommendedStrength }"
@click="$emit('update:useRecommendedStrength', !useRecommendedStrength)"
role="switch"
:aria-checked="useRecommendedStrength"
title="Use recommended strength values from usage tips"
>
<span class="toggle-switch__track"></span>
<span class="toggle-switch__thumb"></span>
</button>
</div>
<div class="slider-container" :class="{ 'slider-container--disabled': !useRecommendedStrength }">
<DualRangeSlider
:min="0"
:max="2"
:value-min="recommendedStrengthScaleMin"
:value-max="recommendedStrengthScaleMax"
:step="0.1"
:default-range="{ min: 0.5, max: 1.0 }"
:disabled="!useRecommendedStrength"
@update:value-min="$emit('update:recommendedStrengthScaleMin', $event)"
@update:value-max="$emit('update:recommendedStrengthScaleMax', $event)"
/>
</div>
</div>
<!-- Clip Strength Range --> <!-- Clip Strength Range -->
<div class="setting-section"> <div class="setting-section">
<div class="section-header-with-toggle"> <div class="section-header-with-toggle">
@@ -200,6 +234,9 @@ defineProps<{
lastUsed: LoraEntry[] | null lastUsed: LoraEntry[] | null
currentLoras: LoraEntry[] currentLoras: LoraEntry[]
canReuseLast: boolean canReuseLast: boolean
useRecommendedStrength: boolean
recommendedStrengthScaleMin: number
recommendedStrengthScaleMax: number
}>() }>()
defineEmits<{ defineEmits<{
@@ -213,6 +250,9 @@ defineEmits<{
'update:clipStrengthMin': [value: number] 'update:clipStrengthMin': [value: number]
'update:clipStrengthMax': [value: number] 'update:clipStrengthMax': [value: number]
'update:rollMode': [value: 'fixed' | 'always'] 'update:rollMode': [value: 'fixed' | 'always']
'update:useRecommendedStrength': [value: boolean]
'update:recommendedStrengthScaleMin': [value: number]
'update:recommendedStrengthScaleMax': [value: number]
'generate-fixed': [] 'generate-fixed': []
'always-randomize': [] 'always-randomize': []
'reuse-last': [] 'reuse-last': []
@@ -341,6 +381,11 @@ const areLorasEqual = (a: LoraEntry[] | null, b: LoraEntry[] | null): boolean =>
padding: 4px 8px; padding: 4px 8px;
} }
.slider-container--disabled {
opacity: 0.5;
pointer-events: none;
}
/* Toggle Switch (same style as LicenseSection) */ /* Toggle Switch (same style as LicenseSection) */
.toggle-switch { .toggle-switch {
position: relative; position: relative;

View File

@@ -66,6 +66,9 @@ export interface RandomizerConfig {
clip_strength_max: number clip_strength_max: number
roll_mode: 'fixed' | 'always' roll_mode: 'fixed' | 'always'
last_used?: LoraEntry[] | null last_used?: LoraEntry[] | null
use_recommended_strength: boolean
recommended_strength_scale_min: number
recommended_strength_scale_max: number
} }
export interface LoraEntry { export interface LoraEntry {

View File

@@ -14,6 +14,9 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
const clipStrengthMax = ref(1.0) const clipStrengthMax = ref(1.0)
const rollMode = ref<'fixed' | 'always'>('fixed') const rollMode = ref<'fixed' | 'always'>('fixed')
const isRolling = ref(false) const isRolling = ref(false)
const useRecommendedStrength = ref(false)
const recommendedStrengthScaleMin = ref(0.5)
const recommendedStrengthScaleMax = ref(1.0)
// Track last used combination (for backend roll mode) // Track last used combination (for backend roll mode)
const lastUsed = ref<LoraEntry[] | null>(null) const lastUsed = ref<LoraEntry[] | null>(null)
@@ -31,6 +34,9 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
clip_strength_max: clipStrengthMax.value, clip_strength_max: clipStrengthMax.value,
roll_mode: rollMode.value, roll_mode: rollMode.value,
last_used: lastUsed.value, last_used: lastUsed.value,
use_recommended_strength: useRecommendedStrength.value,
recommended_strength_scale_min: recommendedStrengthScaleMin.value,
recommended_strength_scale_max: recommendedStrengthScaleMax.value,
}) })
// Restore state from config object // Restore state from config object
@@ -56,6 +62,9 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
rollMode.value = 'fixed' rollMode.value = 'fixed'
} }
lastUsed.value = config.last_used || null lastUsed.value = config.last_used || null
useRecommendedStrength.value = config.use_recommended_strength ?? false
recommendedStrengthScaleMin.value = config.recommended_strength_scale_min ?? 0.5
recommendedStrengthScaleMax.value = config.recommended_strength_scale_max ?? 1.0
} }
// Roll loras - call API to get random selection // Roll loras - call API to get random selection
@@ -76,6 +85,9 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
clip_strength_min: config.clip_strength_min, clip_strength_min: config.clip_strength_min,
clip_strength_max: config.clip_strength_max, clip_strength_max: config.clip_strength_max,
locked_loras: lockedLoras, locked_loras: lockedLoras,
use_recommended_strength: config.use_recommended_strength,
recommended_strength_scale_min: config.recommended_strength_scale_min,
recommended_strength_scale_max: config.recommended_strength_scale_max,
} }
// Add count parameters // Add count parameters
@@ -130,6 +142,7 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
// Computed properties // Computed properties
const isClipStrengthDisabled = computed(() => useSameClipStrength.value) const isClipStrengthDisabled = computed(() => useSameClipStrength.value)
const isRecommendedStrengthEnabled = computed(() => useRecommendedStrength.value)
// Watch all state changes and update widget value // Watch all state changes and update widget value
watch([ watch([
@@ -143,6 +156,9 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
clipStrengthMin, clipStrengthMin,
clipStrengthMax, clipStrengthMax,
rollMode, rollMode,
useRecommendedStrength,
recommendedStrengthScaleMin,
recommendedStrengthScaleMax,
], () => { ], () => {
const config = buildConfig() const config = buildConfig()
if (widget.updateConfig) { if (widget.updateConfig) {
@@ -166,9 +182,13 @@ export function useLoraRandomizerState(widget: ComponentWidget) {
rollMode, rollMode,
isRolling, isRolling,
lastUsed, lastUsed,
useRecommendedStrength,
recommendedStrengthScaleMin,
recommendedStrengthScaleMax,
// Computed // Computed
isClipStrengthDisabled, isClipStrengthDisabled,
isRecommendedStrengthEnabled,
// Methods // Methods
buildConfig, buildConfig,

View File

@@ -7,7 +7,7 @@ import type { LoraPoolConfig, LegacyLoraPoolConfig, RandomizerConfig } from './c
const LORA_POOL_WIDGET_MIN_WIDTH = 500 const LORA_POOL_WIDGET_MIN_WIDTH = 500
const LORA_POOL_WIDGET_MIN_HEIGHT = 400 const LORA_POOL_WIDGET_MIN_HEIGHT = 400
const LORA_RANDOMIZER_WIDGET_MIN_WIDTH = 500 const LORA_RANDOMIZER_WIDGET_MIN_WIDTH = 500
const LORA_RANDOMIZER_WIDGET_MIN_HEIGHT = 430 const LORA_RANDOMIZER_WIDGET_MIN_HEIGHT = 510
const LORA_RANDOMIZER_WIDGET_MAX_HEIGHT = LORA_RANDOMIZER_WIDGET_MIN_HEIGHT const LORA_RANDOMIZER_WIDGET_MAX_HEIGHT = LORA_RANDOMIZER_WIDGET_MIN_HEIGHT
// @ts-ignore - ComfyUI external module // @ts-ignore - ComfyUI external module

View File

@@ -1195,16 +1195,16 @@ to { transform: rotate(360deg);
text-align: center; text-align: center;
} }
.randomizer-settings[data-v-420a82ee] { .randomizer-settings[data-v-90189966] {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
color: #e4e4e7; color: #e4e4e7;
} }
.settings-header[data-v-420a82ee] { .settings-header[data-v-90189966] {
margin-bottom: 8px; margin-bottom: 8px;
} }
.settings-title[data-v-420a82ee] { .settings-title[data-v-90189966] {
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 600;
letter-spacing: 0.05em; letter-spacing: 0.05em;
@@ -1213,28 +1213,28 @@ to { transform: rotate(360deg);
margin: 0; margin: 0;
text-transform: uppercase; text-transform: uppercase;
} }
.setting-section[data-v-420a82ee] { .setting-section[data-v-90189966] {
margin-bottom: 16px; margin-bottom: 16px;
} }
.setting-label[data-v-420a82ee] { .setting-label[data-v-90189966] {
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
color: #d4d4d8; color: #d4d4d8;
display: block; display: block;
margin-bottom: 8px; margin-bottom: 8px;
} }
.section-header-with-toggle[data-v-420a82ee] { .section-header-with-toggle[data-v-90189966] {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-bottom: 8px; margin-bottom: 8px;
} }
.section-header-with-toggle .setting-label[data-v-420a82ee] { .section-header-with-toggle .setting-label[data-v-90189966] {
margin-bottom: 0; margin-bottom: 0;
} }
/* Count Mode Tabs */ /* Count Mode Tabs */
.count-mode-tabs[data-v-420a82ee] { .count-mode-tabs[data-v-90189966] {
display: flex; display: flex;
background: rgba(26, 32, 44, 0.9); background: rgba(26, 32, 44, 0.9);
border: 1px solid rgba(226, 232, 240, 0.2); border: 1px solid rgba(226, 232, 240, 0.2);
@@ -1242,7 +1242,7 @@ to { transform: rotate(360deg);
overflow: hidden; overflow: hidden;
margin-bottom: 8px; margin-bottom: 8px;
} }
.count-mode-tab[data-v-420a82ee] { .count-mode-tab[data-v-90189966] {
flex: 1; flex: 1;
position: relative; position: relative;
padding: 8px 12px; padding: 8px 12px;
@@ -1250,29 +1250,29 @@ to { transform: rotate(360deg);
cursor: pointer; cursor: pointer;
transition: all 0.2s ease; transition: all 0.2s ease;
} }
.count-mode-tab input[type="radio"][data-v-420a82ee] { .count-mode-tab input[type="radio"][data-v-90189966] {
position: absolute; position: absolute;
opacity: 0; opacity: 0;
width: 0; width: 0;
height: 0; height: 0;
} }
.count-mode-tab-label[data-v-420a82ee] { .count-mode-tab-label[data-v-90189966] {
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
color: rgba(226, 232, 240, 0.7); color: rgba(226, 232, 240, 0.7);
transition: all 0.2s ease; transition: all 0.2s ease;
} }
.count-mode-tab:hover .count-mode-tab-label[data-v-420a82ee] { .count-mode-tab:hover .count-mode-tab-label[data-v-90189966] {
color: rgba(226, 232, 240, 0.9); color: rgba(226, 232, 240, 0.9);
} }
.count-mode-tab.active .count-mode-tab-label[data-v-420a82ee] { .count-mode-tab.active .count-mode-tab-label[data-v-90189966] {
color: rgba(191, 219, 254, 1); color: rgba(191, 219, 254, 1);
font-weight: 600; font-weight: 600;
} }
.count-mode-tab.active[data-v-420a82ee] { .count-mode-tab.active[data-v-90189966] {
background: rgba(66, 153, 225, 0.2); background: rgba(66, 153, 225, 0.2);
} }
.count-mode-tab.active[data-v-420a82ee]::after { .count-mode-tab.active[data-v-90189966]::after {
content: ''; content: '';
position: absolute; position: absolute;
bottom: 0; bottom: 0;
@@ -1281,15 +1281,19 @@ to { transform: rotate(360deg);
height: 2px; height: 2px;
background: rgba(66, 153, 225, 0.9); background: rgba(66, 153, 225, 0.9);
} }
.slider-container[data-v-420a82ee] { .slider-container[data-v-90189966] {
background: rgba(26, 32, 44, 0.9); background: rgba(26, 32, 44, 0.9);
border: 1px solid rgba(226, 232, 240, 0.2); border: 1px solid rgba(226, 232, 240, 0.2);
border-radius: 4px; border-radius: 4px;
padding: 4px 8px; padding: 4px 8px;
} }
.slider-container--disabled[data-v-90189966] {
opacity: 0.5;
pointer-events: none;
}
/* Toggle Switch (same style as LicenseSection) */ /* Toggle Switch (same style as LicenseSection) */
.toggle-switch[data-v-420a82ee] { .toggle-switch[data-v-90189966] {
position: relative; position: relative;
width: 36px; width: 36px;
height: 20px; height: 20px;
@@ -1298,7 +1302,7 @@ to { transform: rotate(360deg);
border: none; border: none;
cursor: pointer; cursor: pointer;
} }
.toggle-switch__track[data-v-420a82ee] { .toggle-switch__track[data-v-90189966] {
position: absolute; position: absolute;
inset: 0; inset: 0;
background: var(--comfy-input-bg, #333); background: var(--comfy-input-bg, #333);
@@ -1306,11 +1310,11 @@ to { transform: rotate(360deg);
border-radius: 10px; border-radius: 10px;
transition: all 0.2s; transition: all 0.2s;
} }
.toggle-switch--active .toggle-switch__track[data-v-420a82ee] { .toggle-switch--active .toggle-switch__track[data-v-90189966] {
background: rgba(66, 153, 225, 0.3); background: rgba(66, 153, 225, 0.3);
border-color: rgba(66, 153, 225, 0.6); border-color: rgba(66, 153, 225, 0.6);
} }
.toggle-switch__thumb[data-v-420a82ee] { .toggle-switch__thumb[data-v-90189966] {
position: absolute; position: absolute;
top: 3px; top: 3px;
left: 2px; left: 2px;
@@ -1321,27 +1325,27 @@ to { transform: rotate(360deg);
transition: all 0.2s; transition: all 0.2s;
opacity: 0.6; opacity: 0.6;
} }
.toggle-switch--active .toggle-switch__thumb[data-v-420a82ee] { .toggle-switch--active .toggle-switch__thumb[data-v-90189966] {
transform: translateX(16px); transform: translateX(16px);
background: #4299e1; background: #4299e1;
opacity: 1; opacity: 1;
} }
.toggle-switch:hover .toggle-switch__thumb[data-v-420a82ee] { .toggle-switch:hover .toggle-switch__thumb[data-v-90189966] {
opacity: 1; opacity: 1;
} }
/* Roll buttons with tooltip container */ /* Roll buttons with tooltip container */
.roll-buttons-with-tooltip[data-v-420a82ee] { .roll-buttons-with-tooltip[data-v-90189966] {
position: relative; position: relative;
} }
/* Roll buttons container */ /* Roll buttons container */
.roll-buttons[data-v-420a82ee] { .roll-buttons[data-v-90189966] {
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr; grid-template-columns: 1fr 1fr 1fr;
gap: 8px; gap: 8px;
} }
.roll-button[data-v-420a82ee] { .roll-button[data-v-90189966] {
padding: 8px 10px; padding: 8px 10px;
background: rgba(30, 30, 36, 0.6); background: rgba(30, 30, 36, 0.6);
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
@@ -1358,44 +1362,44 @@ to { transform: rotate(360deg);
transition: all 0.2s; transition: all 0.2s;
white-space: nowrap; white-space: nowrap;
} }
.roll-button[data-v-420a82ee]:hover:not(:disabled) { .roll-button[data-v-90189966]:hover:not(:disabled) {
background: rgba(66, 153, 225, 0.2); background: rgba(66, 153, 225, 0.2);
border-color: rgba(66, 153, 225, 0.4); border-color: rgba(66, 153, 225, 0.4);
color: #bfdbfe; color: #bfdbfe;
} }
.roll-button.selected[data-v-420a82ee] { .roll-button.selected[data-v-90189966] {
background: rgba(66, 153, 225, 0.3); background: rgba(66, 153, 225, 0.3);
border-color: rgba(66, 153, 225, 0.6); border-color: rgba(66, 153, 225, 0.6);
color: #e4e4e7; color: #e4e4e7;
box-shadow: 0 0 0 1px rgba(66, 153, 225, 0.3); box-shadow: 0 0 0 1px rgba(66, 153, 225, 0.3);
} }
.roll-button[data-v-420a82ee]:disabled { .roll-button[data-v-90189966]:disabled {
opacity: 0.4; opacity: 0.4;
cursor: not-allowed; cursor: not-allowed;
} }
.roll-button__icon[data-v-420a82ee] { .roll-button__icon[data-v-90189966] {
width: 20px; width: 20px;
height: 20px; height: 20px;
flex-shrink: 0; flex-shrink: 0;
} }
.roll-button__text[data-v-420a82ee] { .roll-button__text[data-v-90189966] {
font-size: 11px; font-size: 11px;
text-align: center; text-align: center;
line-height: 1.2; line-height: 1.2;
} }
/* Tooltip transitions */ /* Tooltip transitions */
.tooltip-enter-active[data-v-420a82ee], .tooltip-enter-active[data-v-90189966],
.tooltip-leave-active[data-v-420a82ee] { .tooltip-leave-active[data-v-90189966] {
transition: opacity 0.15s ease, transform 0.15s ease; transition: opacity 0.15s ease, transform 0.15s ease;
} }
.tooltip-enter-from[data-v-420a82ee], .tooltip-enter-from[data-v-90189966],
.tooltip-leave-to[data-v-420a82ee] { .tooltip-leave-to[data-v-90189966] {
opacity: 0; opacity: 0;
transform: translateY(4px); transform: translateY(4px);
} }
.lora-randomizer-widget[data-v-bb056060] { .lora-randomizer-widget[data-v-69f71f06] {
padding: 12px; padding: 12px;
background: rgba(40, 44, 52, 0.6); background: rgba(40, 44, 52, 0.6);
border-radius: 4px; border-radius: 4px;
@@ -11663,15 +11667,18 @@ const _hoisted_7 = { class: "setting-section" };
const _hoisted_8 = { class: "slider-container" }; const _hoisted_8 = { class: "slider-container" };
const _hoisted_9 = { class: "setting-section" }; const _hoisted_9 = { class: "setting-section" };
const _hoisted_10 = { class: "section-header-with-toggle" }; const _hoisted_10 = { class: "section-header-with-toggle" };
const _hoisted_11 = { class: "setting-label" }; const _hoisted_11 = ["aria-checked"];
const _hoisted_12 = ["aria-checked"]; const _hoisted_12 = { class: "setting-section" };
const _hoisted_13 = { class: "slider-container" }; const _hoisted_13 = { class: "section-header-with-toggle" };
const _hoisted_14 = { class: "setting-section" }; const _hoisted_14 = { class: "setting-label" };
const _hoisted_15 = { class: "roll-buttons-with-tooltip" }; const _hoisted_15 = ["aria-checked"];
const _hoisted_16 = { class: "roll-buttons" }; const _hoisted_16 = { class: "slider-container" };
const _hoisted_17 = ["disabled"]; const _hoisted_17 = { class: "setting-section" };
const _hoisted_18 = ["disabled"]; const _hoisted_18 = { class: "roll-buttons-with-tooltip" };
const _hoisted_19 = ["disabled"]; const _hoisted_19 = { class: "roll-buttons" };
const _hoisted_20 = ["disabled"];
const _hoisted_21 = ["disabled"];
const _hoisted_22 = ["disabled"];
const _sfc_main$1 = /* @__PURE__ */ defineComponent({ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "LoraRandomizerSettingsView", __name: "LoraRandomizerSettingsView",
props: { props: {
@@ -11689,9 +11696,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
isClipStrengthDisabled: { type: Boolean }, isClipStrengthDisabled: { type: Boolean },
lastUsed: {}, lastUsed: {},
currentLoras: {}, currentLoras: {},
canReuseLast: { type: Boolean } canReuseLast: { type: Boolean },
useRecommendedStrength: { type: Boolean },
recommendedStrengthScaleMin: {},
recommendedStrengthScaleMax: {}
}, },
emits: ["update:countMode", "update:countFixed", "update:countMin", "update:countMax", "update:modelStrengthMin", "update:modelStrengthMax", "update:useSameClipStrength", "update:clipStrengthMin", "update:clipStrengthMax", "update:rollMode", "generate-fixed", "always-randomize", "reuse-last"], emits: ["update:countMode", "update:countFixed", "update:countMin", "update:countMax", "update:modelStrengthMin", "update:modelStrengthMax", "update:useSameClipStrength", "update:clipStrengthMin", "update:clipStrengthMax", "update:rollMode", "update:useRecommendedStrength", "update:recommendedStrengthScaleMin", "update:recommendedStrengthScaleMax", "generate-fixed", "always-randomize", "reuse-last"],
setup(__props) { setup(__props) {
const strengthSegments = [ const strengthSegments = [
{ min: -10, max: -2, widthPercent: 20 }, { min: -10, max: -2, widthPercent: 20 },
@@ -11710,11 +11720,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
}; };
return (_ctx, _cache) => { return (_ctx, _cache) => {
return openBlock(), createElementBlock("div", _hoisted_1$1, [ return openBlock(), createElementBlock("div", _hoisted_1$1, [
_cache[24] || (_cache[24] = createBaseVNode("div", { class: "settings-header" }, [ _cache[29] || (_cache[29] = createBaseVNode("div", { class: "settings-header" }, [
createBaseVNode("h3", { class: "settings-title" }, "RANDOMIZER SETTINGS") createBaseVNode("h3", { class: "settings-title" }, "RANDOMIZER SETTINGS")
], -1)), ], -1)),
createBaseVNode("div", _hoisted_2, [ createBaseVNode("div", _hoisted_2, [
_cache[17] || (_cache[17] = createBaseVNode("label", { class: "setting-label" }, "LoRA Count", -1)), _cache[20] || (_cache[20] = createBaseVNode("label", { class: "setting-label" }, "LoRA Count", -1)),
createBaseVNode("div", _hoisted_3, [ createBaseVNode("div", _hoisted_3, [
createBaseVNode("label", { createBaseVNode("label", {
class: normalizeClass(["count-mode-tab", { active: __props.countMode === "fixed" }]) class: normalizeClass(["count-mode-tab", { active: __props.countMode === "fixed" }])
@@ -11726,7 +11736,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
checked: __props.countMode === "fixed", checked: __props.countMode === "fixed",
onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:countMode", "fixed")) onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:countMode", "fixed"))
}, null, 40, _hoisted_4), }, null, 40, _hoisted_4),
_cache[15] || (_cache[15] = createBaseVNode("span", { class: "count-mode-tab-label" }, "Fixed", -1)) _cache[18] || (_cache[18] = createBaseVNode("span", { class: "count-mode-tab-label" }, "Fixed", -1))
], 2), ], 2),
createBaseVNode("label", { createBaseVNode("label", {
class: normalizeClass(["count-mode-tab", { active: __props.countMode === "range" }]) class: normalizeClass(["count-mode-tab", { active: __props.countMode === "range" }])
@@ -11738,7 +11748,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
checked: __props.countMode === "range", checked: __props.countMode === "range",
onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:countMode", "range")) onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:countMode", "range"))
}, null, 40, _hoisted_5), }, null, 40, _hoisted_5),
_cache[16] || (_cache[16] = createBaseVNode("span", { class: "count-mode-tab-label" }, "Range", -1)) _cache[19] || (_cache[19] = createBaseVNode("span", { class: "count-mode-tab-label" }, "Range", -1))
], 2) ], 2)
]), ]),
createBaseVNode("div", _hoisted_6, [ createBaseVNode("div", _hoisted_6, [
@@ -11764,7 +11774,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
]) ])
]), ]),
createBaseVNode("div", _hoisted_7, [ createBaseVNode("div", _hoisted_7, [
_cache[18] || (_cache[18] = createBaseVNode("label", { class: "setting-label" }, "Model Strength Range", -1)), _cache[21] || (_cache[21] = createBaseVNode("label", { class: "setting-label" }, "Model Strength Range", -1)),
createBaseVNode("div", _hoisted_8, [ createBaseVNode("div", _hoisted_8, [
createVNode(DualRangeSlider, { createVNode(DualRangeSlider, {
min: -10, min: -10,
@@ -11782,20 +11792,51 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
]), ]),
createBaseVNode("div", _hoisted_9, [ createBaseVNode("div", _hoisted_9, [
createBaseVNode("div", _hoisted_10, [ createBaseVNode("div", _hoisted_10, [
createBaseVNode("label", _hoisted_11, " Clip Strength Range - " + toDisplayString(__props.useSameClipStrength ? "Use Model Strength" : "Custom Range"), 1), _cache[23] || (_cache[23] = createBaseVNode("label", { class: "setting-label" }, " Respect Recommended Strength ", -1)),
createBaseVNode("button", {
type: "button",
class: normalizeClass(["toggle-switch", { "toggle-switch--active": __props.useRecommendedStrength }]),
onClick: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("update:useRecommendedStrength", !__props.useRecommendedStrength)),
role: "switch",
"aria-checked": __props.useRecommendedStrength,
title: "Use recommended strength values from usage tips"
}, [..._cache[22] || (_cache[22] = [
createBaseVNode("span", { class: "toggle-switch__track" }, null, -1),
createBaseVNode("span", { class: "toggle-switch__thumb" }, null, -1)
])], 10, _hoisted_11)
]),
createBaseVNode("div", {
class: normalizeClass(["slider-container", { "slider-container--disabled": !__props.useRecommendedStrength }])
}, [
createVNode(DualRangeSlider, {
min: 0,
max: 2,
"value-min": __props.recommendedStrengthScaleMin,
"value-max": __props.recommendedStrengthScaleMax,
step: 0.1,
"default-range": { min: 0.5, max: 1 },
disabled: !__props.useRecommendedStrength,
"onUpdate:valueMin": _cache[8] || (_cache[8] = ($event) => _ctx.$emit("update:recommendedStrengthScaleMin", $event)),
"onUpdate:valueMax": _cache[9] || (_cache[9] = ($event) => _ctx.$emit("update:recommendedStrengthScaleMax", $event))
}, null, 8, ["value-min", "value-max", "disabled"])
], 2)
]),
createBaseVNode("div", _hoisted_12, [
createBaseVNode("div", _hoisted_13, [
createBaseVNode("label", _hoisted_14, " Clip Strength Range - " + toDisplayString(__props.useSameClipStrength ? "Use Model Strength" : "Custom Range"), 1),
createBaseVNode("button", { createBaseVNode("button", {
type: "button", type: "button",
class: normalizeClass(["toggle-switch", { "toggle-switch--active": __props.useSameClipStrength }]), class: normalizeClass(["toggle-switch", { "toggle-switch--active": __props.useSameClipStrength }]),
onClick: _cache[7] || (_cache[7] = ($event) => _ctx.$emit("update:useSameClipStrength", !__props.useSameClipStrength)), onClick: _cache[10] || (_cache[10] = ($event) => _ctx.$emit("update:useSameClipStrength", !__props.useSameClipStrength)),
role: "switch", role: "switch",
"aria-checked": __props.useSameClipStrength, "aria-checked": __props.useSameClipStrength,
title: "Lock clip strength to model strength" title: "Lock clip strength to model strength"
}, [..._cache[19] || (_cache[19] = [ }, [..._cache[24] || (_cache[24] = [
createBaseVNode("span", { class: "toggle-switch__track" }, null, -1), createBaseVNode("span", { class: "toggle-switch__track" }, null, -1),
createBaseVNode("span", { class: "toggle-switch__thumb" }, null, -1) createBaseVNode("span", { class: "toggle-switch__thumb" }, null, -1)
])], 10, _hoisted_12) ])], 10, _hoisted_15)
]), ]),
createBaseVNode("div", _hoisted_13, [ createBaseVNode("div", _hoisted_16, [
createVNode(DualRangeSlider, { createVNode(DualRangeSlider, {
min: -10, min: -10,
max: 10, max: 10,
@@ -11806,36 +11847,36 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
"scale-mode": "segmented", "scale-mode": "segmented",
segments: strengthSegments, segments: strengthSegments,
disabled: __props.isClipStrengthDisabled, disabled: __props.isClipStrengthDisabled,
"onUpdate:valueMin": _cache[8] || (_cache[8] = ($event) => _ctx.$emit("update:clipStrengthMin", $event)), "onUpdate:valueMin": _cache[11] || (_cache[11] = ($event) => _ctx.$emit("update:clipStrengthMin", $event)),
"onUpdate:valueMax": _cache[9] || (_cache[9] = ($event) => _ctx.$emit("update:clipStrengthMax", $event)) "onUpdate:valueMax": _cache[12] || (_cache[12] = ($event) => _ctx.$emit("update:clipStrengthMax", $event))
}, null, 8, ["value-min", "value-max", "disabled"]) }, null, 8, ["value-min", "value-max", "disabled"])
]) ])
]), ]),
createBaseVNode("div", _hoisted_14, [ createBaseVNode("div", _hoisted_17, [
_cache[23] || (_cache[23] = createBaseVNode("label", { class: "setting-label" }, "Roll Mode", -1)), _cache[28] || (_cache[28] = createBaseVNode("label", { class: "setting-label" }, "Roll Mode", -1)),
createBaseVNode("div", _hoisted_15, [ createBaseVNode("div", _hoisted_18, [
createBaseVNode("div", _hoisted_16, [ createBaseVNode("div", _hoisted_19, [
createBaseVNode("button", { createBaseVNode("button", {
class: normalizeClass(["roll-button", { selected: __props.rollMode === "fixed" }]), class: normalizeClass(["roll-button", { selected: __props.rollMode === "fixed" }]),
disabled: __props.isRolling, disabled: __props.isRolling,
onClick: _cache[10] || (_cache[10] = ($event) => _ctx.$emit("generate-fixed")) onClick: _cache[13] || (_cache[13] = ($event) => _ctx.$emit("generate-fixed"))
}, [..._cache[20] || (_cache[20] = [ }, [..._cache[25] || (_cache[25] = [
createStaticVNode('<svg class="roll-button__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-420a82ee><rect x="2" y="2" width="20" height="20" rx="5" data-v-420a82ee></rect><circle cx="12" cy="12" r="3" data-v-420a82ee></circle><circle cx="6" cy="8" r="1.5" data-v-420a82ee></circle><circle cx="18" cy="16" r="1.5" data-v-420a82ee></circle></svg><span class="roll-button__text" data-v-420a82ee>Generate Fixed</span>', 2) createStaticVNode('<svg class="roll-button__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-90189966><rect x="2" y="2" width="20" height="20" rx="5" data-v-90189966></rect><circle cx="12" cy="12" r="3" data-v-90189966></circle><circle cx="6" cy="8" r="1.5" data-v-90189966></circle><circle cx="18" cy="16" r="1.5" data-v-90189966></circle></svg><span class="roll-button__text" data-v-90189966>Generate Fixed</span>', 2)
])], 10, _hoisted_17), ])], 10, _hoisted_20),
createBaseVNode("button", { createBaseVNode("button", {
class: normalizeClass(["roll-button", { selected: __props.rollMode === "always" }]), class: normalizeClass(["roll-button", { selected: __props.rollMode === "always" }]),
disabled: __props.isRolling, disabled: __props.isRolling,
onClick: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("always-randomize")) onClick: _cache[14] || (_cache[14] = ($event) => _ctx.$emit("always-randomize"))
}, [..._cache[21] || (_cache[21] = [ }, [..._cache[26] || (_cache[26] = [
createStaticVNode('<svg class="roll-button__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-420a82ee><path d="M21 12a9 9 0 1 1-6.219-8.56" data-v-420a82ee></path><path d="M21 3v5h-5" data-v-420a82ee></path><circle cx="12" cy="12" r="3" data-v-420a82ee></circle><circle cx="6" cy="8" r="1.5" data-v-420a82ee></circle><circle cx="18" cy="16" r="1.5" data-v-420a82ee></circle></svg><span class="roll-button__text" data-v-420a82ee>Always Randomize</span>', 2) createStaticVNode('<svg class="roll-button__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-90189966><path d="M21 12a9 9 0 1 1-6.219-8.56" data-v-90189966></path><path d="M21 3v5h-5" data-v-90189966></path><circle cx="12" cy="12" r="3" data-v-90189966></circle><circle cx="6" cy="8" r="1.5" data-v-90189966></circle><circle cx="18" cy="16" r="1.5" data-v-90189966></circle></svg><span class="roll-button__text" data-v-90189966>Always Randomize</span>', 2)
])], 10, _hoisted_18), ])], 10, _hoisted_21),
createBaseVNode("button", { createBaseVNode("button", {
class: normalizeClass(["roll-button", { selected: __props.rollMode === "fixed" && __props.canReuseLast && areLorasEqual(__props.currentLoras, __props.lastUsed) }]), class: normalizeClass(["roll-button", { selected: __props.rollMode === "fixed" && __props.canReuseLast && areLorasEqual(__props.currentLoras, __props.lastUsed) }]),
disabled: !__props.canReuseLast, disabled: !__props.canReuseLast,
onMouseenter: _cache[12] || (_cache[12] = ($event) => showTooltip.value = true), onMouseenter: _cache[15] || (_cache[15] = ($event) => showTooltip.value = true),
onMouseleave: _cache[13] || (_cache[13] = ($event) => showTooltip.value = false), onMouseleave: _cache[16] || (_cache[16] = ($event) => showTooltip.value = false),
onClick: _cache[14] || (_cache[14] = ($event) => _ctx.$emit("reuse-last")) onClick: _cache[17] || (_cache[17] = ($event) => _ctx.$emit("reuse-last"))
}, [..._cache[22] || (_cache[22] = [ }, [..._cache[27] || (_cache[27] = [
createBaseVNode("svg", { createBaseVNode("svg", {
class: "roll-button__icon", class: "roll-button__icon",
viewBox: "0 0 24 24", viewBox: "0 0 24 24",
@@ -11849,7 +11890,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
createBaseVNode("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11" }) createBaseVNode("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5v0a5.5 5.5 0 0 1-5.5 5.5H11" })
], -1), ], -1),
createBaseVNode("span", { class: "roll-button__text" }, "Reuse Last", -1) createBaseVNode("span", { class: "roll-button__text" }, "Reuse Last", -1)
])], 42, _hoisted_19) ])], 42, _hoisted_22)
]), ]),
createVNode(Transition, { name: "tooltip" }, { createVNode(Transition, { name: "tooltip" }, {
default: withCtx(() => [ default: withCtx(() => [
@@ -11866,7 +11907,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
}; };
} }
}); });
const LoraRandomizerSettingsView = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-420a82ee"]]); const LoraRandomizerSettingsView = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-90189966"]]);
function useLoraRandomizerState(widget) { function useLoraRandomizerState(widget) {
const countMode = ref("range"); const countMode = ref("range");
const countFixed = ref(3); const countFixed = ref(3);
@@ -11879,6 +11920,9 @@ function useLoraRandomizerState(widget) {
const clipStrengthMax = ref(1); const clipStrengthMax = ref(1);
const rollMode = ref("fixed"); const rollMode = ref("fixed");
const isRolling = ref(false); const isRolling = ref(false);
const useRecommendedStrength = ref(false);
const recommendedStrengthScaleMin = ref(0.5);
const recommendedStrengthScaleMax = ref(1);
const lastUsed = ref(null); const lastUsed = ref(null);
const buildConfig = () => ({ const buildConfig = () => ({
count_mode: countMode.value, count_mode: countMode.value,
@@ -11891,7 +11935,10 @@ function useLoraRandomizerState(widget) {
clip_strength_min: clipStrengthMin.value, clip_strength_min: clipStrengthMin.value,
clip_strength_max: clipStrengthMax.value, clip_strength_max: clipStrengthMax.value,
roll_mode: rollMode.value, roll_mode: rollMode.value,
last_used: lastUsed.value last_used: lastUsed.value,
use_recommended_strength: useRecommendedStrength.value,
recommended_strength_scale_min: recommendedStrengthScaleMin.value,
recommended_strength_scale_max: recommendedStrengthScaleMax.value
}); });
const restoreFromConfig = (config) => { const restoreFromConfig = (config) => {
countMode.value = config.count_mode || "range"; countMode.value = config.count_mode || "range";
@@ -11914,6 +11961,9 @@ function useLoraRandomizerState(widget) {
rollMode.value = "fixed"; rollMode.value = "fixed";
} }
lastUsed.value = config.last_used || null; lastUsed.value = config.last_used || null;
useRecommendedStrength.value = config.use_recommended_strength ?? false;
recommendedStrengthScaleMin.value = config.recommended_strength_scale_min ?? 0.5;
recommendedStrengthScaleMax.value = config.recommended_strength_scale_max ?? 1;
}; };
const rollLoras = async (poolConfig, lockedLoras) => { const rollLoras = async (poolConfig, lockedLoras) => {
try { try {
@@ -11925,7 +11975,10 @@ function useLoraRandomizerState(widget) {
use_same_clip_strength: config.use_same_clip_strength, use_same_clip_strength: config.use_same_clip_strength,
clip_strength_min: config.clip_strength_min, clip_strength_min: config.clip_strength_min,
clip_strength_max: config.clip_strength_max, clip_strength_max: config.clip_strength_max,
locked_loras: lockedLoras locked_loras: lockedLoras,
use_recommended_strength: config.use_recommended_strength,
recommended_strength_scale_min: config.recommended_strength_scale_min,
recommended_strength_scale_max: config.recommended_strength_scale_max
}; };
if (config.count_mode === "fixed") { if (config.count_mode === "fixed") {
requestBody.count = config.count_fixed; requestBody.count = config.count_fixed;
@@ -11966,6 +12019,7 @@ function useLoraRandomizerState(widget) {
return null; return null;
}; };
const isClipStrengthDisabled = computed(() => useSameClipStrength.value); const isClipStrengthDisabled = computed(() => useSameClipStrength.value);
const isRecommendedStrengthEnabled = computed(() => useRecommendedStrength.value);
watch([ watch([
countMode, countMode,
countFixed, countFixed,
@@ -11976,7 +12030,10 @@ function useLoraRandomizerState(widget) {
useSameClipStrength, useSameClipStrength,
clipStrengthMin, clipStrengthMin,
clipStrengthMax, clipStrengthMax,
rollMode rollMode,
useRecommendedStrength,
recommendedStrengthScaleMin,
recommendedStrengthScaleMax
], () => { ], () => {
const config = buildConfig(); const config = buildConfig();
if (widget.updateConfig) { if (widget.updateConfig) {
@@ -11999,8 +12056,12 @@ function useLoraRandomizerState(widget) {
rollMode, rollMode,
isRolling, isRolling,
lastUsed, lastUsed,
useRecommendedStrength,
recommendedStrengthScaleMin,
recommendedStrengthScaleMax,
// Computed // Computed
isClipStrengthDisabled, isClipStrengthDisabled,
isRecommendedStrengthEnabled,
// Methods // Methods
buildConfig, buildConfig,
restoreFromConfig, restoreFromConfig,
@@ -12146,6 +12207,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
"last-used": unref(state).lastUsed.value, "last-used": unref(state).lastUsed.value,
"current-loras": currentLoras.value, "current-loras": currentLoras.value,
"can-reuse-last": canReuseLast.value, "can-reuse-last": canReuseLast.value,
"use-recommended-strength": unref(state).useRecommendedStrength.value,
"recommended-strength-scale-min": unref(state).recommendedStrengthScaleMin.value,
"recommended-strength-scale-max": unref(state).recommendedStrengthScaleMax.value,
"onUpdate:countMode": _cache[0] || (_cache[0] = ($event) => unref(state).countMode.value = $event), "onUpdate:countMode": _cache[0] || (_cache[0] = ($event) => unref(state).countMode.value = $event),
"onUpdate:countFixed": _cache[1] || (_cache[1] = ($event) => unref(state).countFixed.value = $event), "onUpdate:countFixed": _cache[1] || (_cache[1] = ($event) => unref(state).countFixed.value = $event),
"onUpdate:countMin": _cache[2] || (_cache[2] = ($event) => unref(state).countMin.value = $event), "onUpdate:countMin": _cache[2] || (_cache[2] = ($event) => unref(state).countMin.value = $event),
@@ -12156,15 +12220,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
"onUpdate:clipStrengthMin": _cache[7] || (_cache[7] = ($event) => unref(state).clipStrengthMin.value = $event), "onUpdate:clipStrengthMin": _cache[7] || (_cache[7] = ($event) => unref(state).clipStrengthMin.value = $event),
"onUpdate:clipStrengthMax": _cache[8] || (_cache[8] = ($event) => unref(state).clipStrengthMax.value = $event), "onUpdate:clipStrengthMax": _cache[8] || (_cache[8] = ($event) => unref(state).clipStrengthMax.value = $event),
"onUpdate:rollMode": _cache[9] || (_cache[9] = ($event) => unref(state).rollMode.value = $event), "onUpdate:rollMode": _cache[9] || (_cache[9] = ($event) => unref(state).rollMode.value = $event),
"onUpdate:useRecommendedStrength": _cache[10] || (_cache[10] = ($event) => unref(state).useRecommendedStrength.value = $event),
"onUpdate:recommendedStrengthScaleMin": _cache[11] || (_cache[11] = ($event) => unref(state).recommendedStrengthScaleMin.value = $event),
"onUpdate:recommendedStrengthScaleMax": _cache[12] || (_cache[12] = ($event) => unref(state).recommendedStrengthScaleMax.value = $event),
onGenerateFixed: handleGenerateFixed, onGenerateFixed: handleGenerateFixed,
onAlwaysRandomize: handleAlwaysRandomize, onAlwaysRandomize: handleAlwaysRandomize,
onReuseLast: handleReuseLast onReuseLast: handleReuseLast
}, null, 8, ["count-mode", "count-fixed", "count-min", "count-max", "model-strength-min", "model-strength-max", "use-same-clip-strength", "clip-strength-min", "clip-strength-max", "roll-mode", "is-rolling", "is-clip-strength-disabled", "last-used", "current-loras", "can-reuse-last"]) }, null, 8, ["count-mode", "count-fixed", "count-min", "count-max", "model-strength-min", "model-strength-max", "use-same-clip-strength", "clip-strength-min", "clip-strength-max", "roll-mode", "is-rolling", "is-clip-strength-disabled", "last-used", "current-loras", "can-reuse-last", "use-recommended-strength", "recommended-strength-scale-min", "recommended-strength-scale-max"])
]); ]);
}; };
} }
}); });
const LoraRandomizerWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bb056060"]]); const LoraRandomizerWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-69f71f06"]]);
const app = {}; const app = {};
const ROOT_GRAPH_ID = "root"; const ROOT_GRAPH_ID = "root";
function isMapLike(collection) { function isMapLike(collection) {
@@ -12357,7 +12424,7 @@ function updateDownstreamLoaders(startNode, visited = /* @__PURE__ */ new Set())
const LORA_POOL_WIDGET_MIN_WIDTH = 500; const LORA_POOL_WIDGET_MIN_WIDTH = 500;
const LORA_POOL_WIDGET_MIN_HEIGHT = 400; const LORA_POOL_WIDGET_MIN_HEIGHT = 400;
const LORA_RANDOMIZER_WIDGET_MIN_WIDTH = 500; const LORA_RANDOMIZER_WIDGET_MIN_WIDTH = 500;
const LORA_RANDOMIZER_WIDGET_MIN_HEIGHT = 430; const LORA_RANDOMIZER_WIDGET_MIN_HEIGHT = 510;
const LORA_RANDOMIZER_WIDGET_MAX_HEIGHT = LORA_RANDOMIZER_WIDGET_MIN_HEIGHT; const LORA_RANDOMIZER_WIDGET_MAX_HEIGHT = LORA_RANDOMIZER_WIDGET_MIN_HEIGHT;
function forwardMiddleMouseToCanvas(container) { function forwardMiddleMouseToCanvas(container) {
if (!container) return; if (!container) return;

File diff suppressed because one or more lines are too long