summaryrefslogtreecommitdiffhomepage
path: root/src/tool-modal.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-03-24 13:44:52 +0900
committerAdam Malczewski <[email protected]>2026-03-24 13:44:52 +0900
commit5a44a97111d304945bbfc3da02d29a83191d816c (patch)
treea1e31b76db2a0b0e84c5745127a0d05ddc574ec7 /src/tool-modal.ts
parentbb543c3f7840f2a3fa1b7a1fb32245fa87a30f7b (diff)
downloadai-pulse-obsidian-plugin-5a44a97111d304945bbfc3da02d29a83191d816c.tar.gz
ai-pulse-obsidian-plugin-5a44a97111d304945bbfc3da02d29a83191d816c.zip
Add initial ai tool system, and 2 tools to explore
Diffstat (limited to 'src/tool-modal.ts')
-rw-r--r--src/tool-modal.ts43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/tool-modal.ts b/src/tool-modal.ts
new file mode 100644
index 0000000..c1b1522
--- /dev/null
+++ b/src/tool-modal.ts
@@ -0,0 +1,43 @@
+import { Modal, Setting } from "obsidian";
+import type AIOrganizer from "./main";
+import { TOOL_REGISTRY } from "./tools";
+
+export class ToolModal extends Modal {
+ private plugin: AIOrganizer;
+
+ constructor(plugin: AIOrganizer) {
+ super(plugin.app);
+ this.plugin = plugin;
+ }
+
+ onOpen(): void {
+ const { contentEl } = this;
+ contentEl.empty();
+ contentEl.addClass("ai-organizer-tool-modal");
+
+ this.setTitle("AI Tools");
+
+ contentEl.createEl("p", {
+ text: "Enable tools to give the AI access to your vault. Changes take effect on the next message.",
+ cls: "ai-organizer-tool-modal-desc",
+ });
+
+ for (const tool of TOOL_REGISTRY) {
+ new Setting(contentEl)
+ .setName(tool.label)
+ .setDesc(tool.description)
+ .addToggle((toggle) => {
+ const current = this.plugin.settings.enabledTools[tool.id] ?? false;
+ toggle.setValue(current);
+ toggle.onChange(async (value) => {
+ this.plugin.settings.enabledTools[tool.id] = value;
+ await this.plugin.saveSettings();
+ });
+ });
+ }
+ }
+
+ onClose(): void {
+ this.contentEl.empty();
+ }
+}