feat(14-03): implement SemanticCache for content-based caching

- compute_content_hash(): 计算 SHA256 内容哈希
- SemanticCache.get(): 从缓存读取 SegmentationResult
- SemanticCache.set(): 保存 SegmentationResult 到缓存
- 支持版本控制(CACHE_VERSION = '1.0')
- 缓存存储在 .planning/cache/semantic/ 目录
- 错误容错:缓存失败不影响主流程
- 自动创建缓存目录

遵守用户决策:
- 缓存键: SHA256 内容哈希
- 缓存存储: 本地文件系统
- 缓存 TTL: 永久有效
- 缓存内容: 完整的 SegmentationResult

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 22:35:57 +08:00
parent b6e923c4a4
commit baf7c0f521
2 changed files with 163 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
"""语义分段缓存模块"""
from kb_workflow.srt.cache.semantic_cache import (
SemanticCache,
compute_content_hash
)
__all__ = ['SemanticCache', 'compute_content_hash']