feat(tenant): bill AI points by output characters
Previously AI point cost was computed from request (input) characters at reservation time. Switch to reserving a single point up front and settling the final cost from the generated output length on completion. - Reserve 1 point (or FixedPoints) instead of pricing on request chars - On completion, recompute points from output chars vs base chars, update the reservation amounts, and post a ledger delta for the top-up/refund; invalidate the workspace quota summary cache - MarkCompleted now persists final request_chars/base_chars/points - Use ceil division in calculateAIPointCost so an exact base boundary charges one point instead of rolling over - Thread output text through all CompleteAIPoints callers (article selection, KOL assist, question expansion, template assist, compliance judge) and return the settled reservation - Add unit tests plus an integration test gated on TEST_DATABASE_URL - Update the user manual: billing is by output characters Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
|
||||
### 计费基础
|
||||
|
||||
- 每个 AI 调用按"请求字数 / 基准字数"换算成点数
|
||||
- 每个 AI 调用按"输出字数 / 基准字数"换算成点数
|
||||
- 套餐越高,**基准字数** 越大(同样请求消耗的点数越少)
|
||||
- 流水里能看到「{字数} 字 / 基准 {基准}」的换算说明
|
||||
|
||||
@@ -80,7 +80,7 @@ AI 任务在提交时会**先预占**对应点数,任务完成后才正式确
|
||||
|
||||
- **使用场景**:哪类操作触发的扣点
|
||||
- **点数**:本次消耗(负数表示扣除,正数表示退回)
|
||||
- **计费字数**:实际请求字数
|
||||
- **计费字数**:实际输出字数
|
||||
- **创建时间**、**状态**
|
||||
|
||||
如果有"莫名其妙的扣点":
|
||||
|
||||
Reference in New Issue
Block a user