Commit Graph

6362 Commits (zamilmajdy/secrt-1016-phase-2-implement-transaction-history)

Author SHA1 Message Date
Zamil Majdy 0a8f76697b Merge branch 'zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1016-phase-2-implement-transaction-history 2025-01-21 12:18:49 +01:00
Zamil Majdy e26e1d8b6e Fix test 2025-01-21 12:13:02 +01:00
Zamil Majdy d65625d7be Address comments 2025-01-21 12:02:59 +01:00
Zamil Majdy 819c9431cf Merge branch 'zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1016-phase-2-implement-transaction-history 2025-01-21 11:59:43 +01:00
Zamil Majdy f6f4364f7b Address comments 2025-01-21 11:57:59 +01:00
Zamil Majdy ee3c01312c Merge remote-tracking branch 'origin/zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism' into zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism 2025-01-21 11:53:49 +01:00
Zamil Majdy 8dcb52e1dc Address comments 2025-01-21 11:53:41 +01:00
Krzysztof Czerwinski 495d44ec81 Merge branch 'dev' into zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism 2025-01-19 12:47:58 +01:00
Krzysztof Czerwinski 800625c952
fix(frontend): Change `/store*` url to `/marketplace*` (#9119)
We have branded it as "Marketplace", so the URL shouldn't be "store".

### Changes 🏗️

- Change frontend URLs from `/store*` to `/marketplace*`
- No API route changes to minimize bugs (follow up:
https://github.com/Significant-Gravitas/AutoGPT/issues/9118)
2025-01-18 17:49:41 +01:00
Zamil Majdy 7a86884533 feat(platform): Implement User Credit Transaction History 2025-01-17 14:02:12 -06:00
Zamil Majdy 6a6022af64 feat(platform): Implement User Credit Transaction History 2025-01-17 13:59:54 -06:00
Nicholas Tindle 56612f16cf
feat(platform): Linear integration (#9269)
<!-- Clearly explain the need for these changes: -->

I want to be able to do stuff with linear automatically

### Changes 🏗️
- Adds all the backing details to add linear auth and API access with
oauth (and prep for API key)

<!-- Concisely describe all of the changes made in this pull request:
-->

### 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>

---------

Co-authored-by: Aarushi <50577581+aarushik93@users.noreply.github.com>
2025-01-17 13:35:58 +00:00
Reinier van der Leer 0d2bb46786
fix(frontend): Unbreak save button after save error (#9290)
- Resolves #9253

### Changes 🏗️

- Update state when an error occurs on save, to re-enable the save
button

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
- Try to save an agent with missing required fields -> should give an
error
  - Fill out the required fields and try saving again -> should work
2025-01-17 13:29:43 +00:00
Aarushi c61317e448
feat(platform): Create external API (#9272)
We want to allow external api calls against our platform
We also want to keep it sep from internal platform calls for dev ex,
security and scale seperation of concerns

### Changes 🏗️

This PR adds the required external routes
It mounts the new routes on the same app 

Infra PR will seprate routing and domains

### 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>
2025-01-17 11:44:04 +00:00
Bently 3c30783b14
docs(Ollama): Remove steps about adding ollama credentials (#9288)
Since ["feat: no longer require ollama key
#9287"](https://github.com/Significant-Gravitas/AutoGPT/pull/9287) we no
longer need the steps for adding ollama credentials so this removes them
from the docs
2025-01-16 22:35:05 +00:00
Zamil Majdy 96c4fea741 Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism 2025-01-16 15:19:25 -06:00
Zamil Majdy 56b33327ab
feat(platform): Add billing portal entry point (#9264)
<img width="1445" alt="image"
src="https://github.com/user-attachments/assets/5aeb7ee2-4d06-4a64-889b-599ad68c6dae"
/>


### Changes 🏗️

Added an entry point to open the Stripe billing portal.

### 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>

---------

Co-authored-by: Krzysztof Czerwinski <kpczerwinski@gmail.com>
2025-01-16 21:00:15 +00:00
Zamil Majdy c36c239dd5
feat(backend): Add graph/node id & execution id on CreditTransaction table (#9217)
We need to be able to determine the cost of graph/node execution.

### Changes 🏗️

* Add these columns into CreditTransaction `metadata` column:
    - graph_id
    - node_id
    - graph_exec_id
    - node_exec_id
    - block_id
* Drop the `blockId` column and backfill the dropped value into
metadata->>block_id.
* Frequent queries on these values will require an index created on
demand through a migration, depending on the use case.

---------

Co-authored-by: Krzysztof Czerwinski <kpczerwinski@gmail.com>
Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2025-01-16 20:59:49 +00:00
Zamil Majdy d0bce61d3a fix 2025-01-16 12:09:01 -06:00
Zamil Majdy f83c31fa28 fix 2025-01-16 12:04:45 -06:00
Zamil Majdy ef3a4ecbfb Merge branch 'zamilmajdy/secrt-1018-phase-2-create-payment-method-crud' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism 2025-01-16 12:00:57 -06:00
Zamil Majdy 8fbc1f2e0d Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1017-phase-2-create-auto-top-up-balance-mechanism 2025-01-16 11:59:07 -06:00
Zamil Majdy 9349101fb1
Merge branch 'dev' into zamilmajdy/secrt-1018-phase-2-create-payment-method-crud 2025-01-17 00:58:42 +07:00
Nicholas Tindle e53f1eaf80
feat: no longer require ollama key (#9287)
<!-- Clearly explain the need for these changes: -->

### Changes 🏗️

<!-- Concisely describe all of the changes made in this pull request:
-->

### 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>
2025-01-16 12:25:08 +00:00
Zamil Majdy 4b1d83f07f refresh migration date 2025-01-15 18:41:06 -06:00
Zamil Majdy af97f44f24 Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1018-phase-2-create-payment-method-crud 2025-01-15 18:39:54 -06:00
Krzysztof Czerwinski 04915f2db0
feat(platform): Implement top-up flow for PAYG System (#9050)
This PR adds Stripe integration and payment processing for topping-up
user accounts with credits.

### Changes 🏗️

Includes:
- https://github.com/Significant-Gravitas/AutoGPT/pull/9176

#### Top-up flow

1. To top-up a user visits their settings and clicks `Credits` button
(it's unavailable if `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` isn't present)
2. User inputs top-up amount (min 5$ in 1$ increments) and click the
button to confirm.
3. Backend receives top-up request, creates database entry and requests
stripe to provide url for this specific checkout.
4. User gets redirected to externally hosted Stripe checkout page, after
payment (or cancelling) they get redirected back to Credits page.
5. In the meantime Stripe processes payment and sends webhook
confirmation to the backend, backend updates database to activate bought
credits.
6. Credits page shows success (or failure) information (by using url
param `topup=success|cancel`). Credit counter won't update without
refreshing the page unless payment was confirmed before user was back on
Credits page which is the case when testing checkout locally.

<img width="804" alt="Screenshot 2025-01-01 at 2 55 35 PM"
src="https://github.com/user-attachments/assets/22fb518d-b30b-4154-bb4b-edea1d57b6c2"
/>

#### Backend
- Add `stripe` package
- Add environment variables:
  - `STRIPE_API_KEY`
  - `STRIPE_WEBHOOK_SECRET`
- Add routes:
  - `POST /credits`: top-up request, returns Stripe checkout url.
- `POST /credits/stripe_webhook`: Stripe webhook endpoint to notify of
successful payment.
- `PATCH /credits`: prompts beckend to check payment status. It's an
additional failsafe in case webhook fails.
- Update `credit.py` and related files to handle top-up request and
payment confirmation

#### Frontend
- Add `stripe-js` package
- Add `NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` environment variable
- Modify user settings sidebar to show `Credits` if
`NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY` is available
- Add `store/credits` page where user can top-up their account, it shows
confirmation (or failure) after completing checkout.
- Add `useCredits` hook that returns user credits and allows to request
top-up.

### Checklist 📋

#### For code changes:
- [x] 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:
- [x] `.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>

---------

Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>
2025-01-15 23:46:52 +00:00
Zamil Majdy 206d1b87d5 refresh migration date 2025-01-15 14:21:42 -06:00
Nicholas Tindle 9d79bfadea
[Snyk] Security upgrade next from 14.2.20 to 14.2.21 (#9243)
![snyk-top-banner](https://redirect.github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)

### Snyk has created this PR to fix 1 vulnerabilities in the yarn
dependencies of this project.

#### Snyk changed the following file(s):

- `autogpt_platform/frontend/package.json`
- `autogpt_platform/frontend/yarn.lock`


#### Note for
[zero-installs](https://yarnpkg.com/features/zero-installs) users

If you are using the Yarn feature
[zero-installs](https://yarnpkg.com/features/zero-installs) that was
introduced in Yarn V2, note that this PR does not update the
`.yarn/cache/` directory meaning this code cannot be pulled and
immediately developed on as one would expect for a zero-install project
- you will need to run `yarn` to update the contents of the
`./yarn/cache` directory.
If you are not using zero-install you can ignore this as your flow
should likely be unchanged.




#### Vulnerabilities that will be fixed with an upgrade:

|  | Issue |  
:-------------------------:|:-------------------------
![medium
severity](https://res.cloudinary.com/snyk/image/upload/w_20,h_20/v1561977819/icon/m.png
'medium severity') | Allocation of Resources Without Limits or
Throttling
<br/>[SNYK-JS-NEXT-8602067](https://snyk.io/vuln/SNYK-JS-NEXT-8602067)




---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - Max score is 1000. Note that the real score may have changed since
the PR was raised.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open fix PRs._

For more information: <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI4NWY3NDgyYy03NGFiLTQxNmYtYjQ4OC0wMTUwMDlmYzY5NzkiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6Ijg1Zjc0ODJjLTc0YWItNDE2Zi1iNDg4LTAxNTAwOWZjNjk3OSJ9fQ=="
width="0" height="0"/>
🧐 [View latest project
report](https://app.snyk.io/org/significant-gravitas/project/3d924968-0cf3-4767-9609-501fa4962856?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;fix-pr)
📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=github&utm_content=fix-pr-template)
🛠 [Adjust project
settings](https://app.snyk.io/org/significant-gravitas/project/3d924968-0cf3-4767-9609-501fa4962856?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;fix-pr/settings)
📚 [Read about Snyk's upgrade
logic](https://docs.snyk.io/scan-with-snyk/snyk-open-source/manage-vulnerabilities/upgrade-package-versions-to-fix-vulnerabilities?utm_source=github&utm_content=fix-pr-template)

---

**Learn how to fix vulnerabilities with free interactive lessons:**

🦉 [Allocation of Resources Without Limits or
Throttling](https://learn.snyk.io/lesson/no-rate-limiting/?loc&#x3D;fix-pr)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"next","from":"14.2.20","to":"14.2.21"}],"env":"prod","issuesToFix":["SNYK-JS-NEXT-8602067"],"prId":"85f7482c-74ab-416f-b488-015009fc6979","prPublicId":"85f7482c-74ab-416f-b488-015009fc6979","packageManager":"yarn","priorityScoreList":[null],"projectPublicId":"3d924968-0cf3-4767-9609-501fa4962856","projectUrl":"https://app.snyk.io/org/significant-gravitas/project/3d924968-0cf3-4767-9609-501fa4962856?utm_source=github&utm_medium=referral&page=fix-pr","prType":"fix","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":["updated-fix-title"],"type":"auto","upgrade":["SNYK-JS-NEXT-8602067"],"vulns":["SNYK-JS-NEXT-8602067"],"patch":[],"isBreakingChange":false,"remediationStrategy":"vuln"}'

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2025-01-15 18:11:13 +00:00
Zamil Majdy 768822482e lint 2025-01-15 12:09:10 -06:00
Zamil Majdy bd7d251726 feat(platform): Implement Auto-Top-Up credits capability 2025-01-15 11:54:18 -06:00
Zamil Majdy c136013e12 feat(platform): Implement Auto-Top-Up credits capability 2025-01-15 11:49:24 -06:00
Nicholas Tindle 5f50c4863d
test(frontend): Re-enable the tests in monitor.spec.ts and then ensure they pass (#9248)
Enable the tests in `monitor.spec.ts`.

* Remove `test.describe.skip` to enable the tests.
* Ensure the tests are now running and passing successfully.

---

For more details, open the [Copilot Workspace
session](https://copilot-workspace.githubnext.com/Significant-Gravitas/AutoGPT/pull/9248?shareId=edbd64cc-ea19-477b-be06-5eea84c28665).
2025-01-15 09:41:41 +00:00
Zamil Majdy 601b13937d Merge remote-tracking branch 'origin/zamilmajdy/secrt-1018-phase-2-create-payment-method-crud' into zamilmajdy/secrt-1018-phase-2-create-payment-method-crud 2025-01-14 13:42:37 -06:00
Zamil Majdy 66fbefba07 Reformat 2025-01-14 13:42:30 -06:00
Zamil Majdy 11a62b72ef Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into zamilmajdy/secrt-1018-phase-2-create-payment-method-crud 2025-01-14 13:34:45 -06:00
Zamil Majdy 43905f557b
Merge branch 'kpczerwinski/secrt-1012-mvp-implement-top-up-flow' into zamilmajdy/secrt-1018-phase-2-create-payment-method-crud 2025-01-14 05:53:49 +07:00
Zamil Majdy 732a3a00e1 feat(platform): Add billing portal entry point 2025-01-13 16:49:36 -06:00
Zamil Majdy 9e27039a11
Merge branch 'dev' into kpczerwinski/secrt-1012-mvp-implement-top-up-flow 2025-01-14 05:45:23 +07:00
Aarushi fe84cbe566
Revert "feature(backend): Add ability to execute store agents without agent ownership" (#9263)
Reverts Significant-Gravitas/AutoGPT#9179

This PR is preventing the running of agents in dev.
2025-01-13 18:34:17 +00:00
Zamil Majdy a5b63936b8 Refresh migraiton time 2025-01-13 12:33:27 -06:00
Zamil Majdy d1dce4bd5f Merge branch 'kpczerwinski/secrt-1012-mvp-implement-top-up-flow' of github.com:Significant-Gravitas/AutoGPT into kpczerwinski/secrt-1012-mvp-implement-top-up-flow 2025-01-13 12:16:10 -06:00
Zamil Majdy 46eb6c8e4f Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into kpczerwinski/secrt-1012-mvp-implement-top-up-flow 2025-01-13 12:15:43 -06:00
Aarushi 5618072375
fix(blocks/Exa): Fix exa contents block advanced toggle (#9255)
Toggling the advanced option on Exa Contents Block isn't working. It
throws a frontend error.

### Changes 🏗️

Remove Optional from ContentRetrievalSettings in exa/contents.py

### Checklist 📋

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


#### For configuration changes:
N/A
2025-01-13 16:35:14 +00:00
Zamil Majdy 5af06480c5
feat(backend): Add running balance and introduce atomicity on transaction creation (#9176)
- Added runningBalance column on CreditTransaction table.
- Added credit model with normal balance calculation UserCredit & its default monthly version BetaUserCredit.
2025-01-13 15:19:46 +00:00
Reinier van der Leer 95b79abcfe
Revert broken Library v2 DB stuff of #9218, #9211 (#9256)
- **Revert "feature(platform): Implement library add, update, remove,
archive functionality (#9218)"**
- **Revert "feat(backend): Add Support for Managing Agent Presets with
Pagination and Soft Delete (#9211)"**

These PRs contain untested changes to DB functions and cause issues in
production.
2025-01-13 16:08:58 +01:00
Zamil Majdy 86406cd3db Revert unused change 2025-01-10 18:33:25 -06:00
Zamil Majdy 427da2fb81 Set default value for `PLATFORM_BASE_URL` 2025-01-10 18:19:44 -06:00
Zamil Majdy 9c2bc4bd1e Set default value for `PLATFORM_BASE_URL` 2025-01-10 18:05:12 -06:00
Zamil Majdy c7e994cb69 Merge branch 'dev' of github.com:Significant-Gravitas/AutoGPT into kpczerwinski/secrt-1012-mvp-implement-top-up-flow 2025-01-10 18:03:36 -06:00