mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-27 04:16:37 +08:00
fix: model redirect
This commit is contained in:
parent
62e9a628a6
commit
35ca91fc5e
@ -55,6 +55,8 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
|
||||
meta := relaycommon.GenRelayInfo(c)
|
||||
apiType, _ := constant.ChannelType2APIType(channel.Type)
|
||||
adaptor := relay.GetAdaptor(apiType)
|
||||
// OpenAI 适配器需要 channelType
|
||||
adaptor.Init(meta, dto.GeneralOpenAIRequest{})
|
||||
if adaptor == nil {
|
||||
return fmt.Errorf("invalid api type: %d, adaptor is nil", apiType), nil
|
||||
}
|
||||
@ -64,7 +66,7 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
|
||||
} else {
|
||||
testModel = adaptor.GetModelList()[0]
|
||||
}
|
||||
} else {
|
||||
}
|
||||
modelMapping := *channel.ModelMapping
|
||||
if modelMapping != "" && modelMapping != "{}" {
|
||||
modelMap := make(map[string]string)
|
||||
@ -77,8 +79,6 @@ func testChannel(channel *model.Channel, testModel string) (err error, openaiErr
|
||||
testModel = modelMap[testModel]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
request := buildTestRequest()
|
||||
request.Model = testModel
|
||||
meta.UpstreamModelName = testModel
|
||||
|
Loading…
Reference in New Issue
Block a user