Documentation
¶
Index ¶
- type APIKeyConfig
- type AuthConfig
- type CORSConfig
- type Config
- type DatabaseConfig
- type Dependencies
- type HealthCheckConfig
- type JWTConfig
- type LoggingConfig
- type MetricsConfig
- type MockProvider
- func (m *MockProvider) Capabilities() provider.ProviderCapabilities
- func (m *MockProvider) Close() error
- func (m *MockProvider) Complete(ctx context.Context, messages []types.Message, opts *provider.StreamOptions) (*provider.CompleteResponse, error)
- func (m *MockProvider) Config() *types.ModelConfig
- func (m *MockProvider) GetSystemPrompt() string
- func (m *MockProvider) SetSystemPrompt(prompt string) error
- func (m *MockProvider) Stream(ctx context.Context, messages []types.Message, opts *provider.StreamOptions) (<-chan provider.StreamChunk, error)
- type MockProviderFactory
- type ObservabilityConfig
- type Option
- type RateLimitConfig
- type RedisConfig
- type Server
- type TLSConfig
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyConfig ¶
APIKeyConfig holds API key authentication settings
type AuthConfig ¶
type AuthConfig struct {
APIKey APIKeyConfig
JWT JWTConfig
}
AuthConfig holds authentication configuration
type CORSConfig ¶
type CORSConfig struct {
Enabled bool
AllowOrigins []string
AllowMethods []string
AllowHeaders []string
ExposeHeaders []string
AllowCredentials bool
MaxAge int
}
CORSConfig holds CORS configuration
type Config ¶
type Config struct {
Host string
Port int
Mode string // "development" or "production"
CORS CORSConfig
Auth AuthConfig
RateLimit RateLimitConfig
Logging LoggingConfig
Observability ObservabilityConfig
Database DatabaseConfig
Redis RedisConfig
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
TLS TLSConfig
}
Config holds all configuration for the aster production server
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default configuration for development
func ProductionConfig ¶
func ProductionConfig() *Config
ProductionConfig returns a configuration suitable for production
type DatabaseConfig ¶
DatabaseConfig holds database configuration
type Dependencies ¶
type Dependencies struct {
Store store.Store
AgentDeps *agent.Dependencies
}
Dependencies holds all dependencies for the server
type HealthCheckConfig ¶
HealthCheckConfig holds health check settings
type JWTConfig ¶
type JWTConfig struct {
Enabled bool
Secret string
Issuer string
Audience string
TokenDuration int // seconds
Expiry int // seconds (alias for TokenDuration)
ExpiryMinutes int
}
JWTConfig holds JWT authentication settings
type LoggingConfig ¶
LoggingConfig holds logging configuration
type MetricsConfig ¶
MetricsConfig holds metrics configuration
type MockProvider ¶ added in v0.15.0
type MockProvider struct {
// contains filtered or unexported fields
}
MockProvider 模拟 Provider 用于测试
func (*MockProvider) Capabilities ¶ added in v0.15.0
func (m *MockProvider) Capabilities() provider.ProviderCapabilities
func (*MockProvider) Close ¶ added in v0.15.0
func (m *MockProvider) Close() error
func (*MockProvider) Complete ¶ added in v0.15.0
func (m *MockProvider) Complete(ctx context.Context, messages []types.Message, opts *provider.StreamOptions) (*provider.CompleteResponse, error)
func (*MockProvider) Config ¶ added in v0.15.0
func (m *MockProvider) Config() *types.ModelConfig
func (*MockProvider) GetSystemPrompt ¶ added in v0.15.0
func (m *MockProvider) GetSystemPrompt() string
func (*MockProvider) SetSystemPrompt ¶ added in v0.15.0
func (m *MockProvider) SetSystemPrompt(prompt string) error
func (*MockProvider) Stream ¶ added in v0.15.0
func (m *MockProvider) Stream(ctx context.Context, messages []types.Message, opts *provider.StreamOptions) (<-chan provider.StreamChunk, error)
type MockProviderFactory ¶ added in v0.15.0
type MockProviderFactory struct {
// contains filtered or unexported fields
}
MockProviderFactory 模拟 ProviderFactory
func NewMockProviderFactory ¶ added in v0.15.0
func NewMockProviderFactory() *MockProviderFactory
func (*MockProviderFactory) Create ¶ added in v0.15.0
func (f *MockProviderFactory) Create(config *types.ModelConfig) (provider.Provider, error)
func (*MockProviderFactory) SetProvider ¶ added in v0.15.0
func (f *MockProviderFactory) SetProvider(key string, p *MockProvider)
type ObservabilityConfig ¶
type ObservabilityConfig struct {
Enabled bool
Metrics MetricsConfig
Tracing TracingConfig
HealthCheck HealthCheckConfig
}
ObservabilityConfig holds observability settings
type Option ¶
type Option func(*Server)
Option is a function that configures a Server
func WithCustomRouter ¶
WithCustomRouter allows setting a custom Gin router
func WithMiddleware ¶
func WithMiddleware(middlewares ...gin.HandlerFunc) Option
WithMiddleware adds custom gin middlewares to the router
type RateLimitConfig ¶
type RateLimitConfig struct {
Enabled bool
RequestsPerIP int
WindowSize time.Duration
BurstSize int
}
RateLimitConfig holds rate limiting configuration
type RedisConfig ¶
RedisConfig holds Redis configuration
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the aster production server
func New ¶
func New(config *Config, deps *Dependencies, opts ...Option) (*Server, error)
New creates a new Server instance with the given configuration
type TracingConfig ¶
type TracingConfig struct {
Enabled bool
ServiceName string
ServiceVersion string
Environment string
OTLPEndpoint string // OTLP endpoint (e.g., "localhost:4318")
OTLPInsecure bool // Use insecure connection
SamplingRate float64 // 0.0 - 1.0
}
TracingConfig holds tracing configuration