Closed mishl-dev closed 1 year ago
The error seems to be happening in the __load_json
method of the aiassist.py
file. It appears that the code is trying to split a string using the rsplit function and access the second element of the resulting list, but there might not be a second element in the list.
`Task exception was never retrieved future: <Task finished name='Task-36' coro=<on_message..generate_response_in_thread() done, defined at /workspace/Discord-AI-Chatbot/main.py:383> exception=IndexError('list index out of range')>
Traceback (most recent call last):
File "/workspace/Discord-AI-Chatbot/main.py", line 386, in generate_response_in_thread
response = await generate_response(prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/Discord-AI-Chatbot/main.py", line 142, in generate_response
response = await aiassist.Completion.create(prompt=prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/Discord-AI-Chatbot/model/aiassist.py", line 28, in create
response = Completion.__load_json(content)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/Discord-AI-Chatbot/model/aiassist.py", line 34, in __load_json
split = decode_content.rsplit("\n", 1)[1]