Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Use env vars from DB

Tomas Valenta25033847a8fc
diff --git a/api-service/app.py b/api-service/app.py
index 89c9e5a8b..74295e218 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -48,17 +48,12 @@ async def generate():
method = body["method"]
route = body["route"]
- # TODO: STOP SENDING ENVS FROM FRONTEND BECAUSE WE FETCH THEM FROM DB
- envs: List[EnvVar] = body["envs"]
-
- # `get_env_vars()` returns a list of dicts. See the docstring comment inside `get_env_vars`
- env = await db.get_env_vars(project_id)
- # TODO: ------------------
await db.create_deployment(run_id=run_id, project_id=project_id, route_id=route_id)
playground = None
try:
# Create playground for the LLM
+ envs = await db.get_env_vars(project_id)
playground_tools, playground = create_playground_tools(
envs=envs,
route=route,
diff --git a/api-service/database/database.py b/api-service/database/database.py
index 2b13b9b26..a5e8c6491 100644
--- a/api-service/database/database.py
+++ b/api-service/database/database.py
@@ -4,6 +4,7 @@ from enum import Enum
# from supabase.client import create_client
from database.client import Client
+from session.env import EnvVar
class DeploymentState(Enum):
@@ -69,7 +70,7 @@ class Database:
"id", run_id
).execute()
- async def get_env_vars(self, project_id: str) -> List[Dict[str, str]]:
+ async def get_env_vars(self, project_id: str) -> List[EnvVar]:
"""The return value is a list of dicts with the following keys:
- key: The name of an env var
- value: The value of an env var