on main help sign in
chore: add new session
bcd944cKujtim Hoxha
internal/llm/prompt/coder.md+1−1
@@ -228,7 +228,7 @@ NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTAN
228
228
229**When to verify with `pwd`:**
229**When to verify with `pwd`:**
230
230
231−- After a command fails with "file not found" or similar path-related errors
231+- After a command fails with "file not found" or similar path-related or `exit status 1` errors
232- When resuming work or continuing from a previous step if uncertain
232- When resuming work or continuing from a previous step if uncertain
233- When you realize you may have lost track of your current location
233- When you realize you may have lost track of your current location
234
234
internal/tui/components/chat/splash/splash.go+20
@@ -562,6 +562,8 @@ func (s *splashCmp) infoSection() string {
562 lipgloss.Left,
562 lipgloss.Left,
563 s.cwd(),
563 s.cwd(),
564 "",
564 "",
565+ s.currentModelBlock(),
566+ "",
565 lipgloss.JoinHorizontal(lipgloss.Left, s.lspBlock(), s.mcpBlock()),
567 lipgloss.JoinHorizontal(lipgloss.Left, s.lspBlock(), s.mcpBlock()),
566 "",
568 "",
567 ),
569 ),
@@ -740,6 +742,24 @@ func (s *splashCmp) mcpBlock() string {
740 )
742 )
741}
743}
742
744
745+func (s *splashCmp) currentModelBlock() string {
746+ cfg := config.Get()
747+ agentCfg := cfg.Agents["coder"]
748+ model := config.Get().GetModelByType(agentCfg.Model)
749+ t := styles.CurrentTheme()
750+ modelIcon := t.S().Base.Foreground(t.FgSubtle).Render(styles.ModelIcon)
751+ modelName := t.S().Text.Render(model.Name)
752+ modelInfo := fmt.Sprintf("%s %s", modelIcon, modelName)
753+ parts := []string{
754+ modelInfo,
755+ }
756+
757+ return lipgloss.JoinVertical(
758+ lipgloss.Left,
759+ parts...,
760+ )
761+}
762+
743func (s *splashCmp) IsShowingAPIKey() bool {
763func (s *splashCmp) IsShowingAPIKey() bool {
744 return s.needsAPIKey
764 return s.needsAPIKey
745}
765}
internal/tui/components/dialogs/commands/commands.go+10
@@ -59,6 +59,7 @@ type commandDialogCmp struct {
59
59
60type (
60type (
61 SwitchSessionsMsg struct{}
61 SwitchSessionsMsg struct{}
62+ NewSessionsMsg struct{}
62 SwitchModelMsg struct{}
63 SwitchModelMsg struct{}
63 QuitMsg struct{}
64 QuitMsg struct{}
64 OpenFilePickerMsg struct{}
65 OpenFilePickerMsg struct{}
@@ -250,6 +251,15 @@ func (c *commandDialogCmp) Position() (int, int) {
250
251
251func (c *commandDialogCmp) defaultCommands() []Command {
252func (c *commandDialogCmp) defaultCommands() []Command {
252 commands := []Command{
253 commands := []Command{
254+ {
255+ ID: "new_session",
256+ Title: "New Session",
257+ Description: "start a new session",
258+ Shortcut: "ctrl+n",
259+ Handler: func(cmd Command) tea.Cmd {
260+ return util.CmdHandler(NewSessionsMsg{})
261+ },
262+ },
253 {
263 {
254 ID: "switch_session",
264 ID: "switch_session",
255 Title: "Switch Session",
265 Title: "Switch Session",
internal/tui/page/chat/chat.go+5
@@ -287,6 +287,11 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
287 p.isProjectInit = false
287 p.isProjectInit = false
288 p.focusedPane = PanelTypeEditor
288 p.focusedPane = PanelTypeEditor
289 return p, p.SetSize(p.width, p.height)
289 return p, p.SetSize(p.width, p.height)
290+ case commands.NewSessionsMsg:
291+ if p.app.CoderAgent.IsBusy() {
292+ return p, util.ReportWarn("Agent is busy, please wait before starting a new session...")
293+ }
294+ return p, p.newSession()
290 case tea.KeyPressMsg:
295 case tea.KeyPressMsg:
291 switch {
296 switch {
292 case key.Matches(msg, p.keyMap.NewSession):
297 case key.Matches(msg, p.keyMap.NewSession):