feat: add client availability tracking and error handling improvements

- Introduced `IsAvailable` and `SetUnavailable` methods to clients for availability tracking.
- Integrated availability checks in client selection logic to skip unavailable clients.
- Enhanced error handling by marking clients unavailable on specific error codes (e.g., 401, 402).
- Removed redundant quota verification logs in client reordering logic.
This commit is contained in:
Luis Pater
2025-09-19 01:53:38 +08:00
parent 9ec8478b41
commit df66046b14
15 changed files with 183 additions and 21 deletions

View File

@@ -52,5 +52,12 @@ type Client interface {
// Provider returns the name of the AI service provider (e.g., "gemini", "claude").
Provider() string
// RefreshTokens refreshes the access tokens if needed
RefreshTokens(ctx context.Context) error
// IsAvailable returns true if the client is available for use.
IsAvailable() bool
// SetUnavailable sets the client to unavailable.
SetUnavailable()
}