RainEggplant / chatgpt-telegram-bot

A ChatGPT bot for Telegram based on Node.js. Support both browserless and browser-base APIs.
MIT License
323 stars 97 forks source link

[Bug]: text output to telegram comes from two chats chatgpt #46

Open leyalton opened 1 year ago

leyalton commented 1 year ago

Not a duplicate issue

Verify ChatGPT service is operational

Bot version

v2.4.2

API type

browser

Environment details

I use node.js versions 9.6.2. I run the program using npm commands and without using docker.

Describe the Bug

When issuing a telegram response, the bot creates 2 chats in the gp chat and first issues a response from the first chat, then erases it and issues a response from the second chat.

To Reproduce

I run everything according to the instructions:

then i just make a request in a telegram bot and this situation occurs

Logs

chatgpt-telegram-bot@2.4.2 start C:\project\chatgpt node --experimental-loader=extensionless dist/index.js

(node:20076) ExperimentalWarning: Custom ESM Loaders is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) 30.03.2023, 00:34:29 🔮 ChatGPT API has started... 30.03.2023, 00:34:30 🤖 Bot @my_bot has started... 30.03.2023, 00:35:45 📩 Message from @account (1494399999) in private chat: hi, write a 2000-character text on the topic of data structures and Java algorithms chatgpt sendMessage error; retrying... ProtocolError: Runtime.callFunctionOn timed out. 30.03.2023, 00:36:50 ⛔️ ChatGPT API error: ProtocolError: Runtime.callFunctionOn timed out.

Additional context

photo_2023-03-30_00-47-07 photo_2023-03-30_00-47-08 these screenshots show how under 1 request, the first answer option appears first, and then the second

RainEggplant commented 1 year ago

I don't know if this is related to the timeout mechanism. If this only happens for long responses, you can try to increase the api.browser.timeoutMs and see if it resolves the problem.

This could also be a problem with the browser-based API, which has not been maintained for a long time. So I suggest you switch to the official API.