@@ -77,7 +77,7 @@ function AccountSettings() {
77
77
providerTokensSet . includes ( ProviderOptions . github ) || false ;
78
78
const isGitLabTokenSet =
79
79
providerTokensSet . includes ( ProviderOptions . gitlab ) || false ;
80
- const isLLMKeySet = settings ?. LLM_API_KEY === "**********" ;
80
+ const isLLMKeySet = settings ?. LLM_API_KEY_SET ;
81
81
const isAnalyticsEnabled = settings ?. USER_CONSENTS_TO_ANALYTICS ;
82
82
const isAdvancedSettingsSet = determineWhetherToToggleAdvancedSettings ( ) ;
83
83
@@ -120,11 +120,11 @@ function AccountSettings() {
120
120
const enableSoundNotifications =
121
121
formData . get ( "enable-sound-notifications-switch" ) ?. toString ( ) === "on" ;
122
122
const llmBaseUrl = formData . get ( "base-url-input" ) ?. toString ( ) || "" ;
123
+ const inputApiKey = formData . get ( "llm-api-key-input" ) ?. toString ( ) || "" ;
123
124
const llmApiKey =
124
- formData . get ( "llm-api-key-input" ) ?. toString ( ) ||
125
- ( isLLMKeySet
126
- ? undefined // don't update if it's already set
127
- : "" ) ; // reset if it's first time save to avoid 500 error
125
+ inputApiKey === "" && isLLMKeySet
126
+ ? undefined // don't update if it's already set and input is empty
127
+ : inputApiKey ; // otherwise use the input value
128
128
129
129
const githubToken = formData . get ( "github-token-input" ) ?. toString ( ) ;
130
130
const gitlabToken = formData . get ( "gitlab-token-input" ) ?. toString ( ) ;
@@ -151,7 +151,7 @@ function AccountSettings() {
151
151
ENABLE_SOUND_NOTIFICATIONS : enableSoundNotifications ,
152
152
LLM_MODEL : finalLlmModel ,
153
153
LLM_BASE_URL : finalLlmBaseUrl ,
154
- LLM_API_KEY : finalLlmApiKey ,
154
+ llm_api_key : finalLlmApiKey ,
155
155
AGENT : formData . get ( "agent-input" ) ?. toString ( ) ,
156
156
SECURITY_ANALYZER :
157
157
formData . get ( "security-analyzer-input" ) ?. toString ( ) || "" ,
@@ -277,10 +277,10 @@ function AccountSettings() {
277
277
label = "API Key"
278
278
type = "password"
279
279
className = "w-[680px]"
280
+ placeholder = { isLLMKeySet ? "<hidden>" : "" }
280
281
startContent = {
281
282
isLLMKeySet && < KeyStatusIcon isSet = { isLLMKeySet } />
282
283
}
283
- placeholder = { isLLMKeySet ? "<hidden>" : "" }
284
284
/>
285
285
) }
286
286
0 commit comments