소스 검색

fix: fix gemini channel test

CaIon 2 년 전
부모
커밋
e147061933
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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)