Enhances type checking and validation for API response structure
Adds more robust type validation to ensure:
- Correct response object structure
- Presence of required model fields
- Type safety for model data retrieval
Prevents potential runtime errors by implementing stricter type checks
Improves models API response handling by adding structural validation
Ensures that the API response contains an array of model data before processing
Prevents potential runtime errors from unexpected response formats
Reduces max tokens for timed prompts to improve latency and cost-efficiency
Introduces dynamic max_tokens configuration based on prompt type, using a smaller token limit for time-sensitive requests
Replace hardcoded model list with dynamic API-based model fetching
that queries the Anthropic models endpoint. Implements 24-hour caching
with automatic fallback to hardcoded models if API is unavailable.
Changes:
- Add ModelService to fetch and cache available models from API
- Implement 24-hour TTL cache persisted in plugin data
- Update AnthropicClient with fetchModels() method
- Modify settings UI to load models asynchronously with loading states
- Auto-refresh models when API key is entered or changed
- Display model names using display_name field from API
- Preserve user's selected model across updates and restarts
- Show notice when falling back to hardcoded model list
- Change model type from strict enum to string for dynamic support
Technical details:
- New ModelInfo and ModelsListResponse interfaces for API response
- ModelCache interface with timestamp for TTL validation
- FreewritingPromptsData extends settings to include cache
- Settings dropdown disabled during model fetch/refresh
- Fallback to ANTHROPIC_MODELS constant on API failure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Refines prompt generation by incorporating modifiers based on the prompt type.
This ensures that staggered prompts are short and direct, while also enforcing a consistent output format across all prompt types by appending specific instructions to the system prompt.
The user message is also updated to ensure the model returns only the numbered prompts, nothing else.
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