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

Chat.deleteMessagesBulk() seems doesn't work #151

Closed
dappgbut opened this issue Feb 20, 2024 · 10 comments
Closed

Chat.deleteMessagesBulk() seems doesn't work #151

dappgbut opened this issue Feb 20, 2024 · 10 comments

Comments

@dappgbut
Copy link

Hello there, i tried to delete a messages using chat.deleteMessagesBulk() but somehow it returns with no errors and on the website itself, the messages didn't get deleted

Here is my code like (I recently making a chatbot using this package):

if (cmd == "deleteall") {
			(async () => {
				const characterId = "CharacterID";
				const chat = await characterai.createOrContinueChat(characterId);
				await chat.deleteMessagesBulk(50,false); //tried ...Bulk() ...Bulk(amount = 50, descending = false) and ...Bulk(50,false)
				console.log('passed 1');
			})
		}

Maybe are there something wrong on my code? or it's from the package-side (I saw some old issue about DeleteMessage, Like issue #14) ?

Any answers are appreciated, thank you.

@realcoloride
Copy link
Owner

Will investigate and try to check whats going on.

I'll keep you updated

@dappgbut
Copy link
Author

Okay, Thank you. I'll be looking foward to this issue.

@realcoloride
Copy link
Owner

Hello, after investigation, it seems like they have (again) silently changed how their endpoints work
image

It was previously ids_to_delete, now it is uuids_to_delete
image

I'll keep you updated and try to push a fix soon.

@realcoloride
Copy link
Owner

Hello, I've pushed the following commit: 1a9c1a4

Which introduces fixes for deleting messages, rewrote the message bulk deleting to be more accurate & added uuids.
Note: you now need to use message uuids instead of ids to delete specific messages.

Could you try it and tell me how it goes?

@dappgbut
Copy link
Author

Hello, Sorry for the late response...

Thank you for the fixes!.. i'll try it soon in about a few hours when I got into my computer, and give you how it will goes...

@realcoloride
Copy link
Owner

Hello! Let me know.
Make sure to clone the repo and replace it in the node_modules folder.

@dappgbut
Copy link
Author

Hello, thank you for waiting...

I tried to do it outside of my chatbot code and separate the code into this:

const sessiontokenygy = "session token";

(async () => {
    await characterai.authenticateWithToken(sessiontokenygy);
    const characterId = "CharacterId";

    const chat = await characterai.createOrContinueChat(characterId);

    console.log("start deleting");
    await chat.deleteMessagesBulk(2,false,false);
    console.log("delete success");
})();

The console.log returns two of them, but when i check on the character ai website, the messages didn't get deleted...

start deleting
delete success

Any suggestions for this?...

@realcoloride
Copy link
Owner

are you looking at the old or new interface? (chat/chat2, see url)

@dappgbut
Copy link
Author

After a bit of research, the website version does all the message deleted... I've been using the mobile version all the time to check it by the way... where it's kinda buggy...

Sorry my bad... but i'm glad it's working now...

Thank you for your patience in dealing with this issue!! 😀

@realcoloride
Copy link
Owner

No problem. Again the fact you've seen new changes is because its on the new ui, synced to the mobile one, using websockets.

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

2 participants