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
refactor(llm): remove legacy tool use
Elian Doran852215194973
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsxindex 60e24f844f..c5213f6ebc 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx@@ -85,8 +85,6 @@ export default function ChatMessage({ message, isStreaming }: Props) {);}- // Legacy tool calls (from old format stored as separate field)- const legacyToolCalls = message.toolCalls;const hasBlockContent = Array.isArray(message.content);return (@@ -109,19 +107,6 @@ export default function ChatMessage({ message, isStreaming }: Props) {textContent)}</div>- {legacyToolCalls && legacyToolCalls.length > 0 && (- <details className="llm-chat-tool-calls">- <summary className="llm-chat-tool-calls-summary">- <span className="bx bx-wrench" />- {t("llm_chat.tool_calls", { count: legacyToolCalls.length })}- </summary>- <div className="llm-chat-tool-calls-list">- {legacyToolCalls.map((tool) => (- <ToolCallCard key={tool.id} toolCall={tool} />- ))}- </div>- </details>- )}{message.citations && message.citations.length > 0 && (<div className="llm-chat-citations"><div className="llm-chat-citations-label">diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.cssindex d88ce1410e..a07a5526f3 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css+++ b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css@@ -1,60 +1,3 @@-/* Tool calls display (legacy wrapper) */-.llm-chat-tool-calls {- margin-top: 0.75rem;- padding-top: 0.75rem;- border-top: 1px solid var(--main-border-color);-}--.llm-chat-tool-calls-summary {- display: flex;- align-items: center;- gap: 0.5rem;- font-size: 0.85rem;- font-weight: 500;- color: var(--muted-text-color);- padding: 0.25rem 0;- cursor: pointer;- list-style: none;-}--.llm-chat-tool-calls-summary::-webkit-details-marker {- display: none;-}--.llm-chat-tool-calls-summary::before {- content: "▶";- font-size: 0.7em;- transition: transform 0.2s ease;-}--.llm-chat-tool-calls[open] .llm-chat-tool-calls-summary::before {- transform: rotate(90deg);-}--.llm-chat-tool-calls-summary .bx {- font-size: 1rem;-}--.llm-chat-tool-calls-list {- margin-top: 0.5rem;- display: flex;- flex-direction: column;- gap: 0.75rem;-}--.llm-chat-tool-call {- background: var(--accented-background-color);- border-radius: 6px;- padding: 0.75rem;- font-size: 0.85rem;-}--.llm-chat-tool-call-name {- font-weight: 600;- margin-bottom: 0.5rem;- color: var(--main-text-color);-}-.llm-chat-tool-call-input strong,.llm-chat-tool-call-result strong {display: block;@@ -64,18 +7,6 @@text-transform: uppercase;}-.llm-chat-tool-call pre {- margin: 0;- padding: 0.5rem;- background: var(--main-background-color);- border-radius: 4px;- overflow-x: auto;- font-size: 0.8rem;- font-family: var(--monospace-font-family, monospace);- max-height: 200px;- overflow-y: auto;-}-/* Inline tool call cards */.llm-chat-tool-call-inline {margin: 0.5rem 0;diff --git a/apps/client/src/widgets/type_widgets/llm_chat/llm_chat_types.ts b/apps/client/src/widgets/type_widgets/llm_chat/llm_chat_types.tsindex 767a886dae..d05bf291b5 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/llm_chat_types.ts+++ b/apps/client/src/widgets/type_widgets/llm_chat/llm_chat_types.ts@@ -42,11 +42,6 @@ export function getMessageText(content: string | ContentBlock[]): string {* Extract tool calls from message content blocks.*/export function getMessageToolCalls(message: StoredMessage): ToolCall[] {- // Legacy format: tool calls stored in separate field- if (message.toolCalls) {- return message.toolCalls;- }- // Block format: extract from content blocksif (Array.isArray(message.content)) {return message.content.filter((b): b is ToolCallBlock => b.type === "tool_call")@@ -64,8 +59,6 @@ export interface StoredMessage {citations?: LlmCitation[];/** Message type for special rendering. Defaults to "message" if omitted. */type?: MessageType;- /** @deprecated Tool calls are now inline in content blocks. Kept for backward compatibility. */- toolCalls?: ToolCall[];/** Token usage for this response */usage?: LlmUsage;}