mirror of
https://github.com/yzh503/obsidian-aicommander-plugin.git
synced 2026-07-22 07:40:26 +00:00
Compare commits
12 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4803788959 | ||
|
|
60c3f51d2c | ||
|
|
330ce44d20 | ||
|
|
e2b46a8f2e | ||
|
|
a6fb4afbb6 | ||
|
|
6750ad7062 | ||
|
|
e6af43e076 | ||
|
|
71edf59e51 | ||
|
|
174cb2fc47 | ||
|
|
2fa22c6c88 | ||
|
|
64b6f35f55 | ||
|
|
7a5f9c14a4 |
9 changed files with 1164 additions and 4229 deletions
6
.prettierrc
Normal file
6
.prettierrc
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
||||||
10
README.md
10
README.md
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
<a href="https://www.buymeacoffee.com/yzh503" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 40px !important;width: 150px !important;" ></a>
|
<a href="https://www.buymeacoffee.com/yzh503" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 40px !important;width: 150px !important;" ></a>
|
||||||
|
|
||||||
**AI Commander** is a simple AI connector that helps you write notes with the power of OpenAI APIs in conjunction with Bing search engine.
|
**AI Commander** is a simple AI connector that helps you write notes with the power of OpenAI (ChatGPT) APIs in conjunction with Bing search engine.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
[OpenAI API key](https://platform.openai.com/account/api-keys) is required to use this plugin.
|
[OpenAI API key](https://platform.openai.com/account/api-keys) is required to use this plugin.
|
||||||
|
|
||||||
|
|
@ -18,9 +20,9 @@
|
||||||
|
|
||||||
## Supported models
|
## Supported models
|
||||||
|
|
||||||
- OpenAI gpt-3.5-turbo
|
- GPT models listed in https://platform.openai.com/docs/models/gpt-4
|
||||||
- OpenAI Whisper
|
- Whisper v1
|
||||||
- OpenAI image generation model
|
- DALL·E image generation model
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
|
|
|
||||||
BIN
demo.gif
Normal file
BIN
demo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 KiB |
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"id": "ai-commander",
|
"id": "ai-commander",
|
||||||
"name": "AI Commander",
|
"name": "AI Commander",
|
||||||
"version": "1.3.0",
|
"version": "1.3.4",
|
||||||
"minAppVersion": "1.0.0",
|
"minAppVersion": "1.0.0",
|
||||||
"description": "Generate audio transcripts, images, and text in context of PDF attachments or web search results using OpenAI and Bing API.",
|
"description": "Generate audio transcripts, images, and text in context of PDF attachments or web search results using OpenAI (ChatGPT) and Bing API.",
|
||||||
"author": "Simon Yang",
|
"author": "Simon Yang",
|
||||||
"authorUrl": "https://yzh503.github.io",
|
"authorUrl": "https://yzh503.github.io",
|
||||||
"fundingUrl": "https://www.buymeacoffee.com/yzh503",
|
"fundingUrl": "https://www.buymeacoffee.com/yzh503",
|
||||||
|
|
|
||||||
3767
package-lock.json
generated
3767
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "obsidian-sample-plugin",
|
"name": "obsidian-aicommander-plugin",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
|
|
||||||
1553
src/main.ts
1553
src/main.ts
File diff suppressed because it is too large
Load diff
49
src/modal.ts
49
src/modal.ts
|
|
@ -1,4 +1,4 @@
|
||||||
import { App, Modal, Setting } from "obsidian";
|
import { App, Modal } from "obsidian";
|
||||||
|
|
||||||
export class PromptModal extends Modal {
|
export class PromptModal extends Modal {
|
||||||
prompt: string;
|
prompt: string;
|
||||||
|
|
@ -7,34 +7,47 @@ export class PromptModal extends Modal {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
app: App,
|
app: App,
|
||||||
defaultprompt: string,
|
defaultPrompt: string,
|
||||||
onSubmit: (prompt: string) => void
|
onSubmit: (prompt: string) => void
|
||||||
) {
|
) {
|
||||||
super(app);
|
super(app);
|
||||||
this.prompt = defaultprompt;
|
this.prompt = defaultPrompt;
|
||||||
this.onSubmit = onSubmit;
|
this.onSubmit = onSubmit;
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpen() {
|
onOpen() {
|
||||||
const { contentEl } = this;
|
const { contentEl } = this;
|
||||||
|
|
||||||
contentEl.createEl("h1", { text: "" });
|
// Add a title to the modal
|
||||||
|
contentEl.createEl("h2", { text: "Generate Text from Prompt" });
|
||||||
|
|
||||||
new Setting(contentEl).setName("Generate text from prompt").addText((text) =>
|
// Create a container for the textarea
|
||||||
text.setValue(this.prompt).onChange((value) => {
|
const textareaContainer = contentEl.createDiv({ cls: "prompt-modal-textarea-container" });
|
||||||
this.prompt = value;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
new Setting(contentEl).addButton((btn) =>
|
// Create the textarea element
|
||||||
btn
|
const textarea = textareaContainer.createEl("textarea", { cls: "prompt-modal-textarea" });
|
||||||
.setButtonText("Submit")
|
textarea.value = this.prompt;
|
||||||
.setCta()
|
|
||||||
.onClick(() => {
|
textarea.addEventListener("input", () => {
|
||||||
this.close();
|
this.prompt = textarea.value;
|
||||||
this.onSubmit(this.prompt);
|
});
|
||||||
})
|
|
||||||
);
|
// Create a container for the buttons
|
||||||
|
const buttonContainer = contentEl.createDiv({ cls: "prompt-modal-button-container" });
|
||||||
|
|
||||||
|
// Create the submit button
|
||||||
|
const submitBtn = buttonContainer.createEl("button", { text: "Submit" });
|
||||||
|
submitBtn.addClass("mod-cta"); // Obsidian's standard call-to-action button styling
|
||||||
|
submitBtn.addEventListener("click", () => {
|
||||||
|
this.close();
|
||||||
|
this.onSubmit(this.prompt);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Optionally, add a cancel button
|
||||||
|
const cancelBtn = buttonContainer.createEl("button", { text: "Cancel" });
|
||||||
|
cancelBtn.addEventListener("click", () => {
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onClose() {
|
onClose() {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"1.3.0": "1.0.0"
|
"1.3.4": "1.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue