mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 17:46:37 +08:00
fix: update GetAdaptor function to use the actual model name
The GetAdaptor function in the Adaptor struct has been updated to use the actual model name instead of the origin model name. This change ensures that the correct adaptor is retrieved for processing the response.
This commit is contained in:
parent
af59566766
commit
f7a1f72d68
@ -38,7 +38,7 @@ func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.G
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode) {
|
func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode) {
|
||||||
adaptor := GetAdaptor(meta.OriginModelName)
|
adaptor := GetAdaptor(meta.ActualModelName)
|
||||||
if adaptor == nil {
|
if adaptor == nil {
|
||||||
return nil, &relaymodel.ErrorWithStatusCode{
|
return nil, &relaymodel.ErrorWithStatusCode{
|
||||||
StatusCode: http.StatusInternalServerError,
|
StatusCode: http.StatusInternalServerError,
|
||||||
|
@ -11,20 +11,22 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Meta struct {
|
type Meta struct {
|
||||||
Mode int
|
Mode int
|
||||||
ChannelType int
|
ChannelType int
|
||||||
ChannelId int
|
ChannelId int
|
||||||
TokenId int
|
TokenId int
|
||||||
TokenName string
|
TokenName string
|
||||||
UserId int
|
UserId int
|
||||||
Group string
|
Group string
|
||||||
ModelMapping map[string]string
|
ModelMapping map[string]string
|
||||||
BaseURL string
|
BaseURL string
|
||||||
APIKey string
|
APIKey string
|
||||||
APIType int
|
APIType int
|
||||||
Config model.ChannelConfig
|
Config model.ChannelConfig
|
||||||
IsStream bool
|
IsStream bool
|
||||||
|
// OriginModelName is the model name from the raw user request
|
||||||
OriginModelName string
|
OriginModelName string
|
||||||
|
// ActualModelName is the model name after mapping
|
||||||
ActualModelName string
|
ActualModelName string
|
||||||
RequestURLPath string
|
RequestURLPath string
|
||||||
PromptTokens int // only for DoResponse
|
PromptTokens int // only for DoResponse
|
||||||
|
Loading…
Reference in New Issue
Block a user