perf: 更新后自动更新第三方库
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import abc
|
import abc
|
||||||
import json
|
import json
|
||||||
|
import platform
|
||||||
import git.exc
|
import git.exc
|
||||||
from git.repo import Repo
|
from git.repo import Repo
|
||||||
import os
|
import os
|
||||||
@@ -50,15 +51,36 @@ class Command:
|
|||||||
return True, f"当前版本: {now_commit.hexsha[:6]}\n最新版本: {remote_commit_hash}\n\n最新3条commit:\n{str(commits_log)}\n使用update latest更新至最新版本\n"
|
return True, f"当前版本: {now_commit.hexsha[:6]}\n最新版本: {remote_commit_hash}\n\n最新3条commit:\n{str(commits_log)}\n使用update latest更新至最新版本\n"
|
||||||
else:
|
else:
|
||||||
if l[1] == "latest":
|
if l[1] == "latest":
|
||||||
|
pash_tag = ""
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
repo = Repo()
|
repo = Repo()
|
||||||
except git.exc.InvalidGitRepositoryError:
|
except git.exc.InvalidGitRepositoryError:
|
||||||
repo = Repo(path="QQChannelChatGPT")
|
repo = Repo(path="QQChannelChatGPT")
|
||||||
|
pash_tag = "QQChannelChatGPT\\"
|
||||||
repo.remotes.origin.pull()
|
repo.remotes.origin.pull()
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.system("pip install -r "+pash_tag+"requirements.txt")
|
||||||
|
except BaseException as e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
py = sys.executable
|
py = sys.executable
|
||||||
os.execl(py, py, *sys.argv)
|
os.execl(py, py, *sys.argv)
|
||||||
return True, "更新成功"
|
|
||||||
|
|
||||||
|
# 检查是否是windows环境
|
||||||
|
# if platform.system().lower() == "windows":
|
||||||
|
# if os.path.exists("launcher.exe"):
|
||||||
|
# os.system("start launcher.exe")
|
||||||
|
# elif os.path.exists("QQChannelChatGPT\\main.py"):
|
||||||
|
# os.system("start python QQChannelChatGPT\\main.py")
|
||||||
|
# else:
|
||||||
|
# return True, "更新成功,未发现启动项,因此需要手动重启程序。"
|
||||||
|
# exit()
|
||||||
|
# else:
|
||||||
|
# py = sys.executable
|
||||||
|
# os.execl(py, py, *sys.argv)
|
||||||
|
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
return False, "更新失败: "+str(e)
|
return False, "更新失败: "+str(e)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ openai
|
|||||||
qq-botpy
|
qq-botpy
|
||||||
revChatGPT~=4.0.8
|
revChatGPT~=4.0.8
|
||||||
baidu-aip
|
baidu-aip
|
||||||
EdgeGPT~=0.1.2
|
EdgeGPT~=0.1.22.1
|
||||||
chardet
|
chardet
|
||||||
Pillow
|
Pillow
|
||||||
GitPython
|
GitPython
|
||||||
|
|||||||
Reference in New Issue
Block a user