ADD ComfyUI worker适配webhook

This commit is contained in:
kyj@bowong.ai 2025-05-16 18:51:33 +08:00
parent 8f60f205ed
commit bb9ee2cd5d
8 changed files with 22 additions and 22 deletions

View File

@ -8,7 +8,7 @@
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/src" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />

View File

@ -678,7 +678,7 @@ async def comfyui_v1(item: ComfyTaskRequest, headers: Annotated[SentryTransactio
sentry_trace = SentryTransactionInfo(x_trace_id=headers.x_trace_id, x_baggage=headers.x_baggage)
cls = modal.Cls.from_name(config.modal_app_name, "ComfyUI", environment_name=config.modal_environment)
fn_call = cls().api.spawn(item.video_path.path, item.start_time, item.filename_prefix, item.tts_text1,
item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace)
item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace, item.webhook)
return ModalTaskResponse(success=True, taskId=fn_call.object_id)
@ -725,7 +725,7 @@ async def comfyui_v2(item: ComfyTaskRequest, headers: Annotated[SentryTransactio
sentry_trace = SentryTransactionInfo(x_trace_id=headers.x_trace_id, x_baggage=headers.x_baggage)
cls = modal.Cls.from_name(config.modal_app_name, "ComfyUILatentSync15", environment_name=config.modal_environment)
fn_call = cls().api.spawn(item.video_path.path, item.start_time, item.filename_prefix, item.tts_text1,
item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace)
item.tts_text2, item.tts_text3, item.tts_text4, item.anchor_id, item.speed, sentry_trace, item.webhook)
return ModalTaskResponse(success=True, taskId=fn_call.object_id)

View File

@ -316,7 +316,7 @@ class ComfyTaskStatusResponse(BaseModel):
code: Optional[int] = Field(description="任务错误原因代码", default=None)
result: Optional[str] = Field(description="任务运行结果", default=None)
class ComfyTaskRequest(BaseModel):
class ComfyTaskRequest(BaseFFMPEGTaskRequest):
video_path: MediaSource = Field(default=MediaSource.from_str("s3://modal-media-cache/comfyui-input/markers/1016.mp4"), description="视频源")
start_time: str = Field(default="00:00:01.600", description="开始时间")
filename_prefix:str = Field(default=str(uuid.uuid4()), description="生成文件名前缀")

View File

@ -6,15 +6,15 @@ comfyui_image = (
modal.Image.debian_slim(
python_version="3.10"
)
.pip_install_from_pyproject("pyproject_comfyui.toml")
.pip_install_from_pyproject("../pyproject_comfyui.toml")
.apt_install("wget", "software-properties-common")
.run_commands("add-apt-repository -y contrib "
"&& wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb&&dpkg -i cuda-keyring_1.1-1_all.deb")
.apt_install("git", "gcc", "libportaudio2", "cuda-toolkit", "ffmpeg")
.add_local_file("whl/comfy_cli-0.0.0-py3-none-any.whl", "/root/comfy_cli-0.0.0-py3-none-any.whl",copy=True)
.add_local_file("../whl/comfy_cli-0.0.0-py3-none-any.whl", "/root/comfy_cli-0.0.0-py3-none-any.whl",copy=True)
.pip_install("/root/comfy_cli-0.0.0-py3-none-any.whl")
.run_commands("comfy --skip-prompt install --nvidia --version 0.3.10")
.env(dotenv_values(".runtime.env"))
.env(dotenv_values("../.runtime.env"))
.workdir("/root/comfy")
)
@ -50,9 +50,9 @@ comfyui_image = (
).run_commands(
"rm -rf /root/comfy/ComfyUI/models"
)
.add_local_file("config/config.yaml", "/root/comfy/ComfyUI/custom_nodes/ComfyUI-CustomNode/config.yaml",copy=True)
.add_local_file("config/config.py","/root/comfy/ComfyUI/custom_nodes/cosyvoice_comfyui/pretrained_models/tools/config.py",copy=True)
.add_local_file("src/BowongModalFunctions/template/template_v1.json", "/root/src/BowongModalFunctions/template/template_v1.json", copy=True)
.add_local_file("../config/config.yaml", "/root/comfy/ComfyUI/custom_nodes/ComfyUI-CustomNode/config.yaml",copy=True)
.add_local_file("../config/config.py","/root/comfy/ComfyUI/custom_nodes/cosyvoice_comfyui/pretrained_models/tools/config.py",copy=True)
.add_local_file("BowongModalFunctions/template/template_v1.json", "/root/src/BowongModalFunctions/template/template_v1.json", copy=True)
.add_local_python_source('BowongModalFunctions')
.add_local_python_source('cluster')
)

View File

@ -6,15 +6,15 @@ comfyui_latentsync_1_5_image = (
modal.Image.debian_slim(
python_version="3.10"
)
.pip_install_from_pyproject("pyproject_comfyui.toml")
.pip_install_from_pyproject("../pyproject_comfyui.toml")
.apt_install("wget", "software-properties-common")
.run_commands("add-apt-repository -y contrib "
"&& wget https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb&&dpkg -i cuda-keyring_1.1-1_all.deb")
.apt_install("git", "gcc", "libportaudio2", "cuda-toolkit", "ffmpeg")
.add_local_file("whl/comfy_cli-0.0.0-py3-none-any.whl", "/root/comfy_cli-0.0.0-py3-none-any.whl", copy=True)
.add_local_file("../whl/comfy_cli-0.0.0-py3-none-any.whl", "/root/comfy_cli-0.0.0-py3-none-any.whl", copy=True)
.pip_install("/root/comfy_cli-0.0.0-py3-none-any.whl")
.run_commands("comfy --skip-prompt install --nvidia --version 0.3.10")
.env(dotenv_values(".runtime.env"))
.env(dotenv_values("../.runtime.env"))
.workdir("/root/comfy")
)
@ -50,9 +50,9 @@ comfyui_latentsync_1_5_image = (
).run_commands(
"rm -rf /root/comfy/ComfyUI/models"
)
.add_local_file("config/config.yaml", "/root/comfy/ComfyUI/custom_nodes/ComfyUI-CustomNode/config.yaml", copy=True)
.add_local_file("config/config.py", "/root/comfy/ComfyUI/custom_nodes/cosyvoice_comfyui/pretrained_models/tools/config.py", copy=True)
.add_local_file("src/BowongModalFunctions/template/template_v2.json", "/root/src/BowongModalFunctions/template/template_v2.json", copy=True)
.add_local_file("../config/config.yaml", "/root/comfy/ComfyUI/custom_nodes/ComfyUI-CustomNode/config.yaml", copy=True)
.add_local_file("../config/config.py", "/root/comfy/ComfyUI/custom_nodes/cosyvoice_comfyui/pretrained_models/tools/config.py", copy=True)
.add_local_file("BowongModalFunctions/template/template_v2.json", "/root/src/BowongModalFunctions/template/template_v2.json", copy=True)
.add_local_python_source('cluster')
.add_local_python_source('BowongModalFunctions')
)

View File

@ -4,8 +4,8 @@ from dotenv import dotenv_values
ffmpeg_worker_image = (
modal.Image.debian_slim(python_version="3.11")
.apt_install('ffmpeg')
.pip_install_from_pyproject("pyproject.toml")
.env(dotenv_values(".runtime.env"))
.pip_install_from_pyproject("../pyproject.toml")
.env(dotenv_values("../.runtime.env"))
.add_local_python_source('cluster')
.add_local_python_source('BowongModalFunctions')
)

View File

@ -4,8 +4,8 @@ from dotenv import dotenv_values
downloader_image = (
modal.Image
.debian_slim(python_version="3.11")
.pip_install_from_pyproject("pyproject.toml")
.env(dotenv_values(".runtime.env"))
.pip_install_from_pyproject("../pyproject.toml")
.env(dotenv_values("../.runtime.env"))
.add_local_python_source('cluster')
.add_local_python_source('BowongModalFunctions')
)

View File

@ -4,8 +4,8 @@ from dotenv import dotenv_values
fastapi_image = (
modal.Image
.debian_slim(python_version="3.11")
.pip_install_from_pyproject("pyproject.toml")
.env(dotenv_values(".runtime.env"))
.pip_install_from_pyproject("../pyproject.toml")
.env(dotenv_values("../.runtime.env"))
.add_local_python_source('cluster')
.add_local_python_source('BowongModalFunctions')
)