Skip to content

Build your personal knowledge base with Trilium Notes

fix(llm): generate the message footer separators in CSS

Elian Doranf56ce48bf252
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.css b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.css
index e8cb94c962..090adc7592 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.css
@@ -329,6 +329,16 @@
transition: opacity 0.15s ease;
}
+/* Separators are generated on each item after the first rather than being elements of their
+ own: a dot that belongs to the item it precedes can never be orphaned onto a line by
+ itself, and it always shares that item's baseline. `gap` spaces the dot from the item
+ before it, the margin from the item it introduces. */
+.llm-chat-footer > * + *::before {
+ content: "·";
+ margin-inline-end: 0.375rem;
+ opacity: 0.5;
+}
+
.llm-chat-footer-user {
justify-content: flex-end;
}
@@ -345,10 +355,6 @@
font-weight: 500;
}
-.llm-chat-usage-separator {
- opacity: 0.5;
-}
-
.llm-chat-usage-tokens {
cursor: help;
font-family: var(--monospace-font-family, monospace);
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx
index d1ae698389..e5e159d25b 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx
@@ -205,12 +205,8 @@ function ChatMessage({ message, isStreaming, onRetry }: Props) {
{message.usage && typeof message.usage.promptTokens === "number" && (
<>
{message.usage.model && (
- <>
- <span className="llm-chat-usage-separator">·</span>
- <span className="llm-chat-usage-model">{message.usage.model}</span>
- </>
+ <span className="llm-chat-usage-model">{message.usage.model}</span>
)}
- <span className="llm-chat-usage-separator">·</span>
<span
className="llm-chat-usage-tokens"
title={t("llm_chat.tokens_detail", {
@@ -222,10 +218,7 @@ function ChatMessage({ message, isStreaming, onRetry }: Props) {
{t("llm_chat.total_tokens", { total: shortenNumber(message.usage.totalTokens) })}
</span>
{message.usage.cost != null && (
- <>
- <span className="llm-chat-usage-separator">·</span>
- <span className="llm-chat-usage-cost">~${message.usage.cost.toFixed(2)}</span>
- </>
+ <span className="llm-chat-usage-cost">~${message.usage.cost.toFixed(2)}</span>
)}
</>
)}