feat: EditTokenModal 中针对用户创建的 token 默认无限额度 - #2182
Conversation
WalkthroughUpdated default initial values in EditTokenModal.jsx: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the default values for new token creation in the EditTokenModal component. The changes make the default experience more user-friendly by enabling unlimited quota by default instead of starting with a fixed quota amount.
- Changed
remain_quotadefault from 500000 to 0 - Changed
unlimited_quotadefault from false to true
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const getInitValues = () => ({ | ||
| name: '', | ||
| remain_quota: 500000, | ||
| remain_quota: 0, |
There was a problem hiding this comment.
When unlimited_quota is false, the remain_quota field is required (line 486). Setting the default to 0 could be problematic as it represents no quota. If a user toggles unlimited_quota from true to false without entering a value, the form will accept 0 as a valid quota, which may not be the intended behavior. Consider using a more appropriate default like 500000 (matching the autocomplete suggestion for 1$) or add validation to prevent 0 when unlimited_quota is disabled.
| remain_quota: 0, | |
| remain_quota: 500000, |
feat: EditTokenModal 中针对用户创建的 token 默认无限额度
背景
在当前情况下,大多数用户创建 token 是默认 1$,大多数人在使用过程会很快遇到 token 使用完毕,我们大多数用户都应该会以自己额度为准,而且 key 大多数情况只有1个,因此改成默认创建无限额度 token 更合适。有需求的用户可以自行创建限额的 token
Summary by CodeRabbit