perf: memo GridCard, fuse save fns, fix slash tab active color
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m32s
CI / Deploy production (on server) (push) Has been skipped

This commit is contained in:
Antigravity
2026-06-14 14:06:05 +00:00
parent a8785ed4f1
commit a623454347
120 changed files with 12301 additions and 785 deletions

View File

@@ -10,6 +10,7 @@ const OPENAI_COMPAT = new Set<string>([
'glm',
'custom',
'lmstudio',
'custom_openai',
]);
async function validateOpenAiCompatible(
@@ -25,8 +26,14 @@ async function validateOpenAiCompatible(
}
}
async function validateAnthropic(apiKey: string): Promise<void> {
const res = await fetch('https://api.anthropic.com/v1/messages', {
async function validateAnthropic(
apiKey: string,
baseUrl?: string,
): Promise<void> {
const url = baseUrl
? `${baseUrl.replace(/\/$/, '')}/messages`
: 'https://api.anthropic.com/v1/messages';
const res = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': apiKey,
@@ -83,8 +90,12 @@ export async function validateProviderApiKey(
return;
}
if (provider === 'anthropic' || provider === 'anthropic_custom') {
await validateAnthropic(apiKey);
if (
provider === 'anthropic' ||
provider === 'anthropic_custom' ||
provider === 'custom_anthropic'
) {
await validateAnthropic(apiKey, baseUrl);
return;
}
@@ -93,12 +104,18 @@ export async function validateProviderApiKey(
return;
}
if (provider === 'minimax') {
// MiniMax does not expose a public /models endpoint. Key is valid if not empty.
if (!apiKey.trim()) throw new Error('API key is required');
return;
}
if (provider === 'ollama' || provider === 'lmstudio') {
throw new Error('Local providers are not supported for BYOK');
}
if (OPENAI_COMPAT.has(provider)) {
const url = provider === 'custom'
const url = (provider === 'custom' || provider === 'custom_openai')
? baseUrl
: BASE_URLS[provider as AiGatewayProvider];
if (!url) {