{% extends "admin/base.html" %} {%- macro purpose_test_summary(purpose_tests) -%} {#- What "Test all purposes" or one extension's test answered: one line; each row says what it answered. -#} {% set failed = purpose_tests.values() | rejectattr('success') | list %} {% if not purpose_tests %}
{{ _('The connection to an AI service that the portal\'s extensions share: model, key and time limits. Changes apply at once, for the whole portal, without a restart. Where nothing is saved here, the server default applies. What each extension asks the AI to do is set on that extension\'s own pages.') }}
{% set problems = checks | selectattr('status', 'equalto', 'error') | list %}{% if problems %}{{ _('Something needs to be done before everything works:') }} {% else %}{{ _('Everything needed is in place.') }}{% endif %}
{{ check.fix }}{% endif %}
{{ _('Use the server\'s values? This changes:') }}
| {{ _('Setting') }} | {{ _('Now (saved here)') }} | {{ _('Becomes (the server\'s)') }} |
|---|---|---|
| {{ labels[name] }} | {{ by_name[name].value }} | {{ by_name[name].default }} |
{{ _('Other values saved here, and the API keys entered here, stay.') }}
{{ _('Cancel') }}{{ test.answer }}{% endif %}
{{ _('None yet.') }}
{% endif %} {% if can_store_keys %}{{ _('Adds a key without changing the model, for example before you switch service. The key is stored encrypted, goes only to the service you choose as the model, and is never shown again, only its last four characters.') }}
{#- Chosen first: what was sent (after an error), else the first service without a key. -#} {% set without_key = key_services | rejectattr('set') | list %} {% set chosen_service = request.form.get('custom_service', (without_key or key_services or [{'env': 'other'}])[0].env) %}{{ _('Start with the API key: add the key you got from your AI service under “Manage API keys” above. Then the model is chosen here, among that service\'s models.') }}
{% else %}{{ _('There is no API key yet, and this portal keeps its keys in the server configuration. Ask whoever runs the server to add one.') }}
{% endif %} {% else %} {% endif %} {#- Models for different purposes (API 2): an extension names what it uses the AI for, and each purpose may get a model of its own. Empty: the default model above. The key follows the model's service unless another is chosen. The heading is there also without any purpose, so that a sysadmin knows the possibility exists. -#} {% set chosen_any = purpose_rows | selectattr('model') | list or purpose_rows | selectattr('broken') | list %} {% set many_groups = (purpose_rows | map(attribute='consumer') | unique | list | length) > 1 %}{{ _('An extension can use the AI for several things. Each can have a model of its own, for example a fast, inexpensive one for translation and a stronger one for reviews. Leave a model empty to use the default model above. The key is the one for the model\'s service, unless you choose another; it is never sent to another service.') }} {% if purpose_rows and purpose_rows[0].default_model %}{{ _('The default model is now {model}.').format(model=purpose_rows[0].default_model) }}{% endif %}
{{ _('An extension that offers this lists its purposes here. An extension that does not offer it uses the default model and is not listed.') }}
{% if purposes_saved %}{{ _('No installed extension offers purposes of its own yet.') }}
{% elif first_time %}{{ _('Set up the default model above first; then a model can be chosen for each purpose.') }}
{% endif %} {% if purpose_tests is not none and not tested_consumer %}{{ purpose_test_summary(purpose_tests) }}{% endif %} {% if purpose_rows and not first_time %} {% endif %}