{% from '_helpers.html' import render_field %} {% from '_stab.html' import stab_shell, stab_pane %} {# AI / LLM settings tab content — included from settings.html. Requires template context: form, llm_config, llm_env_configured #}
{{ _('Connect an LLM to move from "something changed" to "only the thing you care about changed".') }}
{{ _('Each watch or tag can carry a plain-text intent — %(ex1)s or %(ex2)s. On every detected change the AI evaluates the diff against it and suppresses irrelevant noise.', ex1='"notify me only when the price drops"', ex2='"alert when the item goes out of stock"') | safe }}
{{ _('Instead of raw diffs, receive plain-language summaries in notifications — %(ex1)s or %(ex2)s. Set a global default prompt here, or override per watch or tag.', ex1='"Price dropped from $89 to $67"', ex2='"3 new items added to the listing"') | safe }}
{{ _('The AI sees only a unified diff of what changed — never full page HTML. Low-cost models like %(gpt)s or %(gemini)s handle this well, typically fractions of a cent per check.', gpt='gpt-4o-mini', gemini='Gemini Flash') | safe }}
{{ _('AI Provider') }}
{% if not llm_env_configured and not (llm_config and llm_config.get('model')) %}{{ _('When AI features are active, change data from the websites you monitor — including page diffs and extracted text — is sent to an external AI provider of your choice.') }}
{{ _('Default AI Change Summary') }}
{{ _('Behaviour') }}
{% if llm_config and llm_config.get('model') %}{{ _('Token & Cost Tracking') }}
{% if llm_stored.get('tokens_total_cumulative') or llm_stored.get('tokens_this_month') %}⚠ {{ _('Monthly token budget reached. AI summarisation is paused until next month.') }}
{% endif %}LLM_TOKEN_BUDGET_MONTH)') | safe }}
{% else %}
{{ form.llm.form.llm_token_budget_month(placeholder=_('0 = unlimited'), value=llm_stored.get('token_budget_month', 0) or '') }}
{{ _('tokens (0 = unlimited)') }}
{% endif %}
LLM_MAX_INPUT_CHARS)') | safe }}
{% else %}
{{ form.llm.form.llm_max_input_chars(placeholder='100000', value=llm_stored.get('max_input_chars', 100000) or '') }}
{{ _('characters — currently enforcing: %(n)s', n='{:,}'.format(llm_effective_max_input_chars)) }}
{% endif %}
{{ _('No AI usage recorded yet.') }}
LLM_TOKEN_BUDGET_MONTH)') | safe }}
{% else %}
{{ form.llm.form.llm_token_budget_month(placeholder=_('0 = unlimited'), value=llm_stored.get('token_budget_month', 0) or '') }}
{{ _('tokens per month (0 = unlimited)') }}
{% endif %}
LLM_MAX_INPUT_CHARS)') | safe }}
{% else %}
{{ form.llm.form.llm_max_input_chars(placeholder='100000', value=llm_stored.get('max_input_chars', 100000) or '') }}
{{ _('characters — currently enforcing: %(n)s', n='{:,}'.format(llm_effective_max_input_chars)) }}
{% endif %}