Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/AI chat: allow the user to rename a sidebar chat
Adorian Dorana5a304e0d4b0
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex c35519613d..c6b70cc03f 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -2104,6 +2104,9 @@"recent_chats": "Recent chats","no_chats": "No previous chats","view_all_chats": "View all chats",+ "rename": "Rename",+ "rename_title": "Rename chat",+ "rename_message": "Enter a new name for this chat:","delete": "Delete","delete_chat": "Delete chat","delete_confirm": "Delete this chat? This can't be undone."diff --git a/apps/client/src/widgets/sidebar/SidebarChat.tsx b/apps/client/src/widgets/sidebar/SidebarChat.tsxindex 084211ec37..988a627777 100644--- a/apps/client/src/widgets/sidebar/SidebarChat.tsx+++ b/apps/client/src/widgets/sidebar/SidebarChat.tsx@@ -273,6 +273,26 @@ export default function SidebarChat() {}}, [chatNoteId]);+ const handleRenameChat = useCallback(async () => {+ if (!chatNoteId) return;++ const newTitle = await dialog.prompt({+ title: t("sidebar_chat.rename_title"),+ message: t("sidebar_chat.rename_message"),+ defaultValue: chatNote?.title ?? ""+ });+ // null = cancelled; ignore empty or unchanged names.+ const trimmed = newTitle?.trim();+ if (!trimmed || trimmed === chatNote?.title) return;++ try {+ // The header title updates reactively once the change syncs back to froca.+ await server.put(`notes/${chatNoteId}/title`, { title: trimmed });+ } catch (err) {+ console.error("Failed to rename chat:", err);+ }+ }, [chatNoteId, chatNote]);+return (<RightPanelWidgetid="sidebar-chat"@@ -351,6 +371,14 @@ export default function SidebarChat() {>{t("sidebar_chat.save_chat")}</FormListItem>+ <FormListItem+ icon="bx bx-edit-alt"+ onClick={() => void handleRenameChat()}+ disabled={!chatNoteId}+ >+ {t("sidebar_chat.rename")}+ </FormListItem>+ <FormDropdownDivider /><FormListItemicon="bx bx-trash"onClick={() => { if (chatNoteId) void handleDeleteChat(chatNoteId); }}