father-bot / chatgpt_telegram_bot

💬 Telegram bot with ChatGPT, Python-based, using OpenAI's API.
https://t.me/chatgpt_karfly_bot
MIT License
5.17k stars 1.81k forks source link

Telegram: Timed out Error #441

Open IgorC601 opened 7 months ago

IgorC601 commented 7 months ago

Everytime i try to run the code of this repo using Docker Compose i get the following error: telegram.error.TimedOut: Timed out I tried using it outside of docker and it ran fine (the code for the database didnt but that was expected) but everytime i try to run it with docker it doesn't work.

Has anyone else got this error and was able to solve it?

strydex commented 6 months ago

Everytime i try to run the code of this repo using Docker Compose i get the following error: telegram.error.TimedOut: Timed out I tried using it outside of docker and it ran fine (the code for the database didnt but that was expected) but everytime i try to run it with docker it doesn't work.

Has anyone else got this error and was able to solve it?

try changing:

update only when 100 new symbols are ready

            if abs(len(answer) - len(prev_answer)) < 100 and status != "finished":

with:

update only when 200 new symbols are ready

            if abs(len(answer) - len(prev_answer)) < 200 and status != "finished":

Basically You can find two strings with these parameters in bot.py, so as I understood this error appears espesically in group chats, and extending update time value actually helped me. It worked and I don't get such an error anymore.