Skip to content

Commit

Permalink
Fixing client_version error (#547)
Browse files Browse the repository at this point in the history
* Fixing client_version error
  • Loading branch information
dristysrivastava authored Sep 13, 2024
1 parent ad4e67b commit 2b0d6d4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pebblo/app/api/req_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ReqDiscover(BaseModel):
framework: Framework
chains: Optional[List[ChainInfo]] = None
plugin_version: str
client_version: Framework
client_version: Optional[Framework] = None


class ReqLoaderDoc(BaseModel):
Expand Down
1 change: 1 addition & 0 deletions pebblo/app/models/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class AiBaseApp(BaseModel):
] = [] # list of policy id, title and other details
pebbloServerVersion: Optional[str] = None
pebbloClientVersion: Optional[str] = None
clientVersion: Optional[FrameworkInfo] = None
model_config = ConfigDict(arbitrary_types_allowed=True, use_enum_values=True)


Expand Down
10 changes: 6 additions & 4 deletions pebblo/app/service/discovery/discovery_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ def create_app_obj(
current_time = get_current_time()

metadata = Metadata(createdAt=current_time, modifiedAt=current_time)
client_version = FrameworkInfo(
name=self.data.get("client_version", {}).get("name"),
version=self.data.get("client_version", {}).get("version"),
)
client_version = None
if self.data.get("client_version"):
client_version = FrameworkInfo(
name=self.data.get("client_version", {}).get("name"),
version=self.data.get("client_version", {}).get("version"),
)
ai_app_obj = {
"metadata": metadata,
"description": self.data.get("description", "-"),
Expand Down
10 changes: 6 additions & 4 deletions pebblo/app/service/discovery_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ def _create_ai_apps_model(
createdAt=self._get_current_datetime(),
modifiedAt=self._get_current_datetime(),
)
client_version = FrameworkInfo(
name=self.data.get("client_version", {}).get("name"),
version=self.data.get("client_version", {}).get("version"),
)
client_version = None
if self.data.get("client_version"):
client_version = FrameworkInfo(
name=self.data.get("client_version", {}).get("name"),
version=self.data.get("client_version", {}).get("version"),
)
ai_apps_model = AiApp(
metadata=metadata,
name=self.data.get("name"),
Expand Down

0 comments on commit 2b0d6d4

Please sign in to comment.