Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): show/hide LLM button based on setting

Elian Doran5d0be300bffd
diff --git a/src/public/app/widgets/buttons/llm_chat_button.ts b/src/public/app/widgets/buttons/llm_chat_button.ts
index ea1b9b24e7..94afab977e 100644
--- a/src/public/app/widgets/buttons/llm_chat_button.ts
+++ b/src/public/app/widgets/buttons/llm_chat_button.ts
@@ -1,4 +1,6 @@
+import type { EventData } from "../../components/app_context.js";
import type FNote from "../../entities/fnote.js";
+import options from "../../services/options.js";
import CommandButtonWidget from "./command_button.js";
export default class LlmChatButton extends CommandButtonWidget {
@@ -12,4 +14,14 @@ export default class LlmChatButton extends CommandButtonWidget {
.class("launcher-button");
}
+ isEnabled() {
+ return options.get("aiEnabled") === "true";
+ }
+
+ entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
+ if (loadResults.isOptionReloaded("aiEnabled")) {
+ this.refresh();
+ }
+ }
+
}