@@ -38,7 +38,7 @@ type ProviderOption = {
3838type ConfigField = {
3939 field_name : string ;
4040 env_var : string ;
41- field_type : 'str' | 'integer' ;
41+ field_type : 'str' | 'integer' | 'model' ;
4242 required ?: boolean ;
4343 placeholder ?: string ;
4444 help_text ?: string ;
@@ -399,11 +399,18 @@ export default function EditInteractiveTaskModal({
399399 body . provider_name = provider . name ;
400400 }
401401
402- // Persist model name to history before saving
403- const modelName = configFieldValues [ 'MODEL_NAME' ] ;
404- if ( modelName ?. trim ( ) && ( interactiveType || galleryId ) ) {
405- const taskTypeOrId = interactiveType || galleryId ;
406- saveModelToHistory ( getModelHistoryKey ( taskTypeOrId ) , modelName . trim ( ) ) ;
402+ // Persist all model-type fields to history before saving
403+ const taskTypeOrId = interactiveType || galleryId ;
404+ if ( taskTypeOrId ) {
405+ const historyKey = getModelHistoryKey ( taskTypeOrId ) ;
406+ templateConfigFields
407+ . filter ( ( field ) => field . field_type === 'model' )
408+ . forEach ( ( field ) => {
409+ const modelValue = configFieldValues [ field . env_var ] ;
410+ if ( modelValue ?. trim ( ) ) {
411+ saveModelToHistory ( historyKey , modelValue . trim ( ) ) ;
412+ }
413+ } ) ;
407414 }
408415
409416 // The caller is responsible for actually persisting the changes via API.
@@ -542,20 +549,20 @@ export default function EditInteractiveTaskModal({
542549 < >
543550 { templateConfigFields . map ( ( field ) => {
544551 const isNgrokField = field . env_var === 'NGROK_AUTH_TOKEN' ;
545- const isModelNameField = field . env_var === 'MODEL_NAME ' ;
552+ const isModelField = field . field_type === 'model ' ;
546553 return (
547554 < FormControl
548555 key = { field . env_var }
549556 required = { field . required && ! isNgrokField }
550557 >
551558 < FormLabel > { field . field_name } </ FormLabel >
552- { isModelNameField ? (
559+ { isModelField ? (
553560 < ModelNameInput
554561 value = { configFieldValues [ field . env_var ] || '' }
555562 onChange = { ( v ) =>
556563 handleConfigFieldChange ( field . env_var , v )
557564 }
558- taskTypeOrId = { interactiveType }
565+ taskTypeOrId = { interactiveType || galleryId }
559566 placeholder = { field . placeholder }
560567 disabled = { false }
561568 required = { ! ! field . required }
0 commit comments