Publish current ComfyUI O1Key code baseline
Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
This commit is contained in:
+13
-14
@@ -15,6 +15,7 @@ import aiohttp
|
||||
from .base_client import BaseAPIClient
|
||||
from ..utils.config import get_api_key_or_raise, get_api_base_url
|
||||
from ..utils.image_utils import encode_image_to_base64
|
||||
from ..utils.video_task import PollDeadline, download_video_to_file
|
||||
|
||||
|
||||
class VeoClient(BaseAPIClient):
|
||||
@@ -206,9 +207,11 @@ class VeoClient(BaseAPIClient):
|
||||
close_session = True
|
||||
|
||||
interval = self.POLL_INITIAL_INTERVAL
|
||||
deadline = PollDeadline(label="Veo 视频")
|
||||
|
||||
try:
|
||||
while True:
|
||||
deadline.check()
|
||||
async with session.get(url, headers=headers) as response:
|
||||
if response.status != 200:
|
||||
error_text = await response.text()
|
||||
@@ -276,18 +279,20 @@ class VeoClient(BaseAPIClient):
|
||||
raise RuntimeError(f"视频下载失败: {error_message}")
|
||||
|
||||
content_type = response.headers.get("Content-Type", "")
|
||||
|
||||
download_url = None
|
||||
if "application/json" in content_type:
|
||||
data = await response.json()
|
||||
download_url = data.get("url") or data.get("download_url")
|
||||
if not download_url:
|
||||
raise RuntimeError("视频下载失败: 响应中未找到下载链接")
|
||||
await self._download_from_url(download_url, save_path, session)
|
||||
else:
|
||||
os.makedirs(os.path.dirname(save_path), exist_ok=True)
|
||||
with open(save_path, "wb") as f:
|
||||
async for chunk in response.content.iter_chunked(8192):
|
||||
f.write(chunk)
|
||||
|
||||
if download_url:
|
||||
await self._download_from_url(download_url, save_path, session)
|
||||
else:
|
||||
# content 端点直接返回视频流(幂等 GET,可安全重连续传)
|
||||
await download_video_to_file(
|
||||
session, url, save_path, headers=headers, label="VEO 视频",
|
||||
)
|
||||
|
||||
return save_path
|
||||
|
||||
@@ -474,13 +479,7 @@ class VeoClient(BaseAPIClient):
|
||||
session: aiohttp.ClientSession,
|
||||
) -> None:
|
||||
"""从给定 URL 下载文件到本地路径"""
|
||||
os.makedirs(os.path.dirname(save_path), exist_ok=True)
|
||||
async with session.get(url) as response:
|
||||
if response.status != 200:
|
||||
raise RuntimeError(f"从下载链接获取视频失败 (状态码: {response.status})")
|
||||
with open(save_path, "wb") as f:
|
||||
async for chunk in response.content.iter_chunked(8192):
|
||||
f.write(chunk)
|
||||
await download_video_to_file(session, url, save_path, label="VEO 视频")
|
||||
|
||||
@staticmethod
|
||||
def _extract_error_message(error_text: str, status_code: int) -> str:
|
||||
|
||||
Reference in New Issue
Block a user