* Strip date suffix from model names. * Handles multiple date formats used by different providers: * - OpenAI: YYYY-MM-DD at end (e.g., "gpt-5-4-mini-2026-03-17" → "gpt-5-4-mini") * - Anthropic: YYYYMMDD with optional suffix (e.g., "claude-sonnet-4-5-20250929-thinking" → "claude-sonnet-4-5-thinki
(model: string)
| 235 | * - Cohere/Gemini: MM-YYYY at end (e.g., "command-r-08-2024" → "command-r") |
| 236 | */ |
| 237 | function stripDateSuffix(model: string): string { |
| 238 | // OpenAI format: -YYYY-MM-DD at end |
| 239 | let stripped = model.replace(/-20\d{2}-\d{2}-\d{2}$/, ''); |
| 240 | if (stripped !== model) return stripped; |
| 241 | |
| 242 | // Anthropic format: -YYYYMMDD, possibly followed by suffix like -thinking |
| 243 | stripped = model.replace(/-20\d{6}(-[a-z]+)?$/, '$1'); |
| 244 | if (stripped !== model) return stripped; |
| 245 | |
| 246 | // Cohere/Gemini format: -MM-YYYY at end |
| 247 | stripped = model.replace(/-\d{2}-20\d{2}$/, ''); |
| 248 | return stripped; |
| 249 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…