[mod] tavily engine: revert double punctuation & remove f-stringed gettexts
This commit is contained in:
parent
1a3ffdb4ea
commit
e4e6f21494
@ -93,7 +93,7 @@ about = {
|
||||
"official_api_documentation": "https://docs.tavily.com/docs/rest-api/api-reference",
|
||||
"use_official_api": True,
|
||||
"require_api_key": True,
|
||||
"results": 'JSON',
|
||||
"results": "JSON",
|
||||
}
|
||||
|
||||
search_url = "https://api.tavily.com/search"
|
||||
@ -185,9 +185,9 @@ def response(resp):
|
||||
for result in data.get("results", []):
|
||||
results.append(
|
||||
{
|
||||
"title": result['title'],
|
||||
"title": result["title"],
|
||||
"url": result["url"],
|
||||
"content": f"[{gettext('ai')}] {result['content']}",
|
||||
"content": "[" + gettext("ai") + "] " + result["content"],
|
||||
"publishedDate": _parse_date(result.get("published_date")),
|
||||
}
|
||||
)
|
||||
@ -195,18 +195,18 @@ def response(resp):
|
||||
img_list = data.get("images")
|
||||
if img_list:
|
||||
result = {
|
||||
"infobox": f"Tavily [{gettext('ai')}]",
|
||||
"infobox": "Tavily [" + gettext("ai") + "]",
|
||||
"img_src": img_list[0],
|
||||
}
|
||||
|
||||
content = data.get("answer")
|
||||
if isinstance(img_list[0], dict):
|
||||
result["img_src"] = img_list[0]["url"]
|
||||
img_caption = f"<i>{gettext('Image caption')}</i>: {img_list[0]['description']}"
|
||||
img_caption = gettext("Image caption") + ": " + img_list[0]["description"]
|
||||
if not content:
|
||||
result["content"] = img_caption
|
||||
else:
|
||||
result["content"] = f"{content}<br/>{img_caption}"
|
||||
result["content"] = content + "//" + img_caption
|
||||
elif content:
|
||||
result["content"] = content
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user