refactor: Simplify handling of base model path mappings and download path templates by removing unnecessary JSON.stringify calls

This commit is contained in:
Will Miao
2025-08-19 20:20:30 +08:00
parent 6500936aad
commit ee84571bdb
2 changed files with 4 additions and 19 deletions

View File

@@ -1,4 +1,3 @@
import json
import logging
import os
import sys
@@ -183,16 +182,6 @@ class MiscRoutes:
if old_path != value:
logger.info(f"Example images path changed to {value} - server restart required")
# Special handling for base_model_path_mappings - parse JSON string
if (key == 'base_model_path_mappings' or key == 'download_path_templates') and value:
try:
value = json.loads(value)
except json.JSONDecodeError:
return web.json_response({
'success': False,
'error': f"Invalid JSON format for base_model_path_mappings: {value}"
})
# Save to settings
settings.set(key, value)