Fix static check errors.

This commit is contained in:
Ryan Dick 2024-07-02 09:05:02 -04:00
parent 504a42fe61
commit c1c8e55e8e
6 changed files with 27 additions and 10 deletions

View File

@ -21,6 +21,7 @@ export const ModelTypeFilter = () => {
t2i_adapter: t('common.t2iAdapter'), t2i_adapter: t('common.t2iAdapter'),
ip_adapter: t('common.ipAdapter'), ip_adapter: t('common.ipAdapter'),
clip_vision: 'Clip Vision', clip_vision: 'Clip Vision',
spandrel_image_to_image: 'Spandrel Image to Image',
}), }),
[t] [t]
); );

View File

@ -129,8 +129,17 @@ const InputFieldRenderer = ({ nodeId, fieldName }: InputFieldProps) => {
return <T2IAdapterModelFieldInputComponent nodeId={nodeId} field={fieldInstance} fieldTemplate={fieldTemplate} />; return <T2IAdapterModelFieldInputComponent nodeId={nodeId} field={fieldInstance} fieldTemplate={fieldTemplate} />;
} }
if (isSpandrelImageToImageModelFieldInputInstance(fieldInstance) && isSpandrelImageToImageModelFieldInputTemplate(fieldTemplate)) { if (
return <SpandrelImageToImageModelFieldInputComponent nodeId={nodeId} field={fieldInstance} fieldTemplate={fieldTemplate} />; isSpandrelImageToImageModelFieldInputInstance(fieldInstance) &&
isSpandrelImageToImageModelFieldInputTemplate(fieldTemplate)
) {
return (
<SpandrelImageToImageModelFieldInputComponent
nodeId={nodeId}
field={fieldInstance}
fieldTemplate={fieldTemplate}
/>
);
} }
if (isColorFieldInputInstance(fieldInstance) && isColorFieldInputTemplate(fieldTemplate)) { if (isColorFieldInputInstance(fieldInstance) && isColorFieldInputTemplate(fieldTemplate)) {

View File

@ -1,7 +1,7 @@
import { Combobox, FormControl, Tooltip } from '@invoke-ai/ui-library'; import { Combobox, FormControl, Tooltip } from '@invoke-ai/ui-library';
import { useAppDispatch } from 'app/store/storeHooks'; import { useAppDispatch } from 'app/store/storeHooks';
import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox'; import { useGroupedModelCombobox } from 'common/hooks/useGroupedModelCombobox';
import { fieldSpandrelImageToImageModelValueChanged, } from 'features/nodes/store/nodesSlice'; import { fieldSpandrelImageToImageModelValueChanged } from 'features/nodes/store/nodesSlice';
import type { import type {
SpandrelImageToImageModelFieldInputInstance, SpandrelImageToImageModelFieldInputInstance,
SpandrelImageToImageModelFieldInputTemplate, SpandrelImageToImageModelFieldInputTemplate,
@ -26,7 +26,6 @@ const SpandrelImageToImageModelFieldInputComponent = (
return; return;
} }
dispatch( dispatch(
fieldSpandrelImageToImageModelValueChanged({ fieldSpandrelImageToImageModelValueChanged({
nodeId, nodeId,
fieldName: field.name, fieldName: field.name,

View File

@ -335,7 +335,10 @@ export const nodesSlice = createSlice({
fieldT2IAdapterModelValueChanged: (state, action: FieldValueAction<T2IAdapterModelFieldValue>) => { fieldT2IAdapterModelValueChanged: (state, action: FieldValueAction<T2IAdapterModelFieldValue>) => {
fieldValueReducer(state, action, zT2IAdapterModelFieldValue); fieldValueReducer(state, action, zT2IAdapterModelFieldValue);
}, },
fieldSpandrelImageToImageModelValueChanged: (state, action: FieldValueAction<SpandrelImageToImageModelFieldValue>) => { fieldSpandrelImageToImageModelValueChanged: (
state,
action: FieldValueAction<SpandrelImageToImageModelFieldValue>
) => {
fieldValueReducer(state, action, zSpandrelImageToImageModelFieldValue); fieldValueReducer(state, action, zSpandrelImageToImageModelFieldValue);
}, },
fieldEnumModelValueChanged: (state, action: FieldValueAction<EnumFieldValue>) => { fieldEnumModelValueChanged: (state, action: FieldValueAction<EnumFieldValue>) => {

View File

@ -603,13 +603,16 @@ const zSpandrelImageToImageModelFieldOutputTemplate = zFieldOutputTemplateBase.e
export type SpandrelImageToImageModelFieldValue = z.infer<typeof zSpandrelImageToImageModelFieldValue>; export type SpandrelImageToImageModelFieldValue = z.infer<typeof zSpandrelImageToImageModelFieldValue>;
export type SpandrelImageToImageModelFieldInputInstance = z.infer<typeof zSpandrelImageToImageModelFieldInputInstance>; export type SpandrelImageToImageModelFieldInputInstance = z.infer<typeof zSpandrelImageToImageModelFieldInputInstance>;
export type SpandrelImageToImageModelFieldInputTemplate = z.infer<typeof zSpandrelImageToImageModelFieldInputTemplate>; export type SpandrelImageToImageModelFieldInputTemplate = z.infer<typeof zSpandrelImageToImageModelFieldInputTemplate>;
export const isSpandrelImageToImageModelFieldInputInstance = (val: unknown): val is SpandrelImageToImageModelFieldInputInstance => export const isSpandrelImageToImageModelFieldInputInstance = (
val: unknown
): val is SpandrelImageToImageModelFieldInputInstance =>
zSpandrelImageToImageModelFieldInputInstance.safeParse(val).success; zSpandrelImageToImageModelFieldInputInstance.safeParse(val).success;
export const isSpandrelImageToImageModelFieldInputTemplate = (val: unknown): val is SpandrelImageToImageModelFieldInputTemplate => export const isSpandrelImageToImageModelFieldInputTemplate = (
val: unknown
): val is SpandrelImageToImageModelFieldInputTemplate =>
zSpandrelImageToImageModelFieldInputTemplate.safeParse(val).success; zSpandrelImageToImageModelFieldInputTemplate.safeParse(val).success;
// #endregion // #endregion
// #region SchedulerField // #region SchedulerField
export const zSchedulerFieldValue = zSchedulerField.optional(); export const zSchedulerFieldValue = zSchedulerField.optional();

View File

@ -86,9 +86,11 @@ export const isT2IAdapterModelConfig = (config: AnyModelConfig): config is T2IAd
return config.type === 't2i_adapter'; return config.type === 't2i_adapter';
}; };
export const isSpandrelImageToImageModelConfig = (config: AnyModelConfig): config is SpandrelImageToImageModelConfig => { export const isSpandrelImageToImageModelConfig = (
config: AnyModelConfig
): config is SpandrelImageToImageModelConfig => {
return config.type === 'spandrel_image_to_image'; return config.type === 'spandrel_image_to_image';
} };
export const isControlAdapterModelConfig = ( export const isControlAdapterModelConfig = (
config: AnyModelConfig config: AnyModelConfig