Spaces:
Runtime error
Runtime error
紧急bug修复
Browse files- crazy_functions/下载arxiv论文翻译摘要.py +11 -2
- crazy_functions/总结word文档.py +1 -2
- toolbox.py +2 -2
crazy_functions/下载arxiv论文翻译摘要.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from toolbox import update_ui
|
2 |
from toolbox import CatchException, report_execption, write_results_to_file, predict_no_ui_but_counting_down, get_conf
|
3 |
import re, requests, unicodedata, os
|
4 |
-
|
5 |
def download_arxiv_(url_pdf):
|
6 |
if 'arxiv.org' not in url_pdf:
|
7 |
if ('.' in url_pdf) and ('/' not in url_pdf):
|
@@ -172,7 +172,16 @@ def 下载arxiv论文并翻译摘要(txt, llm_kwargs, plugin_kwargs, chatbot, hi
|
|
172 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
173 |
msg = '正常'
|
174 |
# ** gpt request **
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
177 |
history.append(i_say_show_user); history.append(gpt_say)
|
178 |
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, predict_no_ui_but_counting_down, 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):
|
6 |
if 'arxiv.org' not in url_pdf:
|
7 |
if ('.' in url_pdf) and ('/' not in url_pdf):
|
|
|
172 |
yield from update_ui(chatbot=chatbot, history=history) # 刷新界面
|
173 |
msg = '正常'
|
174 |
# ** gpt request **
|
175 |
+
# 单线,获取文章meta信息
|
176 |
+
gpt_say = yield from request_gpt_model_in_new_thread_with_ui_alive(
|
177 |
+
inputs=i_say,
|
178 |
+
inputs_show_user=i_say_show_user,
|
179 |
+
llm_kwargs=llm_kwargs,
|
180 |
+
chatbot=chatbot, history=[],
|
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, plugin_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) # 刷新界面
|
crazy_functions/总结word文档.py
CHANGED
@@ -40,8 +40,7 @@ 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 predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, llm_kwargs, plugin_kwargs,
|
44 |
-
history=[]) # 带超时倒计时
|
45 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
46 |
history.append(i_say_show_user);
|
47 |
history.append(gpt_say)
|
|
|
40 |
if not fast_debug:
|
41 |
msg = '正常'
|
42 |
# ** gpt request **
|
43 |
+
gpt_say = yield from predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, llm_kwargs, plugin_kwargs, history=[]) # 带超时倒计时
|
|
|
44 |
chatbot[-1] = (i_say_show_user, gpt_say)
|
45 |
history.append(i_say_show_user);
|
46 |
history.append(gpt_say)
|
toolbox.py
CHANGED
@@ -76,7 +76,7 @@ def get_reduce_token_percent(text):
|
|
76 |
return 0.5, '不详'
|
77 |
|
78 |
|
79 |
-
def predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot,
|
80 |
"""
|
81 |
* 此函数未来将被弃用(替代函数 request_gpt_model_in_new_thread_with_ui_alive 文件 chatgpt_academic/crazy_functions/crazy_utils)
|
82 |
|
@@ -102,7 +102,7 @@ def predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, top_p, temp
|
|
102 |
while True:
|
103 |
try:
|
104 |
mutable[0] = predict_no_ui_long_connection(
|
105 |
-
inputs=i_say,
|
106 |
|
107 |
except ConnectionAbortedError as token_exceeded_error:
|
108 |
# 尝试计算比例,尽可能多地保留文本
|
|
|
76 |
return 0.5, '不详'
|
77 |
|
78 |
|
79 |
+
def predict_no_ui_but_counting_down(i_say, i_say_show_user, chatbot, llm_kwargs, history=[], sys_prompt='', long_connection=True):
|
80 |
"""
|
81 |
* 此函数未来将被弃用(替代函数 request_gpt_model_in_new_thread_with_ui_alive 文件 chatgpt_academic/crazy_functions/crazy_utils)
|
82 |
|
|
|
102 |
while True:
|
103 |
try:
|
104 |
mutable[0] = predict_no_ui_long_connection(
|
105 |
+
inputs=i_say, llm_kwargs=llm_kwargs, history=history, sys_prompt=sys_prompt)
|
106 |
|
107 |
except ConnectionAbortedError as token_exceeded_error:
|
108 |
# 尝试计算比例,尽可能多地保留文本
|