Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion comfy_api_nodes/apis/recraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,26 @@ class RecraftImageSize(str, Enum):
"1536x2688",
]

RECRAFT_V4_STYLES_MODELS = frozenset(
{
"recraftv4_styles",
"recraftv4_styles_vector",
"recraftv4_styles_pro",
"recraftv4_styles_pro_vector",
}
)

RECRAFT_V4_VECTOR_MODEL_FOR_STYLE = {
"recraftv4": "recraftv4_vector",
"recraftv4_pro": "recraftv4_pro_vector",
}

RECRAFT_STYLE_MATCH_OPTIONS = ["precise", "flexible"]

RECRAFT_STYLE_REFERENCES_MAX = 10

RECRAFT_STYLE_REFERENCES_MAX_BYTES = 10 * 1024 * 1024


class RecraftColorObject(BaseModel):
rgb: list[int] = Field(..., description='An array of 3 integer values in range of 0...255 defining RGB Color Model')
Expand All @@ -272,6 +292,8 @@ class RecraftImageGenerationRequest(BaseModel):
substyle: str | None = Field(None, description='The substyle to apply to the generated image, depending on the style input')
controls: RecraftControlsObject | None = Field(None, description='A set of custom parameters to tweak generation process')
style_id: str | None = Field(None, description='Use a previously uploaded style as a reference; UUID')
style_match: str | None = Field(None, description='How closely to follow the referenced style: "precise" or "flexible" for V4 models')
style_reference_urls: list[str] | None = Field(None, description='URLs or data URLs of style reference images; a private style is created from them and returned as style_id')
strength: float | None = Field(None, description='Defines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarity')
random_seed: int | None = Field(None, description="Seed for video generation")

Expand All @@ -286,10 +308,12 @@ class RecraftImageGenerationResponse(BaseModel):
credits: int = Field(..., description='Number of credits used for the generation')
data: list[RecraftReturnedObject] | None = Field(None, description='Array of generated image information')
image: RecraftReturnedObject | None = Field(None, description='Single generated image')
style_id: str | None = Field(None, description='The style applied to the generation, including one auto-created from style references')


class RecraftCreateStyleRequest(BaseModel):
style: str = Field(..., description="realistic_image, digital_illustration, vector_illustration, or icon")
style: str = Field(..., description="any, realistic_image, digital_illustration, vector_illustration, or icon")
model: str | None = Field(None, description="The model family the style is created for, e.g. recraftv4_styles")


class RecraftCreateStyleResponse(BaseModel):
Expand Down
Loading
Loading