node-chatgpt-api icon indicating copy to clipboard operation
node-chatgpt-api copied to clipboard

Unexpected message author.

Open zengbo opened this issue 2 years ago • 2 comments

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):

  • OS: [Alpine]
  • Version [e.g. 18]

Package version (please complete the following information):

  • [1.34.0]

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

zengbo avatar Apr 08 '23 03:04 zengbo

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

qcgm1978 avatar Apr 09 '23 12:04 qcgm1978

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

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

Maddaxman avatar Apr 20 '23 02:04 Maddaxman