fix(backend): Set the minimum auto top-up amount to 500 credits (#9418)

### Changes 🏗️

* Set the minimum auto top-up amount to 500.
* Add description on minimum and dollar value in the input box.

### Checklist 📋

#### For code changes:
- [ ] I have clearly listed my changes in the PR description
- [ ] I have made a test plan
- [ ] I have tested my changes according to the test plan:
  <!-- Put your test plan here: -->
  - [ ] ...

<details>
  <summary>Example test plan</summary>
  
  - [ ] Create from scratch and execute an agent with at least 3 blocks
- [ ] Import an agent from file upload, and confirm it executes
correctly
  - [ ] Upload agent to marketplace
- [ ] Import an agent from marketplace and confirm it executes correctly
  - [ ] Edit an agent from monitor, and confirm it executes correctly
</details>

#### For configuration changes:
- [ ] `.env.example` is updated or already compatible with my changes
- [ ] `docker-compose.yml` is updated or already compatible with my
changes
- [ ] I have included a list of my configuration changes in the PR
description (under **Changes**)

<details>
  <summary>Examples of configuration changes</summary>

  - Changing ports
  - Adding new services that need to communicate with each other
  - Secrets or environment variable changes
  - New or infrastructure changes such as databases
</details>
This commit is contained in:
Zamil Majdy
2025-02-04 18:01:33 +01:00
committed by GitHub
parent 8e68e20fef
commit 9151211d2a
2 changed files with 6 additions and 2 deletions

View File

@@ -177,6 +177,8 @@ async def configure_user_auto_top_up(
) -> str:
if request.threshold < 0:
raise ValueError("Threshold must be greater than 0")
if request.amount < 500:
raise ValueError("Amount must be greater than or equal to 500")
if request.amount < request.threshold:
raise ValueError("Amount must be greater than or equal to threshold")

View File

@@ -108,7 +108,7 @@ export default function CreditsPage() {
htmlFor="topUpAmount"
className="mb-1 block text-neutral-700"
>
Top-up Amount (Credits)
Top-up Amount (Credits, Minimum 500 = 5 USD)
</label>
<input
type="number"
@@ -137,7 +137,7 @@ export default function CreditsPage() {
htmlFor="autoTopUpAmount"
className="mb-1 block text-neutral-700"
>
Auto Top-up Amount (Credits)
Auto Top-up Amount (Credits, Minimum 500 = 5 USD)
</label>
<input
type="number"
@@ -145,6 +145,7 @@ export default function CreditsPage() {
name="topUpAmount"
defaultValue={autoTopUpConfig?.amount || ""}
placeholder="Enter auto top-up amount"
min="500"
step="100"
className="w-full rounded-md border border-slate-200 px-4 py-2 dark:border-slate-700 dark:bg-slate-800"
required
@@ -164,6 +165,7 @@ export default function CreditsPage() {
name="threshold"
defaultValue={autoTopUpConfig?.threshold || ""}
placeholder="Enter threshold value"
min="500"
step="100"
className="w-full rounded-md border border-slate-200 px-4 py-2 dark:border-slate-700 dark:bg-slate-800"
required