mirror of
https://github.com/binxly/Atomizer.git
synced 2026-07-22 11:30:28 +00:00
final v1.0.0
This commit is contained in:
parent
94cbd32e43
commit
d662d3ae3f
8 changed files with 644 additions and 147 deletions
|
|
@ -1,3 +0,0 @@
|
|||
node_modules/
|
||||
|
||||
main.js
|
||||
23
.eslintrc
23
.eslintrc
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
14
eslint.config 2.mjs
Normal file
14
eslint.config 2.mjs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import globals from "globals";
|
||||
import pluginJs from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import pluginReact from "eslint-plugin-react";
|
||||
|
||||
|
||||
/** @type {import('eslint').Linter.Config[]} */
|
||||
export default [
|
||||
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
|
||||
{languageOptions: { globals: globals.browser }},
|
||||
pluginJs.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
pluginReact.configs.flat.recommended,
|
||||
];
|
||||
27
eslint.config.mjs
Normal file
27
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import globals from "globals";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
export default [
|
||||
{
|
||||
files: ["**/*.{js,mjs,cjs,ts}"],
|
||||
ignores: ["node_modules/**", "main.js"],
|
||||
languageOptions: {
|
||||
globals: globals.browser,
|
||||
parser: tseslint.parser,
|
||||
parserOptions: {
|
||||
project: "./tsconfig.json"
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
"@typescript-eslint": tseslint.plugin
|
||||
},
|
||||
rules: {
|
||||
...tseslint.configs.recommended.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"
|
||||
}
|
||||
}
|
||||
];
|
||||
11
main.ts
11
main.ts
|
|
@ -2,6 +2,13 @@ import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Set
|
|||
import OpenAI from 'openai';
|
||||
|
||||
// Types and Interfaces
|
||||
interface APIError extends Error {
|
||||
response?: {
|
||||
status: number;
|
||||
data: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface AtomicPluginSettings {
|
||||
apiKey: string;
|
||||
outputFolder: string;
|
||||
|
|
@ -47,7 +54,7 @@ tags: ${settings.enableAtomizedTag ? 'atomized' : ''}${settings.customTags ? (se
|
|||
class OpenAIService {
|
||||
constructor(private apiKey: string, private model: string, private settings: AtomicPluginSettings) {}
|
||||
|
||||
async generateAtomicNotes(content: string, dateTime: string): Promise<string> {
|
||||
async generateAtomicNotes(content: string, timestamp: string): Promise<string> {
|
||||
if (!this.apiKey) {
|
||||
new Notice('OpenAI API key is not set. Please configure it in plugin settings.');
|
||||
return '';
|
||||
|
|
@ -208,7 +215,7 @@ export default class AtomicNotesPlugin extends Plugin {
|
|||
return true;
|
||||
}
|
||||
|
||||
private handleError(error: any) {
|
||||
private handleError(error: APIError) {
|
||||
console.error('Detailed error:', error);
|
||||
new Notice(`Error: ${error.message || 'Unknown error occurred'}`);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@
|
|||
"description": "Turn any text into insightful atomic notes.",
|
||||
"author": "Zac Bagley",
|
||||
"authorUrl": "https://binx.page",
|
||||
"fundingUrl": "https://buymeacoffee.com/binxly",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
|
|
|
|||
704
package-lock.json
generated
704
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -17,8 +17,14 @@
|
|||
"@typescript-eslint/parser": "5.29.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"esbuild": "0.17.3",
|
||||
"eslint": "^8.57.1",
|
||||
"globals": "^15.13.0",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.4"
|
||||
"typescript": "^4.8.4",
|
||||
"typescript-eslint": "^8.17.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"openai": "^4.75.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue