This pull request introduces functionality allowing users to delete their messages from the chatbot conversation. This feature aims to improve the user experience by enabling the management of conversation flow, particularly useful for removing side questions, clarifications, or typos.
Motivation
Implementing message deletion addresses the need for clearer conversational context, as highlighted in issue #652. Users can now manage their conversation history more effectively, ensuring that only relevant messages influence the chatbot's responses and overall dialogue quality.
Implementation Details
Frontend Changes:
Users can delete any message submitted after the initial prompt, a "Delete" (🗑️) button has been added next to each user's prompt in the chat interface, courtesy of @tjbck.
Although deleted from the visible chat history, these messages are retained within the history object with a deleted=true flag.
Messages flagged as deleted=true are excluded from the payload in subsequent API calls, ensuring that deleted messages do not influence the conversation flow.
Upon deletion, the UI immediately updates to reflect the removal of both the user's message and the corresponding chatbot response, maintaining a clean and relevant conversation thread.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/789
**Author:** [@dannyl1u](https://github.com/dannyl1u)
**Created:** 2/18/2024
**Status:** ✅ Merged
**Merged:** 2/23/2024
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `main` ← **Head:** `feat/delete-message`
---
### 📝 Commits (10+)
- [`40a7ac9`](https://github.com/open-webui/open-webui/commit/40a7ac9caac1e38c04d48f30a13704e1d11dbad1) feat: delete message scaffolding
- [`c3ed6fe`](https://github.com/open-webui/open-webui/commit/c3ed6fe974c5debcd1d4281c2b331c9199db5c42) Update UserMessage.svelte
- [`32c7971`](https://github.com/open-webui/open-webui/commit/32c79713001dc9dbea81412fd1494d4e7376aeeb) add isFirstMessage prop to UserMessage component
- [`60c99a4`](https://github.com/open-webui/open-webui/commit/60c99a44f8cacd687ae0e3cea123365a1506c567) remove user message and response from DOM as pair
- [`cd3cecd`](https://github.com/open-webui/open-webui/commit/cd3cecd2f07101bf8e43fca3094f0977c5e392e3) filter out deleted messages in payload 🗑️
- [`941bcdc`](https://github.com/open-webui/open-webui/commit/941bcdc2e541aaa2e1f1964e43991eff81d0ce5d) Refactor deleteMessage function and update deleteMessagePair usage
- [`632882a`](https://github.com/open-webui/open-webui/commit/632882a5119769ad441c051ee9e72348e2e0d703) add message filtering in +page.svelte to filter out deleted messages in payload 🗑️
- [`51b5940`](https://github.com/open-webui/open-webui/commit/51b594036d028adf62573aa825473fd10286d7af) invoke stopResponse() if user deletes message during response generation
- [`95b8edf`](https://github.com/open-webui/open-webui/commit/95b8edf6b3e1ac53749bddf70488836a931860a1) use cancelChatCompletion API call instead of stopResponse function
- [`a655ccd`](https://github.com/open-webui/open-webui/commit/a655ccdd06aa9b0ebcb270b789589eba920c7098) only cancel chat completion if the deleted message is the most recently sent
### 📊 Changes
**4 files changed** (+161 additions, -98 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/components/chat/Messages.svelte` (+119 -87)
📝 `src/lib/components/chat/Messages/UserMessage.svelte` (+38 -7)
📝 `src/routes/(app)/+page.svelte` (+2 -2)
📝 `src/routes/(app)/c/[id]/+page.svelte` (+2 -2)
</details>
### 📄 Description
# Implement Delete Message Functionality
## Description
This pull request introduces functionality allowing users to delete their messages from the chatbot conversation. This feature aims to improve the user experience by enabling the management of conversation flow, particularly useful for removing side questions, clarifications, or typos.
## Motivation
Implementing message deletion addresses the need for clearer conversational context, as highlighted in issue #652. Users can now manage their conversation history more effectively, ensuring that only relevant messages influence the chatbot's responses and overall dialogue quality.
## Implementation Details
**Frontend Changes**:
- Users can delete any message submitted after the initial prompt, a "Delete" (🗑️) button has been added next to each user's prompt in the chat interface, courtesy of @tjbck.
- Although deleted from the visible chat history, these messages are retained within the `history` object with a `deleted=true` flag.
- Messages flagged as `deleted=true` are excluded from the payload in subsequent API calls, ensuring that deleted messages do not influence the conversation flow.
- Upon deletion, the UI immediately updates to reflect the removal of both the user's message and the corresponding chatbot response, maintaining a clean and relevant conversation thread.
## Demo video
https://youtu.be/UklUb_QMrZM
Resolves #652
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/789
Author: @dannyl1u
Created: 2/18/2024
Status: ✅ Merged
Merged: 2/23/2024
Merged by: @tjbck
Base:
main← Head:feat/delete-message📝 Commits (10+)
40a7ac9feat: delete message scaffoldingc3ed6feUpdate UserMessage.svelte32c7971add isFirstMessage prop to UserMessage component60c99a4remove user message and response from DOM as paircd3cecdfilter out deleted messages in payload 🗑️941bcdcRefactor deleteMessage function and update deleteMessagePair usage632882aadd message filtering in +page.svelte to filter out deleted messages in payload 🗑️51b5940invoke stopResponse() if user deletes message during response generation95b8edfuse cancelChatCompletion API call instead of stopResponse functiona655ccdonly cancel chat completion if the deleted message is the most recently sent📊 Changes
4 files changed (+161 additions, -98 deletions)
View changed files
📝
src/lib/components/chat/Messages.svelte(+119 -87)📝
src/lib/components/chat/Messages/UserMessage.svelte(+38 -7)📝
src/routes/(app)/+page.svelte(+2 -2)📝
src/routes/(app)/c/[id]/+page.svelte(+2 -2)📄 Description
Implement Delete Message Functionality
Description
This pull request introduces functionality allowing users to delete their messages from the chatbot conversation. This feature aims to improve the user experience by enabling the management of conversation flow, particularly useful for removing side questions, clarifications, or typos.
Motivation
Implementing message deletion addresses the need for clearer conversational context, as highlighted in issue #652. Users can now manage their conversation history more effectively, ensuring that only relevant messages influence the chatbot's responses and overall dialogue quality.
Implementation Details
Frontend Changes:
historyobject with adeleted=trueflag.deleted=trueare excluded from the payload in subsequent API calls, ensuring that deleted messages do not influence the conversation flow.Demo video
https://youtu.be/UklUb_QMrZM
Resolves #652
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.