web

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(c *gin.Context, code int, message string)

Types

type AdminServer

type AdminServer struct {
	// contains filtered or unexported fields
}

func NewAdminServer

func NewAdminServer(log logger.Logger, m KeyManager) (*AdminServer, error)

func (*AdminServer) Run

func (as *AdminServer) Run()

func (*AdminServer) Shutdown

func (as *AdminServer) Shutdown(ctx context.Context) error

type ErrorResponse

type ErrorResponse struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Status   int    `json:"status"`
	Detail   string `json:"detail"`
	Instance string `json:"instance"`
}

type KeyManager

type KeyManager interface {
	GetKeysByTag(tag string) ([]*key.ResponseKey, error)
	UpdateKey(id string, key *key.UpdateKey) (*key.ResponseKey, error)
	CreateKey(key *key.RequestKey) (*key.ResponseKey, error)
	DeleteKey(id string) error
}

type ProxyServer

type ProxyServer struct {
	// contains filtered or unexported fields
}

func NewProxyServer

func NewProxyServer(log logger.Logger, m KeyManager, ks keyStorage, kms keyMemStorage, e estimator, v validator, r recorder, credential string, enc encrypter, rlm rateLimitManager) (*ProxyServer, error)

func (*ProxyServer) Run

func (ps *ProxyServer) Run()

func (*ProxyServer) Shutdown

func (ps *ProxyServer) Shutdown(ctx context.Context) error

type Route

type Route struct {
	// contains filtered or unexported fields
}

func NewRoute

func NewRoute(rc *config.RouteConfig, openAiClient openai.OpenAiClient, lg logger.Logger, lc *config.LoggerConfig, mode string) (*Route, error)

type ValidationError

type ValidationError interface {
	Error() string
	Validation()
}

type WebServer

type WebServer struct {
	// contains filtered or unexported fields
}

func NewWebServer

func NewWebServer(c *config.Config, lg logger.Logger, mode string) (*WebServer, error)

func (*WebServer) Run

func (w *WebServer) Run()

func (*WebServer) Shutdown

func (w *WebServer) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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