mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-15 23:22:59 +08:00
Add gateway.models_list_read_max_bytes with the existing 8 MiB behavior as its default, and apply it consistently to generic, Codex, and Antigravity model-list reads. Read one sentinel byte for Codex manifests so oversized responses return an explicit bounded upstream error instead of malformed JSON.
11 lines
284 B
Go
11 lines
284 B
Go
package service
|
|
|
|
import "github.com/Wei-Shaw/sub2api/internal/config"
|
|
|
|
func resolveModelsListReadLimit(cfg *config.Config) int64 {
|
|
if cfg != nil && cfg.Gateway.ModelsListReadMaxBytes > 0 {
|
|
return cfg.Gateway.ModelsListReadMaxBytes
|
|
}
|
|
return config.DefaultModelsListReadMaxBytes
|
|
}
|