feat: add message deletion from a session thread (#287)#395
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. |
…sage # Conflicts: # frontend/src/components/ChatWindow.jsx
|
Resolved the merge conflict with |
|
@imDarshanGK this is conflict-free and green now (tests passing) — could you please review it when you get a chance? Happy to address any feedback. Thanks! |
|
@anandsundaramoorthysa resolve conflicts |
…sage # Conflicts: # frontend/src/App.jsx # frontend/src/components/ChatWindow.jsx
|
@imDarshanGK conflicts resolved (in |
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.