tzt
|
e5470a3715
|
feat(proxy): T-X10 采纳 cortiq 语义缓存路由签名分桶——不同路由意图不互串答案
- normalizer.canonical_hash 增加可选 route_sig 段:键 = bucket|doc_version|sig|sha256
(旧三段格式向后兼容,旧条目随 TTL 自然淘汰)
- ProxyConfig 新增 semcache.route_sig_scope:capabilities(默认,vision/tools 需求
签名)/ model(按模型隔离)/ none(旧行为);非法值回落 capabilities
- semcache:签名升级为条目属性并分区 L2 语义扫描(仅键分桶不够——语义层仍会
跨签名命中);签名从缓存键第四段解析,重启重建零 schema 变更;
晋升别名键携带签名段;route_sig=None 的旧调用零过滤完全兼容
- routes:lookup/put 共用同一 norm_hash(消除 put 侧重复哈希),签名贯穿两层
- 新增 tests/test_route_sig.py 6 项(键格式/键空间分割/scope 三态/两层隔离/
重建存活/旧调用兼容)
|
2026-09-19 09:59:15 +08:00 |
|
tzt
|
3250e4e099
|
feat(proxy): T-P5 规范化+桶(canonical_hash 五规则/整形顺序/doc_version 失效)
- normalizer.py:resolve_bucket(X-Campus-Bucket 头 > 映射 > default,D-P2);
normalize_messages(role\u0001content\u0002 串接,剔易变字段与时间戳行,
多模态 content 取 text);is_cacheable(system 外 >1 条 = 多轮不缓存,D-P5);
canonical_hash(bucket|doc_version|sha256(norm)——模板/资料不参与哈希,
资料更新 = 版本+1 旧键失效);shape([canonical_system(无才注入)] ->
[课程资料前缀(文件读取,不入git)] -> [原 messages],易变顶层字段剔除)
- 测试 +8:同义同哈希/易变剔除/模板不入哈希/doc_version 失效/多轮判定/
整形顺序+资料注入/桶解析回落/序列化形态,全量 370 passed
|
2026-09-05 09:40:05 +08:00 |
|
tzt
|
b109576707
|
feat(proxy): T-P0 代理层骨架(包结构/DDL/门控挂载/单进程校验)
- gateway/proxy/ 十文件:config(ProxyConfig:元->毫元加载期换算 D-P1、差异化售价、
桶/峰谷/限流/semcache 配置)/ errors(8 类 HTTP 语义异常)/ ledger(四表两索引 DDL,
WAL,ReviewQueue 连接纪律)/ auth·pricing·normalizer·semcache·upstream(§6 签名占位)
/ routes(/proxy/v1/models OpenAI 形状)/ __init__(build_proxy_router 组装点)
- settings DEFAULTS 增 proxy 段(enabled 默认 False,D-P7)
- api.py 首次 include_router(enabled 门控 + 装配失败不拖垮主应用)
- serve.py workers>1 拒绝启动(D-P9:WEB_CONCURRENCY/UVICORN_WORKERS 校验)
- 测试 +4(门控 404/DDL 幂等/毫元换算/池模型列表),全量 322 passed
|
2026-09-05 08:35:31 +08:00 |
|