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

can't work #2

Closed xinmans closed 1 year ago

xinmans commented 1 year ago

An exception was raised while handling an update update = { "update_id": 856662397, "message": { "chat": { "id": 915625592, "type": "private", "last_name": "L", "first_name": "S", "username": "wangxun0712" }, "text": "where is china", "group_chat_created": false, "entities": [], "new_chat_members": [], "new_chat_photo": [], "message_id": 5, "delete_chat_photo": false, "caption_entities": [], "date": 1670847311, "supergroup_chat_created": false, "photo": [], "channel_chat_created": false, "from": { "is_bot": false, "username": "wangxun0712", "first_name": "S", "last_name": "L", "id": 915625592, "language_code": "zh-hans" } } }

Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/telegram/ext/_application.py", line 945, in process_update await coroutine File "/usr/local/lib/python3.8/site-packages/telegram/ext/_handler.py", line 135, in handle_update return await self.callback(update, context) File "bot.py", line 33, in prompt_handle r = chatgpt.get_chat_response(prompt) File "/usr/local/lib/python3.8/site-packages/revChatGPT/revChatGPT.py", line 54, in get_chat_response response = json.loads(response) File "/usr/local/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 3 (char 2)

karfly commented 1 year ago

I switched the code to GPT-3.5 engine. Try it now