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

{{ _('Metadata check') }}

{% snippet 'metadata_assistant/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 and for a translation. 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 always answers in the metadata language.') }}

{# #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', 'ai_translation_instructions'] %}

{{ titles[name] }}

{% if name == 'ai_review_instructions' %}

{{ _('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.') }}

{% else %}

{{ _('Sent with every translation as well, per language, from the metadata schema:') }}

{% if per_language %} {% endif %} {% 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 trial.kind == 'try' %} {% 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 %} {% else %} {% for s in r.suggestions %}
{{ s.label }} ({{ s.language_label }}): {{ s.suggested_value if s.suggested_value is string else s.suggested_value | join(', ') }}
{{ s.source_language_label }}: {{ s.source_value if s.source_value is string else s.source_value | join(', ') }}
{% else %}

{{ _('Nothing to translate in this dataset.') }}

{% endfor %} {% for f in r.failed %}
{{ f.language_label }}: {{ f.error }}
{% endfor %} {% endif %}
{% endif %}
{% if saved.values() | select | list %}
{{ h.csrf_input() }}
{% endif %} {% endblock %}