fix: fix gemini channel test

This commit is contained in:
CaIon 2024-03-08 21:38:51 +08:00
parent 26ef906c61
commit 8fe8340b6e

View File

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