feat: implement tiered billing expression evaluation and related functionality
- Added support for tiered billing expressions in the billing system. - Introduced new types and functions for handling billing expressions, including caching and execution. - Updated existing billing logic to accommodate tiered billing scenarios. - Enhanced request handling to support incoming billing expression requests. - Added tests for tiered billing functionality to ensure correctness.
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/constant"
|
||||
"github.com/QuantumNous/new-api/dto"
|
||||
"github.com/QuantumNous/new-api/pkg/billingexpr"
|
||||
relayconstant "github.com/QuantumNous/new-api/relay/constant"
|
||||
"github.com/QuantumNous/new-api/setting/model_setting"
|
||||
"github.com/QuantumNous/new-api/types"
|
||||
@@ -152,6 +153,11 @@ type RelayInfo struct {
|
||||
|
||||
PriceData types.PriceData
|
||||
|
||||
// TieredBillingSnapshot is a frozen snapshot of tiered billing rules
|
||||
// captured at pre-consume time. Non-nil only when billing mode is "tiered_expr".
|
||||
TieredBillingSnapshot *billingexpr.BillingSnapshot
|
||||
BillingRequestInput *billingexpr.RequestInput
|
||||
|
||||
Request dto.Request
|
||||
|
||||
// RequestConversionChain records request format conversions in order, e.g.
|
||||
|
||||
Reference in New Issue
Block a user