mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-04 22:07:11 +08:00
Add API_NODE and common error for missing auth token (#5)
This commit is contained in:
parent
7290683905
commit
e7dad1d7db
@ -4,6 +4,12 @@ API_BASE = "https://stagingapi.comfy.org"
|
||||
from inspect import cleandoc
|
||||
from comfy.comfy_types.node_typing import ComfyNodeABC, InputTypeDict, IO
|
||||
|
||||
def check_auth_token(auth_token):
|
||||
"""Verify that an auth token is present."""
|
||||
if auth_token is None:
|
||||
raise Exception("Please login first to use this node.")
|
||||
return auth_token
|
||||
|
||||
class IdeogramTextToImage(ComfyNodeABC):
|
||||
"""
|
||||
Generates images synchronously based on a given prompt and optional parameters.
|
||||
@ -84,13 +90,9 @@ class IdeogramTextToImage(ComfyNodeABC):
|
||||
}
|
||||
|
||||
RETURN_TYPES = (IO.IMAGE,)
|
||||
#RETURN_NAMES = ("image_output_name",)
|
||||
DESCRIPTION = cleandoc(__doc__ or "") # Handle potential None value
|
||||
FUNCTION = "api_call"
|
||||
|
||||
#OUTPUT_NODE = False
|
||||
#OUTPUT_TOOLTIPS = ("",) # Tooltips for the output node
|
||||
|
||||
API_NODE = True
|
||||
CATEGORY = "Example"
|
||||
|
||||
def api_call(self, prompt, model, aspect_ratio=None, resolution=None,
|
||||
@ -102,6 +104,8 @@ class IdeogramTextToImage(ComfyNodeABC):
|
||||
import io
|
||||
import numpy as np
|
||||
|
||||
check_auth_token(auth_token)
|
||||
|
||||
# Build payload with all available parameters
|
||||
payload = {
|
||||
"image_request": {
|
||||
@ -217,11 +221,12 @@ class RunwayVideoNode:
|
||||
DESCRIPTION = "Generates videos from images using Runway's API"
|
||||
FUNCTION = "generate_video"
|
||||
CATEGORY = "video"
|
||||
API_NODE = True
|
||||
|
||||
def generate_video(self, prompt_image, prompt_text, seed=0, model="gen3a_turbo",
|
||||
duration=5.0, ratio="1280:768", watermark=False, auth_token=None):
|
||||
import requests
|
||||
|
||||
check_auth_token(auth_token)
|
||||
# Convert torch tensor image to URL (you'll need to implement this part)
|
||||
# This is a placeholder - you'll need to either save the image temporarily
|
||||
# or upload it to a service that can host it
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user