grok修复

This commit is contained in:
2026-07-03 23:33:04 +08:00
parent c6a8ca440a
commit 34e69adefc
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -140,7 +140,14 @@ func (c *Client) GenerateVideo(ctx context.Context, token, prompt, aspectRatio,
if artifact != "" {
break
}
// No artifact: grok closed the stream early. Retry.
// A fatal stream error means grok definitively rejected this generation
// (content moderation, an unsupported parameter, etc.). Retrying — on this
// or any other account — fails identically and only burns the pool, so fail
// fast with a non-temporary error the pool won't fail over on.
if strings.Contains(body, "STREAM_ERROR_SEVERITY_FATAL") {
return nil, nil, fmt.Errorf("grok: video generation rejected by upstream (fatal stream error): %s", clip([]byte(body), 200))
}
// No artifact and no fatal error: grok closed the stream early. Retry.
lastErr = nil
}
if artifact == "" {