diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-27 14:07:20 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-27 14:08:09 +0200 |
| commit | b3a8dbd0d97998488838386d4042678cf170a2cb (patch) | |
| tree | fc1ca6b60698b5f47ecc42a948718ad99b621d86 /internal | |
| parent | d93694a97961ba33d952535f71f4afa2ea924bb9 (diff) | |
| download | opencode-b3a8dbd0d97998488838386d4042678cf170a2cb.tar.gz opencode-b3a8dbd0d97998488838386d4042678cf170a2cb.zip | |
fix retry warning
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/llm/provider/gemini.go | 4 | ||||
| -rw-r--r-- | internal/llm/provider/openai.go | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/internal/llm/provider/gemini.go b/internal/llm/provider/gemini.go index a0336f261..c9e9cc093 100644 --- a/internal/llm/provider/gemini.go +++ b/internal/llm/provider/gemini.go @@ -209,7 +209,7 @@ func (g *geminiClient) send(ctx context.Context, messages []message.Message, too return nil, retryErr } if retry { - logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) + logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) select { case <-ctx.Done(): return nil, ctx.Err() @@ -308,7 +308,7 @@ func (g *geminiClient) stream(ctx context.Context, messages []message.Message, t return } if retry { - logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) + logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) select { case <-ctx.Done(): if ctx.Err() != nil { diff --git a/internal/llm/provider/openai.go b/internal/llm/provider/openai.go index 53e403e01..4d45aebfa 100644 --- a/internal/llm/provider/openai.go +++ b/internal/llm/provider/openai.go @@ -8,13 +8,13 @@ import ( "io" "time" + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" + "github.com/openai/openai-go/shared" "github.com/opencode-ai/opencode/internal/config" "github.com/opencode-ai/opencode/internal/llm/tools" "github.com/opencode-ai/opencode/internal/logging" "github.com/opencode-ai/opencode/internal/message" - "github.com/openai/openai-go" - "github.com/openai/openai-go/option" - "github.com/openai/openai-go/shared" ) type openaiOptions struct { @@ -188,7 +188,7 @@ func (o *openaiClient) send(ctx context.Context, messages []message.Message, too return nil, retryErr } if retry { - logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) + logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) select { case <-ctx.Done(): return nil, ctx.Err() @@ -288,7 +288,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t return } if retry { - logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) + logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100)) select { case <-ctx.Done(): // context cancelled |
