Bind chat agent sessions to individual devices

This commit is contained in:
showtan001
2026-08-30 21:48:39 +08:00
parent fdaca7539b
commit 697e54427b
3 changed files with 37 additions and 4 deletions
+5 -1
View File
@@ -86,12 +86,16 @@ The local Host console also exposes an authenticated conversational Agent API:
POST http://127.0.0.1:8765/api/chat
```
Send a JSON body containing `messages` (`user`/`assistant` roles). The Agent can
Send a JSON body containing `device_id` and `messages` (`user`/`assistant` roles). The Agent can
return ordinary assistant text or call the same device-operation tool contracts
used by the Runtime; each tool result is fed back to the model before the final
reply is returned. The endpoint uses the Host console session cookie, so it is
not an unauthenticated device-control endpoint.
Every chat request is bound to exactly one registered `device_id`. Keep a
separate message history and client session for each phone; the Agent injects
the bound device into device tools and rejects cross-device tool arguments.
For vision-capable OpenAI models, a user message may contain standard OpenAI
multimodal blocks: