kramcat / CharacterAI

Unofficial Python API for character.ai
https://docs.kram.cat
MIT License
434 stars 61 forks source link

TypeError: string indices must be integers Pls Help! #17

Closed RealUnrealGameDev closed 1 year ago

RealUnrealGameDev commented 1 year ago

Hey, I keep getting this error every time I try to get a response from character. Pls help Traceback (most recent call last): File "d:\Work\LiveWhisper-main\char.py", line 12, in <module> print(f"{data['src_char']['participant']['name']}: {data['replies'][0]['text']}") TypeError: string indices must be integers

JensRosaman commented 1 year ago

This might be due to getting a faulty reply from the server when calling this line: data = await client.chat.send_message(char, message, wait=True). When you get a faulty reply the resulting dict looks like this:

{"abort": true, "error": "500 Internal Server Error" }

Which would explain the resulting error occuring when trying to index it.

kramcat commented 1 year ago

chat.send_message() fixed on v0.6.0