Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): drop the model icon and compact the model selector

Elian Dorande0dc63e8e5f
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
index 9da2754f14..d7da4d40e1 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
@@ -184,11 +184,6 @@
min-width: 0;
}
-.llm-chat-model-select-icon {
- font-size: 1rem;
- flex-shrink: 0;
-}
-
.llm-chat-model-select-name {
overflow: hidden;
text-overflow: ellipsis;
@@ -214,24 +209,39 @@
}
/*
- * The model picker is left as the theme's own combo box (`.select-button.dropdown-toggle.btn`
+ * The model picker stays the theme's own combo box (`.select-button.dropdown-toggle.btn`
* — its fill, its 6px radius, its caret, its focus outline), so it reads as the same
- * control as every other Trilium selector. Only what the theme can't know is set here:
- * the model name has to ellipsize rather than stretch the row, and the leading chip icon
- * needs the button to lay its content out as a flex row. Matching the theme's selector
- * verbatim keeps these at a specificity that actually wins.
+ * control as every other Trilium selector; it is only made compact, the way the theme
+ * itself compacts one.
+ *
+ * The default is sized for a form row: `padding-inline-end: calc(15px + 1.5rem)` alone
+ * reserves ~39px for the caret. Restating `--dropdown-arrow` — the custom property the
+ * theme's own `background` shorthand resolves — shrinks the glyph and pulls it in
+ * without reaching into the theme's rules, as the calendar month selector does with
+ * `--select-arrow-svg`. Matching the theme's selector verbatim keeps this at a
+ * specificity that actually wins.
*/
.llm-chat-input-form .llm-chat-model-select.select-button.dropdown-toggle.btn {
+ --dropdown-arrow: var(--select-arrow-svg) right 0.4em center/10px 14px no-repeat;
+
display: flex;
align-items: center;
- gap: 0.35rem;
min-width: 0;
max-width: 15rem;
+ padding: 0.15em 0.5em;
+ padding-inline-end: calc(10px + 0.8em);
font-family: inherit;
font-size: 0.85rem;
text-align: start;
}
+/* The theme flips the caret to the left edge for RTL with a `background-position`
+ longhand, which would otherwise override the compact offset carried in the
+ shorthand above and leave the caret sitting at the default 0.75rem. */
+body[dir=rtl] .llm-chat-input-form .llm-chat-model-select.select-button.dropdown-toggle.btn {
+ background-position: left 0.4em center;
+}
+
.llm-chat-input-form .llm-chat-model-select.select-button.dropdown-toggle.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
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 8efb031619..8bac8cb5ee 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
@@ -366,14 +366,9 @@ export default function ChatInputBar({
<div className="llm-chat-options">
<div className="llm-chat-model-selector">
<Dropdown
- // The chip icon lives inside the toggle so it shares the pill's
- // hover surface instead of floating loose next to it.
- text={<>
- <span className="bx bx-chip llm-chat-model-select-icon" />
- {currentModel
- ? <span className="llm-chat-model-select-name">{currentModel.name}</span>
- : <span className="llm-chat-model-select-name llm-chat-model-placeholder">{t("llm_chat.no_model_selected")}</span>}
- </>}
+ text={currentModel
+ ? <span className="llm-chat-model-select-name">{currentModel.name}</span>
+ : <span className="llm-chat-model-select-name llm-chat-model-placeholder">{t("llm_chat.no_model_selected")}</span>}
disabled={chat.isStreaming}
buttonClassName="llm-chat-model-select"
className="llm-chat-model-dropdown"