feat: let tpm be configured without an est_tokens companion
The gate check forced operators to guess a per-call token size before they could enable the TPM gate at all; est_tokens is now an optional tuning override and effective_est_tokens() derives the reservation from the provider quota. Reservation and settlement already read the same derived value, so the deposit still nets to zero on both the success path and the non-dead transient failure path. The rest of _validate_gates is untouched, and the est_tokens field plus its EST_TOKENS env key stay put for migration compatibility.
This commit is contained in:
@@ -136,8 +136,8 @@ class SourceConfig:
|
||||
for attr in ("max_concurrency", "rpm", "tpm", "est_tokens"):
|
||||
if getattr(self, attr) < 0:
|
||||
raise ValueError(f"SourceConfig.{attr} 不能为负(0 表示不启用)")
|
||||
if self.tpm > 0 and self.est_tokens <= 0:
|
||||
raise ValueError("启用 TPM 闸时 est_tokens 必须 > 0(入场预扣依据)")
|
||||
# 注: 不再强制 `tpm > 0 ⇒ est_tokens > 0`——预扣量由 effective_est_tokens()
|
||||
# 自 tpm 派生,运维只需填供应商配额页上抄得到的 tpm(设计 §3.2 #1)
|
||||
|
||||
def _validate_watchdog(self) -> None:
|
||||
# CHS config.py:66-82: 流式看门狗成对配置且 0 < inter < ttft < timeout_s
|
||||
|
||||
Reference in New Issue
Block a user