* For 3P users, suggest a fallback model when the selected model is unavailable. * Returns a model name suggestion, or undefined if no suggestion is applicable.
(model: string)
| 993 | * Returns a model name suggestion, or undefined if no suggestion is applicable. |
| 994 | */ |
| 995 | function get3PModelFallbackSuggestion(model: string): string | undefined { |
| 996 | if (getAPIProvider() === 'firstParty') { |
| 997 | return undefined |
| 998 | } |
| 999 | // @[MODEL LAUNCH]: Add a fallback suggestion chain for the new model → previous version for 3P |
| 1000 | const m = model.toLowerCase() |
| 1001 | // If the failing model looks like an Opus 4.6 variant, suggest the default Opus (4.1 for 3P) |
| 1002 | if (m.includes('opus-4-6') || m.includes('opus_4_6')) { |
| 1003 | return getModelStrings().opus41 |
| 1004 | } |
| 1005 | // If the failing model looks like a Sonnet 4.6 variant, suggest Sonnet 4.5 |
| 1006 | if (m.includes('sonnet-4-6') || m.includes('sonnet_4_6')) { |
| 1007 | return getModelStrings().sonnet45 |
| 1008 | } |
| 1009 | // If the failing model looks like a Sonnet 4.5 variant, suggest Sonnet 4 |
| 1010 | if (m.includes('sonnet-4-5') || m.includes('sonnet_4_5')) { |
| 1011 | return getModelStrings().sonnet40 |
| 1012 | } |
| 1013 | return undefined |
| 1014 | } |
| 1015 | |
| 1016 | /** |
| 1017 | * Classifies an API error into a specific error type for analytics tracking. |
no test coverage detected