From f22021187dec9b561d7dc02edf3f6e05775b215d Mon Sep 17 00:00:00 2001 From: Timo Clasen Date: Thu, 10 Jul 2025 01:37:39 +0200 Subject: [PATCH] feat(tui): treat pasted text file paths as file references (#809) --- packages/tui/internal/components/chat/editor.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/tui/internal/components/chat/editor.go b/packages/tui/internal/components/chat/editor.go index 6053c9c0..4f624972 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)