waylaidwanderer / node-chatgpt-api

A client implementation for ChatGPT and Bing AI. Available as a Node.js module, REST API server, and CLI app.
https://www.npmjs.com/package/@waylaidwanderer/chatgpt-api
MIT License
4.2k stars 738 forks source link

Unexpected message author. #288

Open zengbo opened 1 year ago

zengbo commented 1 year ago

Describe the bug


2023-04-08T03:25:55.884442914Z Error: Unexpected message author: user.
2023-04-08T03:25:55.884490315Z     at WebSocket.<anonymous> (file:///var/chatgpt-api/src/BingAIClient.js:446:36)
2023-04-08T03:25:55.884499215Z     at WebSocket.emit (node:events:525:35)
2023-04-08T03:25:55.884505315Z     at Receiver.receiverOnMessage (/var/chatgpt-api/node_modules/ws/lib/websocket.js:1184:20)
2023-04-08T03:25:55.884512315Z     at Receiver.emit (node:events:513:28)
2023-04-08T03:25:55.884518015Z     at Receiver.dataMessage (/var/chatgpt-api/node_modules/ws/lib/receiver.js:541:14)
2023-04-08T03:25:55.884523715Z     at Receiver.getData (/var/chatgpt-api/node_modules/ws/lib/receiver.js:459:17)
2023-04-08T03:25:55.884529416Z     at Receiver.startLoop (/var/chatgpt-api/node_modules/ws/lib/receiver.js:158:22)
2023-04-08T03:25:55.884535816Z     at Receiver._write (/var/chatgpt-api/node_modules/ws/lib/receiver.js:84:10)
2023-04-08T03:25:55.884541816Z     at writeOrBuffer (node:internal/streams/writable:392:12)
2023-04-08T03:25:55.884549616Z     at _write (node:internal/streams/writable:333:

To Reproduce 使用 Bing 聊天,聊了几句会出现这个问题,聊天内容如下:


User
我们来数数吧,从1开始,轮流说,如果遇到3或者3倍数就不能说数字,而要说“过”。规则了解清楚了,我们就开始
AI
你好,我是Sydney。我了解了规则,我们开始吧。1
User
2
AI
过
User
4
AI
5
User
过
AI
7
User
8
AI
Unexpected message author: user.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Node.js version (please complete the following information):

Package version (please complete the following information):

Additional context 在 Docker 运行的 我修改了一下代码,报错信息增加了 eventMessage.author

qcgm1978 commented 1 year ago

新建一个chat解决了这个问题

Maddaxman commented 1 year ago

新建一个chat解决了这个问题

甚至有些错觉是与内容相关。例如,某些提问的内容会在第一条提问时出现Unexpected message author报错。即使重新建立chat并使用相同的提问内容,仍然会直接出现这个报错。实际上,这只是一个普通的问题而已。