fix: align cmhub image timeout display

This commit is contained in:
chengma
2026-07-07 19:13:00 +08:00
parent 95b180e9cf
commit 2928624019
13 changed files with 67 additions and 29 deletions
+2 -9
View File
@@ -38,6 +38,7 @@ class CMHubError(AIError):
CMHUB_IMAGE_MAX_BYTES = 20 * 1024 * 1024
CMHUB_TITLE_READ_TIMEOUT_SECONDS = 600
CMHUB_IMAGE_READ_TIMEOUT_SECONDS = 650
_RESOLUTION_SIZES = {
"512": (512, 512),
@@ -766,15 +767,7 @@ def _normalize_cmhub_resolution(resolution):
def _cmhub_read_timeout(config, resolution):
try:
timeout = int(appconfig.response_timeout(config))
except Exception:
timeout = 600
resolution_key = str(resolution or "").strip().lower()
timeouts = appconfig.ai_config(config).get("resolution_timeouts", {})
if resolution_key in timeouts:
timeout = int(timeouts[resolution_key])
return min(600, max(1, timeout))
return CMHUB_IMAGE_READ_TIMEOUT_SECONDS
def _cmhub_call_with_retry(