Feat/assistant app (#2086)

Co-authored-by: chenhe <guchenhe@gmail.com>
Co-authored-by: Pascal M <11357019+perzeuss@users.noreply.github.com>
This commit is contained in:
Yeuoly 2024-01-23 19:58:23 +08:00 committed by GitHub
commit 86286e1ac8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
175 changed files with 11619 additions and 1235 deletions

View file

@ -0,0 +1,21 @@
from pydantic import BaseModel
from enum import Enum
from typing import List
def serialize_base_model_array(l: List[BaseModel]) -> str:
class _BaseModel(BaseModel):
__root__: List[BaseModel]
"""
{"__root__": [BaseModel, BaseModel, ...]}
"""
return _BaseModel(__root__=l).json()
def serialize_base_model_dict(b: dict) -> str:
class _BaseModel(BaseModel):
__root__: dict
"""
{"__root__": {BaseModel}}
"""
return _BaseModel(__root__=b).json()