针对虚空终端个别情况下不输出文件的问题进行提示
This commit is contained in:
		
							parent
							
								
									ab7999c71a
								
							
						
					
					
						commit
						74f35e3401
					
				@ -2443,48 +2443,75 @@
 | 
				
			|||||||
    "├── CODE_HIGHLIGHT 代码高亮": "├── CODE_HIGHLIGHT Code highlighting",
 | 
					    "├── CODE_HIGHLIGHT 代码高亮": "├── CODE_HIGHLIGHT Code highlighting",
 | 
				
			||||||
    "记得用插件": "Remember to use the plugin",
 | 
					    "记得用插件": "Remember to use the plugin",
 | 
				
			||||||
    "谨慎操作": "Handle with caution",
 | 
					    "谨慎操作": "Handle with caution",
 | 
				
			||||||
    "请检查PDF是否损坏": "#",
 | 
					    "private_upload里面的文件名在解压zip后容易出现乱码": "The file name inside private_upload is prone to garbled characters after unzipping",
 | 
				
			||||||
    "执行成功了": "#",
 | 
					    "直接返回报错": "Direct return error",
 | 
				
			||||||
    "请在输入框内填写需求": "#",
 | 
					    "临时的上传文件夹位置": "Temporary upload folder location",
 | 
				
			||||||
    "结果": "#",
 | 
					    "使用latex格式 测试3 写出麦克斯韦方程组": "Write Maxwell's equations using latex format for test 3",
 | 
				
			||||||
    "开始干正事": "#",
 | 
					    "这是一张图片": "This is an image",
 | 
				
			||||||
    "次代码生成尝试": "#",
 | 
					    "没有发现任何近期上传的文件": "No recent uploaded files found",
 | 
				
			||||||
    "代码生成结束": "#",
 | 
					    "如url未成功匹配返回None": "Return None if the URL does not match successfully",
 | 
				
			||||||
    "Nougat解析论文失败": "#",
 | 
					    "如果有Latex环境": "If there is a Latex environment",
 | 
				
			||||||
    "受到google限制": "#",
 | 
					    "第一次运行时": "When running for the first time",
 | 
				
			||||||
    "收尾": "#",
 | 
					    "创建工作路径": "Create a working directory",
 | 
				
			||||||
    "结果是一个有效文件": "#",
 | 
					    "向": "To",
 | 
				
			||||||
    "然后再次点击该插件": "#",
 | 
					    "执行中. 删除数据": "Executing. Deleting data",
 | 
				
			||||||
    "用插件实现」": "#",
 | 
					    "CodeInterpreter开源版": "CodeInterpreter open source version",
 | 
				
			||||||
    "文件路径": "#",
 | 
					    "建议选择更稳定的接口": "It is recommended to choose a more stable interface",
 | 
				
			||||||
    "仅供测试": "#",
 | 
					    "现在您点击任意函数插件时": "Now when you click on any function plugin",
 | 
				
			||||||
    "将csv文件转excel表格": "#",
 | 
					    "请使用“LatexEnglishCorrection+高亮”插件": "Please use the 'LatexEnglishCorrection+Highlight' plugin",
 | 
				
			||||||
    "开始执行": "#",
 | 
					    "安装完成": "Installation completed",
 | 
				
			||||||
    "测试": "#",
 | 
					    "记得用插件!」": "Remember to use the plugin!",
 | 
				
			||||||
    "睡一会防止触发google反爬虫": "#",
 | 
					    "结论": "Conclusion",
 | 
				
			||||||
    "某段话的整个句子": "#",
 | 
					    "无法下载资源": "Unable to download resources",
 | 
				
			||||||
    "使用tex格式公式 测试2 给出柯西不等式": "#",
 | 
					    "首先排除一个one-api没有done数据包的第三方Bug情形": "First exclude a third-party bug where one-api does not have a done data package",
 | 
				
			||||||
    "找不到本地项目或无法处理": "#",
 | 
					    "知识库中添加文件": "Add files to the knowledge base",
 | 
				
			||||||
    "交换图像的蓝色通道和红色通道": "#",
 | 
					    "处理重名的章节": "Handling duplicate chapter names",
 | 
				
			||||||
    "第三步": "#",
 | 
					    "先上传文件素材": "Upload file materials first",
 | 
				
			||||||
    "返回给定的url解析出的arxiv_id": "#",
 | 
					    "无法从google获取信息!": "Unable to retrieve information from Google!",
 | 
				
			||||||
    "裁剪图像": "#",
 | 
					    "展示如下": "Display as follows",
 | 
				
			||||||
    "已经被记忆": "#",
 | 
					    "「把Arxiv论文翻译成中文PDF": "Translate Arxiv papers into Chinese PDF",
 | 
				
			||||||
    "无法从bing获取信息!": "#",
 | 
					    "论文我刚刚放到上传区了」": "I just put the paper in the upload area",
 | 
				
			||||||
    "可能触发了google反爬虫机制": "#",
 | 
					    "正在下载Gradio主题": "Downloading Gradio themes",
 | 
				
			||||||
    "检索文章的历史版本的题目": "#",
 | 
					    "再运行此插件": "Run this plugin again",
 | 
				
			||||||
    "请配置讯飞星火大模型的XFYUN_APPID": "#",
 | 
					    "记录近期文件": "Record recent files",
 | 
				
			||||||
    "执行失败了": "#",
 | 
					    "粗心检查": "Careful check",
 | 
				
			||||||
    "需要花费较长时间下载NOUGAT参数": "#",
 | 
					    "更多主题": "More themes",
 | 
				
			||||||
    "请检查": "#",
 | 
					    "//huggingface.co/spaces/gradio/theme-gallery 可选": "//huggingface.co/spaces/gradio/theme-gallery optional",
 | 
				
			||||||
    "写入": "#",
 | 
					    "由 test_on_result_chg": "By test_on_result_chg",
 | 
				
			||||||
    "下个句子中已经说完的部分": "#",
 | 
					    "所有问询记录将自动保存在本地目录./": "All inquiry records will be automatically saved in the local directory ./",
 | 
				
			||||||
    "精准翻译PDF文档": "#",
 | 
					    "正在解析论文": "Analyzing the paper",
 | 
				
			||||||
    "解析python源代码项目": "#",
 | 
					    "逐个文件转移到目标路径": "Move each file to the target path",
 | 
				
			||||||
    "首先在arxiv上搜索": "#",
 | 
					    "最多重试5次": "Retry up to 5 times",
 | 
				
			||||||
    "错误追踪": "#",
 | 
					    "日志文件夹的位置": "Location of the log folder",
 | 
				
			||||||
    "结果是一个字符串": "#",
 | 
					    "我们暂时无法解析此PDF文档": "We are temporarily unable to parse this PDF document",
 | 
				
			||||||
    "由 test_on_sentence_end": "#",
 | 
					    "文件检索": "File retrieval",
 | 
				
			||||||
    "获取文章摘要": "#",
 | 
					    "/**/chatGPT对话历史*.html": "/**/chatGPT conversation history*.html",
 | 
				
			||||||
    "受到bing限制": "#"
 | 
					    "非OpenAI官方接口返回了错误": "Non-OpenAI official interface returned an error",
 | 
				
			||||||
 | 
					    "如果在Arxiv上匹配失败": "If the match fails on Arxiv",
 | 
				
			||||||
 | 
					    "文件进入知识库后可长期保存": "Files can be saved for a long time after entering the knowledge base",
 | 
				
			||||||
 | 
					    "您可以再次重试": "You can try again",
 | 
				
			||||||
 | 
					    "整理文件集合": "Organize file collection",
 | 
				
			||||||
 | 
					    "检测到有缺陷的非OpenAI官方接口": "Detected defective non-OpenAI official interface",
 | 
				
			||||||
 | 
					    "此插件不调用Latex": "This plugin does not call Latex",
 | 
				
			||||||
 | 
					    "移除过时的旧文件从而节省空间&保护隐私": "Remove outdated old files to save space & protect privacy",
 | 
				
			||||||
 | 
					    "代码我刚刚打包拖到上传区了」": "I just packed the code and dragged it to the upload area",
 | 
				
			||||||
 | 
					    "将图像转为灰度图像": "Convert the image to grayscale",
 | 
				
			||||||
 | 
					    "待排除": "To be excluded",
 | 
				
			||||||
 | 
					    "请勿修改": "Please do not modify",
 | 
				
			||||||
 | 
					    "crazy_functions/代码重写为全英文_多线程.py": "crazy_functions/code rewritten to all English_multi-threading.py",
 | 
				
			||||||
 | 
					    "开发中": "Under development",
 | 
				
			||||||
 | 
					    "请查阅Gradio主题商店": "Please refer to the Gradio theme store",
 | 
				
			||||||
 | 
					    "输出消息": "Output message",
 | 
				
			||||||
 | 
					    "其他情况": "Other situations",
 | 
				
			||||||
 | 
					    "获取文献失败": "Failed to retrieve literature",
 | 
				
			||||||
 | 
					    "可以通过再次调用本插件的方式": "You can use this plugin again by calling it",
 | 
				
			||||||
 | 
					    "保留下半部分": "Keep the lower half",
 | 
				
			||||||
 | 
					    "排除问题": "Exclude the problem",
 | 
				
			||||||
 | 
					    "知识库": "Knowledge base",
 | 
				
			||||||
 | 
					    "ParsePDF失败": "ParsePDF failed",
 | 
				
			||||||
 | 
					    "向知识库追加更多文档": "Append more documents to the knowledge base",
 | 
				
			||||||
 | 
					    "此处待注入的知识库名称id": "The knowledge base name ID to be injected here",
 | 
				
			||||||
 | 
					    "您需要构建知识库后再运行此插件": "You need to build the knowledge base before running this plugin",
 | 
				
			||||||
 | 
					    "判定是否为公式 | 测试1 写出洛伦兹定律": "Determine whether it is a formula | Test 1 write out the Lorentz law",
 | 
				
			||||||
 | 
					    "构建知识库后": "After building the knowledge base"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										4
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.py
									
									
									
									
									
								
							@ -184,7 +184,7 @@ def main():
 | 
				
			|||||||
        # 函数插件-固定按钮区
 | 
					        # 函数插件-固定按钮区
 | 
				
			||||||
        for k in plugins:
 | 
					        for k in plugins:
 | 
				
			||||||
            if not plugins[k].get("AsButton", True): continue
 | 
					            if not plugins[k].get("AsButton", True): continue
 | 
				
			||||||
            click_handle = plugins[k]["Button"].click(ArgsGeneralWrapper(plugins[k]["Function"]), [*input_combo, gr.State(PORT)], output_combo)
 | 
					            click_handle = plugins[k]["Button"].click(ArgsGeneralWrapper(plugins[k]["Function"]), [*input_combo], output_combo)
 | 
				
			||||||
            click_handle.then(on_report_generated, [cookies, file_upload, chatbot], [cookies, file_upload, chatbot])
 | 
					            click_handle.then(on_report_generated, [cookies, file_upload, chatbot], [cookies, file_upload, chatbot])
 | 
				
			||||||
            cancel_handles.append(click_handle)
 | 
					            cancel_handles.append(click_handle)
 | 
				
			||||||
        # 函数插件-下拉菜单与随变按钮的互动
 | 
					        # 函数插件-下拉菜单与随变按钮的互动
 | 
				
			||||||
@ -204,7 +204,7 @@ def main():
 | 
				
			|||||||
        def route(request: gr.Request, k, *args, **kwargs):
 | 
					        def route(request: gr.Request, k, *args, **kwargs):
 | 
				
			||||||
            if k in [r"打开插件列表", r"请先从插件列表中选择"]: return
 | 
					            if k in [r"打开插件列表", r"请先从插件列表中选择"]: return
 | 
				
			||||||
            yield from ArgsGeneralWrapper(plugins[k]["Function"])(request, *args, **kwargs)
 | 
					            yield from ArgsGeneralWrapper(plugins[k]["Function"])(request, *args, **kwargs)
 | 
				
			||||||
        click_handle = switchy_bt.click(route,[switchy_bt, *input_combo, gr.State(PORT)], output_combo)
 | 
					        click_handle = switchy_bt.click(route,[switchy_bt, *input_combo], output_combo)
 | 
				
			||||||
        click_handle.then(on_report_generated, [cookies, file_upload, chatbot], [cookies, file_upload, chatbot])
 | 
					        click_handle.then(on_report_generated, [cookies, file_upload, chatbot], [cookies, file_upload, chatbot])
 | 
				
			||||||
        cancel_handles.append(click_handle)
 | 
					        cancel_handles.append(click_handle)
 | 
				
			||||||
        # 终止按钮的回调函数注册
 | 
					        # 终止按钮的回调函数注册
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										16
									
								
								toolbox.py
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								toolbox.py
									
									
									
									
									
								
							@ -79,14 +79,23 @@ def ArgsGeneralWrapper(f):
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        chatbot_with_cookie = ChatBotWithCookies(cookies)
 | 
					        chatbot_with_cookie = ChatBotWithCookies(cookies)
 | 
				
			||||||
        chatbot_with_cookie.write_list(chatbot)
 | 
					        chatbot_with_cookie.write_list(chatbot)
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        if cookies.get('lock_plugin', None) is None:
 | 
					        if cookies.get('lock_plugin', None) is None:
 | 
				
			||||||
            # 正常状态
 | 
					            # 正常状态
 | 
				
			||||||
            yield from f(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, *args)
 | 
					            if len(args) == 0:  # 插件通道
 | 
				
			||||||
 | 
					                yield from f(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, request)
 | 
				
			||||||
 | 
					            else:               # 对话通道
 | 
				
			||||||
 | 
					                yield from f(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, *args)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            # 处理个别特殊插件的锁定状态
 | 
					            # 处理少数情况下的特殊插件的锁定状态
 | 
				
			||||||
            module, fn_name = cookies['lock_plugin'].split('->')
 | 
					            module, fn_name = cookies['lock_plugin'].split('->')
 | 
				
			||||||
            f_hot_reload = getattr(importlib.import_module(module, fn_name), fn_name)
 | 
					            f_hot_reload = getattr(importlib.import_module(module, fn_name), fn_name)
 | 
				
			||||||
            yield from f_hot_reload(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, request)
 | 
					            yield from f_hot_reload(txt_passon, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, system_prompt, request)
 | 
				
			||||||
 | 
					            # 判断一下用户是否错误地通过对话通道进入,如果是,则进行提醒
 | 
				
			||||||
 | 
					            final_cookies = chatbot_with_cookie.get_cookies()
 | 
				
			||||||
 | 
					            if len(args) == 0 and 'files_to_promote' in final_cookies and len(final_cookies['files_to_promote']) > 0: 
 | 
				
			||||||
 | 
					                chatbot_with_cookie.append(["检测到**滞留的缓存文档**,请及时处理。", "请及时点击“**保存当前对话**”获取所有滞留文档。"])
 | 
				
			||||||
 | 
					                yield from update_ui(chatbot_with_cookie, final_cookies['history'], msg="检测到被滞留的缓存文档")
 | 
				
			||||||
    return decorated
 | 
					    return decorated
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -96,7 +105,8 @@ def update_ui(chatbot, history, msg='正常', **kwargs):  # 刷新界面
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    assert isinstance(chatbot, ChatBotWithCookies), "在传递chatbot的过程中不要将其丢弃。必要时, 可用clear将其清空, 然后用for+append循环重新赋值。"
 | 
					    assert isinstance(chatbot, ChatBotWithCookies), "在传递chatbot的过程中不要将其丢弃。必要时, 可用clear将其清空, 然后用for+append循环重新赋值。"
 | 
				
			||||||
    cookies = chatbot.get_cookies()
 | 
					    cookies = chatbot.get_cookies()
 | 
				
			||||||
 | 
					    # 备份一份History作为记录
 | 
				
			||||||
 | 
					    cookies.update({'history': history})
 | 
				
			||||||
    # 解决插件锁定时的界面显示问题
 | 
					    # 解决插件锁定时的界面显示问题
 | 
				
			||||||
    if cookies.get('lock_plugin', None):
 | 
					    if cookies.get('lock_plugin', None):
 | 
				
			||||||
        label = cookies.get('llm_model', "") + " | " + "正在锁定插件" + cookies.get('lock_plugin', None)
 | 
					        label = cookies.get('llm_model', "") + " | " + "正在锁定插件" + cookies.get('lock_plugin', None)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user