@@ -100,9 +100,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
100100
101101 const [ newEndpoint , setNewEndpoint ] = useState < string > ( "" ) ; // openai, azure, ollama etc
102102 const [ newModel , setNewModel ] = useState < string > ( "" ) ;
103- const [ newApiKey , setNewApiKey ] = useState < string | undefined > ( undefined ) ;
104- const [ newApiBase , setNewApiBase ] = useState < string | undefined > ( undefined ) ;
105- const [ newApiVersion , setNewApiVersion ] = useState < string | undefined > ( undefined ) ;
103+ const [ newApiKey , setNewApiKey ] = useState < string > ( "" ) ;
104+ const [ newApiBase , setNewApiBase ] = useState < string > ( "" ) ;
105+ const [ newApiVersion , setNewApiVersion ] = useState < string > ( "" ) ;
106106
107107 // Fetch available models from the API
108108 useEffect ( ( ) => {
@@ -145,23 +145,6 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
145145 fetchModelOptions ( ) ;
146146 } , [ ] ) ;
147147
148- useEffect ( ( ) => {
149- if ( newEndpoint == 'ollama' ) {
150- if ( ! newApiBase ) {
151- setNewApiBase ( 'http://localhost:11434' ) ;
152- }
153- }
154- if ( newEndpoint == "openai" ) {
155- if ( ! newModel && providerModelOptions . openai . length > 0 ) {
156- setNewModel ( providerModelOptions . openai [ 0 ] ) ;
157- }
158- }
159- if ( newEndpoint == "anthropic" ) {
160- if ( ! newModel && providerModelOptions . anthropic . length > 0 ) {
161- setNewModel ( providerModelOptions . anthropic [ 0 ] ) ;
162- }
163- }
164- } , [ newEndpoint , providerModelOptions ] ) ;
165148
166149 let modelExists = models . some ( m =>
167150 m . endpoint == newEndpoint && m . model == newModel && m . api_base == newApiBase
@@ -247,8 +230,8 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
247230 < TextField fullWidth size = "small" type = { showKeys ? "text" : "password" }
248231 InputProps = { { style : { fontSize : "0.875rem" } } }
249232 placeholder = 'leave blank if using keyless access'
250- error = { ! ( newEndpoint == "azure" || newEndpoint == "ollama" || newEndpoint == "" ) && ! newApiKey }
251- value = { newApiKey } onChange = { ( event : any ) => { setNewApiKey ( event . target . value ) ; } }
233+ value = { newApiKey }
234+ onChange = { ( event : any ) => { setNewApiKey ( event . target . value ) ; } }
252235 autoComplete = 'off'
253236 />
254237 </ TableCell >
@@ -304,7 +287,6 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
304287 < TableCell align = "right" >
305288 < TextField size = "small" type = "text" fullWidth
306289 placeholder = "api_base"
307- error = { newEndpoint === "azure" && ! newApiBase }
308290 InputProps = { { style : { fontSize : "0.875rem" } } }
309291 value = { newApiBase }
310292 onChange = { ( event : any ) => { setNewApiBase ( event . target . value ) ; } }
@@ -343,9 +325,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
343325
344326 setNewEndpoint ( "" ) ;
345327 setNewModel ( "" ) ;
346- setNewApiKey ( undefined ) ;
347- setNewApiBase ( undefined ) ;
348- setNewApiVersion ( undefined ) ;
328+ setNewApiKey ( "" ) ;
329+ setNewApiBase ( "" ) ;
330+ setNewApiVersion ( "" ) ;
349331 } } >
350332 < AddCircleIcon />
351333 </ IconButton >
@@ -358,9 +340,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
358340 event . stopPropagation ( )
359341 setNewEndpoint ( "" ) ;
360342 setNewModel ( "" ) ;
361- setNewApiKey ( undefined ) ;
362- setNewApiBase ( undefined ) ;
363- setNewApiVersion ( undefined ) ;
343+ setNewApiKey ( "" ) ;
344+ setNewApiBase ( "" ) ;
345+ setNewApiVersion ( "" ) ;
364346 } } >
365347 < ClearIcon />
366348 </ IconButton >
@@ -527,7 +509,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
527509 { modelTable }
528510 </ DialogContent >
529511 < DialogActions >
530- { appConfig . DISABLE_DISPLAY_KEYS && (
512+ { ! appConfig . DISABLE_DISPLAY_KEYS && (
531513 < Button sx = { { marginRight : 'auto' } } endIcon = { showKeys ? < VisibilityOffIcon /> : < VisibilityIcon /> } onClick = { ( ) => {
532514 setShowKeys ( ! showKeys ) ; } } >
533515 { showKeys ? 'hide' : 'show' } keys
0 commit comments