Refactor API handlers to implement retry mechanism with configurable limits and improved error handling

- Introduced retry counter with a configurable ` RequestRetry ` limit in all handlers.
- Enhanced error handling with specific HTTP status codes for switching clients.
- Standardized response forwarding for non-retriable errors.
- Improved logging for quota and client switch scenarios.
This commit is contained in:
Luis Pater
2025-08-25 23:27:30 +08:00
parent 8c555c4e69
commit 9102ff031d
11 changed files with 148 additions and 43 deletions

View File

@@ -37,6 +37,9 @@ type Config struct {
// RequestLog enables or disables detailed request logging functionality.
RequestLog bool `yaml:"request-log"`
// RequestRetry defines the retry times when the request failed.
RequestRetry int `yaml:"request-retry"`
ClaudeKey []ClaudeKey `yaml:"claude-api-key"`
}