mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
The intent REQLLM path (core/handle/intentHandler.py) records a tool result via `Message(role="tool", content=text)` with no tool_call_id and no preceding assistant tool_calls. `Dialogue.getMessages` serializes it as a function_response anyway. When that history is later replayed to an OpenAI-compatible endpoint, the endpoint derives `function_response.name` by matching the tool_call_id back to a function_call; with no match the name is empty. gemini-2.5-flash tolerated the empty name, but gemini-3.5-flash rejects the whole request with HTTP 400 "GenerateContentRequest.contents[N].parts[0] .function_response.name: Name cannot be empty", so every affected turn falls back to "Sorry, the system is busy now." Only tool-using sessions and only the chat turns that replay the accumulated tool results were affected. Guard at the serialization boundary in `getMessages`: emit a role="tool" message as a function_response only when a preceding assistant message carries a matching tool_call id; otherwise demote it to a plain assistant context line so the turn survives. Valid tool-call pairs — including empty-string ids that still match — are unchanged. This defends against any orphan source, not just the intent path. Adds self-contained regression tests (no conftest required). |
||
|---|---|---|
| .. | ||
| config | ||
| core | ||
| models | ||
| music | ||
| performance_tester | ||
| plugins_func | ||
| test | ||
| agent-base-prompt.txt | ||
| app.py | ||
| config.yaml | ||
| config_from_api.yaml | ||
| docker-compose.yml | ||
| docker-compose_all.yml | ||
| mcp_server_settings.json | ||
| performance_tester.py | ||
| requirements.txt | ||