From d44c2d3f5aeab25a9405896f48a36082cee5d8ac Mon Sep 17 00:00:00 2001
From: firecoperana <xuqiaowei1124@gmail.com>
Date: Sun, 20 Jul 2025 05:33:55 -0500
Subject: Webui: New Features for Conversations, Settings, and Chat Messages
 (#618)

* Webui: add Rename/Upload conversation in header and sidebar

webui: don't change modified date when renaming conversation

* webui: add a preset feature to the settings #14649

* webui: Add editing assistant messages #13522

Webui: keep the following message while editing assistance response.

webui: change icon to edit message

* webui: DB import and export #14347

* webui: Wrap long numbers instead of infinite horizontal scroll (#14062)
fix sidebar being covered by main content #14082

---------

Co-authored-by: firecoperana <firecoperana>
---
 examples/server/webui/src/components/ChatMessage.tsx | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'examples/server/webui/src/components/ChatMessage.tsx')

diff --git a/examples/server/webui/src/components/ChatMessage.tsx b/examples/server/webui/src/components/ChatMessage.tsx
index 40ea7471..a60fd241 100644
--- a/examples/server/webui/src/components/ChatMessage.tsx
+++ b/examples/server/webui/src/components/ChatMessage.tsx
@@ -20,6 +20,7 @@ export default function ChatMessage({
   onEditMessage,
   onChangeSibling,
   isPending,
+  onContinueMessage,
 }: {
   msg: Message | PendingMessage;
   siblingLeafNodeIds: Message['id'][];
@@ -27,6 +28,7 @@ export default function ChatMessage({
   id?: string;
   onRegenerateMessage(msg: Message): void;
   onEditMessage(msg: Message, content: string): void;
+  onContinueMessage(msg: Message, content: string): void;
   onChangeSibling(sibling: Message['id']): void;
   isPending?: boolean;
 }) {
@@ -112,7 +114,11 @@ export default function ChatMessage({
                 onClick={() => {
                   if (msg.content !== null) {
                     setEditingContent(null);
-                    onEditMessage(msg as Message, editingContent);
+                    if (msg.role === 'user') {
+                      onEditMessage(msg as Message, editingContent);
+                    } else {
+                      onContinueMessage(msg as Message, editingContent);
+                    }
                   }
                 }}
               >
@@ -283,6 +289,15 @@ export default function ChatMessage({
                   🔄 Regenerate
                 </button>
               )}
+              {!isPending && (
+                <button
+                  className="badge btn-mini show-on-hover"
+                  onClick={() => setEditingContent(msg.content)}
+                  disabled={msg.content === null}
+                >
+                   ✍️ Edit
+                </button>
+              )}
             </>
           )}
           <CopyButton
-- 
cgit v1.2.3

