File tree Expand file tree Collapse file tree 2 files changed +37
-8
lines changed
browser/components/Settings/sections Expand file tree Collapse file tree 2 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,17 @@ export function ProvidersSection() {
5757 }
5858 } , [ editingField , editValue ] ) ;
5959
60+ const handleClearBaseUrl = useCallback ( async ( provider : string ) => {
61+ setSaving ( true ) ;
62+ try {
63+ await window . api . providers . setProviderConfig ( provider , [ "baseUrl" ] , "" ) ;
64+ const cfg = await window . api . providers . getConfig ( ) ;
65+ setConfig ( cfg ) ;
66+ } finally {
67+ setSaving ( false ) ;
68+ }
69+ } , [ ] ) ;
70+
6071 const isConfigured = ( provider : string ) => {
6172 return config [ provider ] ?. apiKeySet ?? false ;
6273 } ;
@@ -192,13 +203,25 @@ export function ProvidersSection() {
192203 < span className = "text-foreground font-mono text-xs" >
193204 { providerConfig ?. baseUrl ?? "Default" }
194205 </ span >
195- < button
196- type = "button"
197- onClick = { ( ) => handleStartEdit ( provider , "baseUrl" ) }
198- className = "text-accent hover:text-accent-light text-xs"
199- >
200- { providerConfig ?. baseUrl ? "Change" : "Set" }
201- </ button >
206+ < div className = "flex gap-2" >
207+ { providerConfig ?. baseUrl && (
208+ < button
209+ type = "button"
210+ onClick = { ( ) => void handleClearBaseUrl ( provider ) }
211+ disabled = { saving }
212+ className = "text-muted hover:text-error text-xs"
213+ >
214+ Clear
215+ </ button >
216+ ) }
217+ < button
218+ type = "button"
219+ onClick = { ( ) => handleStartEdit ( provider , "baseUrl" ) }
220+ className = "text-accent hover:text-accent-light text-xs"
221+ >
222+ { providerConfig ?. baseUrl ? "Change" : "Set" }
223+ </ button >
224+ </ div >
202225 </ div >
203226 ) }
204227 </ div >
Original file line number Diff line number Diff line change @@ -1489,7 +1489,13 @@ export class IpcMain {
14891489 }
14901490
14911491 if ( keyPath . length > 0 ) {
1492- current [ keyPath [ keyPath . length - 1 ] ] = value ;
1492+ const lastKey = keyPath [ keyPath . length - 1 ] ;
1493+ // Delete key if value is empty string, otherwise set it
1494+ if ( value === "" ) {
1495+ delete current [ lastKey ] ;
1496+ } else {
1497+ current [ lastKey ] = value ;
1498+ }
14931499 }
14941500
14951501 // Save updated config
You can’t perform that action at this time.
0 commit comments