feat: make slack process images

This commit is contained in:
mudler
2025-03-09 18:50:54 +01:00
committed by Ettore Di Giacinto
parent bc60dde94f
commit 0b71d8dc10
4 changed files with 309 additions and 118 deletions

View File

@@ -358,14 +358,18 @@ func (a *Agent) processUserInputs(job *Job, role string) {
} else {
// We replace the user message with the image description
// and add the user text to the conversation
lastUserMessage.Content = fmt.Sprintf("The user shared an image which can be described as: %s", imageDescription)
lastUserMessage.MultiContent = nil
lastUserMessage.Role = "system"
explainerMessage := openai.ChatCompletionMessage{
Role: "system",
Content: fmt.Sprintf("The user shared an image which can be described as: %s", imageDescription),
}
// remove lastUserMessage from the conversation
a.currentConversation = a.currentConversation.RemoveLastUserMessage()
a.currentConversation = append(a.currentConversation, explainerMessage)
a.currentConversation = append(a.currentConversation, openai.ChatCompletionMessage{
Role: role,
Content: text,
})
xlog.Debug("Conversation after image description", "conversation", a.currentConversation)
}
}
}