Skip to content

Commit

Permalink
feat: new prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminshafii committed Apr 9, 2024
1 parent 305f967 commit a8c79c4
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 151 deletions.
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
299 changes: 148 additions & 151 deletions src/FileOrganizerSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,167 +3,164 @@ import { logMessage, cleanPath } from "../utils";
import FileOrganizer from "./index";

export class FileOrganizerSettingTab extends PluginSettingTab {
plugin: FileOrganizer;
plugin: FileOrganizer;

constructor(app: App, plugin: FileOrganizer) {
super(app, plugin);
this.plugin = plugin;
}
constructor(app: App, plugin: FileOrganizer) {
super(app, plugin);
this.plugin = plugin;
}

display(): void {
const { containerEl } = this;
display(): void {
const { containerEl } = this;

containerEl.empty();
containerEl.empty();

new Setting(containerEl)
.setName("OpenAI API key")
.setDesc("Enter your API Key here")
.addText((text) =>
text
.setPlaceholder("Enter your API Key")
.setValue(this.plugin.settings.API_KEY)
.onChange(async (value) => {
this.plugin.settings.API_KEY = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("OpenAI API key")
.setDesc("Enter your API Key here")
.addText((text) =>
text
.setPlaceholder("Enter your API Key")
.setValue(this.plugin.settings.API_KEY)
.onChange(async (value) => {
this.plugin.settings.API_KEY = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Inbox Folder")
.setDesc("Choose which folder to automatically organize files from")
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.pathToWatch)
.onChange(async (value) => {
this.plugin.settings.pathToWatch = cleanPath(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Inbox Folder")
.setDesc("Choose which folder to automatically organize files from")
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.pathToWatch)
.onChange(async (value) => {
this.plugin.settings.pathToWatch = cleanPath(value);
await this.plugin.saveSettings();
})
);

new Setting(containerEl).setName("Features").setHeading();
new Setting(containerEl).setName("Features").setHeading();

new Setting(containerEl)
.setName("FileOrganizer logs")
.setDesc(
"Allows you to keep track of the changes made by file Organizer."
)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.useLogs)
.onChange(async (value) => {
this.plugin.settings.useLogs = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("FileOrganizer logs")
.setDesc(
"Allows you to keep track of the changes made by file Organizer."
)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.useLogs)
.onChange(async (value) => {
this.plugin.settings.useLogs = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Similar tags")
.setDesc("Append similar tags to the processed file.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.useSimilarTags)
.onChange(async (value) => {
this.plugin.settings.useSimilarTags = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Similar tags")
.setDesc("Append similar tags to the processed file.")
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.useSimilarTags)
.onChange(async (value) => {
this.plugin.settings.useSimilarTags = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl).setName("Folder config").setHeading();
new Setting(containerEl)
.setName("Attachments folder")
.setDesc(
"Enter the path to the folder where the original images and audio will be moved."
)
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.attachmentsPath)
.onChange(async (value) => {
// cleanup path remove leading and trailing slashes
this.plugin.settings.attachmentsPath = cleanPath(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("File Organizer log folder")
.setDesc("Choose a folder for Organization Logs e.g. Ava/Logs.")
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.logFolderPath)
.onChange(async (value) => {
this.plugin.settings.logFolderPath = cleanPath(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Output folder path")
.setDesc(
"Enter the path where you want to save the processed files. e.g. Processed/myfavoritefolder"
)
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.defaultDestinationPath)
.onChange(async (value) => {
const cleanedPath = cleanPath(value);
logMessage(cleanedPath);
this.plugin.settings.defaultDestinationPath =
cleanedPath;
await this.plugin.saveSettings();
})
);
new Setting(containerEl).setName("Folder config").setHeading();
new Setting(containerEl)
.setName("Attachments folder")
.setDesc(
"Enter the path to the folder where the original images and audio will be moved."
)
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.attachmentsPath)
.onChange(async (value) => {
// cleanup path remove leading and trailing slashes
this.plugin.settings.attachmentsPath = cleanPath(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("File Organizer log folder")
.setDesc("Choose a folder for Organization Logs e.g. Ava/Logs.")
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.logFolderPath)
.onChange(async (value) => {
this.plugin.settings.logFolderPath = cleanPath(value);
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Output folder path")
.setDesc(
"Enter the path where you want to save the processed files. e.g. Processed/myfavoritefolder"
)
.addText((text) =>
text
.setPlaceholder("Enter your path")
.setValue(this.plugin.settings.defaultDestinationPath)
.onChange(async (value) => {
const cleanedPath = cleanPath(value);
logMessage(cleanedPath);
this.plugin.settings.defaultDestinationPath = cleanedPath;
await this.plugin.saveSettings();
})
);

new Setting(containerEl).setName("Experimental features").setHeading();
new Setting(containerEl)
.setName("Custom Server URL")
.setDesc(
"You can run this locally by going on the File Organizer 2000 repo and following the GitHub instructions."
)
.addText((text) =>
text
.setPlaceholder("Enter your server URL")
.setValue(
this.plugin.settings.customServerUrl ||
"file-organizer-2000.vercel.app"
)
.onChange(async (value) => {
this.plugin.settings.customServerUrl = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl).setName("Experimental features").setHeading();
new Setting(containerEl)
.setName("Custom Server URL")
.setDesc(
"You can run this locally by going on the File Organizer 2000 repo and following the GitHub instructions."
)
.addText((text) =>
text
.setPlaceholder("Enter your server URL")
.setValue(
this.plugin.settings.customServerUrl ||
"file-organizer-2000.vercel.app"
)
.onChange(async (value) => {
this.plugin.settings.customServerUrl = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Custom vision prompt")
.setDesc("Enter your custom prompt for vision processing here")
.addText((text) =>
text
.setPlaceholder("Enter your custom prompt")
.setValue(this.plugin.settings.customVisionPrompt)
.onChange(async (value) => {
this.plugin.settings.customVisionPrompt = value;
await this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("Custom vision prompt")
.setDesc("Enter your custom prompt for vision processing here")
.addText((text) =>
text
.setPlaceholder("Enter your custom prompt")
.setValue(this.plugin.settings.customVisionPrompt)
.onChange(async (value) => {
this.plugin.settings.customVisionPrompt = value;
await this.plugin.saveSettings();
})
);

new Setting(containerEl)
.setName("Experimental: Describe workfow (contact for access)")
.setDesc(
"Use words to explain how File Organizer uses GPT-4 to organize your files."
)
.setDisabled(true);
new Setting(containerEl)
.setName(
"Experimental: Append to Existing file (contact for access)"
)
.setDesc(
"Let file Organizer find the most similar file and append the content to it."
)
.setDisabled(true);
new Setting(containerEl)
.setName("Experimental: Full Auto Org (contact for access)")
.setDesc("Let file Organizer work fully automatically.")
.setDisabled(true);
}
new Setting(containerEl)
.setName("Experimental: Describe workfow (contact for access)")
.setDesc(
"Use words to explain how File Organizer uses GPT-4 to organize your files."
)
.setDisabled(true);
new Setting(containerEl)
.setName("Experimental: Append to Existing file (contact for access)")
.setDesc(
"Let file Organizer find the most similar file and append the content to it."
)
.setDisabled(true);
new Setting(containerEl)
.setName("Experimental: Full Auto Org (contact for access)")
.setDesc("Let file Organizer work fully automatically.")
.setDisabled(true);
}
}

0 comments on commit a8c79c4

Please sign in to comment.