fix(ui/chat): display names of all attached files (#706)

This commit is contained in:
Ayyan 2026-01-14 20:23:18 -05:00 • committed by GitHub
parent eebe22e939
commit 8723e87682
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 1 deletions

View file

@ -658,5 +658,10 @@ func (mi *messageInput) openFilePicker() {
func (mi *messageInput) attach(name string, reader io.Reader) {
mi.sendMessageData.Files = append(mi.sendMessageData.Files, sendpart.File{Name: name, Reader: reader})
mi.SetFooter("Attached " + name)
var names []string
for _, file := range mi.sendMessageData.Files {
names = append(names, file.Name)
}
mi.SetFooter("Attached " + humanJoin(names))
}

17
internal/ui/chat/util.go Normal file
View file

@ -0,0 +1,17 @@
package chat
import "strings"
func humanJoin(items []string) string {
count := len(items)
switch count {
case 0:
return ""
case 1:
return items[0]
case 2:
return items[0] + " and " + items[1]
default:
return strings.Join(items[:count-1], ", ") + ", and " + items[count-1]
}
}