From 8388a7a5ec38140bb5a84c0fb7625825a42b4f2e Mon Sep 17 00:00:00 2001 From: Abram Date: Tue, 23 Apr 2024 18:21:51 +0100 Subject: [PATCH] Refactor: make use of variant action when starting variant and accessed uri --- agenta-cli/agenta/cli/variant_commands.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/agenta-cli/agenta/cli/variant_commands.py b/agenta-cli/agenta/cli/variant_commands.py index 195f34bd0c..dd26ccb992 100644 --- a/agenta-cli/agenta/cli/variant_commands.py +++ b/agenta-cli/agenta/cli/variant_commands.py @@ -9,13 +9,15 @@ import click import questionary import toml + from agenta.cli import helper from agenta.cli.telemetry import event_track +from agenta.client.backend.client import AgentaApi +from agenta.client.api import add_variant_to_server from agenta.client.api_models import AppVariant, Image from agenta.docker.docker_utils import build_tar_docker_container +from agenta.client.backend.types.variant_action import VariantActionEnum, VariantAction -from agenta.client.api import add_variant_to_server -from agenta.client.backend.client import AgentaApi BACKEND_URL_SUFFIX = os.environ.get("BACKEND_URL_SUFFIX", "api") @@ -260,8 +262,11 @@ def start_variant(variant_id: str, app_folder: str, host: str): ) endpoint = client.variants.start_variant( - variant_id=variant_id, action={"action": "START"} - ) + variant_id=variant_id, + action=VariantAction( + action=VariantActionEnum.START, + ), + ).uri click.echo("\n" + click.style("Congratulations! 🎉", bold=True, fg="green")) click.echo( click.style("Your app has been deployed locally as an API. 🚀", fg="cyan")