chore: small fixes

Kujtim Hoxha created

Change summary

internal/tui/components/chat/sidebar/sidebar.go |  5 ++++-
internal/tui/tui.go                             | 10 ++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)

Detailed changes

internal/tui/components/chat/sidebar/sidebar.go 🔗

@@ -291,7 +291,10 @@ func (m *sidebarCmp) filesBlock() string {
 		}
 
 		extraContent := strings.Join(statusParts, " ")
-		filePath := fsext.DirTrim(fsext.PrettyPath(file.FilePath), 2)
+		cwd := config.WorkingDirectory() + string(os.PathSeparator)
+		filePath := file.FilePath
+		filePath = strings.TrimPrefix(filePath, cwd)
+		filePath = fsext.DirTrim(fsext.PrettyPath(filePath), 2)
 		filePath = ansi.Truncate(filePath, maxWidth-lipgloss.Width(extraContent)-2, "…")
 		fileList = append(fileList,
 			core.Status(

internal/tui/tui.go 🔗

@@ -2,6 +2,7 @@ package tui
 
 import (
 	"context"
+	"fmt"
 
 	"github.com/charmbracelet/bubbles/v2/key"
 	tea "github.com/charmbracelet/bubbletea/v2"
@@ -175,6 +176,15 @@ func (a *appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
 			Model: compact.NewCompactDialogCmp(a.app.CoderAgent, msg.SessionID, true),
 		})
 
+	// Model Switch
+	case models.ModelSelectedMsg:
+		model, err := a.app.CoderAgent.Update(config.AgentCoder, msg.Model.ID)
+		if err != nil {
+			return a, util.ReportError(err)
+		}
+
+		return a, util.ReportInfo(fmt.Sprintf("Model changed to %s", model.Name))
+
 	// File Picker
 	case chat.OpenFilePickerMsg:
 		if a.dialog.ActiveDialogID() == filepicker.FilePickerID {