mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
`id` is optional in JSON-RPC and may legitimately be `null`. The previous
`int(payload.get("id", 0))` only defaults when the key is absent — a present
`"id": null` reaches `int(None)` and raises TypeError. The exception
propagates out of the message handler, the MCP handshake never completes, and
the session is left with ready=False (no device tools) and no clear error.
Use `or 0` so both the missing-key and explicit-null cases collapse to 0.
Applies to the result and error branches.
|
||
|---|---|---|
| .. | ||
| api | ||
| handle | ||
| providers | ||
| utils | ||
| auth.py | ||
| connection.py | ||
| http_server.py | ||
| websocket_server.py | ||