@@ -100,9 +100,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
100
100
101
101
const [ newEndpoint , setNewEndpoint ] = useState < string > ( "" ) ; // openai, azure, ollama etc
102
102
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 > ( "" ) ;
106
106
107
107
// Fetch available models from the API
108
108
useEffect ( ( ) => {
@@ -145,23 +145,6 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
145
145
fetchModelOptions ( ) ;
146
146
} , [ ] ) ;
147
147
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 ] ) ;
165
148
166
149
let modelExists = models . some ( m =>
167
150
m . endpoint == newEndpoint && m . model == newModel && m . api_base == newApiBase
@@ -247,8 +230,8 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
247
230
< TextField fullWidth size = "small" type = { showKeys ? "text" : "password" }
248
231
InputProps = { { style : { fontSize : "0.875rem" } } }
249
232
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 ) ; } }
252
235
autoComplete = 'off'
253
236
/>
254
237
</ TableCell >
@@ -304,7 +287,6 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
304
287
< TableCell align = "right" >
305
288
< TextField size = "small" type = "text" fullWidth
306
289
placeholder = "api_base"
307
- error = { newEndpoint === "azure" && ! newApiBase }
308
290
InputProps = { { style : { fontSize : "0.875rem" } } }
309
291
value = { newApiBase }
310
292
onChange = { ( event : any ) => { setNewApiBase ( event . target . value ) ; } }
@@ -343,9 +325,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
343
325
344
326
setNewEndpoint ( "" ) ;
345
327
setNewModel ( "" ) ;
346
- setNewApiKey ( undefined ) ;
347
- setNewApiBase ( undefined ) ;
348
- setNewApiVersion ( undefined ) ;
328
+ setNewApiKey ( "" ) ;
329
+ setNewApiBase ( "" ) ;
330
+ setNewApiVersion ( "" ) ;
349
331
} } >
350
332
< AddCircleIcon />
351
333
</ IconButton >
@@ -358,9 +340,9 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
358
340
event . stopPropagation ( )
359
341
setNewEndpoint ( "" ) ;
360
342
setNewModel ( "" ) ;
361
- setNewApiKey ( undefined ) ;
362
- setNewApiBase ( undefined ) ;
363
- setNewApiVersion ( undefined ) ;
343
+ setNewApiKey ( "" ) ;
344
+ setNewApiBase ( "" ) ;
345
+ setNewApiVersion ( "" ) ;
364
346
} } >
365
347
< ClearIcon />
366
348
</ IconButton >
@@ -527,7 +509,7 @@ export const ModelSelectionButton: React.FC<{}> = ({ }) => {
527
509
{ modelTable }
528
510
</ DialogContent >
529
511
< DialogActions >
530
- { appConfig . DISABLE_DISPLAY_KEYS && (
512
+ { ! appConfig . DISABLE_DISPLAY_KEYS && (
531
513
< Button sx = { { marginRight : 'auto' } } endIcon = { showKeys ? < VisibilityOffIcon /> : < VisibilityIcon /> } onClick = { ( ) => {
532
514
setShowKeys ( ! showKeys ) ; } } >
533
515
{ showKeys ? 'hide' : 'show' } keys
0 commit comments