Spaces:
Build error
Build error
Commit
·
2037c5b
1
Parent(s):
5f76274
Delete functional_crazy.py
Browse files- functional_crazy.py +0 -68
functional_crazy.py
DELETED
@@ -1,68 +0,0 @@
|
|
1 |
-
|
2 |
-
def get_crazy_functionals():
|
3 |
-
from crazy_functions.读文章写摘要 import 读文章写摘要
|
4 |
-
from crazy_functions.生成函数注释 import 批量生成函数注释
|
5 |
-
from crazy_functions.解析项目源代码 import 解析项目本身
|
6 |
-
from crazy_functions.解析项目源代码 import 解析一个Python项目
|
7 |
-
from crazy_functions.解析项目源代码 import 解析一个C项目的头文件
|
8 |
-
from crazy_functions.解析项目源代码 import 解析一个C项目
|
9 |
-
from crazy_functions.高级功能函数模板 import 高阶功能模板函数
|
10 |
-
|
11 |
-
return {
|
12 |
-
"[实验] 请解析并解构此项目本身": {
|
13 |
-
"Function": 解析项目本身
|
14 |
-
},
|
15 |
-
"[实验] 解析整个py项目(配合input输入框)": {
|
16 |
-
"Color": "stop", # 按钮颜色
|
17 |
-
"Function": 解析一个Python项目
|
18 |
-
},
|
19 |
-
"[实验] 解析整个C++项目头文件(配合input输入框)": {
|
20 |
-
"Color": "stop", # 按钮颜色
|
21 |
-
"Function": 解析一个C项目的头文件
|
22 |
-
},
|
23 |
-
"[实验] 解析整个C++项目(配合input输入框)": {
|
24 |
-
"Color": "stop", # 按钮颜色
|
25 |
-
"Function": 解析一个C项目
|
26 |
-
},
|
27 |
-
"[实验] 读tex论文写摘要(配合input输入框)": {
|
28 |
-
"Color": "stop", # 按钮颜色
|
29 |
-
"Function": 读文章写摘要
|
30 |
-
},
|
31 |
-
"[实验] 批量生成函数注释(配合input输入框)": {
|
32 |
-
"Color": "stop", # 按钮颜色
|
33 |
-
"Function": 批量生成函数注释
|
34 |
-
},
|
35 |
-
"[实验] 实验功能函数模板": {
|
36 |
-
"Color": "stop", # 按钮颜色
|
37 |
-
"Function": 高阶功能模板函数
|
38 |
-
},
|
39 |
-
}
|
40 |
-
|
41 |
-
def on_file_uploaded(files, chatbot, txt):
|
42 |
-
if len(files) == 0: return chatbot, txt
|
43 |
-
import shutil, os, time, glob
|
44 |
-
from toolbox import extract_archive
|
45 |
-
try: shutil.rmtree('./private_upload/')
|
46 |
-
except: pass
|
47 |
-
time_tag = time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
|
48 |
-
os.makedirs(f'private_upload/{time_tag}', exist_ok=True)
|
49 |
-
for file in files:
|
50 |
-
file_origin_name = os.path.basename(file.orig_name)
|
51 |
-
shutil.copy(file.name, f'private_upload/{time_tag}/{file_origin_name}')
|
52 |
-
extract_archive(f'private_upload/{time_tag}/{file_origin_name}',
|
53 |
-
dest_dir=f'private_upload/{time_tag}/{file_origin_name}.extract')
|
54 |
-
moved_files = [fp for fp in glob.glob('private_upload/**/*', recursive=True)]
|
55 |
-
txt = f'private_upload/{time_tag}'
|
56 |
-
moved_files_str = '\t\n\n'.join(moved_files)
|
57 |
-
chatbot.append(['我上传了文件,请查收',
|
58 |
-
f'[Local Message] 收到以下文件: \n\n{moved_files_str}\n\n调用路径参数已自动修正到: \n\n{txt}\n\n现在您可以直接选择任意实现性功能'])
|
59 |
-
return chatbot, txt
|
60 |
-
|
61 |
-
def on_report_generated(files, chatbot):
|
62 |
-
from toolbox import find_recent_files
|
63 |
-
report_files = find_recent_files('gpt_log')
|
64 |
-
if len(report_files) == 0: return report_files, chatbot
|
65 |
-
# files.extend(report_files)
|
66 |
-
chatbot.append(['汇总报告如何远程获取?', '汇总报告已经添加到右侧文件上传区,请查收。'])
|
67 |
-
return report_files, chatbot
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|