perf(methods): 通过移除不必要的 self 参数优化方法签名
在包括 chat、plugin_system、schedule 和 mais4u 在内的多个模块中,消除冗余的实例引用。此次改动将无需访问实例状态的实用函数转换为静态方法,从而提升了内存效率,并使方法依赖关系更加清晰。
This commit is contained in:
@@ -58,7 +58,7 @@ class MessageBuilder:
|
||||
self,
|
||||
image_format: str,
|
||||
image_base64: str,
|
||||
support_formats: list[str] = SUPPORTED_IMAGE_FORMATS, # 默认支持格式
|
||||
support_formats=None, # 默认支持格式
|
||||
) -> "MessageBuilder":
|
||||
"""
|
||||
添加图片内容
|
||||
@@ -66,6 +66,8 @@ class MessageBuilder:
|
||||
:param image_base64: 图片的base64编码
|
||||
:return: MessageBuilder对象
|
||||
"""
|
||||
if support_formats is None:
|
||||
support_formats = SUPPORTED_IMAGE_FORMATS
|
||||
if image_format.lower() not in support_formats:
|
||||
raise ValueError("不受支持的图片格式")
|
||||
if not image_base64:
|
||||
|
||||
Reference in New Issue
Block a user