feat: consolidate checkpoint metadata handling

- Extract checkpoint entry from multiple metadata locations using helper method
- Sanitize checkpoint metadata by removing transient/local-only fields
- Remove checkpoint duplication from generation parameters to store only at top level
- Update frontend to properly populate checkpoint metadata during import
- Add tests for new checkpoint handling functionality

This ensures consistent checkpoint metadata structure and prevents data duplication across different storage locations.
This commit is contained in:
Will Miao
2025-11-21 14:55:45 +08:00
parent 36f28b3c65
commit 4eb46a8d3e
3 changed files with 149 additions and 6 deletions

View File

@@ -56,6 +56,15 @@ export class DownloadManager {
gen_params: this.importManager.recipeData.gen_params || {},
raw_metadata: this.importManager.recipeData.raw_metadata || {}
};
const checkpointMetadata =
this.importManager.recipeData.checkpoint ||
this.importManager.recipeData.model ||
(this.importManager.recipeData.gen_params || {}).checkpoint;
if (checkpointMetadata && typeof checkpointMetadata === 'object') {
completeMetadata.checkpoint = checkpointMetadata;
}
// Add source_path to metadata to track where the recipe was imported from
if (this.importManager.importMode === 'url') {