-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Feature/chat history deletion clean #3839
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
Closed
Icarus-B4
wants to merge
3
commits into
block:main
from
Icarus-B4:feature/chat-history-deletion-clean
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { useState } from 'react'; | ||
| import { Button } from '../ui/button'; | ||
| import { | ||
| Dialog, | ||
| DialogContent, | ||
| DialogDescription, | ||
| DialogFooter, | ||
| DialogHeader, | ||
| DialogTitle, | ||
| } from '../ui/dialog'; | ||
| import { Loader2, Trash2 } from 'lucide-react'; | ||
|
|
||
| interface DeleteSessionModalProps { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| onConfirm: () => Promise<void>; | ||
| sessionName: string; | ||
| } | ||
|
|
||
| export function DeleteSessionModal({ | ||
| isOpen, | ||
| onClose, | ||
| onConfirm, | ||
| sessionName, | ||
| }: DeleteSessionModalProps) { | ||
| const [isDeleting, setIsDeleting] = useState(false); | ||
|
|
||
| const handleConfirm = async () => { | ||
| setIsDeleting(true); | ||
| try { | ||
| await onConfirm(); | ||
| onClose(); | ||
| } catch (error) { | ||
| console.error('Error deleting session:', error); | ||
| } finally { | ||
| setIsDeleting(false); | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <Dialog open={isOpen} onOpenChange={onClose}> | ||
| <DialogContent className="sm:max-w-[425px]"> | ||
| <DialogHeader> | ||
| <DialogTitle className="flex items-center gap-2"> | ||
| <Trash2 className="h-5 w-5 text-destructive" /> | ||
| Delete Session | ||
| </DialogTitle> | ||
| <DialogDescription> | ||
| Are you sure you want to delete the session "{sessionName}"? This action cannot be undone. | ||
| </DialogDescription> | ||
| </DialogHeader> | ||
| <DialogFooter> | ||
| <Button variant="outline" onClick={onClose} disabled={isDeleting}> | ||
| Cancel | ||
| </Button> | ||
| <Button | ||
| variant="destructive" | ||
| onClick={handleConfirm} | ||
| disabled={isDeleting} | ||
| > | ||
| {isDeleting ? ( | ||
| <> | ||
| <Loader2 className="mr-2 h-4 w-4 animate-spin" /> | ||
| Deleting... | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <Trash2 className="mr-2 h-4 w-4" /> | ||
| Delete Session | ||
| </> | ||
| )} | ||
| </Button> | ||
| </DialogFooter> | ||
| </DialogContent> | ||
| </Dialog> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You say clean ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry im new in PR.
Do i have to remove the comments?
Its not allowed to use AI?
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Icarus-B4 - again I like your enthusiasm and you are encourage to use AI!
however (and maybe we should post some guidelines here) it is your responsibility to make sure the PR the AI produces is actually ready for review. so you can't have comments in there that the AI left there (like "you could show a toast here") or in this case left overs from the previous PR (windowOpacity is not related to the current change). it would also behoove you to check out @zanesq link to the other implementation of this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clear guidance. Good point – I'll be more careful to clean up my PRs in the future and review existing implementations beforehand. I'll checked out @zanesq's link. its "Privat"
Any way i close the PR and let the professionals work.