@@ -193,17 +193,19 @@ func (m *messageCmp) renderAssistantMessage() string {
193 return m.style().Render(joined)
193 return m.style().Render(joined)
196−// renderUserMessage renders user messages with file attachments.
196+// renderUserMessage renders user messages with file attachments. It displays
197−// Displays message content and any attached files with appropriate icons.
197+// message content and any attached files with appropriate icons.
198func (m *messageCmp) renderUserMessage() string {
198func (m *messageCmp) renderUserMessage() string {
199 t := styles.CurrentTheme()
199 t := styles.CurrentTheme()
200 parts := []string{
200 parts := []string{
201 m.toMarkdown(m.message.Content().String()),
201 m.toMarkdown(m.message.Content().String()),
203 attachmentStyles := t.S().Text.
204 attachmentStyles := t.S().Text.
204 MarginLeft(1).
205 MarginLeft(1).
205 Background(t.BgSubtle)
206 Background(t.BgSubtle)
206− attachments := []string{}
208+ attachments := make([]string, len(m.message.BinaryContent()))
207 for _, attachment := range m.message.BinaryContent() {
209 for _, attachment := range m.message.BinaryContent() {
208 file := filepath.Base(attachment.Path)
210 file := filepath.Base(attachment.Path)
209 var filename string
211 var filename string
@@ -214,9 +216,11 @@ func (m *messageCmp) renderUserMessage() string {
215 attachments = append(attachments, attachmentStyles.Render(filename))
217 attachments = append(attachments, attachmentStyles.Render(filename))
217 if len(attachments) > 0 {
220 if len(attachments) > 0 {
218 parts = append(parts, "", strings.Join(attachments, ""))
221 parts = append(parts, "", strings.Join(attachments, ""))
220 joined := lipgloss.JoinVertical(lipgloss.Left, parts...)
224 joined := lipgloss.JoinVertical(lipgloss.Left, parts...)
221 return m.style().Render(joined)
225 return m.style().Render(joined)