removed default scanning of "input" and "output" folders; added separate endpoint for test suite.

This commit is contained in:
bigcat88 2025-09-16 11:28:29 +03:00
parent 0be513b213
commit 24a95f5ca4
No known key found for this signature in database
GPG Key ID: 1F0BF0EC3CF22721
4 changed files with 23 additions and 3 deletions

View File

@ -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:

View File

@ -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):

View File

@ -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:

View File

@ -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