server

package
v0.9.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(opts ...fx.Option)

func SetupRoutes

func SetupRoutes(server *Server, handlers Handlers, client *ent.Client, services Services)

Types

type API added in v0.9.20

type API struct {
	Auth APIAuth `conf:"auth" yaml:"auth" json:"auth"`
}

type APIAuth added in v0.9.20

type APIAuth struct {
	AllowNoAuth bool   `conf:"allow_no_auth" yaml:"allow_no_auth" json:"allow_no_auth"`
	KeyPrefix   string `conf:"key_prefix" yaml:"key_prefix" json:"key_prefix"`
}

type CORS added in v0.7.3

type CORS struct {
	Enabled          bool          `conf:"enabled" yaml:"enabled" json:"enabled"`
	AllowedOrigins   []string      `conf:"allowed_origins" yaml:"allowed_origins" json:"allowed_origins"`
	AllowedMethods   []string      `conf:"allowed_methods" yaml:"allowed_methods" json:"allowed_methods"`
	AllowedHeaders   []string      `conf:"allowed_headers" yaml:"allowed_headers" json:"allowed_headers"`
	ExposedHeaders   []string      `conf:"exposed_headers" yaml:"exposed_headers" json:"exposed_headers"`
	AllowCredentials bool          `conf:"allow_credentials" yaml:"allow_credentials" json:"allow_credentials"`
	MaxAge           time.Duration `conf:"max_age" yaml:"max_age" json:"max_age"`
}

type Config

type Config struct {
	Host        string        `conf:"host" yaml:"host" json:"host"`
	Port        int           `conf:"port" yaml:"port" json:"port"`
	Name        string        `conf:"name" yaml:"name" json:"name"`
	BasePath    string        `conf:"base_path" yaml:"base_path" json:"base_path"`
	ReadTimeout time.Duration `conf:"read_timeout" yaml:"read_timeout" json:"read_timeout"`

	// RequestTimeout is the maximum duration for processing a request.
	RequestTimeout time.Duration `conf:"request_timeout" yaml:"request_timeout" json:"request_timeout"`

	// LLMRequestTimeout is the maximum duration for processing a request to LLM.
	LLMRequestTimeout time.Duration `conf:"llm_request_timeout" yaml:"llm_request_timeout" json:"llm_request_timeout"`

	Trace     tracing.Config `conf:"trace" yaml:"trace" json:"trace"`
	Dashboard Dashboard      `conf:"dashboard" yaml:"dashboard" json:"dashboard"`

	Debug            bool `conf:"debug" yaml:"debug" json:"debug"`
	DisableSSLVerify bool `conf:"disable_ssl_verify" yaml:"disable_ssl_verify" json:"disable_ssl_verify"`
	CORS             CORS `conf:"cors" yaml:"cors" json:"cors"`
	API              API  `conf:"api" yaml:"api" json:"api"`
}

type Dashboard added in v0.9.13

type Dashboard struct {
	// AllTimeTokenStatsSoftTTL is the duration after which cached all-time token stats
	// are considered stale and will be refreshed asynchronously (stale-while-revalidate).
	// Default: 1 hour
	AllTimeTokenStatsSoftTTL time.Duration `conf:"all_time_token_stats_soft_ttl" yaml:"all_time_token_stats_soft_ttl" json:"all_time_token_stats_soft_ttl"`

	// AllTimeTokenStatsHardTTL is the maximum duration for which cached all-time token stats
	// are considered valid. After this, synchronous refresh is required.
	// Default: 24 hours
	AllTimeTokenStatsHardTTL time.Duration `conf:"all_time_token_stats_hard_ttl" yaml:"all_time_token_stats_hard_ttl" json:"all_time_token_stats_hard_ttl"`
}

Dashboard holds configuration for the dashboard cache settings.

type Handlers

type Handlers struct {
	fx.In

	Graphql        *gql.GraphqlHandler
	OpenAPIGraphql *openapi.GraphqlHandler
	OpenAI         *api.OpenAIHandlers
	Doubao         *api.DoubaoHandlers
	Anthropic      *api.AnthropicHandlers
	Gemini         *api.GeminiHandlers
	AiSDK          *api.AiSDKHandlers
	Playground     *api.PlaygroundHandlers
	System         *api.SystemHandlers
	Auth           *api.AuthHandlers
	Jina           *api.JinaHandlers
	Codex          *api.CodexHandlers
	ClaudeCode     *api.ClaudeCodeHandlers
	Antigravity    *api.AntigravityHandlers
	Copilot        *api.CopilotHandlers
	RequestContent *api.RequestContentHandlers
	RequestPreview *api.RequestPreviewHandlers
}

type Server

type Server struct {
	*gin.Engine

	Config Config
	// contains filtered or unexported fields
}

func New

func New(config Config) *Server

func (*Server) Run

func (srv *Server) Run() error

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) error

type Services added in v0.4.0

type Services struct {
	fx.In

	TraceService  *biz.TraceService
	ThreadService *biz.ThreadService
	AuthService   *biz.AuthService
}

Directories

Path Synopsis
biz
gql
qb
Package qb provides database utilities and query builders for AxonHub.
Package qb provides database utilities and query builders for AxonHub.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL