diff --git a/autogpt_platform/backend/backend/api/features/chat/tools/workspace_files.py b/autogpt_platform/backend/backend/api/features/chat/tools/workspace_files.py index c1f381baa6..03532c8fee 100644 --- a/autogpt_platform/backend/backend/api/features/chat/tools/workspace_files.py +++ b/autogpt_platform/backend/backend/api/features/chat/tools/workspace_files.py @@ -4,7 +4,6 @@ import base64 import logging from typing import Any, Optional -from prisma.enums import WorkspaceFileSource from pydantic import BaseModel from backend.api.features.chat.model import ChatSession @@ -27,7 +26,6 @@ class WorkspaceFileInfoData(BaseModel): path: str mime_type: str size_bytes: int - source: str class WorkspaceFileListResponse(ToolResponseBase): @@ -169,7 +167,6 @@ class ListWorkspaceFilesTool(BaseTool): path=f.path, mime_type=f.mimeType, size_bytes=f.sizeBytes, - source=f.source, ) for f in files ] @@ -490,8 +487,6 @@ class WriteWorkspaceFileTool(BaseTool): filename=filename, path=path, mime_type=mime_type, - source=WorkspaceFileSource.COPILOT, - source_session_id=session.session_id, overwrite=overwrite, ) diff --git a/autogpt_platform/backend/backend/data/workspace.py b/autogpt_platform/backend/backend/data/workspace.py index 53e7dc72b5..f3dba0a294 100644 --- a/autogpt_platform/backend/backend/data/workspace.py +++ b/autogpt_platform/backend/backend/data/workspace.py @@ -8,7 +8,6 @@ import logging from datetime import datetime, timezone from typing import Optional -from prisma.enums import WorkspaceFileSource from prisma.models import UserWorkspace, UserWorkspaceFile from prisma.types import UserWorkspaceFileWhereInput @@ -63,9 +62,6 @@ async def create_workspace_file( mime_type: str, size_bytes: int, checksum: Optional[str] = None, - source: WorkspaceFileSource = WorkspaceFileSource.UPLOAD, - source_exec_id: Optional[str] = None, - source_session_id: Optional[str] = None, metadata: Optional[dict] = None, ) -> UserWorkspaceFile: """ @@ -80,9 +76,6 @@ async def create_workspace_file( mime_type: MIME type of the file size_bytes: File size in bytes checksum: Optional SHA256 checksum - source: How the file was created - source_exec_id: Graph execution ID if from execution - source_session_id: Chat session ID if from CoPilot metadata: Optional additional metadata Returns: @@ -102,9 +95,6 @@ async def create_workspace_file( "mimeType": mime_type, "sizeBytes": size_bytes, "checksum": checksum, - "source": source, - "sourceExecId": source_exec_id, - "sourceSessionId": source_session_id, "metadata": SafeJson(metadata or {}), } ) diff --git a/autogpt_platform/backend/backend/util/file.py b/autogpt_platform/backend/backend/util/file.py index 7dbf30bee7..baa9225629 100644 --- a/autogpt_platform/backend/backend/util/file.py +++ b/autogpt_platform/backend/backend/util/file.py @@ -8,8 +8,6 @@ from pathlib import Path from typing import TYPE_CHECKING, Literal from urllib.parse import urlparse -from prisma.enums import WorkspaceFileSource - from backend.util.cloud_storage import get_cloud_storage_handler from backend.util.request import Requests from backend.util.settings import Config @@ -346,8 +344,6 @@ async def store_media_file( file_record = await workspace_manager.write_file( content=content, filename=filename, - source=WorkspaceFileSource.COPILOT, - source_session_id=execution_context.session_id, overwrite=True, ) return MediaFileType(f"workspace://{file_record.id}") diff --git a/autogpt_platform/backend/backend/util/workspace.py b/autogpt_platform/backend/backend/util/workspace.py index d345e41ed1..692c97e03e 100644 --- a/autogpt_platform/backend/backend/util/workspace.py +++ b/autogpt_platform/backend/backend/util/workspace.py @@ -10,7 +10,6 @@ import mimetypes import uuid from typing import Optional -from prisma.enums import WorkspaceFileSource from prisma.errors import UniqueViolationError from prisma.models import UserWorkspaceFile @@ -159,9 +158,6 @@ class WorkspaceManager: filename: str, path: Optional[str] = None, mime_type: Optional[str] = None, - source: WorkspaceFileSource = WorkspaceFileSource.UPLOAD, - source_exec_id: Optional[str] = None, - source_session_id: Optional[str] = None, overwrite: bool = False, ) -> UserWorkspaceFile: """ @@ -175,9 +171,6 @@ class WorkspaceManager: filename: Filename for the file path: Virtual path (defaults to "/{filename}", session-scoped if session_id set) mime_type: MIME type (auto-detected if not provided) - source: How the file was created - source_exec_id: Graph execution ID if from execution - source_session_id: Chat session ID if from CoPilot overwrite: Whether to overwrite existing file at path Returns: @@ -244,9 +237,6 @@ class WorkspaceManager: mime_type=mime_type, size_bytes=len(content), checksum=checksum, - source=source, - source_exec_id=source_exec_id, - source_session_id=source_session_id, ) except UniqueViolationError: # Race condition: another request created a file at this path @@ -266,9 +256,6 @@ class WorkspaceManager: mime_type=mime_type, size_bytes=len(content), checksum=checksum, - source=source, - source_exec_id=source_exec_id, - source_session_id=source_session_id, ) except Exception: # Clean up orphaned storage file on retry failure diff --git a/autogpt_platform/backend/migrations/20260129011611_remove_workspace_file_source/migration.sql b/autogpt_platform/backend/migrations/20260129011611_remove_workspace_file_source/migration.sql new file mode 100644 index 0000000000..2709bc8484 --- /dev/null +++ b/autogpt_platform/backend/migrations/20260129011611_remove_workspace_file_source/migration.sql @@ -0,0 +1,16 @@ +/* + Warnings: + + - You are about to drop the column `source` on the `UserWorkspaceFile` table. All the data in the column will be lost. + - You are about to drop the column `sourceExecId` on the `UserWorkspaceFile` table. All the data in the column will be lost. + - You are about to drop the column `sourceSessionId` on the `UserWorkspaceFile` table. All the data in the column will be lost. + +*/ + +-- AlterTable +ALTER TABLE "UserWorkspaceFile" DROP COLUMN "source", +DROP COLUMN "sourceExecId", +DROP COLUMN "sourceSessionId"; + +-- DropEnum +DROP TYPE "WorkspaceFileSource"; diff --git a/autogpt_platform/backend/schema.prisma b/autogpt_platform/backend/schema.prisma index 67bef8861b..2da898a7ce 100644 --- a/autogpt_platform/backend/schema.prisma +++ b/autogpt_platform/backend/schema.prisma @@ -158,14 +158,6 @@ model UserWorkspace { @@index([userId]) } -// Source of workspace file creation -enum WorkspaceFileSource { - UPLOAD // Direct user upload - EXECUTION // Created by graph execution - COPILOT // Created by CoPilot session - IMPORT // Imported from external source -} - // Individual files in a user's workspace model UserWorkspaceFile { id String @id @default(uuid()) @@ -187,11 +179,6 @@ model UserWorkspaceFile { isDeleted Boolean @default(false) deletedAt DateTime? - // Source tracking - source WorkspaceFileSource @default(UPLOAD) - sourceExecId String? // graph_exec_id if from execution - sourceSessionId String? // chat_session_id if from CoPilot - metadata Json @default("{}") @@unique([workspaceId, path])