(image_config: Any, aspect_ratio: Optional[str], image_size: Optional[str])
| 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 |
no test coverage detected