{% from "_macros.html" import icon %} {# The Chat/Agent switch, the folder tree and the unfiled chats. Its own partial because it is rendered from two places: the sidebar on every page, and `POST /api/preferences/sidebar-kind` when the switch is flicked. Pinned models stay above it in `sidebar.html` -- they start a chat of either kind and are not part of what is being switched. The switch is INSIDE the swapped fragment on purpose. Targeting only the tree would leave the two buttons showing the side you just left, which is the same class of failure as a control whose verb goes somewhere the event does not: the request works and the interface says otherwise. Each button keeps a stable id so htmx puts focus back on the one that was pressed. `sidebar_kind` is narrowed already: `sidebar_context` drops a folder holding nothing of this kind at any depth, so the heading below cannot appear above nothing. It is still passed down to `_folder.html`, which needs it for its own contents and for the children it recurses into. #}