0071: A site's chat is pinned to its site
On this page
Status: accepted
Context
Chat (0062) reads all of Short Leash, so a question about one site leaves the model to work out which site is meant and to name it in every call. Small local models get this wrong: they leave the site out and read every site's requests, or they name another one. Each site has its own pages (Requests, the Monitor, Calls), and asking about a site from its own page should stay on that site.
Decision
A chat can be about one site. Its site is stored with the chat (chats.site, migration 0010) and set only when the chat starts: from the site's Chat page, leash ai chat --site, or POST /v1/ai/chats with site. An unknown site is refused.
In a site's chat, ai::chat::arguments overwrites the site argument of every tool whose schema has one, so reads and actions alike use the chat's site. Which tools those are comes from the tool definitions, so a new tool is covered on its own. get_logs reads that site's output unless the model asked for one of its processes, PHP's or a service's logs, and another site's log source is replaced with the chat's site. Tools about all of Short Leash, like list_sites and list_services, are left as they are. The model is also told which site the chat is about, but the overwrite doesn't rely on it.
The main Chat screen lists every chat and names the site on a site's chats. The site's Chat page lists only that site's chats.
Consequences
- A small model can't wander to another site, and an action's confirm always shows the chat's site.
- A site's chat can't compare two sites. Comparing sites needs a chat from the main Chat screen.
- Reads by id (a trace, a request, a query, a mail) take no site, so they aren't pinned: an id from another site, pasted into the chat, still reads that site's record. Ids the model finds by itself come from the chat's own reads, so they are this site's.
- Overwriting rather than filling in a missing site means a wrong site from the model is corrected silently. The tool row shows the site that was used.
- Deleting or renaming a site leaves its chats behind: they still list under its name and are deleted with other chats by retention.