perf: 降低 lru_cache 上限并限制流式响应块内存占用

- 缩减 model_permissions / tiktoken / formula_engine 的 lru_cache maxsize
- StreamUsageTracker 响应块增加 4MB 大小限制,超限后只计数不存储
- raw_chunks 改用 deque(maxlen=50) 避免无限增长
- HardwareTooltip 导入路径修正、tooltip 延迟归零、文案中文化
This commit is contained in:
fawney19
2026-02-12 11:41:42 +08:00
parent 483d536e2c
commit be430ebdde
5 changed files with 41 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ except ImportError: # pragma: no cover
tiktoken = None
@lru_cache(maxsize=256)
@lru_cache(maxsize=32)
def _get_encoder_cached(model: str) -> Any:
"""全局编码器缓存。