modify the naming.

This commit is contained in:
ittuann 2023-04-02 10:59:38 +08:00
parent 0cf5f42582
commit 5bb5f8ea2f
5 changed files with 37 additions and 31 deletions

View file

@ -1,15 +1,15 @@
# Lightweight ChatGPT Plugin for Obsidian
# GPT-LiteInquirer Plugin for Obsidian
[![build](https://img.shields.io/github/actions/workflow/status/ittuann/obsidian-lightweight-chatgpt-plugin/build.yml?branch=master&label=Build%20Status&logo=github&style=for-the-badge)](https://github.com/ittuann/obsidian-lightweight-chatgpt-plugin)
[![build](https://img.shields.io/github/actions/workflow/status/ittuann/obsidian-gpt-liteinquirer-plugin/build.yml?branch=master&label=Build%20Status&logo=github&style=for-the-badge)](https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin)
With this Lightweight ChatGPT Plugin, you can quickly and senselessly generate ideas, draft content, or get assistance from the ChatGPT AI, all without leaving Obsidian, without interrupt your creative flow.
With this GPT-LiteInquirer Plugin, you can quickly and senselessly generate ideas, draft content, or get assistance from the ChatGPT AI, all without leaving Obsidian, without interrupt your creative flow.
The Lightweight ChatGPT Plugin is a fast, easy-to-use, and non-intrusive AI assistant plugin, which senselessly integrates OpenAI's ChatGPT API directly into Obsidian.
If you enjoy this plugin or would like to show your support, please consider giving it a free star on GitHub~
**View and download this plugin: [Click here](https://obsidian.md/plugins?id=lightweight-chatgpt-plugin)**
**View and download this plugin: [Click here](https://obsidian.md/plugins?id=gpt-liteinquirer)**
## Features
@ -19,8 +19,10 @@ If you enjoy this plugin or would like to show your support, please consider giv
- You no longer have to worry about being interrupted in your creative process by leaving Obsidian to switch between software.
- **User-friendly interface:**
- Interact with the ChatGPT API through an intuitive and straightforward lightweight design interface.
- **Direct API access:**
- Send text to OpenAI's ChatGPT API and receive responses directly in Obsidian, quickly enriching your content or generating new ideas.
- **Diverse ways to use:**
- You can quickly input the current document as a knowledge base into ChatGPT, and ask any questions about any content.
- You can also directly start a conversation with ChatGPT, quickly drafting and enriching your content, generating new ideas, or using the ChatGPT artificial intelligence to do anything you want.
- **Flexible response handling:**
- Copy the AI-generated response to the clipboard. Alternatively, insert it directly at the cursor position in your current document, or at the end of the document.
@ -38,7 +40,7 @@ To download Obsidian: [Click here](https://www.obsidian.md/)
## Usage
You can open the Lightweight ChatGPT Plugin window in three ways:
You can open the Lightweight ChatGPT Plugin interface in three ways:
- By clicking on the Obsidian ribbon on the left.
@ -52,5 +54,12 @@ Tips: You can also send content directly using the `CTRL + ENTER` shortcut.
---
- TODO List:
- Add support for Azure API
- Add support for GPT-4
Lightweight ChatGPT Plugin for Obsidian wants to be a nice companion to boost your creativity and productivity. Experience the seamless AI-enhanced writing and content generation capabilities within Obsidian today!

11
main.js
View file

@ -73,7 +73,7 @@ var LightweightChatGPTPlugin = class extends import_obsidian.Plugin {
}
addSidebarIcon() {
try {
this.ribbonIconEl = this.addRibbonIcon("feather", "Lightweight ChatGPT Plugin Window", (evt) => {
this.ribbonIconEl = this.addRibbonIcon("feather", "GPT-LiteInquirer", (evt) => {
try {
new LightweightChatGPTWindow(this.app, this.settings.apiKey, this.settings.temperature, this.settings.maxTokens, this.settings.insertionMode).open();
} catch (error) {
@ -117,8 +117,8 @@ var LightweightChatGPTWindow = class extends import_obsidian.Modal {
const activeView = this.app.workspace.getActiveViewOfType(import_obsidian.MarkdownView);
const selectedText = activeView ? activeView.editor.getSelection() : "";
this.inputTextArea = contentEl.createEl("textarea");
this.inputTextArea.rows = 4;
this.inputTextArea.style.width = "100%";
this.inputTextArea.rows = 4;
this.inputTextArea.placeholder = "Enter your text here ...";
this.inputTextArea.value = selectedText ? `${selectedText}
====
@ -134,10 +134,7 @@ var LightweightChatGPTWindow = class extends import_obsidian.Modal {
});
contentEl.createEl("hr");
const maxTokensContainer = contentEl.createEl("div");
maxTokensContainer.style.display = "flex";
maxTokensContainer.style.justifyContent = "space-between";
maxTokensContainer.style.alignItems = "center";
maxTokensContainer.style.marginTop = "1rem";
maxTokensContainer.className = "max-tokens-container";
const maxTokensLabelContainer = maxTokensContainer.createEl("div");
maxTokensLabelContainer.createEl("label", { text: "Max tokens:" });
const maxTokensDescription = maxTokensLabelContainer.createEl("p", { text: "Max OpenAI ChatGpt Tokens" });
@ -374,7 +371,7 @@ var LightweightChatGPTSettingTab = class extends import_obsidian.PluginSettingTa
const githubAnchor = githubLink.createEl("a", {
cls: "github-link"
});
githubAnchor.href = "https://github.com/ittuann/obsidian-lightweight-chatgpt-plugin";
githubAnchor.href = "https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin";
githubAnchor.target = "_blank";
githubAnchor.rel = "noopener";
githubAnchor.createEl("span", {

16
main.ts
View file

@ -1,5 +1,7 @@
import { App, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian';
interface LightweightChatGPTPluginSettings {
apiKey: string;
maxTokens: number;
@ -23,7 +25,7 @@ export default class LightweightChatGPTPlugin extends Plugin {
ribbonIconEl: HTMLElement;
async onload() {
try {
await this.loadSettings();
} catch (error) {
@ -72,7 +74,7 @@ export default class LightweightChatGPTPlugin extends Plugin {
addSidebarIcon() {
try {
this.ribbonIconEl = this.addRibbonIcon('feather', 'Lightweight ChatGPT Plugin Window', (evt: MouseEvent) => {
this.ribbonIconEl = this.addRibbonIcon('feather', 'GPT-LiteInquirer', (evt: MouseEvent) => {
try {
new LightweightChatGPTWindow(this.app, this.settings.apiKey, this.settings.temperature, this.settings.maxTokens, this.settings.insertionMode).open();
} catch (error) {
@ -139,8 +141,8 @@ class LightweightChatGPTWindow extends Modal {
const selectedText = activeView ? activeView.editor.getSelection() : '';
this.inputTextArea = contentEl.createEl('textarea');
this.inputTextArea.rows = 4;
this.inputTextArea.style.width = '100%';
this.inputTextArea.rows = 4;
this.inputTextArea.placeholder = 'Enter your text here ...';
this.inputTextArea.value = selectedText ? `${selectedText}\n====\n` : '';
@ -158,10 +160,8 @@ class LightweightChatGPTWindow extends Modal {
// Max Tokens
const maxTokensContainer = contentEl.createEl('div');
maxTokensContainer.style.display = 'flex';
maxTokensContainer.style.justifyContent = 'space-between';
maxTokensContainer.style.alignItems = 'center';
maxTokensContainer.style.marginTop = '1rem';
// maxTokensContainer.style.marginRight = '0.5rem';
maxTokensContainer.className = "max-tokens-container";
const maxTokensLabelContainer = maxTokensContainer.createEl('div');
maxTokensLabelContainer.createEl('label', { text: 'Max tokens:' });
@ -478,7 +478,7 @@ class LightweightChatGPTSettingTab extends PluginSettingTab {
const githubAnchor = githubLink.createEl('a', {
cls: 'github-link',
});
githubAnchor.href = 'https://github.com/ittuann/obsidian-lightweight-chatgpt-plugin';
githubAnchor.href = 'https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin';
githubAnchor.target = '_blank';
githubAnchor.rel = 'noopener';
// const githubLogo = githubAnchor.createEl('img', {

View file

@ -1,11 +1,11 @@
{
"id": "lightweight-chatgpt",
"name": "Lightweight ChatGPT",
"id": "gpt-liteinquirer",
"name": "GPT-LiteInquirer",
"version": "1.0.0",
"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": "https://github.com/ittuann/obsidian-lightweight-chatgpt-plugin",
"fundingUrl": "https://github.com/ittuann/obsidian-gpt-liteinquirer-plugin",
"isDesktopOnly": false
}

View file

@ -1,6 +1,6 @@
/*
This CSS file will be included with your plugin, and
available in the app when your plugin is enabled.
*/
.max-tokens-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 1rem;
}