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): give each search provider its own mark
Elian Doran5eb8ca34ea32
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsxindex 678d131907..dd7d1be916 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatToolsDropdown.tsx@@ -11,7 +11,7 @@ import Dropdown from "../../react/Dropdown.js";import { FormDropdownDivider, FormListHeader, FormListItem, FormListToggleableItem } from "../../react/FormList.js";import Icon from "../../react/Icon.js";import MaskedIcon from "../../react/MaskedIcon.js";-import { providerIconUrl, SEARCH_PROVIDER_ICON } from "../options/llm/provider_icons.js";+import { providerIconUrl } from "../options/llm/provider_icons.js";/*** The Tools menu of the chat input bar: what the model can reach this turn, one section per group@@ -84,7 +84,7 @@ export default function ChatToolsDropdown({ enableNoteTools, onNoteToolsChange,onChoose={onWebSearchChoose}unavailableReason={searchProviderUnavailable}>- <MaskedIcon url={SEARCH_PROVIDER_ICON} className="llm-chat-tools-choice-icon" />+ <MaskedIcon url={providerIconUrl(provider.provider)} className="llm-chat-tools-choice-icon" />{provider.name}</WebSearchChoice>))}diff --git a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsxindex 24b5fd468d..af54f856ad 100644--- a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx@@ -16,7 +16,7 @@ import WizardModal, { type WizardStep } from "../../../react/WizardModal";import OptionsRow from "../components/OptionsRow";import { useAntigravityDownload } from "./antigravity_download";import ModelSelection from "./ModelSelection";-import { PROVIDER_ICONS, SEARCH_PROVIDER_ICON } from "./provider_icons.js";+import { PROVIDER_ICONS } from "./provider_icons.js";export interface LlmProviderConfig {id: string;@@ -164,12 +164,12 @@ export const PROVIDER_TYPES: ProviderType[] = [/** Web search services, configured in the same `llmProviders` option with `kind: "search"`. */export const SEARCH_PROVIDER_TYPES: ProviderType[] = [- { id: "brave", name: "Brave Search", group: "search-cloud", defaultBaseUrl: "https://api.search.brave.com/res/v1", iconUrl: SEARCH_PROVIDER_ICON },- { id: "tavily", name: "Tavily", group: "search-cloud", defaultBaseUrl: "https://api.tavily.com", iconUrl: SEARCH_PROVIDER_ICON },- { id: "exa", name: "Exa", group: "search-cloud", defaultBaseUrl: "https://api.exa.ai", iconUrl: SEARCH_PROVIDER_ICON },+ { id: "brave", name: "Brave Search", group: "search-cloud", defaultBaseUrl: "https://api.search.brave.com/res/v1", iconUrl: PROVIDER_ICONS.brave },+ { id: "tavily", name: "Tavily", group: "search-cloud", defaultBaseUrl: "https://api.tavily.com", iconUrl: PROVIDER_ICONS.tavily },+ { id: "exa", name: "Exa", group: "search-cloud", defaultBaseUrl: "https://api.exa.ai", iconUrl: PROVIDER_ICONS.exa },{id: "searxng", name: "SearXNG", group: "search-local", defaultBaseUrl: "http://localhost:8888", prefillBaseUrl: true,- iconUrl: SEARCH_PROVIDER_ICON,+ iconUrl: PROVIDER_ICONS.searxng,setupHintKey: "llm.setup_hint_searxng", apiKey: "optional", baseUrl: "required"}];diff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/brave.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/brave.svgnew file mode 100644index 0000000000..639299e78c--- /dev/null+++ b/apps/client/src/widgets/type_widgets/options/llm/icons/brave.svg@@ -0,0 +1 @@+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Brave</title><path d="M17.544 2.375c.017-.005 1.844-.5 2.712.361.872.872 1.588 1.642 1.588 1.642l-.565 1.38v-.003.006-.003L22 7.8c-.014.05-2.112 7.983-2.357 8.954-.488 1.924-.819 2.663-2.202 3.638a212.634 212.634 0 01-4.305 2.917c-.41.252-.92.691-1.383.691-.463 0-.974-.439-1.383-.691a213.099 213.099 0 01-4.306-2.917c-1.383-.975-1.72-1.714-2.2-3.632-.246-.977-2.35-8.904-2.364-8.96l.722-2.045-.566-1.383s.722-.764 1.594-1.63c.866-.872 2.712-.36 2.712-.36L8.066 0h7.373l2.105 2.375zm-5.797 12.557c-.138 0-1.04.318-1.762.691l-.457.234c-.487.253-.823.428-.956.506-.168.108-.066.306.09.414.15.103 2.195 1.684 2.394 1.865l.09.078c.186.168.432.391.607.391.174 0 .415-.223.607-.391l.084-.078c.2-.169 2.244-1.756 2.394-1.865.15-.108.258-.3.09-.408-.133-.084-.475-.253-.956-.506h-.006l-.457-.24c-.722-.373-1.623-.691-1.762-.691zm.006-11.276c-.35.02-.694.092-1.023.211l-.378.126c-.493.169-.969.331-1.21.331-.312 0-2.554-.428-2.584-.433 0 0-2.706 3.26-2.706 3.957 0 .577.228.805.504 1.07l.174.175 2.033 2.152.06.067c.204.204.5.498.29.998l-.043.102c-.228.535-.511 1.203-.15 1.876.384.716 1.046 1.19 1.467 1.118.42-.084 1.419-.601 1.78-.841.367-.229 1.52-1.19 1.521-1.551 0-.307-.829-.812-1.238-1.053l-.18-.12-.199-.12c-.367-.229-1.035-.644-1.047-.825-.018-.228-.017-.294.283-.853l.21-.379c.289-.487.602-1.029.536-1.426-.085-.433-.777-.685-1.36-.901l-.21-.078-.613-.229c-.583-.222-1.232-.463-1.34-.511-.145-.073-.11-.132.335-.174l.223-.025c.553-.06 1.582-.168 2.08-.03l.32.09c.564.145 1.25.337 1.316.445l.03.048c.067.09.109.145.037.53l-.121.607c-.15.806-.391 2.069-.421 2.351l-.012.115c-.042.312-.066.529.301.613.438.119.884.206 1.335.259.216 0 .824-.144 1.24-.24l.095-.025c.367-.078.343-.289.3-.602l-.011-.12c-.03-.282-.27-1.54-.42-2.345l-.122-.614c-.072-.384-.024-.439.036-.529l.03-.048c.067-.108.753-.294 1.318-.444l.318-.091c.5-.138 1.528-.03 2.081.03l.216.018c.451.048.493.108.343.18-.11.049-.758.29-1.341.512-.273.108-.547.21-.823.307-.583.216-1.275.468-1.36.907-.066.391.247.939.535 1.42l.21.379c.301.56.308.625.284.854-.012.18-.68.595-1.053.824l-.192.126-.181.108c-.41.247-1.238.758-1.238 1.059 0 .367 1.16 1.316 1.521 1.55.367.235 1.36.758 1.78.836.421.078 1.082-.396 1.467-1.112.36-.673.078-1.335-.15-1.876l-.042-.102c-.21-.5.084-.794.289-1.004l.065-.06 2.02-2.147.181-.181c.271-.265.505-.493.505-1.07 0-.698-2.706-3.957-2.706-3.957-.03.006-2.275.44-2.586.44l.007-.007c-.252 0-.722-.156-1.215-.337l-.379-.12c-.612-.21-1.02-.21-1.022-.21z"></path></svg>\ No newline at end of filediff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/exa.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/exa.svgnew file mode 100644index 0000000000..85ddb9be1c--- /dev/null+++ b/apps/client/src/widgets/type_widgets/options/llm/icons/exa.svg@@ -0,0 +1 @@+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Exa</title><path clip-rule="evenodd" d="M3 0h19v1.791L13.892 12 22 22.209V24H3V0zm9.62 10.348l6.589-8.557H6.03l6.59 8.557zM5.138 3.935v7.17h5.52l-5.52-7.17zm5.52 8.96h-5.52v7.17l5.52-7.17zM6.03 22.21l6.59-8.557 6.589 8.557H6.03z"></path></svg>\ No newline at end of filediff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/search.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/search.svgdeleted file mode 100644index de93f3ff21..0000000000--- a/apps/client/src/widgets/type_widgets/options/llm/icons/search.svg+++ /dev/null@@ -1 +0,0 @@-<svg width="24" height="24" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a8 8 0 0 1 6.32 12.9l5.39 5.39-1.42 1.42-5.39-5.39A8 8 0 1 1 10 2m0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12"/></svg>diff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/searxng.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/searxng.svgnew file mode 100644index 0000000000..7873fdee61--- /dev/null+++ b/apps/client/src/widgets/type_widgets/options/llm/icons/searxng.svg@@ -0,0 +1 @@+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>SearXNG</title><path d="M6.638 4.38a5.35 5.35 0 017.747 3.963 5.35 5.35 0 01-.56 3.284l-1.154-.61A4.044 4.044 0 007.237 5.54l-.6-1.158z"></path><path clip-rule="evenodd" d="M9.13 0a9.13 9.13 0 017.992 13.546l6.803 6.515-3.4 3.551-6.853-6.562A9.13 9.13 0 119.13 0zm0 2.61a6.521 6.521 0 100 13.042 6.521 6.521 0 000-13.043z"></path></svg>\ No newline at end of filediff --git a/apps/client/src/widgets/type_widgets/options/llm/icons/tavily.svg b/apps/client/src/widgets/type_widgets/options/llm/icons/tavily.svgnew file mode 100644index 0000000000..458b2143a5--- /dev/null+++ b/apps/client/src/widgets/type_widgets/options/llm/icons/tavily.svg@@ -0,0 +1 @@+<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Tavily</title><path d="M8.033 14.273a1.612 1.612 0 011.139.47l.04.042.044.043a1.61 1.61 0 010 2.277l-3.073 3.073.816.816c.6.6.303 1.627-.525 1.814l-5.159 1.165a1.07 1.07 0 01-.897-.2l-.102-.09a1.07 1.07 0 01-.289-1l1.164-5.158A1.079 1.079 0 013.006 17l.816.817 3.074-3.074a1.612 1.612 0 011.137-.47zM17.042 13.246c0-.85.935-1.366 1.653-.912l4.47 2.824c.336.212.503.562.503.911 0 .35-.167.7-.501.913l-4.472 2.824a1.079 1.079 0 01-1.654-.912v-1.155h-7.027c.37-.4.605-.902.677-1.438l.022-.232a2.65 2.65 0 00-.492-1.669h6.821v-1.154zM8.188 0c.35 0 .7.168.913.503l2.823 4.47a1.079 1.079 0 01-.911 1.655H9.857v6.692h-1.67a2.633 2.633 0 00-1.668.48V6.629H5.365c-.849 0-1.366-.936-.912-1.654L7.276.503A1.072 1.072 0 018.188 0z"></path></svg>\ No newline at end of filediff --git a/apps/client/src/widgets/type_widgets/options/llm/provider_icons.ts b/apps/client/src/widgets/type_widgets/options/llm/provider_icons.tsindex eb94def88a..2cdcc06a42 100644--- a/apps/client/src/widgets/type_widgets/options/llm/provider_icons.ts+++ b/apps/client/src/widgets/type_widgets/options/llm/provider_icons.ts@@ -1,5 +1,6 @@/**- * Per-provider marks, shared by the provider setup wizard and the chat model picker.+ * Per-provider marks, chat and search alike, shared by the provider setup wizard, the chat model+ * picker and the chat's Tools menu.** Keyed by provider *type* (`LlmProviderConfig.provider`), not by the user's configuration* id — two Ollama configurations show the same mark, which is why the model picker keeps its@@ -12,34 +13,38 @@import anthropicIcon from "./icons/anthropic.svg?url";import antigravityIcon from "./icons/antigravity.svg?url";+import braveIcon from "./icons/brave.svg?url";import claudeAgentIcon from "./icons/claude-ai.svg?url";import codexIcon from "./icons/codex.svg?url";import deepseekIcon from "./icons/deepseek.svg?url";+import exaIcon from "./icons/exa.svg?url";import geminiIcon from "./icons/gemini.svg?url";import githubCopilotIcon from "./icons/github-copilot.svg?url";import lmStudioIcon from "./icons/lmstudio.svg?url";import ollamaIcon from "./icons/ollama.svg?url";import openaiIcon from "./icons/openai.svg?url";import openAiCompatibleIcon from "./icons/robot.svg?url";-import searchIcon from "./icons/search.svg?url";+import searxngIcon from "./icons/searxng.svg?url";+import tavilyIcon from "./icons/tavily.svg?url";export const PROVIDER_ICONS: Record<string, string> = {anthropic: anthropicIcon,"antigravity-agent": antigravityIcon,+ brave: braveIcon,"claude-agent": claudeAgentIcon,"codex-agent": codexIcon,"copilot-agent": githubCopilotIcon,deepseek: deepseekIcon,+ exa: exaIcon,google: geminiIcon,lmstudio: lmStudioIcon,ollama: ollamaIcon,openai: openaiIcon,- "openai-compatible": openAiCompatibleIcon+ "openai-compatible": openAiCompatibleIcon,+ searxng: searxngIcon,+ tavily: tavilyIcon};-/** The mark every search provider card shows. */-export const SEARCH_PROVIDER_ICON = searchIcon;-/*** The mark for a provider type, falling back to the generic one so a provider added later —* or a configuration restored from a newer version — still gets a glyph rather than a gap