perf: to_dict in the base class

This commit is contained in:
Soulter
2025-05-28 03:26:42 -04:00
parent 4e1bef414a
commit 12c4ae4b10
+4
View File
@@ -102,6 +102,10 @@ class BaseMessageComponent(BaseModel):
data[k] = v
return {"type": self.type.lower(), "data": data}
async def to_dict(self) -> dict:
# 默认情况下,回退到旧的同步 toDict()
return self.toDict()
class Plain(BaseMessageComponent):
type: ComponentType = "Plain"