From 62e5558a48e238d68bcc3d969d45558c5b37b38c Mon Sep 17 00:00:00 2001 From: Tyler <68524461+TySP-Dev@users.noreply.github.com> Date: Sun, 17 May 2026 14:09:20 -0400 Subject: [PATCH] Fixing plugin not producing output --- ollama_answers.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ollama_answers.py b/ollama_answers.py index 4aaa1e2..cd590cb 100644 --- a/ollama_answers.py +++ b/ollama_answers.py @@ -7,7 +7,7 @@ except ImportError: get_network = None from flask import Response, request, abort, jsonify from searx.plugins import Plugin, PluginInfo -from searx.result_types import EngineResults +from searx.result_types import Answer from searx import settings from flask_babel import gettext from markupsafe import Markup @@ -630,23 +630,22 @@ class SXNGPlugin(Plugin): return "\n\n".join(context_parts), result_urls - def post_search(self, request: "SXNG_Request", search: "SearchWithPlugins") -> EngineResults: - results = EngineResults() + def post_search(self, request: "SXNG_Request", search: "SearchWithPlugins") -> list: try: if request and hasattr(request, 'headers') and request.headers.get('X-AI-Auxiliary'): - return results + return [] if request and request.form.get('format', 'html') != 'html': - return results + return [] if self.question_mark_required and '?' not in search.search_query.query: - return results + return [] current_tabs = set(search.search_query.categories) if not current_tabs: current_tabs = {'general'} if not self.active or not self.api_key or search.search_query.pageno > 1 or not self.allowed_tabs.intersection(current_tabs): - return results + return [] raw_results = search.result_container.get_ordered_results() raw_infoboxes = getattr(search.result_container, 'infoboxes', []) @@ -770,7 +769,7 @@ class SXNGPlugin(Plugin): ''' - search.result_container.answers.add(results.types.Answer(answer=Markup(html_payload))) + return [Answer(answer=Markup(html_payload))] except Exception as e: logger.error(f"{PLUGIN_NAME}: {e}") - return results \ No newline at end of file + return [] \ No newline at end of file