@@ -104,17 +104,24 @@ func (c *compactDialogCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
106 case agent.AgentEvent:
106 case agent.AgentEvent:
107− if msg.Type == agent.AgentEventTypeSummarize {
108+ case agent.AgentEventTypeSummarize:
108 if msg.Error != nil {
109 if msg.Error != nil {
109 c.state = stateError
110 c.state = stateError
110 c.progress = "Error: " + msg.Error.Error()
111 c.progress = "Error: " + msg.Error.Error()
111 } else if msg.Done {
112 } else if msg.Done {
112− return c, util.CmdHandler(
113+ return c, util.CmdHandler(dialogs.CloseDialogMsg{})
113− dialogs.CloseDialogMsg{},
116 c.progress = msg.Progress
115 c.progress = msg.Progress
117+ case agent.AgentEventTypeError:
118+ // Handle errors that occur during summarization but are sent as separate error events.
119+ c.state = stateError
120+ if msg.Error != nil {
121+ c.progress = "Error: " + msg.Error.Error()
123+ c.progress = "An unknown error occurred"
119 return c, nil
126 return c, nil