mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-06-06 11:32:09 +08:00

* Add Ideogram generate node. * Add staging api. * Add API_NODE and common error for missing auth token (#5) * Add Minimax Video Generation + Async Task queue polling example (#6) * [Minimax] Show video preview and embed workflow in ouput (#7) * Remove uv.lock * Remove polling operations. * Revert "Remove polling operations." This reverts commit 8415404ce8fbc0262b7de54fc700c5c8854a34fc. * Update stubs. * Added Ideogram and Minimax back in. * Added initial BFL Flux 1.1 [pro] Ultra node (#11) * Manually add BFL polling status response schema (#15) * Add function for uploading files. (#18) * Add Luma nodes (#16) Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * Refactor util functions (#20) * Add rest of Luma node functionality (#19) Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * Fix image_luma_ref not working (#28) Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * [Bug] Remove duplicated option T2V-01 in MinimaxTextToVideoNode (#31) * add veo2, bump av req (#32) * Add Recraft nodes (#29) * Add Kling Nodes (#12) * Add Camera Concepts (luma_concepts) to Luma Video nodes (#33) Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * Add Runway nodes (#17) * Convert Minimax node to use VIDEO output type (#34) * Standard `CATEGORY` system for api nodes (#35) * Set `Content-Type` header when uploading files (#36) * add better error propagation to veo2 (#37) * Add Realistic Image and Logo Raster styles for Recraft v3 (#38) * Fix runway image upload and progress polling (#39) * Fix image upload for Luma: only include `Content-Type` header field if it's set explicitly (#40) * Moved Luma nodes to nodes_luma.py (#47) * Moved Recraft nodes to nodes_recraft.py (#48) * Move and fix BFL nodes to node_bfl.py (#49) * Move and edit Minimax node to nodes_minimax.py (#50) * Add Recraft Text to Vector node, add Save SVG node to handle its output (#53) * Added pixverse_template support to Pixverse Text to Video node (#54) * Added Recraft Controls + Recraft Color RGB nodes (#57) * split remaining nodes out of nodes_api, make utility lib, refactor ideogram (#61) * Set request type explicitly (#66) * Add `control_after_generate` to all seed inputs (#69) * Fix bug: deleting `Content-Type` when property does not exist (#73) * Add Pixverse and updated Kling types (#75) * Added Recraft Style - Infinite Style Library node (#82) * add ideogram v3 (#83) * [Kling] Split Camera Control config to its own node (#81) * Add Pika i2v and t2v nodes (#52) * Remove Runway nodes (#88) * Fix: Prompt text can't be validated in Kling nodes when using primitive nodes (#90) * Update Pika Duration and Resolution options (#94) * Removed Infinite Style Library until later (#99) * fix multi image return (#101) close #96 * Serve SVG files directly (#107) * Add a bunch of nodes, 3 ready to use, the rest waiting for endpoint support (#108) * Revert "Serve SVG files directly" (#111) * Expose 4 remaining Recraft nodes (#112) * [Kling] Add `Duration` and `Video ID` outputs (#105) * Add Kling nodes: camera control, start-end frame, lip-sync, video extend (#115) * Fix error for Recraft ImageToImage error for nonexistent random_seed param (#118) * Add remaining Pika nodes (#119) * Make controls input work for Recraft Image to Image node (#120) * Fix: Nested `AnyUrl` in request model cannot be serialized (Kling, Runway) (#129) * Show errors and API output URLs to the user (change log levels) (#131) * Apply small fixes and most prompt validation (if needed to avoid API error) (#135) * Node name/category modifications (#140) * Add back Recraft Style - Infinite Style Library node (#141) * [Kling] Fix: Correct/verify supported subset of input combos in Kling nodes (#149) * Remove pixverse_template from PixVerse Transition Video node (#155) * Use 3.9 compat syntax (#164) * Handle Comfy API key based authorizaton (#167) Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com> * [BFL] Print download URL of successful task result directly on nodes (#175) * Show output URL and progress text on Pika nodes (#168) * [Ideogram] Print download URL of successful task result directly on nodes (#176) * [Kling] Print download URL of successful task result directly on nodes (#181) * Merge upstream may 14 25 (#186) Co-authored-by: comfyanonymous <comfyanonymous@protonmail.com> Co-authored-by: AustinMroz <austinmroz@utexas.edu> Co-authored-by: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Co-authored-by: Benjamin Lu <benceruleanlu@proton.me> Co-authored-by: Andrew Kvochko <kvochko@users.noreply.github.com> Co-authored-by: Pam <42671363+pamparamm@users.noreply.github.com> Co-authored-by: chaObserv <154517000+chaObserv@users.noreply.github.com> Co-authored-by: Yoland Yan <4950057+yoland68@users.noreply.github.com> Co-authored-by: guill <guill@users.noreply.github.com> Co-authored-by: Chenlei Hu <hcl@comfy.org> Co-authored-by: Terry Jia <terryjia88@gmail.com> Co-authored-by: Silver <65376327+silveroxides@users.noreply.github.com> Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com> Co-authored-by: liesen <liesen.dev@gmail.com> Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com> Co-authored-by: Robin Huang <robin.j.huang@gmail.com> Co-authored-by: thot experiment <94414189+thot-experiment@users.noreply.github.com> Co-authored-by: blepping <157360029+blepping@users.noreply.github.com> * Update instructions on how to develop API Nodes. (#171) * Add Runway FLF and I2V nodes (#187) * Add OpenAI chat node (#188) * Update README. * Add Google Gemini API node (#191) * Add Runway Gen 4 Text to Image Node (#193) * [Runway, Gemini] Update node display names and attributes (#194) * Update path from "image-to-video" to "image_to_video" (#197) * [Runway] Split I2V nodes into separate gen3 and gen4 nodes (#198) * Update runway i2v ratio enum (#201) * Rodin3D: implement Rodin3D API Nodes (#190) Co-authored-by: WhiteGiven <c15838568211@163.com> Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * Add Tripo Nodes. (#189) Co-authored-by: Robin Huang <robin.j.huang@gmail.com> * Change casing of categories "3D" => "3d" (#208) * [tripo] fix negtive_prompt and mv2model (#212) * [tripo] set default param to None (#215) * Add description and tooltip to Tripo Refine model. (#218) * Update. * Fix rebase errors. * Fix rebase errors. * Update templates. * Bump frontend. * Add file type info for file inputs. --------- Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com> Co-authored-by: Chenlei Hu <hcl@comfy.org> Co-authored-by: thot experiment <94414189+thot-experiment@users.noreply.github.com> Co-authored-by: comfyanonymous <comfyanonymous@protonmail.com> Co-authored-by: AustinMroz <austinmroz@utexas.edu> Co-authored-by: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Co-authored-by: Benjamin Lu <benceruleanlu@proton.me> Co-authored-by: Andrew Kvochko <kvochko@users.noreply.github.com> Co-authored-by: Pam <42671363+pamparamm@users.noreply.github.com> Co-authored-by: chaObserv <154517000+chaObserv@users.noreply.github.com> Co-authored-by: Yoland Yan <4950057+yoland68@users.noreply.github.com> Co-authored-by: guill <guill@users.noreply.github.com> Co-authored-by: Terry Jia <terryjia88@gmail.com> Co-authored-by: Silver <65376327+silveroxides@users.noreply.github.com> Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com> Co-authored-by: liesen <liesen.dev@gmail.com> Co-authored-by: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Co-authored-by: blepping <157360029+blepping@users.noreply.github.com> Co-authored-by: Changrz <51637999+WhiteGiven@users.noreply.github.com> Co-authored-by: WhiteGiven <c15838568211@163.com> Co-authored-by: seed93 <liangding1990@163.com>
276 lines
13 KiB
Python
276 lines
13 KiB
Python
from __future__ import annotations
|
|
from comfy_api_nodes.apis import (
|
|
TripoModelVersion,
|
|
TripoTextureQuality,
|
|
)
|
|
from enum import Enum
|
|
from typing import Optional, List, Dict, Any, Union
|
|
|
|
from pydantic import BaseModel, Field, RootModel
|
|
|
|
class TripoStyle(str, Enum):
|
|
PERSON_TO_CARTOON = "person:person2cartoon"
|
|
ANIMAL_VENOM = "animal:venom"
|
|
OBJECT_CLAY = "object:clay"
|
|
OBJECT_STEAMPUNK = "object:steampunk"
|
|
OBJECT_CHRISTMAS = "object:christmas"
|
|
OBJECT_BARBIE = "object:barbie"
|
|
GOLD = "gold"
|
|
ANCIENT_BRONZE = "ancient_bronze"
|
|
NONE = "None"
|
|
|
|
class TripoTaskType(str, Enum):
|
|
TEXT_TO_MODEL = "text_to_model"
|
|
IMAGE_TO_MODEL = "image_to_model"
|
|
MULTIVIEW_TO_MODEL = "multiview_to_model"
|
|
TEXTURE_MODEL = "texture_model"
|
|
REFINE_MODEL = "refine_model"
|
|
ANIMATE_PRERIGCHECK = "animate_prerigcheck"
|
|
ANIMATE_RIG = "animate_rig"
|
|
ANIMATE_RETARGET = "animate_retarget"
|
|
STYLIZE_MODEL = "stylize_model"
|
|
CONVERT_MODEL = "convert_model"
|
|
|
|
class TripoTextureAlignment(str, Enum):
|
|
ORIGINAL_IMAGE = "original_image"
|
|
GEOMETRY = "geometry"
|
|
|
|
class TripoOrientation(str, Enum):
|
|
ALIGN_IMAGE = "align_image"
|
|
DEFAULT = "default"
|
|
|
|
class TripoOutFormat(str, Enum):
|
|
GLB = "glb"
|
|
FBX = "fbx"
|
|
|
|
class TripoTopology(str, Enum):
|
|
BIP = "bip"
|
|
QUAD = "quad"
|
|
|
|
class TripoSpec(str, Enum):
|
|
MIXAMO = "mixamo"
|
|
TRIPO = "tripo"
|
|
|
|
class TripoAnimation(str, Enum):
|
|
IDLE = "preset:idle"
|
|
WALK = "preset:walk"
|
|
CLIMB = "preset:climb"
|
|
JUMP = "preset:jump"
|
|
RUN = "preset:run"
|
|
SLASH = "preset:slash"
|
|
SHOOT = "preset:shoot"
|
|
HURT = "preset:hurt"
|
|
FALL = "preset:fall"
|
|
TURN = "preset:turn"
|
|
|
|
class TripoStylizeStyle(str, Enum):
|
|
LEGO = "lego"
|
|
VOXEL = "voxel"
|
|
VORONOI = "voronoi"
|
|
MINECRAFT = "minecraft"
|
|
|
|
class TripoConvertFormat(str, Enum):
|
|
GLTF = "GLTF"
|
|
USDZ = "USDZ"
|
|
FBX = "FBX"
|
|
OBJ = "OBJ"
|
|
STL = "STL"
|
|
_3MF = "3MF"
|
|
|
|
class TripoTextureFormat(str, Enum):
|
|
BMP = "BMP"
|
|
DPX = "DPX"
|
|
HDR = "HDR"
|
|
JPEG = "JPEG"
|
|
OPEN_EXR = "OPEN_EXR"
|
|
PNG = "PNG"
|
|
TARGA = "TARGA"
|
|
TIFF = "TIFF"
|
|
WEBP = "WEBP"
|
|
|
|
class TripoTaskStatus(str, Enum):
|
|
QUEUED = "queued"
|
|
RUNNING = "running"
|
|
SUCCESS = "success"
|
|
FAILED = "failed"
|
|
CANCELLED = "cancelled"
|
|
UNKNOWN = "unknown"
|
|
BANNED = "banned"
|
|
EXPIRED = "expired"
|
|
|
|
class TripoFileTokenReference(BaseModel):
|
|
type: Optional[str] = Field(None, description='The type of the reference')
|
|
file_token: str
|
|
|
|
class TripoUrlReference(BaseModel):
|
|
type: Optional[str] = Field(None, description='The type of the reference')
|
|
url: str
|
|
|
|
class TripoObjectStorage(BaseModel):
|
|
bucket: str
|
|
key: str
|
|
|
|
class TripoObjectReference(BaseModel):
|
|
type: str
|
|
object: TripoObjectStorage
|
|
|
|
class TripoFileEmptyReference(BaseModel):
|
|
pass
|
|
|
|
class TripoFileReference(RootModel):
|
|
root: Union[TripoFileTokenReference, TripoUrlReference, TripoObjectReference, TripoFileEmptyReference]
|
|
|
|
class TripoGetStsTokenRequest(BaseModel):
|
|
format: str = Field(..., description='The format of the image')
|
|
|
|
class TripoTextToModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.TEXT_TO_MODEL, description='Type of task')
|
|
prompt: str = Field(..., description='The text prompt describing the model to generate', max_length=1024)
|
|
negative_prompt: Optional[str] = Field(None, description='The negative text prompt', max_length=1024)
|
|
model_version: Optional[TripoModelVersion] = TripoModelVersion.V2_5
|
|
face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to')
|
|
texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model')
|
|
pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model')
|
|
image_seed: Optional[int] = Field(None, description='The seed for the text')
|
|
model_seed: Optional[int] = Field(None, description='The seed for the model')
|
|
texture_seed: Optional[int] = Field(None, description='The seed for the texture')
|
|
texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard
|
|
style: Optional[TripoStyle] = None
|
|
auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model')
|
|
quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model')
|
|
|
|
class TripoImageToModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.IMAGE_TO_MODEL, description='Type of task')
|
|
file: TripoFileReference = Field(..., description='The file reference to convert to a model')
|
|
model_version: Optional[TripoModelVersion] = Field(None, description='The model version to use for generation')
|
|
face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to')
|
|
texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model')
|
|
pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model')
|
|
model_seed: Optional[int] = Field(None, description='The seed for the model')
|
|
texture_seed: Optional[int] = Field(None, description='The seed for the texture')
|
|
texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard
|
|
texture_alignment: Optional[TripoTextureAlignment] = Field(TripoTextureAlignment.ORIGINAL_IMAGE, description='The texture alignment method')
|
|
style: Optional[TripoStyle] = Field(None, description='The style to apply to the generated model')
|
|
auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model')
|
|
orientation: Optional[TripoOrientation] = TripoOrientation.DEFAULT
|
|
quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model')
|
|
|
|
class TripoMultiviewToModelRequest(BaseModel):
|
|
type: TripoTaskType = TripoTaskType.MULTIVIEW_TO_MODEL
|
|
files: List[TripoFileReference] = Field(..., description='The file references to convert to a model')
|
|
model_version: Optional[TripoModelVersion] = Field(None, description='The model version to use for generation')
|
|
orthographic_projection: Optional[bool] = Field(False, description='Whether to use orthographic projection')
|
|
face_limit: Optional[int] = Field(None, description='The number of faces to limit the generation to')
|
|
texture: Optional[bool] = Field(True, description='Whether to apply texture to the generated model')
|
|
pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the generated model')
|
|
model_seed: Optional[int] = Field(None, description='The seed for the model')
|
|
texture_seed: Optional[int] = Field(None, description='The seed for the texture')
|
|
texture_quality: Optional[TripoTextureQuality] = TripoTextureQuality.standard
|
|
texture_alignment: Optional[TripoTextureAlignment] = TripoTextureAlignment.ORIGINAL_IMAGE
|
|
auto_size: Optional[bool] = Field(False, description='Whether to auto-size the model')
|
|
orientation: Optional[TripoOrientation] = Field(TripoOrientation.DEFAULT, description='The orientation for the model')
|
|
quad: Optional[bool] = Field(False, description='Whether to apply quad to the generated model')
|
|
|
|
class TripoTextureModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.TEXTURE_MODEL, description='Type of task')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
texture: Optional[bool] = Field(True, description='Whether to apply texture to the model')
|
|
pbr: Optional[bool] = Field(True, description='Whether to apply PBR to the model')
|
|
model_seed: Optional[int] = Field(None, description='The seed for the model')
|
|
texture_seed: Optional[int] = Field(None, description='The seed for the texture')
|
|
texture_quality: Optional[TripoTextureQuality] = Field(None, description='The quality of the texture')
|
|
texture_alignment: Optional[TripoTextureAlignment] = Field(TripoTextureAlignment.ORIGINAL_IMAGE, description='The texture alignment method')
|
|
|
|
class TripoRefineModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.REFINE_MODEL, description='Type of task')
|
|
draft_model_task_id: str = Field(..., description='The task ID of the draft model')
|
|
|
|
class TripoAnimatePrerigcheckRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.ANIMATE_PRERIGCHECK, description='Type of task')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
|
|
class TripoAnimateRigRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.ANIMATE_RIG, description='Type of task')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
out_format: Optional[TripoOutFormat] = Field(TripoOutFormat.GLB, description='The output format')
|
|
spec: Optional[TripoSpec] = Field(TripoSpec.TRIPO, description='The specification for rigging')
|
|
|
|
class TripoAnimateRetargetRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.ANIMATE_RETARGET, description='Type of task')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
animation: TripoAnimation = Field(..., description='The animation to apply')
|
|
out_format: Optional[TripoOutFormat] = Field(TripoOutFormat.GLB, description='The output format')
|
|
bake_animation: Optional[bool] = Field(True, description='Whether to bake the animation')
|
|
|
|
class TripoStylizeModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.STYLIZE_MODEL, description='Type of task')
|
|
style: TripoStylizeStyle = Field(..., description='The style to apply to the model')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
block_size: Optional[int] = Field(80, description='The block size for stylization')
|
|
|
|
class TripoConvertModelRequest(BaseModel):
|
|
type: TripoTaskType = Field(TripoTaskType.CONVERT_MODEL, description='Type of task')
|
|
format: TripoConvertFormat = Field(..., description='The format to convert to')
|
|
original_model_task_id: str = Field(..., description='The task ID of the original model')
|
|
quad: Optional[bool] = Field(False, description='Whether to apply quad to the model')
|
|
force_symmetry: Optional[bool] = Field(False, description='Whether to force symmetry')
|
|
face_limit: Optional[int] = Field(10000, description='The number of faces to limit the conversion to')
|
|
flatten_bottom: Optional[bool] = Field(False, description='Whether to flatten the bottom of the model')
|
|
flatten_bottom_threshold: Optional[float] = Field(0.01, description='The threshold for flattening the bottom')
|
|
texture_size: Optional[int] = Field(4096, description='The size of the texture')
|
|
texture_format: Optional[TripoTextureFormat] = Field(TripoTextureFormat.JPEG, description='The format of the texture')
|
|
pivot_to_center_bottom: Optional[bool] = Field(False, description='Whether to pivot to the center bottom')
|
|
|
|
class TripoTaskRequest(RootModel):
|
|
root: Union[
|
|
TripoTextToModelRequest,
|
|
TripoImageToModelRequest,
|
|
TripoMultiviewToModelRequest,
|
|
TripoTextureModelRequest,
|
|
TripoRefineModelRequest,
|
|
TripoAnimatePrerigcheckRequest,
|
|
TripoAnimateRigRequest,
|
|
TripoAnimateRetargetRequest,
|
|
TripoStylizeModelRequest,
|
|
TripoConvertModelRequest
|
|
]
|
|
|
|
class TripoTaskOutput(BaseModel):
|
|
model: Optional[str] = Field(None, description='URL to the model')
|
|
base_model: Optional[str] = Field(None, description='URL to the base model')
|
|
pbr_model: Optional[str] = Field(None, description='URL to the PBR model')
|
|
rendered_image: Optional[str] = Field(None, description='URL to the rendered image')
|
|
riggable: Optional[bool] = Field(None, description='Whether the model is riggable')
|
|
|
|
class TripoTask(BaseModel):
|
|
task_id: str = Field(..., description='The task ID')
|
|
type: Optional[str] = Field(None, description='The type of task')
|
|
status: Optional[TripoTaskStatus] = Field(None, description='The status of the task')
|
|
input: Optional[Dict[str, Any]] = Field(None, description='The input parameters for the task')
|
|
output: Optional[TripoTaskOutput] = Field(None, description='The output of the task')
|
|
progress: Optional[int] = Field(None, description='The progress of the task', ge=0, le=100)
|
|
create_time: Optional[int] = Field(None, description='The creation time of the task')
|
|
running_left_time: Optional[int] = Field(None, description='The estimated time left for the task')
|
|
queue_position: Optional[int] = Field(None, description='The position in the queue')
|
|
|
|
class TripoTaskResponse(BaseModel):
|
|
code: int = Field(0, description='The response code')
|
|
data: TripoTask = Field(..., description='The task data')
|
|
|
|
class TripoGeneralResponse(BaseModel):
|
|
code: int = Field(0, description='The response code')
|
|
data: Dict[str, str] = Field(..., description='The task ID data')
|
|
|
|
class TripoBalanceData(BaseModel):
|
|
balance: float = Field(..., description='The account balance')
|
|
frozen: float = Field(..., description='The frozen balance')
|
|
|
|
class TripoBalanceResponse(BaseModel):
|
|
code: int = Field(0, description='The response code')
|
|
data: TripoBalanceData = Field(..., description='The balance data')
|
|
|
|
class TripoErrorResponse(BaseModel):
|
|
code: int = Field(..., description='The error code')
|
|
message: str = Field(..., description='The error message')
|
|
suggestion: str = Field(..., description='The suggestion for fixing the error')
|