@@ -7,49 +7,65 @@ import type {
77} from 'features/controlLayers/store/types' ;
88import type { ParameterModel } from 'features/parameters/types/parameterSchemas' ;
99
10+ export const WARNINGS = {
11+ EMPTY_LAYER : 'parameters.invoke.layer.emptyLayer' ,
12+ UNSUPPORTED_MODEL : 'parameters.invoke.layer.unsupportedModel' ,
13+ RG_NO_PROMPTS_OR_IP_ADAPTERS : 'parameters.invoke.layer.rgNoPromptsOrIPAdapters' ,
14+ RG_NEGATIVE_PROMPT_NOT_SUPPORTED : 'parameters.invoke.layer.rgNegativePromptNotSupported' ,
15+ RG_REFERENCE_IMAGES_NOT_SUPPORTED : 'parameters.invoke.layer.rgReferenceImagesNotSupported' ,
16+ RG_AUTO_NEGATIVE_NOT_SUPPORTED : 'parameters.invoke.layer.rgAutoNegativeNotSupported' ,
17+ IP_ADAPTER_NO_MODEL_SELECTED : 'parameters.invoke.layer.ipAdapterNoModelSelected' ,
18+ IP_ADAPTER_INCOMPATIBLE_BASE_MODEL : 'parameters.invoke.layer.ipAdapterIncompatibleBaseModel' ,
19+ IP_ADAPTER_NO_IMAGE_SELECTED : 'parameters.invoke.layer.ipAdapterNoImageSelected' ,
20+ CONTROL_ADAPTER_NO_MODEL_SELECTED : 'parameters.invoke.layer.controlAdapterNoModelSelected' ,
21+ CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL : 'parameters.invoke.layer.controlAdapterIncompatibleBaseModel' ,
22+ } as const ;
23+
24+ type WarningTKey = ( typeof WARNINGS ) [ keyof typeof WARNINGS ] ;
25+
1026export const getRegionalGuidanceWarnings = (
1127 entity : CanvasRegionalGuidanceState ,
1228 model : ParameterModel | null
13- ) : string [ ] => {
14- const warnings : string [ ] = [ ] ;
29+ ) : WarningTKey [ ] => {
30+ const warnings : WarningTKey [ ] = [ ] ;
1531
1632 if ( entity . objects . length === 0 ) {
1733 // Layer is in empty state - skip other checks
18- warnings . push ( 'parameters.invoke.layer.emptyLayer' ) ;
34+ warnings . push ( WARNINGS . EMPTY_LAYER ) ;
1935 } else {
2036 if ( entity . positivePrompt === null && entity . negativePrompt === null && entity . referenceImages . length === 0 ) {
2137 // Must have at least 1 prompt or IP Adapter
22- warnings . push ( 'parameters.invoke.layer.rgNoPromptsOrIPAdapters' ) ;
38+ warnings . push ( WARNINGS . RG_NO_PROMPTS_OR_IP_ADAPTERS ) ;
2339 }
2440
2541 if ( model ) {
2642 if ( model . base === 'sd-3' || model . base === 'sd-2' ) {
2743 // Unsupported model architecture
28- warnings . push ( 'parameters.invoke.layer.unsupportedModel' ) ;
44+ warnings . push ( WARNINGS . UNSUPPORTED_MODEL ) ;
2945 } else if ( model . base === 'flux' ) {
3046 // Some features are not supported for flux models
3147 if ( entity . negativePrompt !== null ) {
32- warnings . push ( 'parameters.invoke.layer.rgNegativePromptNotSupported' ) ;
48+ warnings . push ( WARNINGS . RG_NEGATIVE_PROMPT_NOT_SUPPORTED ) ;
3349 }
3450 if ( entity . referenceImages . length > 0 ) {
35- warnings . push ( 'parameters.invoke.layer.rgReferenceImagesNotSupported' ) ;
51+ warnings . push ( WARNINGS . RG_REFERENCE_IMAGES_NOT_SUPPORTED ) ;
3652 }
3753 if ( entity . autoNegative ) {
38- warnings . push ( 'parameters.invoke.layer.rgAutoNegativeNotSupported' ) ;
54+ warnings . push ( WARNINGS . RG_AUTO_NEGATIVE_NOT_SUPPORTED ) ;
3955 }
4056 } else {
4157 entity . referenceImages . forEach ( ( { ipAdapter } ) => {
4258 if ( ! ipAdapter . model ) {
4359 // No model selected
44- warnings . push ( 'parameters.invoke.layer.ipAdapterNoModelSelected' ) ;
60+ warnings . push ( WARNINGS . IP_ADAPTER_NO_MODEL_SELECTED ) ;
4561 } else if ( ipAdapter . model . base !== model . base ) {
4662 // Supported model architecture but doesn't match
47- warnings . push ( 'parameters.invoke.layer.ipAdapterIncompatibleBaseModel' ) ;
63+ warnings . push ( WARNINGS . IP_ADAPTER_INCOMPATIBLE_BASE_MODEL ) ;
4864 }
4965
5066 if ( ! ipAdapter . image ) {
5167 // No image selected
52- warnings . push ( 'parameters.invoke.layer.ipAdapterNoImageSelected' ) ;
68+ warnings . push ( WARNINGS . IP_ADAPTER_NO_IMAGE_SELECTED ) ;
5369 }
5470 } ) ;
5571 }
@@ -62,71 +78,80 @@ export const getRegionalGuidanceWarnings = (
6278export const getGlobalReferenceImageWarnings = (
6379 entity : CanvasReferenceImageState ,
6480 model : ParameterModel | null
65- ) : string [ ] => {
66- const warnings : string [ ] = [ ] ;
81+ ) : WarningTKey [ ] => {
82+ const warnings : WarningTKey [ ] = [ ] ;
6783
6884 if ( ! entity . ipAdapter . model ) {
6985 // No model selected
70- warnings . push ( 'parameters.invoke.layer.ipAdapterNoModelSelected' ) ;
86+ warnings . push ( WARNINGS . IP_ADAPTER_NO_MODEL_SELECTED ) ;
7187 } else if ( model ) {
7288 if ( model . base === 'sd-3' || model . base === 'sd-2' ) {
7389 // Unsupported model architecture
74- warnings . push ( 'parameters.invoke.layer.unsupportedModel' ) ;
90+ warnings . push ( WARNINGS . UNSUPPORTED_MODEL ) ;
7591 } else if ( entity . ipAdapter . model . base !== model . base ) {
7692 // Supported model architecture but doesn't match
77- warnings . push ( 'parameters.invoke.layer.ipAdapterIncompatibleBaseModel' ) ;
93+ warnings . push ( WARNINGS . IP_ADAPTER_INCOMPATIBLE_BASE_MODEL ) ;
7894 }
7995 }
8096
8197 if ( ! entity . ipAdapter . image ) {
8298 // No image selected
83- warnings . push ( 'parameters.invoke.layer.ipAdapterNoImageSelected' ) ;
99+ warnings . push ( WARNINGS . IP_ADAPTER_NO_IMAGE_SELECTED ) ;
84100 }
85101
86102 return warnings ;
87103} ;
88104
89- export const getControlLayerWarnings = ( entity : CanvasControlLayerState , model : ParameterModel | null ) : string [ ] => {
90- const warnings : string [ ] = [ ] ;
105+ export const getControlLayerWarnings = (
106+ entity : CanvasControlLayerState ,
107+ model : ParameterModel | null
108+ ) : WarningTKey [ ] => {
109+ const warnings : WarningTKey [ ] = [ ] ;
91110
92111 if ( entity . objects . length === 0 ) {
93112 // Layer is in empty state - skip other checks
94- warnings . push ( 'parameters.invoke.layer.emptyLayer' ) ;
113+ warnings . push ( WARNINGS . EMPTY_LAYER ) ;
95114 } else {
96115 if ( ! entity . controlAdapter . model ) {
97116 // No model selected
98- warnings . push ( 'parameters.invoke.layer.controlAdapterNoModelSelected' ) ;
117+ warnings . push ( WARNINGS . CONTROL_ADAPTER_NO_MODEL_SELECTED ) ;
99118 } else if ( model ) {
100119 if ( model . base === 'sd-3' || model . base === 'sd-2' ) {
101120 // Unsupported model architecture
102- warnings . push ( 'parameters.invoke.layer.unsupportedModel' ) ;
121+ warnings . push ( WARNINGS . UNSUPPORTED_MODEL ) ;
103122 } else if ( entity . controlAdapter . model . base !== model . base ) {
104123 // Supported model architecture but doesn't match
105- warnings . push ( 'parameters.invoke.layer.controlAdapterIncompatibleBaseModel' ) ;
124+ warnings . push ( WARNINGS . CONTROL_ADAPTER_INCOMPATIBLE_BASE_MODEL ) ;
106125 }
107126 }
108127 }
109128
110129 return warnings ;
111130} ;
112131
113- export const getRasterLayerWarnings = ( entity : CanvasRasterLayerState , _model : ParameterModel | null ) : string [ ] => {
114- const warnings : string [ ] = [ ] ;
132+ export const getRasterLayerWarnings = (
133+ entity : CanvasRasterLayerState ,
134+ _model : ParameterModel | null
135+ ) : WarningTKey [ ] => {
136+ const warnings : WarningTKey [ ] = [ ] ;
115137
116138 if ( entity . objects . length === 0 ) {
117139 // Layer is in empty state - skip other checks
118- warnings . push ( 'parameters.invoke.layer.emptyLayer' ) ;
140+ warnings . push ( WARNINGS . EMPTY_LAYER ) ;
119141 }
120142
121143 return warnings ;
122144} ;
123145
124- export const getInpaintMaskWarnings = ( entity : CanvasInpaintMaskState , _model : ParameterModel | null ) : string [ ] => {
125- const warnings : string [ ] = [ ] ;
146+ export const getInpaintMaskWarnings = (
147+ entity : CanvasInpaintMaskState ,
148+ _model : ParameterModel | null
149+ ) : WarningTKey [ ] => {
150+ const warnings : WarningTKey [ ] = [ ] ;
126151
127152 if ( entity . objects . length === 0 ) {
128153 // Layer is in empty state - skip other checks
129- warnings . push ( 'parameters.invoke.layer.emptyLayer' ) ;
154+ warnings . push ( WARNINGS . EMPTY_LAYER ) ;
130155 }
131156
132157 return warnings ;
0 commit comments