BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr
Adjust to send up to the first 50 images to the context
hwliang1a2157e7fe60
diff --git a/core/internal/service/askai/openai.go b/core/internal/service/askai/openai.goindex 085bfc7f..57055d65 100644--- a/core/internal/service/askai/openai.go+++ b/core/internal/service/askai/openai.go@@ -477,8 +477,18 @@ func (o *OpenAI) GetImagesPrompt() (string, int) {return "", 0}- prompt := DataToText(images, "Images", []string{"UpdateTime", "ImageId", "Filename", "ImageTag"}) // Convert the images configuration to a text representation- tokens, _ := o.CalculateTokens(prompt, true) // Calculate the tokens for the images prompt+ n := 0+ newImages := []ImageInfo{}+ for _, image := range images {+ if n > 50 {+ break+ }+ newImages = append(newImages, image)+ n+++ }++ prompt := DataToText(newImages, "Images", []string{"UpdateTime", "ImageId", "Filename", "ImageTag"}) // Convert the images configuration to a text representation+ tokens, _ := o.CalculateTokens(prompt, true) // Calculate the tokens for the images promptreturn prompt, tokens}