fix: update Gemini API models to Gemini 3.5 and 3.1 matching 2026 AI Studio console

This commit is contained in:
2026-05-25 09:36:40 +05:00
parent aeed229184
commit 60d25261c8
+11 -8
View File
@@ -1,5 +1,5 @@
/** /**
* XFlow AI Utility — OpenRouter & Google Gemini Integration * XFlow AI Utility — OpenRouter & Google Gemini Integration (Updated for May 2026 Models)
*/ */
const OPENROUTER_BASE_URL = 'https://openrouter.ai/api/v1/chat/completions' const OPENROUTER_BASE_URL = 'https://openrouter.ai/api/v1/chat/completions'
@@ -10,10 +10,12 @@ export const AI_MODELS = {
laguna: 'poolside/laguna-m.1:free', laguna: 'poolside/laguna-m.1:free',
/** MoE 120B тяжёлая аналитика, архитектурный анализ, сложные рассуждения */ /** MoE 120B тяжёлая аналитика, архитектурный анализ, сложные рассуждения */
nemotron: 'nvidia/nemotron-3-super-120b-a12b:free', nemotron: 'nvidia/nemotron-3-super-120b-a12b:free',
/** Прямой вызов Gemini Flash */ /** Прямой вызов Gemini 3.5 Flash */
geminiFlash: 'gemini-1.5-flash', geminiFlash: 'gemini-3.5-flash',
/** Прямой вызов Gemini Pro */ /** Прямой вызов Gemini 3.1 Pro Preview */
geminiPro: 'gemini-1.5-pro' geminiPro: 'gemini-3.1-pro-preview',
/** Прямой вызов Gemini 3.1 Flash Lite */
geminiLite: 'gemini-3.1-flash-lite'
} as const } as const
export type AiModelKey = keyof typeof AI_MODELS export type AiModelKey = keyof typeof AI_MODELS
@@ -45,7 +47,7 @@ export const generateAIResponse = async (
if (!geminiKey) { if (!geminiKey) {
throw new Error('Gemini API key (GEMINI_API_KEY or GOOGLE_API_KEY) is not configured') throw new Error('Gemini API key (GEMINI_API_KEY or GOOGLE_API_KEY) is not configured')
} }
const geminiModel = resolvedModel.startsWith('gemini') ? resolvedModel : 'gemini-1.5-flash' const geminiModel = resolvedModel.startsWith('gemini') ? resolvedModel : 'gemini-3.5-flash'
console.log(`[AI] Direct Google Gemini call: ${geminiModel}`) console.log(`[AI] Direct Google Gemini call: ${geminiModel}`)
try { try {
@@ -130,6 +132,7 @@ export const getAvailableModels = () =>
const modelLabels: Record<AiModelKey, string> = { const modelLabels: Record<AiModelKey, string> = {
laguna: '🏊 Laguna M.1 — стабильная инженерная (Claude via OpenRouter)', laguna: '🏊 Laguna M.1 — стабильная инженерная (Claude via OpenRouter)',
nemotron: '🔬 Nemotron Super 120B — тяжёлая аналитика (NVIDIA via OpenRouter)', nemotron: '🔬 Nemotron Super 120B — тяжёлая аналитика (NVIDIA via OpenRouter)',
geminiFlash: '⚡ Gemini 1.5 Flash — быстрая и стабильная (Google Direct)', geminiFlash: '⚡ Gemini 3.5 Flash — быстрая и стабильная (Google Direct)',
geminiPro: '🧠 Gemini 1.5 Pro — продвинутая аналитика (Google Direct)' geminiPro: '🧠 Gemini 3.1 Pro — продвинутая аналитика (Google Direct)',
geminiLite: '🍃 Gemini 3.1 Flash Lite — экономичная (Google Direct)'
} }