Commit Graph
2 Commits
Author SHA1 Message Date
tzt f24f016e95 feat(proxy): T-P2 上游客户端(流式派发/usage 注入过滤/三家归一化/首 token 前 failover)
- upstream.py:httpx.AsyncClient 模块级单例(keepalive,limits=100,
  超时 connect10/read120/write10/pool30);stream() 始终注入
  stream_options.include_usage(计量不依赖客户端)+ filter_usage_chunk
  (客户端未要求 usage 时剥除该 chunk);D-P4 首 token 前 failover 链、
  流中失败抛 UpstreamAborted(不可切换);ttfb_ms 记录
- normalize_usage 三家归一:deepseek prompt_cache_hit_tokens /
  openai prompt_tokens_details.cached_tokens / anthropic cache_read_input_tokens
  (命中数>总数时钳制)
- model_pool:+provider(枚举校验 deepseek/openai/anthropic)+in_hit_price
  (缺省 = price_in×1/30,D-P3)
- 测试 +6:透传+sink/failover/流中 aborted/全挂 502/三家归一/过滤,全量 345 passed
2026-09-05 09:14:31 +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