feat: integrate Google Gemini, MiniMax, and GLM providers; fix persistent agent loading toast
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 1m23s

This commit is contained in:
Antigravity
2026-05-10 22:33:35 +00:00
parent b23829846a
commit cf2786dec4
7 changed files with 278 additions and 5 deletions

View File

@@ -23,6 +23,9 @@ type AIProvider =
| 'mistral'
| 'zai'
| 'lmstudio'
| 'google'
| 'minimax'
| 'glm'
/** Providers that cannot be used for embeddings in Memento (no embedding API wired). */
const PROVIDERS_WITHOUT_EMBEDDINGS: AIProvider[] = ['anthropic', 'anthropic_custom']
@@ -45,6 +48,9 @@ const PROVIDER_META: Record<AIProvider, { apiKeyLabel: string; baseUrlLabel: str
zai: { apiKeyLabel: 'ZAI_API_KEY', baseUrlLabel: '', hasApiKey: true, hasBaseUrl: false, isLocal: false },
lmstudio: { apiKeyLabel: '', baseUrlLabel: 'admin.ai.baseUrl', hasApiKey: false, hasBaseUrl: true, isLocal: true },
custom: { apiKeyLabel: 'CUSTOM_OPENAI_API_KEY', baseUrlLabel: 'admin.ai.baseUrl', hasApiKey: true, hasBaseUrl: true, isLocal: false },
google: { apiKeyLabel: 'GOOGLE_GENERATIVE_AI_API_KEY', baseUrlLabel: '', hasApiKey: true, hasBaseUrl: false, isLocal: false },
minimax: { apiKeyLabel: 'MINIMAX_API_KEY', baseUrlLabel: '', hasApiKey: true, hasBaseUrl: false, isLocal: false },
glm: { apiKeyLabel: 'GLM_API_KEY', baseUrlLabel: '', hasApiKey: true, hasBaseUrl: false, isLocal: false },
}
// Config key names for each provider's API key (used to read/save from config)
@@ -59,6 +65,9 @@ const API_KEY_CONFIG: Record<AIProvider, string> = {
zai: 'ZAI_API_KEY',
lmstudio: 'LMSTUDIO_API_KEY',
custom: 'CUSTOM_OPENAI_API_KEY',
google: 'GOOGLE_GENERATIVE_AI_API_KEY',
minimax: 'MINIMAX_API_KEY',
glm: 'GLM_API_KEY',
}
const BASE_URL_CONFIG: Record<AIProvider, string> = {
@@ -72,6 +81,9 @@ const BASE_URL_CONFIG: Record<AIProvider, string> = {
zai: '',
lmstudio: 'LMSTUDIO_BASE_URL',
custom: 'CUSTOM_OPENAI_BASE_URL',
google: '',
minimax: '',
glm: '',
}
const DEFAULT_BASE_URLS: Record<AIProvider, string> = {
@@ -85,6 +97,9 @@ const DEFAULT_BASE_URLS: Record<AIProvider, string> = {
zai: 'https://api.zukijourney.com/v1',
lmstudio: 'http://localhost:1234/v1',
custom: '',
google: '',
minimax: 'https://api.minimax.io/v1',
glm: 'https://open.bigmodel.ai/api/paas/v4',
}
// Suggested models per provider (shown as hints in Combobox - user can always type a custom name)
@@ -112,6 +127,9 @@ const SUGGESTED_MODELS: Record<string, string[]> = {
deepseek: ['deepseek-chat', 'deepseek-reasoner'],
mistral: ['mistral-small-latest', 'mistral-medium-latest', 'mistral-large-latest', 'codestral-latest', 'mistral-embed'],
zai: ['gpt-4.1', 'gpt-4.1-mini', 'gpt-4o', 'gpt-4o-mini', 'claude-sonnet-4', 'gemini-2.5-flash'],
google: ['gemini-2.0-flash', 'gemini-1.5-flash', 'gemini-1.5-pro', 'gemini-1.0-pro'],
minimax: ['abab6.5-chat', 'abab6.5s-chat', 'abab5.5-chat'],
glm: ['glm-4', 'glm-4-air', 'glm-4-flash', 'glm-3-turbo'],
}
const SUGGESTED_EMBEDDINGS: Record<string, string[]> = {
@@ -605,6 +623,9 @@ export function AdminSettingsForm({ config }: { config: Record<string, string> }
{ value: 'mistral', label: t('admin.ai.providerMistralOption') },
{ value: 'zai', label: t('admin.ai.providerZAIOption') },
{ value: 'lmstudio', label: t('admin.ai.providerLMStudioOption') },
{ value: 'google', label: 'Google Gemini' },
{ value: 'minimax', label: 'MiniMax' },
{ value: 'glm', label: 'Zhipu GLM' },
{ value: 'custom', label: t('admin.ai.providerCustomOption') },
]