feat: update metadata saving to ensure backup creation and support nested civitai structure

This commit is contained in:
Will Miao
2025-06-25 11:50:10 +08:00
parent afc810f21f
commit 2ee057e19b
5 changed files with 18 additions and 11 deletions

View File

@@ -792,9 +792,13 @@ class ApiRoutes:
metadata['modelDescription'] = description
metadata['tags'] = tags
metadata['creator'] = creator
# Ensure the civitai dict exists
if 'civitai' not in metadata:
metadata['civitai'] = {}
# Store creator in the civitai nested structure
metadata['civitai']['creator'] = creator
await MetadataManager.save_metadata(file_path, metadata)
await MetadataManager.save_metadata(file_path, metadata, True)
except Exception as e:
logger.error(f"Error saving model metadata: {e}")