Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenwits committed Mar 25, 2024
0 parents commit e747f02
Show file tree
Hide file tree
Showing 17 changed files with 2,814 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vscode
.vscode

# Intellij
*.iml
.idea

# npm
node_modules

# Don't include the compiled main.js file in the repo.
# They should be uploaded to GitHub releases instead.
main.js

# Exclude sourcemaps
*.map

# obsidian
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Obsidian AI Summary Plugin

Welcome to the Obsidian AI Summary Plugin! This plugin provides an easy-to-use AI summary tool for your notes in Obsidian. With this plugin, you can quickly summarize selected text within a note, replacing the selection with the generated summary. Additionally, there are options to customize the prompt and maximum tokens for summarization. You can also choose to paste the summary under the `summary` property of the frontmatter of the note.

## Features

- **AI Summarization**: Summarize selected text within a note using AI technology.
- **Replace Selection**: Replace the selected text with the generated summary.
- **Customizable Prompt**: Optionally customize the prompt used for AI summarization.
- **Customizable Max Tokens**: Optionally customize the maximum tokens used for summarization.
- **Toggle Option**: Choose whether to replace the selection or paste the summary under the `summary` property of the note's frontmatter.

## Installation

1. Open Obsidian and navigate to Settings > Community Plugins.
2. Search for "AI Summary" in the plugin list.
3. Click "Install" to install the plugin.
4. Once installed, enable the plugin by toggling the switch.

## Usage

1. Add your OpenAI API key to the plugin settings. You can obtain an API key by signing up for an account at [OpenAI](https://platform.openai.com/signup).
2. Customize the prompt and maximum tokens if desired from plugin settings.
3. Select the text within a note that you want to summarize. The selection must be at least 10 characters long.
4. Use the designated shortcut in context menu or command (AI Summarize: Summarize) to activate the AI summary tool.
5. Choose whether to replace the selection with the summary or paste it under the `summary` property of the note's frontmatter.
6. Enjoy the summarized content in your notes!

## Configuration

- Customize the prompt and maximum tokens in the plugin settings, located in the Obsidian settings menu under "AI Summary Plugin."

## Feedback and Support

If you encounter any issues, have suggestions for improvements, or need assistance, please feel free to [submit an issue](https://github.com/your-username/obsidian-ai-summary-plugin/issues) on GitHub.

## Contributing

Contributions are welcome! If you'd like to contribute to the development of this plugin, please fork the repository, make your changes, and submit a pull request.

## License

This project is licensed under the [GPL-3.0 License](LICENSE).

## Donate

If you find this plugin helpful and would like to support its development, consider buying me a coffee! ☕️
[Donate](https://www.buymeacoffee.com/ravenwits)

---

Happy summarizing! 🚀
33 changes: 33 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import esbuild from 'esbuild';
import process from 'process';
import builtins from 'builtin-modules';

const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = process.argv[2] === 'production';

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ['src/plugin/main.ts'],
bundle: true,
external: ['obsidian', 'electron', '@codemirror/autocomplete', '@codemirror/collab', '@codemirror/commands', '@codemirror/language', '@codemirror/lint', '@codemirror/search', '@codemirror/state', '@codemirror/view', '@lezer/common', '@lezer/highlight', '@lezer/lr', ...builtins],
format: 'cjs',
target: 'es2018',
logLevel: 'info',
sourcemap: prod ? false : 'inline',
treeShaking: true,
outfile: 'main.js',
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
15 changes: 15 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"id": "AI-Summarize",
"name": "AI Summarize",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"description": "Summarize your notes using AI",
"author": "ravenwits",
"authorUrl": "https://www.alpsariyer.dev",
"fundingUrl": {
"Github Sponsor": "https://github.com/sponsors/ravenwits",
"Buy me a Coffee": "https://buymeacoffee.com/ravenwits"
},
"donation": "https://buymeacoffee.com/ravenwits",
"isDesktopOnly": false
}
Loading

0 comments on commit e747f02

Please sign in to comment.