Skip to content

Commit 47e94e3

Browse files
authored
Merge pull request #1866 from Agenta-AI/feature/age-396-bug-overwriting-an-app-from-cli
[Bug fix]: CLI overwriting an app does not update configuration #1863
2 parents 804895e + bba03e2 commit 47e94e3

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

agenta-backend/agenta_backend/services/db_manager.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,10 @@ async def update_variant_parameters(
17811781
raise NoResultFound(f"App variant with id {app_variant_id} not found")
17821782

17831783
# Update associated ConfigDB parameters
1784-
app_variant_db.config_parameters.update(parameters)
1784+
if parameters == {}:
1785+
app_variant_db.config_parameters = {}
1786+
else:
1787+
app_variant_db.config_parameters.update(parameters)
17851788

17861789
# ...and variant versioning
17871790
app_variant_db.revision += 1 # type: ignore

agenta-cli/agenta/sdk/agenta_init.py

+4-12
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,6 @@ def __new__(cls):
2626
cls._instance = super(AgentaSingleton, cls).__new__(cls)
2727
return cls._instance
2828

29-
@property
30-
def client(self):
31-
"""API Backend client.
32-
33-
Returns:
34-
AgentaAPI: instance of agenta api backend
35-
"""
36-
37-
return AgentaApi(base_url=self.host + "/api", api_key=self.api_key)
38-
3929
def init(
4030
self,
4131
app_id: Optional[str] = None,
@@ -95,15 +85,17 @@ def init(
9585

9686

9787
class Config:
98-
def __init__(self, base_id: str, host: str, api_key: str = ""):
88+
def __init__(self, base_id: str, host: str, api_key: Optional[str] = ""):
9989
self.base_id = base_id
10090
self.host = host
10191

10292
if base_id is None or host is None:
10393
self.persist = False
10494
else:
10595
self.persist = True
106-
self.client = AgentaApi(base_url=self.host + "/api", api_key=api_key)
96+
self.client = AgentaApi(
97+
base_url=self.host + "/api", api_key=api_key if api_key else ""
98+
)
10799

108100
def register_default(self, overwrite=False, **kwargs):
109101
"""alias for default"""

0 commit comments

Comments
 (0)