mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
check if lora is enabled before adding trigger phrases
This commit is contained in:
parent
641eefa4a1
commit
ff3067476e
@ -1,10 +1,10 @@
|
|||||||
import { isAnyOf } from '@reduxjs/toolkit';
|
import { isAnyOf } from '@reduxjs/toolkit';
|
||||||
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
import type { AppStartListening } from 'app/store/middleware/listenerMiddleware';
|
||||||
import { loraAdded, loraRemoved } from 'features/lora/store/loraSlice';
|
import { loraAdded, loraIsEnabledChanged, loraRecalled, loraRemoved } from 'features/lora/store/loraSlice';
|
||||||
import { modelChanged, triggerPhrasesChanged } from 'features/parameters/store/generationSlice';
|
import { modelChanged, triggerPhrasesChanged } from 'features/parameters/store/generationSlice';
|
||||||
import { modelsApi } from 'services/api/endpoints/models';
|
import { modelsApi } from 'services/api/endpoints/models';
|
||||||
|
|
||||||
const matcher = isAnyOf(loraAdded, loraRemoved, modelChanged);
|
const matcher = isAnyOf(loraAdded, loraRemoved, loraRecalled, loraIsEnabledChanged, modelChanged);
|
||||||
|
|
||||||
export const addPromptTriggerListChanged = (startAppListening: AppStartListening) => {
|
export const addPromptTriggerListChanged = (startAppListening: AppStartListening) => {
|
||||||
startAppListening({
|
startAppListening({
|
||||||
@ -27,7 +27,7 @@ export const addPromptTriggerListChanged = (startAppListening: AppStartListening
|
|||||||
|
|
||||||
for (let index = 0; index < Object.values(loras).length; index++) {
|
for (let index = 0; index < Object.values(loras).length; index++) {
|
||||||
const lora = Object.values(loras)[index];
|
const lora = Object.values(loras)[index];
|
||||||
if (lora) {
|
if (lora && lora.isEnabled) {
|
||||||
const { data: loraData } = await dispatch(modelsApi.endpoints.getModelMetadata.initiate(lora.model.key));
|
const { data: loraData } = await dispatch(modelsApi.endpoints.getModelMetadata.initiate(lora.model.key));
|
||||||
triggerPhrases = [...triggerPhrases, ...(loraData?.trigger_phrases || [])];
|
triggerPhrases = [...triggerPhrases, ...(loraData?.trigger_phrases || [])];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user