refactor(handler): implement defensive token update strategy and extract cache creation token utility

- Add extract_cache_creation_tokens utility to handle new/old cache creation token formats
- Implement defensive update strategy in StreamContext to prevent zero values overwriting valid data
- Simplify cache creation token parsing in Claude handler using new utility
- Add comprehensive test suite for cache creation token extraction
- Improve type hints in handler classes
This commit is contained in:
fawney19
2025-12-16 00:02:49 +08:00
parent adcdb73d29
commit f3a69a6160
8 changed files with 186 additions and 34 deletions

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
"""测试模块"""