From 3f31fb99904265f31eaeb95a41e6358dd5f635ee Mon Sep 17 00:00:00 2001 From: duhaode520 Date: Mon, 15 May 2023 08:11:13 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9E=20fix(=E8=B0=B7=E6=AD=8C?= =?UTF-8?q?=E5=AD=A6=E6=9C=AF=E6=90=9C=E7=B4=A2):=20=E5=8C=85=E8=A3=85sear?= =?UTF-8?q?ch.results()=E4=B8=BA=E7=A9=BA=E5=8F=AF=E8=83=BD=E9=80=A0?= =?UTF-8?q?=E6=88=90=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/binary-husky/gpt_academic/issues/423 --- crazy_functions/谷歌检索小助手.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crazy_functions/谷歌检索小助手.py b/crazy_functions/谷歌检索小助手.py index b9e1f8e..46c10de 100644 --- a/crazy_functions/谷歌检索小助手.py +++ b/crazy_functions/谷歌检索小助手.py @@ -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) From f2a55dc7690674b458a5fd2439fe521cc9a5c9df Mon Sep 17 00:00:00 2001 From: binary-husky <96192199+binary-husky@users.noreply.github.com> Date: Mon, 15 May 2023 17:22:52 +0800 Subject: [PATCH 2/3] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 4e7a1fc..b0a9888 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,6 +8,7 @@ body: attributes: label: Installation Method | 安装方法与平台 options: + - Please choose | 请选择 - Pip Install (I used latest requirements.txt and python>=3.8) - Anaconda (I used latest requirements.txt and python>=3.8) - Docker(Windows/Mac) @@ -22,11 +23,19 @@ body: - type: textarea id: describe attributes: - label: Describe the bug & Screen Shot | 简述 与 有帮助的截图 - description: Describe the bug & Screen Shot | 简述 与 有帮助的截图 + label: Describe the bug | 简述 + description: Describe the bug | 简述 validations: required: true - + + - type: textarea + id: screenshot + attributes: + label: Screen Shot | 有帮助的截图 + description: Screen Shot | 有帮助的截图 + validations: + required: true + - type: textarea id: traceback attributes: From 43e64782dc2fc8d4451aeb37f10d17063d6c76a1 Mon Sep 17 00:00:00 2001 From: 505030475 <505030475@qq.com> Date: Tue, 16 May 2023 00:35:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=9D=9E=E5=AE=98?= =?UTF-8?q?=E6=96=B9=E7=9A=84OpenAI=E5=8F=8D=E4=BB=A3=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request_llm/bridge_chatgpt.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/request_llm/bridge_chatgpt.py b/request_llm/bridge_chatgpt.py index aa6ae72..eef8fbf 100644 --- a/request_llm/bridge_chatgpt.py +++ b/request_llm/bridge_chatgpt.py @@ -168,7 +168,15 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp if stream: stream_response = response.iter_lines() while True: - chunk = next(stream_response) + try: + chunk = next(stream_response) + except StopIteration: + # 非OpenAI官方接口的出现这样的报错,OpenAI和API2D不会走这里 + from toolbox import regular_txt_to_markdown; tb_str = '```\n' + trimmed_format_exc() + '```' + chatbot[-1] = (chatbot[-1][0], f"[Local Message] 远程返回错误: \n\n{tb_str} \n\n{regular_txt_to_markdown(chunk.decode())}") + yield from update_ui(chatbot=chatbot, history=history, msg="远程返回错误:" + chunk.decode()) # 刷新界面 + return + # print(chunk.decode()[6:]) if is_head_of_the_stream and (r'"object":"error"' not in chunk.decode()): # 数据流的第一帧不携带content