diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py index 4235c9240..d3e758ed2 100644 --- a/changedetectionio/blueprint/tags/__init__.py +++ b/changedetectionio/blueprint/tags/__init__.py @@ -6,7 +6,7 @@ from loguru import logger from changedetectionio.blueprint.tags.colour import safe_css_colour from changedetectionio.store import ChangeDetectionStore from changedetectionio.flask_app import login_optionally_required -from changedetectionio.llm.evaluator import get_llm_config as _get_llm_config +from changedetectionio.llm.evaluator import get_llm_config as _get_llm_config, is_llm_features_disabled def construct_blueprint(datastore: ChangeDetectionStore): @@ -230,6 +230,7 @@ def construct_blueprint(datastore: ChangeDetectionStore): output = render_template("edit-tag.html", extra_form_content=included_content, extra_tab_content=form.extra_tab_content() if form.extra_tab_content() else None, + llm_features_disabled=is_llm_features_disabled(), matching_watches=matching_watches, settings_application=datastore.data['settings']['application'], **template_args diff --git a/changedetectionio/blueprint/tags/templates/edit-tag.html b/changedetectionio/blueprint/tags/templates/edit-tag.html index 82e8aca8d..d86d8bafa 100644 --- a/changedetectionio/blueprint/tags/templates/edit-tag.html +++ b/changedetectionio/blueprint/tags/templates/edit-tag.html @@ -29,7 +29,9 @@
  • {{ _('General') }}
  • {# Always shown, like the watch edit page: with no provider configured the pane explains how to set one up (and carries the AI switches through on save). #} +{%- if not llm_features_disabled %}
  • {{ _('AI / LLM') }}
  • +{%- endif -%}
  • {{ _('Filters & Triggers') }}
  • {% if extra_tab_content %}
  • {{ extra_tab_content }}
  • @@ -91,11 +93,11 @@ - +{%- if not llm_features_disabled %}
    {% include "edit/include_llm_intent.html" %}
    - +{%- endif -%}
    {# TRANSLATORS: CJK fonts lack native italics; allow substitution with conventional local styling. dennis-ignore: W303 #}

    {{ _('These settings are added to any existing watch configurations.')|safe }}

    diff --git a/changedetectionio/tests/llm/test_llm_features_disabled.py b/changedetectionio/tests/llm/test_llm_features_disabled.py index b6fb2e315..336961147 100644 --- a/changedetectionio/tests/llm/test_llm_features_disabled.py +++ b/changedetectionio/tests/llm/test_llm_features_disabled.py @@ -47,7 +47,8 @@ def test_llm_features_disabled_hides_ui(client, live_server, monkeypatch): _llm_markers_absent(res.data, where='settings') # 3. Edit page for a watch (should not have an AI / LLM tab or include_llm_intent body) - uuid = datastore.add_watch(url='http://example.com', extras={'title': 'Disabled LLM watch'}) + uuid = datastore.add_watch(url='http://example.com', extras={'title': 'Disabled LLM watch'}, tag="LLMgroup") + tag_uuid = live_server.app.config['DATASTORE'].data['watching'][uuid]['tags'][0] res = client.get(url_for('ui.ui_edit.edit_page', uuid=uuid)) assert res.status_code == 200 _llm_markers_absent(res.data, where='edit') @@ -55,6 +56,11 @@ def test_llm_features_disabled_hides_ui(client, live_server, monkeypatch): assert b'name="llm_intent"' not in res.data assert b'name="llm_change_summary"' not in res.data + res = client.get(url_for("tags.form_tag_edit", uuid=tag_uuid)) + assert res.status_code == 200 + assert b'id="ai-llm"' not in res.data + assert b'llm_intent' not in res.data + # 4. Add-watch page - with no "what matters" intent box there is nothing to choose # between, so element selection is always on and the opt-in checkbox is not rendered. res = client.get(url_for('add_watch_ui.add_watch_ui_index'))