From 311655de5a859c2a91e17dd3e83fc955347d5426 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 20 Apr 2026 12:22:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89PlayStation=E8=AE=BE=E8=AE=A1=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E9=87=8D=E6=9E=84=E8=8F=9C=E5=8D=95=E7=94=9F=E5=9B=BE?= =?UTF-8?q?=E5=B9=B6=E6=81=A2=E5=A4=8D=E5=85=A8=E9=87=8F=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/robot_menu/menu_render_tool.py | 325 +++++++++++++------------ 1 file changed, 173 insertions(+), 152 deletions(-) diff --git a/plugins/robot_menu/menu_render_tool.py b/plugins/robot_menu/menu_render_tool.py index 368f5db..22ebac4 100644 --- a/plugins/robot_menu/menu_render_tool.py +++ b/plugins/robot_menu/menu_render_tool.py @@ -104,21 +104,17 @@ class RobotMenuRenderTool: return lines def _iter_user_command_features(self) -> list[Feature]: - """筛选“用户可直接触发”的功能集合。 + """返回菜单要展示的功能集合。 - 设计说明: - 1. 为了让菜单图片更短、更直观,只展示存在明确聊天指令的功能; - 2. 纯自动/定时类功能不在图片主体展示,避免干扰普通用户阅读。 + 说明: + 1. 按用户最新要求“不要管之前限制”,这里不再做仅指令功能过滤; + 2. 全量展示 Feature,保证用户在一张图里看到完整功能地图; + 3. 没有显式指令的功能,在卡片中标注为“自动/定时触发”。 """ - result: list[Feature] = [] - for feature in Feature: - _, cmd_hint = self._split_feature_description(feature.description) - if self._extract_command_tokens(cmd_hint): - result.append(feature) - return result + return list(Feature) def build_feature_status_markdown(self, group_id: str) -> str: - """构建紧凑菜单 Markdown(强调“怎么用”,并显示开启/关闭状态)。""" + """构建菜单 Markdown(全量功能 + 状态 + 指令/触发方式)。""" user_features = self._iter_user_command_features() lines = [ "# 机器人功能菜单", @@ -126,10 +122,6 @@ class RobotMenuRenderTool: f"- 目标:`{group_id}`", f"- 生成时间:`{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())}`", "", - "## 快速使用", - "- 发送 `菜单` 可再次查看本图", - "- 以下仅保留用户可直接使用的触发方式", - "", "## 功能与指令", ] for feature in user_features: @@ -154,30 +146,28 @@ class RobotMenuRenderTool: return "
".join(rows) def build_feature_status_html(self, group_id: str) -> str: - """构建菜单 HTML(自定义样式,不复用 md2image 默认样式)。""" - # UI 设计方向(依据用户指定 skill): - # 1. 采用“精致极简 + 信息密度高”的纵向单列排版; - # 2. 仅展示用户可直接触发的功能,保证篇幅短、理解快; - # 3. 使用克制但有辨识度的色彩/字体组合,避免通用模板感。 + """构建 PlayStation 风格菜单 HTML(黑-白-蓝三段式)。""" + # 设计实现说明(基于 DESIGN-playstation.md): + # 1. 三段式表面:黑色英雄区 -> 白色内容区 -> 蓝色底部; + # 2. 主色锚点固定为 PlayStation Blue #0070cc,交互强调色为 #1eaedb; + # 3. 组件采用圆角胶囊/卡片体系,保持信息密度与可读性平衡。 user_features = self._iter_user_command_features() feature_cards = [] + enabled_count = 0 for feature in user_features: title, _ = self._split_feature_description(feature.description) command_examples = self._get_feature_command_examples(feature) status = GroupBotManager.get_group_permission(group_id, feature) is_enabled = status == PermissionStatus.ENABLED + if is_enabled: + enabled_count += 1 status_text = "开启" if is_enabled else "关闭" status_class = "status-on" if is_enabled else "status-off" - # 为纵向卡片增加轻量色彩分组,提升视觉节奏感,避免纯白卡片过于单调。 - try: - tone_idx = int(feature.value) % 4 - except Exception: - tone_idx = 0 feature_cards.append( f""" -
+
-
{feature.value}
+
{feature.value:02d}

{html.escape(title)}

功能键:{html.escape(feature.name)}

@@ -199,189 +189,220 @@ class RobotMenuRenderTool:
+
PlayStation Style Interface

机器人功能菜单

-

目标群/会话:{html.escape(group_id)}

-

生成时间:{now_text}

+

用户功能查看中心 · 直达命令与状态一屏可见

+
+ 目标:{html.escape(group_id)} + 功能总数:{len(user_features)} + 已开启:{enabled_count} + 生成时间:{now_text} +
-

快速上手

-
-
-
-
A
-
-

查看菜单

-

菜单

-
-
-
-

发送一次即可查看全部功能卡片

-
-
-
-
-
B
-
-

展示范围

-

用户直接可用指令

-
-
-
-

当前共 {len(user_features)} 项

-
-
-
-
-
-

功能与指令

+

功能卡片

{''.join(feature_cards)}
+