{% extends "admin/base.html" %} {% set by_name = {} %} {% for row in rows %}{% do by_name.update({row.name: row}) %}{% endfor %} {% macro origin(name) %} {% set row = by_name[name] %} {% if row.saved %} {{ _('set on this page') }} {% if row.default %}{{ _("Without the setting on this page, the server's setting applies: {value}").format(value=row.default) }} {% elif name == 'suggest_fields' %}{{ _('Without the choice on this page, the fields the metadata schema marks with ai_suggest get suggestions (none, if it marks none).') }} {% else %}{{ _('Without the setting on this page, the built-in default applies.') }}{% endif %} {% endif %} {% for e in errors[name] or [] %}{{ e }}{% endfor %} {% endmacro %} {% block primary_content_inner %}

{{ _('Metadata assistant') }}

{% snippet 'ai_metadata/admin/_nav.html', active='check' %}

{{ _('What the check of a dataset\'s metadata does. The rule check works without any AI. Changes apply at once, for the whole portal, without a restart. Where nothing is saved here, the server default applies.') }}

{# The setup checks, here since the AI connection got a page of its own in ckanext-ai-connector (2026-11-18). #} {% set problems = checks | selectattr('status', 'equalto', 'error') | list %}

{{ _('Setup') }}

{% if problems %}{{ _('Something needs to be done before everything works:') }} {% else %}{{ _('Everything needed is in place.') }}{% endif %}

{{ h.csrf_input() }}
{{ _('On: the AI may write descriptions with Markdown and the suggestions can be previewed. Off: plain text only. Follow the schema: on when the description box is a Markdown box. Markdown is shown on the web but exported as typed, so keep it off if the page and the export must match.') }} {{ origin('markdown') }}
{{ _('On: when the editor leaves an address field with a new address, the panel asks the link check whether it answers, and says if it forwards or does not work. It needs the link check extension. The address is requested from the server, as in the nightly check.') }} {% if not link_check_on %}{{ _('The link check extension is not switched on here, so this has no effect.') }}{% endif %} {{ origin('check_addresses') }}
{{ _('How the page behind a dataset\'s landing page address is fetched for the review. The AI reads it in every case: it turns the page into a short summary of what the dataset contains, covers and how it is updated, which the review then uses. What differs is who fetches the page. The portal fetches it itself, as an ordinary web browser would: about a second, and it works with every model, but not for a page that is built in the browser with JavaScript, for a document such as a PDF file, or for a site that keeps the portal out. The AI service (Gemini, Claude) fetches it from its side: slower, up to half a minute when the site does not let it in, but it can read documents and sometimes a page the portal cannot. Automatic: the portal first, and the AI service if the portal cannot read the page, but not for a page that does not exist. The portal only: the same for every model. The AI service only: nothing else is tried.') }} {{ origin('landing_page_fetch') }}
{{ _('On: when an editor opens a dataset that has a landing page address, the page is read in the background, so that the suggestions come sooner when the editor asks for them. The reading is one call to the AI for every page that has not been read in the last hours, also when the editor never asks for suggestions. Off: the page is read when the editor asks for suggestions, or changes the address.') }} {{ origin('read_page_on_open') }}
{# Further fields for the AI (2026-11-22, extra_fields.py): only what the portal ticks here, one field at a time. #}
{{ _('AI suggestions for more fields') }}

{{ _('Besides title, description, keywords and theme, the AI can suggest values for the fields ticked here. For each such field the AI service gets its label, its help text, its current value and, for a list, all the choices. Tick only fields whose values the portal may send to the AI service; a free text field holds whatever the editors wrote. At most {count} fields.').format(count=max_fields) }}

{% if extra_fields %} {% for row in extra_fields %} {% endfor %}
{{ _('Field') }}{{ _('Kind') }}{{ _('Note') }}
{{ row.kind }}{% if row.choices %} ({{ ungettext('{count} choice', '{count} choices', row.choices).format(count=row.choices) }}){% endif %} {% if not row.usable %}{{ _('Cannot be used:') }} {{ row.reason }}{% endif %} {% if row.usable and row.sensitive %}{{ _('Going by the field\'s name only: it may be about personal data, confidentiality, rights, a licence or the law. Make sure that its values may be sent to the AI service, and remember that the editor, not the AI, decides such things.') }}{% endif %} {% if row.marked %}{{ _('Turned on in the metadata schema (ai_suggest), so ticked unless this page says otherwise.') }}{% endif %}
{% else %}

{{ _('The schema has no further fields.') }}

{% endif %} {{ origin('suggest_fields') }}
{{ h.csrf_input() }} {% set has_saved = rows | selectattr('saved') | list | length > 0 %} {% if has_saved %}{{ _('Forgets every setting changed on this page, not only the fields.') }} {% else %}{{ _('Nothing is changed on this page: the server\'s settings apply.') }}{% endif %}
{% endblock %}