feat(channels): add custom account stats pricing rules
Allow channels to configure independent model pricing for account statistics cost calculation, decoupled from user billing. Backend: - Migration 101: channels.apply_pricing_to_account_stats toggle, channel_account_stats_pricing_rules/model_pricing tables, usage_logs.account_stats_cost column - resolveAccountStatsCost: match rules by group/account, then channel pricing, fallback to original formula when unconfigured - Integrate into both GatewayService.recordUsageCore and OpenAIGatewayService.RecordUsage - Update 8 account stats SQL queries to use COALESCE(account_stats_cost, total_cost) * account_rate_multiplier - 23 unit tests for matching, pricing lookup, and cost calculation Frontend: - Channel edit dialog: toggle + custom rules UI with group/account multi-select and pricing entry cards - API types and i18n (zh/en)
This commit is contained in:
@@ -1844,7 +1844,18 @@ export default {
|
||||
noPlatforms: 'Click "Add Platform" to start configuring the channel',
|
||||
mappingCount: 'mappings',
|
||||
pricingEntry: 'Pricing Entry',
|
||||
noModels: 'No models added'
|
||||
noModels: 'No models added',
|
||||
applyPricingToAccountStats: 'Apply Pricing to Account Stats',
|
||||
applyPricingToAccountStatsDesc: 'When enabled, account statistics cost will use channel model pricing. Account rate multiplier still applies.',
|
||||
accountStatsPricingRules: 'Custom Account Stats Pricing Rules',
|
||||
addRule: 'Add Rule',
|
||||
noRulesConfigured: 'No custom rules configured. Channel model pricing above will be used.',
|
||||
ruleName: 'Rule name (optional)',
|
||||
ruleGroups: 'Groups',
|
||||
ruleAccounts: 'Account IDs',
|
||||
ruleAccountsPlaceholder: 'Enter account IDs, comma-separated',
|
||||
ruleModelPricing: 'Model Pricing',
|
||||
noGroupsInChannel: 'No groups selected in platform tabs above'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -1923,7 +1923,18 @@ export default {
|
||||
noPlatforms: '点击"添加平台"开始配置渠道',
|
||||
mappingCount: '条映射',
|
||||
pricingEntry: '定价配置',
|
||||
noModels: '未添加模型'
|
||||
noModels: '未添加模型',
|
||||
applyPricingToAccountStats: '应用模型定价到账号统计',
|
||||
applyPricingToAccountStatsDesc: '启用后,账号统计费用将使用渠道模型定价计算。账号自身的统计倍率仍然生效。',
|
||||
accountStatsPricingRules: '自定义账号统计定价规则',
|
||||
addRule: '添加规则',
|
||||
noRulesConfigured: '未配置自定义规则,将使用上方的模型定价。',
|
||||
ruleName: '规则名称(可选)',
|
||||
ruleGroups: '分组',
|
||||
ruleAccounts: '账号 ID',
|
||||
ruleAccountsPlaceholder: '输入账号 ID,逗号分隔',
|
||||
ruleModelPricing: '模型定价',
|
||||
noGroupsInChannel: '上方平台标签页中未选择分组'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user