Spaces:
Runtime error
Runtime error
renew all
Browse files- crazy_functions/Latex全文润色.py +1 -1
- crazy_functions/Latex全文翻译.py +1 -1
- crazy_functions/下载arxiv论文翻译摘要.py +1 -2
- crazy_functions/总结word文档.py +19 -6
- crazy_functions/批量总结PDF文档.py +19 -3
- crazy_functions/批量总结PDF文档pdfminer.py +18 -5
- crazy_functions/理解PDF文档内容.py +5 -4
- crazy_functions/生成函数注释.py +5 -4
- crazy_functions/解析项目源代码.py +2 -2
- crazy_functions/读文章写摘要.py +4 -3
crazy_functions/Latex全文润色.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
class PaperFileGroup():
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
class PaperFileGroup():
|
crazy_functions/Latex全文翻译.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
class PaperFileGroup():
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
class PaperFileGroup():
|
crazy_functions/下载arxiv论文翻译摘要.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file,
|
| 3 |
import re, requests, unicodedata, os
|
| 4 |
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 5 |
def download_arxiv_(url_pdf):
|
|
@@ -181,7 +181,6 @@ def 下载arxiv论文并翻译摘要(txt, llm_kwargs, plugin_kwargs, chatbot, hi
|
|
| 181 |
sys_prompt="Your job is to collect information from materials and translate to Chinese。",
|
| 182 |
)
|
| 183 |
|
| 184 |
-
# gpt_say = yield from predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, llm_kwargs, history=[]) # 带超时倒计时
|
| 185 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 186 |
history.append(i_say_show_user); history.append(gpt_say)
|
| 187 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file, get_conf
|
| 3 |
import re, requests, unicodedata, os
|
| 4 |
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 5 |
def download_arxiv_(url_pdf):
|
|
|
|
| 181 |
sys_prompt="Your job is to collect information from materials and translate to Chinese。",
|
| 182 |
)
|
| 183 |
|
|
|
|
| 184 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 185 |
history.append(i_say_show_user); history.append(gpt_say)
|
| 186 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
crazy_functions/总结word文档.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
|
|
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
|
|
@@ -40,9 +41,16 @@ def 解析docx(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot
|
|
| 40 |
if not fast_debug:
|
| 41 |
msg = '正常'
|
| 42 |
# ** gpt request **
|
| 43 |
-
gpt_say = yield from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 45 |
-
history.append(i_say_show_user)
|
| 46 |
history.append(gpt_say)
|
| 47 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
| 48 |
if not fast_debug: time.sleep(2)
|
|
@@ -65,9 +73,14 @@ def 解析docx(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot
|
|
| 65 |
if not fast_debug:
|
| 66 |
msg = '正常'
|
| 67 |
# ** gpt request **
|
| 68 |
-
gpt_say = yield from
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
chatbot[-1] = (i_say, gpt_say)
|
| 72 |
history.append(i_say)
|
| 73 |
history.append(gpt_say)
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 4 |
fast_debug = False
|
| 5 |
|
| 6 |
|
|
|
|
| 41 |
if not fast_debug:
|
| 42 |
msg = '正常'
|
| 43 |
# ** gpt request **
|
| 44 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 45 |
+
inputs=i_say,
|
| 46 |
+
inputs_show_user=i_say_show_user,
|
| 47 |
+
llm_kwargs=llm_kwargs,
|
| 48 |
+
chatbot=chatbot,
|
| 49 |
+
history=[],
|
| 50 |
+
sys_prompt="总结文章。"
|
| 51 |
+
) # 带超时倒计时
|
| 52 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 53 |
+
history.append(i_say_show_user)
|
| 54 |
history.append(gpt_say)
|
| 55 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
| 56 |
if not fast_debug: time.sleep(2)
|
|
|
|
| 73 |
if not fast_debug:
|
| 74 |
msg = '正常'
|
| 75 |
# ** gpt request **
|
| 76 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 77 |
+
inputs=i_say,
|
| 78 |
+
inputs_show_user=i_say,
|
| 79 |
+
llm_kwargs=llm_kwargs,
|
| 80 |
+
chatbot=chatbot,
|
| 81 |
+
history=history,
|
| 82 |
+
sys_prompt="总结文章。"
|
| 83 |
+
) # 带超时倒计时
|
| 84 |
chatbot[-1] = (i_say, gpt_say)
|
| 85 |
history.append(i_say)
|
| 86 |
history.append(gpt_say)
|
crazy_functions/批量总结PDF文档.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
import re
|
| 4 |
import unicodedata
|
| 5 |
fast_debug = False
|
|
|
|
| 6 |
|
| 7 |
def is_paragraph_break(match):
|
| 8 |
"""
|
|
@@ -77,7 +78,15 @@ def 解析PDF(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot,
|
|
| 77 |
if not fast_debug:
|
| 78 |
msg = '正常'
|
| 79 |
# ** gpt request **
|
| 80 |
-
gpt_say = yield from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 83 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
@@ -92,7 +101,14 @@ def 解析PDF(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot,
|
|
| 92 |
if not fast_debug:
|
| 93 |
msg = '正常'
|
| 94 |
# ** gpt request **
|
| 95 |
-
gpt_say = yield from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
chatbot[-1] = (i_say, gpt_say)
|
| 98 |
history.append(i_say); history.append(gpt_say)
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
import re
|
| 4 |
import unicodedata
|
| 5 |
fast_debug = False
|
| 6 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 7 |
|
| 8 |
def is_paragraph_break(match):
|
| 9 |
"""
|
|
|
|
| 78 |
if not fast_debug:
|
| 79 |
msg = '正常'
|
| 80 |
# ** gpt request **
|
| 81 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 82 |
+
inputs=i_say,
|
| 83 |
+
inputs_show_user=i_say_show_user,
|
| 84 |
+
llm_kwargs=llm_kwargs,
|
| 85 |
+
chatbot=chatbot,
|
| 86 |
+
history=[],
|
| 87 |
+
sys_prompt="总结文章。"
|
| 88 |
+
) # 带超时倒计时
|
| 89 |
+
|
| 90 |
|
| 91 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 92 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
|
|
| 101 |
if not fast_debug:
|
| 102 |
msg = '正常'
|
| 103 |
# ** gpt request **
|
| 104 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 105 |
+
inputs=i_say,
|
| 106 |
+
inputs_show_user=i_say,
|
| 107 |
+
llm_kwargs=llm_kwargs,
|
| 108 |
+
chatbot=chatbot,
|
| 109 |
+
history=history,
|
| 110 |
+
sys_prompt="总结文章。"
|
| 111 |
+
) # 带超时倒计时
|
| 112 |
|
| 113 |
chatbot[-1] = (i_say, gpt_say)
|
| 114 |
history.append(i_say); history.append(gpt_say)
|
crazy_functions/批量总结PDF文档pdfminer.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
|
|
|
| 3 |
|
| 4 |
fast_debug = False
|
| 5 |
|
|
@@ -82,8 +83,14 @@ def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbo
|
|
| 82 |
if not fast_debug:
|
| 83 |
msg = '正常'
|
| 84 |
# ** gpt request **
|
| 85 |
-
gpt_say = yield from
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 88 |
history.append(i_say_show_user); history.append(gpt_say)
|
| 89 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
|
@@ -97,8 +104,14 @@ def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbo
|
|
| 97 |
if not fast_debug:
|
| 98 |
msg = '正常'
|
| 99 |
# ** gpt request **
|
| 100 |
-
gpt_say = yield from
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
chatbot[-1] = (i_say, gpt_say)
|
| 103 |
history.append(i_say); history.append(gpt_say)
|
| 104 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 4 |
|
| 5 |
fast_debug = False
|
| 6 |
|
|
|
|
| 83 |
if not fast_debug:
|
| 84 |
msg = '正常'
|
| 85 |
# ** gpt request **
|
| 86 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 87 |
+
inputs=i_say,
|
| 88 |
+
inputs_show_user=i_say_show_user,
|
| 89 |
+
llm_kwargs=llm_kwargs,
|
| 90 |
+
chatbot=chatbot,
|
| 91 |
+
history=[],
|
| 92 |
+
sys_prompt="总结文章。"
|
| 93 |
+
) # 带超时倒计时
|
| 94 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 95 |
history.append(i_say_show_user); history.append(gpt_say)
|
| 96 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
|
|
|
| 104 |
if not fast_debug:
|
| 105 |
msg = '正常'
|
| 106 |
# ** gpt request **
|
| 107 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 108 |
+
inputs=i_say,
|
| 109 |
+
inputs_show_user=i_say,
|
| 110 |
+
llm_kwargs=llm_kwargs,
|
| 111 |
+
chatbot=chatbot,
|
| 112 |
+
history=history,
|
| 113 |
+
sys_prompt="总结文章。"
|
| 114 |
+
) # 带超时倒计时
|
| 115 |
chatbot[-1] = (i_say, gpt_say)
|
| 116 |
history.append(i_say); history.append(gpt_say)
|
| 117 |
yield from update_ui(chatbot=chatbot, history=chatbot, msg=msg) # 刷新界面
|
crazy_functions/理解PDF文档内容.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption
|
| 3 |
import re
|
| 4 |
import unicodedata
|
|
|
|
| 5 |
fast_debug = False
|
| 6 |
|
| 7 |
def is_paragraph_break(match):
|
|
@@ -81,11 +82,11 @@ def 解析PDF(file_name, llm_kwargs, plugin_kwargs, chatbot, history, system_pro
|
|
| 81 |
i_say = f'你只需要回答“接受完成”。文章内容第{i+1}/{split_group}部分是 ```{file_content[i*split_number:(i+1)*split_number]}```'
|
| 82 |
i_say_show_user = f'当前发送{i+1}/{split_group}部分'
|
| 83 |
chatbot.append((i_say_show_user, "[Local Message] waiting gpt response."))
|
| 84 |
-
gpt_say = yield from
|
| 85 |
while "完成" not in gpt_say:
|
| 86 |
i_say = f'你只需要回答“接受完成”。文章内容第{i+1}/{split_group}部分是 ```{file_content[i*split_number:(i+1)*split_number]}```'
|
| 87 |
i_say_show_user = f'出现error,重新发送{i+1}/{split_group}部分'
|
| 88 |
-
gpt_say = yield from
|
| 89 |
time.sleep(1)
|
| 90 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 91 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
@@ -97,7 +98,7 @@ def 解析PDF(file_name, llm_kwargs, plugin_kwargs, chatbot, history, system_pro
|
|
| 97 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 98 |
|
| 99 |
# ** gpt request **
|
| 100 |
-
gpt_say = yield from
|
| 101 |
chatbot[-1] = (i_say, gpt_say)
|
| 102 |
history.append(i_say); history.append(gpt_say)
|
| 103 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption
|
| 3 |
import re
|
| 4 |
import unicodedata
|
| 5 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 6 |
fast_debug = False
|
| 7 |
|
| 8 |
def is_paragraph_break(match):
|
|
|
|
| 82 |
i_say = f'你只需要回答“接受完成”。文章内容第{i+1}/{split_group}部分是 ```{file_content[i*split_number:(i+1)*split_number]}```'
|
| 83 |
i_say_show_user = f'当前发送{i+1}/{split_group}部分'
|
| 84 |
chatbot.append((i_say_show_user, "[Local Message] waiting gpt response."))
|
| 85 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(i_say, i_say_show_user, llm_kwargs, chatbot, history=[], sys_prompt="") # 带超时倒计时
|
| 86 |
while "完成" not in gpt_say:
|
| 87 |
i_say = f'你只需要回答“接受完成”。文章内容第{i+1}/{split_group}部分是 ```{file_content[i*split_number:(i+1)*split_number]}```'
|
| 88 |
i_say_show_user = f'出现error,重新发送{i+1}/{split_group}部分'
|
| 89 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(i_say, i_say_show_user, llm_kwargs, chatbot, history=[], sys_prompt="") # 带超时倒计时
|
| 90 |
time.sleep(1)
|
| 91 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 92 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
|
|
| 98 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
| 99 |
|
| 100 |
# ** gpt request **
|
| 101 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(i_say, i_say, llm_kwargs, chatbot, history=history, sys_prompt="") # 带超时倒计时
|
| 102 |
chatbot[-1] = (i_say, gpt_say)
|
| 103 |
history.append(i_say); history.append(gpt_say)
|
| 104 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
crazy_functions/生成函数注释.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
|
|
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
-
|
| 6 |
def 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):
|
| 7 |
-
import time,
|
| 8 |
print('begin analysis on:', file_manifest)
|
| 9 |
for index, fp in enumerate(file_manifest):
|
| 10 |
with open(fp, 'r', encoding='utf-8') as f:
|
|
@@ -18,7 +18,8 @@ def 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs,
|
|
| 18 |
if not fast_debug:
|
| 19 |
msg = '正常'
|
| 20 |
# ** gpt request **
|
| 21 |
-
gpt_say = yield from
|
|
|
|
| 22 |
|
| 23 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 24 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 4 |
fast_debug = False
|
| 5 |
|
|
|
|
| 6 |
def 生成函数注释(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):
|
| 7 |
+
import time, os
|
| 8 |
print('begin analysis on:', file_manifest)
|
| 9 |
for index, fp in enumerate(file_manifest):
|
| 10 |
with open(fp, 'r', encoding='utf-8') as f:
|
|
|
|
| 18 |
if not fast_debug:
|
| 19 |
msg = '正常'
|
| 20 |
# ** gpt request **
|
| 21 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
| 22 |
+
i_say, i_say_show_user, llm_kwargs, chatbot, history=[], sys_prompt=system_prompt) # 带超时倒计时
|
| 23 |
|
| 24 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 25 |
history.append(i_say_show_user); history.append(gpt_say)
|
crazy_functions/解析项目源代码.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
|
| 4 |
def 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):
|
| 5 |
import os, copy
|
| 6 |
from .crazy_utils import request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency
|
| 7 |
-
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 8 |
msg = '正常'
|
| 9 |
inputs_array = []
|
| 10 |
inputs_show_user_array = []
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
|
| 4 |
def 解析源代码新(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt):
|
| 5 |
import os, copy
|
| 6 |
from .crazy_utils import request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency
|
| 7 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 8 |
msg = '正常'
|
| 9 |
inputs_array = []
|
| 10 |
inputs_show_user_array = []
|
crazy_functions/读文章写摘要.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
-
from toolbox import CatchException, report_execption, write_results_to_file
|
|
|
|
| 3 |
fast_debug = False
|
| 4 |
|
| 5 |
|
|
@@ -19,7 +20,7 @@ def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbo
|
|
| 19 |
if not fast_debug:
|
| 20 |
msg = '正常'
|
| 21 |
# ** gpt request **
|
| 22 |
-
gpt_say = yield from
|
| 23 |
|
| 24 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 25 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
@@ -34,7 +35,7 @@ def 解析Paper(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbo
|
|
| 34 |
if not fast_debug:
|
| 35 |
msg = '正常'
|
| 36 |
# ** gpt request **
|
| 37 |
-
gpt_say = yield from
|
| 38 |
|
| 39 |
chatbot[-1] = (i_say, gpt_say)
|
| 40 |
history.append(i_say); history.append(gpt_say)
|
|
|
|
| 1 |
from toolbox import update_ui
|
| 2 |
+
from toolbox import CatchException, report_execption, write_results_to_file
|
| 3 |
+
from .crazy_utils import request_gpt_model_in_new_thread_with_ui_alive
|
| 4 |
fast_debug = False
|
| 5 |
|
| 6 |
|
|
|
|
| 20 |
if not fast_debug:
|
| 21 |
msg = '正常'
|
| 22 |
# ** gpt request **
|
| 23 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(i_say, i_say_show_user, llm_kwargs, chatbot, history=[], sys_prompt=system_prompt) # 带超时倒计时
|
| 24 |
|
| 25 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
| 26 |
history.append(i_say_show_user); history.append(gpt_say)
|
|
|
|
| 35 |
if not fast_debug:
|
| 36 |
msg = '正常'
|
| 37 |
# ** gpt request **
|
| 38 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(i_say, i_say, llm_kwargs, chatbot, history=history, sys_prompt=system_prompt) # 带超时倒计时
|
| 39 |
|
| 40 |
chatbot[-1] = (i_say, gpt_say)
|
| 41 |
history.append(i_say); history.append(gpt_say)
|