RainEggplant / chatgpt-telegram-bot

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

The new version 2.2.0 seems to be not working #25

Open savokiss opened 1 year ago

savokiss commented 1 year ago

The queue may be stucked, and can't be released.

It always reply You are #{n} in line.

RainEggplant commented 1 year ago

Is this due to network issues (the API is not responding)? Does switching to the previous version resolve the problem?

savokiss commented 1 year ago

Yep, I revert the branch and it's OK now. Note that I use the unofficial mode. While the ChatGPT website is ok, only the telegram respond seems stucked.

RainEggplant commented 1 year ago

It's weird... Mine seems to be working fine. Can you provide more details on how to reproduce this problem?

savokiss commented 1 year ago

Maybe because I've add a fetch polyfill? I am using Node 16 and had to polyfill that. I'll check it later and provide some more detail. Thanks for your attention~ 😄

soyelmismo commented 1 year ago

does the queue is reset when /reset or /reload are triggered? i got it stuck and after reloading the session it still adding to queue

RainEggplant commented 1 year ago

does the queue is reset when /reset or /reload are triggered?

No, /reset and /reload will not reset the queue. The requests in the queue won't be affected. /reset only starts a new conversation for the upcoming messages, and /reload should only be used for the browser API.

i got it stuck and after reloading the session it still adding to queue

What's the version of node you're using? In what circumstances will it get stuck?

soyelmismo commented 1 year ago

idk how it happens, maybe it dont perceive a timeout from the api and it just stop receiving the prompt output and the queue gets the bug

Screenshot_20230301-111431_Nagram

RainEggplant commented 1 year ago

Sometimes the API does not respond. Will add a timeout mechanism to fix this.

savokiss commented 1 year ago

Sometimes the API does not respond. Will add a timeout mechanism to fix this.

Yep, May be the network issue. May not be the Node.js version problem.

Vadko commented 1 year ago

For everyone who is facing issues with order being hanged right now

  1. This is mostly happening on unofficial/browser api. Official api doesnt have this issue
  2. The only way to fix that is to reject hanged requests. That could be done by adding timeoutMs param to the _api.sendMessage (I recommend 30s)

However, we are not currently satisfied with timeout mechanism on chatgpt-api side since it doesnt count onProgress trigger as request succeed, instead, it just waits for stream to close.

I'm currently working on PR for chatgpt-api to add this mechanism and after that fix will be added there. With other nasty feature :D

So, please, use timeoutMs for api as temporary solution, there will be fix soon.

RainEggplant commented 1 year ago

I've added a simple timeout mechanism in #36 as an initial fix. Still waiting for https://github.com/transitive-bullshit/chatgpt-api/pull/444 to be merged.