forked from boos/BoosAPI
feat: enhance response serialization for compact mode
- Added support for preserving native response.compaction payloads when compact serialization is requested in `serializeResponsesFinalPayload`. - Implemented serialization of compact mode as `response.compaction` instead of an ordinary response object. - Introduced a new type `ResponsesFinalSerializationMode` to manage serialization modes. - Refactored `serializeResponsesFinalPayload` to handle different serialization modes and usage payloads. - Added tests to ensure correct behavior for compact serialization and preservation of upstream payloads. - Updated favicon assets and documentation configuration for VitePress.
This commit is contained in:
+15
-6
@@ -87,12 +87,19 @@ Metapi 的路由引擎按多因子加权选择最优通道。
|
||||
|
||||
### 路由预设建议
|
||||
|
||||
| 场景 | COST_WEIGHT | BALANCE_WEIGHT | USAGE_WEIGHT |
|
||||
|------|:-----------:|:--------------:|:------------:|
|
||||
| **成本优先** | 0.7 | 0.2 | 0.1 |
|
||||
| **均衡(默认)** | 0.4 | 0.3 | 0.3 |
|
||||
| **稳定优先** | 0.2 | 0.5 | 0.3 |
|
||||
| **轮转均匀** | 0.1 | 0.1 | 0.8 |
|
||||
| 场景 | COST_WEIGHT | BALANCE_WEIGHT | USAGE_WEIGHT | 说明 |
|
||||
|------|:-----------:|:--------------:|:------------:|------|
|
||||
| **成本优先** | 0.7 | 0.2 | 0.1 | 适合预算敏感场景,总是选最便宜的通道 |
|
||||
| **均衡(默认)** | 0.4 | 0.3 | 0.3 | 兼顾成本、余额和负载均衡,推荐大多数用户 |
|
||||
| **稳定优先** | 0.2 | 0.5 | 0.3 | 适合生产环境,优先选余额充足的通道避免中断 |
|
||||
| **轮转均匀** | 0.1 | 0.1 | 0.8 | 适合测试场景,尽量让每个通道都被使用到 |
|
||||
|
||||
**调参建议:**
|
||||
|
||||
- 如果某个站点总是被选中导致余额很快耗尽 → 调高 `BALANCE_WEIGHT`
|
||||
- 如果你有几个很便宜的站点想优先用 → 调高 `COST_WEIGHT`
|
||||
- 如果你想让请求均匀分散到所有站点 → 调高 `USAGE_WEIGHT`
|
||||
- 如果你需要对特定项目偏好某个站点 → 使用[下游 API Key 的 `siteWeightMultipliers`](#下游-api-key-策略) 而非调全局权重
|
||||
|
||||
## 代理日志保留
|
||||
|
||||
@@ -209,3 +216,5 @@ Metapi 的路由引擎按多因子加权选择最优通道。
|
||||
|
||||
- [部署指南](./deployment.md) — Docker Compose 与反向代理
|
||||
- [客户端接入](./client-integration.md) — 对接下游应用
|
||||
- [上游接入](./upstream-integration.md) — 添加和管理上游平台
|
||||
- [运维手册](./operations.md) — 备份、日志与健康检查
|
||||
|
||||
Reference in New Issue
Block a user