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 = ''
|
||||
|
||||
Reference in New Issue
Block a user