mirror of
https://github.com/zadam/trilium.git
synced 2026-06-27 20:49:08 +02:00
feat(llm): automatic refresh of note title
This commit is contained in:
@@ -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 context
|
||||
const { 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 options
|
||||
const chat = useLlmChat(
|
||||
// onMessagesChange - trigger save
|
||||
@@ -213,7 +217,7 @@ export default function SidebarChat() {
|
||||
return (
|
||||
<RightPanelWidget
|
||||
id="sidebar-chat"
|
||||
title={t("sidebar_chat.title")}
|
||||
title={chatTitle}
|
||||
grow
|
||||
buttons={
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user