From eb1ed245fe046dd714cf9faf1a4d657e38f35769 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Thu, 25 Sep 2025 20:42:18 +1000 Subject: [PATCH] tidy(ui): use Extract to get model config types --- .../frontend/web/src/services/api/types.ts | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/invokeai/frontend/web/src/services/api/types.ts b/invokeai/frontend/web/src/services/api/types.ts index 48313bd7ef..7506b29356 100644 --- a/invokeai/frontend/web/src/services/api/types.ts +++ b/invokeai/frontend/web/src/services/api/types.ts @@ -106,31 +106,34 @@ export const isVideoDTO = (dto: ImageDTO | VideoDTO): dto is VideoDTO => { }; // Model Configs -export type ControlLoRAModelConfig = S['ControlLoRALyCORISConfig'] | S['ControlLoRADiffusersConfig']; -export type LoRAModelConfig = S['LoRADiffusersConfig'] | S['LoRALyCORISConfig'] | S['LoRAOmiConfig']; -export type VAEModelConfig = S['VAECheckpointConfig'] | S['VAEDiffusersConfig']; -export type ControlNetModelConfig = S['ControlNetDiffusersConfig'] | S['ControlNetCheckpointConfig']; -export type IPAdapterModelConfig = S['IPAdapterInvokeAIConfig'] | S['IPAdapterCheckpointConfig']; -export type T2IAdapterModelConfig = S['T2IAdapterConfig']; -export type CLIPLEmbedModelConfig = S['CLIPLEmbedDiffusersConfig']; -export type CLIPGEmbedModelConfig = S['CLIPGEmbedDiffusersConfig']; -export type CLIPEmbedModelConfig = CLIPLEmbedModelConfig | CLIPGEmbedModelConfig; -type LlavaOnevisionConfig = S['LlavaOnevisionConfig']; -export type T5EncoderModelConfig = S['T5EncoderConfig']; -export type T5EncoderBnbQuantizedLlmInt8bModelConfig = S['T5EncoderBnbQuantizedLlmInt8bConfig']; -export type SpandrelImageToImageModelConfig = S['SpandrelImageToImageConfig']; -export type CheckpointModelConfig = S['MainCheckpointConfig']; -type CLIPVisionDiffusersConfig = S['CLIPVisionDiffusersConfig']; -type SigLipModelConfig = S['SigLIPConfig']; -export type FLUXReduxModelConfig = S['FluxReduxConfig']; -type ApiModelConfig = S['ApiModelConfig']; -export type VideoApiModelConfig = S['VideoApiModelConfig']; -type UnknownModelConfig = S['UnknownModelConfig']; +export type AnyModelConfig = S['AnyModelConfig']; export type MainModelConfig = Extract; +export type ControlLoRAModelConfig = Extract; +export type LoRAModelConfig = Extract; +export type VAEModelConfig = Extract; +export type ControlNetModelConfig = Extract; +export type IPAdapterModelConfig = Extract; +export type T2IAdapterModelConfig = Extract; +export type CLIPLEmbedModelConfig = Extract; +export type CLIPGEmbedModelConfig = Extract; +export type CLIPEmbedModelConfig = Extract; +type LlavaOnevisionConfig = Extract; +export type T5EncoderModelConfig = Extract; +export type T5EncoderBnbQuantizedLlmInt8bModelConfig = Extract< + S['AnyModelConfig'], + { type: 't5_encoder'; format: 'bnb_quantized_int8b' } +>; +export type SpandrelImageToImageModelConfig = Extract; +export type CheckpointModelConfig = Extract; +type CLIPVisionDiffusersConfig = Extract; +type SigLipModelConfig = Extract; +export type FLUXReduxModelConfig = Extract; +type ApiModelConfig = Extract; +export type VideoApiModelConfig = Extract; +type UnknownModelConfig = Extract; export type FLUXKontextModelConfig = MainModelConfig; export type ChatGPT4oModelConfig = ApiModelConfig; export type Gemini2_5ModelConfig = ApiModelConfig; -export type AnyModelConfig = S['AnyModelConfig']; /** * Checks if a list of submodels contains any that match a given variant or type