mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-04-18 03:47:27 +00:00
fix: 修复PR的潜在问题
1. 解析ImageRequest的Extra时,处理err 2. DoResponse方法添加RelayModeImagesGenerations(fallthrough)
This commit is contained in:
@@ -37,11 +37,13 @@ func (a *Adaptor) ConvertAudioRequest(c *gin.Context, info *relaycommon.RelayInf
|
||||
|
||||
func (a *Adaptor) ConvertImageRequest(c *gin.Context, info *relaycommon.RelayInfo, request dto.ImageRequest) (any, error) {
|
||||
// 解析extra到SFImageRequest里,以填入SiliconFlow特殊字段。若失败重建一个空的。
|
||||
extra, _ := common.Marshal(request.Extra)
|
||||
sfRequest := &SFImageRequest{}
|
||||
err := common.Unmarshal(extra, sfRequest)
|
||||
if err != nil {
|
||||
sfRequest = &SFImageRequest{}
|
||||
extra, err := common.Marshal(request.Extra)
|
||||
if err == nil {
|
||||
err = common.Unmarshal(extra, sfRequest)
|
||||
if err != nil {
|
||||
sfRequest = &SFImageRequest{}
|
||||
}
|
||||
}
|
||||
|
||||
sfRequest.Model = request.Model
|
||||
@@ -122,6 +124,8 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, info *relaycom
|
||||
fallthrough
|
||||
case constant.RelayModeChatCompletions:
|
||||
fallthrough
|
||||
case constant.RelayModeImagesGenerations:
|
||||
fallthrough
|
||||
default:
|
||||
if info.IsStream {
|
||||
usage, err = openai.OaiStreamHandler(c, info, resp)
|
||||
|
||||
Reference in New Issue
Block a user