From d71320a5a9d327f2a8c0f59851fd5f96513dfffe Mon Sep 17 00:00:00 2001 From: Cosmo Date: Wed, 22 Jul 2026 20:54:45 +0000 Subject: [PATCH] =?UTF-8?q?fix(voice):=20=D0=B0=D0=B3=D0=B5=D0=BD=D1=82=20?= =?UTF-8?q?=D1=81=D0=BB=D1=83=D1=88=D0=B0=D0=B5=D1=82=200.0.0.0=20+=20?= =?UTF-8?q?=D0=B7=D0=B0=D1=89=D0=B8=D1=82=D0=B0=20tool=5Fuse.input=20?= =?UTF-8?q?=D0=BE=D1=82=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - agent/predict.py: HTTPServer bind 127.0.0.1 -> 0.0.0.0, иначе route.ts (контейнер планшета) не достукивается до tablet-agent по имени в сети coolify - route.ts: historyToAnthropicMessages приводит не-объект/null из tc.function.arguments к {} — Anthropic 400 (tool_use.input must be object) на legacy-истории от Groq (arguments: "null") Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01UYsVrPyJ5phJeVsAGciS1v --- agent/predict.py | 4 ++-- app/api/voice/chat/route.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/agent/predict.py b/agent/predict.py index 1308aad..1158b64 100644 --- a/agent/predict.py +++ b/agent/predict.py @@ -79,8 +79,8 @@ def serve(port): pass # тихо _ensure_loaded() - print(f"tablet-agent слушает http://127.0.0.1:{port} (порог {THRESHOLD})") - HTTPServer(("127.0.0.1", port), Handler).serve_forever() + print(f"tablet-agent слушает http://0.0.0.0:{port} (порог {THRESHOLD})") + HTTPServer(("0.0.0.0", port), Handler).serve_forever() def main(): diff --git a/app/api/voice/chat/route.ts b/app/api/voice/chat/route.ts index c8b6c39..cacc585 100644 --- a/app/api/voice/chat/route.ts +++ b/app/api/voice/chat/route.ts @@ -81,7 +81,7 @@ function historyToAnthropicMessages(history: HistoryMessage[]): any[] { if (msg.content) content.push({ type: 'text', text: msg.content }) for (const tc of msg.tool_calls) { let input: any = {} - try { input = JSON.parse(tc.function.arguments) } catch {} + try { const _p = JSON.parse(tc.function.arguments); if (_p && typeof _p === 'object' && !Array.isArray(_p)) input = _p } catch {} content.push({ type: 'tool_use', id: tc.id, name: tc.function.name, input }) } result.push({ role: 'assistant', content })