1
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""应用级类型契约。"""
|
||||
@@ -0,0 +1 @@
|
||||
"""生成领域类型契约。"""
|
||||
@@ -0,0 +1,67 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Protocol, TypedDict
|
||||
|
||||
|
||||
class ProviderGenerationRecordLike(Protocol):
|
||||
"""图片/视频供应商提交接口需要的任务字段协议。"""
|
||||
|
||||
id: str
|
||||
original_prompt: str
|
||||
optimized_prompt: str | None
|
||||
media_references: str | None
|
||||
gen_type: str
|
||||
duration: int | None
|
||||
aspect_ratio: str | None
|
||||
resolution: str | None
|
||||
image_size: str | None
|
||||
image_proportion: str | None
|
||||
image_px: str | None
|
||||
generation_count: int
|
||||
engine_id: str | None
|
||||
|
||||
|
||||
class ProviderImageEngineLike(Protocol):
|
||||
"""图片生成提交接口需要的引擎字段协议。"""
|
||||
|
||||
id: str
|
||||
name: str
|
||||
provider: str
|
||||
api_base: str
|
||||
api_key: str
|
||||
model_name: str
|
||||
default_size: str | None
|
||||
multi_generation_enabled: bool
|
||||
max_generation_count: int
|
||||
multi_image_max_images: int
|
||||
max_reference_image_count: int
|
||||
output_format: str
|
||||
|
||||
|
||||
class ProviderVideoEngineLike(Protocol):
|
||||
"""视频生成提交接口需要的引擎字段协议。"""
|
||||
|
||||
name: str
|
||||
api_base: str
|
||||
api_key: str
|
||||
model_name: str
|
||||
|
||||
|
||||
class ImageProviderItem(TypedDict, total=False):
|
||||
generation_index: int
|
||||
remote_result_url: str
|
||||
b64_json: str
|
||||
size: str
|
||||
output_format: str
|
||||
response_data: dict[str, Any]
|
||||
error_code: str
|
||||
error_message: str
|
||||
|
||||
|
||||
class ImageProviderBatchResult(TypedDict, total=False):
|
||||
items: list[ImageProviderItem]
|
||||
model: str
|
||||
created: int
|
||||
generated_images: int
|
||||
image_tokens: int
|
||||
response_data: dict[str, Any]
|
||||
Reference in New Issue
Block a user