fix: Switch to channel-ratio

- Use channel ratios instead of group ratios in all applicable places
- Start using the lowest channel ratio of the specified channel's groups
This commit is contained in:
Laisky.Cai
2024-03-01 13:49:23 +00:00
parent ba827b95e3
commit dbe3930a8c
5 changed files with 24 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ type RelayMeta struct {
ActualModelName string
RequestURLPath string
PromptTokens int // only for DoResponse
ChannelRatio float64
}
func GetRelayMeta(c *gin.Context) *RelayMeta {
@@ -43,6 +44,7 @@ func GetRelayMeta(c *gin.Context) *RelayMeta {
APIKey: strings.TrimPrefix(c.Request.Header.Get("Authorization"), "Bearer "),
Config: nil,
RequestURLPath: c.Request.URL.String(),
ChannelRatio: c.GetFloat64("channel_ratio"),
}
if meta.ChannelType == common.ChannelTypeAzure {
meta.APIVersion = GetAzureAPIVersion(c)