MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _apply_image_config

Function _apply_image_config

src/core/model_resolver.py:517–536  ·  view source on GitHub ↗
(image_config: Any, aspect_ratio: Optional[str], image_size: Optional[str])

Source from the content-addressed store, hash-verified

515 return None
516
517 def _apply_image_config(image_config: Any, aspect_ratio: Optional[str], image_size: Optional[str]) -> Tuple[Optional[str], Optional[str]]:
518 # 显式 aspectRatio/imageSize
519 if not aspect_ratio:
520 aspect_ratio = _normalize_aspect_ratio(
521 _read_value(image_config, "aspectRatio", "aspect_ratio", "aspect")
522 )
523 if not image_size:
524 image_size = _normalize_image_size(
525 _read_value(image_config, "imageSize", "image_size", "resolution")
526 )
527
528 # OpenAI size/quality
529 if not aspect_ratio:
530 aspect_ratio = _aspect_from_openai_size(_read_value(image_config, "size"))
531 if not image_size:
532 image_size = _image_size_from_openai_quality(
533 _read_value(image_config, "quality", "imageQuality", "image_quality")
534 )
535
536 return aspect_ratio, image_size
537
538 aspect_ratio: Optional[str] = None
539 image_size: Optional[str] = None

Callers 1

Calls 5

_normalize_aspect_ratioFunction · 0.85
_read_valueFunction · 0.85
_normalize_image_sizeFunction · 0.85
_aspect_from_openai_sizeFunction · 0.85

Tested by

no test coverage detected