11import React , { useEffect , useState } from 'react' ;
2- import { Form , Input , InputNumber , Switch , Select , Tooltip } from 'antd' ;
2+ import { Form , Switch , Tooltip } from 'antd' ;
33import { QuestionCircleOutlined } from '@ant-design/icons' ;
44import useGenericSettings from '@app/hooks/useGenericSettings' ;
55import { ImageModerationSettings as ImageModerationSettingsType , SettingsGroupType } from '@app/types/settings.types' ;
66import BaseSettingsForm from './BaseSettingsForm' ;
7-
8- const { Option } = Select ;
7+ import * as S from './Settings.styles' ;
8+ const { Option } = S . SelectField ;
99
1010const ImageModerationSettings : React . FC = ( ) => {
11- const {
12- settings,
13- loading,
14- error,
15- fetchSettings,
16- updateSettings,
17- saveSettings,
18- } = useGenericSettings ( 'image_moderation' ) ;
11+ const { settings, loading, error, fetchSettings, updateSettings, saveSettings } =
12+ useGenericSettings ( 'image_moderation' ) ;
1913
2014 const [ form ] = Form . useForm ( ) ;
2115 const [ isUserEditing , setIsUserEditing ] = useState ( false ) ;
@@ -24,13 +18,13 @@ const ImageModerationSettings: React.FC = () => {
2418 useEffect ( ( ) => {
2519 if ( settings && ! isUserEditing ) {
2620 console . log ( 'ImageModerationSettings - Received settings:' , settings ) ;
27-
21+
2822 // The useGenericSettings hook now returns properly prefixed field names
2923 // so we can use the settings directly without transformation
3024 const settingsObj = settings as Record < string , any > ;
31-
25+
3226 console . log ( 'ImageModerationSettings - Setting form values directly:' , settingsObj ) ;
33-
27+
3428 // Set form values directly since they're already properly prefixed
3529 form . setFieldsValue ( settingsObj ) ;
3630 console . log ( 'ImageModerationSettings - Form values after set:' , form . getFieldsValue ( ) ) ;
@@ -70,11 +64,7 @@ const ImageModerationSettings: React.FC = () => {
7064 setIsUserEditing ( false ) ;
7165 } }
7266 >
73- < Form . Item
74- name = "image_moderation_enabled"
75- label = "Enable Image Moderation"
76- valuePropName = "checked"
77- >
67+ < Form . Item name = "image_moderation_enabled" label = "Enable Image Moderation" valuePropName = "checked" >
7868 < Switch />
7969 </ Form . Item >
8070
@@ -89,27 +79,35 @@ const ImageModerationSettings: React.FC = () => {
8979 </ span >
9080 }
9181 >
92- < Select
93- allowClear = { true }
94- placeholder = "Select a moderation mode"
95- >
82+ < S . SelectField allowClear = { true } placeholder = "Select a moderation mode" >
9683 < Option value = "basic" > Basic Mode (Fastest, detects explicit content only)</ Option >
9784 < Option value = "strict" > Strict Mode (Fast, blocks all buttocks)</ Option >
9885 < Option value = "full" > Full Mode (Most accurate, uses Llama Vision)</ Option >
99- </ Select >
86+ </ S . SelectField >
10087 </ Form . Item >
101-
88+
10289 < Form . Item >
103- < div style = { {
104- backgroundColor : 'rgba(0, 0, 0, 0.1)' ,
105- padding : '12px' ,
106- borderRadius : '4px' ,
107- marginBottom : '16px'
108- } } >
90+ < div
91+ style = { {
92+ backgroundColor : 'rgba(0, 0, 0, 0.1)' ,
93+ padding : '12px' ,
94+ borderRadius : '4px' ,
95+ marginBottom : '16px' ,
96+ } }
97+ >
10998 < h4 style = { { marginTop : 0 } } > Moderation Mode Details:</ h4 >
110- < p > < strong > Basic Mode:</ strong > Only detects genitals, anus, and exposed breasts. Fastest processing (no Llama Vision). Best for high-volume applications.</ p >
111- < p > < strong > Strict Mode:</ strong > Includes all "basic" detection plus automatic blocking of all detected buttocks. Fast processing. Best for zero-tolerance platforms.</ p >
112- < p > < strong > Full Mode (Default):</ strong > Complete analysis with contextual evaluation. Slower due to Llama Vision, but most accurate. Reduces false positives.</ p >
99+ < p >
100+ < strong > Basic Mode:</ strong > Only detects genitals, anus, and exposed breasts. Fastest processing (no
101+ Llama Vision). Best for high-volume applications.
102+ </ p >
103+ < p >
104+ < strong > Strict Mode:</ strong > Includes all "basic" detection plus automatic blocking of all
105+ detected buttocks. Fast processing. Best for zero-tolerance platforms.
106+ </ p >
107+ < p >
108+ < strong > Full Mode (Default):</ strong > Complete analysis with contextual evaluation. Slower due to Llama
109+ Vision, but most accurate. Reduces false positives.
110+ </ p >
113111 </ div >
114112 </ Form . Item >
115113
@@ -118,14 +116,11 @@ const ImageModerationSettings: React.FC = () => {
118116 label = "API Endpoint"
119117 rules = { [ { required : true , message : 'Please enter the API endpoint' } ] }
120118 >
121- < Input placeholder = "http://localhost:8000/moderate" />
119+ < S . InputField placeholder = "http://localhost:8000/moderate" />
122120 </ Form . Item >
123121
124- < Form . Item
125- name = "image_moderation_temp_dir"
126- label = "Temporary Directory"
127- >
128- < Input placeholder = "./data/moderation/temp" />
122+ < Form . Item name = "image_moderation_temp_dir" label = "Temporary Directory" >
123+ < S . InputField placeholder = "./data/moderation/temp" />
129124 </ Form . Item >
130125
131126 < Form . Item
@@ -140,48 +135,43 @@ const ImageModerationSettings: React.FC = () => {
140135 }
141136 rules = { [
142137 { required : true , message : 'Please enter a threshold value' } ,
143- { type : 'number' , min : 0 , max : 1 , message : 'Value must be between 0 and 1' }
138+ { type : 'number' , min : 0 , max : 1 , message : 'Value must be between 0 and 1' } ,
144139 ] }
145140 >
146- < InputNumber
147- step = { 0.1 }
148- min = { 0 }
149- max = { 1 }
150- style = { { width : '100%' } }
151- />
141+ < S . InputNumberField step = { 0.1 } min = { 0 } max = { 1 } style = { { width : '100%' } } />
152142 </ Form . Item >
153143
154144 < Form . Item
155145 name = "image_moderation_check_interval"
156146 label = "Check Interval (seconds)"
157147 rules = { [
158148 { required : true , message : 'Please enter a check interval' } ,
159- { type : 'number' , min : 1 , message : 'Value must be at least 1' }
149+ { type : 'number' , min : 1 , message : 'Value must be at least 1' } ,
160150 ] }
161151 >
162- < InputNumber min = { 1 } style = { { width : '100%' } } />
152+ < S . InputNumberField min = { 1 } style = { { width : '100%' } } />
163153 </ Form . Item >
164154
165155 < Form . Item
166156 name = "image_moderation_concurrency"
167157 label = "Concurrency"
168158 rules = { [
169159 { required : true , message : 'Please enter a concurrency value' } ,
170- { type : 'number' , min : 1 , message : 'Value must be at least 1' }
160+ { type : 'number' , min : 1 , message : 'Value must be at least 1' } ,
171161 ] }
172162 >
173- < InputNumber min = { 1 } style = { { width : '100%' } } />
163+ < S . InputNumberField min = { 1 } style = { { width : '100%' } } />
174164 </ Form . Item >
175165
176166 < Form . Item
177167 name = "image_moderation_timeout"
178168 label = "Timeout (seconds)"
179169 rules = { [
180170 { required : true , message : 'Please enter a timeout value' } ,
181- { type : 'number' , min : 1 , message : 'Value must be at least 1' }
171+ { type : 'number' , min : 1 , message : 'Value must be at least 1' } ,
182172 ] }
183173 >
184- < InputNumber min = { 1 } style = { { width : '100%' } } />
174+ < S . InputNumberField min = { 1 } style = { { width : '100%' } } />
185175 </ Form . Item >
186176 </ Form >
187177 </ BaseSettingsForm >
0 commit comments