mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-14 16:26:57 +08:00
Improve active skill schema handling
This commit is contained in:
@@ -29,3 +29,26 @@ func TestAIServiceFailureHighlightsHTMLGatewayResponse(t *testing.T) {
|
||||
t.Fatalf("html parse error should not use the generic balance/timeout-only guidance: %s", msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAIServiceFailureHighlightsUpstreamEmptyOutputRateLimit(t *testing.T) {
|
||||
a := New(nil, nil, DefaultConfig(), slog.Default())
|
||||
|
||||
msg, err := a.aiServiceFailure("zh", errors.New(`API returned error (status 429): {"error":{"code":"upstream_empty_output","message":"Upstream model returned empty output.","param":null,"type":"rate_limit_error"}}`))
|
||||
if err != nil {
|
||||
t.Fatalf("aiServiceFailure returned error: %v", err)
|
||||
}
|
||||
|
||||
for _, want := range []string{
|
||||
"当前 AI 服务调用失败",
|
||||
"上游模型没有返回有效内容",
|
||||
"不应优先归因成“余额不足”",
|
||||
"切换到另一个可用模型",
|
||||
} {
|
||||
if !strings.Contains(msg, want) {
|
||||
t.Fatalf("expected message to contain %q, got: %s", want, msg)
|
||||
}
|
||||
}
|
||||
if strings.Contains(msg, "更可能是模型服务余额不足、接口报错、鉴权失败或超时") {
|
||||
t.Fatalf("upstream empty output should not use the generic balance/auth/timeout guidance: %s", msg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user