Add files via upload

This commit is contained in:
公明
2026-06-02 23:41:49 +08:00
committed by GitHub
parent dcea95968b
commit a5f11cc003
2 changed files with 4 additions and 5 deletions
+1 -5
View File
@@ -3,7 +3,6 @@ package multiagent
import (
"context"
"errors"
"io"
"strings"
"time"
@@ -24,10 +23,6 @@ func isEinoTransientRunError(err error) bool {
if err == nil {
return false
}
// io.EOF 常见于流式正常收尾,不应触发分段重试。
if errors.Is(err, io.EOF) {
return false
}
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
return false
}
@@ -66,6 +61,7 @@ func isEinoTransientRunError(err error) bool {
"tls handshake timeout",
"stream error",
"unexpected eof",
`": eof`, // net/http: Post "url": EOF (often wraps io.EOF)
"unexpected end of json",
"status code: 406",
"status code: 502",
@@ -3,6 +3,7 @@ package multiagent
import (
"context"
"errors"
"fmt"
"io"
"testing"
"time"
@@ -21,6 +22,8 @@ func TestIsEinoTransientRunError(t *testing.T) {
{"nil", nil, false},
{"io eof", io.EOF, false},
{"plain eof text", errors.New("EOF"), false},
{"post chat completions eof", errors.New(`Post "https://token-plan-cn.xiaomimimo.com/v1/chat/completions": EOF`), true},
{"post eof wraps io.EOF", fmt.Errorf(`Post %q: %w`, "https://token-plan-cn.xiaomimimo.com/v1/chat/completions", io.EOF), true},
{"429", errors.New("HTTP 429 Too Many Requests"), true},
{"rate limit", errors.New(`{"error":"rate limit exceeded"}`), true},
{"connection reset", errors.New("read tcp: connection reset by peer"), true},