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
1c44d7e1cd
commit
d6536d2907
@ -147,7 +147,6 @@ var InitialRootAccessToken = os.Getenv("INITIAL_ROOT_ACCESS_TOKEN")
|
|||||||
|
|
||||||
var GeminiVersion = env.String("GEMINI_VERSION", "v1")
|
var GeminiVersion = env.String("GEMINI_VERSION", "v1")
|
||||||
|
|
||||||
|
|
||||||
var OnlyOneLogFile = env.Bool("ONLY_ONE_LOG_FILE", false)
|
var OnlyOneLogFile = env.Bool("ONLY_ONE_LOG_FILE", false)
|
||||||
|
|
||||||
var RelayProxy = env.String("RELAY_PROXY", "")
|
var RelayProxy = env.String("RELAY_PROXY", "")
|
||||||
|
@ -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,
|
||||||
|
@ -32,7 +32,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type innerAIAdapter interface {
|
type innerAIAdapter interface {
|
||||||
ConvertRequest(c *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)
|
ConvertRequest(c *gin.Context, relayMode int, request *model.GeneralOpenAIRequest) (any, error)
|
||||||
DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)
|
DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode)
|
||||||
|
@ -26,7 +26,6 @@ type ApplicationDefaultCredentials struct {
|
|||||||
UniverseDomain string `json:"universe_domain"`
|
UniverseDomain string `json:"universe_domain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var Cache = cache.New(50*time.Minute, 55*time.Minute)
|
var Cache = cache.New(50*time.Minute, 55*time.Minute)
|
||||||
|
|
||||||
const defaultScope = "https://www.googleapis.com/auth/cloud-platform"
|
const defaultScope = "https://www.googleapis.com/auth/cloud-platform"
|
||||||
|
@ -23,7 +23,9 @@ type Meta struct {
|
|||||||
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