mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
Merge branch 'v0.9.0rc' into remove-sandbox-as-it-is-broken
This commit is contained in:
@@ -13,8 +13,10 @@ import { toast } from 'sonner';
|
||||
|
||||
export function ApiKeysSection() {
|
||||
const { apiKeys, setApiKeys } = useAppStore();
|
||||
const { claudeAuthStatus, setClaudeAuthStatus } = useSetupStore();
|
||||
const { claudeAuthStatus, setClaudeAuthStatus, codexAuthStatus, setCodexAuthStatus } =
|
||||
useSetupStore();
|
||||
const [isDeletingAnthropicKey, setIsDeletingAnthropicKey] = useState(false);
|
||||
const [isDeletingOpenaiKey, setIsDeletingOpenaiKey] = useState(false);
|
||||
|
||||
const { providerConfigParams, handleSave, saved } = useApiKeyManagement();
|
||||
|
||||
@@ -49,6 +51,34 @@ export function ApiKeysSection() {
|
||||
}
|
||||
}, [apiKeys, setApiKeys, claudeAuthStatus, setClaudeAuthStatus]);
|
||||
|
||||
// Delete OpenAI API key
|
||||
const deleteOpenaiKey = useCallback(async () => {
|
||||
setIsDeletingOpenaiKey(true);
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.deleteApiKey) {
|
||||
toast.error('Delete API not available');
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await api.setup.deleteApiKey('openai');
|
||||
if (result.success) {
|
||||
setApiKeys({ ...apiKeys, openai: '' });
|
||||
setCodexAuthStatus({
|
||||
authenticated: false,
|
||||
method: 'none',
|
||||
});
|
||||
toast.success('OpenAI API key deleted');
|
||||
} else {
|
||||
toast.error(result.error || 'Failed to delete API key');
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error('Failed to delete API key');
|
||||
} finally {
|
||||
setIsDeletingOpenaiKey(false);
|
||||
}
|
||||
}, [apiKeys, setApiKeys, setCodexAuthStatus]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -119,6 +149,23 @@ export function ApiKeysSection() {
|
||||
Delete Anthropic Key
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{apiKeys.openai && (
|
||||
<Button
|
||||
onClick={deleteOpenaiKey}
|
||||
disabled={isDeletingOpenaiKey}
|
||||
variant="outline"
|
||||
className="h-10 border-red-500/30 text-red-500 hover:bg-red-500/10 hover:border-red-500/50"
|
||||
data-testid="delete-openai-key"
|
||||
>
|
||||
{isDeletingOpenaiKey ? (
|
||||
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
|
||||
) : (
|
||||
<Trash2 className="w-4 h-4 mr-2" />
|
||||
)}
|
||||
Delete OpenAI Key
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user