mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
Allow for empty lora (no loras option) in Lora Pool
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
:exclude-folders="state.excludeFolders.value"
|
||||
:no-credit-required="state.noCreditRequired.value"
|
||||
:allow-selling="state.allowSelling.value"
|
||||
:include-empty-lora="state.includeEmptyLora.value"
|
||||
:preview-items="state.previewItems.value"
|
||||
:match-count="state.matchCount.value"
|
||||
:is-loading="state.isLoading.value"
|
||||
@@ -18,6 +19,7 @@
|
||||
@update:exclude-folders="state.excludeFolders.value = $event"
|
||||
@update:no-credit-required="state.noCreditRequired.value = $event"
|
||||
@update:allow-selling="state.allowSelling.value = $event"
|
||||
@update:include-empty-lora="state.includeEmptyLora.value = $event"
|
||||
@refresh="state.refreshPreview"
|
||||
/>
|
||||
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
<LicenseSection
|
||||
:no-credit-required="noCreditRequired"
|
||||
:allow-selling="allowSelling"
|
||||
:include-empty-lora="includeEmptyLora"
|
||||
@update:no-credit-required="$emit('update:noCreditRequired', $event)"
|
||||
@update:allow-selling="$emit('update:allowSelling', $event)"
|
||||
@update:include-empty-lora="$emit('update:includeEmptyLora', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -61,9 +63,10 @@ defineProps<{
|
||||
// Folders
|
||||
includeFolders: string[]
|
||||
excludeFolders: string[]
|
||||
// License
|
||||
// License & Misc
|
||||
noCreditRequired: boolean
|
||||
allowSelling: boolean
|
||||
includeEmptyLora: boolean
|
||||
// Preview
|
||||
previewItems: LoraItem[]
|
||||
matchCount: number
|
||||
@@ -76,6 +79,7 @@ defineEmits<{
|
||||
'update:excludeFolders': [value: string[]]
|
||||
'update:noCreditRequired': [value: boolean]
|
||||
'update:allowSelling': [value: boolean]
|
||||
'update:includeEmptyLora': [value: boolean]
|
||||
refresh: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="section">
|
||||
<div class="section__header">
|
||||
<span class="section__title">LICENSE</span>
|
||||
<span class="section__title">LICENSE & OPTIONS</span>
|
||||
</div>
|
||||
<div class="section__toggles">
|
||||
<label class="toggle-item">
|
||||
@@ -33,6 +33,22 @@
|
||||
<span class="toggle-switch__thumb"></span>
|
||||
</button>
|
||||
</label>
|
||||
|
||||
<label class="toggle-item">
|
||||
<span class="toggle-item__label">Include No LoRAs</span>
|
||||
<button
|
||||
type="button"
|
||||
class="toggle-switch"
|
||||
:class="{ 'toggle-switch--active': includeEmptyLora }"
|
||||
@click="$emit('update:includeEmptyLora', !includeEmptyLora)"
|
||||
role="switch"
|
||||
:aria-checked="includeEmptyLora"
|
||||
title="Include an empty/blank LoRA option in the pool results"
|
||||
>
|
||||
<span class="toggle-switch__track"></span>
|
||||
<span class="toggle-switch__thumb"></span>
|
||||
</button>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -41,11 +57,13 @@
|
||||
defineProps<{
|
||||
noCreditRequired: boolean
|
||||
allowSelling: boolean
|
||||
includeEmptyLora: boolean
|
||||
}>()
|
||||
|
||||
defineEmits<{
|
||||
'update:noCreditRequired': [value: boolean]
|
||||
'update:allowSelling': [value: boolean]
|
||||
'update:includeEmptyLora': [value: boolean]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
@@ -69,6 +87,7 @@ defineEmits<{
|
||||
|
||||
.section__toggles {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface LoraPoolConfig {
|
||||
noCreditRequired: boolean
|
||||
allowSelling: boolean
|
||||
}
|
||||
includeEmptyLora: boolean
|
||||
}
|
||||
preview: { matchCount: number; lastUpdated: number }
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ export function useLoraPoolApi() {
|
||||
foldersExclude?: string[]
|
||||
noCreditRequired?: boolean
|
||||
allowSelling?: boolean
|
||||
includeEmptyLora?: boolean
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
@@ -92,6 +93,10 @@ export function useLoraPoolApi() {
|
||||
urlParams.set('allow_selling_generated_content', String(params.allowSelling))
|
||||
}
|
||||
|
||||
if (params.includeEmptyLora !== undefined) {
|
||||
urlParams.set('include_empty_lora', String(params.includeEmptyLora))
|
||||
}
|
||||
|
||||
const response = await fetch(`/api/lm/loras/list?${urlParams}`)
|
||||
const data = await response.json()
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
const excludeFolders = ref<string[]>([])
|
||||
const noCreditRequired = ref(false)
|
||||
const allowSelling = ref(false)
|
||||
const includeEmptyLora = ref(false)
|
||||
|
||||
// Available options from API
|
||||
const availableBaseModels = ref<BaseModelOption[]>([])
|
||||
@@ -52,7 +53,8 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
license: {
|
||||
noCreditRequired: noCreditRequired.value,
|
||||
allowSelling: allowSelling.value
|
||||
}
|
||||
},
|
||||
includeEmptyLora: includeEmptyLora.value
|
||||
},
|
||||
preview: {
|
||||
matchCount: matchCount.value,
|
||||
@@ -94,6 +96,7 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
updateIfChanged(excludeFolders, filters.folders?.exclude || [])
|
||||
updateIfChanged(noCreditRequired, filters.license?.noCreditRequired ?? false)
|
||||
updateIfChanged(allowSelling, filters.license?.allowSelling ?? false)
|
||||
updateIfChanged(includeEmptyLora, filters.includeEmptyLora ?? false)
|
||||
|
||||
// matchCount doesn't trigger watchers, so direct assignment is fine
|
||||
matchCount.value = preview?.matchCount || 0
|
||||
@@ -125,6 +128,7 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
foldersExclude: excludeFolders.value,
|
||||
noCreditRequired: noCreditRequired.value || undefined,
|
||||
allowSelling: allowSelling.value || undefined,
|
||||
includeEmptyLora: includeEmptyLora.value || undefined,
|
||||
pageSize: 6
|
||||
})
|
||||
|
||||
@@ -150,7 +154,8 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
includeFolders,
|
||||
excludeFolders,
|
||||
noCreditRequired,
|
||||
allowSelling
|
||||
allowSelling,
|
||||
includeEmptyLora
|
||||
], onFilterChange, { deep: true })
|
||||
|
||||
return {
|
||||
@@ -162,6 +167,7 @@ export function useLoraPoolState(widget: ComponentWidget<LoraPoolConfig>) {
|
||||
excludeFolders,
|
||||
noCreditRequired,
|
||||
allowSelling,
|
||||
includeEmptyLora,
|
||||
|
||||
// Available options
|
||||
availableBaseModels,
|
||||
|
||||
Reference in New Issue
Block a user