Kaynağa Gözat

fix: xAI missing finish_reason #572

CalciumIon 1 yıl önce
ebeveyn
işleme
1774be8536
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5 0
      relay/channel/openai/relay-openai.go

+ 5 - 0
relay/channel/openai/relay-openai.go

@@ -98,6 +98,11 @@ func OaiStreamHandler(c *gin.Context, resp *http.Response, info *relaycommon.Rel
 				shouldSendLastResp = false
 			}
 		}
+		for _, choice := range lastStreamResponse.Choices {
+			if choice.FinishReason != nil {
+				shouldSendLastResp = true
+			}
+		}
 	}
 	if shouldSendLastResp {
 		service.StringData(c, lastStreamData)