feat(tui): treat pasted text file paths as file references (#809)

This commit is contained in:
Timo Clasen
2025-07-10 01:37:39 +02:00
committed by GitHub
parent febecc348a
commit f22021187d

View File

@@ -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)