perf(methods): 通过移除不必要的 self 参数优化方法签名
在包括 chat、plugin_system、schedule 和 mais4u 在内的多个模块中,消除冗余的实例引用。此次改动将无需访问实例状态的实用函数转换为静态方法,从而提升了内存效率,并使方法依赖关系更加清晰。
This commit is contained in:
@@ -627,9 +627,9 @@ class LLMRequest:
|
||||
logger.error(f"任务-'{task_name}' 模型-'{model_name}': 未知异常,错误信息-{str(e)}")
|
||||
return -1, None # 不再重试请求该模型
|
||||
|
||||
@staticmethod
|
||||
def _check_retry(
|
||||
self,
|
||||
remain_try: int,
|
||||
remain_try: int,
|
||||
retry_interval: int,
|
||||
can_retry_msg: str,
|
||||
cannot_retry_msg: str,
|
||||
@@ -747,7 +747,8 @@ class LLMRequest:
|
||||
)
|
||||
return -1, None
|
||||
|
||||
def _build_tool_options(self, tools: Optional[List[Dict[str, Any]]]) -> Optional[List[ToolOption]]:
|
||||
@staticmethod
|
||||
def _build_tool_options(tools: Optional[List[Dict[str, Any]]]) -> Optional[List[ToolOption]]:
|
||||
# sourcery skip: extract-method
|
||||
"""构建工具选项列表"""
|
||||
if not tools:
|
||||
@@ -811,7 +812,8 @@ class LLMRequest:
|
||||
|
||||
return final_text
|
||||
|
||||
def _inject_random_noise(self, text: str, intensity: int) -> str:
|
||||
@staticmethod
|
||||
def _inject_random_noise(text: str, intensity: int) -> str:
|
||||
"""在文本中注入随机乱码"""
|
||||
import random
|
||||
import string
|
||||
|
||||
Reference in New Issue
Block a user