Skip to content

Commit b1be050

Browse files
committed
移除冗余代码,修复多用户存档问题
1 parent 977f992 commit b1be050

File tree

6 files changed

+24
-32
lines changed

6 files changed

+24
-32
lines changed

.pre-commit-config.yaml

-10
This file was deleted.

config.py

-5
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,6 @@
235235
# 自定义按钮的最大数量限制
236236
NUM_CUSTOM_BASIC_BTN = 4
237237

238-
239-
# LATEX实验性功能
240-
LATEX_EXPERIMENTAL = False
241-
242-
243238
"""
244239
在线大模型配置关联关系示意图
245240

crazy_functions/latex_fns/latex_actions.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@ def __init__(self) -> None:
9595
self.abstract = "unknown"
9696

9797
def read_title_and_abstract(self, txt):
98-
title, abstract = find_title_and_abs(txt)
99-
if title is not None:
100-
self.title = title.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
101-
if abstract is not None:
102-
self.abstract = abstract.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
98+
try:
99+
title, abstract = find_title_and_abs(txt)
100+
if title is not None:
101+
self.title = title.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
102+
if abstract is not None:
103+
self.abstract = abstract.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
104+
except:
105+
pass
103106

104107
def merge_result(self, arr, mode, msg, buggy_lines=[], buggy_line_surgery_n_lines=10):
105108
"""
@@ -265,12 +268,12 @@ def Latex精细分解与转化(file_manifest, project_folder, llm_kwargs, plugin
265268

266269
else:
267270
# <-------- gpt 多线程请求 ---------->
268-
LATEX_EXPERIMENTAL, = get_conf('LATEX_EXPERIMENTAL')
269271
history_array = [[""] for _ in range(n_split)]
270-
if LATEX_EXPERIMENTAL:
271-
paper_meta = f"The paper you processing is `{lps.title}`, a part of the abstraction is `{lps.abstract}`"
272-
paper_meta_max_len = 888
273-
history_array = [[ paper_meta[:paper_meta_max_len] + '...', "Understand, what should I do?"] for _ in range(n_split)]
272+
# LATEX_EXPERIMENTAL, = get_conf('LATEX_EXPERIMENTAL')
273+
# if LATEX_EXPERIMENTAL:
274+
# paper_meta = f"The paper you processing is `{lps.title}`, a part of the abstraction is `{lps.abstract}`"
275+
# paper_meta_max_len = 888
276+
# history_array = [[ paper_meta[:paper_meta_max_len] + '...', "Understand, what should I do?"] for _ in range(n_split)]
274277

275278
gpt_response_collection = yield from request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
276279
inputs_array=inputs_array,

crazy_functions/latex_fns/latex_toolbox.py

+1
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def extract_title(string):
352352
title = extract_title(main_file)
353353
return title, abstract
354354

355+
355356
def merge_tex_files(project_foler, main_file, mode):
356357
"""
357358
Merge Tex project recrusively

toolbox.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -544,14 +544,16 @@ def find_recent_files(directory):
544544

545545

546546
def file_already_in_downloadzone(file, user_path):
547-
parent_path = user_path
548-
child_path = file
549-
if os.path.commonpath([parent_path, child_path]) == parent_path:
550-
return True
551-
else:
547+
try:
548+
parent_path = os.path.abspath(user_path)
549+
child_path = os.path.abspath(file)
550+
if os.path.samefile(os.path.commonpath([parent_path, child_path]), parent_path):
551+
return True
552+
else:
553+
return False
554+
except:
552555
return False
553556

554-
555557
def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
556558
# 将文件复制一份到下载区
557559
import shutil
@@ -564,6 +566,7 @@ def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
564566
if file_already_in_downloadzone(file, user_path):
565567
new_path = file
566568
else:
569+
user_path = get_log_folder(user_name, plugin_name='downloadzone')
567570
if rename_file is None: rename_file = f'{gen_time_str()}-{os.path.basename(file)}'
568571
new_path = pj(user_path, rename_file)
569572
# 如果已经存在,先删除

version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"version": 3.60,
33
"show_feature": true,
4-
"new_feature": "11月12日紧急BUG修复 <-> AutoGen多智能体插件测试版 <-> 修复本地模型在Windows下的加载BUG <-> 支持文心一言v4和星火v3 <-> 支持GLM3和智谱的API <-> 解决本地模型并发BUG <-> 支持动态追加基础功能按钮 <-> 新汇报PDF汇总页面 <-> 重新编译Gradio优化使用体验"
4+
"new_feature": "修复多个BUG <-> AutoGen多智能体插件测试版 <-> 修复本地模型在Windows下的加载BUG <-> 支持文心一言v4和星火v3 <-> 支持GLM3和智谱的API <-> 解决本地模型并发BUG <-> 支持动态追加基础功能按钮 <-> 新汇报PDF汇总页面 <-> 重新编译Gradio优化使用体验"
55
}

0 commit comments

Comments
 (0)