summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--packages/tui/internal/components/chat/editor.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go
index 6053c9c01..4f6249722 100644
--- a/packages/tui/internal/components/chat/editor.go
+++ b/packages/tui/internal/components/chat/editor.go
@@ -96,7 +96,16 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
case ".pdf":
mediaType = "application/pdf"
default:
- mediaType = "text/plain"
+ attachment := &textarea.Attachment{
+ ID: uuid.NewString(),
+ Display: "@" + filePath,
+ URL: fmt.Sprintf("file://./%s", filePath),
+ Filename: filePath,
+ MediaType: "text/plain",
+ }
+ m.textarea.InsertAttachment(attachment)
+ m.textarea.InsertString(" ")
+ return m, nil
}
fileBytes, err := os.ReadFile(filePath)