mirror of
https://github.com/sst/opencode.git
synced 2025-08-03 21:28:14 +00:00
Fix: failed to open session (#999)
This commit is contained in:
parent
95e0957d64
commit
636fe0fb64
2 changed files with 8 additions and 2 deletions
|
@ -50,6 +50,9 @@ type App struct {
|
|||
IsLeaderSequence bool
|
||||
}
|
||||
|
||||
type SessionCreatedMsg = struct {
|
||||
Session *opencode.Session
|
||||
}
|
||||
type SessionSelectedMsg = *opencode.Session
|
||||
type SessionLoadedMsg struct{}
|
||||
type ModelSelectedMsg struct {
|
||||
|
@ -380,7 +383,7 @@ func (a *App) InitializeProject(ctx context.Context) tea.Cmd {
|
|||
}
|
||||
|
||||
a.Session = session
|
||||
cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
|
||||
cmds = append(cmds, util.CmdHandler(SessionCreatedMsg{Session: session}))
|
||||
|
||||
go func() {
|
||||
_, err := a.Client.Session.Init(ctx, a.Session.ID, opencode.SessionInitParams{
|
||||
|
@ -456,7 +459,7 @@ func (a *App) SendChatMessage(
|
|||
return a, toast.NewErrorToast(err.Error())
|
||||
}
|
||||
a.Session = session
|
||||
cmds = append(cmds, util.CmdHandler(SessionSelectedMsg(session)))
|
||||
cmds = append(cmds, util.CmdHandler(SessionCreatedMsg{Session: session}))
|
||||
}
|
||||
|
||||
message := opencode.UserMessage{
|
||||
|
|
|
@ -498,6 +498,9 @@ func (a appModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
a.app.Session = msg
|
||||
a.app.Messages = messages
|
||||
return a, util.CmdHandler(app.SessionLoadedMsg{})
|
||||
case app.SessionCreatedMsg:
|
||||
a.app.Session = msg.Session
|
||||
return a, util.CmdHandler(app.SessionLoadedMsg{})
|
||||
case app.ModelSelectedMsg:
|
||||
a.app.Provider = &msg.Provider
|
||||
a.app.Model = &msg.Model
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue