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(sidebar/llm): add an option to view all the chats
Elian Doranb01154823977
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 0e186ff340..b6fb1df575 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1821,7 +1821,8 @@"empty_state": "Start a conversation","history": "Chat history","recent_chats": "Recent chats",- "no_chats": "No previous chats"+ "no_chats": "No previous chats",+ "view_all_chats": "View all chats"},"shared_switch": {"shared": "Shared",diff --git a/apps/client/src/widgets/sidebar/SidebarChat.tsx b/apps/client/src/widgets/sidebar/SidebarChat.tsxindex 8f16b24133..7c6f247f14 100644--- a/apps/client/src/widgets/sidebar/SidebarChat.tsx+++ b/apps/client/src/widgets/sidebar/SidebarChat.tsx@@ -3,13 +3,14 @@ import "./SidebarChat.css";import type { Dropdown as BootstrapDropdown } from "bootstrap";import { useCallback, useEffect, useRef, useState } from "preact/hooks";+import appContext from "../../components/app_context.js";import dateNoteService, { type RecentLlmChat } from "../../services/date_notes.js";import { t } from "../../services/i18n.js";import server from "../../services/server.js";import { formatDateTime } from "../../utils/formatters";import ActionButton from "../react/ActionButton.js";import Dropdown from "../react/Dropdown.js";-import { FormListItem } from "../react/FormList.js";+import { FormDropdownDivider, FormListItem } from "../react/FormList.js";import { useActiveNoteContext, useNote, useNoteProperty, useSpacedUpdate } from "../react/hooks.js";import ChatInputBar from "../type_widgets/llm_chat/ChatInputBar.js";import ChatMessageList from "../type_widgets/llm_chat/ChatMessageList.js";@@ -200,6 +201,11 @@ export default function SidebarChat() {}}, []);+ const handleViewAllChats = useCallback(() => {+ historyDropdownRef.current?.hide();+ appContext.tabManager.openInNewTab("_llmChat", "_llmChat", true);+ }, []);+const handleSelectChat = useCallback(async (noteId: string) => {historyDropdownRef.current?.hide();@@ -267,6 +273,13 @@ export default function SidebarChat() {</FormListItem>)))}+ <FormDropdownDivider />+ <FormListItem+ icon="bx bx-folder-open"+ onClick={handleViewAllChats}+ >+ {t("sidebar_chat.view_all_chats")}+ </FormListItem></Dropdown><ActionButtonicon="bx bx-save"