@@ -4,7 +4,7 @@ import { ModelConvertButton } from 'features/modelManagerV2/subpanels/ModelPanel
4
4
import { ModelEditButton } from 'features/modelManagerV2/subpanels/ModelPanel/ModelEditButton' ;
5
5
import { ModelHeader } from 'features/modelManagerV2/subpanels/ModelPanel/ModelHeader' ;
6
6
import { TriggerPhrases } from 'features/modelManagerV2/subpanels/ModelPanel/TriggerPhrases' ;
7
- import { memo } from 'react' ;
7
+ import { memo , useMemo } from 'react' ;
8
8
import { useTranslation } from 'react-i18next' ;
9
9
import type { AnyModelConfig } from 'services/api/types' ;
10
10
@@ -17,6 +17,20 @@ type Props = {
17
17
18
18
export const ModelView = memo ( ( { modelConfig } : Props ) => {
19
19
const { t } = useTranslation ( ) ;
20
+ const withSettings = useMemo ( ( ) => {
21
+ if ( modelConfig . type === 'main' && modelConfig . base !== 'sdxl-refiner' ) {
22
+ return true ;
23
+ }
24
+ if ( modelConfig . type === 'controlnet' || modelConfig . type === 't2i_adapter' ) {
25
+ return true ;
26
+ }
27
+ if ( modelConfig . type === 'main' || modelConfig . type === 'lora' ) {
28
+ return true ;
29
+ }
30
+
31
+ return false ;
32
+ } , [ modelConfig . base , modelConfig . type ] ) ;
33
+
20
34
return (
21
35
< Flex flexDir = "column" gap = { 4 } >
22
36
< ModelHeader modelConfig = { modelConfig } >
@@ -50,15 +64,19 @@ export const ModelView = memo(({ modelConfig }: Props) => {
50
64
) }
51
65
</ SimpleGrid >
52
66
</ Box >
53
- < Box layerStyle = "second" borderRadius = "base" p = { 4 } >
54
- { modelConfig . type === 'main' && modelConfig . base !== 'sdxl-refiner' && (
55
- < MainModelDefaultSettings modelConfig = { modelConfig } />
56
- ) }
57
- { ( modelConfig . type === 'controlnet' || modelConfig . type === 't2i_adapter' ) && (
58
- < ControlNetOrT2IAdapterDefaultSettings modelConfig = { modelConfig } />
59
- ) }
60
- { ( modelConfig . type === 'main' || modelConfig . type === 'lora' ) && < TriggerPhrases modelConfig = { modelConfig } /> }
61
- </ Box >
67
+ { withSettings && (
68
+ < Box layerStyle = "second" borderRadius = "base" p = { 4 } >
69
+ { modelConfig . type === 'main' && modelConfig . base !== 'sdxl-refiner' && (
70
+ < MainModelDefaultSettings modelConfig = { modelConfig } />
71
+ ) }
72
+ { ( modelConfig . type === 'controlnet' || modelConfig . type === 't2i_adapter' ) && (
73
+ < ControlNetOrT2IAdapterDefaultSettings modelConfig = { modelConfig } />
74
+ ) }
75
+ { ( modelConfig . type === 'main' || modelConfig . type === 'lora' ) && (
76
+ < TriggerPhrases modelConfig = { modelConfig } />
77
+ ) }
78
+ </ Box >
79
+ ) }
62
80
</ Flex >
63
81
</ Flex >
64
82
) ;
0 commit comments