From 5bf73caba778b0bc9ad5ad9f3ad67a9f4d54cdf6 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sat, 8 Apr 2023 11:05:12 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=9B=B4=E6=96=B0=E5=90=8E=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=9B=B4=E6=96=B0=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/command.py | 24 +++++++++++++++++++++++- requirements.txt | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/model/command/command.py b/model/command/command.py index 992688429..150dee499 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -1,5 +1,6 @@ import abc import json +import platform import git.exc from git.repo import Repo 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" else: if l[1] == "latest": + pash_tag = "" try: try: repo = Repo() except git.exc.InvalidGitRepositoryError: repo = Repo(path="QQChannelChatGPT") + pash_tag = "QQChannelChatGPT\\" repo.remotes.origin.pull() + + try: + os.system("pip install -r "+pash_tag+"requirements.txt") + except BaseException as e: + print(str(e)) + py = sys.executable 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: return False, "更新失败: "+str(e) diff --git a/requirements.txt b/requirements.txt index c6f9278a0..92a2da1ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ openai qq-botpy revChatGPT~=4.0.8 baidu-aip -EdgeGPT~=0.1.2 +EdgeGPT~=0.1.22.1 chardet Pillow GitPython