Add LoRA activation words and hide LoRAs that do not match the current engine.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,6 +32,12 @@
|
||||
<span class="block leading-none" aria-hidden="true">⋮⋮</span>
|
||||
</button>
|
||||
<span class="min-w-0 truncate text-zinc-200">{{ loraDisplayName(item.name) }}</span>
|
||||
<LoraTriggerTip
|
||||
:text="triggerFor(item.name)"
|
||||
:aria-label="'Activation for ' + loraDisplayName(item.name)"
|
||||
@insert="emit('insert-trigger', $event)"
|
||||
@save="saveTrigger(item.name, $event)"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
@@ -99,6 +105,7 @@ import {
|
||||
clampLoraStrength,
|
||||
loraDisplayName,
|
||||
loraIdentityKey,
|
||||
loraTriggerFor,
|
||||
makeLoraStackItem,
|
||||
type LoraStackItem
|
||||
} from '~/utils/loras'
|
||||
@@ -112,6 +119,7 @@ const props = withDefaults(defineProps<{
|
||||
compact?: boolean
|
||||
disabled?: boolean
|
||||
clipStrength?: boolean
|
||||
triggers?: Record<string, string>
|
||||
}>(), {
|
||||
label: 'LoRA',
|
||||
emptyLabel: 'None',
|
||||
@@ -119,9 +127,15 @@ const props = withDefaults(defineProps<{
|
||||
missingLabel: 'Wake GPU to load LoRAs',
|
||||
compact: false,
|
||||
disabled: false,
|
||||
clipStrength: true
|
||||
clipStrength: true,
|
||||
triggers: () => ({})
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
'insert-trigger': [text: string]
|
||||
'update-trigger': [name: string, trigger: string]
|
||||
}>()
|
||||
|
||||
const model = defineModel<LoraStackItem[]>({ default: () => [] })
|
||||
|
||||
const draggingIndex = ref<number | null>(null)
|
||||
@@ -201,4 +215,12 @@ function setStrength(index: number, key: 'strengthModel' | 'strengthClip', value
|
||||
const next = clampLoraStrength(value)
|
||||
model.value = model.value.map((item, i) => i === index ? { ...item, [key]: next } : item)
|
||||
}
|
||||
|
||||
function triggerFor(name: string) {
|
||||
return loraTriggerFor(name, props.triggers)
|
||||
}
|
||||
|
||||
function saveTrigger(name: string, trigger: string) {
|
||||
emit('update-trigger', name, trigger)
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user