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

Allow users to delete chat entries. #1210

Closed
Prezombie opened this issue May 28, 2024 · 11 comments · Fixed by #1240
Closed

Allow users to delete chat entries. #1210

Prezombie opened this issue May 28, 2024 · 11 comments · Fixed by #1240
Labels
back This issue is related to the Svelte backend or the DB enhancement New feature or request front This issue is related to the front-end of the app. good first issue Good for newcomers

Comments

@Prezombie
Copy link

It's rather annoying how there's no way to delete single chat entries, only edit your own or regenerate the AI response. Especially considering loading an old chat involves fiddling with every node that was edited or regenerated to get to the current position.

@nsarrazin nsarrazin added enhancement New feature or request front This issue is related to the front-end of the app. back This issue is related to the Svelte backend or the DB good first issue Good for newcomers labels May 31, 2024
@nsarrazin
Copy link
Collaborator

Hi, I think that makes sense, if someone feels like tackling it feel free! Otherwise I might take a look when I have time

@omesh-omg
Copy link

hello @nsarrazin and @Prezombie can I work on this

@nsarrazin
Copy link
Collaborator

nsarrazin commented Jun 1, 2024

Sure thing! Would be a nice feature to see.

How about showing a trash icon if a message has more than 1 children ? Screenshot from 2024-06-01 06-49-37

Then you would need a deleteBranch form action in src/routes/conversation/[id]/+page.server.ts which sends the message ID in the form

The delete should delete every message in conversation.messages that contain the message ID in their ancestors property, as well as the message itself. That should do the trick! Let me know if you need more details

@omesh-omg
Copy link

just built the project locally and went through the code do we have a icon library to use for the delete icon or should I use some random icon there?

@nsarrazin
Copy link
Collaborator

I think you can use the trashcan icon we use for deleting conversations

@krakenftw
Copy link
Contributor

I have added the basic things needed and created the action, my question is how do i send the Message.id form page to deleteBranch. stuck here : /

@nsarrazin
Copy link
Collaborator

nsarrazin commented Jun 1, 2024

I have added the basic things needed and created the action, my question is how do i send the Message.id form page to deleteBranch. stuck here : /

You could wrap the button in a form with an input type='hidden' with name messageId and value message.id to send the data to the form action.

Feel free to open a draft PR and I can help review there 😄

@krakenftw
Copy link
Contributor

wanted a bit of clarification on this, does deleteBranch delete the whole message including the regenerated ones?

@nsarrazin
Copy link
Collaborator

Just the current branch, so if you're on 1/12 for example, afterwards there should only be 11 branches left.

But it should delete any message that comes after the one you're deleting in the DB (since they can't be shown anyway, that's why you filter on the ancestors property). And the option shouldn't be visible if you only have one branch. (only show if you see the < 1/2 > indicator)

@krakenftw
Copy link
Contributor

krakenftw commented Jun 1, 2024

can you have a look at this once? @nsarrazin
#1239

@omesh-omg
Copy link

okay @krakenftw you can work on this

krakenftw added a commit to krakenftw/chat-ui that referenced this issue Jun 2, 2024
nsarrazin added a commit that referenced this issue Jun 3, 2024
* feat: delete branch #1210

* removed some files

* lint

* types & error handling

* Improve query efficiency & add auth check

* Icon styling

* make it hover only

---------

Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
ice91 pushed a commit to ice91/chat-ui that referenced this issue Oct 30, 2024
* feat: delete branch huggingface#1210

* removed some files

* lint

* types & error handling

* Improve query efficiency & add auth check

* Icon styling

* make it hover only

---------

Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back This issue is related to the Svelte backend or the DB enhancement New feature or request front This issue is related to the front-end of the app. good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants