From fc2486d8783fb280f03d8a4bb91755a76137a35d Mon Sep 17 00:00:00 2001 From: etnAtker Date: Mon, 13 Oct 2025 20:20:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPR=E7=9A=84=E6=BD=9C?= =?UTF-8?q?=E5=9C=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 解析ImageRequest的Extra时,处理err 2. DoResponse方法添加RelayModeImagesGenerations(fallthrough) --- relay/channel/siliconflow/adaptor.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/relay/channel/siliconflow/adaptor.go b/relay/channel/siliconflow/adaptor.go index 57e13d7e..daffff18 100644 --- a/relay/channel/siliconflow/adaptor.go +++ b/relay/channel/siliconflow/adaptor.go @@ -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)