Jelajahi Sumber

fix: test all channel error (close #206)

CaIon 1 tahun lalu
induk
melakukan
a4defe6ada
1 mengubah file dengan 7 tambahan dan 1 penghapusan
  1. 7 1
      relay/channel/xunfei/relay-xunfei.go

+ 7 - 1
relay/channel/xunfei/relay-xunfei.go

@@ -179,7 +179,13 @@ func xunfeiHandler(c *gin.Context, textRequest dto.GeneralOpenAIRequest, appId s
 		case stop = <-stopChan:
 		}
 	}
-
+	if len(xunfeiResponse.Payload.Choices.Text) == 0 {
+		xunfeiResponse.Payload.Choices.Text = []XunfeiChatResponseTextItem{
+			{
+				Content: "",
+			},
+		}
+	}
 	xunfeiResponse.Payload.Choices.Text[0].Content = content
 
 	response := responseXunfei2OpenAI(&xunfeiResponse)