diff --git a/agenta-backend/agenta_backend/__init__.py b/agenta-backend/agenta_backend/__init__.py index 836ab52bfc..1f17607a17 100644 --- a/agenta-backend/agenta_backend/__init__.py +++ b/agenta-backend/agenta_backend/__init__.py @@ -1,4 +1,4 @@ import os -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: import agenta_backend.cloud.__init__ diff --git a/agenta-backend/agenta_backend/main.py b/agenta-backend/agenta_backend/main.py index e4ac583174..ee083eea25 100644 --- a/agenta-backend/agenta_backend/main.py +++ b/agenta-backend/agenta_backend/main.py @@ -57,12 +57,12 @@ async def lifespan(application: FastAPI, cache=True): allow_headers=allow_headers, ) -if os.environ["FEATURE_FLAG"] not in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] not in ["cloud", "ee"]: from agenta_backend.services.auth_helper import authentication_middleware app.middleware("http")(authentication_middleware) -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: import agenta_backend.cloud.main as cloud app, allow_headers = cloud.extend_main(app) diff --git a/agenta-backend/agenta_backend/routers/app_router.py b/agenta-backend/agenta_backend/routers/app_router.py index d02da7b3b4..0ff57c034b 100644 --- a/agenta-backend/agenta_backend/routers/app_router.py +++ b/agenta-backend/agenta_backend/routers/app_router.py @@ -26,7 +26,7 @@ ) from agenta_backend.models import converters -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all @@ -326,23 +326,14 @@ async def create_app_and_variant_from_template( logger.debug("Step 1: Getting user and organization ID") user_org_data: dict = await get_user_and_org_id(request.state.user_id) - # Check if the user has reached app limit - logger.debug("Step 2: Checking user app limit") - if os.environ["FEATURE_FLAG"] == "demo": - if await db_manager.count_apps(**user_org_data) > 2: - raise HTTPException( - status_code=500, - detail="Sorry, you can only create two Apps at this time.", - ) - - logger.debug("Step 3: Setting organization ID") + logger.debug("Step 2: Setting organization ID") if payload.organization_id is None: organization = await get_user_own_org(user_org_data["uid"]) organization_id = organization.id else: organization_id = payload.organization_id - logger.debug(f"Step 4: Checking if app {payload.app_name} already exists") + logger.debug(f"Step 3 Checking if app {payload.app_name} already exists") app_name = payload.app_name.lower() app = await db_manager.fetch_app_by_name_and_organization( app_name, organization_id, **user_org_data @@ -353,13 +344,13 @@ async def create_app_and_variant_from_template( detail=f"App with name {app_name} already exists", ) - logger.debug("Step 5: Creating new app and initializing environments") + logger.debug("Step 4: Creating new app and initializing environments") if app is None: app = await db_manager.create_app_and_envs( app_name, organization_id, **user_org_data ) - logger.debug("Step 5 (extra): Retrieve template from db") + logger.debug("Step 5: Retrieve template from db") template_db = await db_manager.get_template(payload.template_id) repo_name = os.environ.get("AGENTA_TEMPLATE_REPO", "agentaai/lambda_templates") image_name = f"{repo_name}:{template_db.name}" @@ -392,7 +383,7 @@ async def create_app_and_variant_from_template( ) logger.debug("Step 8: Starting variant and injecting environment variables") - if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: + if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: if not os.environ["OPENAI_API_KEY"]: raise HTTPException( status_code=400, diff --git a/agenta-backend/agenta_backend/routers/bases_router.py b/agenta-backend/agenta_backend/routers/bases_router.py index 54ddfb60f4..bda4d348fb 100644 --- a/agenta-backend/agenta_backend/routers/bases_router.py +++ b/agenta-backend/agenta_backend/routers/bases_router.py @@ -6,7 +6,7 @@ from agenta_backend.services import db_manager from agenta_backend.models import converters -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/configs_router.py b/agenta-backend/agenta_backend/routers/configs_router.py index d01d8c21b9..d0a09ac5e5 100644 --- a/agenta-backend/agenta_backend/routers/configs_router.py +++ b/agenta-backend/agenta_backend/routers/configs_router.py @@ -12,7 +12,7 @@ app_manager, ) -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/container_router.py b/agenta-backend/agenta_backend/routers/container_router.py index d645966ecf..d789aafc42 100644 --- a/agenta-backend/agenta_backend/routers/container_router.py +++ b/agenta-backend/agenta_backend/routers/container_router.py @@ -10,7 +10,7 @@ from fastapi import APIRouter, Request, UploadFile, HTTPException from fastapi.responses import JSONResponse -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/environment_router.py b/agenta-backend/agenta_backend/routers/environment_router.py index 1ba2c4ce9c..3c68ec6349 100644 --- a/agenta-backend/agenta_backend/routers/environment_router.py +++ b/agenta-backend/agenta_backend/routers/environment_router.py @@ -10,7 +10,7 @@ DeployToEnvironmentPayload, ) -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/evaluation_router.py b/agenta-backend/agenta_backend/routers/evaluation_router.py index 6833f85199..3561ca15df 100644 --- a/agenta-backend/agenta_backend/routers/evaluation_router.py +++ b/agenta-backend/agenta_backend/routers/evaluation_router.py @@ -44,7 +44,7 @@ from agenta_backend.models import converters from agenta_backend.services import results_service -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( # noqa pylint: disable-all get_user_and_org_id, ) diff --git a/agenta-backend/agenta_backend/routers/observability_router.py b/agenta-backend/agenta_backend/routers/observability_router.py index 29b7033208..1896005492 100644 --- a/agenta-backend/agenta_backend/routers/observability_router.py +++ b/agenta-backend/agenta_backend/routers/observability_router.py @@ -26,7 +26,7 @@ UpdateTrace, ) -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/organization_router.py b/agenta-backend/agenta_backend/routers/organization_router.py index 7c48d0cd6e..c78f9606b6 100644 --- a/agenta-backend/agenta_backend/routers/organization_router.py +++ b/agenta-backend/agenta_backend/routers/organization_router.py @@ -12,7 +12,7 @@ ) from agenta_backend.services import db_manager -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/testset_router.py b/agenta-backend/agenta_backend/routers/testset_router.py index e8ccd70bbc..4138fbc76c 100644 --- a/agenta-backend/agenta_backend/routers/testset_router.py +++ b/agenta-backend/agenta_backend/routers/testset_router.py @@ -26,7 +26,7 @@ router = APIRouter() -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/user_profile.py b/agenta-backend/agenta_backend/routers/user_profile.py index 01f7aa907d..9af12d6226 100644 --- a/agenta-backend/agenta_backend/routers/user_profile.py +++ b/agenta-backend/agenta_backend/routers/user_profile.py @@ -6,7 +6,7 @@ router = APIRouter() -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all diff --git a/agenta-backend/agenta_backend/routers/variants_router.py b/agenta-backend/agenta_backend/routers/variants_router.py index 912b525a0d..503a8ce541 100644 --- a/agenta-backend/agenta_backend/routers/variants_router.py +++ b/agenta-backend/agenta_backend/routers/variants_router.py @@ -24,7 +24,7 @@ VariantActionEnum, ) -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services.selectors import ( get_user_and_org_id, ) # noqa pylint: disable-all @@ -247,7 +247,7 @@ async def start_variant( user_org_data: dict = await get_user_and_org_id(request.state.user_id) # Inject env vars to docker container - if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: + if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: if not os.environ["OPENAI_API_KEY"]: raise HTTPException( status_code=400, diff --git a/agenta-backend/agenta_backend/services/app_manager.py b/agenta-backend/agenta_backend/services/app_manager.py index 5f147e76ba..f09867f0d2 100644 --- a/agenta-backend/agenta_backend/services/app_manager.py +++ b/agenta-backend/agenta_backend/services/app_manager.py @@ -24,7 +24,7 @@ else: from agenta_backend.services import deployment_manager -if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: +if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: from agenta_backend.cloud.services import ( api_key_service, ) # noqa pylint: disable-all @@ -77,7 +77,7 @@ async def start_variant( env_vars.update( {"AGENTA_BASE_ID": str(db_app_variant.base.id), "AGENTA_HOST": domain_name} ) - if os.environ["FEATURE_FLAG"] in ["cloud", "ee", "demo"]: + if os.environ["FEATURE_FLAG"] in ["cloud", "ee"]: api_key = await api_key_service.create_api_key( str(db_app_variant.user.uid), expiration_date=None, hidden=True ) diff --git a/agenta-backend/agenta_backend/services/db_manager.py b/agenta-backend/agenta_backend/services/db_manager.py index 4df77e1e75..9df8b95fb9 100644 --- a/agenta-backend/agenta_backend/services/db_manager.py +++ b/agenta-backend/agenta_backend/services/db_manager.py @@ -575,7 +575,7 @@ async def get_user(user_uid: str) -> UserDB: user = await engine.find_one(UserDB, UserDB.uid == user_uid) if user is None: - if os.environ["FEATURE_FLAG"] not in ["cloud", "ee", "demo"]: + if os.environ["FEATURE_FLAG"] not in ["cloud", "ee"]: create_user = UserDB(uid="0") await engine.save(create_user) diff --git a/agenta-backend/agenta_backend/services/deployment_manager.py b/agenta-backend/agenta_backend/services/deployment_manager.py index 651a970419..8a3b71b2ad 100644 --- a/agenta-backend/agenta_backend/services/deployment_manager.py +++ b/agenta-backend/agenta_backend/services/deployment_manager.py @@ -74,10 +74,7 @@ async def remove_image(image: Image): None """ try: - if ( - os.environ["FEATURE_FLAG"] not in ["cloud", "ee", "demo"] - and image.deletable - ): + if os.environ["FEATURE_FLAG"] not in ["cloud", "ee"] and image.deletable: docker_utils.delete_image(image.docker_id) logger.info(f"Image {image.docker_id} deleted") except RuntimeError as e: diff --git a/agenta-web/cypress/support/commands/utils.ts b/agenta-web/cypress/support/commands/utils.ts index 5e6f7cf5b9..8f7bd5b3fc 100644 --- a/agenta-web/cypress/support/commands/utils.ts +++ b/agenta-web/cypress/support/commands/utils.ts @@ -5,7 +5,7 @@ Cypress.Commands.add("clickLinkAndWait", (selector) => { export const isDemo = () => { if (Cypress.env["NEXT_PUBLIC_FF"]) { - return ["demo", "cloud", "ee"].includes(Cypress.env["NEXT_PUBLIC_FF"]) + return ["cloud", "ee"].includes(Cypress.env["NEXT_PUBLIC_FF"]) } return false } diff --git a/agenta-web/src/lib/helpers/utils.ts b/agenta-web/src/lib/helpers/utils.ts index e2e063d2f6..4c7d94f5de 100644 --- a/agenta-web/src/lib/helpers/utils.ts +++ b/agenta-web/src/lib/helpers/utils.ts @@ -136,7 +136,7 @@ export const getInitials = (str: string, limit = 2) => { export const isDemo = () => { if (process.env.NEXT_PUBLIC_FF) { - return ["demo", "cloud", "ee"].includes(process.env.NEXT_PUBLIC_FF) + return ["cloud", "ee"].includes(process.env.NEXT_PUBLIC_FF) } return false }