Spaces:
Sleeping
Sleeping
bug fix
Browse files
crazy_functions/代码重写为全英文_多线程.py
CHANGED
|
@@ -9,10 +9,13 @@ def 全项目切换英文(txt, top_p, temperature, chatbot, history, sys_prompt,
|
|
| 9 |
history = [] # 清空历史,以免输入溢出
|
| 10 |
# 集合文件
|
| 11 |
import time, glob, os
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
i_say_show_user_buffer = []
|
| 14 |
|
| 15 |
-
#
|
| 16 |
for index, fp in enumerate(file_manifest):
|
| 17 |
# if 'test_project' in fp: continue
|
| 18 |
with open(fp, 'r', encoding='utf-8') as f:
|
|
@@ -58,8 +61,7 @@ def 全项目切换英文(txt, top_p, temperature, chatbot, history, sys_prompt,
|
|
| 58 |
fp = file_manifest[index]
|
| 59 |
gpt_say = mutable_return[index]
|
| 60 |
i_say_show_user = i_say_show_user_buffer[index]
|
| 61 |
-
|
| 62 |
-
os.makedirs('gpt_log/generated_english_version/crazy_functions', exist_ok=True)
|
| 63 |
where_to_relocate = f'gpt_log/generated_english_version/{fp}'
|
| 64 |
with open(where_to_relocate, 'w+', encoding='utf-8') as f: f.write(gpt_say.lstrip('```').rstrip('```'))
|
| 65 |
chatbot.append((i_say_show_user, f'[Local Message] 已完成{os.path.abspath(fp)}的转化,\n\n存入{os.path.abspath(where_to_relocate)}'))
|
|
|
|
| 9 |
history = [] # 清空历史,以免输入溢出
|
| 10 |
# 集合文件
|
| 11 |
import time, glob, os
|
| 12 |
+
os.makedirs('gpt_log/generated_english_version', exist_ok=True)
|
| 13 |
+
os.makedirs('gpt_log/generated_english_version/crazy_functions', exist_ok=True)
|
| 14 |
+
file_manifest = [f for f in glob.glob('./*.py') if ('test_project' not in f) and ('gpt_log' not in f)] + \
|
| 15 |
+
[f for f in glob.glob('./crazy_functions/*.py') if ('test_project' not in f) and ('gpt_log' not in f)]
|
| 16 |
i_say_show_user_buffer = []
|
| 17 |
|
| 18 |
+
# 随便显示点什么防止卡顿的感觉
|
| 19 |
for index, fp in enumerate(file_manifest):
|
| 20 |
# if 'test_project' in fp: continue
|
| 21 |
with open(fp, 'r', encoding='utf-8') as f:
|
|
|
|
| 61 |
fp = file_manifest[index]
|
| 62 |
gpt_say = mutable_return[index]
|
| 63 |
i_say_show_user = i_say_show_user_buffer[index]
|
| 64 |
+
|
|
|
|
| 65 |
where_to_relocate = f'gpt_log/generated_english_version/{fp}'
|
| 66 |
with open(where_to_relocate, 'w+', encoding='utf-8') as f: f.write(gpt_say.lstrip('```').rstrip('```'))
|
| 67 |
chatbot.append((i_say_show_user, f'[Local Message] 已完成{os.path.abspath(fp)}的转化,\n\n存入{os.path.abspath(where_to_relocate)}'))
|