feat: add message deletion from a session thread (#287)#395
Open
anandsundaramoorthysa wants to merge 1 commit into
Open
feat: add message deletion from a session thread (#287)#395anandsundaramoorthysa wants to merge 1 commit into
anandsundaramoorthysa wants to merge 1 commit into
Conversation
Adds the ability to delete a single message from a chat thread (previously
only "clear all messages" existed).
Backend:
- db_service.delete_message(session_id, message_id): session-scoped delete
that also decrements the session's message_count (clamped at 0)
- get_messages_full now returns each message's id so the client can target
a specific message
- DELETE /api/sessions/{session_id}/messages/{message_id} route (404 when
the message doesn't exist in the session)
- Tests: test_delete_single_message and test_delete_message_not_found
Frontend:
- api.deleteMessage(sessionId, messageId)
- Use the real message id from the backend (instead of the array index)
- ChatWindow: a delete control on each message with a lightweight inline
"Delete? Yes/No" confirm (no window.confirm), with optimistic removal
Verified: full pytest suite passes (73 tests) and a live end-to-end check
(delete a message in the UI -> removed from the thread and the DB, with the
sidebar count kept in sync).
|
@anandsundaramoorthysa is attempting to deploy a commit to the Darshan's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adds the ability to delete a single message from a session thread. Previously the app could only "clear all messages" in a session — there was no way to remove one message.
Closes #287
Changes
Backend
db_service.delete_message(session_id, message_id)— session-scoped delete (a message can only be removed from its own thread) that also decrements the session'smessage_count(clamped at 0).get_messages_fullnow returns each message'sid, so the client can target a specific message (it previously omitted the id).DELETE /api/sessions/{session_id}/messages/{message_id}→404when the message doesn't exist in that session.test_delete_single_messageandtest_delete_message_not_found.Frontend
api.deleteMessage(sessionId, messageId).ChatWindow: a delete control on every message (user and assistant) with a lightweight inline "Delete? Yes / No" confirm (nowindow.confirm, consistent with the project's move away from native dialogs), and optimistic removal for instant feedback.Verification
Notes
session_id, so a crafted request can't delete another session's message.