Skip to content

Build your personal knowledge base with Trilium Notes

fix(llm_chat): give the split Allow button the look of a plain one

Elian Doran31896826b601
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index f012a15186..79e86e4f36 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2695,7 +2695,7 @@
"tool_approval_allow": "Allow",
"tool_approval_deny": "Deny",
"tool_approval_declined": "denied",
- "tool_approval_allow_for_chat": "Allow for this chat",
+ "tool_approval_allow_for_chat": "Always allow {{tool}} for this chat",
"allowed_tools": "Allowed in this chat",
"allowed_tools_count_one": "{{count}} tool",
"allowed_tools_count_other": "{{count}} tools"
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css
index 7adef35aa6..5f7df8ab79 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.css
@@ -160,5 +160,23 @@
button.btn.btn-sm {
min-width: unset;
}
+
+ > .btn-group {
+ gap: 0;
+ padding: 0;
+ border-radius: 6px;
+ background: var(--cmd-button-background-color);
+ box-shadow: 1px 1px 1px var(--cmd-button-shadow-color);
+
+ button.btn {
+ border-radius: 6px 0 0 6px;
+ }
+
+ button.btn.dropdown-toggle-split {
+ padding-inline: 0.4rem;
+ border-inline-start: 1px solid var(--main-border-color);
+ border-radius: 0 6px 6px 0;
+ }
+ }
}
}
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.spec.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.spec.tsx
index 90dd02a400..13bb6bb343 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.spec.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.spec.tsx
@@ -845,7 +845,7 @@ describe("ToolCallCard", () => {
if (!found) throw new Error("expected the menu to open");
return found;
});
- expect(row.textContent).toBe("llm_chat.tool_approval_allow_for_chat");
+ expect(row.textContent).toBe("llm_chat.tool_approval_allow_for_chat{\"tool\":\"rename_note\"}");
act(() => row.click());
expect(answer).toHaveBeenLastCalledWith("c1", true, "chat");
});
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.tsx
index b85f3866f1..0ba740a980 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ToolCallCard.tsx
@@ -283,7 +283,7 @@ function ToolCallSection({ toolCall }: { toolCall: ToolCall }) {
return (
<div className="llm-chat-tool-call-pending">
{section}
- <ToolApprovalBar toolCallId={toolCall.id} />
+ <ToolApprovalBar toolCall={toolCall} />
</div>
);
}
@@ -427,11 +427,13 @@ export default function ToolCallCard({ toolCalls }: { toolCalls: ToolCall[] }) {
}
/** Asks the user whether a waiting tool call can run. */
-function ToolApprovalBar({ toolCallId }: { toolCallId: string }) {
+function ToolApprovalBar({ toolCall }: { toolCall: ToolCall }) {
const answer = useContext(ToolApprovalContext);
if (!answer) {
return null;
}
+ const { id: toolCallId, toolName } = toolCall;
+ const tool = t(`llm.tools.${toolName}`, { defaultValue: toolName });
return (
<div
@@ -452,7 +454,7 @@ function ToolApprovalBar({ toolCallId }: { toolCallId: string }) {
onClick={() => answer(toolCallId, true)}
>
<FormListItem icon="bx bx-check-double" onClick={() => answer(toolCallId, true, "chat")}>
- {t("llm_chat.tool_approval_allow_for_chat")}
+ {t("llm_chat.tool_approval_allow_for_chat", { tool })}
</FormListItem>
</SplitButton>
</div>
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI.html
index a6163fb658..4574691d8f 100644
--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI.html
+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI.html
@@ -271,9 +271,9 @@
<ul>
<li>To let the call run, press <em>Allow</em>.</li>
<li>To stop asking about a tool for the rest of the chat, open the menu next
- to <em>Allow</em> and choose <em>Allow for this chat</em>. The call runs,
- and so do the other calls of that tool still waiting and every later one
- in this chat. Other tools keep asking, and a new chat asks again.</li>
+ to <em>Allow</em> and choose to always allow that tool for this chat. The
+ call runs, and so do the other calls of that tool still waiting and every
+ later one in this chat. Other tools keep asking, and a new chat asks again.</li>
<li>To refuse it, press <em>Deny</em>. The AI is told that you declined, and
its reply carries on without the call, which is marked <em>denied</em>.</li>
<li>Stopping the reply denies every call that is still waiting.</li>
diff --git a/docs/User Guide/User Guide/AI.md b/docs/User Guide/User Guide/AI.md
index e164e6c7fd..ac07d6c2b0 100644
--- a/docs/User Guide/User Guide/AI.md
+++ b/docs/User Guide/User Guide/AI.md
@@ -161,7 +161,7 @@ When the reply stops moving for a couple of seconds while the AI is still at wor
Before the AI runs a tool, the chat asks whether to allow it. The tool's line is marked with a <span class="tn-icon bx bxs-hand"></span> icon and has _Allow_ and _Deny_ buttons below it. When the call would write to a note, the line opens on the text it would write or the changes of an edit. The reply waits until you answer.
* To let the call run, press _Allow_.
-* To stop asking about a tool for the rest of the chat, open the menu next to _Allow_ and choose _Allow for this chat_. The call runs, and so do the other calls of that tool still waiting and every later one in this chat. Other tools keep asking, and a new chat asks again.
+* To stop asking about a tool for the rest of the chat, open the menu next to _Allow_ and choose to always allow that tool for this chat. The call runs, and so do the other calls of that tool still waiting and every later one in this chat. Other tools keep asking, and a new chat asks again.
* To refuse it, press _Deny_. The AI is told that you declined, and its reply carries on without the call, which is marked _denied_.
* Stopping the reply denies every call that is still waiting.