mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): typing issues related to trigger phrase changes
This commit is contained in:
parent
f0b815aa9b
commit
8fd9342712
@ -15,6 +15,7 @@ import type { ChangeEvent } from 'react';
|
||||
import { useCallback, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useGetModelConfigQuery, useUpdateModelMutation } from 'services/api/endpoints/models';
|
||||
import { isNonRefinerMainModelConfig } from 'services/api/types';
|
||||
|
||||
export const TriggerPhrases = () => {
|
||||
const { t } = useTranslation();
|
||||
@ -29,8 +30,11 @@ export const TriggerPhrases = () => {
|
||||
}, []);
|
||||
|
||||
const triggerPhrases = useMemo(() => {
|
||||
if (!modelConfig || !isNonRefinerMainModelConfig(modelConfig)) {
|
||||
return [];
|
||||
}
|
||||
return modelConfig?.trigger_phrases || [];
|
||||
}, [modelConfig?.trigger_phrases]);
|
||||
}, [modelConfig]);
|
||||
|
||||
const errors = useMemo(() => {
|
||||
const errors = [];
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
useGetModelConfigQuery,
|
||||
useGetTextualInversionModelsQuery,
|
||||
} from 'services/api/endpoints/models';
|
||||
import { isNonRefinerMainModelConfig } from 'services/api/types';
|
||||
|
||||
const noOptionsMessage = () => t('prompt.noMatchingTriggers');
|
||||
|
||||
@ -84,7 +85,7 @@ export const PromptTriggerSelect = memo(({ onSelect, onClose }: PromptTriggerSel
|
||||
}
|
||||
}
|
||||
|
||||
if (mainModelConfig && mainModelConfig.trigger_phrases?.length) {
|
||||
if (mainModelConfig && isNonRefinerMainModelConfig(mainModelConfig) && mainModelConfig.trigger_phrases?.length) {
|
||||
_options.push({
|
||||
label: t('modelManager.mainModelTriggerPhrases'),
|
||||
options: mainModelConfig.trigger_phrases.map((triggerPhrase) => ({
|
||||
|
Loading…
Reference in New Issue
Block a user