This commit is contained in:
Michael Poluektov 2024-11-21 17:52:19 +00:00
parent 6783c98539
commit e1a85c99ab
2 changed files with 5 additions and 4 deletions

View File

@ -598,7 +598,9 @@ async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_
app.state.config.BRAVE_SEARCH_API_KEY = ( app.state.config.BRAVE_SEARCH_API_KEY = (
form_data.web.search.brave_search_api_key form_data.web.search.brave_search_api_key
) )
app.state.config.MOJEEK_SEARCH_API_KEY = form_data.web.search.mojeek_search_api_key app.state.config.MOJEEK_SEARCH_API_KEY = (
form_data.web.search.mojeek_search_api_key
)
app.state.config.SERPSTACK_API_KEY = form_data.web.search.serpstack_api_key app.state.config.SERPSTACK_API_KEY = form_data.web.search.serpstack_api_key
app.state.config.SERPSTACK_HTTPS = form_data.web.search.serpstack_https app.state.config.SERPSTACK_HTTPS = form_data.web.search.serpstack_https
app.state.config.SERPER_API_KEY = form_data.web.search.serper_api_key app.state.config.SERPER_API_KEY = form_data.web.search.serper_api_key

View File

@ -22,7 +22,7 @@ def search_mojeek(
headers = { headers = {
"Accept": "application/json", "Accept": "application/json",
} }
params = {"q": query, "api_key": api_key, 'fmt': 'json', 't': count} params = {"q": query, "api_key": api_key, "fmt": "json", "t": count}
response = requests.get(url, headers=headers, params=params) response = requests.get(url, headers=headers, params=params)
response.raise_for_status() response.raise_for_status()
@ -32,10 +32,9 @@ def search_mojeek(
if filter_list: if filter_list:
results = get_filtered_results(results, filter_list) results = get_filtered_results(results, filter_list)
return [ return [
SearchResult( SearchResult(
link=result["url"], title=result.get("title"), snippet=result.get("desc") link=result["url"], title=result.get("title"), snippet=result.get("desc")
) )
for result in results for result in results
] ]