Jelajahi Sumber

Merge pull request #1260 from tbphp/fix-gemini-empty-content-error

fix: Gemini & Vertex empty content error
Calcium-Ion 8 bulan lalu
induk
melakukan
ab78efc815
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      relay/channel/gemini/relay-gemini.go

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

@@ -374,7 +374,9 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest, info *relaycommon
 		if content.Role == "assistant" {
 		if content.Role == "assistant" {
 			content.Role = "model"
 			content.Role = "model"
 		}
 		}
-		geminiRequest.Contents = append(geminiRequest.Contents, content)
+		if len(content.Parts) > 0 {
+			geminiRequest.Contents = append(geminiRequest.Contents, content)
+		}
 	}
 	}
 
 
 	if len(system_content) > 0 {
 	if len(system_content) > 0 {