mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 10:33:41 +08:00
chore: do not hardcode context key
This commit is contained in:
@@ -33,14 +33,14 @@ type Meta struct {
|
||||
func GetByContext(c *gin.Context) *Meta {
|
||||
meta := Meta{
|
||||
Mode: relaymode.GetByPath(c.Request.URL.Path),
|
||||
ChannelType: c.GetInt("channel"),
|
||||
ChannelId: c.GetInt("channel_id"),
|
||||
TokenId: c.GetInt("token_id"),
|
||||
TokenName: c.GetString("token_name"),
|
||||
UserId: c.GetInt("id"),
|
||||
Group: c.GetString("group"),
|
||||
ModelMapping: c.GetStringMapString("model_mapping"),
|
||||
BaseURL: c.GetString("base_url"),
|
||||
ChannelType: c.GetInt(ctxkey.Channel),
|
||||
ChannelId: c.GetInt(ctxkey.ChannelId),
|
||||
TokenId: c.GetInt(ctxkey.TokenId),
|
||||
TokenName: c.GetString(ctxkey.TokenName),
|
||||
UserId: c.GetInt(ctxkey.Id),
|
||||
Group: c.GetString(ctxkey.Group),
|
||||
ModelMapping: c.GetStringMapString(ctxkey.ModelMapping),
|
||||
BaseURL: c.GetString(ctxkey.BaseURL),
|
||||
APIVersion: c.GetString(ctxkey.ConfigAPIVersion),
|
||||
APIKey: strings.TrimPrefix(c.Request.Header.Get("Authorization"), "Bearer "),
|
||||
Config: nil,
|
||||
|
||||
Reference in New Issue
Block a user