From a5da5127faffacd7703fc0dde061ef1f490d3dce Mon Sep 17 00:00:00 2001 From: adamdottv <2363879+adamdottv@users.noreply.github.com> Date: Tue, 17 Jun 2025 07:09:04 -0500 Subject: chore: consolidate chat page into tui.go --- packages/tui/internal/app/app.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'packages/tui/internal/app') 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 -- cgit v1.2.3