From d27fd086f1b830cd24fb25a9fbfbe53fd85f7cd0 Mon Sep 17 00:00:00 2001 From: Mike Thicke Date: Tue, 10 Jun 2025 10:37:49 -0400 Subject: [PATCH] Updates to follow Obsidian Plugin guidelines --- manifest.json | 2 +- src/CoIntelligencePlugin.tsx | 15 --------------- src/settings.ts | 27 +++++++++++++-------------- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/manifest.json b/manifest.json index 012de57..125e9e2 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "Co-Intelligence AI", "version": "1.0.0", "minAppVersion": "1.5.0", - "description": "Co-Intelligence is a plugin for working with AI in Obsidian.", + "description": "Co-Intelligence AI gives you a full AI chat experience in Obsidian.", "author": "Mike Thicke", "authorUrl": "https://github.com/Epistemic-Technology", "fundingUrl": "https://ko-fi.com/epistemictechnology", diff --git a/src/CoIntelligencePlugin.tsx b/src/CoIntelligencePlugin.tsx index 94e863e..e620279 100644 --- a/src/CoIntelligencePlugin.tsx +++ b/src/CoIntelligencePlugin.tsx @@ -129,22 +129,7 @@ export class CoIntelligencePlugin extends Plugin { * * @see https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/main.ts */ - // registerMonkeyPatches() { - // this.register( - // around(WorkspaceLeaf.prototype, { - // setViewState(next): Function { - // return function (state: ViewState, ...rest: any[]) { - // console.log("Monkey patching setViewState"); - // return next.apply(this, [state, ...rest]); - // }; - // }, - // }), - // ); - // } - private registerMonkeyPatches() { - const key = - "https://github.com/zsviczian/obsidian-excalidraw-plugin/issues"; // Monkey patch WorkspaceLeaf to open Excalidraw drawings with ExcalidrawView by default this.register( around(WorkspaceLeaf.prototype, { diff --git a/src/settings.ts b/src/settings.ts index dd67202..ecf57e3 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -1,5 +1,5 @@ import type CoIntelligencePlugin from "@/CoIntelligencePlugin"; -import { App, PluginSettingTab, Setting } from "obsidian"; +import { App, normalizePath, PluginSettingTab, Setting } from "obsidian"; import { ModelId } from "@/types"; export interface CoIntelligenceSettings { @@ -47,10 +47,12 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { shouldRefreshDisplay = false, ) { return async (value: string) => { - // Update pending changes const existingIndex = this.pendingChanges.findIndex( (change) => change.settingKey === settingKey, ); + if (settingKey.includes("Folder")) { + value = normalizePath(value); + } if (existingIndex >= 0) { this.pendingChanges[existingIndex] = { settingKey, @@ -67,18 +69,15 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { }); } - // Clear existing timer if (this.debounceTimer) { window.clearTimeout(this.debounceTimer); } - // Set new timer this.debounceTimer = window.setTimeout(async () => { const changes = [...this.pendingChanges]; this.pendingChanges = []; this.debounceTimer = null; - // Apply all pending changes let needsReinitialize = false; let needsRefreshDisplay = false; @@ -147,7 +146,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { }); new Setting(containerEl) - .setName("OpenAI API Key") + .setName("OpenAI API key") .setDesc("Enter your OpenAI API key") .addText((text) => text @@ -159,7 +158,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Anthropic API Key") + .setName("Anthropic API key") .setDesc("Enter your Anthropic API key") .addText((text) => text @@ -171,7 +170,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Google API Key") + .setName("Google API key") .setDesc("Enter your Google API key") .addText((text) => text @@ -183,7 +182,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Perplexity API Key") + .setName("Perplexity API key") .setDesc("Enter your Perplexity API key") .addText((text) => text @@ -195,7 +194,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Default Folder") + .setName("Default folder") .setDesc("Enter the default folder for CoIntelligence") .addText((text) => text @@ -205,7 +204,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { ); new Setting(containerEl) - .setName("Default Model") + .setName("Default model") .setDesc("Enter the default model for CoIntelligence") .addDropdown((dropdown) => { const availableModels = this.plugin.registry.availableModels; @@ -223,7 +222,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { }); new Setting(containerEl) - .setName("Renaming Model") + .setName("Renaming model") .setDesc("Enter the model for automatically renaming notes") .addDropdown((dropdown) => { const availableModels = this.plugin.registry.availableModels; @@ -244,7 +243,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { }); new Setting(containerEl) - .setName("System Prompt Folder") + .setName("System prompt folder") .setDesc("Enter the folder path for custom system prompts") .addText((textArea) => { textArea.setPlaceholder("Enter folder for custom system prompts"); @@ -255,7 +254,7 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab { }); new Setting(containerEl) - .setName("Default System Prompt") + .setName("Default system prompt") .setDesc("Select note for default system prompt") .addDropdown((dropdown) => { const systemPromptFolder = this.plugin.settings.systemPromptFolder;