Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/tui/internal/components/chat/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if filePath := strings.TrimSpace(strings.TrimPrefix(text, "@")); strings.HasPrefix(text, "@") && filePath != "" {
statPath := filePath
if !filepath.IsAbs(filePath) {
statPath = filepath.Join(util.CwdPath, filePath)
statPath = filepath.Join(util.RootPath, filePath)
}
if _, err := os.Stat(statPath); err == nil {
attachment := m.createAttachmentFromPath(filePath)
Expand Down Expand Up @@ -629,7 +629,7 @@ func (m *editorComponent) SetValueWithAttachments(value string) {
if end > start {
filePath := value[start:end]
slog.Debug("test", "filePath", filePath)
if _, err := os.Stat(filepath.Join(util.CwdPath, filePath)); err == nil {
if _, err := os.Stat(filepath.Join(util.RootPath, filePath)); err == nil {
slog.Debug("test", "found", true)
attachment := m.createAttachmentFromFile(filePath)
if attachment != nil {
Expand Down Expand Up @@ -832,7 +832,7 @@ func (m *editorComponent) createAttachmentFromFile(filePath string) *attachment.
mediaType := getMediaTypeFromExtension(ext)
absolutePath := filePath
if !filepath.IsAbs(filePath) {
absolutePath = filepath.Join(util.CwdPath, filePath)
absolutePath = filepath.Join(util.RootPath, filePath)
}

// For text files, create a simple file reference
Expand Down Expand Up @@ -886,7 +886,7 @@ func (m *editorComponent) createAttachmentFromPath(filePath string) *attachment.
mediaType := getMediaTypeFromExtension(extension)
absolutePath := filePath
if !filepath.IsAbs(filePath) {
absolutePath = filepath.Join(util.CwdPath, filePath)
absolutePath = filepath.Join(util.RootPath, filePath)
}
return &attachment.Attachment{
ID: uuid.NewString(),
Expand Down