feat: LLM_QUESTION_MARK_REQUIRED added as an optional gate for AI answer generation

This commit is contained in:
cra88y/pc
2026-03-29 20:57:37 -05:00
parent 4e567ce4e2
commit 76c77c997d
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -44,6 +44,7 @@ Configure via the environment variables:
- `LLM_CONTEXT_SHALLOW_COUNT`: Results with headlines only (additional breadth). Default `15`.
- `LLM_TABS`: Tab whitelist, comma delimiter. Default `general,science,it,news`.
- `LLM_INTERACTIVE`: UI mode. Default is `true` (interactive: copy, regenerate, follow up). Set to `false` for simple response only mode.
- `LLM_QUESTION_MARK_REQUIRED`: Only trigger AI answers when the query contains `?`. Default `false`.
## How It Works
1 user initial search
+4
View File
@@ -440,6 +440,7 @@ class SXNGPlugin(Plugin):
def _load_config(self):
self.interactive = os.getenv('LLM_INTERACTIVE', 'true').lower().strip() in ('true', '1', 'yes', 'on')
self.question_mark_required = os.getenv('LLM_QUESTION_MARK_REQUIRED', 'false').lower().strip() in ('true', '1', 'yes', 'on')
raw_provider = os.getenv('LLM_PROVIDER', '').lower().strip()
raw_url = os.getenv('LLM_URL', '').strip()
@@ -899,6 +900,9 @@ class SXNGPlugin(Plugin):
if request and hasattr(request, 'headers') and request.headers.get('X-AI-Auxiliary'):
return results
if self.question_mark_required and '?' not in search.search_query.query:
return results
current_tabs = set(search.search_query.categories)
if not current_tabs: current_tabs = {'general'}