{% extends "admin/base.html" %} {% set titles = { 'ai_review_instructions': _('Review of title, description, keywords and theme'), } %} {% block primary_content_inner %}

{{ _('Metadata assistant') }}

{% snippet 'ai_metadata/admin/_nav.html', active='instructions' %} {% if not ai_ready %}
{{ _('The AI is not set up yet, so these instructions are not used. Set it up under') }} {{ _('AI settings') }}.
{% endif %}

{{ _('This is the whole instruction to the AI for a review. The text here is only our default: change any of it to fit this catalogue. The answer format is asked for separately in every request, and each request also carries the material to judge: the dataset, the help text of each field, the name of the catalogue and its organisation, and whether Markdown may be used. Mention them here to say how to use them.') }}

{{ _('The built-in part is in English, which the AI follows best. Your own text can be in any language. The AI writes its suggestions in the metadata language, and its reasons and questions in the language of the page.') }}

{# #trial: after a trial, or a trial that failed, the page opens at the trial, its result and its errors #}
{{ h.csrf_input() }} {% for name in ['ai_review_instructions'] %}

{{ titles[name] }}

{{ _('Sent with every review as well: the help text of each field, from the form. Edit a help text, and the AI follows the new one.') }}

{{ _('Now:') }} {% if saved[name] and not form[name] %}{{ _('empty: the AI gets no instruction') }}{% elif saved[name] %}{{ _('changed on this page') }}{% else %}{{ _('the default text is used') }}{% endif %} {% for e in errors[name] or [] %}{{ e }}{% endfor %} {{ _('Emptying the field sends the AI no instruction at all. “Use the default texts” brings our default back.') }} {% if saved[name] %}
{{ _('Show the default text') }}
{{ defaults[name] }}
{% endif %} {% endfor %}

{{ _('Try on a dataset') }}

{{ _('Runs the AI with the texts in the form, without saving them. Nothing in the dataset changes.') }}

{% for e in errors.dataset or [] %}{{ e }}{% endfor %}
{% if trial %}
{{ _('Trial with the text in the form (nothing is saved)') }} {% set r = trial.result %} {% if r.summary %}

{{ r.summary }}

{% endif %} {% for s in r.suggestions %}
{{ s.field }}: {{ s.suggested_value if s.suggested_value is string else s.suggested_value | join(', ') }}
{{ s.reason }}
{% endfor %} {% if r.questions_for_editor %} {{ _('Questions for the editor') }} {% endif %}
{% endif %}
{% if saved.values() | select | list %}
{{ h.csrf_input() }}
{% endif %} {% endblock %}