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
feat(llm): automatic refresh of note title
Elian Doranb2befb4feb00
diff --git a/apps/client/src/widgets/sidebar/SidebarChat.tsx b/apps/client/src/widgets/sidebar/SidebarChat.tsxindex cb3c4663b9..9aba9dae9e 100644--- a/apps/client/src/widgets/sidebar/SidebarChat.tsx+++ b/apps/client/src/widgets/sidebar/SidebarChat.tsx@@ -9,7 +9,7 @@ import server from "../../services/server.js";import ActionButton from "../react/ActionButton.js";import Dropdown from "../react/Dropdown.js";import { FormListItem } from "../react/FormList.js";-import { useActiveNoteContext } from "../react/hooks.js";+import { useActiveNoteContext, useNote, useNoteProperty } from "../react/hooks.js";import NoItems from "../react/NoItems.js";import ChatInputBar from "../type_widgets/llm_chat/ChatInputBar.js";import ChatMessage from "../type_widgets/llm_chat/ChatMessage.js";@@ -32,6 +32,10 @@ export default function SidebarChat() {// Get the current active note contextconst { noteId: activeNoteId, note: activeNote } = useActiveNoteContext();+ // Reactively watch the chat note's title (updates via WebSocket sync after auto-rename)+ const chatNote = useNote(chatNoteId);+ const chatTitle = useNoteProperty(chatNote, "title") || t("sidebar_chat.title");+// Use shared chat hook with sidebar-specific optionsconst chat = useLlmChat(// onMessagesChange - trigger save@@ -213,7 +217,7 @@ export default function SidebarChat() {return (<RightPanelWidgetid="sidebar-chat"- title={t("sidebar_chat.title")}+ title={chatTitle}growbuttons={<>