Add trigger words editting

This commit is contained in:
Will Miao
2025-03-10 17:10:58 +08:00
parent 72a82707ea
commit 2bdecf571b
4 changed files with 483 additions and 24 deletions

View File

@@ -121,6 +121,15 @@ async def load_metadata(file_path: str) -> Optional[LoraMetadata]:
elif preview_url != normalize_path(preview_url):
data['preview_url'] = normalize_path(preview_url)
needs_update = True
# Ensure all fields are present, due to updates adding new fields
if 'tags' not in data:
data['tags'] = []
needs_update = True
if 'modelDescription' not in data:
data['modelDescription'] = ""
needs_update = True
if needs_update:
with open(metadata_path, 'w', encoding='utf-8') as f: