@@ -1118,6 +1118,7 @@ const CreateJobFormContent: React.FC<CreateJobFormProps> = ({
11181118 message : t ( 'components.createJobForm.pleaseEnterTaskName' ) ,
11191119 } ,
11201120 ] }
1121+ normalize = { value => value ?. trim ( ) || '' }
11211122 >
11221123 < Input
11231124 placeholder = { t ( 'components.createJobForm.taskNamePlaceholder' ) }
@@ -1151,7 +1152,55 @@ const CreateJobFormContent: React.FC<CreateJobFormProps> = ({
11511152 required : true ,
11521153 message : t ( 'components.createJobForm.pleaseEnterApiUrl' ) ,
11531154 } ,
1155+ {
1156+ validator : ( _ , value ) => {
1157+ if ( ! value ?. trim ( ) ) return Promise . resolve ( ) ;
1158+
1159+ const trimmedValue = value . trim ( ) ;
1160+
1161+ // Check for spaces in URL
1162+ if ( trimmedValue . includes ( ' ' ) ) {
1163+ return Promise . reject (
1164+ new Error (
1165+ t ( 'components.createJobForm.urlCannotContainSpaces' )
1166+ )
1167+ ) ;
1168+ }
1169+
1170+ // Check for proper protocol
1171+ if (
1172+ ! trimmedValue . startsWith ( 'http://' ) &&
1173+ ! trimmedValue . startsWith ( 'https://' )
1174+ ) {
1175+ return Promise . reject (
1176+ new Error (
1177+ t ( 'components.createJobForm.invalidUrlFormat' )
1178+ )
1179+ ) ;
1180+ }
1181+
1182+ try {
1183+ const url = new URL ( trimmedValue ) ;
1184+ // Additional validation: ensure hostname is present
1185+ if ( ! url . hostname || url . hostname . length === 0 ) {
1186+ return Promise . reject (
1187+ new Error (
1188+ t ( 'components.createJobForm.invalidUrlFormat' )
1189+ )
1190+ ) ;
1191+ }
1192+ return Promise . resolve ( ) ;
1193+ } catch ( error ) {
1194+ return Promise . reject (
1195+ new Error (
1196+ t ( 'components.createJobForm.invalidUrlFormat' )
1197+ )
1198+ ) ;
1199+ }
1200+ } ,
1201+ } ,
11541202 ] }
1203+ normalize = { value => value ?. trim ( ) || '' }
11551204 >
11561205 < Input
11571206 style = { { width : '70%' } }
@@ -1167,6 +1216,7 @@ const CreateJobFormContent: React.FC<CreateJobFormProps> = ({
11671216 message : t ( 'components.createJobForm.pleaseEnterApiPath' ) ,
11681217 } ,
11691218 ] }
1219+ normalize = { value => value ?. trim ( ) || '' }
11701220 >
11711221 < Input
11721222 style = { { width : '30%' } }
@@ -1196,6 +1246,7 @@ const CreateJobFormContent: React.FC<CreateJobFormProps> = ({
11961246 message : t ( 'components.createJobForm.pleaseEnterModelName' ) ,
11971247 } ,
11981248 ] }
1249+ normalize = { value => value ?. trim ( ) || '' }
11991250 >
12001251 < Input placeholder = 'e.g. gpt-4, claude-3, internlm3-latest' />
12011252 </ Form . Item >
@@ -1974,47 +2025,46 @@ const CreateJobFormContent: React.FC<CreateJobFormProps> = ({
19742025
19752026 < Col span = { 8 } >
19762027 < Form . Item
1977- name = { [ 'field_mapping' , 'stop_flag ' ] }
2028+ name = { [ 'field_mapping' , 'end_condition ' ] }
19782029 label = {
19792030 < span >
1980- { t ( 'components.createJobForm.stopSignal ' ) }
2031+ { t ( 'components.createJobForm.endFieldPath ' ) }
19812032 < Tooltip
1982- title = { t ( 'components.createJobForm.stopSignalTooltip' ) }
2033+ title = { t (
2034+ 'components.createJobForm.endFieldPathTooltip'
2035+ ) }
19832036 >
19842037 < InfoCircleOutlined style = { { marginLeft : 5 } } />
19852038 </ Tooltip >
19862039 </ span >
19872040 }
1988- rules = { [
1989- {
1990- required : true ,
1991- message : t (
1992- 'components.createJobForm.pleaseSpecifyStopSignal'
1993- ) ,
1994- } ,
1995- ] }
19962041 >
1997- < Input placeholder = '[DONE] ' />
2042+ < Input placeholder = 'choices.0.finish_reason ' />
19982043 </ Form . Item >
19992044 </ Col >
2000-
20012045 < Col span = { 8 } >
20022046 < Form . Item
2003- name = { [ 'field_mapping' , 'end_condition ' ] }
2047+ name = { [ 'field_mapping' , 'stop_flag ' ] }
20042048 label = {
20052049 < span >
2006- { t ( 'components.createJobForm.endFieldPath ' ) }
2050+ { t ( 'components.createJobForm.stopSignal ' ) }
20072051 < Tooltip
2008- title = { t (
2009- 'components.createJobForm.endFieldPathTooltip'
2010- ) }
2052+ title = { t ( 'components.createJobForm.stopSignalTooltip' ) }
20112053 >
20122054 < InfoCircleOutlined style = { { marginLeft : 5 } } />
20132055 </ Tooltip >
20142056 </ span >
20152057 }
2058+ rules = { [
2059+ {
2060+ required : true ,
2061+ message : t (
2062+ 'components.createJobForm.pleaseSpecifyStopSignal'
2063+ ) ,
2064+ } ,
2065+ ] }
20162066 >
2017- < Input placeholder = 'choices.0.finish_reason ' />
2067+ < Input placeholder = '[DONE] ' />
20182068 </ Form . Item >
20192069 </ Col >
20202070 </ Row >
0 commit comments