3v324v23 commited on
Commit
e9a6efe
1 Parent(s): 89a75e2

修复非压缩文件上传的读取问题

Browse files
crazy_functions/解析项目源代码.py CHANGED
@@ -293,7 +293,7 @@ def 解析任意code项目(txt, llm_kwargs, plugin_kwargs, chatbot, history, sys
293
  return
294
  # 若上传压缩文件, 先寻找到解压的文件夹路径, 从而避免解析压缩文件
295
  maybe_dir = [f for f in glob.glob(f'{project_folder}/*') if os.path.isdir(f)]
296
- if maybe_dir[0].endswith('.extract'):
297
  extract_folder_path = maybe_dir[0]
298
  else:
299
  extract_folder_path = project_folder
 
293
  return
294
  # 若上传压缩文件, 先寻找到解压的文件夹路径, 从而避免解析压缩文件
295
  maybe_dir = [f for f in glob.glob(f'{project_folder}/*') if os.path.isdir(f)]
296
+ if len(maybe_dir)>0 and maybe_dir[0].endswith('.extract'):
297
  extract_folder_path = maybe_dir[0]
298
  else:
299
  extract_folder_path = project_folder