Files
freewriting-prompts/types.ts
T
AlexKucera 44936775cd Implements freewriting prompts plugin
Initial implementation of the Freewriting Prompts plugin.

This commit introduces the core functionality for generating
AI-powered writing prompts using Anthropic's Claude API.

It includes:
- API client for interacting with the Anthropic API
- Services for generating and caching prompts
- Commands for displaying staggered prompts and appending prompts to notes
- Settings tab for configuring the plugin
2025-09-19 18:51:48 +02:00

57 lines
1.3 KiB
TypeScript

// ABOUTME: Type definitions for the Freewriting Prompts plugin
// ABOUTME: Defines interfaces for settings, API responses, and plugin configuration
export interface FreewritingPromptsSettings {
apiKey: string;
model: string;
staggeredCount: number;
delaySeconds: number;
noteCount: number;
systemPrompt: string;
staggeredExamplePrompt: string;
freewritingExamplePrompt: string;
}
export interface AnthropicMessage {
role: 'user' | 'assistant' | 'system';
content: string;
}
export interface AnthropicRequest {
model: string;
max_tokens: number;
messages: AnthropicMessage[];
system?: string;
}
export interface AnthropicResponse {
content: Array<{
text: string;
type: 'text';
}>;
id: string;
model: string;
role: 'assistant';
stop_reason: string;
stop_sequence: null;
type: 'message';
usage: {
input_tokens: number;
output_tokens: number;
};
}
export interface GeneratedPrompt {
text: string;
timestamp: Date;
}
export const ANTHROPIC_MODELS = [
'claude-3-haiku-20240307',
'claude-3-sonnet-20240229',
'claude-3-opus-20240229',
'claude-3-5-sonnet-20241022',
'claude-3-5-haiku-20241022'
] as const;
export type AnthropicModel = typeof ANTHROPIC_MODELS[number];