diff options
| author | adamdottv <[email protected]> | 2025-06-16 15:58:46 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-06-16 15:58:52 -0500 |
| commit | d6d45bdc6388dcc7e5e5248c6b4645d90159bb18 (patch) | |
| tree | 011b8409874bcda6d39ae10cfb3bdd2c0bbc956c /packages/tui/internal/app | |
| parent | 13a83721b076a1201a049ca1e4cebae8896da55b (diff) | |
| download | opencode-d6d45bdc6388dcc7e5e5248c6b4645d90159bb18.tar.gz opencode-d6d45bdc6388dcc7e5e5248c6b4645d90159bb18.zip | |
feat: share and init commands
Diffstat (limited to 'packages/tui/internal/app')
| -rw-r--r-- | packages/tui/internal/app/app.go | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/packages/tui/internal/app/app.go b/packages/tui/internal/app/app.go index 658dbcbdf..f7481f9f4 100644 --- a/packages/tui/internal/app/app.go +++ b/packages/tui/internal/app/app.go @@ -170,16 +170,17 @@ func (a *App) InitializeProject(ctx context.Context) tea.Cmd { cmds = append(cmds, util.CmdHandler(state.SessionSelectedMsg(session))) go func() { - // TODO: Handle no provider or model setup, yet response, err := a.Client.PostSessionInitialize(ctx, client.PostSessionInitializeJSONRequestBody{ SessionID: a.Session.Id, ProviderID: a.Provider.Id, ModelID: a.Model.Id, }) if err != nil { + slog.Error("Failed to initialize project", "error", err) // status.Error(err.Error()) } if response != nil && response.StatusCode != 200 { + slog.Error("Failed to initialize project", "error", response.StatusCode) // status.Error(fmt.Sprintf("failed to initialize project: %d", response.StatusCode)) } }() @@ -187,6 +188,21 @@ func (a *App) InitializeProject(ctx context.Context) tea.Cmd { return tea.Batch(cmds...) } +func (a *App) CompactSession(ctx context.Context) tea.Cmd { + response, err := a.Client.PostSessionSummarizeWithResponse(ctx, client.PostSessionSummarizeJSONRequestBody{ + SessionID: a.Session.Id, + ProviderID: a.Provider.Id, + ModelID: a.Model.Id, + }) + if err != nil { + slog.Error("Failed to compact session", "error", err) + } + if response != nil && response.StatusCode() != 200 { + slog.Error("Failed to compact session", "error", response.StatusCode) + } + return nil +} + func (a *App) MarkProjectInitialized(ctx context.Context) error { response, err := a.Client.PostAppInitialize(ctx) if err != nil { |
