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

refactor(platform): Update database model to reflect domain #8375

Merged

Conversation

Swiftyos
Copy link
Contributor

@Swiftyos Swiftyos commented Oct 18, 2024

Background

We are enhancing our platform’s capabilities by introducing several new features that require an updated database schema. These features include group support, user-specific agent configurations, an accounting and credit system, and a marketplace for agent listings. These changes are essential to support the domino feature, which integrates these components to provide a more robust and user-friendly experience.

Changes 🏗️

  • Renamed AgentGraph to Agent:

    • Updated the AgentGraph model to Agent for clarity.
    • Adjusted all references and relations to accommodate the new naming.
    • Added @@map("AgentGraph") to maintain backward compatibility with the existing database.
  • Group Support:

    • Introduced a new UserGroup model to enable user group functionalities.
    • Fields include id, name, description, groupIconUrl, and relations to User, Agent, Profile, and StoreListing.
  • Updated the User model:

    • Added relations groups and adminGroups to represent group memberships and admin roles.
    • Included additional relations for accounting and subscriptions.
  • User-Specific Agent Configurations:

    • Added ConfiguredAgent model:
      • Stores user-specific configurations of agents.
      • Fields include id, name, description, and relations to User, Agent, and AgentNodeExecutionInputOutput.
    • Introduced UserAgents model:
      • Tracks agents associated with users, including favorites and published agents.
      • Fields include id, userId, agentId, and flags like isFavorite, isPublished, etc.
  • Accounting and Credit System:

    • Created UserAccounting model to manage user balances and transactions.
      • Fields include id, userId, usdBalance, and relations to UserBlockCredit.
    • Updated UserBlockCredit model:
      • Added references to UserAccounting, Agent, and StoreListing.
      • Included new enum values in UserBlockCreditType: COMMISSION, PURCHASE, SALE.
    • Added UserSubscription and SubscriptionPlan models:
      • UserSubscription tracks user subscriptions, including status and plan details.
      • SubscriptionPlan defines available subscription plans with pricing and credit information.
  • Marketplace Functionality:

    • Introduced Profile model to represent user or group profiles in the marketplace.
      • Fields include id, username, description, social links, and avatar URL.
    • Added StoreListing model to enable users to list agents for sale.
      • Fields include id, slug, name, description, and relations to Agent, User, UserGroup, and store-related models.
    • Created StoreListingVersion, StorePricing, and StoreListingApproval models to handle versioning, pricing, and approval workflows for listings.
  • Updated Triggering Mechanism:

    • Modified AgentGraphExecutionSchedule to now trigger a ConfiguredAgent using the input data from there
    • Add WebhookTriggers table for tracking web hook triggers
    • Added triggerIdentifier so agents can identify what tigger resulted in there execution
  • Updated Existing Models:

    • Modified models like AgentNode, AgentGraphExecution, and AgentNodeExecutionInputOutput:
      • Updated references from AgentGraph to Agent.
      • Adjusted relations and fields to align with the new schema structure.
      • Added indexes and comments for better query performance and readability.
  • Organized the schema into sections with clear comments for maintainability.

These changes collectively update the database schema to support the new features associated with the domino initiative, enhancing the platform’s functionality and scalability.

@Swiftyos Swiftyos requested review from a team as code owners October 18, 2024 08:38
@Swiftyos Swiftyos requested review from Bentlybro and majdyz and removed request for a team October 18, 2024 08:38
@CLAassistant
Copy link

CLAassistant commented Oct 18, 2024

CLA assistant check
All committers have signed the CLA.

@Swiftyos Swiftyos changed the base branch from master to dev October 18, 2024 08:38
@github-actions github-actions bot added platform/backend AutoGPT Platform - Back end size/l labels Oct 18, 2024
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 5 🔵🔵🔵🔵🔵
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Database Schema Changes
Significant changes to the database schema, including new models and relationships. Ensure all changes are necessary and properly implemented.

Cost Factor Adjustments
Cost factors for various LLM models have been significantly reduced. Verify if these changes are intentional and accurately reflect the new pricing structure.

Input/Output Schema Validation
New validation checks added for input and output schemas. Ensure this doesn't break existing functionality and is implemented correctly.

Credit System Update
Changes to the credit system, including new cost calculations for search and website content extraction. Verify the accuracy and implications of these changes.

Copy link

netlify bot commented Oct 18, 2024

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit a9a9d55
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67121e8ccb467e0008712070
😎 Deploy Preview https://deploy-preview-8375--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Swiftyos
Copy link
Contributor Author

Swiftyos commented Oct 18, 2024

When we come to an agreement on the schema changes I will propagate all these changes throughout the codebase

@Swiftyos Swiftyos requested a review from a team October 18, 2024 08:56
autogpt_platform/backend/schema.prisma Outdated Show resolved Hide resolved
autogpt_platform/backend/schema.prisma Outdated Show resolved Hide resolved
autogpt_platform/backend/schema.prisma Outdated Show resolved Hide resolved
@github-actions github-actions bot added size/xl and removed size/l labels Oct 24, 2024
@Swiftyos Swiftyos merged commit c7cd6dc into dev Oct 29, 2024
6 checks passed
@Swiftyos Swiftyos deleted the swiftyos/open-1829-update-database-model-to-reflect-domain branch October 29, 2024 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants