Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const COMMON_CONSTANTS = {
DEFAULT_RELIABILITY_MIN: 0,
DEFAULT_RELIABILITY_MAX: 1,
DEFAULT_TEMPERATURE: 0.7,
MIN_RELIABILITY_THRESHOLD: 0.2,
VERIFY_CONNECTION_SYSTEM_PROMPT: 'You are a test system. You must respond with valid JSON.',
VERIFY_CONNECTION_USER_PROMPT: 'Return a JSON object containing {"output": [], "reliability": 0}',
};
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { TFile } from 'obsidian';
import { Plugin } from 'obsidian';
import { CommonNotice } from 'ui/components/common/CommonNotice';
import { COMMON_CONSTANTS } from './api/constants';
import { DEFAULT_SYSTEM_ROLE, getPromptTemplate } from './api/prompt';
import type { ProviderConfig } from './api/types';
import { getContentWithoutFrontmatter, getTags, insertToFrontMatter } from './frontmatter';
Expand All @@ -12,13 +13,13 @@

export default class AutoClassifierPlugin extends Plugin {
settings: AutoClassifierSettings;
async onload() {

Check warning on line 16 in src/main.ts

View workflow job for this annotation

GitHub Actions / test

Missing return type on function
await this.loadSettings();
this.setupCommand();
this.addSettingTab(new AutoClassifierSettingTab(this));
}

setupCommand() {

Check warning on line 22 in src/main.ts

View workflow job for this annotation

GitHub Actions / test

Missing return type on function
this.settings.frontmatter.forEach((fm) => {
this.registerCommand(fm.name, async () => await this.processFrontmatter(fm.id));
});
Expand All @@ -29,7 +30,7 @@
);
}

registerCommand(name: string, callback: () => Promise<void>) {

Check warning on line 33 in src/main.ts

View workflow job for this annotation

GitHub Actions / test

Missing return type on function
this.addCommand({
id: `fetch-frontmatter-${name}`,
name: `Fetch frontmatter: ${name}`,
Expand Down Expand Up @@ -130,8 +131,8 @@
)
);

if (apiResponse && apiResponse.reliability > 0.2) {
if (apiResponse && apiResponse.reliability > COMMON_CONSTANTS.MIN_RELIABILITY_THRESHOLD) {
const processFrontMatter = (file: TFile, fn: (frontmatter: any) => void) =>

Check warning on line 135 in src/main.ts

View workflow job for this annotation

GitHub Actions / test

Missing return type on function
this.app.fileManager.processFrontMatter(file, fn);

await insertToFrontMatter(processFrontMatter, {
Expand All @@ -157,7 +158,7 @@
}
};

async loadSettings() {

Check warning on line 161 in src/main.ts

View workflow job for this annotation

GitHub Actions / test

Missing return type on function
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());

await this.saveSettings();
Expand Down
Loading