diff --git a/app/api/settings/route.ts b/app/api/settings/route.ts index 62fd5c2..2245535 100644 --- a/app/api/settings/route.ts +++ b/app/api/settings/route.ts @@ -7,7 +7,7 @@ const SETTINGS_PATH = '/data/settings.json' const DEFAULTS = { voiceProvider: 'anthropic', anthropicModel: 'claude-haiku-4-5-20251001', - groqModel: 'llama-3.3-70b-versatile', + groqModel: 'meta-llama/llama-4-scout-17b-16e-instruct', } async function readSettings() { diff --git a/app/api/voice/chat/route.ts b/app/api/voice/chat/route.ts index 29ed4d6..66ab87e 100644 --- a/app/api/voice/chat/route.ts +++ b/app/api/voice/chat/route.ts @@ -23,7 +23,7 @@ const GROQ_API_KEY = process.env.GROQ_API_KEY || '' const GROQ_PROXY = process.env.GROQ_PROXY || '' const SETTINGS_PATH = '/data/settings.json' -const SETTINGS_DEFAULTS = { voiceProvider: 'anthropic', anthropicModel: 'claude-haiku-4-5-20251001', groqModel: 'llama-3.3-70b-versatile' } +const SETTINGS_DEFAULTS = { voiceProvider: 'anthropic', anthropicModel: 'claude-haiku-4-5-20251001', groqModel: 'meta-llama/llama-4-scout-17b-16e-instruct' } async function getVoiceSettings() { try { @@ -149,9 +149,16 @@ export async function POST(req: Request) { // ======== GROQ ======== if (provider === 'groq') { const groqModel = settings.groqModel || 'llama-3.3-70b-versatile' + // Нормализовать tool_calls в истории — Groq требует type:'function' + const normalizedHistory = history.map(m => { + if (m.role === 'assistant' && m.tool_calls?.length) { + return { ...m, tool_calls: m.tool_calls.map((tc: any) => ({ type: 'function', ...tc })) } + } + return m + }) const groqMessages: any[] = [ { role: 'system', content: sysPrompt }, - ...history, + ...normalizedHistory, { role: 'user', content: userText }, ] let lastToolSig = '' diff --git a/app/page.tsx b/app/page.tsx index 8f04e86..816bfff 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -807,12 +807,12 @@ function SettingsTab({ city, onCityChange, onLogout, theme, onThemeChange }: { c fontSize: 13, fontWeight: 600, cursor: 'pointer', transition: 'all 0.2s ease', }} > - {p === 'anthropic' ? '🧠 Claude Haiku' : '⚡ Groq Llama'} + {p === 'anthropic' ? '🧠 Claude Haiku' : '⚡ Groq Llama 4'} ))}
- {voiceProvider === 'anthropic' ? 'Claude Haiku — точнее, лучше с tools. Платный (~$0.001/запрос).' : 'Groq Llama — быстро, бесплатно. Иногда глючит с tools.'} + {voiceProvider === 'anthropic' ? 'Claude Haiku — точнее, лучше с tools. Платный (~$0.001/запрос).' : 'Groq Llama 4 Scout — быстро, бесплатно. Хорошо работает с tools.'}