移除冗余代码,修复多用户存档问题

This commit is contained in:
qingxu fu 2023-11-20 01:06:19 +08:00
parent 977f992e3a
commit b1be05009b
6 changed files with 24 additions and 32 deletions

View File

@ -1,10 +0,0 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

View File

@ -235,11 +235,6 @@ BLOCK_INVALID_APIKEY = False
# 自定义按钮的最大数量限制
NUM_CUSTOM_BASIC_BTN = 4
# LATEX实验性功能
LATEX_EXPERIMENTAL = False
"""
在线大模型配置关联关系示意图

View File

@ -95,11 +95,14 @@ class LatexPaperSplit():
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):
"""
@ -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,

View File

@ -352,6 +352,7 @@ def find_title_and_abs(main_file):
title = extract_title(main_file)
return title, abstract
def merge_tex_files(project_foler, main_file, mode):
"""
Merge Tex project recrusively

View File

@ -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
@ -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)
# 如果已经存在,先删除

View File

@ -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优化使用体验"
}