feat(cache): add cache health monitoring and validation system, see #730

- Add cache entry validator service for data integrity checks
- Add cache health monitor service for periodic health checks
- Enhance model cache and scanner with validation support
- Update websocket manager for health status broadcasting
- Add initialization banner service for cache health alerts
- Add comprehensive test coverage for new services
- Update translations across all locales
- Refactor sync translation keys script
This commit is contained in:
Will Miao
2026-02-02 08:26:38 +08:00
parent 68cf381b50
commit 778ad8abd2
21 changed files with 1719 additions and 10 deletions

View File

@@ -5,7 +5,6 @@ import logging
logger = logging.getLogger(__name__)
from typing import Any, Dict, List, Optional, Tuple
from dataclasses import dataclass, field
from operator import itemgetter
from natsort import natsorted
# Supported sort modes: (sort_key, order)
@@ -229,17 +228,17 @@ class ModelCache:
reverse=reverse
)
elif sort_key == 'date':
# Sort by modified timestamp
# Sort by modified timestamp (use .get() with default to handle missing fields)
result = sorted(
data,
key=itemgetter('modified'),
key=lambda x: x.get('modified', 0.0),
reverse=reverse
)
elif sort_key == 'size':
# Sort by file size
# Sort by file size (use .get() with default to handle missing fields)
result = sorted(
data,
key=itemgetter('size'),
key=lambda x: x.get('size', 0),
reverse=reverse
)
elif sort_key == 'usage':