diff --git a/main.js b/main.js index b6162ea..a328589 100644 --- a/main.js +++ b/main.js @@ -37,6 +37,7 @@ var DEFAULT_SETTINGS = { maxTokens: 16, defaultPrompt: "", insertionMode: "end", + displayTokensUsage: true, showSidebarIcon: true }; var LightweightChatGPTPlugin = class extends import_obsidian.Plugin { @@ -178,18 +179,16 @@ ${this.plugin.settings.defaultPrompt} responseDividerLine.style.display = "none"; this.outputContainer = contentEl.createEl("div"); this.outputContainer.classList.add("output-container"); - const buttonsContainer = contentEl.createEl("div"); - buttonsContainer.style.display = "flex"; - buttonsContainer.style.marginTop = "1rem"; - const copyToClipboardButton = buttonsContainer.createEl("button", { - text: "Copy to clipboard" - }, (el) => { - el.style.backgroundColor = "green"; - el.style.color = "white"; - }); + this.displayTokensUsageContainer = contentEl.createEl("div"); + this.displayTokensUsageContainer.classList.add("display-tokens-usage-container"); + const buttonsBottomContainer = contentEl.createEl("div"); + buttonsBottomContainer.classList.add("buttons-bottom-container"); + const copyToClipboardButton = buttonsBottomContainer.createEl("button", { text: "Copy to clipboard" }); copyToClipboardButton.style.marginRight = "1rem"; + copyToClipboardButton.style.backgroundColor = "green"; + copyToClipboardButton.style.color = "white"; copyToClipboardButton.style.display = "none"; - const addToPostButton = buttonsContainer.createEl("button", { text: "Add to current document" }); + const addToPostButton = buttonsBottomContainer.createEl("button", { text: "Add to current document" }); addToPostButton.style.marginRight = "1rem"; addToPostButton.style.display = "none"; sendButton.addEventListener("click", async () => { @@ -202,7 +201,7 @@ ${this.plugin.settings.defaultPrompt} return; } if (!this.inputTextArea.value) { - new import_obsidian.Notice("Please Enter text"); + new import_obsidian.Notice("Please enter text"); return; } if (this.isSendingRequest) { @@ -214,11 +213,8 @@ ${this.plugin.settings.defaultPrompt} try { new import_obsidian.Notice("Sending..."); this.responseAPIText = await this.sendRequestToChatGPT(); - if (!this.responseAPIText) { + if (this.responseAPIText && this.responseAPIText.trim() !== "") { this.outputContainer.empty(); - responseDividerLine.style.display = "none"; - copyToClipboardButton.style.display = "none"; - addToPostButton.style.display = "none"; } this.outputContainer.createEl("p", { text: this.responseAPIText }); sendButton.textContent = "Send"; @@ -239,6 +235,14 @@ ${this.plugin.settings.defaultPrompt} this.appendToCurrentNote(this.inputTextArea.value, this.responseAPIText, this.plugin.settings.insertionMode); }); } + async displayTokensUsage(promptTokens, completionTokens, totalTokens) { + this.displayTokensUsageContainer.empty(); + this.displayTokensUsageContainer.createEl("p", { + text: `Tokens Usage Prompt: ${promptTokens} / + Completion: ${completionTokens} / + Total: ${totalTokens}` + }); + } async sendRequestToChatGPT() { const maxTokens = parseInt(this.maxTokensInput.value); try { @@ -262,6 +266,12 @@ ${this.plugin.settings.defaultPrompt} const currentResult = JSON.parse(response); if (currentResult.choices && currentResult.choices.length > 0) { const gptResponse = currentResult.choices[0].message.content; + const promptTokens = currentResult.usage.prompt_tokens; + const completionTokens = currentResult.usage.completion_tokens; + const totalTokens = currentResult.usage.total_tokens; + if (this.plugin.settings.displayTokensUsage) { + this.displayTokensUsage(promptTokens, completionTokens, totalTokens); + } return gptResponse; } else if (currentResult.error) { throw new Error(JSON.stringify(currentResult.error)); @@ -367,6 +377,9 @@ var LightweightChatGPTSettingTab = class extends import_obsidian.PluginSettingTa containerEl.createEl("h6", { text: "ChatGPT Model setting" }); new import_obsidian.Setting(containerEl).setName("Temperature").setDesc("Enter the temperature value between 0 and 2 (inclusive) for the API response").addText((text) => text.setPlaceholder("Enter temperature").setValue(this.plugin.settings.temperature.toString()).onChange(async (value) => { let parsedValue = parseFloat(value); + if (isNaN(parsedValue)) { + parsedValue = 1; + } if (parsedValue < 0) { parsedValue = 0; } else if (parsedValue > 2) { @@ -381,10 +394,10 @@ var LightweightChatGPTSettingTab = class extends import_obsidian.PluginSettingTa if (this.plugin.settings.chatGPTModel === "gpt-4") { parsedMaxValue = 4096; } - if (parsedValue < 1) { - parsedValue = 1; - } else if (parsedValue > parsedMaxValue) { + if (isNaN(parsedValue) || parsedValue > parsedMaxValue) { parsedValue = parsedMaxValue; + } else if (parsedValue < 1) { + parsedValue = 1; } this.plugin.settings.maxTokens = parsedValue; await this.plugin.saveSettings(); @@ -400,6 +413,10 @@ var LightweightChatGPTSettingTab = class extends import_obsidian.PluginSettingTa this.plugin.settings.insertionMode = value; await this.plugin.saveSettings(); })); + new import_obsidian.Setting(containerEl).setName("Display Tokens Usage").setDesc("Toggle to display or hide the number of Tokens used per request.").addToggle((toggle) => toggle.setValue(this.plugin.settings.displayTokensUsage).onChange(async (value) => { + this.plugin.settings.displayTokensUsage = value; + await this.plugin.saveSettings(); + })); new import_obsidian.Setting(containerEl).setName("Show Sidebar Icon").setDesc("Toggle to show or hide the sidebar icon").addToggle((toggle) => toggle.setValue(this.plugin.settings.showSidebarIcon).onChange(async (value) => { this.plugin.settings.showSidebarIcon = value; await this.plugin.saveSettings(); @@ -419,20 +436,17 @@ var LightweightChatGPTSettingTab = class extends import_obsidian.PluginSettingTa const githubAnchor = githubLink.createEl("a", { cls: "settings-github-link" }); - const githubLogo = githubAnchor.createEl("img", { - cls: "settings-github-logo" - }); githubAnchor.href = "https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin"; githubAnchor.target = "_blank"; githubAnchor.rel = "noopener"; - const githubText = githubAnchor.createEl("span", { - text: "View on GitHub" + const githubLogo = githubAnchor.createEl("img", { + cls: "settings-github-logo" }); githubLogo.src = "https://assets.stickpng.com/images/5847f98fcef1014c0b5e48c0.png"; githubLogo.alt = "GitHub"; - githubLogo.style.width = "24px"; - githubLogo.style.height = "24px"; - githubLogo.style.verticalAlign = "middle"; + const githubText = githubAnchor.createEl("span", { + text: "View on GitHub" + }); githubText.style.display = "inline-block"; githubText.style.verticalAlign = "middle"; } diff --git a/main.ts b/main.ts index e8430ff..bc65402 100644 --- a/main.ts +++ b/main.ts @@ -20,6 +20,7 @@ interface LightweightChatGPTPluginSettings { maxTokens: number; defaultPrompt: string; insertionMode: string; + displayTokensUsage: boolean; showSidebarIcon: boolean; } @@ -32,6 +33,7 @@ const DEFAULT_SETTINGS: LightweightChatGPTPluginSettings = { maxTokens: 16, defaultPrompt: '', insertionMode: 'end', + displayTokensUsage: true, showSidebarIcon: true } @@ -134,6 +136,7 @@ class LightweightChatGPTWindow extends Modal { private inputTextArea: HTMLTextAreaElement; private outputContainer: HTMLElement; + private displayTokensUsageContainer: HTMLElement; private maxTokensInput: HTMLInputElement; private responseAPIText: string; @@ -223,19 +226,19 @@ class LightweightChatGPTWindow extends Modal { this.outputContainer = contentEl.createEl('div'); this.outputContainer.classList.add('output-container'); + // Tokens Container + this.displayTokensUsageContainer = contentEl.createEl('div'); + this.displayTokensUsageContainer.classList.add('display-tokens-usage-container'); + // Add Other Button - const buttonsContainer = contentEl.createEl('div'); - buttonsContainer.style.display = 'flex'; - buttonsContainer.style.marginTop = '1rem'; - const copyToClipboardButton = buttonsContainer.createEl('button', { - text: 'Copy to clipboard' - }, (el: HTMLButtonElement) => { - el.style.backgroundColor = 'green'; - el.style.color = 'white'; - }); + const buttonsBottomContainer = contentEl.createEl('div'); + buttonsBottomContainer.classList.add('buttons-bottom-container'); + const copyToClipboardButton = buttonsBottomContainer.createEl('button', { text: 'Copy to clipboard' }); copyToClipboardButton.style.marginRight = '1rem'; + copyToClipboardButton.style.backgroundColor = 'green'; + copyToClipboardButton.style.color = 'white'; copyToClipboardButton.style.display = 'none'; - const addToPostButton = buttonsContainer.createEl('button', { text: 'Add to current document' }); + const addToPostButton = buttonsBottomContainer.createEl('button', { text: 'Add to current document' }); addToPostButton.style.marginRight = '1rem'; addToPostButton.style.display = 'none'; @@ -252,7 +255,7 @@ class LightweightChatGPTWindow extends Modal { } if (!this.inputTextArea.value) { - new Notice('Please Enter text'); + new Notice('Please enter text'); return; } @@ -269,12 +272,10 @@ class LightweightChatGPTWindow extends Modal { new Notice('Sending...'); this.responseAPIText = await this.sendRequestToChatGPT(); - if (!this.responseAPIText) { + if (this.responseAPIText && this.responseAPIText.trim() !== '') { this.outputContainer.empty(); - responseDividerLine.style.display = 'none'; - copyToClipboardButton.style.display = 'none'; - addToPostButton.style.display = 'none'; } + this.outputContainer.createEl('p', { text: this.responseAPIText }); sendButton.textContent = 'Send'; @@ -298,6 +299,16 @@ class LightweightChatGPTWindow extends Modal { }); } + async displayTokensUsage(promptTokens: number, completionTokens: number, totalTokens: number) { + this.displayTokensUsageContainer.empty(); + + this.displayTokensUsageContainer.createEl('p', { + text: `Tokens Usage Prompt: ${promptTokens} / + Completion: ${completionTokens} / + Total: ${totalTokens}` + }); + } + async sendRequestToChatGPT() { const maxTokens = parseInt(this.maxTokensInput.value); @@ -323,6 +334,15 @@ class LightweightChatGPTWindow extends Modal { const currentResult = JSON.parse(response); if (currentResult.choices && currentResult.choices.length > 0) { const gptResponse = currentResult.choices[0].message.content; + + const promptTokens = currentResult.usage.prompt_tokens; + const completionTokens = currentResult.usage.completion_tokens; + const totalTokens = currentResult.usage.total_tokens; + + if (this.plugin.settings.displayTokensUsage) { + this.displayTokensUsage(promptTokens, completionTokens, totalTokens); + } + return gptResponse; } else if (currentResult.error) { throw new Error(JSON.stringify(currentResult.error)); @@ -353,7 +373,7 @@ class LightweightChatGPTWindow extends Modal { new Notice('No text to add'); return; } - + const activeView = this.app.workspace.getActiveViewOfType(MarkdownView); const activeLeaf = activeView?.leaf; if (activeView && activeLeaf && activeLeaf.view instanceof MarkdownView) { @@ -475,6 +495,9 @@ class LightweightChatGPTSettingTab extends PluginSettingTab { .setValue(this.plugin.settings.temperature.toString()) .onChange(async (value) => { let parsedValue = parseFloat(value); + if (isNaN(parsedValue)) { + parsedValue = 1; + } if (parsedValue < 0) { parsedValue = 0; } else if (parsedValue > 2) { @@ -498,10 +521,10 @@ class LightweightChatGPTSettingTab extends PluginSettingTab { if (this.plugin.settings.chatGPTModel === "gpt-4") { parsedMaxValue = 4096; } - if (parsedValue < 1) { - parsedValue = 1; - } else if (parsedValue > parsedMaxValue) { + if (isNaN(parsedValue) || parsedValue > parsedMaxValue) { parsedValue = parsedMaxValue; + } else if (parsedValue < 1) { + parsedValue = 1; } this.plugin.settings.maxTokens = parsedValue; await this.plugin.saveSettings(); @@ -534,6 +557,16 @@ class LightweightChatGPTSettingTab extends PluginSettingTab { await this.plugin.saveSettings(); })); + new Setting(containerEl) + .setName('Display Tokens Usage') + .setDesc('Toggle to display or hide the number of Tokens used per request.') + .addToggle(toggle => toggle + .setValue(this.plugin.settings.displayTokensUsage) + .onChange(async (value) => { + this.plugin.settings.displayTokensUsage = value; + await this.plugin.saveSettings(); + })); + new Setting(containerEl) .setName('Show Sidebar Icon') .setDesc('Toggle to show or hide the sidebar icon') @@ -560,22 +593,19 @@ class LightweightChatGPTSettingTab extends PluginSettingTab { const githubAnchor = githubLink.createEl('a', { cls: 'settings-github-link', }); - const githubLogo = githubAnchor.createEl('img', { - cls: 'settings-github-logo', - }); githubAnchor.href = 'https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin'; githubAnchor.target = '_blank'; githubAnchor.rel = 'noopener'; + + const githubLogo = githubAnchor.createEl('img', { + cls: 'settings-github-logo', + }); + githubLogo.src = 'https://assets.stickpng.com/images/5847f98fcef1014c0b5e48c0.png'; + githubLogo.alt = 'GitHub'; const githubText = githubAnchor.createEl('span', { text: 'View on GitHub', }); - - githubLogo.src = 'https://assets.stickpng.com/images/5847f98fcef1014c0b5e48c0.png'; - githubLogo.alt = 'GitHub'; - githubLogo.style.width = '24px'; - githubLogo.style.height = '24px'; - githubLogo.style.verticalAlign = 'middle'; githubText.style.display = 'inline-block'; githubText.style.verticalAlign = 'middle'; } diff --git a/manifest.json b/manifest.json index ac784c4..eab5fb2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,11 +1,11 @@ { "id": "gpt-liteinquirer", "name": "GPT-LiteInquirer", - "version": "1.0.0", + "version": "1.1.5", "minAppVersion": "0.15.0", "description": "Experience OpenAI ChatGPT assistance directly within Obsidian, drafting content without interrupting your creative flow.", "author": "ittuann", "authorUrl": "https://github.com/ittuann", "fundingUrl": "", "isDesktopOnly": false -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index cc43d61..954bec3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gpt-liteinquirer", - "version": "1.0.0", + "version": "1.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gpt-liteinquirer", - "version": "1.0.0", + "version": "1.1.5", "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", @@ -40,342 +40,6 @@ "w3c-keyname": "^2.2.4" } }, - "node_modules/@esbuild/android-arm": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.3.tgz", - "integrity": "sha512-1Mlz934GvbgdDmt26rTLmf03cAgLg5HyOgJN+ZGCeP3Q9ynYTNMn2/LQxIl7Uy+o4K6Rfi2OuLsr12JQQR8gNg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.3.tgz", - "integrity": "sha512-XvJsYo3dO3Pi4kpalkyMvfQsjxPWHYjoX4MDiB/FUM4YMfWcXa5l4VCwFWVYI1+92yxqjuqrhNg0CZg3gSouyQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.3.tgz", - "integrity": "sha512-nuV2CmLS07Gqh5/GrZLuqkU9Bm6H6vcCspM+zjp9TdQlxJtIe+qqEXQChmfc7nWdyr/yz3h45Utk1tUn8Cz5+A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.3.tgz", - "integrity": "sha512-01Hxaaat6m0Xp9AXGM8mjFtqqwDjzlMP0eQq9zll9U85ttVALGCGDuEvra5Feu/NbP5AEP1MaopPwzsTcUq1cw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.3.tgz", - "integrity": "sha512-Eo2gq0Q/er2muf8Z83X21UFoB7EU6/m3GNKvrhACJkjVThd0uA+8RfKpfNhuMCl1bKRfBzKOk6xaYKQZ4lZqvA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.3.tgz", - "integrity": "sha512-CN62ESxaquP61n1ZjQP/jZte8CE09M6kNn3baos2SeUfdVBkWN5n6vGp2iKyb/bm/x4JQzEvJgRHLGd5F5b81w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.3.tgz", - "integrity": "sha512-feq+K8TxIznZE+zhdVurF3WNJ/Sa35dQNYbaqM/wsCbWdzXr5lyq+AaTUSER2cUR+SXPnd/EY75EPRjf4s1SLg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.3.tgz", - "integrity": "sha512-CLP3EgyNuPcg2cshbwkqYy5bbAgK+VhyfMU7oIYyn+x4Y67xb5C5ylxsNUjRmr8BX+MW3YhVNm6Lq6FKtRTWHQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.3.tgz", - "integrity": "sha512-JHeZXD4auLYBnrKn6JYJ0o5nWJI9PhChA/Nt0G4MvLaMrvXuWnY93R3a7PiXeJQphpL1nYsaMcoV2QtuvRnF/g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.3.tgz", - "integrity": "sha512-FyXlD2ZjZqTFh0sOQxFDiWG1uQUEOLbEh9gKN/7pFxck5Vw0qjWSDqbn6C10GAa1rXJpwsntHcmLqydY9ST9ZA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.3.tgz", - "integrity": "sha512-OrDGMvDBI2g7s04J8dh8/I7eSO+/E7nMDT2Z5IruBfUO/RiigF1OF6xoH33Dn4W/OwAWSUf1s2nXamb28ZklTA==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.3.tgz", - "integrity": "sha512-DcnUpXnVCJvmv0TzuLwKBC2nsQHle8EIiAJiJ+PipEVC16wHXaPEKP0EqN8WnBe0TPvMITOUlP2aiL5YMld+CQ==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.3.tgz", - "integrity": "sha512-BDYf/l1WVhWE+FHAW3FzZPtVlk9QsrwsxGzABmN4g8bTjmhazsId3h127pliDRRu5674k1Y2RWejbpN46N9ZhQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.3.tgz", - "integrity": "sha512-WViAxWYMRIi+prTJTyV1wnqd2mS2cPqJlN85oscVhXdb/ZTFJdrpaqm/uDsZPGKHtbg5TuRX/ymKdOSk41YZow==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.3.tgz", - "integrity": "sha512-Iw8lkNHUC4oGP1O/KhumcVy77u2s6+KUjieUqzEU3XuWJqZ+AY7uVMrrCbAiwWTkpQHkr00BuXH5RpC6Sb/7Ug==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.3.tgz", - "integrity": "sha512-0AGkWQMzeoeAtXQRNB3s4J1/T2XbigM2/Mn2yU1tQSmQRmHIZdkGbVq2A3aDdNslPyhb9/lH0S5GMTZ4xsjBqg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.3.tgz", - "integrity": "sha512-4+rR/WHOxIVh53UIQIICryjdoKdHsFZFD4zLSonJ9RRw7bhKzVyXbnRPsWSfwybYqw9sB7ots/SYyufL1mBpEg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.3.tgz", - "integrity": "sha512-cVpWnkx9IYg99EjGxa5Gc0XmqumtAwK3aoz7O4Dii2vko+qXbkHoujWA68cqXjhh6TsLaQelfDO4MVnyr+ODeA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.3.tgz", - "integrity": "sha512-RxmhKLbTCDAY2xOfrww6ieIZkZF+KBqG7S2Ako2SljKXRFi+0863PspK74QQ7JpmWwncChY25JTJSbVBYGQk2Q==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.3.tgz", - "integrity": "sha512-0r36VeEJ4efwmofxVJRXDjVRP2jTmv877zc+i+Pc7MNsIr38NfsjkQj23AfF7l0WbB+RQ7VUb+LDiqC/KY/M/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.17.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.3.tgz", - "integrity": "sha512-wgO6rc7uGStH22nur4aLFcq7Wh86bE9cOFmfTr/yxN3BXvDEdCSXyKkO+U5JIt53eTOgC47v9k/C1bITWL/Teg==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, "node_modules/@esbuild/win32-x64": { "version": "0.17.3", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.3.tgz", diff --git a/package.json b/package.json index dd865c5..f011e91 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "gpt-liteinquirer", - "version": "1.0.0", + "version": "1.1.5", "description": "Experience OpenAI ChatGPT assistance directly within Obsidian, drafting content without interrupting your creative flow.", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", "build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production", - "version": "node version-bump.mjs && git add manifest.json versions.json", + "version": "node version-bump.mjs", "lint": "eslint .", "pretty": "prettier --check \"**/*.{ts,css,scss,json,mjs,jsx,md}\"" }, diff --git a/styles.css b/styles.css index 297def3..bd1eadc 100644 --- a/styles.css +++ b/styles.css @@ -33,8 +33,14 @@ user-select: text; } +.display-tokens-usage-container { + font-style: italic; + text-align: right; + font-size: 12px; +} + /* Buttons */ -.buttons-container { +.buttons-bottom-container { display: flex; margin-top: 1rem; } @@ -69,3 +75,10 @@ color: white; text-decoration: none; } + +.settings-github-logo { + width: 24px; + height: 24px; + vertical-align: middle; + display: inline-block; +} diff --git a/versions.json b/versions.json index 26382a1..6914cba 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,5 @@ { - "1.0.0": "0.15.0" -} + "1.0.0": "0.15.0", + "1.1.3": "0.15.0", + "1.1.5": "0.15.0" +} \ No newline at end of file