[mod] plugin: AI tab only when activated, user API key, grounding on

Three changes to the ai_summary plugin:

- The *AI Summary* preferences tab is only rendered when the plugin is
  activated in settings.yml.  An instance that does not offer AI
  summaries no longer shows an AI tab at all.  The gate is the
  administrator setting, not the user opt-out, because the per user
  on/off switch lives inside that tab -- hiding it on opt-out would
  leave no way to opt back in.

- Users can configure an API key for their own LLM server
  (ai_summary_api_key).  The administrator key is still only sent to
  base_url and the user key only to a server the user configured, so
  neither key can be captured through the other.  The setting is marked
  secret: credentials are excluded from the preferences URL, which users
  copy around to transfer or share their preferences.

- Grounding summaries on the search results is now the default; the
  extra cost of the longer prompt is moderate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
jasonwitty
2026-08-07 12:45:50 -07:00
co-authored by Claude Opus 5
parent ce400f993c
commit 8edc368752
10 changed files with 148 additions and 37 deletions
+1 -1
View File
@@ -169,7 +169,7 @@ class TestPreferences(SearxTestCase):
self.preferences.parse_encoded_data(url_params)
self.assertEqual(
vars(self.preferences.key_value_settings['categories']),
{'value': ['general'], 'locked': False, 'choices': ['general', 'none']},
{'value': ['general'], 'locked': False, 'secret': False, 'choices': ['general', 'none']},
)
def test_save_key_value_setting(self):