perf(methods): 通过移除不必要的 self 参数优化方法签名
在包括 chat、plugin_system、schedule 和 mais4u 在内的多个模块中,消除冗余的实例引用。此次改动将无需访问实例状态的实用函数转换为静态方法,从而提升了内存效率,并使方法依赖关系更加清晰。
This commit is contained in:
@@ -243,7 +243,8 @@ class ActionModifier:
|
||||
|
||||
return deactivated_actions
|
||||
|
||||
def _generate_context_hash(self, chat_content: str) -> str:
|
||||
@staticmethod
|
||||
def _generate_context_hash(chat_content: str) -> str:
|
||||
"""生成上下文的哈希值用于缓存"""
|
||||
context_content = f"{chat_content}"
|
||||
return hashlib.md5(context_content.encode("utf-8")).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user