cmd/config: fix cloud model limit lookups in integrations (#14650)

This commit is contained in:
Parth Sareen
2026-03-05 13:57:28 -08:00
committed by GitHub
parent 15732f0ea7
commit 9896e3627f
6 changed files with 79 additions and 9 deletions

View File

@@ -26,17 +26,15 @@ type cloudModelLimit struct {
}
// lookupCloudModelLimit returns the token limits for a cloud model.
// It tries the exact name first, then strips the ":cloud" suffix.
// It normalizes common cloud suffixes before checking the shared limit map.
func lookupCloudModelLimit(name string) (cloudModelLimit, bool) {
// TODO(parthsareen): migrate to using cloud check instead.
for _, suffix := range []string{"-cloud", ":cloud"} {
name = strings.TrimSuffix(name, suffix)
}
if l, ok := cloudModelLimits[name]; ok {
return l, true
}
base := strings.TrimSuffix(name, ":cloud")
if base != name {
if l, ok := cloudModelLimits[base]; ok {
return l, true
}
}
return cloudModelLimit{}, false
}