@@ -14,6 +14,7 @@ import { AgentsEditor } from './AgentsEditor'
1414import { AgentsMdEditor } from './AgentsMdEditor'
1515import { McpManager } from './McpManager'
1616import { SkillsEditor } from './SkillsEditor'
17+ import { OpenCodeModelsEditor , type ConfigProvider } from './OpenCodeModelsEditor'
1718import { VersionSelectDialog } from './VersionSelectDialog'
1819import { MemoryPluginConfig } from './MemoryPluginConfig'
1920import { settingsApi } from '@/api/settings'
@@ -65,6 +66,7 @@ export function OpenCodeConfigManager() {
6566 agents : false ,
6667 skills : false ,
6768 mcp : false ,
69+ models : false ,
6870 } )
6971 const [ isCreateDialogOpen , setIsCreateDialogOpen ] = useState ( false )
7072 const [ isEditDialogOpen , setIsEditDialogOpen ] = useState ( false )
@@ -76,6 +78,7 @@ export function OpenCodeConfigManager() {
7678 const agentsRef = useRef < HTMLButtonElement > ( null )
7779 const skillsRef = useRef < HTMLButtonElement > ( null )
7880 const mcpRef = useRef < HTMLButtonElement > ( null )
81+ const modelsRef = useRef < HTMLButtonElement > ( null )
7982
8083 const { data : managedSkills = [ ] } = useQuery ( {
8184 queryKey : [ 'managed-skills' ] ,
@@ -868,6 +871,50 @@ export function OpenCodeConfigManager() {
868871 </ div >
869872 </ div >
870873 </ div >
874+
875+ < div className = "bg-card border border-border rounded-lg overflow-hidden min-w-0" >
876+ < button
877+ ref = { modelsRef }
878+ className = { cn ( "w-full px-4 py-3 flex items-center justify-between transition-colors min-w-0" , expandedSections . models ? "bg-muted/40 hover:bg-muted/50" : "hover:bg-muted/50" ) }
879+ onClick = { ( ) => {
880+ const isExpanding = ! expandedSections . models
881+ setExpandedSections ( prev => ( { ...prev , models : isExpanding } ) )
882+
883+ if ( isExpanding ) {
884+ setTimeout ( ( ) => scrollToSection ( modelsRef ) , 100 )
885+ }
886+ } }
887+ >
888+ < div className = "flex items-center gap-3 min-w-0" >
889+ < h4 className = "text-sm font-medium truncate" > Models</ h4 >
890+ < span className = "text-xs text-muted-foreground" >
891+ { ( ( ) => {
892+ const provider = selectedConfig . content ?. provider as Record < string , unknown > | undefined
893+ if ( ! provider ) return 0
894+ return Object . values ( provider ) . reduce < number > ( ( acc , p ) => {
895+ const models = ( p as { models ?: Record < string , unknown > } ) ?. models
896+ return acc + ( models ? Object . keys ( models ) . length : 0 )
897+ } , 0 )
898+ } ) ( ) } configured
899+ </ span >
900+ </ div >
901+ < ChevronDown className = { `h-4 w-4 transition-transform ${ expandedSections . models ? 'rotate-90' : '' } ` } />
902+ </ button >
903+ < div className = { `${ expandedSections . models ? 'block' : 'hidden' } border-t border-border` } >
904+ < div className = "p-4 max-h-[50vh] overflow-y-auto" >
905+ < OpenCodeModelsEditor
906+ providers = { ( selectedConfig . content ?. provider as Record < string , ConfigProvider > | undefined ) ?? { } }
907+ onChange = { ( providers ) => {
908+ const updatedContent = {
909+ ...selectedConfig . content ,
910+ provider : providers
911+ }
912+ updateConfigContent ( selectedConfig . name , updatedContent )
913+ } }
914+ />
915+ </ div >
916+ </ div >
917+ </ div >
871918 </ >
872919 ) : (
873920 < div className = "bg-card border border-border rounded-lg p-6" >
0 commit comments