Skip to content

Commit

Permalink
移除冗余代码,修复多用户存档问题
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-sky committed Nov 19, 2023
1 parent 977f992 commit b1be050
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
10 changes: 0 additions & 10 deletions .pre-commit-config.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@
# 自定义按钮的最大数量限制
NUM_CUSTOM_BASIC_BTN = 4


# LATEX实验性功能
LATEX_EXPERIMENTAL = False


"""
在线大模型配置关联关系示意图
Expand Down
23 changes: 13 additions & 10 deletions crazy_functions/latex_fns/latex_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ def __init__(self) -> None:
self.abstract = "unknown"

def read_title_and_abstract(self, txt):
title, abstract = find_title_and_abs(txt)
if title is not None:
self.title = title.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
if abstract is not None:
self.abstract = abstract.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
try:
title, abstract = find_title_and_abs(txt)
if title is not None:
self.title = title.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
if abstract is not None:
self.abstract = abstract.replace('\n', ' ').replace('\\\\', ' ').replace(' ', '').replace(' ', '')
except:
pass

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

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

gpt_response_collection = yield from request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
inputs_array=inputs_array,
Expand Down
1 change: 1 addition & 0 deletions crazy_functions/latex_fns/latex_toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def extract_title(string):
title = extract_title(main_file)
return title, abstract


def merge_tex_files(project_foler, main_file, mode):
"""
Merge Tex project recrusively
Expand Down
15 changes: 9 additions & 6 deletions toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,14 +544,16 @@ def find_recent_files(directory):


def file_already_in_downloadzone(file, user_path):
parent_path = user_path
child_path = file
if os.path.commonpath([parent_path, child_path]) == parent_path:
return True
else:
try:
parent_path = os.path.abspath(user_path)
child_path = os.path.abspath(file)
if os.path.samefile(os.path.commonpath([parent_path, child_path]), parent_path):
return True
else:
return False
except:
return False


def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
# 将文件复制一份到下载区
import shutil
Expand All @@ -564,6 +566,7 @@ def promote_file_to_downloadzone(file, rename_file=None, chatbot=None):
if file_already_in_downloadzone(file, user_path):
new_path = file
else:
user_path = get_log_folder(user_name, plugin_name='downloadzone')
if rename_file is None: rename_file = f'{gen_time_str()}-{os.path.basename(file)}'
new_path = pj(user_path, rename_file)
# 如果已经存在,先删除
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 3.60,
"show_feature": true,
"new_feature": "11月12日紧急BUG修复 <-> AutoGen多智能体插件测试版 <-> 修复本地模型在Windows下的加载BUG <-> 支持文心一言v4和星火v3 <-> 支持GLM3和智谱的API <-> 解决本地模型并发BUG <-> 支持动态追加基础功能按钮 <-> 新汇报PDF汇总页面 <-> 重新编译Gradio优化使用体验"
"new_feature": "修复多个BUG <-> AutoGen多智能体插件测试版 <-> 修复本地模型在Windows下的加载BUG <-> 支持文心一言v4和星火v3 <-> 支持GLM3和智谱的API <-> 解决本地模型并发BUG <-> 支持动态追加基础功能按钮 <-> 新汇报PDF汇总页面 <-> 重新编译Gradio优化使用体验"
}

0 comments on commit b1be050

Please sign in to comment.