feat(agent): 云端 Agent - 增加上下文预算、任务事实与终态恢复保障
This commit is contained in:
1 parent
3bf21d79af
commit
b52bc9d5f2
61 files changed
+3512
-309
No files matched your search
@@ -0,0 +1,14 @@
|
||||
package repository
|
||||
|
||||
import "infinite-canvas/backend/internal/model"
|
||||
|
||||
func billingChargeLimitApplies(order model.BillingOrder) bool {
|
||||
return order.ChargeLimitSet || order.ChargeLimitMicrocredits > 0
|
||||
}
|
||||
|
||||
func validateBillingChargeLimit(order model.BillingOrder, amount int64) error {
|
||||
if amount < 0 || (billingChargeLimitApplies(order) && (order.ChargeLimitMicrocredits < 0 || amount > order.ChargeLimitMicrocredits)) {
|
||||
return ErrBillingChargeLimit
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user