Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Character limit #19

Open
avrcal opened this issue Feb 6, 2025 · 13 comments
Open

Character limit #19

avrcal opened this issue Feb 6, 2025 · 13 comments

Comments

@avrcal
Copy link

avrcal commented Feb 6, 2025

Hi i dont know if the repository dead or no but i have problem with it

It only puts the 50% of the repsond instead of the repsond of the c.ai message

And if you wonder why i care about this because im working on discord bot about c.ai bot and people who uses it wants the bot to put the full repsond

Thanks

@Xtr4F
Copy link
Owner

Xtr4F commented Feb 6, 2025

Hi, the repository is alive.

Could you please provide me with your code that you think is causing this problem?

@avrcal
Copy link
Author

avrcal commented Feb 6, 2025

async def send_ai_message(channel_id, message_content, user_name):
    chat_data = active_chats.get(channel_id)
    if not chat_data or not chat_data["is_active"]:
        return None

    client = chat_data["client"]
    character_id = chat_data["character_id"]
    chat_id = chat_data["chat_id"]

    formatted_message = f"[{user_name}]: {message_content}"
    
    answer = await client.chat.send_message(
        character_id, chat_id, formatted_message,
        streaming=True 
    )
    
    printed_length = 0
    full_response = ""
    
    async for message in answer:
        if printed_length == 0:
            full_response += f"[{message.author_name}]: "
        text = message.get_primary_candidate().text
        full_response += text[printed_length:]
        printed_length = len(text)
    
    return full_response.strip()

@Xtr4F
Copy link
Owner

Xtr4F commented Feb 6, 2025

Try to use it without streaming

async def send_ai_message(channel_id, message_content, user_name):
    chat_data = active_chats.get(channel_id)
    if not chat_data or not chat_data["is_active"]:
        return None

    client = chat_data["client"]
    character_id = chat_data["character_id"]
    chat_id = chat_data["chat_id"]

    formatted_message = f"[{user_name}]: {message_content}"
    
    answer = await client.chat.send_message(
        character_id, chat_id, formatted_message
    )
    
    text = answer.get_primary_candidate().text
    return text.strip()

@avrcal
Copy link
Author

avrcal commented Feb 6, 2025

I tried it
It says there is no full_response
After i added full response it doesnt send anything in the c.ai chat

Image

@avrcal
Copy link
Author

avrcal commented Feb 6, 2025

Nvm i fixed it

But still it has character limit

Can you fix it by changing library files?

@Xtr4F
Copy link
Owner

Xtr4F commented Feb 6, 2025

Oh, sorry, my bad. It should return text.strip() instead of full_response.strip()

I'm not quite sure what character limit you've encountered, the Library is definitely working as it should.

@avrcal
Copy link
Author

avrcal commented Feb 6, 2025

Image here is explain

@avrcal
Copy link
Author

avrcal commented Feb 7, 2025

Uh did you forgot about the issue or you dont know the solution?

@Xtr4F
Copy link
Owner

Xtr4F commented Feb 7, 2025

Could you please, for example, print the text that you are getting in response from the character using my library before sending this message to discord (i.e. in the send_ai_message function before return do print(text) ) and compare it with the actual character response message on the website?

If they are different then that's really weird and I'll try to figure out what's wrong, if they are the same then the problem is somewhere in your code.

@avrcal
Copy link
Author

avrcal commented Feb 7, 2025

on discord

Image

on console

Image

on c.ai

Image

@avrcal
Copy link
Author

avrcal commented Feb 9, 2025

So there is no solution? Im still waitting idc if this takes months

@Xtr4F
Copy link
Owner

Xtr4F commented Feb 10, 2025

I've been really busy lately, sorry for the long response time.

It looks more like a problem on the c.ai side. I tried asking the same bot to write me some code and it generates something like

Image

and then stops.

In other scenarios everything is fine and responses are complete. Maybe c.ai is just incapable of generating code?

@Alichan83737
Copy link

hello..having the same issue here
i think it's like a limit from c.ai
i use the token normally for 1 month..sometimes a week..then it switches to an older model with dumb responses and message limit
the only solution i use is just switching to another account
it's not really a solution tho but it works..
not sure if it's a limit for the api or just a limit from c.ai so we pay for plus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants