fix: update text handling to ensure nil checks and pointer usage for message content

This commit is contained in:
Laisky.Cai
2025-03-17 03:31:43 +00:00
parent 34c7523f01
commit d236477531
5 changed files with 13 additions and 9 deletions

View File

@@ -159,7 +159,9 @@ func ConvertRequest(c *gin.Context, textRequest model.GeneralOpenAIRequest) (*Re
var content Content
if part.Type == model.ContentTypeText {
content.Type = "text"
content.Text = part.Text
if part.Text != nil {
content.Text = *part.Text
}
} else if part.Type == model.ContentTypeImageURL {
content.Type = "image"
content.Source = &ImageSource{