AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
refactor(platform): remove unused functions and imports (#10535)
Zamil Majdyb85e8204df24
diff --git a/autogpt_platform/CLAUDE.md b/autogpt_platform/CLAUDE.mdindex 9e4fd69caa..d1aa22a57d 100644--- a/autogpt_platform/CLAUDE.md+++ b/autogpt_platform/CLAUDE.md@@ -144,3 +144,41 @@ Key models (defined in `/backend/schema.prisma`):- Prevents sensitive data (auth tokens, API keys, user data) from being cached by browsers/proxies- To allow caching for a new endpoint, add it to `CACHEABLE_PATHS` in the middleware- Applied to both main API server and external API applications+++### Creating Pull Requests+- Create the PR aginst the `dev` branch of the repository.+- Ensure the branch name is descriptive (e.g., `feature/add-new-block`)/+- Use conventional commit messages (see below)/+- Fill out the .github/PULL_REQUEST_TEMPLATE.md template as the PR description/+- Run the github pre-commit hooks to ensure code quality.++### Conventional Commits++Use this format for commit messages and Pull Request titles:++**Conventional Commit Types:**++- `feat`: Introduces a new feature to the codebase+- `fix`: Patches a bug in the codebase+- `refactor`: Code change that neither fixes a bug nor adds a feature; also applies to removing features+- `ci`: Changes to CI configuration+- `docs`: Documentation-only changes+- `dx`: Improvements to the developer experience++**Recommended Base Scopes:**++- `platform`: Changes affecting both frontend and backend+- `frontend`+- `backend`+- `infra`+- `blocks`: Modifications/additions of individual blocks++**Subscope Examples:**++- `backend/executor`+- `backend/db`+- `frontend/builder` (includes changes to the block UI component)+- `infra/prod`++Use these scopes and subscopes for clarity and consistency in commit messages.diff --git a/autogpt_platform/backend/backend/data/user.py b/autogpt_platform/backend/backend/data/user.pyindex 7102afb0ef..83a62fc73b 100644--- a/autogpt_platform/backend/backend/data/user.py+++ b/autogpt_platform/backend/backend/data/user.py@@ -13,7 +13,7 @@ from prisma.models import Userfrom prisma.types import JsonFilter, UserCreateInput, UserUpdateInputfrom backend.data.db import prisma-from backend.data.model import UserIntegrations, UserMetadata, UserMetadataRaw+from backend.data.model import UserIntegrations, UserMetadatafrom backend.data.notifications import NotificationPreference, NotificationPreferenceDTOfrom backend.server.v2.store.exceptions import DatabaseErrorfrom backend.util.encryption import JSONCryptor@@ -93,22 +93,6 @@ async def create_default_user() -> Optional[User]:return User.model_validate(user)-async def get_user_metadata(user_id: str) -> UserMetadata:- user = await User.prisma().find_unique_or_raise(- where={"id": user_id},- )-- metadata = cast(UserMetadataRaw, user.metadata)- return UserMetadata.model_validate(metadata)---async def update_user_metadata(user_id: str, metadata: UserMetadata):- await User.prisma().update(- where={"id": user_id},- data={"metadata": SafeJson(metadata.model_dump())},- )--async def get_user_integrations(user_id: str) -> UserIntegrations:user = await User.prisma().find_unique_or_raise(where={"id": user_id},diff --git a/autogpt_platform/backend/backend/executor/database.py b/autogpt_platform/backend/backend/executor/database.pyindex 4574216c48..bdf59bc809 100644--- a/autogpt_platform/backend/backend/executor/database.py+++ b/autogpt_platform/backend/backend/executor/database.py@@ -7,7 +7,6 @@ from backend.data.execution import (create_graph_execution,get_block_error_stats,get_execution_kv_data,- get_graph_execution,get_graph_execution_meta,get_graph_executions,get_latest_node_execution,@@ -39,10 +38,8 @@ from backend.data.user import (get_user_email_by_id,get_user_email_verification,get_user_integrations,- get_user_metadata,get_user_notification_preference,update_user_integrations,- update_user_metadata,)from backend.util.service import AppService, AppServiceClient, endpoint_to_sync, exposefrom backend.util.settings import Config@@ -94,7 +91,6 @@ class DatabaseManager(AppService):return cast(Callable[Concatenate[object, P], R], expose(f))# Executions- get_graph_execution = _(get_graph_execution)get_graph_executions = _(get_graph_executions)get_graph_execution_meta = _(get_graph_execution_meta)create_graph_execution = _(create_graph_execution)@@ -122,8 +118,6 @@ class DatabaseManager(AppService):get_credits = _(_get_credits, name="get_credits")# User + User Metadata + User Integrations- get_user_metadata = _(get_user_metadata)- update_user_metadata = _(update_user_metadata)get_user_integrations = _(get_user_integrations)update_user_integrations = _(update_user_integrations)@@ -154,38 +148,21 @@ class DatabaseManagerClient(AppServiceClient):return DatabaseManager# Executions- get_graph_execution = _(d.get_graph_execution)get_graph_executions = _(d.get_graph_executions)get_graph_execution_meta = _(d.get_graph_execution_meta)- create_graph_execution = _(d.create_graph_execution)- get_node_execution = _(d.get_node_execution)get_node_executions = _(d.get_node_executions)- get_latest_node_execution = _(d.get_latest_node_execution)update_node_execution_status = _(d.update_node_execution_status)- update_node_execution_status_batch = _(d.update_node_execution_status_batch)update_graph_execution_start_time = _(d.update_graph_execution_start_time)update_graph_execution_stats = _(d.update_graph_execution_stats)- upsert_execution_input = _(d.upsert_execution_input)upsert_execution_output = _(d.upsert_execution_output)- get_execution_kv_data = _(d.get_execution_kv_data)- set_execution_kv_data = _(d.set_execution_kv_data)# Graphs- get_node = _(d.get_node)- get_graph = _(d.get_graph)- get_connected_output_nodes = _(d.get_connected_output_nodes)get_graph_metadata = _(d.get_graph_metadata)# Creditsspend_credits = _(d.spend_credits)get_credits = _(d.get_credits)- # User + User Metadata + User Integrations- get_user_metadata = _(d.get_user_metadata)- update_user_metadata = _(d.update_user_metadata)- get_user_integrations = _(d.get_user_integrations)- update_user_integrations = _(d.update_user_integrations)-# User Comms - asyncget_active_user_ids_in_timerange = _(d.get_active_user_ids_in_timerange)get_user_email_by_id = _(d.get_user_email_by_id)@@ -232,4 +209,3 @@ class DatabaseManagerAsyncClient(AppServiceClient):update_user_integrations = d.update_user_integrationsget_execution_kv_data = d.get_execution_kv_dataset_execution_kv_data = d.set_execution_kv_data- get_block_error_stats = d.get_block_error_stats