diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-08 20:32:57 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-08 20:32:57 +0200 |
| commit | fde04bbf85ea641a33a282b354d63f227f9945fb (patch) | |
| tree | 8b71df5743546e937f5c89977f0f8e0a1814bf56 /internal/llm/agent | |
| parent | 124bd57c507fdcbb56ab27137cbe892f12e1b48f (diff) | |
| parent | 4385fb321903f335097119349aa1ebf9edb3f71a (diff) | |
| download | opencode-fde04bbf85ea641a33a282b354d63f227f9945fb.tar.gz opencode-fde04bbf85ea641a33a282b354d63f227f9945fb.zip | |
Merge pull request #22 from adamdottv/adam/retries
fix(anthropic): better 429/529 handling
Diffstat (limited to 'internal/llm/agent')
| -rw-r--r-- | internal/llm/agent/agent.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/internal/llm/agent/agent.go b/internal/llm/agent/agent.go index cb123e78c..baf78be65 100644 --- a/internal/llm/agent/agent.go +++ b/internal/llm/agent/agent.go @@ -15,6 +15,8 @@ import ( "github.com/kujtimiihoxha/termai/internal/llm/provider" "github.com/kujtimiihoxha/termai/internal/llm/tools" "github.com/kujtimiihoxha/termai/internal/message" + "github.com/kujtimiihoxha/termai/internal/pubsub" + "github.com/kujtimiihoxha/termai/internal/tui/util" ) type Agent interface { @@ -92,9 +94,24 @@ func (c *agent) processEvent( assistantMsg.AppendContent(event.Content) return c.Messages.Update(*assistantMsg) case provider.EventError: + // TODO: remove when realease log.Println("error", event.Error) + c.App.Status.Publish(pubsub.UpdatedEvent, util.InfoMsg{ + Type: util.InfoTypeError, + Msg: event.Error.Error(), + }) return event.Error - + case provider.EventWarning: + c.App.Status.Publish(pubsub.UpdatedEvent, util.InfoMsg{ + Type: util.InfoTypeWarn, + Msg: event.Info, + }) + return nil + case provider.EventInfo: + c.App.Status.Publish(pubsub.UpdatedEvent, util.InfoMsg{ + Type: util.InfoTypeInfo, + Msg: event.Info, + }) case provider.EventComplete: assistantMsg.SetToolCalls(event.Response.ToolCalls) assistantMsg.AddFinish(event.Response.FinishReason) |
