@@ -59,11 +59,6 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
self.LOG = logger
|
||||
# 注册功能权限
|
||||
self.feature = self.register_feature()
|
||||
# 百科问答里只有“出题 / 判题”会真正走 LLM:
|
||||
# 1. `/t` 需要模型随机生成题目;
|
||||
# 2. `/a` 需要模型判分并给理由;
|
||||
# 3. `/s /r /l /h` 主要是本地 DB 读写,保持前台即可。
|
||||
self._background_commands = {"/t", "/a"}
|
||||
|
||||
def initialize(self, context: Dict[str, Any]) -> bool:
|
||||
"""初始化插件"""
|
||||
@@ -123,22 +118,6 @@ class GameTaskPlugin(MessagePluginInterface):
|
||||
|
||||
return command in self._commands
|
||||
|
||||
def get_message_dispatch_mode(self, message: Dict[str, Any]) -> str:
|
||||
"""只把 LLM 型命令切到后台,避免百科插件拖慢前台消息链。"""
|
||||
content = str(message.get("content", "") or "").strip()
|
||||
command = content.split()[0] if content else ""
|
||||
if command in self._background_commands:
|
||||
return self.normalize_message_dispatch_mode("background")
|
||||
return super().get_message_dispatch_mode(message)
|
||||
|
||||
def get_message_process_timeout_seconds(self, message: Dict[str, Any]) -> Optional[int]:
|
||||
"""为出题/判题命令单独放宽超时,兼容慢模型或排队场景。"""
|
||||
content = str(message.get("content", "") or "").strip()
|
||||
command = content.split()[0] if content else ""
|
||||
if command in self._background_commands:
|
||||
return 120
|
||||
return None
|
||||
|
||||
def calculate_game_points(self, message: Dict[str, Any], success: bool, response: str) -> int:
|
||||
"""计算游戏积分"""
|
||||
if not success:
|
||||
|
||||
Reference in New Issue
Block a user