fix: address PR review comments

1. Remove 429 from PROVIDER_FAILURE_ERROR_CODES
   - 429 (rate limit) is already handled by model-level and account-level locks
   - Including it in provider-wide circuit breaker causes premature cooldown

2. Fix reference counting in ModelStatusContext
   - Changed registeredModels from Set to Map<string, number>
   - Prevents polling stop when one component unmounts while others still track the model

3. Fix model ID parsing for providers with slashes in model names
   - Use indexOf/substring instead of split to handle models like "modelscope/moonshotai/Kimi-K2.5"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
clousky
2026-04-20 13:25:37 +08:00
parent a389f2699a
commit 0d86244c90

View File

@@ -57,7 +57,7 @@ type ProviderFailureEntry = {
};
// Error codes that count toward provider-level failure threshold
const PROVIDER_FAILURE_ERROR_CODES = new Set([429, 408, 500, 502, 503, 504]);
const PROVIDER_FAILURE_ERROR_CODES = new Set([408, 500, 502, 503, 504]);
// Provider-level failure state map: providerId -> failure entry
const providerFailureState = new Map<string, ProviderFailureEntry>();