mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
chore(gateway): bump upstream response read limit 64MB -> 128MB
单张 4K PNG base64 最坏情况可达 67MB,image_generation_call 返回多张 候选图时 64MB 仍可能被撑爆。128MB 能覆盖 2-3 张 4K PNG 的常见场景,且相对 请求体上限 256MB 仍有缓冲。
This commit is contained in:
@@ -1407,7 +1407,7 @@ func setDefaults() {
|
||||
viper.SetDefault("gateway.antigravity_fallback_cooldown_minutes", 1)
|
||||
viper.SetDefault("gateway.antigravity_extra_retries", 10)
|
||||
viper.SetDefault("gateway.max_body_size", int64(256*1024*1024))
|
||||
viper.SetDefault("gateway.upstream_response_read_max_bytes", int64(64*1024*1024))
|
||||
viper.SetDefault("gateway.upstream_response_read_max_bytes", int64(128*1024*1024))
|
||||
viper.SetDefault("gateway.proxy_probe_response_read_max_bytes", int64(1024*1024))
|
||||
viper.SetDefault("gateway.gemini_debug_response_headers", false)
|
||||
viper.SetDefault("gateway.connection_pool_isolation", ConnectionPoolIsolationAccountProxy)
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
var ErrUpstreamResponseBodyTooLarge = errors.New("upstream response body too large")
|
||||
|
||||
// defaultUpstreamResponseReadMaxBytes 上游非流式响应体的默认读取上限。
|
||||
// 64 MB 足以容纳多张高清图(base64 膨胀 33%,64MB ≈ 48MB 原始字节)。
|
||||
// 128 MB 可容纳 2-3 张 4K PNG(base64 膨胀 33%,单张 4K PNG 最坏约 67MB base64)。
|
||||
// 可通过 gateway.upstream_response_read_max_bytes 配置项覆盖。
|
||||
const defaultUpstreamResponseReadMaxBytes int64 = 64 * 1024 * 1024
|
||||
const defaultUpstreamResponseReadMaxBytes int64 = 128 * 1024 * 1024
|
||||
|
||||
func resolveUpstreamResponseReadLimit(cfg *config.Config) int64 {
|
||||
if cfg != nil && cfg.Gateway.UpstreamResponseReadMaxBytes > 0 {
|
||||
|
||||
Reference in New Issue
Block a user