mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-04-24 03:00:15 -04:00
fix: initialize Parts slice in genai.Content struct to prevent nil pointer errors
## CHANGES - Initialize Parts slice with empty slice in Content struct - Prevent potential nil pointer dereference during message conversion - Ensure Parts field is ready for append operations - Improve robustness of convertMessages function in Gemini client
This commit is contained in:
@@ -323,7 +323,7 @@ func (o *Client) convertMessages(msgs []*chat.ChatCompletionMessage) []*genai.Co
|
||||
var contents []*genai.Content
|
||||
|
||||
for _, msg := range msgs {
|
||||
content := &genai.Content{}
|
||||
content := &genai.Content{Parts: []*genai.Part{}}
|
||||
|
||||
if msg.Content != "" {
|
||||
content.Parts = append(content.Parts, &genai.Part{Text: msg.Content})
|
||||
|
||||
Reference in New Issue
Block a user