mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
### Need 💡 This PR introduces the ability for users to "favorite" agents in the library view, enhancing agent discoverability and organization. Favorited agents will be visually marked with a heart icon and prioritized in the library list, appearing at the top. This feature is distinct from pinning specific agent runs. ### Changes 🏗️ * **Backend:** * Updated `LibraryAgent` model in `backend/server/v2/library/model.py` to include the `is_favorite` field when fetching from the database. * **Frontend:** * Updated `LibraryAgent` TypeScript type in `autogpt-server-api/types.ts` to include `is_favorite`. * Modified `LibraryAgentCard.tsx` to display a clickable heart icon, indicating the favorite status. * Implemented a click handler on the heart icon to toggle the `is_favorite` status via an API call, including loading states and toast notifications. * Updated `useLibraryAgentList.ts` to implement client-side sorting, ensuring favorited agents appear at the top of the list. * Updated `openapi.json` to include `is_favorite` in the `LibraryAgent` schema and regenerated frontend API types. * Installed `@orval/core` for API generation. ### 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: - [x] Verify that the heart icon is displayed correctly on `LibraryAgentCard` for both favorited (filled red) and unfavorited (outlined gray) agents. - [x] Click the heart icon on an unfavorited agent: - [x] Confirm the icon changes to filled red. - [x] Verify a "Added to favorites" toast notification appears. - [x] Confirm the agent moves to the top of the library list. - [x] Check that the agent card does not navigate to the agent details page. - [x] Click the heart icon on a favorited agent: - [x] Confirm the icon changes to outlined gray. - [x] Verify a "Removed from favorites" toast notification appears. - [x] Confirm the agent's position adjusts in the list (no longer at the very top unless other sorting criteria apply). - [x] Check that the agent card does not navigate to the agent details page. - [x] Test the loading state: rapidly click the heart icon and observe the `opacity-50 cursor-not-allowed` styling. - [x] Verify that the sorting correctly places all favorited agents at the top, maintaining their original relative order within the favorited group, and the same for unfavorited agents. #### For configuration changes: - [ ] `.env.default` is updated or already compatible with my changes - [ ] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) --- <a href="https://cursor.com/background-agent?bcId=bc-43e8f98c-e4ea-4149-afc8-5eea3d1ab439"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-cursor-dark.svg"> <source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-cursor-light.svg"> <img alt="Open in Cursor" src="https://cursor.com/open-in-cursor.svg"> </picture> </a> <a href="https://cursor.com/agents?id=bc-43e8f98c-e4ea-4149-afc8-5eea3d1ab439"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/open-in-web-dark.svg"> <source media="(prefers-color-scheme: light)" srcset="https://cursor.com/open-in-web-light.svg"> <img alt="Open in Web" src="https://cursor.com/open-in-web.svg"> </picture> </a> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Nicholas Tindle <ntindle@users.noreply.github.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
98 lines
2.5 KiB
TypeScript
98 lines
2.5 KiB
TypeScript
import { defineConfig } from "orval";
|
|
|
|
export default defineConfig({
|
|
autogpt_api_client: {
|
|
input: {
|
|
target: `./src/app/api/openapi.json`,
|
|
override: {
|
|
transformer: "./src/app/api/transformers/fix-tags.mjs",
|
|
},
|
|
},
|
|
output: {
|
|
workspace: "./src/app/api",
|
|
target: `./__generated__/endpoints`,
|
|
schemas: "./__generated__/models",
|
|
mode: "tags-split",
|
|
client: "react-query",
|
|
httpClient: "fetch",
|
|
indexFiles: false,
|
|
override: {
|
|
mutator: {
|
|
path: "./mutators/custom-mutator.ts",
|
|
name: "customMutator",
|
|
},
|
|
query: {
|
|
useQuery: true,
|
|
useMutation: true,
|
|
usePrefetch: true,
|
|
// Will add more as their use cases arise
|
|
},
|
|
useDates: true,
|
|
operations: {
|
|
"getV2List library agents": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
},
|
|
},
|
|
"getV2List favorite library agents": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
},
|
|
},
|
|
"getV1List graph executions": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
},
|
|
},
|
|
"getV2Get builder blocks": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
useQuery: true,
|
|
},
|
|
},
|
|
"getV2Get builder integration providers": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
},
|
|
},
|
|
"getV2List store agents": {
|
|
query: {
|
|
useInfinite: true,
|
|
useInfiniteQueryParam: "page",
|
|
useQuery: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
hooks: {
|
|
afterAllFilesWrite:
|
|
"prettier --ignore-path= --write ./src/app/api/__generated__",
|
|
},
|
|
},
|
|
// autogpt_zod_schema: {
|
|
// input: {
|
|
// target: `./src/app/api/openapi.json`,
|
|
// override: {
|
|
// transformer: "./src/app/api/transformers/fix-tags.mjs",
|
|
// },
|
|
// },
|
|
// output: {
|
|
// workspace: "./src/app/api",
|
|
// target: `./__generated__/zod-schema`,
|
|
// schemas: "./__generated__/models",
|
|
// mode: "tags-split",
|
|
// client: "zod",
|
|
// indexFiles: false,
|
|
// },
|
|
// hooks: {
|
|
// afterAllFilesWrite: "prettier --write",
|
|
// },
|
|
// },
|
|
});
|