Skip to content

Build your personal knowledge base with Trilium Notes

feat(options/llm): don't show settings unless the experimental setting is on

Elian Doran80ac0eea62d7
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 9ab342229f..ce49038fb5 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2323,6 +2323,7 @@
"llm": {
"settings_title": "AI / LLM",
"settings_description": "Configure AI and Large Language Model integrations.",
+ "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",
"configured_providers": "Configured Providers",
diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsx
index d4ed23fb9b..2f7bc7d5df 100644
--- a/apps/client/src/widgets/type_widgets/options/llm.tsx
+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx
@@ -1,6 +1,7 @@
import { useCallback, useMemo, useState } from "preact/hooks";
import dialog from "../../../services/dialog";
+import { isExperimentalFeatureEnabled } from "../../../services/experimental_features";
import { t } from "../../../services/i18n";
import ActionButton from "../../react/ActionButton";
import Button from "../../react/Button";
@@ -11,6 +12,23 @@ import OptionsSection from "./components/OptionsSection";
import AddProviderModal, { type LlmProviderConfig, PROVIDER_TYPES } from "./llm/AddProviderModal";
export default function LlmSettings() {
+ if (!isExperimentalFeatureEnabled("llm")) {
+ return (
+ <OptionsSection title={t("llm.settings_title")}>
+ <p className="form-text">{t("llm.feature_not_enabled")}</p>
+ </OptionsSection>
+ );
+ }
+
+ return (
+ <>
+ <ProviderSettings />
+ <McpSettings />
+ </>
+ );
+}
+
+function ProviderSettings() {
const [providersJson, setProvidersJson] = useTriliumOption("llmProviders");
const providers = useMemo<LlmProviderConfig[]>(() => {
try {
@@ -36,34 +54,30 @@ export default function LlmSettings() {
}, [providers, setProviders]);
return (
- <>
- <OptionsSection title={t("llm.settings_title")}>
- <p className="form-text">{t("llm.settings_description")}</p>
-
- <Button
- size="small"
- icon="bx bx-plus"
- text={t("llm.add_provider")}
- onClick={() => setShowAddModal(true)}
- />
-
- <hr />
-
- <h5>{t("llm.configured_providers")}</h5>
- <ProviderList
- providers={providers}
- onDelete={handleDeleteProvider}
- />
-
- <AddProviderModal
- show={showAddModal}
- onHidden={() => setShowAddModal(false)}
- onSave={handleAddProvider}
- />
- </OptionsSection>
-
- <McpSettings />
- </>
+ <OptionsSection title={t("llm.settings_title")}>
+ <p className="form-text">{t("llm.settings_description")}</p>
+
+ <Button
+ size="small"
+ icon="bx bx-plus"
+ text={t("llm.add_provider")}
+ onClick={() => setShowAddModal(true)}
+ />
+
+ <hr />
+
+ <h5>{t("llm.configured_providers")}</h5>
+ <ProviderList
+ providers={providers}
+ onDelete={handleDeleteProvider}
+ />
+
+ <AddProviderModal
+ show={showAddModal}
+ onHidden={() => setShowAddModal(false)}
+ onSave={handleAddProvider}
+ />
+ </OptionsSection>
);
}