Fix provider API key validation trimming (#810)
This commit is contained in:
@@ -9,6 +9,7 @@ import type {
|
||||
ProviderVendorInfo,
|
||||
ProviderWithKeyInfo,
|
||||
} from '@/lib/providers';
|
||||
import { normalizeProviderApiKeyInput } from '@/lib/providers';
|
||||
import { hostApiFetch } from '@/lib/host-api';
|
||||
import {
|
||||
fetchProviderSnapshot,
|
||||
@@ -326,9 +327,10 @@ export const useProviderStore = create<ProviderState>((set, get) => ({
|
||||
|
||||
validateAccountApiKey: async (providerId, apiKey, options) => {
|
||||
try {
|
||||
const normalizedApiKey = normalizeProviderApiKeyInput(apiKey);
|
||||
const result = await hostApiFetch<{ valid: boolean; error?: string }>('/api/providers/validate', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ providerId, apiKey, options }),
|
||||
body: JSON.stringify({ providerId, apiKey: normalizedApiKey, options }),
|
||||
});
|
||||
return result;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user