>({});
const handleCancel = () => {
setCustomProviderName('');
setCustomBaseURL('');
setCustomApiKey('');
+ setCustomAuthMethod('api-key');
setPresetApiKeys({});
setOpen(false);
};
@@ -112,7 +115,8 @@ export function AISettingsDialog({ open: controlledOpen, onOpenChange }: AISetti
const newProvider: AIConnection = {
baseURL: customBaseURL.trim(),
- apiKey: customApiKey.trim(),
+ apiKey: customAuthMethod === 'nostr' ? undefined : customApiKey.trim(),
+ nostr: customAuthMethod === 'nostr' || undefined,
};
// Auto-save: Add provider immediately to persistent storage
@@ -121,6 +125,7 @@ export function AISettingsDialog({ open: controlledOpen, onOpenChange }: AISetti
setCustomProviderName('');
setCustomBaseURL('');
setCustomApiKey('');
+ setCustomAuthMethod('api-key');
};
const handleRemoveProvider = (name: string) => {
@@ -204,15 +209,35 @@ export function AISettingsDialog({ open: controlledOpen, onOpenChange }: AISetti
/>
-
- handleUpdateProvider(providerId, { apiKey: e.target.value })}
- />
+
+
+ {!provider?.nostr && (
+
+
+ handleUpdateProvider(providerId, { apiKey: e.target.value })}
+ />
+
+ )}
@@ -299,15 +324,37 @@ export function AISettingsDialog({ open: controlledOpen, onOpenChange }: AISetti
/>
-
- setCustomApiKey(e.target.value)}
- />
+
+
+ {customAuthMethod === 'api-key' && (
+
+
+ setCustomApiKey(e.target.value)}
+ />
+
+ )}