mirror of
https://github.com/epistemic-technology/co-intelligence.git
synced 2026-07-22 06:45:17 +00:00
Improve conformity to Obsidian plugin norms
This commit is contained in:
parent
59145eb603
commit
eba15d47a1
7 changed files with 77 additions and 65 deletions
BIN
assets/images/kofi.png
Normal file
BIN
assets/images/kofi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "co-intelligence",
|
||||
"name": "Co-Intelligence AI",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.6",
|
||||
"minAppVersion": "1.8.0",
|
||||
"description": "Co-Intelligence AI gives you a full AI chat experience in Obsidian.",
|
||||
"author": "Mike Thicke",
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import {
|
|||
} from "obsidian";
|
||||
import { around } from "monkey-around";
|
||||
|
||||
import "./styles.css";
|
||||
|
||||
import {
|
||||
CoIntelligenceSettings,
|
||||
CoIntelligenceSettingsTab,
|
||||
|
|
|
|||
125
src/settings.ts
125
src/settings.ts
|
|
@ -2,6 +2,8 @@ import type CoIntelligencePlugin from "@/CoIntelligencePlugin";
|
|||
import { App, normalizePath, PluginSettingTab, Setting } from "obsidian";
|
||||
import { ModelId } from "@/types";
|
||||
|
||||
import kofiLogo from "@assets/images/kofi.png";
|
||||
|
||||
export interface CoIntelligenceSettings {
|
||||
openaiApiKey: string;
|
||||
anthropicApiKey: string;
|
||||
|
|
@ -143,67 +145,6 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab {
|
|||
|
||||
containerEl.empty();
|
||||
|
||||
// Following pattern from https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/settings.ts
|
||||
const callToActionDiv = containerEl.createDiv("coi-settings-cta");
|
||||
const feedbackDiv = callToActionDiv.createDiv("coi-settings-feedback");
|
||||
const donateDiv = callToActionDiv.createDiv("coi-settings-donate");
|
||||
const kofiLink = donateDiv.createEl("a", {
|
||||
href: "https://ko-fi.com/epistemictechnology",
|
||||
cls: "coi-settings-donate-link",
|
||||
});
|
||||
const srOnlySpan = kofiLink.createEl("span", {
|
||||
text: "Support me on Ko-fi",
|
||||
cls: "sr-only",
|
||||
});
|
||||
kofiLink.createEl("img", {
|
||||
attr: {
|
||||
src: "https://cdn.ko-fi.com/cdn/kofi1.png?v=3",
|
||||
alt: "Buy me a coffee",
|
||||
cls: "coi-settings-donate-img",
|
||||
},
|
||||
});
|
||||
const feedbackLink = feedbackDiv.createEl("a", {
|
||||
href: "https://github.com/Epistemic-Technology/co-intelligence/issues",
|
||||
attr: {
|
||||
"aria-label":
|
||||
"Report a bug, suggest a feature, offer feedback, or ask a question",
|
||||
},
|
||||
});
|
||||
const githubSVG = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"svg",
|
||||
);
|
||||
githubSVG.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
||||
githubSVG.setAttribute("viewBox", "0 0 24 24");
|
||||
githubSVG.setAttribute("fill", "none");
|
||||
githubSVG.setAttribute("stroke", "currentColor");
|
||||
githubSVG.setAttribute("stroke-width", "2");
|
||||
githubSVG.setAttribute("stroke-linecap", "round");
|
||||
githubSVG.setAttribute("stroke-linejoin", "round");
|
||||
|
||||
const path1 = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"path",
|
||||
);
|
||||
path1.setAttribute(
|
||||
"d",
|
||||
"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",
|
||||
);
|
||||
|
||||
const path2 = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"path",
|
||||
);
|
||||
path2.setAttribute("d", "M9 18c-4.51 2-5-2-7-2");
|
||||
|
||||
githubSVG.appendChild(path1);
|
||||
githubSVG.appendChild(path2);
|
||||
|
||||
const textDiv = document.createElement("div");
|
||||
textDiv.textContent = "Bugs, feedback, help";
|
||||
|
||||
feedbackLink.appendChild(githubSVG);
|
||||
feedbackLink.appendChild(textDiv);
|
||||
containerEl.createEl("div", {
|
||||
text: "⚠️ API keys are stored unencrypted in your vault. Anyone with access to your vault can read them.",
|
||||
cls: "coi-settings-security-warning",
|
||||
|
|
@ -341,5 +282,67 @@ export class CoIntelligenceSettingsTab extends PluginSettingTab {
|
|||
this.createDebouncedChangeHandler("defaultSystemPromptNote"),
|
||||
);
|
||||
});
|
||||
|
||||
// Following pattern from https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/src/core/settings.ts
|
||||
const callToActionDiv = containerEl.createDiv("coi-settings-cta");
|
||||
const feedbackDiv = callToActionDiv.createDiv("coi-settings-feedback");
|
||||
const donateDiv = callToActionDiv.createDiv("coi-settings-donate");
|
||||
const kofiLink = donateDiv.createEl("a", {
|
||||
href: "https://ko-fi.com/epistemictechnology",
|
||||
cls: "coi-settings-donate-link",
|
||||
});
|
||||
const srOnlySpan = kofiLink.createEl("span", {
|
||||
text: "Support me on Ko-fi",
|
||||
cls: "sr-only",
|
||||
});
|
||||
kofiLink.createEl("img", {
|
||||
attr: {
|
||||
src: kofiLogo,
|
||||
alt: "Buy me a coffee",
|
||||
cls: "coi-settings-donate-img",
|
||||
},
|
||||
});
|
||||
const feedbackLink = feedbackDiv.createEl("a", {
|
||||
href: "https://github.com/Epistemic-Technology/co-intelligence/issues",
|
||||
attr: {
|
||||
"aria-label":
|
||||
"Report a bug, suggest a feature, offer feedback, or ask a question",
|
||||
},
|
||||
});
|
||||
const githubSVG = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"svg",
|
||||
);
|
||||
githubSVG.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
||||
githubSVG.setAttribute("viewBox", "0 0 24 24");
|
||||
githubSVG.setAttribute("fill", "none");
|
||||
githubSVG.setAttribute("stroke", "currentColor");
|
||||
githubSVG.setAttribute("stroke-width", "2");
|
||||
githubSVG.setAttribute("stroke-linecap", "round");
|
||||
githubSVG.setAttribute("stroke-linejoin", "round");
|
||||
|
||||
const path1 = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"path",
|
||||
);
|
||||
path1.setAttribute(
|
||||
"d",
|
||||
"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",
|
||||
);
|
||||
|
||||
const path2 = document.createElementNS(
|
||||
"http://www.w3.org/2000/svg",
|
||||
"path",
|
||||
);
|
||||
path2.setAttribute("d", "M9 18c-4.51 2-5-2-7-2");
|
||||
|
||||
githubSVG.appendChild(path1);
|
||||
githubSVG.appendChild(path2);
|
||||
|
||||
const textDiv = document.createElement("div");
|
||||
textDiv.textContent = "Bugs, feedback, help";
|
||||
|
||||
feedbackLink.appendChild(githubSVG);
|
||||
feedbackLink.appendChild(textDiv);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7
src/vite-env.d.ts
vendored
Normal file
7
src/vite-env.d.ts
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/// <reference types="vite/client" />
|
||||
|
||||
declare module "*.png";
|
||||
declare module "*.jpg";
|
||||
declare module "*.jpeg";
|
||||
declare module "*.gif";
|
||||
declare module "*.svg";
|
||||
|
|
@ -10,7 +10,8 @@
|
|||
"esModuleInterop": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
"@/*": ["src/*"],
|
||||
"@assets/*": ["assets/*"]
|
||||
},
|
||||
"types": ["obsidian"]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ export default defineConfig({
|
|||
viteStaticCopy({
|
||||
targets: [{ src: "manifest.json", dest: "." }],
|
||||
}),
|
||||
viteStaticCopy({
|
||||
targets: [{ src: "src/styles.css", dest: "." }],
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue