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

@@ -119,6 +119,20 @@ func (m Messages) Exist(content string) bool {
return false
}
func (m Messages) RemoveLastUserMessage() Messages {
if len(m) == 0 {
return m
}
for i := len(m) - 1; i >= 0; i-- {
if m[i].Role == UserRole {
return append(m[:i], m[i+1:]...)
}
}
return m
}
func (m Messages) Save(path string) error {
content, err := json.MarshalIndent(m, "", " ")
if err != nil {