Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfacb78da4 | ||
|
|
f2972a5b83 |
No files matched your search
@@ -190,7 +190,7 @@ export class TimedPromptsCommand {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Add CSS class for styling
|
// Add CSS class for styling
|
||||||
const noticeEl = notice.noticeEl;
|
const noticeEl = notice.messageEl;
|
||||||
if (noticeEl) {
|
if (noticeEl) {
|
||||||
noticeEl.addClass('freewriting-prompt-notice');
|
noticeEl.addClass('freewriting-prompt-notice');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ export default class FreewritingPromptsPlugin extends Plugin {
|
|||||||
// Timed prompts command
|
// Timed prompts command
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'timed-prompts',
|
id: 'timed-prompts',
|
||||||
name: 'Show Timed Prompts',
|
name: 'Show timed prompts',
|
||||||
callback: async () => {
|
callback: async () => {
|
||||||
await this.executeTimedPrompts();
|
await this.executeTimedPrompts();
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ export default class FreewritingPromptsPlugin extends Plugin {
|
|||||||
// Note prompt command (editor-based)
|
// Note prompt command (editor-based)
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'note-prompts',
|
id: 'note-prompts',
|
||||||
name: 'Add Note Prompts',
|
name: 'Add note prompts',
|
||||||
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
editorCallback: async (editor: Editor, view: MarkdownView) => {
|
||||||
await this.executeNotePrompts(editor, view);
|
await this.executeNotePrompts(editor, view);
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ export default class FreewritingPromptsPlugin extends Plugin {
|
|||||||
// Stop timed prompts command
|
// Stop timed prompts command
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: 'stop-timed-prompts',
|
id: 'stop-timed-prompts',
|
||||||
name: 'Stop Timed Prompts',
|
name: 'Stop timed prompts',
|
||||||
callback: () => {
|
callback: () => {
|
||||||
this.stopTimedPrompts();
|
this.stopTimedPrompts();
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ export default class FreewritingPromptsPlugin extends Plugin {
|
|||||||
private async executeTimedPrompts(): Promise<void> {
|
private async executeTimedPrompts(): Promise<void> {
|
||||||
// Check if timed prompts are already running
|
// Check if timed prompts are already running
|
||||||
if (this.timedCommand.isRunning()) {
|
if (this.timedCommand.isRunning()) {
|
||||||
new Notice('Timed prompts are already running. Use "Stop Timed Prompts" to stop them first.');
|
new Notice('Timed prompts are already running. Use "Stop timed prompts" to stop them first.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+27
-21
@@ -116,14 +116,14 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
const { containerEl } = this;
|
const { containerEl } = this;
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
||||||
containerEl.createEl('h2', { text: 'Freewriting Prompts' });
|
|
||||||
|
|
||||||
// MARK: - API Configuration
|
// MARK: - API Configuration
|
||||||
|
|
||||||
containerEl.createEl('h3', { text: 'API Configuration' });
|
new Setting(containerEl)
|
||||||
|
.setName('API configuration')
|
||||||
|
.setHeading();
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Anthropic API Key')
|
.setName('Anthropic API key')
|
||||||
.setDesc('Your Anthropic API key for Claude. Get one at https://console.anthropic.com/')
|
.setDesc('Your Anthropic API key for Claude. Get one at https://console.anthropic.com/')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setPlaceholder('sk-ant-...')
|
.setPlaceholder('sk-ant-...')
|
||||||
@@ -158,16 +158,16 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Test API Key')
|
.setName('Test API key')
|
||||||
.setDesc('Test your API key to verify it works correctly')
|
.setDesc('Test your API key to verify it works correctly')
|
||||||
.addButton(button => button
|
.addButton(button => button
|
||||||
.setButtonText('Test Connection')
|
.setButtonText('Test connection')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
void this.testApiKey(button);
|
void this.testApiKey(button);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Claude Model')
|
.setName('Claude model')
|
||||||
.setDesc('Which Claude model to use for generating prompts')
|
.setDesc('Which Claude model to use for generating prompts')
|
||||||
.addDropdown(dropdown => {
|
.addDropdown(dropdown => {
|
||||||
this.modelDropdown = dropdown;
|
this.modelDropdown = dropdown;
|
||||||
@@ -187,10 +187,12 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
// MARK: - Command Configuration
|
// MARK: - Command Configuration
|
||||||
|
|
||||||
containerEl.createEl('h3', { text: 'Command Configuration' });
|
new Setting(containerEl)
|
||||||
|
.setName('Command configuration')
|
||||||
|
.setHeading();
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Timed Prompts Count')
|
.setName('Timed prompts count')
|
||||||
.setDesc('Number of prompts to generate for timed notifications (1-50)')
|
.setDesc('Number of prompts to generate for timed notifications (1-50)')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setPlaceholder('10')
|
.setPlaceholder('10')
|
||||||
@@ -213,7 +215,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Delay Between Prompts')
|
.setName('Delay between prompts')
|
||||||
.setDesc('Seconds to wait between each timed prompt notification (1-300)')
|
.setDesc('Seconds to wait between each timed prompt notification (1-300)')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setPlaceholder('6')
|
.setPlaceholder('6')
|
||||||
@@ -236,7 +238,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Note Prompts Count')
|
.setName('Note prompts count')
|
||||||
.setDesc('Number of prompts to append to the current note (1-20)')
|
.setDesc('Number of prompts to append to the current note (1-20)')
|
||||||
.addText(text => text
|
.addText(text => text
|
||||||
.setPlaceholder('3')
|
.setPlaceholder('3')
|
||||||
@@ -260,10 +262,12 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
// MARK: - Prompt Customization
|
// MARK: - Prompt Customization
|
||||||
|
|
||||||
containerEl.createEl('h3', { text: 'Prompt Customization' });
|
new Setting(containerEl)
|
||||||
|
.setName('Prompt customization')
|
||||||
|
.setHeading();
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('System Prompt')
|
.setName('System prompt')
|
||||||
.setDesc('Instructions for the AI on how to generate prompts')
|
.setDesc('Instructions for the AI on how to generate prompts')
|
||||||
.addTextArea(text => text
|
.addTextArea(text => text
|
||||||
.setPlaceholder('You are a creative writing assistant...')
|
.setPlaceholder('You are a creative writing assistant...')
|
||||||
@@ -277,7 +281,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Timed Prompts Example')
|
.setName('Timed prompts example')
|
||||||
.setDesc('Example prompt to guide the style for timed notifications')
|
.setDesc('Example prompt to guide the style for timed notifications')
|
||||||
.addTextArea(text => text
|
.addTextArea(text => text
|
||||||
.setPlaceholder('Write about a character who...')
|
.setPlaceholder('Write about a character who...')
|
||||||
@@ -291,7 +295,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Note Prompts Example')
|
.setName('Note prompts example')
|
||||||
.setDesc('Example prompt to guide the style for note prompts')
|
.setDesc('Example prompt to guide the style for note prompts')
|
||||||
.addTextArea(text => text
|
.addTextArea(text => text
|
||||||
.setPlaceholder('Describe a world where...')
|
.setPlaceholder('Describe a world where...')
|
||||||
@@ -306,13 +310,15 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
|
|
||||||
containerEl.createEl('h3', { text: 'Actions' });
|
new Setting(containerEl)
|
||||||
|
.setName('Actions')
|
||||||
|
.setHeading();
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Clear Cache')
|
.setName('Clear cache')
|
||||||
.setDesc('Clear the cached prompts to force regeneration')
|
.setDesc('Clear the cached prompts to force regeneration')
|
||||||
.addButton(button => button
|
.addButton(button => button
|
||||||
.setButtonText('Clear Cache')
|
.setButtonText('Clear cache')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.plugin.promptGenerator.clearCache();
|
this.plugin.promptGenerator.clearCache();
|
||||||
// Show a temporary notice
|
// Show a temporary notice
|
||||||
@@ -321,10 +327,10 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Clear Model List Cache')
|
.setName('Clear model list cache')
|
||||||
.setDesc('Clear cached Claude model list to force a fresh fetch from the API')
|
.setDesc('Clear cached Claude model list to force a fresh fetch from the API')
|
||||||
.addButton(button => button
|
.addButton(button => button
|
||||||
.setButtonText('Clear Models Cache')
|
.setButtonText('Clear models cache')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.plugin.modelService.clearCache();
|
this.plugin.modelService.clearCache();
|
||||||
// Show a temporary notice
|
// Show a temporary notice
|
||||||
@@ -488,7 +494,7 @@ export class FreewritingPromptsSettingTab extends PluginSettingTab {
|
|||||||
* @param button - Button component to update with loading state
|
* @param button - Button component to update with loading state
|
||||||
*/
|
*/
|
||||||
private async testApiKey(button: ButtonComponent): Promise<void> {
|
private async testApiKey(button: ButtonComponent): Promise<void> {
|
||||||
const originalText = button.buttonEl.textContent || 'Test Connection';
|
const originalText = button.buttonEl.textContent || 'Test connection';
|
||||||
|
|
||||||
// Update button to show loading state
|
// Update button to show loading state
|
||||||
button.setButtonText('Testing...');
|
button.setButtonText('Testing...');
|
||||||
|
|||||||
Reference in new issue
Block a user