mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 01:37:04 +08:00
removed default scanning of "input" and "output" folders; added separate endpoint for test suite.
This commit is contained in:
parent
0be513b213
commit
24a95f5ca4
@ -483,6 +483,26 @@ async def delete_asset_tags(request: web.Request) -> web.Response:
|
||||
return web.json_response(result.model_dump(mode="json"), status=200)
|
||||
|
||||
|
||||
@ROUTES.post("/api/assets/scan/seed")
|
||||
async def seed_assets(request: web.Request) -> web.Response:
|
||||
try:
|
||||
payload = await request.json()
|
||||
except Exception:
|
||||
payload = {}
|
||||
|
||||
try:
|
||||
body = schemas_in.ScheduleAssetScanBody.model_validate(payload)
|
||||
except ValidationError as ve:
|
||||
return _validation_error_response("INVALID_BODY", ve)
|
||||
|
||||
try:
|
||||
await assets_scanner.sync_seed_assets(body.roots)
|
||||
except Exception:
|
||||
LOGGER.exception("sync_seed_assets failed for roots=%s", body.roots)
|
||||
return _error_response(500, "INTERNAL", "Unexpected server error.")
|
||||
return web.json_response({"synced": True, "roots": body.roots}, status=200)
|
||||
|
||||
|
||||
@ROUTES.post("/api/assets/scan/schedule")
|
||||
async def schedule_asset_scan(request: web.Request) -> web.Response:
|
||||
try:
|
||||
|
||||
2
main.py
2
main.py
@ -283,7 +283,7 @@ async def setup_database():
|
||||
|
||||
await init_db_engine()
|
||||
if not args.disable_assets_autoscan:
|
||||
await sync_seed_assets(["models", "input", "output"])
|
||||
await sync_seed_assets(["models"])
|
||||
|
||||
|
||||
def start_comfyui(asyncio_loop=None):
|
||||
|
||||
@ -629,7 +629,7 @@ class PromptServer():
|
||||
|
||||
@routes.get("/object_info")
|
||||
async def get_object_info(request):
|
||||
await sync_seed_assets(["models", "input", "output"])
|
||||
await sync_seed_assets(["models"])
|
||||
with folder_paths.cache_helper:
|
||||
out = {}
|
||||
for x in nodes.NODE_CLASS_MAPPINGS:
|
||||
|
||||
@ -272,7 +272,7 @@ async def autoclean_unit_test_assets(http: aiohttp.ClientSession, api_base: str)
|
||||
|
||||
async def trigger_sync_seed_assets(session: aiohttp.ClientSession, base_url: str) -> None:
|
||||
"""Force a fast sync/seed pass by calling the ComfyUI '/object_info' endpoint."""
|
||||
async with session.get(base_url + "/object_info") as r:
|
||||
async with session.post(base_url + "/api/assets/scan/seed", json={"roots": ["models", "input", "output"]}) as r:
|
||||
await r.read()
|
||||
await asyncio.sleep(0.1) # tiny yield to the event loop to let any final DB commits flush
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user