Merge pull request #748 from duhaode520/master

🐞 fix(谷歌学术搜索): 包装search.results()为空可能造成的报错
这个提交包含在:
binary-husky
2023-05-15 17:27:41 +08:00
提交者 GitHub
当前提交 5f79fed566

查看文件

@@ -36,14 +36,18 @@ def get_meta_information(url, chatbot, history):
max_results = 1,
sort_by = arxiv.SortCriterion.Relevance,
)
paper = next(search.results())
if string_similar(title, paper.title) > 0.90: # same paper
abstract = paper.summary.replace('\n', ' ')
is_paper_in_arxiv = True
else: # different paper
try:
paper = next(search.results())
if string_similar(title, paper.title) > 0.90: # same paper
abstract = paper.summary.replace('\n', ' ')
is_paper_in_arxiv = True
else: # different paper
abstract = abstract
is_paper_in_arxiv = False
paper = next(search.results())
except:
abstract = abstract
is_paper_in_arxiv = False
paper = next(search.results())
print(title)
print(author)
print(citation)