From b63ab214b31fcb406ebd129095ac30246b5bf242 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Fri, 24 Oct 2025 10:53:54 +0200 Subject: [PATCH] Refactors Anthropic model type and list handling Removes strict type definition for Anthropic models to enable more dynamic model selection Allows for flexible model ID fetching from Anthropic API Provides a fallback list of models when direct API access is limited Supports more adaptable model configuration in the application --- CLAUDE.md | 2 +- types.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index a8ae80b..3c4c8d2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -75,7 +75,7 @@ Settings use the `FreewritingCleanupSettings` interface with modular defaults: ```typescript interface FreewritingCleanupSettings { apiKey: string; - model: AnthropicModel; + model: string; // Dynamic model ID fetched from Anthropic API cleanupPrompt: string; enableCommentary: boolean; commentaryStyle: CommentaryStyle; diff --git a/types.ts b/types.ts index 1668210..87b6584 100644 --- a/types.ts +++ b/types.ts @@ -80,16 +80,15 @@ export interface ModelCache { fetchedAt: number; } -export const ANTHROPIC_MODELS = [ +// Fallback model list used when API key is not set or API fetch fails +export const ANTHROPIC_MODELS: readonly string[] = [ 'claude-opus-4-1-20250805', 'claude-opus-4-20250514', 'claude-sonnet-4-20250514', 'claude-3-7-sonnet-latest', 'claude-3-5-haiku-latest', 'claude-3-haiku-20240307' -] as const; - -export type AnthropicModel = typeof ANTHROPIC_MODELS[number]; +]; // Commentary style options export const COMMENTARY_STYLES = [