MCPcopy Create free account
hub / github.com/HisMax/RedInk / __init__

Method __init__

backend/generators/image_api.py:16–31  ·  view source on GitHub ↗
(self, config: Dict[str, Any])

Source from the content-addressed store, hash-verified

14 """Image API 生成器"""
15
16 def __init__(self, config: Dict[str, Any]):
17 super().__init__(config)
18 logger.debug("初始化 ImageApiGenerator...")
19 self.policy = ImageProviderPolicy.from_config(
20 config,
21 default_model='default-model',
22 default_endpoint='/v1/images/generations',
23 )
24 self.client = ImageApiClient(self.policy)
25 self.base_url = self.policy.base_url
26 self.model = self.policy.model
27 self.default_aspect_ratio = config.get('default_aspect_ratio', '3:4')
28 self.image_size = config.get('image_size', '4K')
29 self.endpoint_type = self.policy.endpoint_type
30
31 logger.info(f"ImageApiGenerator 初始化完成: base_url={self.base_url}, model={self.model}, endpoint={self.endpoint_type}")
32
33 def validate_config(self) -> bool:
34 """验证配置是否有效"""

Callers

nothing calls this directly

Calls 3

ImageApiClientClass · 0.85
from_configMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected