diff --git a/README.md b/README.md index d7468465..b84649f6 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,6 @@ Read this in [English](docs/README.English.md) | [日本語](docs/README.Japanes ⭐支持mermaid图像渲染 | 支持让GPT生成[流程图](https://www.bilibili.com/video/BV18c41147H9/)、状态转移图、甘特图、饼状图、GitGraph等等(3.7版本) ⭐Arxiv论文精细翻译 ([Docker](https://github.com/binary-husky/gpt_academic/pkgs/container/gpt_academic_with_latex)) | [插件] 一键[以超高质量翻译arxiv论文](https://www.bilibili.com/video/BV1dz4y1v77A/),目前最好的论文翻译工具 ⭐[实时语音对话输入](https://github.com/binary-husky/gpt_academic/blob/master/docs/use_audio.md) | [插件] 异步[监听音频](https://www.bilibili.com/video/BV1AV4y187Uy/),自动断句,自动寻找回答时机 -⭐AutoGen多智能体插件 | [插件] 借助微软AutoGen,探索多Agent的智能涌现可能! ⭐虚空终端插件 | [插件] 能够使用自然语言直接调度本项目其他插件 润色、翻译、代码解释 | 一键润色、翻译、查找论文语法错误、解释代码 [自定义快捷键](https://www.bilibili.com/video/BV14s4y1E7jN) | 支持自定义快捷键 diff --git a/crazy_functional.py b/crazy_functional.py index 0f0fbaf0..a2c16780 100644 --- a/crazy_functional.py +++ b/crazy_functional.py @@ -3,8 +3,8 @@ from toolbox import trimmed_format_exc from loguru import logger def get_crazy_functions(): - from crazy_functions.读文章写摘要 import 读文章写摘要 - from crazy_functions.生成函数注释 import 批量生成函数注释 + from crazy_functions.Paper_Abstract_Writer import Paper_Abstract_Writer + from crazy_functions.Program_Comment_Gen import 批量Program_Comment_Gen from crazy_functions.SourceCode_Analyse import 解析项目本身 from crazy_functions.SourceCode_Analyse import 解析一个Python项目 from crazy_functions.SourceCode_Analyse import 解析一个Matlab项目 @@ -17,26 +17,26 @@ def get_crazy_functions(): from crazy_functions.高级功能函数模板 import 高阶功能模板函数 from crazy_functions.高级功能函数模板 import Demo_Wrap from crazy_functions.Latex_Project_Polish import Latex英文润色 - from crazy_functions.询问多个大语言模型 import 同时问询 + from crazy_functions.Multi_LLM_Query import 同时问询 from crazy_functions.SourceCode_Analyse import 解析一个Lua项目 from crazy_functions.SourceCode_Analyse import 解析一个CSharp项目 - from crazy_functions.总结word文档 import 总结word文档 - from crazy_functions.解析JupyterNotebook import 解析ipynb文件 + from crazy_functions.Word_Summary import Word_Summary + from crazy_functions.SourceCode_Analyse_JupyterNotebook import 解析ipynb文件 from crazy_functions.Conversation_To_File import 载入对话历史存档 from crazy_functions.Conversation_To_File import 对话历史存档 from crazy_functions.Conversation_To_File import Conversation_To_File_Wrap from crazy_functions.Conversation_To_File import 删除所有本地对话历史记录 - from crazy_functions.辅助功能 import 清除缓存 + from crazy_functions.Helpers import 清除缓存 from crazy_functions.Markdown_Translate import Markdown英译中 - from crazy_functions.批量总结PDF文档 import 批量总结PDF文档 + from crazy_functions.PDF_Summary import PDF_Summary from crazy_functions.PDF_Translate import 批量翻译PDF文档 - from crazy_functions.谷歌检索小助手 import 谷歌检索小助手 - from crazy_functions.理解PDF文档内容 import 理解PDF文档内容标准文件输入 + from crazy_functions.Google_Scholar_Assistant_Legacy import Google_Scholar_Assistant_Legacy + from crazy_functions.PDF_QA import PDF_QA标准文件输入 from crazy_functions.Latex_Project_Polish import Latex中文润色 from crazy_functions.Latex_Project_Polish import Latex英文纠错 from crazy_functions.Markdown_Translate import Markdown中译英 - from crazy_functions.虚空终端 import 虚空终端 - from crazy_functions.生成多种Mermaid图表 import Mermaid_Gen + from crazy_functions.Void_Terminal import Void_Terminal + from crazy_functions.Mermaid_Figure_Gen import Mermaid_Gen from crazy_functions.PDF_Translate_Wrap import PDF_Tran from crazy_functions.Latex_Function import Latex英文纠错加PDF对比 from crazy_functions.Latex_Function import Latex翻译中文并重新编译PDF @@ -67,7 +67,7 @@ def get_crazy_functions(): "Color": "stop", "AsButton": True, "Info": "使用自然语言实现您的想法", - "Function": HotReload(虚空终端), + "Function": HotReload(Void_Terminal), }, "解析整个Python项目": { "Group": "编程", @@ -125,7 +125,7 @@ def get_crazy_functions(): "Color": "stop", "AsButton": False, "Info": "批量总结word文档 | 输入参数为路径", - "Function": HotReload(总结word文档), + "Function": HotReload(Word_Summary), }, "解析整个Matlab项目": { "Group": "编程", @@ -204,7 +204,7 @@ def get_crazy_functions(): "Color": "stop", "AsButton": False, "Info": "读取Tex论文并写摘要 | 输入参数为路径", - "Function": HotReload(读文章写摘要), + "Function": HotReload(Paper_Abstract_Writer), }, "翻译README或MD": { "Group": "编程", @@ -225,14 +225,14 @@ def get_crazy_functions(): "Color": "stop", "AsButton": False, # 加入下拉菜单中 "Info": "批量生成函数的注释 | 输入参数为路径", - "Function": HotReload(批量生成函数注释), + "Function": HotReload(批量Program_Comment_Gen), }, "保存当前的对话": { "Group": "对话", "Color": "stop", "AsButton": True, "Info": "保存当前的对话 | 不需要输入参数", - "Function": HotReload(对话历史存档), # 当注册Class后,Function旧接口仅会在“虚空终端”中起作用 + "Function": HotReload(对话历史存档), # 当注册Class后,Function旧接口仅会在“Void_Terminal”中起作用 "Class": Conversation_To_File_Wrap # 新一代插件需要注册Class }, "[多线程Demo]解析此项目本身(源码自译解)": { @@ -258,12 +258,12 @@ def get_crazy_functions(): "Function": None, "Class": Demo_Wrap, # 新一代插件需要注册Class }, - "精准翻译PDF论文": { + "PDF论文翻译": { "Group": "学术", "Color": "stop", "AsButton": True, "Info": "精准翻译PDF论文为中文 | 输入参数为路径", - "Function": HotReload(批量翻译PDF文档), # 当注册Class后,Function旧接口仅会在“虚空终端”中起作用 + "Function": HotReload(批量翻译PDF文档), # 当注册Class后,Function旧接口仅会在“Void_Terminal”中起作用 "Class": PDF_Tran, # 新一代插件需要注册Class }, "询问多个GPT模型": { @@ -277,21 +277,21 @@ def get_crazy_functions(): "Color": "stop", "AsButton": False, # 加入下拉菜单中 "Info": "批量总结PDF文档的内容 | 输入参数为路径", - "Function": HotReload(批量总结PDF文档), + "Function": HotReload(PDF_Summary), }, "谷歌学术检索助手(输入谷歌学术搜索页url)": { "Group": "学术", "Color": "stop", "AsButton": False, # 加入下拉菜单中 "Info": "使用谷歌学术检索助手搜索指定URL的结果 | 输入参数为谷歌学术搜索页的URL", - "Function": HotReload(谷歌检索小助手), + "Function": HotReload(Google_Scholar_Assistant_Legacy), }, "理解PDF文档内容 (模仿ChatPDF)": { "Group": "学术", "Color": "stop", "AsButton": False, # 加入下拉菜单中 "Info": "理解PDF文档的内容并进行回答 | 输入参数为路径", - "Function": HotReload(理解PDF文档内容标准文件输入), + "Function": HotReload(PDF_QA标准文件输入), }, "英文Latex项目全文润色(输入路径或上传压缩包)": { "Group": "学术", @@ -356,7 +356,7 @@ def get_crazy_functions(): r"例如当单词'agent'翻译不准确时, 请尝试把以下指令复制到高级参数区: " r'If the term "agent" is used in this section, it should be translated to "智能体". ', "Info": "ArXiv论文精细翻译 | 输入参数arxiv论文的ID,比如1812.10695", - "Function": HotReload(Latex翻译中文并重新编译PDF), # 当注册Class后,Function旧接口仅会在“虚空终端”中起作用 + "Function": HotReload(Latex翻译中文并重新编译PDF), # 当注册Class后,Function旧接口仅会在“Void_Terminal”中起作用 "Class": Arxiv_Localize, # 新一代插件需要注册Class }, "📚本地Latex论文精细翻译(上传Latex项目)[需Latex]": { @@ -379,7 +379,7 @@ def get_crazy_functions(): r"例如当单词'agent'翻译不准确时, 请尝试把以下指令复制到高级参数区: " r'If the term "agent" is used in this section, it should be translated to "智能体". ', "Info": "PDF翻译中文,并重新编译PDF | 输入参数为路径", - "Function": HotReload(PDF翻译中文并重新编译PDF), # 当注册Class后,Function旧接口仅会在“虚空终端”中起作用 + "Function": HotReload(PDF翻译中文并重新编译PDF), # 当注册Class后,Function旧接口仅会在“Void_Terminal”中起作用 "Class": PDF_Localize # 新一代插件需要注册Class }, "批量文件询问 (支持自定义总结各种文件)": { @@ -400,7 +400,7 @@ def get_crazy_functions(): "Color": "stop", "AsButton": False, "Info": "使用 DALLE2/DALLE3 生成图片 | 输入参数字符串,提供图像的内容", - "Function": HotReload(图片生成_DALLE2), # 当注册Class后,Function旧接口仅会在“虚空终端”中起作用 + "Function": HotReload(图片生成_DALLE2), # 当注册Class后,Function旧接口仅会在“Void_Terminal”中起作用 "Class": ImageGen_Wrap # 新一代插件需要注册Class }, } @@ -427,7 +427,7 @@ def get_crazy_functions(): try: - from crazy_functions.下载arxiv论文翻译摘要 import 下载arxiv论文并翻译摘要 + from crazy_functions.Arxiv_Downloader import 下载arxiv论文并翻译摘要 function_plugins.update( { @@ -465,7 +465,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.询问多个大语言模型 import 同时问询_指定模型 + from crazy_functions.Multi_LLM_Query import 同时问询_指定模型 function_plugins.update( { @@ -486,7 +486,7 @@ def get_crazy_functions(): try: - from crazy_functions.总结音视频 import 总结音视频 + from crazy_functions.Audio_Summary import Audio_Summary function_plugins.update( { @@ -497,7 +497,7 @@ def get_crazy_functions(): "AdvancedArgs": True, "ArgsReminder": "调用openai api 使用whisper-1模型, 目前支持的格式:mp4, m4a, wav, mpga, mpeg, mp3。此处可以输入解析提示,例如:解析为简体中文(默认)。", "Info": "批量总结音频或视频 | 输入参数为路径", - "Function": HotReload(总结音视频), + "Function": HotReload(Audio_Summary), } } ) @@ -506,7 +506,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.数学动画生成manim import 动画生成 + from crazy_functions.Math_Animation_Gen import 动画生成 function_plugins.update( { @@ -543,7 +543,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.知识库问答 import 知识库文件注入 + from crazy_functions.Vectorstore_QA import 知识库文件注入 function_plugins.update( { @@ -562,7 +562,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.知识库问答 import 读取知识库作答 + from crazy_functions.Vectorstore_QA import 读取知识库作答 function_plugins.update( { @@ -581,7 +581,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.交互功能函数模板 import 交互功能模板函数 + from crazy_functions.Interactive_Func_Template import 交互功能模板函数 function_plugins.update( { @@ -603,7 +603,7 @@ def get_crazy_functions(): ENABLE_AUDIO = get_conf("ENABLE_AUDIO") if ENABLE_AUDIO: - from crazy_functions.语音助手 import 语音助手 + from crazy_functions.Audio_Assistant import Audio_Assistant function_plugins.update( { @@ -612,7 +612,7 @@ def get_crazy_functions(): "Color": "stop", "AsButton": True, "Info": "这是一个时刻聆听着的语音对话助手 | 没有输入参数", - "Function": HotReload(语音助手), + "Function": HotReload(Audio_Assistant), } } ) @@ -621,7 +621,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.批量翻译PDF文档_NOUGAT import 批量翻译PDF文档 + from crazy_functions.PDF_Translate_Nougat import 批量翻译PDF文档 function_plugins.update( { @@ -638,7 +638,7 @@ def get_crazy_functions(): logger.error("Load function plugin failed") try: - from crazy_functions.函数动态生成 import 函数动态生成 + from crazy_functions.Dynamic_Function_Generate import Dynamic_Function_Generate function_plugins.update( { @@ -646,7 +646,7 @@ def get_crazy_functions(): "Group": "智能体", "Color": "stop", "AsButton": False, - "Function": HotReload(函数动态生成), + "Function": HotReload(Dynamic_Function_Generate), } } ) @@ -655,14 +655,14 @@ def get_crazy_functions(): logger.error("Load function plugin failed") # try: - # from crazy_functions.多智能体 import 多智能体终端 + # from crazy_functions.Multi_Agent_Legacy import Multi_Agent_Legacy终端 # function_plugins.update( # { - # "AutoGen多智能体终端(仅供测试)": { + # "AutoGenMulti_Agent_Legacy终端(仅供测试)": { # "Group": "智能体", # "Color": "stop", # "AsButton": False, - # "Function": HotReload(多智能体终端), + # "Function": HotReload(Multi_Agent_Legacy终端), # } # } # ) @@ -670,23 +670,6 @@ def get_crazy_functions(): # logger.error(trimmed_format_exc()) # logger.error("Load function plugin failed") - try: - from crazy_functions.互动小游戏 import 随机小游戏 - - function_plugins.update( - { - "随机互动小游戏(仅供测试)": { - "Group": "智能体", - "Color": "stop", - "AsButton": False, - "Function": HotReload(随机小游戏), - } - } - ) - except: - logger.error(trimmed_format_exc()) - logger.error("Load function plugin failed") - try: from crazy_functions.Rag_Interface import Rag问答 diff --git a/crazy_functions/下载arxiv论文翻译摘要.py b/crazy_functions/Arxiv_Downloader.py similarity index 100% rename from crazy_functions/下载arxiv论文翻译摘要.py rename to crazy_functions/Arxiv_Downloader.py diff --git a/crazy_functions/语音助手.py b/crazy_functions/Audio_Assistant.py similarity index 98% rename from crazy_functions/语音助手.py rename to crazy_functions/Audio_Assistant.py index e73421f2..e74d149a 100644 --- a/crazy_functions/语音助手.py +++ b/crazy_functions/Audio_Assistant.py @@ -168,7 +168,7 @@ class InterviewAssistant(AliyunASR): @CatchException -def 语音助手(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Audio_Assistant(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): # pip install -U openai-whisper chatbot.append(["对话助手函数插件:使用时,双手离开鼠标键盘吧", "音频助手, 正在听您讲话(点击“停止”键可终止程序)..."]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 diff --git a/crazy_functions/总结音视频.py b/crazy_functions/Audio_Summary.py similarity index 97% rename from crazy_functions/总结音视频.py rename to crazy_functions/Audio_Summary.py index 6adaca1a..556fa573 100644 --- a/crazy_functions/总结音视频.py +++ b/crazy_functions/Audio_Summary.py @@ -132,13 +132,13 @@ def AnalyAudio(parse_prompt, file_manifest, llm_kwargs, chatbot, history): @CatchException -def 总结音视频(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, WEB_PORT): +def Audio_Summary(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, WEB_PORT): import glob, os # 基本信息:功能、贡献者 chatbot.append([ "函数插件功能?", - "总结音视频内容,函数插件贡献者: dalvqw & BinaryHusky"]) + "Audio_Summary内容,函数插件贡献者: dalvqw & BinaryHusky"]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 try: diff --git a/crazy_functions/命令行助手.py b/crazy_functions/Commandline_Assistant.py similarity index 92% rename from crazy_functions/命令行助手.py rename to crazy_functions/Commandline_Assistant.py index 390ce177..edce3163 100644 --- a/crazy_functions/命令行助手.py +++ b/crazy_functions/Commandline_Assistant.py @@ -4,7 +4,7 @@ from crazy_functions.crazy_utils import input_clipping import copy, json @CatchException -def 命令行助手(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Commandline_Assistant(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): """ txt 输入栏用户输入的文本, 例如需要翻译的一段话, 再例如一个包含了待处理文件的路径 llm_kwargs gpt模型参数, 如温度和top_p等, 一般原样传递下去就行 diff --git a/crazy_functions/函数动态生成.py b/crazy_functions/Dynamic_Function_Generate.py similarity index 98% rename from crazy_functions/函数动态生成.py rename to crazy_functions/Dynamic_Function_Generate.py index 9b8af760..b4fca48d 100644 --- a/crazy_functions/函数动态生成.py +++ b/crazy_functions/Dynamic_Function_Generate.py @@ -139,7 +139,7 @@ def get_recent_file_prompt_support(chatbot): return path @CatchException -def 函数动态生成(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Dynamic_Function_Generate(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): """ txt 输入栏用户输入的文本,例如需要翻译的一段话,再例如一个包含了待处理文件的路径 llm_kwargs gpt模型参数,如温度和top_p等,一般原样传递下去就行 @@ -159,7 +159,7 @@ def 函数动态生成(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_ # ⭐ 文件上传区是否有东西 # 1. 如果有文件: 作为函数参数 - # 2. 如果没有文件:需要用GPT提取参数 (太懒了,以后再写,虚空终端已经实现了类似的代码) + # 2. 如果没有文件:需要用GPT提取参数 (太懒了,以后再写,Void_Terminal已经实现了类似的代码) file_list = [] if get_plugin_arg(plugin_kwargs, key="file_path_arg", default=False): file_path = get_plugin_arg(plugin_kwargs, key="file_path_arg", default=None) diff --git a/crazy_functions/谷歌检索小助手.py b/crazy_functions/Google_Scholar_Assistant_Legacy.py similarity index 98% rename from crazy_functions/谷歌检索小助手.py rename to crazy_functions/Google_Scholar_Assistant_Legacy.py index b5583d30..4640926b 100644 --- a/crazy_functions/谷歌检索小助手.py +++ b/crazy_functions/Google_Scholar_Assistant_Legacy.py @@ -132,7 +132,7 @@ def get_meta_information(url, chatbot, history): return profile @CatchException -def 谷歌检索小助手(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Google_Scholar_Assistant_Legacy(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): disable_auto_promotion(chatbot=chatbot) # 基本信息:功能、贡献者 chatbot.append([ diff --git a/crazy_functions/辅助功能.py b/crazy_functions/Helpers.py similarity index 100% rename from crazy_functions/辅助功能.py rename to crazy_functions/Helpers.py diff --git a/crazy_functions/交互功能函数模板.py b/crazy_functions/Interactive_Func_Template.py similarity index 88% rename from crazy_functions/交互功能函数模板.py rename to crazy_functions/Interactive_Func_Template.py index ec9836a4..600214b1 100644 --- a/crazy_functions/交互功能函数模板.py +++ b/crazy_functions/Interactive_Func_Template.py @@ -13,13 +13,13 @@ def 交互功能模板函数(txt, llm_kwargs, plugin_kwargs, chatbot, history, s user_request 当前用户的请求信息(IP地址等) """ history = [] # 清空历史,以免输入溢出 - chatbot.append(("这是什么功能?", "交互功能函数模板。在执行完成之后, 可以将自身的状态存储到cookie中, 等待用户的再次调用。")) + chatbot.append(("这是什么功能?", "Interactive_Func_Template。在执行完成之后, 可以将自身的状态存储到cookie中, 等待用户的再次调用。")) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 state = chatbot._cookies.get('plugin_state_0001', None) # 初始化插件状态 if state is None: - chatbot._cookies['lock_plugin'] = 'crazy_functions.交互功能函数模板->交互功能模板函数' # 赋予插件锁定 锁定插件回调路径,当下一次用户提交时,会直接转到该函数 + chatbot._cookies['lock_plugin'] = 'crazy_functions.Interactive_Func_Template->交互功能模板函数' # 赋予插件锁定 锁定插件回调路径,当下一次用户提交时,会直接转到该函数 chatbot._cookies['plugin_state_0001'] = 'wait_user_keyword' # 赋予插件状态 chatbot.append(("第一次调用:", "请输入关键词, 我将为您查找相关壁纸, 建议使用英文单词, 插件锁定中,请直接提交即可。")) diff --git a/crazy_functions/互动小游戏.py b/crazy_functions/Interactive_Mini_Game.py similarity index 89% rename from crazy_functions/互动小游戏.py rename to crazy_functions/Interactive_Mini_Game.py index 1291a6dd..d68ad761 100644 --- a/crazy_functions/互动小游戏.py +++ b/crazy_functions/Interactive_Mini_Game.py @@ -16,7 +16,7 @@ def 随机小游戏(prompt, llm_kwargs, plugin_kwargs, chatbot, history, system_ llm_kwargs, cls, plugin_name='MiniGame_ResumeStory', - callback_fn='crazy_functions.互动小游戏->随机小游戏', + callback_fn='crazy_functions.Interactive_Mini_Game->随机小游戏', lock_plugin=True ) yield from state.continue_game(prompt, chatbot, history) @@ -34,7 +34,7 @@ def 随机小游戏1(prompt, llm_kwargs, plugin_kwargs, chatbot, history, system llm_kwargs, cls, plugin_name='MiniGame_ASCII_Art', - callback_fn='crazy_functions.互动小游戏->随机小游戏1', + callback_fn='crazy_functions.Interactive_Mini_Game->随机小游戏1', lock_plugin=True ) yield from state.continue_game(prompt, chatbot, history) diff --git a/crazy_functions/联网的ChatGPT_bing版.py b/crazy_functions/Internet_GPT_Bing_Legacy.py similarity index 100% rename from crazy_functions/联网的ChatGPT_bing版.py rename to crazy_functions/Internet_GPT_Bing_Legacy.py diff --git a/crazy_functions/联网的ChatGPT.py b/crazy_functions/Internet_GPT_Legacy.py similarity index 100% rename from crazy_functions/联网的ChatGPT.py rename to crazy_functions/Internet_GPT_Legacy.py diff --git a/crazy_functions/数学动画生成manim.py b/crazy_functions/Math_Animation_Gen.py similarity index 100% rename from crazy_functions/数学动画生成manim.py rename to crazy_functions/Math_Animation_Gen.py diff --git a/crazy_functions/生成多种Mermaid图表.py b/crazy_functions/Mermaid_Figure_Gen.py similarity index 99% rename from crazy_functions/生成多种Mermaid图表.py rename to crazy_functions/Mermaid_Figure_Gen.py index 2243e77a..47e999c7 100644 --- a/crazy_functions/生成多种Mermaid图表.py +++ b/crazy_functions/Mermaid_Figure_Gen.py @@ -297,7 +297,7 @@ def 解析历史输入(history, llm_kwargs, file_manifest, chatbot, plugin_kwarg @CatchException -def 生成多种Mermaid图表( +def Mermaid_Figure_Gen( txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, web_port ): """ @@ -426,7 +426,7 @@ class Mermaid_Gen(GptAcademicPluginTemplate): "思维导图", ] plugin_kwargs = options.index(plugin_kwargs['Type_of_Mermaid']) - yield from 生成多种Mermaid图表( + yield from Mermaid_Figure_Gen( txt, llm_kwargs, plugin_kwargs, diff --git a/crazy_functions/多智能体.py b/crazy_functions/Multi_Agent_Legacy.py similarity index 88% rename from crazy_functions/多智能体.py rename to crazy_functions/Multi_Agent_Legacy.py index 3bbfb11d..4f9d880e 100644 --- a/crazy_functions/多智能体.py +++ b/crazy_functions/Multi_Agent_Legacy.py @@ -22,7 +22,7 @@ def remove_model_prefix(llm): @CatchException -def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Multi_Agent_Legacy终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): """ txt 输入栏用户输入的文本,例如需要翻译的一段话,再例如一个包含了待处理文件的路径 llm_kwargs gpt模型参数,如温度和top_p等,一般原样传递下去就行 @@ -78,17 +78,17 @@ def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_ chatbot.get_cookies()['lock_plugin'] = None persistent_class_multi_user_manager = GradioMultiuserManagerForPersistentClasses() user_uuid = chatbot.get_cookies().get('uuid') - persistent_key = f"{user_uuid}->多智能体终端" + persistent_key = f"{user_uuid}->Multi_Agent_Legacy终端" if persistent_class_multi_user_manager.already_alive(persistent_key): - # 当已经存在一个正在运行的多智能体终端时,直接将用户输入传递给它,而不是再次启动一个新的多智能体终端 + # 当已经存在一个正在运行的Multi_Agent_Legacy终端时,直接将用户输入传递给它,而不是再次启动一个新的Multi_Agent_Legacy终端 logger.info('[debug] feed new user input') executor = persistent_class_multi_user_manager.get(persistent_key) exit_reason = yield from executor.main_process_ui_control(txt, create_or_resume="resume") else: - # 运行多智能体终端 (首次) + # 运行Multi_Agent_Legacy终端 (首次) logger.info('[debug] create new executor instance') history = [] - chatbot.append(["正在启动: 多智能体终端", "插件动态生成, 执行开始, 作者 Microsoft & Binary-Husky."]) + chatbot.append(["正在启动: Multi_Agent_Legacy终端", "插件动态生成, 执行开始, 作者 Microsoft & Binary-Husky."]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 executor = AutoGenMath(llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request) persistent_class_multi_user_manager.set(persistent_key, executor) @@ -96,7 +96,7 @@ def 多智能体终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_ if exit_reason == "wait_feedback": # 当用户点击了“等待反馈”按钮时,将executor存储到cookie中,等待用户的再次调用 - executor.chatbot.get_cookies()['lock_plugin'] = 'crazy_functions.多智能体->多智能体终端' + executor.chatbot.get_cookies()['lock_plugin'] = 'crazy_functions.Multi_Agent_Legacy->Multi_Agent_Legacy终端' else: executor.chatbot.get_cookies()['lock_plugin'] = None yield from update_ui(chatbot=executor.chatbot, history=executor.history) # 更新状态 diff --git a/crazy_functions/询问多个大语言模型.py b/crazy_functions/Multi_LLM_Query.py similarity index 100% rename from crazy_functions/询问多个大语言模型.py rename to crazy_functions/Multi_LLM_Query.py diff --git a/crazy_functions/理解PDF文档内容.py b/crazy_functions/PDF_QA.py similarity index 98% rename from crazy_functions/理解PDF文档内容.py rename to crazy_functions/PDF_QA.py index 23e3ce4f..c066d5d1 100644 --- a/crazy_functions/理解PDF文档内容.py +++ b/crazy_functions/PDF_QA.py @@ -62,7 +62,7 @@ def 解析PDF(file_name, llm_kwargs, plugin_kwargs, chatbot, history, system_pro @CatchException -def 理解PDF文档内容标准文件输入(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def PDF_QA标准文件输入(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): import glob, os # 基本信息:功能、贡献者 diff --git a/crazy_functions/批量总结PDF文档.py b/crazy_functions/PDF_Summary.py similarity index 97% rename from crazy_functions/批量总结PDF文档.py rename to crazy_functions/PDF_Summary.py index a23750df..26e7333b 100644 --- a/crazy_functions/批量总结PDF文档.py +++ b/crazy_functions/PDF_Summary.py @@ -103,13 +103,13 @@ do not have too much repetitive information, numerical values using the original @CatchException -def 批量总结PDF文档(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def PDF_Summary(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): import glob, os # 基本信息:功能、贡献者 chatbot.append([ "函数插件功能?", - "批量总结PDF文档。函数插件贡献者: ValeriaWong,Eralien"]) + "PDF_Summary。函数插件贡献者: ValeriaWong,Eralien"]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 尝试导入依赖,如果缺少依赖,则给出安装建议 diff --git a/crazy_functions/批量翻译PDF文档_NOUGAT.py b/crazy_functions/PDF_Translate_Nougat.py similarity index 100% rename from crazy_functions/批量翻译PDF文档_NOUGAT.py rename to crazy_functions/PDF_Translate_Nougat.py diff --git a/crazy_functions/读文章写摘要.py b/crazy_functions/Paper_Abstract_Writer.py similarity index 97% rename from crazy_functions/读文章写摘要.py rename to crazy_functions/Paper_Abstract_Writer.py index 1bb0d325..12d9bc41 100644 --- a/crazy_functions/读文章写摘要.py +++ b/crazy_functions/Paper_Abstract_Writer.py @@ -43,7 +43,7 @@ def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbo @CatchException -def 读文章写摘要(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Paper_Abstract_Writer(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): history = [] # 清空历史,以免输入溢出 import glob, os if os.path.exists(txt): diff --git a/crazy_functions/生成函数注释.py b/crazy_functions/Program_Comment_Gen.py similarity index 88% rename from crazy_functions/生成函数注释.py rename to crazy_functions/Program_Comment_Gen.py index 64a3176c..6ae0b4ac 100644 --- a/crazy_functions/生成函数注释.py +++ b/crazy_functions/Program_Comment_Gen.py @@ -4,7 +4,7 @@ from toolbox import CatchException, report_exception from toolbox import write_history_to_file, promote_file_to_downloadzone from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive -def 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt): +def Program_Comment_Gen(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt): import time, os logger.info('begin analysis on:', file_manifest) for index, fp in enumerate(file_manifest): @@ -34,7 +34,7 @@ def 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, @CatchException -def 批量生成函数注释(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def 批量Program_Comment_Gen(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): history = [] # 清空历史,以免输入溢出 import glob, os if os.path.exists(txt): @@ -51,4 +51,4 @@ def 批量生成函数注释(txt, llm_kwargs, plugin_kwargs, chatbot, history, s report_exception(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何.tex文件: {txt}") yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 return - yield from 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt) + yield from Program_Comment_Gen(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt) diff --git a/crazy_functions/解析JupyterNotebook.py b/crazy_functions/SourceCode_Analyse_JupyterNotebook.py similarity index 100% rename from crazy_functions/解析JupyterNotebook.py rename to crazy_functions/SourceCode_Analyse_JupyterNotebook.py diff --git a/crazy_functions/知识库问答.py b/crazy_functions/Vectorstore_QA.py similarity index 97% rename from crazy_functions/知识库问答.py rename to crazy_functions/Vectorstore_QA.py index dd1207d6..b3e9da52 100644 --- a/crazy_functions/知识库问答.py +++ b/crazy_functions/Vectorstore_QA.py @@ -79,8 +79,8 @@ def 知识库文件注入(txt, llm_kwargs, plugin_kwargs, chatbot, history, syst # yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # chatbot._cookies['langchain_plugin_embedding'] = kai.get_current_archive_id() # chatbot._cookies['lock_plugin'] = 'crazy_functions.知识库文件注入->读取知识库作答' - # chatbot.append(['完成', "“根据知识库作答”函数插件已经接管问答系统, 提问吧! 但注意, 您接下来不能再使用其他插件了,刷新页面即可以退出知识库问答模式。"]) - chatbot.append(['构建完成', f"当前知识库内的有效文件:\n\n---\n\n{kai_files}\n\n---\n\n请切换至“知识库问答”插件进行知识库访问, 或者使用此插件继续上传更多文件。"]) + # chatbot.append(['完成', "“根据知识库作答”函数插件已经接管问答系统, 提问吧! 但注意, 您接下来不能再使用其他插件了,刷新页面即可以退出Vectorstore_QA模式。"]) + chatbot.append(['构建完成', f"当前知识库内的有效文件:\n\n---\n\n{kai_files}\n\n---\n\n请切换至“Vectorstore_QA”插件进行知识库访问, 或者使用此插件继续上传更多文件。"]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 由于请求gpt需要一段时间,我们先及时地做一次界面更新 @CatchException diff --git a/crazy_functions/虚空终端.py b/crazy_functions/Void_Terminal.py similarity index 94% rename from crazy_functions/虚空终端.py rename to crazy_functions/Void_Terminal.py index 662e3c1b..f4db8104 100644 --- a/crazy_functions/虚空终端.py +++ b/crazy_functions/Void_Terminal.py @@ -21,7 +21,7 @@ Please describe in natural language what you want to do. 5. If you don't need to upload a file, you can simply repeat your command again. """ explain_msg = """ -## 虚空终端插件说明: +## Void_Terminal插件说明: 1. 请用**自然语言**描述您需要做什么。例如: - 「请调用插件,为我翻译PDF论文,论文我刚刚放到上传区了」 @@ -104,9 +104,9 @@ def analyze_intention_with_simple_rules(txt): @CatchException -def 虚空终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Void_Terminal(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): disable_auto_promotion(chatbot=chatbot) - # 获取当前虚空终端状态 + # 获取当前Void_Terminal状态 state = VoidTerminalState.get_state(chatbot) appendix_msg = "" @@ -121,21 +121,21 @@ def 虚空终端(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt state.set_state(chatbot=chatbot, key='has_provided_explanation', value=True) state.unlock_plugin(chatbot=chatbot) yield from update_ui(chatbot=chatbot, history=history) - yield from 虚空终端主路由(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request) + yield from Void_Terminal主路由(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request) return else: # 如果意图模糊,提示 state.set_state(chatbot=chatbot, key='has_provided_explanation', value=True) state.lock_plugin(chatbot=chatbot) - chatbot.append(("虚空终端状态:", explain_msg+appendix_msg)) + chatbot.append(("Void_Terminal状态:", explain_msg+appendix_msg)) yield from update_ui(chatbot=chatbot, history=history) return -def 虚空终端主路由(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Void_Terminal主路由(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): history = [] - chatbot.append(("虚空终端状态: ", f"正在执行任务: {txt}")) + chatbot.append(("Void_Terminal状态: ", f"正在执行任务: {txt}")) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # ⭐ ⭐ ⭐ 分析用户意图 diff --git a/crazy_functions/总结word文档.py b/crazy_functions/Word_Summary.py similarity index 96% rename from crazy_functions/总结word文档.py rename to crazy_functions/Word_Summary.py index 99f0919b..9ead8abd 100644 --- a/crazy_functions/总结word文档.py +++ b/crazy_functions/Word_Summary.py @@ -79,13 +79,13 @@ def 解析docx(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot @CatchException -def 总结word文档(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): +def Word_Summary(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): import glob, os # 基本信息:功能、贡献者 chatbot.append([ "函数插件功能?", - "批量总结Word文档。函数插件贡献者: JasonGuo1。注意, 如果是.doc文件, 请先转化为.docx格式。"]) + "批量Word_Summary。函数插件贡献者: JasonGuo1。注意, 如果是.doc文件, 请先转化为.docx格式。"]) yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 # 尝试导入依赖,如果缺少依赖,则给出安装建议 diff --git a/crazy_functions/review_fns/data_sources/arxiv_source.py b/crazy_functions/review_fns/data_sources/arxiv_source.py index e4fb492d..8467e56d 100644 --- a/crazy_functions/review_fns/data_sources/arxiv_source.py +++ b/crazy_functions/review_fns/data_sources/arxiv_source.py @@ -9,7 +9,7 @@ from tqdm import tqdm class ArxivSource(DataSource): """arXiv API实现""" - + CATEGORIES = { # 物理学 "Physics": { @@ -27,7 +27,7 @@ class ArxivSource(DataSource): "physics": "物理学", "quant-ph": "量子物理", }, - + # 数学 "Mathematics": { "math.AG": "代数几何", @@ -63,7 +63,7 @@ class ArxivSource(DataSource): "math.ST": "统计理论", "math.SG": "辛几何", }, - + # 计算机科学 "Computer Science": { "cs.AI": "人工智能", @@ -107,7 +107,7 @@ class ArxivSource(DataSource): "cs.SC": "符号计算", "cs.SY": "系统与控制", }, - + # 定量生物学 "Quantitative Biology": { "q-bio.BM": "生物分子", @@ -121,7 +121,7 @@ class ArxivSource(DataSource): "q-bio.SC": "亚细胞过程", "q-bio.TO": "组织与器官", }, - + # 定量金融 "Quantitative Finance": { "q-fin.CP": "计算金融", @@ -134,7 +134,7 @@ class ArxivSource(DataSource): "q-fin.ST": "统计金融", "q-fin.TR": "交易与市场微观结构", }, - + # 统计学 "Statistics": { "stat.AP": "应用统计", @@ -144,7 +144,7 @@ class ArxivSource(DataSource): "stat.OT": "其他统计", "stat.TH": "统计理论", }, - + # 电气工程与系统科学 "Electrical Engineering and Systems Science": { "eess.AS": "音频与语音处理", @@ -152,7 +152,7 @@ class ArxivSource(DataSource): "eess.SP": "信号处理", "eess.SY": "系统与控制", }, - + # 经济学 "Economics": { "econ.EM": "计量经济学", @@ -170,15 +170,15 @@ class ArxivSource(DataSource): 'lastUpdatedDate': arxiv.SortCriterion.LastUpdatedDate, # 最后更新日期 'submittedDate': arxiv.SortCriterion.SubmittedDate, # 提交日期 } - + self.sort_order_options = { 'ascending': arxiv.SortOrder.Ascending, 'descending': arxiv.SortOrder.Descending } - + self.default_sort = 'lastUpdatedDate' self.default_order = 'descending' - + def _initialize(self) -> None: """初始化客户端,设置默认参数""" self.client = arxiv.Client() @@ -196,22 +196,22 @@ class ArxivSource(DataSource): # 使用默认排序如果提供的排序选项无效 if not sort_by or sort_by not in self.sort_options: sort_by = self.default_sort - - # 使用默认排序顺序如果提供的顺序无效 + + # 使用默认排序顺序如果提供的顺序无效 if not sort_order or sort_order not in self.sort_order_options: sort_order = self.default_order - + # 如果指定了起始年份,添加到查询中 if start_year: query = f"{query} AND submittedDate:[{start_year}0101 TO 99991231]" - + search = arxiv.Search( query=query, max_results=limit, sort_by=self.sort_options[sort_by], sort_order=self.sort_order_options[sort_order] ) - + results = list(self.client.results(search)) return [self._parse_paper_data(result) for result in results] except Exception as e: @@ -220,13 +220,13 @@ class ArxivSource(DataSource): async def search_by_id(self, paper_id: Union[str, List[str]]) -> List[PaperMetadata]: """按ID搜索论文 - + Args: paper_id: 单个arXiv ID或ID列表,例如:'2005.14165' 或 ['2005.14165', '2103.14030'] """ if isinstance(paper_id, str): paper_id = [paper_id] - + search = arxiv.Search( id_list=paper_id, max_results=len(paper_id) @@ -235,8 +235,8 @@ class ArxivSource(DataSource): return [self._parse_paper_data(result) for result in results] async def search_by_category( - self, - category: str, + self, + category: str, limit: int = 100, sort_by: str = 'relevance', sort_order: str = 'descending', @@ -244,11 +244,11 @@ class ArxivSource(DataSource): ) -> List[PaperMetadata]: """按类别搜索论文""" query = f"cat:{category}" - + # 如果指定了起始年份,添加到查询中 if start_year: query = f"{query} AND submittedDate:[{start_year}0101 TO 99991231]" - + return await self.search( query=query, limit=limit, @@ -257,19 +257,19 @@ class ArxivSource(DataSource): ) async def search_by_authors( - self, - authors: List[str], + self, + authors: List[str], limit: int = 100, sort_by: str = 'relevance', start_year: int = None ) -> List[PaperMetadata]: """按作者搜索论文""" query = " AND ".join([f"au:\"{author}\"" for author in authors]) - + # 如果指定了起始年份,添加到查询中 if start_year: query = f"{query} AND submittedDate:[{start_year}0101 TO 99991231]" - + return await self.search( query=query, limit=limit, @@ -277,9 +277,9 @@ class ArxivSource(DataSource): ) async def search_by_date_range( - self, - start_date: datetime, - end_date: datetime, + self, + start_date: datetime, + end_date: datetime, limit: int = 100, sort_by: Literal['relevance', 'updated', 'submitted'] = 'submitted', sort_order: Literal['ascending', 'descending'] = 'descending' @@ -287,20 +287,20 @@ class ArxivSource(DataSource): """按日期范围搜索论文""" query = f"submittedDate:[{start_date.strftime('%Y%m%d')} TO {end_date.strftime('%Y%m%d')}]" return await self.search( - query, - limit=limit, - sort_by=sort_by, + query, + limit=limit, + sort_by=sort_by, sort_order=sort_order ) async def download_pdf(self, paper_id: str, dirpath: str = "./", filename: str = "") -> str: """下载论文PDF - + Args: paper_id: arXiv ID dirpath: 保存目录 filename: 文件名,如果为空则使用默认格式:{paper_id}_{标题}.pdf - + Returns: 保存的文件路径 """ @@ -308,24 +308,24 @@ class ArxivSource(DataSource): if not papers: raise ValueError(f"未找到ID为 {paper_id} 的论文") paper = papers[0] - + if not filename: # 清理标题中的非法字符 safe_title = "".join(c if c.isalnum() else "_" for c in paper.title) filename = f"{paper_id}_{safe_title}.pdf" - + filepath = os.path.join(dirpath, filename) urlretrieve(paper.url, filepath) return filepath async def download_source(self, paper_id: str, dirpath: str = "./", filename: str = "") -> str: """下载论文源文件(通常是LaTeX源码) - + Args: paper_id: arXiv ID dirpath: 保存目录 filename: 文件名,如果为空则使用默认格式:{paper_id}_{标题}.tar.gz - + Returns: 保存的文件路径 """ @@ -333,11 +333,11 @@ class ArxivSource(DataSource): if not papers: raise ValueError(f"未找到ID为 {paper_id} 的论文") paper = papers[0] - + if not filename: safe_title = "".join(c if c.isalnum() else "_" for c in paper.title) filename = f"{paper_id}_{safe_title}.tar.gz" - + filepath = os.path.join(dirpath, filename) source_url = paper.url.replace("/pdf/", "/src/") urlretrieve(source_url, filepath) @@ -353,10 +353,10 @@ class ArxivSource(DataSource): async def get_paper_details(self, paper_id: str) -> Optional[PaperMetadata]: """获取论文详情 - + Args: paper_id: arXiv ID 或 DOI - + Returns: 论文详细信息,如果未找到返回 None """ @@ -367,7 +367,7 @@ class ArxivSource(DataSource): # 如果是 DOI 格式且是 arXiv 论文,提取 ID elif paper_id.startswith("10.48550/arXiv."): paper_id = paper_id.split(".")[-1] - + papers = await self.search_by_id(paper_id) return papers[0] if papers else None except Exception as e: @@ -379,7 +379,7 @@ class ArxivSource(DataSource): # 解析主要类别和次要类别 primary_category = result.primary_category categories = result.categories - + # 构建venue信息 venue_info = { 'primary_category': primary_category, @@ -387,7 +387,7 @@ class ArxivSource(DataSource): 'comments': getattr(result, 'comment', None), 'journal_ref': getattr(result, 'journal_ref', None) } - + return PaperMetadata( title=result.title, authors=[author.name for author in result.authors], @@ -405,15 +405,15 @@ class ArxivSource(DataSource): ) async def get_latest_papers( - self, - category: str, + self, + category: str, debug: bool = False, batch_size: int = 50 ) -> List[PaperMetadata]: """获取指定类别的最新论文 - + 通过 RSS feed 获取最新发布的论文,然后批量获取详细信息 - + Args: category: arXiv类别,例如: - 整个领域: 'cs' @@ -421,10 +421,10 @@ class ArxivSource(DataSource): - 多个类别: 'cs.AI+q-bio.NC' debug: 是否为调试模式,如果为True则只返回5篇最新论文 batch_size: 批量获取论文的数量,默认50 - + Returns: 论文列表 - + Raises: ValueError: 如果类别无效 """ @@ -433,22 +433,22 @@ class ArxivSource(DataSource): # 1. 转换为小写 # 2. 确保多个类别之间使用+连接 category = category.lower().replace(' ', '+') - + # 构建RSS feed URL feed_url = f"https://rss.arxiv.org/rss/{category}" print(f"正在获取RSS feed: {feed_url}") # 添加调试信息 - + feed = feedparser.parse(feed_url) - + # 检查feed是否有效 if hasattr(feed, 'status') and feed.status != 200: raise ValueError(f"获取RSS feed失败,状态码: {feed.status}") - + if not feed.entries: print(f"警告:未在feed中找到任何条目") # 添加调试信息 print(f"Feed标题: {feed.feed.title if hasattr(feed, 'feed') else '无标题'}") raise ValueError(f"无效的arXiv类别或未找到论文: {category}") - + if debug: # 调试模式:只获取5篇最新论文 search = arxiv.Search( @@ -459,7 +459,7 @@ class ArxivSource(DataSource): ) results = list(self.client.results(search)) return [self._parse_paper_data(result) for result in results] - + # 正常模式:获取所有新论文 # 从RSS条目中提取arXiv ID paper_ids = [] @@ -476,13 +476,13 @@ class ArxivSource(DataSource): except Exception as e: print(f"警告:处理条目时出错: {str(e)}") # 添加调试信息 continue - + if not paper_ids: print("未能从feed中提取到任何论文ID") # 添加调试信息 return [] - + print(f"成功提取到 {len(paper_ids)} 个论文ID") # 添加调试信息 - + # 批量获取论文详情 papers = [] with tqdm(total=len(paper_ids), desc="获取arXiv论文") as pbar: @@ -495,9 +495,9 @@ class ArxivSource(DataSource): batch_results = list(self.client.results(search)) papers.extend([self._parse_paper_data(result) for result in batch_results]) pbar.update(len(batch_results)) - + return papers - + except Exception as e: print(f"获取最新论文时发生错误: {str(e)}") import traceback @@ -507,18 +507,18 @@ class ArxivSource(DataSource): async def example_usage(): """ArxivSource使用示例""" arxiv_source = ArxivSource() - + try: # 示例1:基本搜索,使用不同的排序方式 # print("\n=== 示例1:搜索最新的机器学习论文(按提交时间排序)===") # papers = await arxiv_source.search( - # "ti:\"machine learning\"", + # "ti:\"machine learning\"", # limit=3, # sort_by='submitted', # sort_order='descending' # ) # print(f"找到 {len(papers)} 篇论文") - + # for i, paper in enumerate(papers, 1): # print(f"\n--- 论文 {i} ---") # print(f"标题: {paper.title}") @@ -544,7 +544,7 @@ async def example_usage(): # # 示例3:按类别搜索 # print("\n=== 示例3:搜索人工智能领域最新论文 ===") # ai_papers = await arxiv_source.search_by_category( - # "cs.AI", + # "cs.AI", # limit=2, # sort_by='updated', # sort_order='descending' @@ -558,7 +558,7 @@ async def example_usage(): # # 示例4:按作者搜索 # print("\n=== 示例4:搜索特定作者的论文 ===") # author_papers = await arxiv_source.search_by_authors( - # ["Bengio"], + # ["Bengio"], # limit=2, # sort_by='relevance' # ) @@ -598,7 +598,7 @@ async def example_usage(): # 示例6:获取最新论文 print("\n=== 示例8:获取最新论文 ===") - + # 获取CS.AI领域的最新论文 print("\n--- 获取AI领域最新论文 ---") ai_latest = await arxiv_source.get_latest_papers("cs.AI", debug=True) @@ -607,7 +607,7 @@ async def example_usage(): print(f"标题: {paper.title}") print(f"作者: {', '.join(paper.authors)}") print(f"发表年份: {paper.year}") - + # 获取整个计算机科学领域的最新论文 print("\n--- 获取整个CS领域最新论文 ---") cs_latest = await arxiv_source.get_latest_papers("cs", debug=True) @@ -616,7 +616,7 @@ async def example_usage(): print(f"标题: {paper.title}") print(f"作者: {', '.join(paper.authors)}") print(f"发表年份: {paper.year}") - + # 获取多个类别的最新论文 print("\n--- 获取AI和机器学习领域最新论文 ---") multi_latest = await arxiv_source.get_latest_papers("cs.AI+cs.LG", debug=True) @@ -633,4 +633,4 @@ async def example_usage(): if __name__ == "__main__": import asyncio - asyncio.run(example_usage()) \ No newline at end of file + asyncio.run(example_usage()) \ No newline at end of file diff --git a/crazy_functions/vt_fns/vt_state.py b/crazy_functions/vt_fns/vt_state.py index f09236dc..de24a8ea 100644 --- a/crazy_functions/vt_fns/vt_state.py +++ b/crazy_functions/vt_fns/vt_state.py @@ -8,7 +8,7 @@ class VoidTerminalState(): self.has_provided_explanation = False def lock_plugin(self, chatbot): - chatbot._cookies['lock_plugin'] = 'crazy_functions.虚空终端->虚空终端' + chatbot._cookies['lock_plugin'] = 'crazy_functions.Void_Terminal->Void_Terminal' chatbot._cookies['plugin_state'] = pickle.dumps(self) def unlock_plugin(self, chatbot): diff --git a/crazy_functions/批量总结PDF文档pdfminer.py b/crazy_functions/批量总结PDF文档pdfminer.py deleted file mode 100644 index 0afc9968..00000000 --- a/crazy_functions/批量总结PDF文档pdfminer.py +++ /dev/null @@ -1,162 +0,0 @@ -from loguru import logger -from toolbox import update_ui -from toolbox import CatchException, report_exception -from crazy_functions.crazy_utils import request_gpt_model_in_new_thread_with_ui_alive -from toolbox import write_history_to_file, promote_file_to_downloadzone - -fast_debug = False - -def readPdf(pdfPath): - """ - 读取pdf文件,返回文本内容 - """ - import pdfminer - from pdfminer.pdfparser import PDFParser - from pdfminer.pdfdocument import PDFDocument - from pdfminer.pdfpage import PDFPage, PDFTextExtractionNotAllowed - from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter - from pdfminer.pdfdevice import PDFDevice - from pdfminer.layout import LAParams - from pdfminer.converter import PDFPageAggregator - - fp = open(pdfPath, 'rb') - - # Create a PDF parser object associated with the file object - parser = PDFParser(fp) - - # Create a PDF document object that stores the document structure. - # Password for initialization as 2nd parameter - document = PDFDocument(parser) - # Check if the document allows text extraction. If not, abort. - if not document.is_extractable: - raise PDFTextExtractionNotAllowed - - # Create a PDF resource manager object that stores shared resources. - rsrcmgr = PDFResourceManager() - - # Create a PDF device object. - # device = PDFDevice(rsrcmgr) - - # BEGIN LAYOUT ANALYSIS. - # Set parameters for analysis. - laparams = LAParams( - char_margin=10.0, - line_margin=0.2, - boxes_flow=0.2, - all_texts=False, - ) - # Create a PDF page aggregator object. - device = PDFPageAggregator(rsrcmgr, laparams=laparams) - # Create a PDF interpreter object. - interpreter = PDFPageInterpreter(rsrcmgr, device) - - # loop over all pages in the document - outTextList = [] - for page in PDFPage.create_pages(document): - # read the page into a layout object - interpreter.process_page(page) - layout = device.get_result() - for obj in layout._objs: - if isinstance(obj, pdfminer.layout.LTTextBoxHorizontal): - outTextList.append(obj.get_text()) - - return outTextList - - -def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt): - import time, glob, os - from bs4 import BeautifulSoup - logger.info('begin analysis on:', file_manifest) - for index, fp in enumerate(file_manifest): - if ".tex" in fp: - with open(fp, 'r', encoding='utf-8', errors='replace') as f: - file_content = f.read() - if ".pdf" in fp.lower(): - file_content = readPdf(fp) - file_content = BeautifulSoup(''.join(file_content), features="lxml").body.text.encode('gbk', 'ignore').decode('gbk') - - prefix = "接下来请你逐文件分析下面的论文文件,概括其内容" if index==0 else "" - i_say = prefix + f'请对下面的文章片段用中文做一个概述,文件名是{os.path.relpath(fp, project_folder)},文章内容是 ```{file_content}```' - i_say_show_user = prefix + f'[{index+1}/{len(file_manifest)}] 请对下面的文章片段做一个概述: {os.path.abspath(fp)}' - chatbot.append((i_say_show_user, "[Local Message] waiting gpt response.")) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - if not fast_debug: - msg = '正常' - # ** gpt request ** - gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive( - inputs=i_say, - inputs_show_user=i_say_show_user, - llm_kwargs=llm_kwargs, - chatbot=chatbot, - history=[], - sys_prompt="总结文章。" - ) # 带超时倒计时 - chatbot[-1] = (i_say_show_user, gpt_say) - history.append(i_say_show_user); history.append(gpt_say) - yield from update_ui(chatbot=chatbot, history=history, msg=msg) # 刷新界面 - if not fast_debug: time.sleep(2) - - all_file = ', '.join([os.path.relpath(fp, project_folder) for index, fp in enumerate(file_manifest)]) - i_say = f'根据以上你自己的分析,对全文进行概括,用学术性语言写一段中文摘要,然后再写一段英文摘要(包括{all_file})。' - chatbot.append((i_say, "[Local Message] waiting gpt response.")) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - if not fast_debug: - msg = '正常' - # ** gpt request ** - gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive( - inputs=i_say, - inputs_show_user=i_say, - llm_kwargs=llm_kwargs, - chatbot=chatbot, - history=history, - sys_prompt="总结文章。" - ) # 带超时倒计时 - chatbot[-1] = (i_say, gpt_say) - history.append(i_say); history.append(gpt_say) - yield from update_ui(chatbot=chatbot, history=history, msg=msg) # 刷新界面 - res = write_history_to_file(history) - promote_file_to_downloadzone(res, chatbot=chatbot) - chatbot.append(("完成了吗?", res)) - yield from update_ui(chatbot=chatbot, history=history, msg=msg) # 刷新界面 - - - -@CatchException -def 批量总结PDF文档pdfminer(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request): - history = [] # 清空历史,以免输入溢出 - import glob, os - - # 基本信息:功能、贡献者 - chatbot.append([ - "函数插件功能?", - "批量总结PDF文档,此版本使用pdfminer插件,带token约简功能。函数插件贡献者: Euclid-Jie。"]) - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - - # 尝试导入依赖,如果缺少依赖,则给出安装建议 - try: - import pdfminer, bs4 - except: - report_exception(chatbot, history, - a = f"解析项目: {txt}", - b = f"导入软件依赖失败。使用该模块需要额外依赖,安装方法```pip install --upgrade pdfminer beautifulsoup4```。") - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - return - if os.path.exists(txt): - project_folder = txt - else: - if txt == "": txt = '空空如也的输入栏' - report_exception(chatbot, history, a = f"解析项目: {txt}", b = f"找不到本地项目或无权访问: {txt}") - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - return - file_manifest = [f for f in glob.glob(f'{project_folder}/**/*.tex', recursive=True)] + \ - [f for f in glob.glob(f'{project_folder}/**/*.pdf', recursive=True)] # + \ - # [f for f in glob.glob(f'{project_folder}/**/*.cpp', recursive=True)] + \ - # [f for f in glob.glob(f'{project_folder}/**/*.c', recursive=True)] - if len(file_manifest) == 0: - report_exception(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何.tex或pdf文件: {txt}") - yield from update_ui(chatbot=chatbot, history=history) # 刷新界面 - return - yield from 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt) - diff --git a/docs/self_analysis.md b/docs/self_analysis.md index 5863136e..bb09fe23 100644 --- a/docs/self_analysis.md +++ b/docs/self_analysis.md @@ -19,24 +19,24 @@ | crazy_functions\Latex全文润色.py | 对整个 Latex 项目进行润色和纠错 | | crazy_functions\Latex全文翻译.py | 对整个 Latex 项目进行翻译 | | crazy_functions\\_\_init\_\_.py | 模块初始化文件,标识 `crazy_functions` 是一个包 | -| crazy_functions\下载arxiv论文翻译摘要.py | 下载 `arxiv` 论文的 PDF 文件,并提取摘要和翻译 | +| crazy_functions\Arxiv_Downloader.py | 下载 `arxiv` 论文的 PDF 文件,并提取摘要和翻译 | | crazy_functions\代码重写为全英文_多线程.py | 将Python源代码文件中的中文内容转化为英文 | | crazy_functions\图片生成.py | 根据激励文本使用GPT模型生成相应的图像 | | crazy_functions\Conversation_To_File.py | 将每次对话记录写入Markdown格式的文件中 | -| crazy_functions\总结word文档.py | 对输入的word文档进行摘要生成 | -| crazy_functions\总结音视频.py | 对输入的音视频文件进行摘要生成 | +| crazy_functions\Word_Summary.py | 对输入的word文档进行摘要生成 | +| crazy_functions\Audio_Summary.py | 对输入的音视频文件进行摘要生成 | | crazy_functions\Markdown_Translate.py | 将指定目录下的Markdown文件进行中英文翻译 | -| crazy_functions\批量总结PDF文档.py | 对PDF文件进行切割和摘要生成 | -| crazy_functions\批量总结PDF文档pdfminer.py | 对PDF文件进行文本内容的提取和摘要生成 | +| crazy_functions\PDF_Summary.py | 对PDF文件进行切割和摘要生成 | +| crazy_functions\PDF_Summarypdfminer.py | 对PDF文件进行文本内容的提取和摘要生成 | | crazy_functions\PDF_Translate.py | 将指定目录下的PDF文件进行中英文翻译 | -| crazy_functions\理解PDF文档内容.py | 对PDF文件进行摘要生成和问题解答 | -| crazy_functions\生成函数注释.py | 自动生成Python函数的注释 | -| crazy_functions\联网的ChatGPT.py | 使用网络爬虫和ChatGPT模型进行聊天回答 | -| crazy_functions\解析JupyterNotebook.py | 对Jupyter Notebook进行代码解析 | +| crazy_functions\PDF_QA.py | 对PDF文件进行摘要生成和问题解答 | +| crazy_functions\Program_Comment_Gen.py | 自动生成Python函数的注释 | +| crazy_functions\Internet_GPT_Legacy.py | 使用网络爬虫和ChatGPT模型进行聊天回答 | +| crazy_functions\SourceCode_Analyse_JupyterNotebook.py | 对Jupyter Notebook进行代码解析 | | crazy_functions\解析项目源代码.py | 对指定编程语言的源代码进行解析 | -| crazy_functions\询问多个大语言模型.py | 使用多个大语言模型对输入进行处理和回复 | -| crazy_functions\读文章写摘要.py | 对论文进行解析和全文摘要生成 | -| crazy_functions\谷歌检索小助手.py | 提供谷歌学术搜索页面中相关文章的元数据信息。 | +| crazy_functions\Multi_LLM_Query.py | 使用多个大语言模型对输入进行处理和回复 | +| crazy_functions\Paper_Abstract_Writer.py | 对论文进行解析和全文摘要生成 | +| crazy_functions\Google_Scholar_Assistant_Legacy.py | 提供谷歌学术搜索页面中相关文章的元数据信息。 | | crazy_functions\高级功能函数模板.py | 使用Unsplash API发送相关图片以回复用户的输入。 | | request_llms\bridge_all.py | 基于不同LLM模型进行对话。 | | request_llms\bridge_chatglm.py | 使用ChatGLM模型生成回复,支持单线程和多线程方式。 | @@ -120,7 +120,7 @@ toolbox.py是一个工具类库,其中主要包含了一些函数装饰器和 ## [10/48] 请对下面的程序文件做一个概述: crazy_functions\crazy_functions_test.py -这个文件是一个Python测试模块,用于测试crazy_functions中的各种函数插件。这些函数包括:解析Python项目源代码、解析Cpp项目源代码、Latex全文润色、Markdown中译英、批量翻译PDF文档、谷歌检索小助手、总结word文档、下载arxiv论文并翻译摘要、联网回答问题、和解析Jupyter Notebooks。对于每个函数插件,都有一个对应的测试函数来进行测试。 +这个文件是一个Python测试模块,用于测试crazy_functions中的各种函数插件。这些函数包括:解析Python项目源代码、解析Cpp项目源代码、Latex全文润色、Markdown中译英、批量翻译PDF文档、Google_Scholar_Assistant_Legacy、Word_Summary、下载arxiv论文并翻译摘要、联网回答问题、和解析Jupyter Notebooks。对于每个函数插件,都有一个对应的测试函数来进行测试。 ## [11/48] 请对下面的程序文件做一个概述: crazy_functions\crazy_utils.py @@ -143,9 +143,9 @@ toolbox.py是一个工具类库,其中主要包含了一些函数装饰器和 这是一个Python模块的初始化文件(__init__.py),命名为"crazy_functions"。该模块包含了一些疯狂的函数,但该文件并没有实现这些函数,而是作为一个包(package)来导入其它的Python模块以实现这些函数。在该文件中,没有定义任何类或函数,它唯一的作用就是标识"crazy_functions"模块是一个包。 -## [15/48] 请对下面的程序文件做一个概述: crazy_functions\下载arxiv论文翻译摘要.py +## [15/48] 请对下面的程序文件做一个概述: crazy_functions\Arxiv_Downloader.py -这是一个 Python 程序文件,文件名为 `下载arxiv论文翻译摘要.py`。程序包含多个函数,其中 `下载arxiv论文并翻译摘要` 函数的作用是下载 `arxiv` 论文的 PDF 文件,提取摘要并使用 GPT 对其进行翻译。其他函数包括用于下载 `arxiv` 论文的 `download_arxiv_` 函数和用于获取文章信息的 `get_name` 函数,其中涉及使用第三方库如 requests, BeautifulSoup 等。该文件还包含一些用于调试和存储文件的代码段。 +这是一个 Python 程序文件,文件名为 `Arxiv_Downloader.py`。程序包含多个函数,其中 `下载arxiv论文并翻译摘要` 函数的作用是下载 `arxiv` 论文的 PDF 文件,提取摘要并使用 GPT 对其进行翻译。其他函数包括用于下载 `arxiv` 论文的 `download_arxiv_` 函数和用于获取文章信息的 `get_name` 函数,其中涉及使用第三方库如 requests, BeautifulSoup 等。该文件还包含一些用于调试和存储文件的代码段。 ## [16/48] 请对下面的程序文件做一个概述: crazy_functions\代码重写为全英文_多线程.py @@ -167,11 +167,11 @@ toolbox.py是一个工具类库,其中主要包含了一些函数装饰器和 4. Conversation_To_File(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, user_request):一个主要函数,用于保存当前对话记录并提醒用户。如果用户希望加载历史记录,则调用read_file_to_chat()来更新聊天显示框。如果用户希望删除历史记录,调用删除所有本地对话历史记录()函数完成删除操作。 -## [19/48] 请对下面的程序文件做一个概述: crazy_functions\总结word文档.py +## [19/48] 请对下面的程序文件做一个概述: crazy_functions\Word_Summary.py -该程序文件实现了一个总结Word文档的功能,使用Python的docx库读取docx格式的文件,使用pywin32库读取doc格式的文件。程序会先根据传入的txt参数搜索需要处理的文件,并逐个解析其中的内容,将内容拆分为指定长度的文章片段,然后使用另一个程序文件中的request_gpt_model_in_new_thread_with_ui_alive函数进行中文概述。最后将所有的总结结果写入一个文件中,并在界面上进行展示。 +该程序文件实现了一个Word_Summary的功能,使用Python的docx库读取docx格式的文件,使用pywin32库读取doc格式的文件。程序会先根据传入的txt参数搜索需要处理的文件,并逐个解析其中的内容,将内容拆分为指定长度的文章片段,然后使用另一个程序文件中的request_gpt_model_in_new_thread_with_ui_alive函数进行中文概述。最后将所有的总结结果写入一个文件中,并在界面上进行展示。 -## [20/48] 请对下面的程序文件做一个概述: crazy_functions\总结音视频.py +## [20/48] 请对下面的程序文件做一个概述: crazy_functions\Audio_Summary.py 该程序文件包括两个函数:split_audio_file()和AnalyAudio(),并且导入了一些必要的库并定义了一些工具函数。split_audio_file用于将音频文件分割成多个时长相等的片段,返回一个包含所有切割音频片段文件路径的列表,而AnalyAudio用来分析音频文件,通过调用whisper模型进行音频转文字并使用GPT模型对音频内容进行概述,最终将所有总结结果写入结果文件中。 @@ -179,31 +179,31 @@ toolbox.py是一个工具类库,其中主要包含了一些函数装饰器和 该程序文件名为`Markdown_Translate.py`,包含了以下功能:读取Markdown文件,将长文本分离开来,将Markdown文件进行翻译(英译中和中译英),整理结果并退出。程序使用了多线程以提高效率。程序使用了`tiktoken`依赖库,可能需要额外安装。文件中还有一些其他的函数和类,但与文件名所描述的功能无关。 -## [22/48] 请对下面的程序文件做一个概述: crazy_functions\批量总结PDF文档.py +## [22/48] 请对下面的程序文件做一个概述: crazy_functions\PDF_Summary.py -该文件是一个Python脚本,名为crazy_functions\批量总结PDF文档.py。在导入了一系列库和工具函数后,主要定义了5个函数,其中包括一个错误处理装饰器(@CatchException),用于批量总结PDF文档。该函数主要实现对PDF文档的解析,并调用模型生成中英文摘要。 +该文件是一个Python脚本,名为crazy_functions\PDF_Summary.py。在导入了一系列库和工具函数后,主要定义了5个函数,其中包括一个错误处理装饰器(@CatchException),用于PDF_Summary。该函数主要实现对PDF文档的解析,并调用模型生成中英文摘要。 -## [23/48] 请对下面的程序文件做一个概述: crazy_functions\批量总结PDF文档pdfminer.py +## [23/48] 请对下面的程序文件做一个概述: crazy_functions\PDF_Summarypdfminer.py -该程序文件是一个用于批量总结PDF文档的函数插件,使用了pdfminer插件和BeautifulSoup库来提取PDF文档的文本内容,对每个PDF文件分别进行处理并生成中英文摘要。同时,该程序文件还包括一些辅助工具函数和处理异常的装饰器。 +该程序文件是一个用于PDF_Summary的函数插件,使用了pdfminer插件和BeautifulSoup库来提取PDF文档的文本内容,对每个PDF文件分别进行处理并生成中英文摘要。同时,该程序文件还包括一些辅助工具函数和处理异常的装饰器。 ## [24/48] 请对下面的程序文件做一个概述: crazy_functions\PDF_Translate.py 这个程序文件是一个Python脚本,文件名为“PDF_Translate.py”。它主要使用了“toolbox”、“request_gpt_model_in_new_thread_with_ui_alive”、“request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency”、“colorful”等Python库和自定义的模块“crazy_utils”的一些函数。程序实现了一个批量翻译PDF文档的功能,可以自动解析PDF文件中的基础信息,递归地切割PDF文件,翻译和处理PDF论文中的所有内容,并生成相应的翻译结果文件(包括md文件和html文件)。功能比较复杂,其中需要调用多个函数和依赖库,涉及到多线程操作和UI更新。文件中有详细的注释和变量命名,代码比较清晰易读。 -## [25/48] 请对下面的程序文件做一个概述: crazy_functions\理解PDF文档内容.py +## [25/48] 请对下面的程序文件做一个概述: crazy_functions\PDF_QA.py -该程序文件实现了一个名为“理解PDF文档内容”的函数,该函数可以为输入的PDF文件提取摘要以及正文各部分的主要内容,并在提取过程中根据上下文关系进行学术性问题解答。该函数依赖于多个辅助函数和第三方库,并在执行过程中针对可能出现的异常进行了处理。 +该程序文件实现了一个名为“PDF_QA”的函数,该函数可以为输入的PDF文件提取摘要以及正文各部分的主要内容,并在提取过程中根据上下文关系进行学术性问题解答。该函数依赖于多个辅助函数和第三方库,并在执行过程中针对可能出现的异常进行了处理。 -## [26/48] 请对下面的程序文件做一个概述: crazy_functions\生成函数注释.py +## [26/48] 请对下面的程序文件做一个概述: crazy_functions\Program_Comment_Gen.py -该程序文件是一个Python模块文件,文件名为“生成函数注释.py”,定义了两个函数:一个是生成函数注释的主函数“生成函数注释”,另一个是通过装饰器实现异常捕捉的函数“批量生成函数注释”。该程序文件依赖于“toolbox”和本地“crazy_utils”模块,并且在运行时使用了多线程技术和GPT模型来生成注释。函数生成的注释结果使用Markdown表格输出并写入历史记录文件。 +该程序文件是一个Python模块文件,文件名为“Program_Comment_Gen.py”,定义了两个函数:一个是Program_Comment_Gen的主函数“Program_Comment_Gen”,另一个是通过装饰器实现异常捕捉的函数“批量Program_Comment_Gen”。该程序文件依赖于“toolbox”和本地“crazy_utils”模块,并且在运行时使用了多线程技术和GPT模型来生成注释。函数生成的注释结果使用Markdown表格输出并写入历史记录文件。 -## [27/48] 请对下面的程序文件做一个概述: crazy_functions\联网的ChatGPT.py +## [27/48] 请对下面的程序文件做一个概述: crazy_functions\Internet_GPT_Legacy.py -这是一个名为`联网的ChatGPT.py`的Python程序文件,其中定义了一个函数`连接网络回答问题`。该函数通过爬取搜索引擎的结果和访问网页来综合回答给定的问题,并使用ChatGPT模型完成回答。此外,该文件还包括一些工具函数,例如从网页中抓取文本和使用代理访问网页。 +这是一个名为`Internet_GPT_Legacy.py`的Python程序文件,其中定义了一个函数`连接网络回答问题`。该函数通过爬取搜索引擎的结果和访问网页来综合回答给定的问题,并使用ChatGPT模型完成回答。此外,该文件还包括一些工具函数,例如从网页中抓取文本和使用代理访问网页。 -## [28/48] 请对下面的程序文件做一个概述: crazy_functions\解析JupyterNotebook.py +## [28/48] 请对下面的程序文件做一个概述: crazy_functions\SourceCode_Analyse_JupyterNotebook.py 这个程序文件包含了两个函数: `parseNotebook()`和`解析ipynb文件()`,并且引入了一些工具函数和类。`parseNotebook()`函数将Jupyter Notebook文件解析为文本代码块,`解析ipynb文件()`函数则用于解析多个Jupyter Notebook文件,使用`parseNotebook()`解析每个文件和一些其他的处理。函数中使用了多线程处理输入和输出,并且将结果写入到文件中。 @@ -211,17 +211,17 @@ toolbox.py是一个工具类库,其中主要包含了一些函数装饰器和 这是一个源代码分析的Python代码文件,其中定义了多个函数,包括解析一个Python项目、解析一个C项目、解析一个C项目的头文件和解析一个Java项目等。其中解析源代码新函数是实际处理源代码分析并生成报告的函数。该函数首先会逐个读取传入的源代码文件,生成对应的请求内容,通过多线程发送到chatgpt进行分析。然后将结果写入文件,并进行汇总分析。最后通过调用update_ui函数刷新界面,完整实现了源代码的分析。 -## [30/48] 请对下面的程序文件做一个概述: crazy_functions\询问多个大语言模型.py +## [30/48] 请对下面的程序文件做一个概述: crazy_functions\Multi_LLM_Query.py 该程序文件包含两个函数:同时问询()和同时问询_指定模型(),它们的作用是使用多个大语言模型同时对用户输入进行处理,返回对应模型的回复结果。同时问询()会默认使用ChatGPT和ChatGLM两个模型,而同时问询_指定模型()则可以指定要使用的模型。该程序文件还引用了其他的模块和函数库。 -## [31/48] 请对下面的程序文件做一个概述: crazy_functions\读文章写摘要.py +## [31/48] 请对下面的程序文件做一个概述: crazy_functions\Paper_Abstract_Writer.py -这个程序文件是一个Python模块,文件名为crazy_functions\读文章写摘要.py。该模块包含了两个函数,其中主要函数是"读文章写摘要"函数,其实现了解析给定文件夹中的tex文件,对其中每个文件的内容进行摘要生成,并根据各论文片段的摘要,最终生成全文摘要。第二个函数是"解析Paper"函数,用于解析单篇论文文件。其中用到了一些工具函数和库,如update_ui、CatchException、report_exception、write_results_to_file等。 +这个程序文件是一个Python模块,文件名为crazy_functions\Paper_Abstract_Writer.py。该模块包含了两个函数,其中主要函数是"Paper_Abstract_Writer"函数,其实现了解析给定文件夹中的tex文件,对其中每个文件的内容进行摘要生成,并根据各论文片段的摘要,最终生成全文摘要。第二个函数是"解析Paper"函数,用于解析单篇论文文件。其中用到了一些工具函数和库,如update_ui、CatchException、report_exception、write_results_to_file等。 -## [32/48] 请对下面的程序文件做一个概述: crazy_functions\谷歌检索小助手.py +## [32/48] 请对下面的程序文件做一个概述: crazy_functions\Google_Scholar_Assistant_Legacy.py -该文件是一个Python模块,文件名为“谷歌检索小助手.py”。该模块包含两个函数,一个是“get_meta_information()”,用于从提供的网址中分析出所有相关的学术文献的元数据信息;另一个是“谷歌检索小助手()”,是主函数,用于分析用户提供的谷歌学术搜索页面中出现的文章,并提取相关信息。其中,“谷歌检索小助手()”函数依赖于“get_meta_information()”函数,并调用了其他一些Python模块,如“arxiv”、“math”、“bs4”等。 +该文件是一个Python模块,文件名为“Google_Scholar_Assistant_Legacy.py”。该模块包含两个函数,一个是“get_meta_information()”,用于从提供的网址中分析出所有相关的学术文献的元数据信息;另一个是“Google_Scholar_Assistant_Legacy()”,是主函数,用于分析用户提供的谷歌学术搜索页面中出现的文章,并提取相关信息。其中,“Google_Scholar_Assistant_Legacy()”函数依赖于“get_meta_information()”函数,并调用了其他一些Python模块,如“arxiv”、“math”、“bs4”等。 ## [33/48] 请对下面的程序文件做一个概述: crazy_functions\高级功能函数模板.py @@ -307,7 +307,7 @@ GetGLMHandle 类继承自Process类(多进程),主要功能是启动一个 这个文件是用于对llm模型进行单元测试的Python程序。程序导入一个名为"request_llms.bridge_newbingfree"的模块,然后三次使用该模块中的predict_no_ui_long_connection()函数进行预测,并输出结果。此外,还有一些注释掉的代码段,这些代码段也是关于模型预测的。 ## 用一张Markdown表格简要描述以下文件的功能: -check_proxy.py, colorful.py, config.py, config_private.py, core_functional.py, crazy_functional.py, main.py, multi_language.py, theme.py, toolbox.py, crazy_functions\crazy_functions_test.py, crazy_functions\crazy_utils.py, crazy_functions\Latex全文润色.py, crazy_functions\Latex全文翻译.py, crazy_functions\__init__.py, crazy_functions\下载arxiv论文翻译摘要.py。根据以上分析,用一句话概括程序的整体功能。 +check_proxy.py, colorful.py, config.py, config_private.py, core_functional.py, crazy_functional.py, main.py, multi_language.py, theme.py, toolbox.py, crazy_functions\crazy_functions_test.py, crazy_functions\crazy_utils.py, crazy_functions\Latex全文润色.py, crazy_functions\Latex全文翻译.py, crazy_functions\__init__.py, crazy_functions\Arxiv_Downloader.py。根据以上分析,用一句话概括程序的整体功能。 | 文件名 | 功能描述 | | ------ | ------ | @@ -326,40 +326,40 @@ check_proxy.py, colorful.py, config.py, config_private.py, core_functional.py, c | crazy_functions\Latex全文润色.py | 对整个 Latex 项目进行润色和纠错 | | crazy_functions\Latex全文翻译.py | 对整个 Latex 项目进行翻译 | | crazy_functions\__init__.py | 模块初始化文件,标识 `crazy_functions` 是一个包 | -| crazy_functions\下载arxiv论文翻译摘要.py | 下载 `arxiv` 论文的 PDF 文件,并提取摘要和翻译 | +| crazy_functions\Arxiv_Downloader.py | 下载 `arxiv` 论文的 PDF 文件,并提取摘要和翻译 | 这些程序源文件提供了基础的文本和语言处理功能、工具函数和高级插件,使 Chatbot 能够处理各种复杂的学术文本问题,包括润色、翻译、搜索、下载、解析等。 ## 用一张Markdown表格简要描述以下文件的功能: -crazy_functions\代码重写为全英文_多线程.py, crazy_functions\图片生成.py, crazy_functions\Conversation_To_File.py, crazy_functions\总结word文档.py, crazy_functions\总结音视频.py, crazy_functions\Markdown_Translate.py, crazy_functions\批量总结PDF文档.py, crazy_functions\批量总结PDF文档pdfminer.py, crazy_functions\PDF_Translate.py, crazy_functions\理解PDF文档内容.py, crazy_functions\生成函数注释.py, crazy_functions\联网的ChatGPT.py, crazy_functions\解析JupyterNotebook.py, crazy_functions\解析项目源代码.py, crazy_functions\询问多个大语言模型.py, crazy_functions\读文章写摘要.py。根据以上分析,用一句话概括程序的整体功能。 +crazy_functions\代码重写为全英文_多线程.py, crazy_functions\图片生成.py, crazy_functions\Conversation_To_File.py, crazy_functions\Word_Summary.py, crazy_functions\Audio_Summary.py, crazy_functions\Markdown_Translate.py, crazy_functions\PDF_Summary.py, crazy_functions\PDF_Summarypdfminer.py, crazy_functions\PDF_Translate.py, crazy_functions\PDF_QA.py, crazy_functions\Program_Comment_Gen.py, crazy_functions\Internet_GPT_Legacy.py, crazy_functions\SourceCode_Analyse_JupyterNotebook.py, crazy_functions\解析项目源代码.py, crazy_functions\Multi_LLM_Query.py, crazy_functions\Paper_Abstract_Writer.py。根据以上分析,用一句话概括程序的整体功能。 | 文件名 | 功能简述 | | --- | --- | | 代码重写为全英文_多线程.py | 将Python源代码文件中的中文内容转化为英文 | | 图片生成.py | 根据激励文本使用GPT模型生成相应的图像 | | Conversation_To_File.py | 将每次对话记录写入Markdown格式的文件中 | -| 总结word文档.py | 对输入的word文档进行摘要生成 | -| 总结音视频.py | 对输入的音视频文件进行摘要生成 | +| Word_Summary.py | 对输入的word文档进行摘要生成 | +| Audio_Summary.py | 对输入的音视频文件进行摘要生成 | | Markdown_Translate.py | 将指定目录下的Markdown文件进行中英文翻译 | -| 批量总结PDF文档.py | 对PDF文件进行切割和摘要生成 | -| 批量总结PDF文档pdfminer.py | 对PDF文件进行文本内容的提取和摘要生成 | +| PDF_Summary.py | 对PDF文件进行切割和摘要生成 | +| PDF_Summarypdfminer.py | 对PDF文件进行文本内容的提取和摘要生成 | | PDF_Translate.py | 将指定目录下的PDF文件进行中英文翻译 | -| 理解PDF文档内容.py | 对PDF文件进行摘要生成和问题解答 | -| 生成函数注释.py | 自动生成Python函数的注释 | -| 联网的ChatGPT.py | 使用网络爬虫和ChatGPT模型进行聊天回答 | -| 解析JupyterNotebook.py | 对Jupyter Notebook进行代码解析 | +| PDF_QA.py | 对PDF文件进行摘要生成和问题解答 | +| Program_Comment_Gen.py | 自动生成Python函数的注释 | +| Internet_GPT_Legacy.py | 使用网络爬虫和ChatGPT模型进行聊天回答 | +| SourceCode_Analyse_JupyterNotebook.py | 对Jupyter Notebook进行代码解析 | | 解析项目源代码.py | 对指定编程语言的源代码进行解析 | -| 询问多个大语言模型.py | 使用多个大语言模型对输入进行处理和回复 | -| 读文章写摘要.py | 对论文进行解析和全文摘要生成 | +| Multi_LLM_Query.py | 使用多个大语言模型对输入进行处理和回复 | +| Paper_Abstract_Writer.py | 对论文进行解析和全文摘要生成 | 概括程序的整体功能:提供了一系列处理文本、文件和代码的功能,使用了各类语言模型、多线程、网络请求和数据解析技术来提高效率和精度。 ## 用一张Markdown表格简要描述以下文件的功能: -crazy_functions\谷歌检索小助手.py, crazy_functions\高级功能函数模板.py, request_llms\bridge_all.py, request_llms\bridge_chatglm.py, request_llms\bridge_chatgpt.py, request_llms\bridge_jittorllms_llama.py, request_llms\bridge_jittorllms_pangualpha.py, request_llms\bridge_jittorllms_rwkv.py, request_llms\bridge_moss.py, request_llms\bridge_newbing.py, request_llms\bridge_newbingfree.py, request_llms\bridge_stackclaude.py, request_llms\bridge_tgui.py, request_llms\edge_gpt.py, request_llms\edge_gpt_free.py, request_llms\test_llms.py。根据以上分析,用一句话概括程序的整体功能。 +crazy_functions\Google_Scholar_Assistant_Legacy.py, crazy_functions\高级功能函数模板.py, request_llms\bridge_all.py, request_llms\bridge_chatglm.py, request_llms\bridge_chatgpt.py, request_llms\bridge_jittorllms_llama.py, request_llms\bridge_jittorllms_pangualpha.py, request_llms\bridge_jittorllms_rwkv.py, request_llms\bridge_moss.py, request_llms\bridge_newbing.py, request_llms\bridge_newbingfree.py, request_llms\bridge_stackclaude.py, request_llms\bridge_tgui.py, request_llms\edge_gpt.py, request_llms\edge_gpt_free.py, request_llms\test_llms.py。根据以上分析,用一句话概括程序的整体功能。 | 文件名 | 功能描述 | | --- | --- | -| crazy_functions\谷歌检索小助手.py | 提供谷歌学术搜索页面中相关文章的元数据信息。 | +| crazy_functions\Google_Scholar_Assistant_Legacy.py | 提供谷歌学术搜索页面中相关文章的元数据信息。 | | crazy_functions\高级功能函数模板.py | 使用Unsplash API发送相关图片以回复用户的输入。 | | request_llms\bridge_all.py | 基于不同LLM模型进行对话。 | | request_llms\bridge_chatglm.py | 使用ChatGLM模型生成回复,支持单线程和多线程方式。 | diff --git a/tests/test_academic_conversation.py b/tests/test_academic_conversation.py index 9656a5b5..7fc278c9 100644 --- a/tests/test_academic_conversation.py +++ b/tests/test_academic_conversation.py @@ -12,7 +12,7 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.Internet_GPT->连接网络回答问题', main_input="谁是应急食品?") - # plugin_test(plugin='crazy_functions.函数动态生成->函数动态生成', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) + # plugin_test(plugin='crazy_functions.Dynamic_Function_Generate->Dynamic_Function_Generate', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) # plugin_test(plugin='crazy_functions.Latex_Function->Latex翻译中文并重新编译PDF', main_input="2307.07522") @@ -23,13 +23,13 @@ if __name__ == "__main__": # main_input="G:/SEAFILE_LOCAL/50503047/我的资料库/学位/paperlatex/aaai/Fu_8368_with_appendix", # ) - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='修改api-key为sk-jhoejriotherjep') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='修改api-key为sk-jhoejriotherjep') - # plugin_test(plugin='crazy_functions.批量翻译PDF文档_NOUGAT->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') + # plugin_test(plugin='crazy_functions.PDF_Translate_Nougat->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') - # plugin_test(plugin='crazy_functions.命令行助手->命令行助手', main_input='查看当前的docker容器列表') + # plugin_test(plugin='crazy_functions.Commandline_Assistant->Commandline_Assistant', main_input='查看当前的docker容器列表') # plugin_test(plugin='crazy_functions.SourceCode_Analyse->解析一个Python项目', main_input="crazy_functions/test_project/python/dqn") @@ -41,15 +41,15 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.PDF_Translate->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.谷歌检索小助手->谷歌检索小助手', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") + # plugin_test(plugin='crazy_functions.Google_Scholar_Assistant_Legacy->Google_Scholar_Assistant_Legacy', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") - # plugin_test(plugin='crazy_functions.总结word文档->总结word文档', main_input="crazy_functions/test_project/pdf_and_word") + # plugin_test(plugin='crazy_functions.Word_Summary->Word_Summary', main_input="crazy_functions/test_project/pdf_and_word") - # plugin_test(plugin='crazy_functions.下载arxiv论文翻译摘要->下载arxiv论文并翻译摘要', main_input="1812.10695") + # plugin_test(plugin='crazy_functions.Arxiv_Downloader->下载arxiv论文并翻译摘要', main_input="1812.10695") - # plugin_test(plugin='crazy_functions.解析JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") + # plugin_test(plugin='crazy_functions.SourceCode_Analyse_JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") - # plugin_test(plugin='crazy_functions.数学动画生成manim->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") + # plugin_test(plugin='crazy_functions.Math_Animation_Gen->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") # for lang in ["English", "French", "Japanese", "Korean", "Russian", "Italian", "German", "Portuguese", "Arabic"]: # plugin_test(plugin='crazy_functions.Markdown_Translate->Markdown翻译指定语言', main_input="README.md", advanced_arg={"advanced_arg": lang}) diff --git a/tests/test_anim_gen.py b/tests/test_anim_gen.py index 0084f841..e256d095 100644 --- a/tests/test_anim_gen.py +++ b/tests/test_anim_gen.py @@ -9,4 +9,4 @@ import os, sys if __name__ == "__main__": from test_utils import plugin_test - plugin_test(plugin='crazy_functions.数学动画生成manim->动画生成', main_input="A point moving along function culve y=sin(x), starting from x=0 and stop at x=4*\pi.") + plugin_test(plugin='crazy_functions.Math_Animation_Gen->动画生成', main_input="A point moving along function culve y=sin(x), starting from x=0 and stop at x=4*\pi.") diff --git a/tests/test_media.py b/tests/test_media.py index 1b89fdbe..ccd7eb2d 100644 --- a/tests/test_media.py +++ b/tests/test_media.py @@ -13,7 +13,7 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.Internet_GPT->连接网络回答问题', main_input="谁是应急食品?") - # plugin_test(plugin='crazy_functions.函数动态生成->函数动态生成', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) + # plugin_test(plugin='crazy_functions.Dynamic_Function_Generate->Dynamic_Function_Generate', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) # plugin_test(plugin='crazy_functions.Latex_Function->Latex翻译中文并重新编译PDF', main_input="2307.07522") @@ -24,13 +24,13 @@ if __name__ == "__main__": # main_input="G:/SEAFILE_LOCAL/50503047/我的资料库/学位/paperlatex/aaai/Fu_8368_with_appendix", # ) - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='修改api-key为sk-jhoejriotherjep') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='修改api-key为sk-jhoejriotherjep') - # plugin_test(plugin='crazy_functions.批量翻译PDF文档_NOUGAT->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') + # plugin_test(plugin='crazy_functions.PDF_Translate_Nougat->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') - # plugin_test(plugin='crazy_functions.命令行助手->命令行助手', main_input='查看当前的docker容器列表') + # plugin_test(plugin='crazy_functions.Commandline_Assistant->Commandline_Assistant', main_input='查看当前的docker容器列表') # plugin_test(plugin='crazy_functions.SourceCode_Analyse->解析一个Python项目', main_input="crazy_functions/test_project/python/dqn") @@ -42,15 +42,15 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.PDF_Translate->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.谷歌检索小助手->谷歌检索小助手', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") + # plugin_test(plugin='crazy_functions.Google_Scholar_Assistant_Legacy->Google_Scholar_Assistant_Legacy', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") - # plugin_test(plugin='crazy_functions.总结word文档->总结word文档', main_input="crazy_functions/test_project/pdf_and_word") + # plugin_test(plugin='crazy_functions.Word_Summary->Word_Summary', main_input="crazy_functions/test_project/pdf_and_word") - # plugin_test(plugin='crazy_functions.下载arxiv论文翻译摘要->下载arxiv论文并翻译摘要', main_input="1812.10695") + # plugin_test(plugin='crazy_functions.Arxiv_Downloader->下载arxiv论文并翻译摘要', main_input="1812.10695") - # plugin_test(plugin='crazy_functions.解析JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") + # plugin_test(plugin='crazy_functions.SourceCode_Analyse_JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") - # plugin_test(plugin='crazy_functions.数学动画生成manim->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") + # plugin_test(plugin='crazy_functions.Math_Animation_Gen->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") # for lang in ["English", "French", "Japanese", "Korean", "Russian", "Italian", "German", "Portuguese", "Arabic"]: # plugin_test(plugin='crazy_functions.Markdown_Translate->Markdown翻译指定语言', main_input="README.md", advanced_arg={"advanced_arg": lang}) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 6faa4579..6a078901 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -13,7 +13,7 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.Internet_GPT->连接网络回答问题', main_input="谁是应急食品?") - # plugin_test(plugin='crazy_functions.函数动态生成->函数动态生成', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) + # plugin_test(plugin='crazy_functions.Dynamic_Function_Generate->Dynamic_Function_Generate', main_input='交换图像的蓝色通道和红色通道', advanced_arg={"file_path_arg": "./build/ants.jpg"}) # plugin_test(plugin='crazy_functions.Latex_Function->Latex翻译中文并重新编译PDF', main_input="2307.07522") @@ -24,13 +24,13 @@ if __name__ == "__main__": # main_input="G:/SEAFILE_LOCAL/50503047/我的资料库/学位/paperlatex/aaai/Fu_8368_with_appendix", # ) - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='修改api-key为sk-jhoejriotherjep') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='修改api-key为sk-jhoejriotherjep') - # plugin_test(plugin='crazy_functions.批量翻译PDF文档_NOUGAT->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') + # plugin_test(plugin='crazy_functions.PDF_Translate_Nougat->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.虚空终端->虚空终端', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') + # plugin_test(plugin='crazy_functions.Void_Terminal->Void_Terminal', main_input='调用插件,对C:/Users/fuqingxu/Desktop/旧文件/gpt/chatgpt_academic/crazy_functions/latex_fns中的python文件进行解析') - # plugin_test(plugin='crazy_functions.命令行助手->命令行助手', main_input='查看当前的docker容器列表') + # plugin_test(plugin='crazy_functions.Commandline_Assistant->Commandline_Assistant', main_input='查看当前的docker容器列表') # plugin_test(plugin='crazy_functions.SourceCode_Analyse->解析一个Python项目', main_input="crazy_functions/test_project/python/dqn") @@ -42,15 +42,15 @@ if __name__ == "__main__": # plugin_test(plugin='crazy_functions.PDF_Translate->批量翻译PDF文档', main_input='crazy_functions/test_project/pdf_and_word/aaai.pdf') - # plugin_test(plugin='crazy_functions.谷歌检索小助手->谷歌检索小助手', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") + # plugin_test(plugin='crazy_functions.Google_Scholar_Assistant_Legacy->Google_Scholar_Assistant_Legacy', main_input="https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=auto+reinforcement+learning&btnG=") - # plugin_test(plugin='crazy_functions.总结word文档->总结word文档', main_input="crazy_functions/test_project/pdf_and_word") + # plugin_test(plugin='crazy_functions.Word_Summary->Word_Summary', main_input="crazy_functions/test_project/pdf_and_word") - # plugin_test(plugin='crazy_functions.下载arxiv论文翻译摘要->下载arxiv论文并翻译摘要', main_input="1812.10695") + # plugin_test(plugin='crazy_functions.Arxiv_Downloader->下载arxiv论文并翻译摘要', main_input="1812.10695") - # plugin_test(plugin='crazy_functions.解析JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") + # plugin_test(plugin='crazy_functions.SourceCode_Analyse_JupyterNotebook->解析ipynb文件', main_input="crazy_functions/test_samples") - # plugin_test(plugin='crazy_functions.数学动画生成manim->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") + # plugin_test(plugin='crazy_functions.Math_Animation_Gen->动画生成', main_input="A ball split into 2, and then split into 4, and finally split into 8.") # for lang in ["English", "French", "Japanese", "Korean", "Russian", "Italian", "German", "Portuguese", "Arabic"]: # plugin_test(plugin='crazy_functions.Markdown_Translate->Markdown翻译指定语言', main_input="README.md", advanced_arg={"advanced_arg": lang}) diff --git a/tests/test_vector_plugins.py b/tests/test_vector_plugins.py index e42c40d7..63609ed7 100644 --- a/tests/test_vector_plugins.py +++ b/tests/test_vector_plugins.py @@ -18,11 +18,11 @@ validate_path() # 返回项目根路径 if __name__ == "__main__": from tests.test_utils import plugin_test - plugin_test(plugin="crazy_functions.知识库问答->知识库文件注入", main_input="./README.md") + plugin_test(plugin="crazy_functions.Vectorstore_QA->知识库文件注入", main_input="./README.md") plugin_test( - plugin="crazy_functions.知识库问答->读取知识库作答", + plugin="crazy_functions.Vectorstore_QA->读取知识库作答", main_input="What is the installation method?", ) - plugin_test(plugin="crazy_functions.知识库问答->读取知识库作答", main_input="远程云服务器部署?") + plugin_test(plugin="crazy_functions.Vectorstore_QA->读取知识库作答", main_input="远程云服务器部署?")