From 0ff838443ea5d5c3fbab70261c042c9fb0c2d9af Mon Sep 17 00:00:00 2001 From: mrhblfx Date: Thu, 20 Apr 2023 21:44:35 +0800 Subject: [PATCH] fix a bug --- crazy_functions/解析项目源代码.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crazy_functions/解析项目源代码.py b/crazy_functions/解析项目源代码.py index 9218fa5..64af5ec 100644 --- a/crazy_functions/解析项目源代码.py +++ b/crazy_functions/解析项目源代码.py @@ -296,8 +296,9 @@ def 解析任意code项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, sys extract_folder_path = maybe_dir[0].replace('\\', '/') if len(maybe_dir) != 0 else "" # 按输入的匹配模式寻找上传的非压缩文件和已解压的文件 file_manifest = [f for f in glob.glob(f'{project_folder}/**') if os.path.isfile(f) and not re.search(pattern_except, f)] + \ - [f for _ in pattern_include for f in glob.glob(f'{extract_folder_path}/**/{_}', recursive=True) if \ - "" != extract_folder_path and os.path.isfile(f) and not re.search(pattern_except, f)] + [f for _ in pattern_include for f in glob.glob(f'{extract_folder_path}/**/{_}', recursive=True) if "" != extract_folder_path and \ + os.path.isfile(f) and (not re.search(pattern_except, f) or _.endswith('.' + re.search(pattern_except, f).group().split('.')[-1]))] + if len(file_manifest) == 0: report_execption(chatbot, history, a = f"解析项目: {txt}", b = f"找不到任何文件: {txt}") yield from update_ui(chatbot=chatbot, history=history) # 刷新界面