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
feat(llm_chat): show why a web search choice is unavailable on an info icon
Elian Dorand6367b2b9439
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.spec.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.spec.tsxindex 63e091b195..796f983c15 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.spec.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.spec.tsx@@ -107,7 +107,7 @@ describe("ChatToolsDropdown", () => {expect(mocks.triggerCommand).toHaveBeenCalledExactlyOnceWith("showOptions", { section: "_optionsLlm" });});- it("keeps a choice the model can't use listed, disabled, with the reason under it", async () => {+ it("keeps a choice the model can't use listed, disabled, with the reason on an info icon", async () => {const menu = renderMenu({ webSearch: {choice: "builtin", enableWebSearch: false,builtInUnavailableKey: "no_builtin", searchProviderUnavailableKey: "own_tools"@@ -115,8 +115,9 @@ describe("ChatToolsDropdown", () => {const builtIn = menu.row("llm_chat.web_search_builtin");expect(builtIn?.classList.contains("disabled")).toBe(true);- expect(builtIn?.querySelector(".description")?.textContent).toBe("no_builtin");- expect(menu.row("Tavily")?.querySelector(".description")?.textContent).toBe("own_tools");+ expect(builtIn?.querySelector(".bx-info-circle")?.getAttribute("title")).toBe("no_builtin");+ expect(builtIn?.querySelector(".description")).toBeNull();+ expect(menu.row("Tavily")?.querySelector(".bx-info-circle")?.getAttribute("title")).toBe("own_tools");await act(async () => menu.row("Tavily")?.click());expect(menu.onWebSearchChoose).not.toHaveBeenCalled();diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsxindex 51a2b65be4..5a3b520caf 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx@@ -84,7 +84,7 @@ export default function ChatToolsDropdown({ enableNoteTools, onNoteToolsChange,/*** One choice of the web search section. A choice the current model can't use stays listed,- * disabled, with the reason under it; the marked one is shown as such either way.+ * disabled, with the reason on an info icon beside it; the marked one is shown as such either way.*/function WebSearchChoice({ choice, webSearch, onChoose, unavailableReason, children }: {choice: string;@@ -98,7 +98,7 @@ function WebSearchChoice({ choice, webSearch, onChoose, unavailableReason, childcheckablechecked={webSearch.choice === choice}disabled={!!unavailableReason}- description={unavailableReason}+ disabledTooltip={unavailableReason}closeOnSelect={false}onClick={() => onChoose(choice)}>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.htmlindex 76cd0b23b3..3a70d9a1ab 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@@ -128,9 +128,10 @@the end of the menu opens.</li></ul><p>Whether web search is on is kept per chat; the search source is shared- by all chats. A choice the current model can't use stays in the menu, disabled,- with the reason under it. Claude Code, GitHub Copilot, Google Antigravity- and OpenAI Codex run their own tools, so they can't use a search provider.</p>+ by all chats. A choice the current model can't use stays in the menu, disabled;+ hover the <span class="tn-icon bx bx-info-circle"></span> icon next to it+ to see why. Claude Code, GitHub Copilot, Google Antigravity and OpenAI+ Codex run their own tools, so they can't use a search provider.</p><h3>Thinking</h3><p>Some models reason before they answer. While the model is thinking, itsreasoning is shown in full under a spinner; once it is done, it folds intodiff --git a/docs/User Guide/User Guide/AI.md b/docs/User Guide/User Guide/AI.mdindex a3912b7231..3f7ff6b432 100644--- a/docs/User Guide/User Guide/AI.md+++ b/docs/User Guide/User Guide/AI.md@@ -91,7 +91,7 @@ Where the search comes from is chosen under _Web search_ in the <span class="tn-* _Use the model's built-in search_, the default, lets the model search with its provider's own search. Anthropic, OpenAI and Google Gemini models have one, as do Claude Code, Google Antigravity and OpenAI Codex. DeepSeek, Ollama, LM Studio and custom endpoints don't, so this choice is disabled for their models.* A search provider (Brave Search, Tavily, Exa or SearXNG) searches through that service instead, whichever model is answering. Search providers are added in the _Search Providers_ section of the AI settings, which _Manage search providers…_ at the end of the menu opens.-Whether web search is on is kept per chat; the search source is shared by all chats. A choice the current model can't use stays in the menu, disabled, with the reason under it. Claude Code, GitHub Copilot, Google Antigravity and OpenAI Codex run their own tools, so they can't use a search provider.+Whether web search is on is kept per chat; the search source is shared by all chats. A choice the current model can't use stays in the menu, disabled; hover the <span class="tn-icon bx bx-info-circle"></span> icon next to it to see why. Claude Code, GitHub Copilot, Google Antigravity and OpenAI Codex run their own tools, so they can't use a search provider.### Thinking