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

This commit is contained in:
Elian Doran 2025-03-16 23:28:52 +02:00
parent d7167131cb
commit 5d0be300bf
No known key found for this signature in database

View File

@ -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();
}
}
}