Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(backend): Add ability to execute store agents without agent ownership #9179

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4465994
Allow execution of store listings
Swiftyos Jan 3, 2025
6b9580b
Merge branch 'dev' into swiftyos/open-2276-add-ability-to-execute-sto…
Swiftyos Jan 3, 2025
6df94aa
updated comment to make the meaning of userId clearer
Swiftyos Jan 3, 2025
a7e0af0
Merge branch 'swiftyos/open-2276-add-ability-to-execute-store-agents-…
Swiftyos Jan 3, 2025
c6daeef
Merge branch 'dev' into swiftyos/open-2276-add-ability-to-execute-sto…
Swiftyos Jan 7, 2025
4f861e3
fixed merged error
Swiftyos Jan 7, 2025
797f9ed
fmt
Swiftyos Jan 7, 2025
bb8e562
Update autogpt_platform/backend/backend/data/graph.py
Swiftyos Jan 7, 2025
f051266
Merge branch 'dev' into swiftyos/open-2276-add-ability-to-execute-sto…
Swiftyos Jan 7, 2025
37e8b51
add isActive filter back in
Swiftyos Jan 8, 2025
cf453cf
updated get graph checks
Swiftyos Jan 9, 2025
4cdfb4e
added tests for get_graph
Swiftyos Jan 9, 2025
874e2b3
Merge branch 'dev' into swiftyos/open-2276-add-ability-to-execute-sto…
Swiftyos Jan 9, 2025
30504e1
ensure isApproved and not isDeleted added tests to check
Swiftyos Jan 9, 2025
3be552c
Merge branch 'swiftyos/open-2276-add-ability-to-execute-store-agents-…
Swiftyos Jan 9, 2025
714913a
cosmetic change
majdyz Jan 9, 2025
8adf7bf
update store indexing
Swiftyos Jan 10, 2025
9e008ad
Merge branch 'swiftyos/open-2276-add-ability-to-execute-store-agents-…
Swiftyos Jan 10, 2025
3052656
fix linting
Swiftyos Jan 10, 2025
99bc218
Merge branch 'dev' into swiftyos/open-2276-add-ability-to-execute-sto…
Swiftyos Jan 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Warnings:

- A unique constraint covering the columns `[agentId]` on the table `StoreListing` will be added. If there are existing duplicate values, this will fail.

*/
-- DropIndex
DROP INDEX "StoreListing_agentId_idx";

-- DropIndex
DROP INDEX "StoreListing_isApproved_idx";

-- DropIndex
DROP INDEX "StoreListingVersion_agentId_agentVersion_isApproved_idx";

-- CreateIndex
CREATE INDEX "StoreListing_agentId_owningUserId_idx" ON "StoreListing"("agentId", "owningUserId");

-- CreateIndex
CREATE INDEX "StoreListing_isDeleted_isApproved_idx" ON "StoreListing"("isDeleted", "isApproved");

-- CreateIndex
CREATE INDEX "StoreListing_isDeleted_idx" ON "StoreListing"("isDeleted");

-- CreateIndex
CREATE UNIQUE INDEX "StoreListing_agentId_key" ON "StoreListing"("agentId");

-- CreateIndex
CREATE INDEX "StoreListingVersion_agentId_agentVersion_isDeleted_idx" ON "StoreListingVersion"("agentId", "agentVersion", "isDeleted");
20 changes: 11 additions & 9 deletions autogpt_platform/backend/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,8 @@ view Creator {
agent_rating Float
agent_runs Int
is_featured Boolean

// Index or unique are not applied to views
}

view StoreAgent {
Expand All @@ -465,11 +467,7 @@ view StoreAgent {
rating Float
versions String[]

@@unique([creator_username, slug])
@@index([creator_username])
@@index([featured])
@@index([categories])
@@index([storeListingVersionId])
// Index or unique are not applied to views
}

view StoreSubmission {
Expand All @@ -487,7 +485,7 @@ view StoreSubmission {
agent_id String
agent_version Int

@@index([user_id])
// Index or unique are not applied to views
}

model StoreListing {
Expand All @@ -510,9 +508,13 @@ model StoreListing {
StoreListingVersions StoreListingVersion[]
StoreListingSubmission StoreListingSubmission[]

@@index([isApproved])
@@index([agentId])
// Unique index on agentId to ensure only one listing per agent, regardless of number of versions the agent has.
@@unique([agentId])
@@index([agentId, owningUserId])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as below,

@@index([owningUserId])
// Used in the view query
@@index([isDeleted, isApproved])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two indices with Boolean values will only be used on a query like this

Select ... From StoreListing where is deleted = ...

If you have another column in the filter, it will never be used. So I don't think this will be useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If [isDeleted, isApproved] is indeed the filter column, the index with two columns will override the one below.
So we can safely remove it.

@@index([isDeleted])
}

model StoreListingVersion {
Expand Down Expand Up @@ -553,7 +555,7 @@ model StoreListingVersion {
StoreListingReview StoreListingReview[]

@@unique([agentId, agentVersion])
@@index([agentId, agentVersion, isApproved])
@@index([agentId, agentVersion, isDeleted])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentId and agent version is already unique

Adding another index on this will be useless and slowing down the write

}

model StoreListingReview {
Expand Down