pedrojlazevedo / twitch-chatgpt

ChatGPT Implementation for Twitch Streamers
67 stars 1.63k forks source link

Error Connecting To Remote Server #26

Open proximasix opened 11 months ago

proximasix commented 11 months ago

Both bots produce this error quite often. Sometimes there are other errors described in this section, but this particular error is the most common. Unfortunately, I was never able to identify the pattern of its appearance. I assume that the problem may be that sometimes the bot formulates a message that is too long, and while it is being cut off, the bot timeout passes, which is why it throws an error. Perhaps you have some progress in learning and fixing this issue?

takimate commented 11 months ago

I write this in my file context: "Important you can only respond with 380 or less characters!". I rarely get this error after I added this.

Meredith2k5 commented 11 months ago

Similar issue, the errors less prominent if you include the above character limit but if you ask the chatbot to write a poem, song, story etc it hits the character limit almost every time. If you include 'less than 380 characters' in the Twitch chat prompt it will work however. Anyone figured a way around this?

pedrojlazevedo commented 11 months ago

I'm currently working on a solution.

Can be more complex, but I'm creating a specific twitch bot to actually reply instead of nightbot.

Twitch has the answer limit on 399 characters. Nightbot has a timeout of 10sec. Sometimes OpenAI endpoint takes longer to answer.

I will let you know as soon as I push the changes to main :)

proximasix commented 11 months ago

I'm currently working on a solution.

Can be more complex, but I'm creating a specific twitch bot to actually reply instead of nightbot.

Twitch has the answer limit on 399 characters. Nightbot has a timeout of 10sec. Sometimes OpenAI endpoint takes longer to answer.

I will let you know as soon as I push the changes to main :)

In case this information is useful: if you change GPT_MODE to PROMPT, then this error does not appear and the bot gives quick answers to EVERY request. However, the bot itself, due to a different model (davinci), seems less “smart”, responds rather primitively and does not take on the “character” from file_context.txt so well. With all this, it becomes significantly more expensive, so this is a rather dubious compromise.

yaorenmao commented 10 months ago

That's how i solved it: ` let mao_res = "wait ~25sec > !gptr" //save response: mao_res = sliced_agent_response res.send(sliced_agent_response)

//repeat response: app.all('/repeat/', (req, res) => { res.send(mao_res) }) `

have to type !gptr if error connecting to server

takimate commented 10 months ago

That's how i solved it: ` let mao_res = "wait ~25sec > !gptr" //save response: mao_res = sliced_agent_response res.send(sliced_agent_response)

//repeat response: app.all('/repeat/', (req, res) => { res.send(mao_res) }) `

have to type !gptr if error connecting to server

Where do you put this?

yaorenmao commented 10 months ago

Where do you put this? in index.js and you need to fetch it in your bot like continue command(nightbot example): !gptcontinue $(urlfetch https://your-url.cyclic.cloud/repeat)

Meredith2k5 commented 10 months ago

Where do you put this? in index.js and you need to fetch it in your bot like continue command(nightbot example): !gptcontinue $(urlfetch https://your-url.cyclic.cloud/repeat)

Hmm I had no luck with this, I did take a look at your .index.js but couldn't figure it out. Im still learning to code so I may have put it in the wrong location however.

Ive noticed that !continue works even if the bot times out, would it be possible to save the first message as a variable, then recall that variable in the $(urlfetch https://your-url.cyclic.app/variable)? That way it functions as normal but if you do get this error you can simply !recall or whatever you name the command in streamelements/nightbot.

Maybe thats what yaorenmao intended, im not sure how it works so only throwing ideas out there. Ive seen another implementation of Chat GPT on twitch that seems to do this though.

Also is there a way to get this to work with streamerbot? Ill probably do some digging at some point in how to implement apis and url answers in streamerbot at some point, most of the documentation are for the older version though unfortunately.