iuiaoin / wechat-gptbot

A wechat robot based on ChatGPT with no risk, very stable! 🚀
MIT License
579 stars 113 forks source link

[Bug]: 启动失败,不能获取微信账号信息 #93

Open JohnHansROOT opened 11 months ago

JohnHansROOT commented 11 months ago

Search for answers in existing issues

Python version

python 3.10

Issue description

按照要求做了,最后python app.py报错:

[ERROR][2023-09-24 01:39:03][api.py:46] - Get personal info failed!
[ERROR][2023-09-24 01:39:03][api.py:47] - Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "C:\Users\Administrator\.conda\envs\chatbot\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Administrator\.conda\envs\chatbot\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Administrator\.conda\envs\chatbot\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Administrator\.conda\envs\chatbot\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\wechat-gptbot-1.5.1\wechat-gptbot-1.5.1\utils\api.py", line 32, in get_personal_info
    response = fetch(path, data)
  File "C:\Users\Administrator\Desktop\wechat-gptbot-1.5.1\wechat-gptbot-1.5.1\utils\api.py", line 22, in fetch
    return response.json()
  File "C:\Users\Administrator\.conda\envs\chatbot\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[INFO][2023-09-24 01:39:03][wechat.py:40] - App startup successfully!
[ERROR][2023-09-24 01:39:23][wechat.py:184] - [Websocket] Error: Connection to remote host was lost.
[ERROR][2023-09-24 01:39:23][wechat.py:184] - [Websocket] Error: WeChatChannel.on_close() takes 2 positional arguments but 4 were given

Repro steps

No response

Relevant log output

No response

QAbot-zh commented 11 months ago

确认一下requirement要求的库版本和你环境的库版本(pip list)是否一致

elonln commented 11 months ago

确认一下requirement要求的库版本和你环境的库版本(pip list)是否一致

[INFO][2023-09-25 20:47:23][manager.py:42] - Checking plugins...
[INFO][2023-09-25 20:47:23][manager.py:54] - All plugins are installed
<Response [200]>
[ERROR][2023-09-25 20:47:23][api.py:48] - Get personal info failed!
[ERROR][2023-09-25 20:47:23][api.py:49] - 'wx_name'
Traceback (most recent call last):
File "D:\funProject\wechat-gptbot\utils\api.py", line 40, in get_personal_info
nickName: {content['wx_name']}
KeyError: 'wx_name'
[INFO][2023-09-25 20:47:23][wechat.py:43] - App startup successfully!

也有这个问题,我确认与环境的库版本一致 ,Python3.8.1

fetch方法返回值content中显示json报错: '{"content":"{\"content\":\"[json.exception.type_error.316] invalid UTF-8 byte at index 0: 0x88\",\"id\":\"20230925205800\",\"receiver\":\"CLIENT\",\"sender\":\"SERVER\",\"srvid\":1,\"status\":\"FAILED\",\"time\":\"2023-09-25 20:58:00\",\"type\":6500}","id":"20230925205800","receiver":"CLIENT","sender":"SERVER","srvid":1,"status":"SUCCSESSED","time":"2023-09-25 20:58:00","type":6500}'

QAbot-zh commented 11 months ago

@elonln 你用的是新注册的小号吗?没有给小号起昵称?为什么会没有wx_name,好奇怪。 不过我倒是遇到另一个问题,我本地主机有段时间没运行了(因为部署到其他地方去了),使用Python3.8复现你们问题的过程中遇到下面的报错: [ERROR][2023-09-26 16:40:46][wechat.py:398] - [Websocket] Error: 'wx_id' 然后去我本地主机以前能正常运行的Python环境中也存在这个问题,然后把raw_msg打印出来,发现居然变成了wxid,没有下划线了,改掉就正常运行了。emm也不知道是websocket的问题还是微信的问题。

elonln commented 10 months ago

@elonln 你用的是新注册的小号吗?没有给小号起昵称?为什么会没有wx_name,好奇怪。 不过我倒是遇到另一个问题,我本地主机有段时间没运行了(因为部署到其他地方去了),使用Python3.8复现你们问题的过程中遇到下面的报错: [ERROR][2023-09-26 16:40:46][wechat.py:398] - [Websocket] Error: 'wx_id' 然后去我本地主机以前能正常运行的Python环境中也存在这个问题,然后把raw_msg打印出来,发现居然变成了wxid,没有下划线了,改掉就正常运行了。emm也不知道是websocket的问题还是微信的问题。

不是小号,我这个bug应该是websocket的问题,请求到5555接口那边返回的内容就是报错,服务端构建json错误,不只是name没有,所有信息都没有因为返回了一个error。我用那个非注入版hook后不再报错。wx_id我也发现了,改过来了

QAbot-zh commented 10 months ago

@elonln 那现在问题解决了?

RichardQt commented 5 months ago

同样遇到此问题,确实环境符合,仍然报错 image

ziren926 commented 2 months ago

微信截图_20240614153549 我也有遇到了一个奇怪的问题,老帐号,并且我已经成功注入了ddl