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): rename the chat providers to Model Providers and list their models
Elian Dorana25c0e9bef8a
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 5e8ce964d3..5818b9d257 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -4160,7 +4160,6 @@"enabled_description": "Adds the AI chat sidebar and LLM chat notes, using the providers configured below.","feature_not_enabled": "Enable the LLM experimental feature in Settings → Advanced → Experimental features to use AI integrations.","add_provider": "Add Provider",- "add_provider_title": "Add AI Provider","edit_provider_title": "Edit {{- name}}","edit_provider": "Edit","save": "Save",@@ -4173,10 +4172,6 @@"models_select_all": "Select all","models_select_none": "Select none","models_reset_defaults": "Reset to defaults",- "provider_model_count_one": "{{count}} model",- "provider_model_count_other": "{{count}} models",- "configured_providers": "Configured Providers",- "no_providers_configured": "No providers configured yet.","provider_name": "Name","beta": "Beta","provider_unavailable_standalone": "Unavailable in the browser version: this provider works by running a separate program on the machine, and there is no machine here to run it on.",@@ -4268,7 +4263,11 @@"search_provider_group_local": "Self-hosted","search_provider_group_local_description": "Your own metasearch instance. Searches reach only that instance and the search engines it queries.","setup_hint_searxng": "The address of your SearXNG instance. Its <Code>settings.yml</Code> must list <Code>json</Code> under <Code>search.formats</Code>.",- "search_base_url_description": "Optional. Reaches the same API through a proxy or gateway."+ "search_base_url_description": "Optional. Reaches the same API through a proxy or gateway.",+ "model_providers": "Model Providers",+ "add_model_provider": "Add Model Provider",+ "no_model_providers_configured": "No model providers configured yet.",+ "provider_no_models": "No models selected, so it isn't offered in the chat."},"common": {"save": "Save",diff --git a/apps/client/src/widgets/type_widgets/options/llm.css b/apps/client/src/widgets/type_widgets/options/llm.cssindex 8c81af622e..0533f09738 100644--- a/apps/client/src/widgets/type_widgets/options/llm.css+++ b/apps/client/src/widgets/type_widgets/options/llm.css@@ -8,6 +8,14 @@text-align: end;}+/* One line, cut off at the row's width; the full list is in its tooltip. */+.llm-provider-models {+ display: block;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+}+/* Scale the provider logo down to sit inline with the row label text. */.llm-provider-name .masked-icon {--masked-icon-size: 1.2em;diff --git a/apps/client/src/widgets/type_widgets/options/llm.spec.tsx b/apps/client/src/widgets/type_widgets/options/llm.spec.tsxindex 4231679aa5..a9dae23510 100644--- a/apps/client/src/widgets/type_widgets/options/llm.spec.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm.spec.tsx@@ -222,19 +222,23 @@ describe("the configured providers", () => {expect(host.querySelector(".no-items")).not.toBeNull();});- it("gives each provider a segment, named, described by its model count or its address and never by its name", () => {+ it("describes a model provider by its models, a search provider by its address, and neither by its name", () => {withProviders([- { id: "a", name: "My OpenAI", provider: "openai", apiKey: "sk", selectedModels: [ {}, {} ] },+ { id: "a", name: "My OpenAI", provider: "openai", apiKey: "sk", selectedModels: [ { id: "gpt-5", name: "GPT-5" }, { id: "o3", name: "o3" } ] },{ id: "b", name: "Ollama", provider: "ollama", apiKey: "", baseURL: "http://box:11434" },+ { id: "e", name: "Anthropic", provider: "anthropic", apiKey: "sk", selectedModels: [ { id: "s", name: "Claude Sonnet 4.5" } ] },{ id: "c", name: "Brave Search", provider: "brave", kind: "search", apiKey: "bk" },{ id: "d", name: "SearXNG", provider: "searxng", kind: "search", apiKey: "", baseURL: "http://searx.lan" }]);open();- expect(providers()).toHaveLength(4);+ expect(providers()).toHaveLength(5);expect(providers()[0].querySelector(".llm-provider-name")?.textContent).toContain("My OpenAI");const descriptions = providers().map((option) => option.querySelector(".tn-card-option-description")?.textContent ?? null);- expect(descriptions).toEqual([ "llm.provider_model_count", "http://box:11434", null, "http://searx.lan" ]);+ // The short names the chat's picker shows; a provider with none is never offered there.+ expect(descriptions).toEqual([ "GPT-5, o3", "llm.provider_no_models", "Sonnet 4.5", null, "http://searx.lan" ]);+ // A list cut off by the row's width is still readable in full.+ expect(providers()[0].querySelector(".llm-provider-models")?.getAttribute("title")).toBe("GPT-5, o3");});it("marks only the destructive action, and drops the one provider it was pressed on", async () => {@@ -275,7 +279,7 @@ describe("the configured providers", () => {.find((c) => c.querySelector(".tn-card-heading")?.textContent === heading);const names = (heading: string) => [ ...card(heading)?.querySelectorAll(".llm-provider-name") ?? [] ].map((name) => name.textContent);- expect(names("llm.configured_providers")).toEqual([ "My OpenAI" ]);+ expect(names("llm.model_providers")).toEqual([ "My OpenAI" ]);expect(names("llm.search_providers")).toEqual([ "Brave Search" ]);const remove = card("llm.search_providers")?.querySelectorAll(".tn-card-option-actions button")[1];diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsxindex 069700522b..b4335ade06 100644--- a/apps/client/src/widgets/type_widgets/options/llm.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx@@ -17,6 +17,7 @@ import FormToggle from "../../react/FormToggle";import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";import MaskedIcon from "../../react/MaskedIcon";import NoItems from "../../react/NoItems";+import { shortModelName } from "../llm_chat/model_name";import OptionsPageHeader from "./components/OptionsPageHeader";import AddProviderModal, { findProviderType, type LlmProviderConfig } from "./llm/AddProviderModal";@@ -95,11 +96,11 @@ function ProviderSettings({ kind }: { kind: LlmProviderKind }) {const isSearch = kind === "search";return (<>- <Card heading={isSearch ? t("llm.search_providers") : t("llm.configured_providers")}>+ <Card heading={isSearch ? t("llm.search_providers") : t("llm.model_providers")}><ProviderListproviders={providers}emptyIcon={isSearch ? "bx bx-search" : "bx bx-bot"}- emptyText={isSearch ? t("llm.no_search_providers_configured") : t("llm.no_providers_configured")}+ emptyText={isSearch ? t("llm.no_search_providers_configured") : t("llm.no_model_providers_configured")}onEdit={openModal}onDelete={handleDeleteProvider}/>@@ -108,7 +109,7 @@ function ProviderSettings({ kind }: { kind: LlmProviderKind }) {<Buttonname={isSearch ? "add-search-provider-button" : "add-llm-provider-button"}size="micro" icon="bx-plus"- text={isSearch ? t("llm.add_search_provider") : t("llm.add_provider")}+ text={isSearch ? t("llm.add_search_provider") : t("llm.add_model_provider")}onClick={() => openModal()}/></CardSection>@@ -286,7 +287,6 @@ function ProviderList({ providers, emptyIcon, emptyText, onEdit, onDelete }: Proreturn <>{providers.map((provider) => {const providerType = findProviderType(provider.provider);- const modelCount = provider.selectedModels?.length ?? 0;return (<OptionCardSectionkey={provider.id}@@ -296,9 +296,7 @@ function ProviderList({ providers, emptyIcon, emptyText, onEdit, onDelete }: Pro{provider.name}</span>}- description={modelCount > 0- ? t("llm.provider_model_count", { count: modelCount })- : provider.baseURL}+ description={isProviderOfKind(provider, "llm") ? <ModelList provider={provider} /> : provider.baseURL}><span className="tn-card-option-actions"><ActionButton@@ -318,3 +316,13 @@ function ProviderList({ providers, emptyIcon, emptyText, onEdit, onDelete }: Pro})}</>;}++/** The short names of a model provider's selected models, as the chat's picker shows them. */+function ModelList({ provider }: { provider: LlmProviderConfig }) {+ const models = provider.selectedModels ?? [];+ if (!models.length) {+ return <>{t("llm.provider_no_models")}</>;+ }+ const names = models.map((model) => shortModelName(model.name, provider.provider)).join(", ");+ return <span className="llm-provider-models" title={names}>{names}</span>;+}diff --git a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsxindex 87c1a9f6c0..aba668cac8 100644--- a/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx+++ b/apps/client/src/widgets/type_widgets/options/llm/AddProviderModal.tsx@@ -357,7 +357,7 @@ export default function AddProviderModal({ show, onHidden, onSave, existingProviconst allSteps: WizardStep<ProviderStep>[] = [{id: "provider",- title: isSearch ? t("llm.add_search_provider") : t("llm.add_provider_title"),+ title: isSearch ? t("llm.add_search_provider") : t("llm.add_model_provider"),// Choosing a card advances on its own, so the step needs no primary action —// but Enter must still not advance with whichever provider happens to be// first in the list, hence the guard.diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI/Providers.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI/Providers.htmlindex c96218492a..cc4e05293e 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI/Providers.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/AI/Providers.html@@ -1,3 +1,7 @@+<p>Providers are added in the <em>Model Providers</em> section of the AI settings,+ with <em>Add Model Provider</em>. Each one lists the models selected for+ it, which are the ones the chat offers; a provider with no models selected+ is not offered in the chat.</p><h2>Cloud providers using API keys</h2><p>Currently, the following cloud providers are supported:</p><ul>diff --git a/docs/User Guide/User Guide/AI/Providers.md b/docs/User Guide/User Guide/AI/Providers.mdindex 97b7bd38e2..65b7f54b32 100644--- a/docs/User Guide/User Guide/AI/Providers.md+++ b/docs/User Guide/User Guide/AI/Providers.md@@ -1,4 +1,6 @@# Providers+Providers are added in the _Model Providers_ section of the AI settings, with _Add Model Provider_. Each one lists the models selected for it, which are the ones the chat offers; a provider with no models selected is not offered in the chat.+## Cloud providers using API keysCurrently, the following cloud providers are supported: