Skip to content

Commit

Permalink
change arxiv cache dir path
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Jun 19, 2024
1 parent dfae4e8 commit d37383d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion crazy_functions/Latex_Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 工具函数 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Expand Down
4 changes: 2 additions & 2 deletions shared_utils/fastapi_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit d37383d

Please sign in to comment.