Browse Source

fix: need ignore empty gemini part (#363)

* fix: need ignore empty gemini part

* fix: skip empty text part
zijiren 4 months ago
parent
commit
8fb04d5d58
1 changed files with 8 additions and 0 deletions
  1. 8 0
      core/relay/adaptor/gemini/main.go

+ 8 - 0
core/relay/adaptor/gemini/main.go

@@ -328,12 +328,20 @@ func buildContents(
 		default:
 			// Handle regular messages
 			openaiContent := message.ParseContent()
+			if len(openaiContent) == 0 {
+				continue
+			}
+
 			for _, part := range openaiContent {
 				msgPart := buildMessageParts(part)
 				if msgPart.InlineData != nil {
 					imageTasks = append(imageTasks, msgPart)
 				}
 
+				if msgPart.Text == "" {
+					continue
+				}
+
 				content.Parts = append(content.Parts, msgPart)
 			}
 		}