fix(stats): load embeddings from saved stats on startup

_load_stats() was missing the embeddings section, so on every restart
the embeddings usage tracking hash would start from an empty dict.
This caused all previously saved embedding usage data to appear reset.

Added the missing load path for the 'embeddings' key, parallel to the
existing checkpoints and loras loading logic.
This commit is contained in:
Will Miao
2026-06-12 08:57:25 +08:00
parent d6669f1d04
commit 3e961a9860

View File

@@ -221,6 +221,9 @@ class UsageStats:
if "loras" in loaded_stats and isinstance(loaded_stats["loras"], dict): if "loras" in loaded_stats and isinstance(loaded_stats["loras"], dict):
self.stats["loras"] = loaded_stats["loras"] self.stats["loras"] = loaded_stats["loras"]
if "embeddings" in loaded_stats and isinstance(loaded_stats["embeddings"], dict):
self.stats["embeddings"] = loaded_stats["embeddings"]
if "total_executions" in loaded_stats: if "total_executions" in loaded_stats:
self.stats["total_executions"] = loaded_stats["total_executions"] self.stats["total_executions"] = loaded_stats["total_executions"]