kramcat / CharacterAI

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

Very amazing idea but couldn't get it to work at all #50

Open louissypher800k opened 1 year ago

louissypher800k commented 1 year ago

Its beautiful but I couldn't get it to work at all. I think you need to include a example script that actually works instead of just posting pieces of code on the gitbook. I give up. I am just going to build my own quick and dirty scraper with selenium and I'll check back later.

forbenaj commented 1 year ago

Hello! I'm making it work just fine. What you're having trouble with? This would be a basic chat script:

from characterai import PyCAI

my_token = '39b1fa309f245479a9440cebb1af394399ac90a' # This is your personal token, let me know if you need help getting yours

# Create the client
client = PyCAI(my_token)

#Character ID, found in the url of the character
char = 'OYYf4iM6fjt9eZ72oXRsY3UGPeXd9Y-uJwfAjF5JAwk' # SM64 Mario

message = input("Your message: ") # Wait for user input...

#Send the message, wait for the response
response = client.chat.send_message(char, message)

#Get last response
last_msg = response['replies'][0]['text'] # Not sure what the "response" object looks like, but this get's the message sent by the character

print(last_msg)

let me know what you'd need help with

kramcat commented 1 year ago

why you are showing the token

forbenaj commented 1 year ago

i broke it dw 🧙‍♂️

louissypher800k commented 1 year ago

Hello! I'm making it work just fine. What you're having trouble with? This would be a basic chat script:

from characterai import PyCAI

my_token = '39b1fa309f245479a9440cebb1af394399ac90a' # This is your personal token, let me know if you need help getting yours

# Create the client
client = PyCAI(my_token)

#Character ID, found in the url of the character
char = 'OYYf4iM6fjt9eZ72oXRsY3UGPeXd9Y-uJwfAjF5JAwk' # SM64 Mario

message = input("Your message: ") # Wait for user input...

#Send the message, wait for the response
response = client.chat.send_message(char, message)

#Get last response
last_msg = response['replies'][0]['text'] # Not sure what the "response" object looks like, but this get's the message sent by the character

print(last_msg)

let me know what you'd need help with

I just built a scraper...I don't know. Documentation that is clear would be nice. It shouldn't take longer to learn an API than it does to write one.

kramcat commented 12 months ago

try on v0.8.0