fix: default Groq model → llama-4-scout, normalize tool_calls type in history
All checks were successful
Deploy / deploy (push) Successful in 1m26s
All checks were successful
Deploy / deploy (push) Successful in 1m26s
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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 = ''
|
||||
|
||||
@@ -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'}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div style={{ fontSize: 11, color: 'var(--text-tertiary)', marginTop: 8, lineHeight: 1.5 }}>
|
||||
{voiceProvider === 'anthropic' ? 'Claude Haiku — точнее, лучше с tools. Платный (~$0.001/запрос).' : 'Groq Llama — быстро, бесплатно. Иногда глючит с tools.'}
|
||||
{voiceProvider === 'anthropic' ? 'Claude Haiku — точнее, лучше с tools. Платный (~$0.001/запрос).' : 'Groq Llama 4 Scout — быстро, бесплатно. Хорошо работает с tools.'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user