on main help sign in
chore: add new session
commitbcd944c2cd082d5cfae1064a7d0c3895fe25be71 authorKujtim Hoxha <kujtimii.h@gmail.com> dateTue 29 Jul 2025, 12:34 (1 year ago) parent5ad49fb
4 files changed+36−1
internal/llm/prompt/coder.md+1−1 internal/tui/components/chat/splash/splash.go+20 internal/tui/components/dialogs/commands/commands.go+10 internal/tui/page/chat/chat.go+5
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
228228
229229**When to verify with `pwd`:**
230230
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
232232- When resuming work or continuing from a previous step if uncertain
233233- When you realize you may have lost track of your current location
234234
internal/tui/components/chat/splash/splash.go+20
@@ -562,6 +562,8 @@ func (s *splashCmp) infoSection() string {
562562 lipgloss.Left,
563563 s.cwd(),
564564 "",
565+ s.currentModelBlock(),
566+ "",
565567 lipgloss.JoinHorizontal(lipgloss.Left, s.lspBlock(), s.mcpBlock()),
566568 "",
567569 ),
@@ -740,6 +742,24 @@ func (s *splashCmp) mcpBlock() string {
740742 )
741743}
742744
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+
743763func (s *splashCmp) IsShowingAPIKey() bool {
744764 return s.needsAPIKey
745765}
internal/tui/components/dialogs/commands/commands.go+10
@@ -59,6 +59,7 @@ type commandDialogCmp struct {
5959
6060type (
6161 SwitchSessionsMsg struct{}
62+ NewSessionsMsg struct{}
6263 SwitchModelMsg struct{}
6364 QuitMsg struct{}
6465 OpenFilePickerMsg struct{}
@@ -250,6 +251,15 @@ func (c *commandDialogCmp) Position() (int, int) {
250251
251252func (c *commandDialogCmp) defaultCommands() []Command {
252253 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+ },
253263 {
254264 ID: "switch_session",
255265 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) {
287287 p.isProjectInit = false
288288 p.focusedPane = PanelTypeEditor
289289 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()
290295 case tea.KeyPressMsg:
291296 switch {
292297 case key.Matches(msg, p.keyMap.NewSession):