fix(channels): satisfy tool feedback throttle lint
This commit is contained in:
parent
af04f0f88b
commit
c8611f0734
3 changed files with 8 additions and 3 deletions
|
|
@ -144,7 +144,7 @@ type toolFeedbackMessageContentPreparer interface {
|
|||
}
|
||||
|
||||
type toolFeedbackAnimatorConfigurer interface {
|
||||
ConfigureToolFeedbackAnimator(ToolFeedbackAnimatorConfig)
|
||||
ConfigureToolFeedbackAnimator(cfg ToolFeedbackAnimatorConfig)
|
||||
}
|
||||
|
||||
type asyncTask struct {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ const defaultToolFeedbackAnimationInterval = 3 * time.Second
|
|||
const initialToolFeedbackAnimationFrame = ""
|
||||
|
||||
var toolFeedbackAnimationFrames = []string{"..", "."}
|
||||
|
||||
var retryAfterPattern = regexp.MustCompile(`retry after:? (\d+)`)
|
||||
|
||||
// MaxToolFeedbackAnimationFrameLength returns the largest frame suffix length
|
||||
|
|
@ -304,7 +305,9 @@ func (a *ToolFeedbackAnimator) retryAfterDelay(err error) (time.Duration, bool)
|
|||
return 0, false
|
||||
}
|
||||
errText := strings.ToLower(err.Error())
|
||||
if !errors.Is(err, ErrRateLimit) && !strings.Contains(errText, "too many requests") && !strings.Contains(errText, "429") {
|
||||
if !errors.Is(err, ErrRateLimit) &&
|
||||
!strings.Contains(errText, "too many requests") &&
|
||||
!strings.Contains(errText, "429") {
|
||||
return 0, false
|
||||
}
|
||||
match := retryAfterPattern.FindStringSubmatch(errText)
|
||||
|
|
|
|||
|
|
@ -833,7 +833,9 @@ func TestLoadConfig_ToolFeedbackThrottleIntervals(t *testing.T) {
|
|||
configPath := filepath.Join(dir, "config.json")
|
||||
if err := os.WriteFile(
|
||||
configPath,
|
||||
[]byte(`{"version":1,"agents":{"defaults":{"tool_feedback":{"enabled":true,"animation_interval_secs":5,"edit_min_interval_seconds":10}}}}`),
|
||||
[]byte(
|
||||
`{"version":1,"agents":{"defaults":{"tool_feedback":{"enabled":true,"animation_interval_secs":5,"edit_min_interval_seconds":10}}}}`,
|
||||
),
|
||||
0o600,
|
||||
); err != nil {
|
||||
t.Fatalf("WriteFile() error: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue