mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-24 02:03:02 +08:00
chore(api/core): apply ruff reformatting (#7624)
This commit is contained in:
@@ -13,12 +13,8 @@ class SearXNGProvider(BuiltinToolProviderController):
|
||||
"credentials": credentials,
|
||||
}
|
||||
).invoke(
|
||||
user_id='',
|
||||
tool_parameters={
|
||||
"query": "SearXNG",
|
||||
"limit": 1,
|
||||
"search_type": "general"
|
||||
},
|
||||
user_id="",
|
||||
tool_parameters={"query": "SearXNG", "limit": 1, "search_type": "general"},
|
||||
)
|
||||
except Exception as e:
|
||||
raise ToolProviderCredentialValidationError(str(e))
|
||||
|
||||
@@ -23,18 +23,21 @@ class SearXNGSearchTool(BuiltinTool):
|
||||
ToolInvokeMessage | list[ToolInvokeMessage]: The result of the tool invocation.
|
||||
"""
|
||||
|
||||
host = self.runtime.credentials.get('searxng_base_url')
|
||||
host = self.runtime.credentials.get("searxng_base_url")
|
||||
if not host:
|
||||
raise Exception('SearXNG api is required')
|
||||
raise Exception("SearXNG api is required")
|
||||
|
||||
response = requests.get(host, params={
|
||||
"q": tool_parameters.get('query'),
|
||||
"format": "json",
|
||||
"categories": tool_parameters.get('search_type', 'general')
|
||||
})
|
||||
response = requests.get(
|
||||
host,
|
||||
params={
|
||||
"q": tool_parameters.get("query"),
|
||||
"format": "json",
|
||||
"categories": tool_parameters.get("search_type", "general"),
|
||||
},
|
||||
)
|
||||
|
||||
if response.status_code != 200:
|
||||
raise Exception(f'Error {response.status_code}: {response.text}')
|
||||
raise Exception(f"Error {response.status_code}: {response.text}")
|
||||
|
||||
res = response.json().get("results", [])
|
||||
if not res:
|
||||
|
||||
Reference in New Issue
Block a user