Documentation
¶
Index ¶
- type Condition
- type Config
- type PerformanceConfig
- type Provider
- type Route
- type Service
- func (s *Service) DeleteProvider(name string) error
- func (s *Service) Get() *Config
- func (s *Service) GetProvider(name string) (*Provider, error)
- func (s *Service) Load() error
- func (s *Service) Reload() error
- func (s *Service) Save() error
- func (s *Service) SaveProvider(provider *Provider) error
- func (s *Service) SetConfig(cfg *Config)
- func (s *Service) UpdateProvider(name string, provider *Provider) error
- func (s *Service) Validate() error
- type TransformerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct { Type string `json:"type" mapstructure:"type"` // "tokenCount", "parameter", "model" Operator string `json:"operator" mapstructure:"operator"` // ">", "<", "==", "contains" Value interface{} `json:"value" mapstructure:"value"` }
Condition represents a routing condition
type Config ¶
type Config struct { Providers []Provider `json:"providers" mapstructure:"providers"` Routes map[string]Route `json:"routes" mapstructure:"routes"` Log bool `json:"log" mapstructure:"log"` LogFile string `json:"log_file" mapstructure:"log_file"` Host string `json:"host" mapstructure:"host"` Port int `json:"port" mapstructure:"port"` APIKey string `json:"apikey" mapstructure:"apikey"` ProxyURL string `json:"proxy_url" mapstructure:"proxy_url"` Performance PerformanceConfig `json:"performance" mapstructure:"performance"` ShutdownTimeout time.Duration `json:"shutdown_timeout" mapstructure:"shutdown_timeout"` }
Config represents the main configuration structure for CCProxy
func LoadFromFile ¶
LoadFromFile loads configuration from a specific file
type PerformanceConfig ¶
type PerformanceConfig struct { MetricsEnabled bool `json:"metrics_enabled" mapstructure:"metrics_enabled"` RateLimitEnabled bool `json:"rate_limit_enabled" mapstructure:"rate_limit_enabled"` RateLimitRequestsPerMin int `json:"rate_limit_requests_per_min" mapstructure:"rate_limit_requests_per_min"` CircuitBreakerEnabled bool `json:"circuit_breaker_enabled" mapstructure:"circuit_breaker_enabled"` RequestTimeout time.Duration `json:"request_timeout" mapstructure:"request_timeout"` MaxRequestBodySize int64 `json:"max_request_body_size" mapstructure:"max_request_body_size"` }
PerformanceConfig represents performance monitoring configuration
type Provider ¶
type Provider struct { Name string `json:"name" mapstructure:"name"` APIBaseURL string `json:"api_base_url" mapstructure:"api_base_url"` APIKey string `json:"api_key" mapstructure:"api_key"` Models []string `json:"models" mapstructure:"models"` Enabled bool `json:"enabled" mapstructure:"enabled"` Transformers []TransformerConfig `json:"transformers" mapstructure:"transformers"` CreatedAt time.Time `json:"created_at" mapstructure:"created_at"` UpdatedAt time.Time `json:"updated_at" mapstructure:"updated_at"` MessageFormat string `json:"message_format,omitempty" mapstructure:"message_format"` // Message format used by provider }
Provider represents a LLM provider configuration
type Route ¶
type Route struct { Provider string `json:"provider" mapstructure:"provider"` Model string `json:"model" mapstructure:"model"` Conditions []Condition `json:"conditions" mapstructure:"conditions"` Parameters map[string]interface{} `json:"parameters,omitempty" mapstructure:"parameters"` }
Route represents a routing configuration
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles configuration loading and management
func (*Service) DeleteProvider ¶
DeleteProvider removes a provider by name
func (*Service) Get ¶
Get returns the current configuration (returns a copy to prevent race conditions)
func (*Service) GetProvider ¶
GetProvider returns a provider by name
func (*Service) SaveProvider ¶
SaveProvider saves a new provider
func (*Service) UpdateProvider ¶
UpdateProvider updates a provider by name
type TransformerConfig ¶
type TransformerConfig struct { Name string `json:"name" mapstructure:"name"` Config map[string]interface{} `json:"config,omitempty" mapstructure:"config"` }
TransformerConfig represents transformer configuration