Skip to content

Commit b3a8dbd

Browse files
committed
fix retry warning
1 parent d93694a commit b3a8dbd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/llm/provider/gemini.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (g *geminiClient) send(ctx context.Context, messages []message.Message, too
209209
return nil, retryErr
210210
}
211211
if retry {
212-
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
212+
logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
213213
select {
214214
case <-ctx.Done():
215215
return nil, ctx.Err()
@@ -308,7 +308,7 @@ func (g *geminiClient) stream(ctx context.Context, messages []message.Message, t
308308
return
309309
}
310310
if retry {
311-
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
311+
logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
312312
select {
313313
case <-ctx.Done():
314314
if ctx.Err() != nil {

internal/llm/provider/openai.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import (
88
"io"
99
"time"
1010

11+
"github.com/openai/openai-go"
12+
"github.com/openai/openai-go/option"
13+
"github.com/openai/openai-go/shared"
1114
"github.com/opencode-ai/opencode/internal/config"
1215
"github.com/opencode-ai/opencode/internal/llm/tools"
1316
"github.com/opencode-ai/opencode/internal/logging"
1417
"github.com/opencode-ai/opencode/internal/message"
15-
"github.com/openai/openai-go"
16-
"github.com/openai/openai-go/option"
17-
"github.com/openai/openai-go/shared"
1818
)
1919

2020
type openaiOptions struct {
@@ -188,7 +188,7 @@ func (o *openaiClient) send(ctx context.Context, messages []message.Message, too
188188
return nil, retryErr
189189
}
190190
if retry {
191-
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
191+
logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
192192
select {
193193
case <-ctx.Done():
194194
return nil, ctx.Err()
@@ -288,7 +288,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
288288
return
289289
}
290290
if retry {
291-
logging.WarnPersist("Retrying due to rate limit... attempt %d of %d", logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
291+
logging.WarnPersist(fmt.Sprintf("Retrying due to rate limit... attempt %d of %d", attempts, maxRetries), logging.PersistTimeArg, time.Millisecond*time.Duration(after+100))
292292
select {
293293
case <-ctx.Done():
294294
// context cancelled

0 commit comments

Comments
 (0)