summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/app
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-06-17 07:09:04 -0500
committeradamdottv <[email protected]>2025-06-17 07:09:04 -0500
commita5da5127faffacd7703fc0dde061ef1f490d3dce (patch)
treeab9c65d0eb45ab9fdc326187ca5881dc9b10936e /packages/tui/internal/app
parentb5a4439704c70a17d661f1984bb030d5325d141a (diff)
downloadopencode-a5da5127faffacd7703fc0dde061ef1f490d3dce.tar.gz
opencode-a5da5127faffacd7703fc0dde061ef1f490d3dce.zip
chore: consolidate chat page into tui.go
Diffstat (limited to 'packages/tui/internal/app')
-rw-r--r--packages/tui/internal/app/app.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go
index f7481f9f4..8db93381a 100644
--- a/packages/tui/internal/app/app.go
+++ b/packages/tui/internal/app/app.go
@@ -11,7 +11,6 @@ import (
tea "github.com/charmbracelet/bubbletea/v2"
"github.com/sst/opencode/internal/commands"
"github.com/sst/opencode/internal/config"
- "github.com/sst/opencode/internal/state"
"github.com/sst/opencode/internal/theme"
"github.com/sst/opencode/internal/util"
"github.com/sst/opencode/pkg/client"
@@ -32,6 +31,14 @@ type App struct {
Commands commands.Registry
}
+type SessionSelectedMsg = *client.SessionInfo
+type ModelSelectedMsg struct {
+ Provider client.ProviderInfo
+ Model client.ModelInfo
+}
+type SessionClearedMsg struct{}
+type CompactSessionMsg struct{}
+
func New(
ctx context.Context,
version string,
@@ -118,7 +125,7 @@ func (a *App) InitializeProvider() tea.Cmd {
}
// TODO: handle no provider or model setup, yet
- return state.ModelSelectedMsg{
+ return ModelSelectedMsg{
Provider: *currentProvider,
Model: *currentModel,
}
@@ -167,7 +174,7 @@ func (a *App) InitializeProject(ctx context.Context) tea.Cmd {
}
a.Session = session
- cmds = append(cmds, util.CmdHandler(state.SessionSelectedMsg(session)))
+ cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
go func() {
response, err := a.Client.PostSessionInitialize(ctx, client.PostSessionInitializeJSONRequestBody{
@@ -236,7 +243,7 @@ func (a *App) SendChatMessage(ctx context.Context, text string, attachments []At
return nil
}
a.Session = session
- cmds = append(cmds, util.CmdHandler(state.SessionSelectedMsg(session)))
+ cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
}
// TODO: Handle attachments when API supports them