@@ -22,7 +22,38 @@ const ImageModerationSettings: React.FC = () => {
2222 // Update form values when settings change
2323 useEffect ( ( ) => {
2424 if ( settings ) {
25- form . setFieldsValue ( settings ) ;
25+ console . log ( 'ImageModerationSettings - Received settings:' , settings ) ;
26+
27+ // Transform property names to match form field names
28+ // The API returns properties without the prefix, but the form expects prefixed names
29+ const settingsObj = settings as Record < string , any > ;
30+
31+ const formValues = {
32+ image_moderation_api : settingsObj . api ,
33+ image_moderation_check_interval : typeof settingsObj . check_interval === 'string'
34+ ? parseFloat ( settingsObj . check_interval )
35+ : settingsObj . check_interval ,
36+ image_moderation_concurrency : typeof settingsObj . concurrency === 'string'
37+ ? parseFloat ( settingsObj . concurrency )
38+ : settingsObj . concurrency ,
39+ image_moderation_enabled : settingsObj . enabled ,
40+ image_moderation_mode : settingsObj . mode ,
41+ image_moderation_temp_dir : settingsObj . temp_dir ,
42+ image_moderation_threshold : typeof settingsObj . threshold === 'string'
43+ ? parseFloat ( settingsObj . threshold )
44+ : settingsObj . threshold ,
45+ image_moderation_timeout : typeof settingsObj . timeout === 'string'
46+ ? parseFloat ( settingsObj . timeout )
47+ : settingsObj . timeout
48+ } ;
49+
50+ console . log ( 'ImageModerationSettings - Transformed form values:' , formValues ) ;
51+
52+ // Set form values with a slight delay to ensure the form is ready
53+ setTimeout ( ( ) => {
54+ form . setFieldsValue ( formValues ) ;
55+ console . log ( 'ImageModerationSettings - Form values after set:' , form . getFieldsValue ( ) ) ;
56+ } , 100 ) ;
2657 }
2758 } , [ settings , form ] ) ;
2859
@@ -44,6 +75,7 @@ const ImageModerationSettings: React.FC = () => {
4475 layout = "vertical"
4576 onValuesChange = { handleValuesChange }
4677 initialValues = { settings || { } }
78+ onFinish = { ( values ) => console . log ( 'Form submitted with values:' , values ) }
4779 >
4880 < Form . Item
4981 name = "image_moderation_enabled"
@@ -65,9 +97,11 @@ const ImageModerationSettings: React.FC = () => {
6597 }
6698 >
6799 < Select >
68- < Option value = "full" > Full</ Option >
69- < Option value = "basic" > Basic</ Option >
70- < Option value = "minimal" > Minimal</ Option >
100+ < Option value = "full" > Full (Check all images)</ Option >
101+ < Option value = "basic" > Basic (Limited checks)</ Option >
102+ < Option value = "minimal" > Minimal (Essential checks only)</ Option >
103+ < Option value = "sample" > Sample (Check random images)</ Option >
104+ < Option value = "flagged" > Flagged Only (Check only reported images)</ Option >
71105 </ Select >
72106 </ Form . Item >
73107
0 commit comments