flynnoct / chatgpt-telegram-bot

Telegram bot implemented by OFFICIAL OpenAI ChatGPT API (gpt-3.5-turbo, released on 2023-03-01)
MIT License
181 stars 43 forks source link

Bot Unresponsive #82

Closed kwikcoins closed 1 year ago

kwikcoins commented 1 year ago

I have installed and configured the config.json with my api key and bot key. I run the bot on terminal and it says the bot has started, but when I try to interact with the bot in telegram it does nothing.

kwikcoins commented 1 year ago

I have got the bot somewhat working but it seems when it needs to call gpt it doesnt respond. image

kwikcoins commented 1 year ago

some of my logs

Traceback (most recent call last): File "/home/codespace/.python/current/lib/python3.10/site-packages/telegram/ext/_application.py", line 1104, in process_update await coroutine File "/home/codespace/.python/current/lib/python3.10/site-packages/telegram/ext/_handler.py", line 141, in handle_update return await self.callback(update, context) File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/telegram_message_parser.py", line 121, in chat_text response = self.message_manager.get_response( File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/message_manager.py", line 38, in get_response self.userDict[id].update(t, message, "user") File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/chat_session.py", line 34, in update if (source == "user") and (contactTime - self.latestTime > ConfigLoader.get("wait_time")) : TypeError: '>' not supported between instances of 'float' and 'str' 2023-04-24 06:30:07,229 - TelegramMessageParser - INFO - Get a chat message from user: 1482109310 2023-04-24 06:30:07,635 - telegram.ext._application - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last): File "/home/codespace/.python/current/lib/python3.10/site-packages/telegram/ext/_application.py", line 1104, in process_update await coroutine File "/home/codespace/.python/current/lib/python3.10/site-packages/telegram/ext/_handler.py", line 141, in handle_update return await self.callback(update, context) File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/telegram_message_parser.py", line 121, in chat_text response = self.message_manager.get_response( File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/message_manager.py", line 38, in get_response self.userDict[id].update(t, message, "user") File "/workspaces/codespaces-blank/chatgpt-telegram-bot/src/chat_session.py", line 34, in update if (source == "user") and (contactTime - self.latestTime > ConfigLoader.get("wait_time")) : TypeError: '>' not supported between instances of 'float' and 'str'

flynnoct commented 1 year ago

@DSwutang Check this

DSwutang commented 1 year ago

It seems that the issue is caused by the wait_time field in config.json being filled with a string. We currently do not have an automatic check for config types. You can modify the relevant part of the config field to the following content: ... "enable_voice": true, "wait_time": 600, "enable_dalle": true, ... The value filled after wait_time should be an integer or a float, adding quotes may cause it to be identified as a string, which could be the cause of the problem you encountered.

flynnoct commented 1 year ago

@DSwutang answer will solve your problem.