Closed YSDiting closed 1 year ago
控制台报了什么错;然后可以提供一下model/command/command.py里面的内容吗
[QQBOT] 接收到消息:<@!11620738824688910836> update latest [ERROR] (cmd.py:144)pump_stream Pumping 'stderr' of cmd(['git', 'pull', '-v', '--', 'origin']) failed due to: UnicodeDecodeError('gbk', b'From https://github.com/Soulter/QQChannelChatGPT\n = [up to date] master -> origin/master\n = [up to date] 20-revChatGPTLoginPerf -> origin/20-revChatGPTLoginPerf\n = [up to date] 27-msg-oper-perf -> origin/27-msg-oper-perf\n = [up to date] 30-personality-fix -> origin/30-personality-fix\n = [up to date] 42-openai_api_domain_customization -> origin/42-openai_api_domain_customization\n = [up to date] 55-multi-models-switch -> origin/55-multi-models-switch\n = [up to date] 61-enhancement-\xe9\x87\x8d\xe6\x9e\x84\xe4\xbb\xa3\xe7\xa0\x81\xe5\xa2\x9e\xe5\xbc\xba\xe7\xa8\xb3\xe5\xae\x9a\xe6\x80\xa7 -> origin/61-enhancement-\xe9\x87\x8d\xe6\x9e\x84\xe4\xbb\xa3\xe7\xa0\x81\xe5\xa2\x9e\xe5\xbc\xba\xe7\xa8\xb3\xe5\xae\x9a\xe6\x80\xa7\n = [up to date] ChatGPTAI-perf -> origin/ChatGPTAI-perf\n = [up to date] add-license-1 -> origin/add-license-1\n', 571, 572, 'illegal multibyte sequence') Exception in thread Thread-7 (pump_stream): Traceback (most recent call last): File "C:\Users\DiTing\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\git\cmd.py", line 134, in pump_stream for line in stream: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa7 in position 571: illegal multibyte sequence
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64qbz5n2kfra8p0\Lib\threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\DiTing\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\git\cmd.py", line 147, in pump_stream
raise CommandError([f"<{name}-pump>"] + remove_password_if_present(cmdline), ex) from ex
git.exc.CommandError: Cmd('
import abc import json import git.exc from git.repo import Repo import os import sys
import requests from model.provider.provider import Provider
class Command: def init(self, provider: Provider): self.provider = Provider
@abc.abstractmethod
def check_command(self, message):
if message.startswith("help") or message.startswith("帮助"):
return True, self.help()
return False, None
# 接受可变参数
def command_start_with(self, message: str, *args):
for arg in args:
if message.startswith(arg) or message.startswith('/'+arg):
return True
return False
def update(self, message: str):
l = message.split(" ")
if len(l) == 1:
# 得到本地版本号和最新版本号
try:
repo = Repo()
except git.exc.InvalidGitRepositoryError:
repo = Repo(path="QQChannelChatGPT")
now_commit = repo.head.commit
# 得到最新的5条commit列表, 包含commit信息
origin = repo.remotes.origin
origin.fetch()
commits = list(repo.iter_commits('master', max_count=5))
commits_log = ''
index = 1
for commit in commits:
commits_log += f"[{index}] {commit.message}\n-----------\n"
index+=1
remote_commit_hash = origin.refs.master.commit.hexsha[:6]
return True, f"当前版本: {now_commit.hexsha[:6]}\n最新版本: {remote_commit_hash}\n\n最新5条commit:\n{str(commits_log)}\n使用update latest更新至最新版本\n"
else:
if l[1] == "latest":
try:
try:
repo = Repo()
except git.exc.InvalidGitRepositoryError:
repo = Repo(path="QQChannelChatGPT")
repo.remotes.origin.pull()
py = sys.executable
os.execl(py, py, *sys.argv)
return True, "更新成功"
except BaseException as e:
return False, "更新失败: "+str(e)
def reset(self):
return False
def set(self):
return False
def unset(self):
return False
def key(self):
return False
def help(self):
# ol_version = 'Unknown'
# try:
# res = requests.get("https://soulter.top/channelbot/update.json")
# res_obj = json.loads(res.text)
# ol_version = res_obj['version']
# except BaseException:
# pass
return True, f"[Github项目名: QQChannelChatGPT,有问题请前往提交issue,欢迎Star此项目~]\n\n指令面板:\nstatus 查看机器人key状态\ncount 查看机器人统计信息\nreset 重置会话\nhis 查看历史记录\ntoken 查看会话token数\nhelp 查看帮助\nset 人格指令菜单\nkey 动态添加key"
def status(self):
return False
def token(self):
return False
def his(self):
return False
def draw(self):
return False
这个是GitPython
库的一个bug
有更新成功吗,使用/gpt指令试试会不会提示切换模型
没更新成功,不会切换模型
用新的安装器重装后可以切换模型
机器人回复: 指令调用错误: 更新失败: Cmd('git') failed due to: exit code(1) cmdline: git pull -v -- origin