Skip to content

Commit

Permalink
make requested review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
connorpark24 committed Jul 4, 2024
1 parent 45872fb commit 5996a28
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion RefresherModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class RefresherModal extends Modal {

displaySummaries(contentEl: HTMLElement) {
contentEl.empty();
contentEl.createEl("h2", { text: "Daily Refresher" });
contentEl.createEl("h2", { text: "Daily refresher" });

this.summaries?.forEach((note) => {
const noteName = note.name.replace(/\.md$/, "");
Expand Down
23 changes: 14 additions & 9 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { App, Plugin, PluginSettingTab, Setting, TFile } from "obsidian";
import {
App,
Plugin,
PluginSettingTab,
Setting,
TFile,
TFolder,
} from "obsidian";
import { RefresherModal } from "./RefresherModal";
import { ChatOpenAI } from "@langchain/openai";
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
Expand All @@ -22,7 +29,7 @@ export default class NotesRefresher extends Plugin {

this.addSettingTab(new NotesRefresherSettingTab(this.app, this));

this.addRibbonIcon("clock-4", "Refresh", async () => {
this.addRibbonIcon("clock-4", "Get Note Summaries", async () => {
const modal = new RefresherModal(this.app, null);
modal.open();

Expand All @@ -38,14 +45,14 @@ export default class NotesRefresher extends Plugin {
onunload() {}

async getNotesFromFolder(folderPath: string): Promise<TFile[]> {
const folder = this.app.vault.getAbstractFileByPath(folderPath);
const folder = this.app.vault.getFolderByPath(folderPath);
const notes: TFile[] = [];

const traverseFolder = (folder: any) => {
const traverseFolder = (folder: TFolder) => {
for (const child of folder.children) {
if (child instanceof TFile && child.extension === "md") {
notes.push(child);
} else if (child.children) {
} else if (child instanceof TFolder) {
traverseFolder(child);
}
}
Expand Down Expand Up @@ -133,10 +140,8 @@ class NotesRefresherSettingTab extends PluginSettingTab {

containerEl.empty();

containerEl.createEl("h2", { text: "Settings for my plugin." });

new Setting(containerEl)
.setName("Folder Path")
.setName("Folder path")
.setDesc("Path to the folder containing notes to summarize")
.addText((text) =>
text
Expand All @@ -149,7 +154,7 @@ class NotesRefresherSettingTab extends PluginSettingTab {
);

new Setting(containerEl)
.setName("OpenAI API Key")
.setName("OpenAI API key")
.setDesc("API key for OpenAI")
.addText((text) =>
text
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "notes-refresher",
"name": "Notes Refresher",
"version": "1.0.0",
"minAppVersion": "0.0.0",
"minAppVersion": "0.15.0",
"description": "Provides summaries of notes from your Vault.",
"author": "Connor Park",
"isDesktopOnly": true
Expand Down

0 comments on commit 5996a28

Please sign in to comment.