Commit Graph
16 Commits
Author SHA1 Message Date
AlexKucera 5bf804b266 Fixes pagination ID consistency in model sorting
Recomputes pagination first and last IDs after sorting models to ensure consistent
ID references match the sorted array order.

Prevents potential misalignment between sorted model list and pagination metadata
2025-10-31 13:35:49 +01:00
AlexKucera d5af2a08ce Improves ping response validation robustness
Enhances API ping check to handle multiple text content blocks

Modifies response text extraction to:
- Process all text content blocks
- Support multiple text segments
- Normalize and validate ping response more comprehensively

Increases reliability of API connection verification
2025-10-31 13:17:36 +01:00
AlexKucera fc04d3f1af Improves model listing and prompt parsing logic
Adds sorting for model dropdown to ensure consistent user experience across sessions

Enhances prompt extraction by supporting more list prefix formats, improving robustness of text parsing
2025-10-25 10:49:01 +02:00
AlexKucera 3f53bb5a30 Improves model list pagination with safety measures
Adds robust pagination handling for Anthropic model retrieval:
- Implements duplicate model filtering
- Adds iteration limit to prevent infinite loops
- Introduces cursor advancement validation
- Fixes potential API pagination edge cases

Ensures more reliable and predictable model list retrieval
2025-10-24 16:56:38 +02:00
AlexKucera 329c12ab4b Refactors Anthropic API client configuration
Centralizes API base URL and version configuration for improved maintainability

Adds constants for API base URL and version to prevent potential drift
Normalizes API version header usage across request methods
Improves ping validation to handle variations in response text

Supports more robust and consistent API client configuration
2025-10-24 16:50:20 +02:00
AlexKucera e5c7a523c5 Improves Anthropic API client robustness
Enhances API client with more reliable pagination and response handling:
- Uses URLSearchParams for clearer parameter management
- Increases pagination limit to 1000 to reduce API calls
- Adds more robust content parsing for multi-block responses
- Implements stricter API health check validation

Ensures more predictable and resilient API interactions
2025-10-24 13:38:28 +02:00
AlexKucera f9fefceac1 Adds pagination support for Anthropic models API
Enhances models fetching to handle paginated API responses

Implements robust pagination mechanism to retrieve all available models
- Continues fetching pages while 'has_more' is true
- Accumulates models across multiple API calls
- Preserves first and last page identifiers
- Ensures complete model list retrieval

Improves error handling and response validation
2025-10-24 13:12:32 +02:00
AlexKucera def8bbcfe5 Improves Anthropic models API response validation
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
2025-10-24 13:11:06 +02:00
AlexKucera e96ef65200 Added DocStrings 2025-10-24 13:09:10 +02:00
AlexKucera 03d2b1c93d Adds robust model list response validation
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
2025-10-24 13:00:31 +02:00
AlexKucera 6ccfb9e023 Optimizes token usage for timed prompts
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
2025-10-24 11:29:33 +02:00
Jarvis 20530142e4 feat: add dynamic model fetching from Anthropic API
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>
2025-10-23 10:17:30 +02:00
AlexKucera d7497c1259 Removes unnecessary error notification
The Notice was removed because the error is already being logged to the console and re-thrown.
2025-09-26 08:19:54 +02:00
Jarvis 4786e7647d refactor: rename "Staggered Prompts" to "Timed Prompts" for clarity
Renames command terminology throughout codebase to better reflect
regular interval delivery rather than irregular/staggered timing.

Changes:
- Rename staggeredPrompts.ts → timedPrompts.ts
- Update class StaggeredPromptsCommand → TimedPromptsCommand
- Update command IDs: staggered-prompts → timed-prompts
- Update user-facing labels in settings and README
- Update property names: staggeredCount → timedCount
- Update method names: generateStaggeredPrompts → generateTimedPrompts
- Update API constants and type annotations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-21 07:53:48 +02:00
AlexKucera c34ee2edd6 Enhances prompt generation with type-specific instructions
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.
2025-09-20 10:55:06 +02:00
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