Closed kwikcoins closed 1 year ago
I have got the bot somewhat working but it seems when it needs to call gpt it doesnt respond.
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'
@DSwutang Check this
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.
@DSwutang answer will solve your problem.
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.