diff --git a/config.py b/config.py index 6e5134fb8..f3c9ecb05 100644 --- a/config.py +++ b/config.py @@ -281,15 +281,19 @@ AUTOGEN_USE_DOCKER = False -# 临时的上传文件夹位置,请勿修改 +# 临时的上传文件夹位置,请尽量不要修改 PATH_PRIVATE_UPLOAD = "private_upload" -# 日志文件夹的位置,请勿修改 +# 日志文件夹的位置,请尽量不要修改 PATH_LOGGING = "gpt_log" -# 除了连接OpenAI之外,还有哪些场合允许使用代理,请勿修改 +# 存储翻译好的arxiv论文的路径,请尽量不要修改 +ARXIV_CACHE_DIR = "gpt_log/arxiv_cache" + + +# 除了连接OpenAI之外,还有哪些场合允许使用代理,请尽量不要修改 WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid", "Warmup_Modules", "Nougat_Download", "AutoGen"] diff --git a/crazy_functions/Latex_Function.py b/crazy_functions/Latex_Function.py index eb2eed9d6..310ecc7e7 100644 --- a/crazy_functions/Latex_Function.py +++ b/crazy_functions/Latex_Function.py @@ -4,7 +4,7 @@ import glob, os, requests, time, json, tarfile pj = os.path.join -ARXIV_CACHE_DIR = os.path.expanduser(f"~/arxiv_cache/") +ARXIV_CACHE_DIR = get_conf("ARXIV_CACHE_DIR") # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 工具函数 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=- diff --git a/shared_utils/fastapi_server.py b/shared_utils/fastapi_server.py index 5bb0c2b15..fdc4c6a2d 100644 --- a/shared_utils/fastapi_server.py +++ b/shared_utils/fastapi_server.py @@ -62,7 +62,7 @@ def validate_path_safety(path_or_url, user): else: raise FriendlyException(f"输入文件的路径 ({path_or_url}) 存在,但位置非法。请将文件上传后再执行该任务。") # return False if sensitive_path: - allowed_users = [user, 'autogen', default_user_name] # three user path that can be accessed + allowed_users = [user, 'autogen', 'arxiv_cache', default_user_name] # three user path that can be accessed for user_allowed in allowed_users: if f"{os.sep}".join(path_or_url.split(os.sep)[:2]) == os.path.join(sensitive_path, user_allowed): return True @@ -82,7 +82,7 @@ def _authorize_user(path_or_url, request, gradio_app): if sensitive_path: token = request.cookies.get("access-token") or request.cookies.get("access-token-unsecure") user = gradio_app.tokens.get(token) # get user - allowed_users = [user, 'autogen', default_user_name] # three user path that can be accessed + allowed_users = [user, 'autogen', 'arxiv_cache', default_user_name] # three user path that can be accessed for user_allowed in allowed_users: # exact match if f"{os.sep}".join(path_or_url.split(os.sep)[:2]) == os.path.join(sensitive_path, user_allowed):