Skip to content

Build your personal knowledge base with Trilium Notes

chore(llm): improve button for note access

Elian Doran46dd500d37be
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
index 8fb81a7997..207f7a15d5 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
@@ -2,6 +2,7 @@ import type { RefObject } from "preact";
import { t } from "../../../services/i18n.js";
import ActionButton from "../../react/ActionButton.js";
+import Button from "../../react/Button.js";
import Dropdown from "../../react/Dropdown.js";
import { FormDropdownDivider, FormDropdownSubmenu, FormListItem, FormListToggleableItem } from "../../react/FormList.js";
import type { UseLlmChatReturn } from "./useLlmChat.js";
@@ -160,18 +161,18 @@ export default function ChatInputBar({
/>
</Dropdown>
{activeNoteId && activeNoteTitle && (
- <button
- type="button"
+ <Button
+ text={activeNoteTitle}
+ icon={isNoteContextEnabled ? "bx-file" : "bx-file-blank"}
+ kind="lowProfile"
+ size="micro"
className={`llm-chat-note-context ${isNoteContextEnabled ? "active" : ""}`}
onClick={handleNoteContextToggle}
disabled={chat.isStreaming}
title={isNoteContextEnabled
? t("llm_chat.note_context_enabled", { title: activeNoteTitle })
: t("llm_chat.note_context_disabled")}
- >
- <span className={`bx ${isNoteContextEnabled ? "bx-file" : "bx-file-blank"}`} />
- <span className="llm-chat-note-context-title">{activeNoteTitle}</span>
- </button>
+ />
)}
{chat.lastPromptTokens > 0 && (
<div
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
index c1e63b6402..dcb042a5e7 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
@@ -311,46 +311,22 @@
}
/* Note context toggle */
-.llm-chat-note-context {
- display: flex;
- align-items: center;
- gap: 0.375rem;
- padding: 0.25rem 0.5rem;
- border: none;
- border-radius: 4px;
- background: transparent;
- color: var(--muted-text-color);
- font-family: inherit;
- font-size: 0.8rem;
- cursor: pointer;
+.llm-chat-note-context.tn-low-profile {
max-width: 150px;
- transition: all 0.15s ease;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--muted-text-color);
}
-.llm-chat-note-context:hover:not(:disabled) {
+.llm-chat-note-context.tn-low-profile:hover:not(:disabled) {
color: var(--main-text-color);
}
-.llm-chat-note-context.active {
+.llm-chat-note-context.tn-low-profile.active {
color: var(--main-text-color);
}
-.llm-chat-note-context:disabled {
- opacity: 0.5;
- cursor: not-allowed;
-}
-
-.llm-chat-note-context .bx {
- font-size: 1rem;
- flex-shrink: 0;
-}
-
-.llm-chat-note-context-title {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
/* Markdown styles */
.llm-chat-markdown {
line-height: 1.6;