diff options
| author | Adam Malczewski <[email protected]> | 2026-05-23 19:07:21 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-23 19:07:21 +0900 |
| commit | 997b00034435440d412f955e05e53f09bae83f9e (patch) | |
| tree | 22d1f530e9e1a97bd19286456d2f06793bd030f7 /packages/core/src/credentials/api-keys.ts | |
| parent | ff00dec6ae2971bee38c74cb00fe034de9a839ee (diff) | |
| download | dispatch-997b00034435440d412f955e05e53f09bae83f9e.tar.gz dispatch-997b00034435440d412f955e05e53f09bae83f9e.zip | |
feat: google gemini provider, adaptive thinking for opus 4.7, model search filter
- Added Google (Gemini) as a provider: add-key UI, env var resolution via resolveApiKey, usage tracking via native models endpoint + gemini.google.com cookie scraping
- @ai-sdk/anthropic upgraded to v3 (adaptive thinking support) with LanguageModelV1 cast for ai v4 compat
- Claude Opus 4.7 uses adaptive thinking (type: adaptive); all other models keep explicit budget tokens
- Model selector modal: search filter with space matching dash/underscore
- Copy button: all tool results truncated at 300 chars
- Sidebar layout fix: Claude Reset panel removed from flex-1 fill to prevent overlap
Diffstat (limited to 'packages/core/src/credentials/api-keys.ts')
| -rw-r--r-- | packages/core/src/credentials/api-keys.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/core/src/credentials/api-keys.ts b/packages/core/src/credentials/api-keys.ts index af5aa0e..ef30400 100644 --- a/packages/core/src/credentials/api-keys.ts +++ b/packages/core/src/credentials/api-keys.ts @@ -40,10 +40,14 @@ export function getApiKey(keyId: string): string | null { } /** - * Resolve an API key from the database. Returns null if not found. + * Resolve an API key from the database, with env var fallback. + * Pass the env var name (e.g. "GOOGLE_API_KEY") to check process.env as well. */ -export function resolveApiKey(keyId: string): string | null { - return getApiKey(keyId); +export function resolveApiKey(keyId: string, envVar?: string): string | null { + const dbKey = getApiKey(keyId); + if (dbKey) return dbKey; + if (envVar) return process.env[envVar] ?? null; + return null; } /** |
