- 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
20 lines
736 B
Python
20 lines
736 B
Python
"""请求规范化与桶解析(T-P5 落地;本文件先立签名)。"""
|
||
from __future__ import annotations
|
||
|
||
from typing import Any, Dict
|
||
|
||
|
||
def resolve_bucket(body: dict, headers: dict, cfg) -> Any:
|
||
"""解析课程桶:X-Campus-Bucket 头 > model->bucket 映射 > default(T-P5 实现)。"""
|
||
raise NotImplementedError("T-P5")
|
||
|
||
|
||
def canonical_hash(bucket: str, doc_version: int, body: dict) -> str:
|
||
"""规范化哈希:稳定序列化 -> sha256(五规则见 §6;T-P5 实现)。"""
|
||
raise NotImplementedError("T-P5")
|
||
|
||
|
||
def shape(body: dict, bucket_cfg) -> dict:
|
||
"""整形上游请求体:[canonical_system] -> [doc_prefix] -> [原 messages](T-P5 实现)。"""
|
||
raise NotImplementedError("T-P5")
|