Fix hanging issue when sending empty content (#2399)

This commit is contained in:
Jeffrey Morgan
2024-02-07 19:30:33 -05:00
committed by GitHub
parent ab0d37fde4
commit a0a199b108
2 changed files with 24 additions and 21 deletions

View File

@@ -181,16 +181,19 @@ func (m *Model) ChatPrompts(msgs []api.Message) (*ChatHistory, error) {
}
currentVars.Prompt = msg.Content
for i := range msg.Images {
id := len(images) + i
currentVars.Prompt += fmt.Sprintf(" [img-%d]", id)
currentVars.Images = append(currentVars.Images, llm.ImageData{
ID: id,
Data: msg.Images[i],
})
}
images = append(images, currentVars.Images...)
if len(m.ProjectorPaths) > 0 {
for i := range msg.Images {
id := len(images) + i
currentVars.Prompt += fmt.Sprintf(" [img-%d]", id)
currentVars.Images = append(currentVars.Images, llm.ImageData{
ID: id,
Data: msg.Images[i],
})
}
images = append(images, currentVars.Images...)
}
case "assistant":
currentVars.Response = msg.Content
prompts = append(prompts, currentVars)