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

Feat(web3 env) #60

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions eve/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,22 @@ def load_env(db):
os.environ["DB"] = db

# First try ~/.eve
stage = db == "STAGE"
env_file = ".env.STAGE" if stage else ".env"
eve_file = ".eve.STAGE" if stage else ".eve"
env_file = (
".env.STAGE" if db == "STAGE" else
".env.PROD" if db == "PROD" else
".env.WEB3-STAGE" if db == "WEB3-STAGE" else
".env.WEB3-PROD" if db == "WEB3-PROD" else
".env.STAGE"
)

eve_file = (
".eve.STAGE" if db == "STAGE" else
".eve.PROD" if db == "PROD" else
".eve.WEB3-STAGE" if db == "WEB3-STAGE" else
".eve.WEB3-PROD" if db == "WEB3-PROD" else
".eve.STAGE"
)

eve_path = os.path.join(home_dir, eve_file)

if os.path.exists(eve_path):
Expand Down
2 changes: 1 addition & 1 deletion eve/cli/agent_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def agent():
@agent.command()
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down
2 changes: 1 addition & 1 deletion eve/cli/chat_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def async_chat(agent_name, new_thread=True, debug=False):
@click.command()
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down
13 changes: 10 additions & 3 deletions eve/cli/deploy_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def process_agent(agent_path: Path, env: str):
@click.option("--all", is_flag=True, help="Deploy all configured agents")
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand All @@ -166,8 +166,15 @@ def deploy(agent: str, all: bool, db: str):
# Ensure Modal environment exists
ensure_modal_env_exists()
load_env(db)
env = "stage" if db == "STAGE" else "prod"


env_map = {
"STAGE": "stage",
"PROD": "prod",
"WEB3-STAGE": "web3-stage",
"WEB3-PROD": "web3-prod"
}
env = env_map.get(db, "stage")

if all:
agents = get_deployable_agents(env)
if not agents:
Expand Down
4 changes: 2 additions & 2 deletions eve/cli/start_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@click.argument("agent", nargs=1, required=True)
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down Expand Up @@ -138,7 +138,7 @@ def start(agent: str, db: str, platforms: tuple, local: bool):
)
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down
8 changes: 4 additions & 4 deletions eve/cli/tool_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def tool():
@tool.command()
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down Expand Up @@ -116,7 +116,7 @@ def update(db: str, names: tuple):
@tool.command()
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down Expand Up @@ -155,7 +155,7 @@ def remove(db: str, names: tuple):
@tool.command(context_settings=dict(ignore_unknown_options=True, allow_extra_args=True))
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to load tools from if from mongo",
)
Expand Down Expand Up @@ -214,7 +214,7 @@ def run(ctx, tool: str, db: str):
)
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to load tools from if from mongo",
)
Expand Down
2 changes: 1 addition & 1 deletion eve/cli/upload_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@click.command()
@click.option(
"--db",
type=click.Choice(["STAGE", "PROD"], case_sensitive=False),
type=click.Choice(["STAGE", "PROD", "WEB3-STAGE", "WEB3-PROD"], case_sensitive=False),
default="STAGE",
help="DB to save against",
)
Expand Down
12 changes: 11 additions & 1 deletion eve/clients/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,15 @@ def get_ably_channel_name(agent_username: str, client_platform: ClientType):


def get_eden_creation_url(creation_id: str):
root_url = "beta.eden.art" if db == "PROD" else "staging2.app.eden.art"
if db == "PROD":
root_url = "beta.eden.art"
elif db == "STAGE":
root_url = "staging2.app.eden.art"
elif db == "WEB3-PROD":
root_url = "web3.eden.art"
elif db == "WEB3-STAGE":
root_url = "staging.web3.eden.art"
else:
root_url = "staging2.app.eden.art"

return f"https://{root_url}/creations/{creation_id}"