Skip to content

Commit 468a99d

Browse files
authored
Merge branch 'comfyanonymous:master' into master
2 parents a0160c9 + 7390ff3 commit 468a99d

96 files changed

Lines changed: 112882 additions & 89839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pullrequest-ci-run.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runner_label: [self-hosted, Linux]
2424
flags: ""
2525
- os: windows
26-
runner_label: [self-hosted, win]
26+
runner_label: [self-hosted, Windows]
2727
flags: ""
2828
runs-on: ${{ matrix.runner_label }}
2929
steps:

.github/workflows/stable-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ on:
1717
description: 'Python minor version'
1818
required: true
1919
type: string
20-
default: "11"
20+
default: "12"
2121
python_patch:
2222
description: 'Python patch version'
2323
required: true
2424
type: string
25-
default: "9"
25+
default: "7"
2626

2727

2828
jobs:

.github/workflows/test-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
runner_label: [self-hosted, Linux]
3333
flags: ""
3434
- os: windows
35-
runner_label: [self-hosted, win]
35+
runner_label: [self-hosted, Windows]
3636
flags: ""
3737
runs-on: ${{ matrix.runner_label }}
3838
steps:
@@ -55,7 +55,7 @@ jobs:
5555
torch_version: ["nightly"]
5656
include:
5757
- os: windows
58-
runner_label: [self-hosted, win]
58+
runner_label: [self-hosted, Windows]
5959
flags: ""
6060
runs-on: ${{ matrix.runner_label }}
6161
steps:

.github/workflows/test-unit.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ on:
88

99
jobs:
1010
test:
11-
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
runs-on: ${{ matrix.os }}
15+
continue-on-error: true
1216
steps:
1317
- uses: actions/checkout@v4
14-
- uses: actions/setup-python@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
1520
with:
1621
python-version: '3.10'
1722
- name: Install requirements

.github/workflows/windows_release_dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ on:
2323
description: 'python minor version'
2424
required: true
2525
type: string
26-
default: "11"
26+
default: "12"
2727

2828
python_patch:
2929
description: 'python patch version'
3030
required: true
3131
type: string
32-
default: "9"
32+
default: "7"
3333
# push:
3434
# branches:
3535
# - master

.github/workflows/windows_release_package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ on:
1313
description: 'python minor version'
1414
required: true
1515
type: string
16-
default: "11"
16+
default: "12"
1717

1818
python_patch:
1919
description: 'python patch version'
2020
required: true
2121
type: string
22-
default: "9"
22+
default: "7"
2323
# push:
2424
# branches:
2525
# - master

api_server/routes/internal/internal_routes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from aiohttp import web
22
from typing import Optional
3-
from folder_paths import models_dir, user_directory, output_directory
3+
from folder_paths import models_dir, user_directory, output_directory, folder_names_and_paths
44
from api_server.services.file_service import FileService
55
import app.logger
66

@@ -36,6 +36,13 @@ async def list_files(request):
3636
async def get_logs(request):
3737
return web.json_response(app.logger.get_logs())
3838

39+
@self.routes.get('/folder_paths')
40+
async def get_folder_paths(request):
41+
response = {}
42+
for key in folder_names_and_paths:
43+
response[key] = folder_names_and_paths[key][0]
44+
return web.json_response(response)
45+
3946
def get_app(self):
4047
if self._app is None:
4148
self._app = web.Application()

app/frontend_management.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ def init_frontend_unsafe(cls, version_string: str, provider: Optional[FrontEndPr
151151
return cls.DEFAULT_FRONTEND_PATH
152152

153153
repo_owner, repo_name, version = cls.parse_version_string(version_string)
154+
155+
if version.startswith("v"):
156+
expected_path = str(Path(cls.CUSTOM_FRONTENDS_ROOT) / f"{repo_owner}_{repo_name}" / version.lstrip("v"))
157+
if os.path.exists(expected_path):
158+
logging.info(f"Using existing copy of specific frontend version tag: {repo_owner}/{repo_name}@{version}")
159+
return expected_path
160+
161+
logging.info(f"Initializing frontend: {repo_owner}/{repo_name}@{version}, requesting version details from GitHub...")
162+
154163
provider = provider or FrontEndProvider(repo_owner, repo_name)
155164
release = provider.get_release(version)
156165

@@ -159,16 +168,20 @@ def init_frontend_unsafe(cls, version_string: str, provider: Optional[FrontEndPr
159168
Path(cls.CUSTOM_FRONTENDS_ROOT) / provider.folder_name / semantic_version
160169
)
161170
if not os.path.exists(web_root):
171+
# Use tmp path until complete to avoid path exists check passing from interrupted downloads
172+
tmp_path = web_root + ".tmp"
162173
try:
163-
os.makedirs(web_root, exist_ok=True)
174+
os.makedirs(tmp_path, exist_ok=True)
164175
logging.info(
165176
"Downloading frontend(%s) version(%s) to (%s)",
166177
provider.folder_name,
167178
semantic_version,
168-
web_root,
179+
tmp_path,
169180
)
170181
logging.debug(release)
171-
download_release_asset_zip(release, destination_path=web_root)
182+
download_release_asset_zip(release, destination_path=tmp_path)
183+
if os.listdir(tmp_path):
184+
os.rename(tmp_path, web_root)
172185
finally:
173186
# Clean up the directory if it is empty, i.e. the download failed
174187
if not os.listdir(web_root):

app/logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ def get_logs():
1010
return "\n".join([formatter.format(x) for x in logs])
1111

1212

13-
def setup_logger(verbose: bool = False, capacity: int = 300):
13+
def setup_logger(log_level: str = 'INFO', capacity: int = 300):
1414
global logs
1515
if logs:
1616
return
1717

1818
# Setup default global logger
1919
logger = logging.getLogger()
20-
logger.setLevel(logging.DEBUG if verbose else logging.INFO)
20+
logger.setLevel(log_level)
2121

2222
stream_handler = logging.StreamHandler()
2323
stream_handler.setFormatter(logging.Formatter("%(message)s"))

app/user_manager.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,29 @@ async def post_users(request):
118118

119119
@routes.get("/userdata")
120120
async def listuserdata(request):
121+
"""
122+
List user data files in a specified directory.
123+
124+
This endpoint allows listing files in a user's data directory, with options for recursion,
125+
full file information, and path splitting.
126+
127+
Query Parameters:
128+
- dir (required): The directory to list files from.
129+
- recurse (optional): If "true", recursively list files in subdirectories.
130+
- full_info (optional): If "true", return detailed file information (path, size, modified time).
131+
- split (optional): If "true", split file paths into components (only applies when full_info is false).
132+
133+
Returns:
134+
- 400: If 'dir' parameter is missing.
135+
- 403: If the requested path is not allowed.
136+
- 404: If the requested directory does not exist.
137+
- 200: JSON response with the list of files or file information.
138+
139+
The response format depends on the query parameters:
140+
- Default: List of relative file paths.
141+
- full_info=true: List of dictionaries with file details.
142+
- split=true (and full_info=false): List of lists, each containing path components.
143+
"""
121144
directory = request.rel_url.query.get('dir', '')
122145
if not directory:
123146
return web.Response(status=400, text="Directory not provided")

0 commit comments

Comments
 (0)