JerryZhouYG commited on
Commit
12a6997
·
verified ·
1 Parent(s): da2b0bd

Update check_proxy.py

Browse files
Files changed (1) hide show
  1. check_proxy.py +14 -15
check_proxy.py CHANGED
@@ -123,21 +123,20 @@ def auto_update(raise_error=False):
123
  with open('./version', 'r', encoding='utf8') as f:
124
  current_version = f.read()
125
  current_version = json.loads(current_version)['version']
126
- if (remote_version - current_version) >= 0.01-1e-5:
127
- from colorful import print亮黄
128
- print亮黄(f'\n新版本可用。新版本:{remote_version},当前版本:{current_version}。{new_feature}')
129
- print('(1)Github更新地址:\nhttps://github.com/binary-husky/chatgpt_academic\n')
130
- path = backup_and_download(current_version, remote_version)
131
- try:
132
- patch_and_restart(path)
133
- except:
134
- msg = '更新失败。'
135
- if raise_error:
136
- from toolbox import trimmed_format_exc
137
- msg += trimmed_format_exc()
138
- print(msg)
139
- else:
140
- return
141
  except:
142
  msg = '自动更新程序:已禁用。建议排查:代理网络配置。'
143
  if raise_error:
 
123
  with open('./version', 'r', encoding='utf8') as f:
124
  current_version = f.read()
125
  current_version = json.loads(current_version)['version']
126
+ user_instruction = input('(2)是否一键更新代码(Y+回车=确认,输入其他/无输入+回车=不更新)?')
127
+ if user_instruction in ['Y', 'y']:
128
+ path = backup_and_download(current_version, remote_version)
129
+ try:
130
+ patch_and_restart(path)
131
+ except:
132
+ msg = '更新失败。'
133
+ if raise_error:
134
+ from toolbox import trimmed_format_exc
135
+ msg += trimmed_format_exc()
136
+ print(msg)
137
+ else:
138
+ print('自动更新程序:已禁用')
139
+ return
 
140
  except:
141
  msg = '自动更新程序:已禁用。建议排查:代理网络配置。'
142
  if raise_error: