mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-05 10:27:50 +08:00
fix timeout
This commit is contained in:
@@ -107,9 +107,10 @@ type ProvidersConfig struct {
|
||||
}
|
||||
|
||||
type ProviderConfig struct {
|
||||
APIKey string `json:"api_key" env:"CLAWGO_PROVIDERS_{{.Name}}_API_KEY"`
|
||||
APIBase string `json:"api_base" env:"CLAWGO_PROVIDERS_{{.Name}}_API_BASE"`
|
||||
Auth string `json:"auth" env:"CLAWGO_PROVIDERS_{{.Name}}_AUTH"`
|
||||
APIKey string `json:"api_key" env:"CLAWGO_PROVIDERS_{{.Name}}_API_KEY"`
|
||||
APIBase string `json:"api_base" env:"CLAWGO_PROVIDERS_{{.Name}}_API_BASE"`
|
||||
Auth string `json:"auth" env:"CLAWGO_PROVIDERS_{{.Name}}_AUTH"`
|
||||
TimeoutSec int `json:"timeout_sec" env:"CLAWGO_PROVIDERS_PROXY_TIMEOUT_SEC"`
|
||||
}
|
||||
|
||||
type GatewayConfig struct {
|
||||
@@ -276,7 +277,8 @@ func DefaultConfig() *Config {
|
||||
},
|
||||
Providers: ProvidersConfig{
|
||||
Proxy: ProviderConfig{
|
||||
APIBase: "http://localhost:8080/v1",
|
||||
APIBase: "http://localhost:8080/v1",
|
||||
TimeoutSec: 90,
|
||||
},
|
||||
},
|
||||
Gateway: GatewayConfig{
|
||||
|
||||
@@ -39,6 +39,9 @@ func Validate(cfg *Config) []error {
|
||||
if cfg.Providers.Proxy.APIBase == "" {
|
||||
errs = append(errs, fmt.Errorf("providers.proxy.api_base is required"))
|
||||
}
|
||||
if cfg.Providers.Proxy.TimeoutSec <= 0 {
|
||||
errs = append(errs, fmt.Errorf("providers.proxy.timeout_sec must be > 0"))
|
||||
}
|
||||
|
||||
if cfg.Gateway.Port <= 0 || cfg.Gateway.Port > 65535 {
|
||||
errs = append(errs, fmt.Errorf("gateway.port must be in 1..65535"))
|
||||
|
||||
Reference in New Issue
Block a user