From a097b6cd032cee3779af953b67b0260f5ad5ac6d Mon Sep 17 00:00:00 2001 From: binary-husky <505030475@qq.com> Date: Mon, 24 Apr 2023 11:34:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=AF=8F=E6=AC=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=9A=84=E8=AE=BA=E6=96=87=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/谷歌检索小助手.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/crazy_functions/谷歌检索小助手.py b/crazy_functions/谷歌检索小助手.py index 786b266..2e2d3d1 100644 --- a/crazy_functions/谷歌检索小助手.py +++ b/crazy_functions/谷歌检索小助手.py @@ -82,21 +82,22 @@ def 谷歌检索小助手(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst history = [] meta_paper_info_list = yield from get_meta_information(txt, chatbot, history) + batchsize = 7 + for batch in range(len(meta_paper_info_list)//batchsize): + if len(meta_paper_info_list[:batchsize]) > 0: + i_say = "下面是一些学术文献的数据,提取出以下内容,使用Markdown格式输出:" + \ + "1、英文题目;2、中文题目翻译;3、作者;4、arxiv公开(is_paper_in_arxiv);4、引用数量(cite);5、中文摘要翻译。" + \ + f"以下是信息源:{str(meta_paper_info_list[:batchsize])}" - if len(meta_paper_info_list[:10]) > 0: - i_say = "下面是一些学术文献的数据,请从中提取出以下内容。" + \ - "1、英文题目;2、中文题目翻译;3、作者;4、arxiv公开(is_paper_in_arxiv);4、引用数量(cite);5、中文摘要翻译。" + \ - f"以下是信息源:{str(meta_paper_info_list[:10])}" + inputs_show_user = f"请分析此页面中出现的所有文章:{txt},这是第{batch+1}批" + gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive( + inputs=i_say, inputs_show_user=inputs_show_user, + llm_kwargs=llm_kwargs, chatbot=chatbot, history=[], + sys_prompt="你是一个学术翻译,请从数据中提取信息。你必须使用Markdown格式。你必须逐个文献进行处理。" + ) - inputs_show_user = f"请分析此页面中出现的所有文章:{txt}" - gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive( - inputs=i_say, inputs_show_user=inputs_show_user, - llm_kwargs=llm_kwargs, chatbot=chatbot, history=[], - sys_prompt="你是一个学术翻译,请从数据中提取信息。你必须使用Markdown格式。你必须逐个文献进行处理。" - ) - - history.extend([ "第一批", gpt_say ]) - meta_paper_info_list = meta_paper_info_list[10:] + history.extend([ f"第{batch+1}批", gpt_say ]) + meta_paper_info_list = meta_paper_info_list[batchsize:] chatbot.append(["状态?", "已经全部完成,您可以试试让AI写一个Related Works,例如您可以继续输入Write a \"Related Works\" section about \"你搜索的研究领域\" for me."])