mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:43:35 +00:00
fix: 修复PR #458中的totalCostLimit功能问题
主要修复: - 移除重复的totalUsageLimit字段,统一使用totalCostLimit - 删除auth.js中重复的总费用限制检查逻辑 - 删除admin.js中重复的totalCostLimit验证代码 - 更新所有前端组件,移除totalUsageLimit引用 功能改进: - 确保totalCostLimit作为永久累计费用限制正常工作 - 与dailyCostLimit(每日重置)功能互补 - 适用于预付费、一次性API Key场景 测试: - 删除有逻辑错误的test-total-usage-limit.js - 创建新的test-total-cost-limit.js验证功能正确性 - 所有测试通过,功能正常工作 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -344,34 +344,34 @@
|
||||
<button
|
||||
class="rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"
|
||||
type="button"
|
||||
@click="form.totalUsageLimit = '100'"
|
||||
@click="form.totalCostLimit = '100'"
|
||||
>
|
||||
$100
|
||||
</button>
|
||||
<button
|
||||
class="rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"
|
||||
type="button"
|
||||
@click="form.totalUsageLimit = '500'"
|
||||
@click="form.totalCostLimit = '500'"
|
||||
>
|
||||
$500
|
||||
</button>
|
||||
<button
|
||||
class="rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"
|
||||
type="button"
|
||||
@click="form.totalUsageLimit = '1000'"
|
||||
@click="form.totalCostLimit = '1000'"
|
||||
>
|
||||
$1000
|
||||
</button>
|
||||
<button
|
||||
class="rounded bg-gray-100 px-2 py-1 text-xs font-medium hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:hover:bg-gray-600"
|
||||
type="button"
|
||||
@click="form.totalUsageLimit = ''"
|
||||
@click="form.totalCostLimit = ''"
|
||||
>
|
||||
自定义
|
||||
</button>
|
||||
</div>
|
||||
<input
|
||||
v-model="form.totalUsageLimit"
|
||||
v-model="form.totalCostLimit"
|
||||
class="form-input w-full border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 dark:placeholder-gray-400"
|
||||
min="0"
|
||||
placeholder="0 表示无限制"
|
||||
@@ -910,7 +910,7 @@ const form = reactive({
|
||||
rateLimitCost: '', // 新增:费用限制
|
||||
concurrencyLimit: '',
|
||||
dailyCostLimit: '',
|
||||
totalUsageLimit: '',
|
||||
totalCostLimit: '',
|
||||
weeklyOpusCostLimit: '',
|
||||
expireDuration: '',
|
||||
customExpireDate: '',
|
||||
@@ -1249,9 +1249,9 @@ const createApiKey = async () => {
|
||||
form.dailyCostLimit !== '' && form.dailyCostLimit !== null
|
||||
? parseFloat(form.dailyCostLimit)
|
||||
: 0,
|
||||
totalUsageLimit:
|
||||
form.totalUsageLimit !== '' && form.totalUsageLimit !== null
|
||||
? parseFloat(form.totalUsageLimit)
|
||||
totalCostLimit:
|
||||
form.totalCostLimit !== '' && form.totalCostLimit !== null
|
||||
? parseFloat(form.totalCostLimit)
|
||||
: 0,
|
||||
weeklyOpusCostLimit:
|
||||
form.weeklyOpusCostLimit !== '' && form.weeklyOpusCostLimit !== null
|
||||
|
||||
Reference in New Issue
Block a user