From d2c766eec90fe60fcef7a55b1c7ca712958677d3 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 27 Apr 2026 09:51:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A4=BE=E4=BA=A4=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=E5=9B=BE=E8=A7=86=E8=A7=89=E9=A3=8E=E6=A0=BC=E5=B9=B6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=BD=BB=E7=A7=91=E5=B9=BB=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/value_rank/main.py | 59 +++++++++--- .../value_rank/templates/social_graph.html | 95 +++++++++++++++++-- 2 files changed, 133 insertions(+), 21 deletions(-) diff --git a/plugins/value_rank/main.py b/plugins/value_rank/main.py index 6946b1e..d26e6ab 100644 --- a/plugins/value_rank/main.py +++ b/plugins/value_rank/main.py @@ -1462,6 +1462,7 @@ class ValueRankPlugin(MessagePluginInterface): cm = ContactManager.get_instance() strongest_uid = selected_nodes[0] if selected_nodes else "" + edge_defs_parts: List[str] = [] edge_svg_parts: List[str] = [] # 边数字标签只给“最重要的少数边”: # 1. 全边标数字时,图面会被 0/1、1/0 这类噪声淹没; @@ -1509,11 +1510,29 @@ class ValueRankPlugin(MessagePluginInterface): ax, ay = pos_map[a] bx, by = pos_map[b] normalized = max(0.12, min(score / max_edge_score, 1.0)) - stroke_width = 1.2 + 6.2 * normalized - opacity = 0.14 + 0.42 * normalized + stroke_width = 1.35 + 6.5 * normalized + glow_width = stroke_width + 3.6 + opacity = 0.20 + 0.48 * normalized + glow_opacity = 0.10 + 0.22 * normalized + edge_gradient_id = f"edge_gradient_{edge_idx}" + start_color = "#50D6FF" + end_color = "#FFBB5C" if (a == strongest_uid or b == strongest_uid) else "#6C92FF" + edge_defs_parts.append( + f'' + f'' + f'' + f'' + ) edge_svg_parts.append( f'' + f'stroke="rgba(84, 214, 255, {glow_opacity:.3f})" stroke-width="{glow_width:.2f}" ' + f'stroke-linecap="round" filter="url(#edgeGlow)" />' + ) + edge_svg_parts.append( + f'' ) if (a, b) not in labeled_edge_keys: continue @@ -1541,8 +1560,9 @@ class ValueRankPlugin(MessagePluginInterface): edge_label_parts.append( f'' f'' - f'{safe_label}' + f'rx="7" ry="7" fill="rgba(16,38,74,0.68)" stroke="rgba(84,214,255,0.34)" stroke-width="1.0" ' + f'filter="url(#panelSoftGlow)">' + f'{safe_label}' f'' ) @@ -1566,10 +1586,20 @@ class ValueRankPlugin(MessagePluginInterface): ring_idx = int(node_meta_map.get(uid, {}).get("ring_idx", 0)) # 使用“连接度越高环线越偏暖”的视觉策略,帮助快速识别核心节点。 - ring_color = "rgba(255, 152, 0, 0.95)" if size_norm >= 0.6 else "rgba(79, 123, 201, 0.95)" + ring_color = "rgba(255, 176, 58, 0.96)" if size_norm >= 0.6 else "rgba(74, 141, 255, 0.96)" + glow_color = "rgba(255, 205, 111, 0.30)" if size_norm >= 0.6 else "rgba(84, 214, 255, 0.26)" + orbit_color = "rgba(255, 211, 130, 0.74)" if size_norm >= 0.6 else "rgba(113, 228, 255, 0.72)" node_svg_parts.append( - f'' + f'' + ) + node_svg_parts.append( + f'' + ) + node_svg_parts.append( + f'' ) if avatar_url: @@ -1613,7 +1643,7 @@ class ValueRankPlugin(MessagePluginInterface): ] crown_points_text = " ".join([f"{px:.1f},{py:.1f}" for px, py in crown_points]) node_svg_parts.append( - f'' + f'' f'' f'' + f'rx="10" ry="10" fill="rgba(17, 41, 79, 0.84)" stroke="{ring_color}" stroke-width="1.6" ' + f'filter="url(#panelSoftGlow)">' ) node_svg_parts.append( f'{badge_text}' + f'font-size="{badge_font_size}" fill="#F4FBFF" font-weight="700">{badge_text}' ) # 名字固定放在头像正下方,避免沿径向排布带来的“漂移感”: @@ -1657,11 +1688,12 @@ class ValueRankPlugin(MessagePluginInterface): label_box_y = title_y - 18.0 node_svg_parts.append( f'' + f'rx="12" ry="12" fill="rgba(14, 33, 66, 0.66)" stroke="rgba(84,214,255,0.24)" stroke-width="1.0" ' + f'filter="url(#panelSoftGlow)">' ) node_svg_parts.append( f'{safe_nick}' + f'font-size="14.5" fill="#F2FAFF" font-weight="700">{safe_nick}' ) group_title = html.escape(ContactManager.get_instance().get_nickname(group_id) or group_id) @@ -1693,6 +1725,7 @@ class ValueRankPlugin(MessagePluginInterface): "__HEIGHT__": str(height), "__GROUP_TITLE__": group_title, "__SUMMARY_TEXT__": summary_text, + "__EDGE_DEFS__": "".join(edge_defs_parts), "__EDGE_SVG__": "".join(edge_svg_parts), "__EDGE_LABELS__": "".join(edge_label_parts), "__NODE_DEFS__": "".join(node_defs_parts), diff --git a/plugins/value_rank/templates/social_graph.html b/plugins/value_rank/templates/social_graph.html index 3ca8e18..d598855 100644 --- a/plugins/value_rank/templates/social_graph.html +++ b/plugins/value_rank/templates/social_graph.html @@ -3,9 +3,18 @@