diff --git a/admin/dashboard/static/favicon_logosc.zip b/admin/dashboard/static/favicon_logosc.zip new file mode 100644 index 0000000..ac2b3cb Binary files /dev/null and b/admin/dashboard/static/favicon_logosc.zip differ diff --git a/admin/dashboard/static/logo.png b/admin/dashboard/static/logo.png new file mode 100644 index 0000000..466ff2e Binary files /dev/null and b/admin/dashboard/static/logo.png differ diff --git a/robot.py b/robot.py index 29d8724..d76ee7f 100644 --- a/robot.py +++ b/robot.py @@ -202,10 +202,12 @@ class Robot(Job): Feature.AI_CAPABILITY) == PermissionStatus.DISABLED: return True else: - if msg.type == 1: # 只处理类型为1的消息提供的问题,引用@不予以对话 - rsp = self.chat.get_answer(q, (msg.roomid if msg.from_group() else msg.sender)) - else: - return True + msg = self.gbm.get_enabled_features(msg.roomid) + self.message_util.send_text_msg(msg, (msg.roomid if msg.from_group() else msg.sender), msg.sender) + # if msg.type == 1: # 只处理类型为1的消息提供的问题,引用@不予以对话 + # rsp = self.chat.get_answer(q, (msg.roomid if msg.from_group() else msg.sender)) + # else: + return True if rsp: if msg.from_group(): self.send_text_msg(rsp, msg.roomid, msg.sender) diff --git a/robot_cmd/robot_command.py b/robot_cmd/robot_command.py index 51a5c7a..75a7410 100644 --- a/robot_cmd/robot_command.py +++ b/robot_cmd/robot_command.py @@ -27,7 +27,7 @@ class Feature(Enum): ROBOT = 1, "群机器人" DAILY_NEWS = 2, "每日新闻自动播报" DAILY_SUMMARY = 3, "每日群发言总结" - AI_CAPABILITY = 4, "群AI能力" + AI_CAPABILITY = 4, "群AI能力 [ai, dify, 聊天, AI] " SUMMARY_CAPABILITY = 5, "群总结能力 [#总结]" PDF_CAPABILITY = 6, "sehuatang PDF能力" EPIC = 7, "EPIC自动播报" # 新增的功能 @@ -226,6 +226,45 @@ class GroupBotManager: menu.append(f"{feature.value}. {feature.description}") return "\n".join(menu) + @staticmethod + def get_enabled_features(group_id): + """获取某个群已启用的功能列表及其描述,并返回格式化的字符串 + 只返回描述中包含指令(方括号[])的功能 + + Args: + group_id: 群ID + + Returns: + str: 格式化的已启用功能列表字符串 + """ + enabled_features = [] + + # 检查群是否在列表中 + if group_id not in GroupBotManager.local_cache["group_list"]: + return "该群未启用机器人功能" + + # 遍历所有功能,检查哪些已启用且包含指令 + for feature in Feature: + status = GroupBotManager.get_group_permission(group_id, feature) + # 只添加已启用且描述中包含方括号的功能 + if status == PermissionStatus.ENABLED and "[" in feature.description and "]" in feature.description: + enabled_features.append({ + "id": feature.value, + "name": feature.name, + "description": feature.description + }) + + # 如果没有启用任何带指令的功能 + if not enabled_features: + return "该群未启用任何带指令的功能" + + # 构建格式化的字符串 + result = f"群功能菜单:\n" + for feature in enabled_features: + result += f"{feature['id']}.{feature['name']}:{feature['description']}\n" + + return result + @staticmethod def get_group_list(): """返回所有启用了群机器人的群组清单,格式为集合"""