Skip to content

Commit 7961211

Browse files
style: format code with Autopep8
This commit fixes the style issues introduced in f5c724d according to the output from Autopep8. Details: None
1 parent f5c724d commit 7961211

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

python/searxng-addons/search_answers_llm/plugins_langchain_llm.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ class SXNGPlugin(Plugin):
7373

7474
def __init__(self, plg_cfg: "PluginCfg") -> None:
7575
super().__init__(plg_cfg)
76-
print(f"[DEBUG] LangChain plugin initialized with active={plg_cfg.active}")
76+
print(
77+
f"[DEBUG] LangChain plugin initialized with active={plg_cfg.active}")
7778

7879
self.info = PluginInfo(
7980
id=self.id,
8081
name=gettext("LangChain LLM"),
81-
description=gettext("Generate AI answers using LLM with rich formatting"),
82+
description=gettext(
83+
"Generate AI answers using LLM with rich formatting"),
8284
preference_section="general",
8385
)
8486

@@ -105,7 +107,8 @@ def post_search(
105107
) -> EngineResults:
106108
results = EngineResults()
107109

108-
print(f"[DEBUG] post_search called for query: {search.search_query.query}")
110+
print(
111+
f"[DEBUG] post_search called for query: {search.search_query.query}")
109112

110113
# Only process on first page
111114
if search.search_query.pageno > 1:
@@ -192,7 +195,8 @@ def _get_search_context(self, query: str) -> list[dict]:
192195
timeout_limit=5.0, # 5 second timeout for context search
193196
)
194197

195-
print(f"[DEBUG] Created SearchQuery with {len(engine_refs)} engines")
198+
print(
199+
f"[DEBUG] Created SearchQuery with {len(engine_refs)} engines")
196200

197201
# Execute the search
198202
context_search = Search(context_search_query)
@@ -273,7 +277,8 @@ def _generate_contextual_answer_html(
273277
print(f"[DEBUG] Generated contextual response: {answer[:100]}...")
274278

275279
# Create formatted HTML answer from markdown
276-
formatted_answer = self._format_html_answer(answer, has_context=True)
280+
formatted_answer = self._format_html_answer(
281+
answer, has_context=True)
277282
return formatted_answer
278283

279284
except Exception as e:
@@ -310,7 +315,8 @@ def _generate_simple_answer_html(self, query: str) -> str:
310315
print(f"[DEBUG] Generated simple response: {answer[:100]}...")
311316

312317
# Create formatted HTML answer from markdown
313-
formatted_answer = self._format_html_answer(answer, has_context=False)
318+
formatted_answer = self._format_html_answer(
319+
answer, has_context=False)
314320
return formatted_answer
315321

316322
except Exception as e:
@@ -382,7 +388,8 @@ def _format_search_context(self, search_context: list[dict]) -> str:
382388
content = result.get("content", "")
383389
if content:
384390
# Truncate content to avoid token limits
385-
content = content[:300] + "..." if len(content) > 300 else content
391+
content = content[:300] + \
392+
"..." if len(content) > 300 else content
386393
context_parts.append(f"Content: {content}")
387394

388395
source = result.get("engine", "Unknown")

0 commit comments

Comments
 (0)