{#- The name of model `model_id` of `setting`, a `ModelSetting`, with `effort` after it when there is one. -#} {% macro model_name(setting, model_id, effort) -%} {{ setting.models | selectattr("id", "equalto", model_id) | map(attribute="name") | first }}{% if effort %} ยท {{ effort }}{% endif %} {%- endmacro %} {#- What the agent of `setting`, a `ModelSetting`, writes with: the name of its model, with the effort. -#} {% macro used_name(setting) -%} {% set model, effort = setting.used() %}{% if setting.models %}{{ model_name(setting, model, effort) }}{% else %}the CLI chooses{% endif %} {%- endmacro %} {#- The two lists that set the model and the effort of an agent at one level, from `setting`, a `ModelSetting` with models; `agent_name` names the agent in their labels. The first option of the model list takes the level's own setting away, and names the default that then holds. The effort list always shows: it holds the levels of the picked model, and for the default, or a model with no levels, it only shows what holds, disabled. `model_setting.js` fills it again when the model changes, from the levels each model option carries: a page that shows the lists loads that script. With `labels` false they have no visible labels. With `default` false the model list has no option that takes the setting away, and the lists show what holds as picked: so the app level, where the default is the choice of the CLI, shows only models. autocomplete: a browser must not put back the pick of an earlier visit over the stored one. -#} {% macro model_setting_lists(setting, agent_name, labels=true, default=true) %} {% set picked, picked_effort = (setting.model, setting.effort) if default else setting.used() %} {% set efforts = (setting.models | selectattr("id", "equalto", picked) | map(attribute="efforts") | first) or [] %} {% if labels %}{% endif %} {% endmacro %}