mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-18 02:43:00 +08:00
Fix JSON serialization error in bulk import fail info API (#2119)
* fix: import failed info bulk api bug fix * fix: Remove unused ImportFailInfoBulkResponse import
This commit is contained in:
parent
d970fe68ea
commit
e13bf68775
@ -62,7 +62,6 @@ from ..data_models import (
|
|||||||
BatchExecutionRecord,
|
BatchExecutionRecord,
|
||||||
ComfyUISystemState,
|
ComfyUISystemState,
|
||||||
ImportFailInfoBulkRequest,
|
ImportFailInfoBulkRequest,
|
||||||
ImportFailInfoBulkResponse,
|
|
||||||
BatchOperation,
|
BatchOperation,
|
||||||
InstalledNodeInfo,
|
InstalledNodeInfo,
|
||||||
ComfyUIVersionInfo,
|
ComfyUIVersionInfo,
|
||||||
@ -1683,7 +1682,11 @@ async def import_fail_info_bulk(request):
|
|||||||
if module_name is not None:
|
if module_name is not None:
|
||||||
info = cm_global.error_dict.get(module_name)
|
info = cm_global.error_dict.get(module_name)
|
||||||
if info is not None:
|
if info is not None:
|
||||||
results[cnr_id] = info
|
# Convert error_dict format to API spec format
|
||||||
|
results[cnr_id] = {
|
||||||
|
'error': info.get('msg', ''),
|
||||||
|
'traceback': info.get('traceback', '')
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
results[cnr_id] = None
|
results[cnr_id] = None
|
||||||
else:
|
else:
|
||||||
@ -1695,15 +1698,18 @@ async def import_fail_info_bulk(request):
|
|||||||
if module_name is not None:
|
if module_name is not None:
|
||||||
info = cm_global.error_dict.get(module_name)
|
info = cm_global.error_dict.get(module_name)
|
||||||
if info is not None:
|
if info is not None:
|
||||||
results[url] = info
|
# Convert error_dict format to API spec format
|
||||||
|
results[url] = {
|
||||||
|
'error': info.get('msg', ''),
|
||||||
|
'traceback': info.get('traceback', '')
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
results[url] = None
|
results[url] = None
|
||||||
else:
|
else:
|
||||||
results[url] = None
|
results[url] = None
|
||||||
|
|
||||||
# Create response using Pydantic model
|
# Return results directly as JSON
|
||||||
response_data = ImportFailInfoBulkResponse(root=results)
|
return web.json_response(results, content_type="application/json")
|
||||||
return web.json_response(response_data.root)
|
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
logging.error(f"[ComfyUI-Manager] Invalid request data: {e}")
|
logging.error(f"[ComfyUI-Manager] Invalid request data: {e}")
|
||||||
return web.Response(status=400, text=f"Invalid request data: {e}")
|
return web.Response(status=400, text=f"Invalid request data: {e}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user