{#- The page of a chat: its messages and proposals, then what the user may write. With `full` and an agent of `open_agents`, the agents open to the user, it is the form that sends a message to one of them. With `propose` it is the same form without the agents: it writes a proposal. Anyone else gets a line that says why there is no form. -#} {% extends "project/base.html" %} {% block title %}{{ chat.shown_title }} — aiwe{% endblock %} {% from "model_setting.html" import used_name %} {% block project %} {% set proposing = access == "propose" %}
{% include "chat/messages.html" %}
{% if access == "read" %}

You may only read this project.

{% elif chat.in_trash and proposing %}

This chat is in the trash: nobody writes here.

{% elif chat.in_trash %} {# A plain form: the page comes anew, with the form that sends a message. #}
This chat is in the trash: nobody writes here, and agents do not search it.
{% elif proposing or open_agents %} {# The script shows one of these while the page cannot reach the server or the sign-in is gone. The link opens a new tab, so the files picked here stay. #} {# Why the server refused the last message or the last pick of a model, in its own words. #} {# htmx posts the form and puts the messages it gets back in place of the list. drop: a second Send while one is on its way does nothing. The form is one line while it is out of focus and holds nothing to send. tabindex: a click on any part of the form gives it the focus, which unfolds it and keeps it so. A chat with no message opens ready to write. #}
{# The form may hold a proposal of the list over it: the script puts its text into the message and its id here. The form then sends that proposal as the user's message, or, for its author, gives it the new text. The line under this says so, and its button gives the form back. #}
{% if proposing %} Your proposal. You change its text: its files stay as they are. {% else %} Proposal of . Change it as you like: it goes to the agent as your own message. {% endif %}
{# Hidden: the script lists its files below, each with a button that takes it back. #}
{% if proposing %} A user with full access reads it and sends it to an agent. {% else %} {# Only the agents open to the user. None is checked when the agent the form would start on is not among them. #}
{% for agent in open_agents %} {% endfor %}
{# Names what the picked agent writes with, and opens the lists of every agent, which stand after the form. #} {% endif %} {% if speech_models %} {# The microphone starts a dictation and stops it. The arrow opens the speech models, which stand after the form; with one model there is nothing to pick. #}
{% if speech_models|length > 1 %} {% endif %}
{% endif %} {# `data-holding` is what the button says while the form holds a proposal. #}
{% if not proposing %} {% include "chat/models.html" %} {% endif %} {% if speech_models %} {# The speech models of voxo, in a box over the microphone. The script marks the one the browser keeps as picked. No part of the form: a pick is not sent with a message. #}

Speech model

{% for model in speech_models %} {% endfor %}
{% endif %} {% elif agents %}

No agent is open to you, so you write to none. The admin opens an agent to a user.

{% else %}

No agent to write to yet: the admin adds a Claude or Codex CLI on the Admin page.

{% endif %} {% endblock %}