fix(router.py): handle id being passed in as int

This commit is contained in:
Krrish Dholakia 2024-04-04 14:22:50 -07:00
parent 9638e244f8
commit 48a5948081
7 changed files with 29 additions and 4 deletions

View file

@ -37,9 +37,11 @@ class ModelInfo(BaseModel):
str
] # Allow id to be optional on input, but it will always be present as a str in the model instance
def __init__(self, id: Optional[str] = None, **params):
def __init__(self, id: Optional[Union[str, int]] = None, **params):
if id is None:
id = str(uuid.uuid4()) # Generate a UUID if id is None or not provided
elif isinstance(id, int):
id = str(id)
super().__init__(id=id, **params)
class Config: