Merge branch 'master' into frontier
This commit is contained in:
commit
4fefbb80ac
@ -5,7 +5,6 @@ def check_proxy(proxies):
|
|||||||
try:
|
try:
|
||||||
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
response = requests.get("https://ipapi.co/json/", proxies=proxies, timeout=4)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
# print(f'查询代理的地理位置,返回的结果是{data}')
|
|
||||||
if 'country_name' in data:
|
if 'country_name' in data:
|
||||||
country = data['country_name']
|
country = data['country_name']
|
||||||
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
result = f"代理配置 {proxies_https}, 代理所在地:{country}"
|
||||||
@ -47,8 +46,8 @@ def backup_and_download(current_version, remote_version):
|
|||||||
os.makedirs(new_version_dir)
|
os.makedirs(new_version_dir)
|
||||||
shutil.copytree('./', backup_dir, ignore=lambda x, y: ['history'])
|
shutil.copytree('./', backup_dir, ignore=lambda x, y: ['history'])
|
||||||
proxies = get_conf('proxies')
|
proxies = get_conf('proxies')
|
||||||
r = requests.get(
|
try: r = requests.get('https://github.com/binary-husky/chatgpt_academic/archive/refs/heads/master.zip', proxies=proxies, stream=True)
|
||||||
'https://github.com/binary-husky/chatgpt_academic/archive/refs/heads/master.zip', proxies=proxies, stream=True)
|
except: r = requests.get('https://public.gpt-academic.top/publish/master.zip', proxies=proxies, stream=True)
|
||||||
zip_file_path = backup_dir+'/master.zip'
|
zip_file_path = backup_dir+'/master.zip'
|
||||||
with open(zip_file_path, 'wb+') as f:
|
with open(zip_file_path, 'wb+') as f:
|
||||||
f.write(r.content)
|
f.write(r.content)
|
||||||
@ -111,11 +110,10 @@ def auto_update(raise_error=False):
|
|||||||
try:
|
try:
|
||||||
from toolbox import get_conf
|
from toolbox import get_conf
|
||||||
import requests
|
import requests
|
||||||
import time
|
|
||||||
import json
|
import json
|
||||||
proxies = get_conf('proxies')
|
proxies = get_conf('proxies')
|
||||||
response = requests.get(
|
try: response = requests.get("https://raw.githubusercontent.com/binary-husky/chatgpt_academic/master/version", proxies=proxies, timeout=5)
|
||||||
"https://raw.githubusercontent.com/binary-husky/chatgpt_academic/master/version", proxies=proxies, timeout=5)
|
except: response = requests.get("https://public.gpt-academic.top/publish/version", proxies=proxies, timeout=5)
|
||||||
remote_json_data = json.loads(response.text)
|
remote_json_data = json.loads(response.text)
|
||||||
remote_version = remote_json_data['version']
|
remote_version = remote_json_data['version']
|
||||||
if remote_json_data["show_feature"]:
|
if remote_json_data["show_feature"]:
|
||||||
@ -127,8 +125,7 @@ def auto_update(raise_error=False):
|
|||||||
current_version = json.loads(current_version)['version']
|
current_version = json.loads(current_version)['version']
|
||||||
if (remote_version - current_version) >= 0.01-1e-5:
|
if (remote_version - current_version) >= 0.01-1e-5:
|
||||||
from colorful import print亮黄
|
from colorful import print亮黄
|
||||||
print亮黄(
|
print亮黄(f'\n新版本可用。新版本:{remote_version},当前版本:{current_version}。{new_feature}')
|
||||||
f'\n新版本可用。新版本:{remote_version},当前版本:{current_version}。{new_feature}')
|
|
||||||
print('(1)Github更新地址:\nhttps://github.com/binary-husky/chatgpt_academic\n')
|
print('(1)Github更新地址:\nhttps://github.com/binary-husky/chatgpt_academic\n')
|
||||||
user_instruction = input('(2)是否一键更新代码(Y+回车=确认,输入其他/无输入+回车=不更新)?')
|
user_instruction = input('(2)是否一键更新代码(Y+回车=确认,输入其他/无输入+回车=不更新)?')
|
||||||
if user_instruction in ['Y', 'y']:
|
if user_instruction in ['Y', 'y']:
|
||||||
|
@ -73,6 +73,7 @@ def move_project(project_folder, arxiv_id=None):
|
|||||||
|
|
||||||
# align subfolder if there is a folder wrapper
|
# align subfolder if there is a folder wrapper
|
||||||
items = glob.glob(pj(project_folder,'*'))
|
items = glob.glob(pj(project_folder,'*'))
|
||||||
|
items = [item for item in items if os.path.basename(item)!='__MACOSX']
|
||||||
if len(glob.glob(pj(project_folder,'*.tex'))) == 0 and len(items) == 1:
|
if len(glob.glob(pj(project_folder,'*.tex'))) == 0 and len(items) == 1:
|
||||||
if os.path.isdir(items[0]): project_folder = items[0]
|
if os.path.isdir(items[0]): project_folder = items[0]
|
||||||
|
|
||||||
@ -214,7 +215,6 @@ def Latex英文纠错加PDF对比(txt, llm_kwargs, plugin_kwargs, chatbot, histo
|
|||||||
# <-------------- we are done ------------->
|
# <-------------- we are done ------------->
|
||||||
return success
|
return success
|
||||||
|
|
||||||
|
|
||||||
# ========================================= 插件主程序2 =====================================================
|
# ========================================= 插件主程序2 =====================================================
|
||||||
|
|
||||||
@CatchException
|
@CatchException
|
||||||
|
@ -283,10 +283,10 @@ def find_tex_file_ignore_case(fp):
|
|||||||
dir_name = os.path.dirname(fp)
|
dir_name = os.path.dirname(fp)
|
||||||
base_name = os.path.basename(fp)
|
base_name = os.path.basename(fp)
|
||||||
# 如果输入的文件路径是正确的
|
# 如果输入的文件路径是正确的
|
||||||
if os.path.exists(pj(dir_name, base_name)): return pj(dir_name, base_name)
|
if os.path.isfile(pj(dir_name, base_name)): return pj(dir_name, base_name)
|
||||||
# 如果不正确,试着加上.tex后缀试试
|
# 如果不正确,试着加上.tex后缀试试
|
||||||
if not base_name.endswith('.tex'): base_name+='.tex'
|
if not base_name.endswith('.tex'): base_name+='.tex'
|
||||||
if os.path.exists(pj(dir_name, base_name)): return pj(dir_name, base_name)
|
if os.path.isfile(pj(dir_name, base_name)): return pj(dir_name, base_name)
|
||||||
# 如果还找不到,解除大小写限制,再试一次
|
# 如果还找不到,解除大小写限制,再试一次
|
||||||
import glob
|
import glob
|
||||||
for f in glob.glob(dir_name+'/*.tex'):
|
for f in glob.glob(dir_name+'/*.tex'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user