Jelajahi Sumber

fix: fix gemini channel test

CaIon 2 tahun lalu
induk
melakukan
e147061933
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      relay/channel/gemini/relay-gemini.go

+ 1 - 1
relay/channel/gemini/relay-gemini.go

@@ -140,8 +140,8 @@ func responseGeminiChat2OpenAI(response *GeminiChatResponse) *dto.OpenAITextResp
 			},
 			FinishReason: relaycommon.StopFinishReason,
 		}
-		content, _ = json.Marshal(candidate.Content.Parts[0].Text)
 		if len(candidate.Content.Parts) > 0 {
+			content, _ = json.Marshal(candidate.Content.Parts[0].Text)
 			choice.Message.Content = content
 		}
 		fullTextResponse.Choices = append(fullTextResponse.Choices, choice)