change arxiv cache dir path
This commit is contained in:
10
config.py
10
config.py
@@ -281,15 +281,19 @@ ALLOW_RESET_CONFIG = False
|
|||||||
AUTOGEN_USE_DOCKER = False
|
AUTOGEN_USE_DOCKER = False
|
||||||
|
|
||||||
|
|
||||||
# 临时的上传文件夹位置,请勿修改
|
# 临时的上传文件夹位置,请尽量不要修改
|
||||||
PATH_PRIVATE_UPLOAD = "private_upload"
|
PATH_PRIVATE_UPLOAD = "private_upload"
|
||||||
|
|
||||||
|
|
||||||
# 日志文件夹的位置,请勿修改
|
# 日志文件夹的位置,请尽量不要修改
|
||||||
PATH_LOGGING = "gpt_log"
|
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",
|
WHEN_TO_USE_PROXY = ["Download_LLM", "Download_Gradio_Theme", "Connect_Grobid",
|
||||||
"Warmup_Modules", "Nougat_Download", "AutoGen"]
|
"Warmup_Modules", "Nougat_Download", "AutoGen"]
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from functools import partial
|
|||||||
import glob, os, requests, time, json, tarfile
|
import glob, os, requests, time, json, tarfile
|
||||||
|
|
||||||
pj = os.path.join
|
pj = os.path.join
|
||||||
ARXIV_CACHE_DIR = os.path.expanduser(f"~/arxiv_cache/")
|
ARXIV_CACHE_DIR = get_conf("ARXIV_CACHE_DIR")
|
||||||
|
|
||||||
|
|
||||||
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 工具函数 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 工具函数 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ def validate_path_safety(path_or_url, user):
|
|||||||
else:
|
else:
|
||||||
raise FriendlyException(f"输入文件的路径 ({path_or_url}) 存在,但位置非法。请将文件上传后再执行该任务。") # return False
|
raise FriendlyException(f"输入文件的路径 ({path_or_url}) 存在,但位置非法。请将文件上传后再执行该任务。") # return False
|
||||||
if sensitive_path:
|
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:
|
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):
|
if f"{os.sep}".join(path_or_url.split(os.sep)[:2]) == os.path.join(sensitive_path, user_allowed):
|
||||||
return True
|
return True
|
||||||
@@ -82,7 +82,7 @@ def _authorize_user(path_or_url, request, gradio_app):
|
|||||||
if sensitive_path:
|
if sensitive_path:
|
||||||
token = request.cookies.get("access-token") or request.cookies.get("access-token-unsecure")
|
token = request.cookies.get("access-token") or request.cookies.get("access-token-unsecure")
|
||||||
user = gradio_app.tokens.get(token) # get user
|
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:
|
for user_allowed in allowed_users:
|
||||||
# exact match
|
# exact match
|
||||||
if f"{os.sep}".join(path_or_url.split(os.sep)[:2]) == os.path.join(sensitive_path, user_allowed):
|
if f"{os.sep}".join(path_or_url.split(os.sep)[:2]) == os.path.join(sensitive_path, user_allowed):
|
||||||
|
|||||||
Reference in New Issue
Block a user