Documentation ¶
Index ¶
- Constants
- func AdminAuth(c *gin.Context)
- func CORS() gin.HandlerFunc
- func Distribute(c *gin.Context)
- func ErrorResponse(c *gin.Context, code int, message string)
- func ForceRateLimit(ctx context.Context, key string, maxRequestNum int, duration time.Duration) bool
- func GetLogger(c *gin.Context) *logrus.Entry
- func GlobalAPIRateLimit(c *gin.Context)
- func MemoryRateLimit(_ context.Context, key string, maxRequestNum int, duration time.Duration) bool
- func NewLog(l *logrus.Logger) gin.HandlerFunc
- func NewLogger() *logrus.Entry
- func NewMetaByContext(c *gin.Context) *meta.Meta
- func RateLimit(ctx context.Context, key string, maxRequestNum int, duration time.Duration) (bool, error)
- func RequestID(c *gin.Context)
- func SetLogActualModelFields(fields logrus.Fields, actualModel string)
- func SetLogChannelFields(fields logrus.Fields, channel *meta.ChannelMeta)
- func SetLogFieldsFromMeta(m *meta.Meta, fields logrus.Fields)
- func SetLogGroupFields(fields logrus.Fields, group *model.GroupCache)
- func SetLogIsChannelTestField(fields logrus.Fields, isChannelTest bool)
- func SetLogModeField(fields logrus.Fields, mode int)
- func SetLogModelFields(fields logrus.Fields, model string)
- func SetLogRequestIDField(fields logrus.Fields, requestID string)
- func SetLogTokenFields(fields logrus.Fields, token *model.TokenCache)
- func SuccessResponse(c *gin.Context, data any)
- func TokenAuth(c *gin.Context)
- type APIResponse
- type ModelRequest
Constants ¶
View Source
const (
ErrorTypeAIPROXY = "aiproxy_error"
)
Variables ¶
This section is empty.
Functions ¶
func CORS ¶
func CORS() gin.HandlerFunc
func Distribute ¶
func ForceRateLimit ¶
func ForceRateLimit(ctx context.Context, key string, maxRequestNum int, duration time.Duration) bool
ignore redis error
func GlobalAPIRateLimit ¶
func MemoryRateLimit ¶
func SetLogActualModelFields ¶
func SetLogChannelFields ¶
func SetLogChannelFields(fields logrus.Fields, channel *meta.ChannelMeta)
func SetLogGroupFields ¶
func SetLogGroupFields(fields logrus.Fields, group *model.GroupCache)
func SetLogModeField ¶
func SetLogModelFields ¶
func SetLogRequestIDField ¶
func SetLogTokenFields ¶
func SetLogTokenFields(fields logrus.Fields, token *model.TokenCache)
func SuccessResponse ¶
Types ¶
type APIResponse ¶
type ModelRequest ¶
type ModelRequest struct {
Model string `form:"model" json:"model"`
}
Click to show internal directories.
Click to hide internal directories.