videogen/apps/api/engine/utils/workflow_util.py
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

68 lines
2.1 KiB
Python

# Copyright (C) 2025 AIDC-AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Workflow Path Resolver
Standardized workflow path resolution for all ComfyUI services.
Convention: {source}/{service}.json
Examples:
- Image analysis: selfhost/analyse_image.json, runninghub/analyse_image.json
- Image generation: selfhost/image.json, runninghub/image.json
- Video generation: selfhost/video.json, runninghub/video.json
- TTS: selfhost/tts.json, runninghub/tts.json
"""
from typing import Literal
WorkflowSource = Literal['runninghub', 'selfhost']
def resolve_workflow_path(
service_name: str,
source: WorkflowSource = 'runninghub'
) -> str:
"""
Resolve workflow path using standardized naming convention
Convention: workflows/{source}/{service_name}.json
Args:
service_name: Service identifier (e.g., "analyse_image", "image", "video", "tts")
source: Workflow source - 'runninghub' (default) or 'selfhost'
Returns:
Workflow path in format: "{source}/{service_name}.json"
Examples:
>>> resolve_workflow_path("analyse_image", "runninghub")
'runninghub/analyse_image.json'
>>> resolve_workflow_path("analyse_image", "selfhost")
'selfhost/analyse_image.json'
>>> resolve_workflow_path("image") # defaults to runninghub
'runninghub/image.json'
"""
return f"{source}/{service_name}.json"
def get_default_source() -> WorkflowSource:
"""
Get default workflow source
Returns:
'runninghub' - Cloud-first approach, better for beginners
"""
return 'runninghub'