chore: 更新 PL 相关知识图谱并修复 update-graph.sh 探测逻辑

使用本机 graphify CLI 强制重建 backend/web-admin 图谱;脚本改为优先走 PATH 中的 graphify。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-07-19 17:22:31 +08:00
1 parent aa5fbe7780
commit 6d9354a194
10 files changed
+481537 -950244

No files matched your search

+1 -10
View File
@@ -159,13 +159,8 @@
"157": "Community 157",
"158": "Community 158",
"159": "Community 159",
"160": "Community 160",
"161": "Community 161",
"162": "Community 162",
"163": "Community 163",
"164": "Community 164",
"165": "Community 165",
"166": "Community 166",
"167": "Community 167",
"168": "Community 168",
"169": "Community 169",
@@ -173,9 +168,5 @@
"171": "Community 171",
"172": "Community 172",
"173": "Community 173",
"174": "Community 174",
"175": "Community 175",
"176": "Community 176",
"177": "Community 177",
"178": "Community 178"
"174": "Community 174"
}
+1 -1
View File
@@ -1 +1 @@
/Users/zlwu/work/00code/shanxia2.0/backend
backend
File diff suppressed because it is too large. Load diff
+307
View File
@@ -0,0 +1,307 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>graphify - backend/graphify-out/graph.html</title>
<script src="https://unpkg.com/vis-network@9.1.6/standalone/umd/vis-network.min.js"
integrity="sha384-Ux6phic9PEHJ38YtrijhkzyJ8yQlH8i/+buBR8s3mAZOJrP1gwyvAcIYl3GWtpX1"
crossorigin="anonymous"></script>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f1a; color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
#graph { flex: 1; }
#sidebar { width: 280px; background: #1a1a2e; border-left: 1px solid #2a2a4e; display: flex; flex-direction: column; overflow: hidden; }
#search-wrap { padding: 12px; border-bottom: 1px solid #2a2a4e; }
#search { width: 100%; background: #0f0f1a; border: 1px solid #3a3a5e; color: #e0e0e0; padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
#search:focus { border-color: #4E79A7; }
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid #2a2a4e; display: none; }
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item:hover { background: #2a2a4e; }
#info-panel { padding: 14px; border-bottom: 1px solid #2a2a4e; min-height: 140px; }
#info-panel h3 { font-size: 13px; color: #aaa; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
#info-content { font-size: 13px; color: #ccc; line-height: 1.6; }
#info-content .field { margin-bottom: 5px; }
#info-content .field b { color: #e0e0e0; }
#info-content .empty { color: #555; font-style: italic; }
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #333; }
.neighbor-link:hover { background: #2a2a4e; }
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
#legend-wrap h3 { font-size: 13px; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
.legend-item:hover { background: #2a2a4e; padding-left: 4px; }
.legend-item.dimmed { opacity: 0.35; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: #666; font-size: 11px; }
#stats { padding: 10px 14px; border-top: 1px solid #2a2a4e; font-size: 11px; color: #555; }
#legend-controls { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 4px 0; }
#legend-controls label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; color: #aaa; user-select: none; }
#legend-controls label:hover { color: #e0e0e0; }
.legend-cb, #select-all-cb { appearance: none; -webkit-appearance: none; width: 14px; height: 14px; border: 1.5px solid #3a3a5e; border-radius: 3px; background: #0f0f1a; cursor: pointer; position: relative; flex-shrink: 0; }
.legend-cb:checked, #select-all-cb:checked { background: #4E79A7; border-color: #4E79A7; }
.legend-cb:checked::after, #select-all-cb:checked::after { content: ''; position: absolute; left: 3.5px; top: 1px; width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#select-all-cb:indeterminate { background: #4E79A7; border-color: #4E79A7; }
#select-all-cb:indeterminate::after { content: ''; position: absolute; left: 2px; top: 5px; width: 8px; height: 2px; background: #fff; border: none; transform: none; }
</style>
</head>
<body>
<div id="graph"></div>
<div id="sidebar">
<div id="search-wrap">
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
<div id="search-results"></div>
</div>
<div id="info-panel">
<h3>Node Info</h3>
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
</div>
<div id="legend-wrap">
<h3>Communities</h3>
<div id="legend-controls">
<label><input type="checkbox" id="select-all-cb" checked onchange="toggleAllCommunities(!this.checked)">Select All</label>
</div>
<div id="legend"></div>
</div>
<div id="stats">3969 nodes &middot; 14567 edges &middot; 170 communities</div>
</div>
<script>
const RAW_NODES = [{"id": "app_init", "label": "__init__.py", "color": {"background": "#76B7B2", "border": "#76B7B2", "highlight": {"background": "#ffffff", "border": "#76B7B2"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 123, "community_name": "Community 123", "source_file": "app/__init__.py", "file_type": "code", "degree": 0}, {"id": "app_api_init", "label": "__init__.py", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.7, "font": {"size": 0, "color": "#ffffff"}, "title": "__init__.py", "community": 9, "community_name": "Community 9", "source_file": "app/api/__init__.py", "file_type": "code", "degree": 10}, {"id": "app_api_init_rationale_1", "label": "API \u8def\u7531\u5305 \u2014 \u5c71\u5ce1\u5316\u5de5\u751f\u4ea7\u4e00\u4f53\u5316\u95e8\u6237", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.1, "font": {"size": 0, "color": "#ffffff"}, "title": "API \u8def\u7531\u5305 \u2014 \u5c71\u5ce1\u5316\u5de5\u751f\u4ea7\u4e00\u4f53\u5316\u95e8\u6237", "community": 9, "community_name": "Community 9", "source_file": "app/api/__init__.py", "file_type": "rationale", "degree": 1}, {"id": "app_api_admin", "label": "admin.py", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 17.2, "font": {"size": 12, "color": "#ffffff"}, "title": "admin.py", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 110}, {"id": "app_api_admin_list_roles_for_select", "label": "list_roles_for_select()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": "list_roles_for_select()", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 5}, {"id": "app_api_admin_py_session", "label": "Session", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 13.5, "font": {"size": 0, "color": "#ffffff"}, "title": "Session", "community": 18, "community_name": "Community 18", "source_file": "", "file_type": "code", "degree": 53}, {"id": "app_api_admin_list_users_for_select", "label": "list_users_for_select()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.4, "font": {"size": 0, "color": "#ffffff"}, "title": "list_users_for_select()", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 6}, {"id": "app_api_admin_list_roles_for_designer", "label": "list_roles_for_designer()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.4, "font": {"size": 0, "color": "#ffffff"}, "title": "list_roles_for_designer()", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 6}, {"id": "app_api_admin_tenantcreatebody", "label": "TenantCreateBody", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "TenantCreateBody", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 7}, {"id": "app_api_admin_tenantupdatebody", "label": "TenantUpdateBody", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.5, "font": {"size": 0, "color": "#ffffff"}, "title": "TenantUpdateBody", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 7}, {"id": "app_api_admin_list_tenants", "label": "list_tenants()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.2, "font": {"size": 0, "color": "#ffffff"}, "title": "list_tenants()", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 3}, {"id": "app_api_admin_create_tenant", "label": "create_tenant()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.3, "font": {"size": 0, "color": "#ffffff"}, "title": "create_tenant()", "community": 18, "community_name": "Community 18", "source_file": "app/api/admin.py", "file_type": "code", "degree": 5}, {"id": "app_api_admin_update_tenant", "label": "update_tenant()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"Line truncated
const RAW_EDGES = [{"from": "app_api_init", "to": "app_api_admin", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_bx_init", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_crm", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_db_init", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_leave", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_menu", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_monitor", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_public", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init", "to": "app_api_workflow", "label": "re_exports", "title": "re_exports [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_init_rationale_1", "to": "app_api_init", "label": "rationale_for", "title": "rationale_for [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_attachment_download_url", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_attachment_preview_url", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_attachmentdownloadurlbody", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_dept", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_dict_data", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_dict_type", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_menu", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_post", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_role_management", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_site", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_tenant", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_create_user", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_delete_dept", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_delete_dict_data", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "app_api_admin", "to": "app_api_admin_delete_dict_type", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {Line truncated
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Community 0", "count": 226}, {"cid": 1, "color": "#F28E2B", "label": "Community 1", "count": 1}, {"cid": 2, "color": "#E15759", "label": "Community 2", "count": 12}, {"cid": 3, "color": "#76B7B2", "label": "Community 3", "count": 85}, {"cid": 4, "color": "#59A14F", "label": "Community 4", "count": 29}, {"cid": 5, "color": "#EDC948", "label": "Community 5", "count": 36}, {"cid": 6, "color": "#B07AA1", "label": "Community 6", "count": 41}, {"cid": 7, "color": "#FF9DA7", "label": "Community 7", "count": 38}, {"cid": 8, "color": "#9C755F", "label": "Community 8", "count": 74}, {"cid": 9, "color": "#BAB0AC", "label": "Community 9", "count": 64}, {"cid": 10, "color": "#4E79A7", "label": "Community 10", "count": 37}, {"cid": 11, "color": "#F28E2B", "label": "Community 11", "count": 55}, {"cid": 12, "color": "#E15759", "label": "Community 12", "count": 31}, {"cid": 13, "color": "#76B7B2", "label": "Community 13", "count": 35}, {"cid": 14, "color": "#59A14F", "label": "Community 14", "count": 95}, {"cid": 15, "color": "#EDC948", "label": "Community 15", "count": 31}, {"cid": 16, "color": "#B07AA1", "label": "Community 16", "count": 12}, {"cid": 17, "color": "#FF9DA7", "label": "Community 17", "count": 61}, {"cid": 18, "color": "#9C755F", "label": "Community 18", "count": 91}, {"cid": 19, "color": "#BAB0AC", "label": "Community 19", "count": 41}, {"cid": 20, "color": "#4E79A7", "label": "Community 20", "count": 34}, {"cid": 21, "color": "#F28E2B", "label": "Community 21", "count": 70}, {"cid": 22, "color": "#E15759", "label": "Community 22", "count": 57}, {"cid": 23, "color": "#76B7B2", "label": "Community 23", "count": 31}, {"cid": 24, "color": "#59A14F", "label": "Community 24", "count": 29}, {"cid": 25, "color": "#EDC948", "label": "Community 25", "count": 29}, {"cid": 26, "color": "#B07AA1", "label": "Community 26", "count": 50}, {"cid": 27, "color": "#FF9DA7", "label": "Community 27", "count": 25}, {"cid": 28, "color": "#9C755F", "label": "Community 28", "count": 27}, {"cid": 29, "color": "#BAB0AC", "label": "Community 29", "count": 67}, {"cid": 30, "color": "#4E79A7", "label": "Community 30", "count": 63}, {"cid": 31, "color": "#F28E2B", "label": "Community 31", "count": 34}, {"cid": 32, "color": "#E15759", "label": "Community 32", "count": 33}, {"cid": 33, "color": "#76B7B2", "label": "Community 33", "count": 30}, {"cid": 34, "color": "#59A14F", "label": "Community 34", "count": 24}, {"cid": 35, "color": "#EDC948", "label": "Community 35", "count": 21}, {"cid": 36, "color": "#B07AA1", "label": "Community 36", "count": 39}, {"cid": 37, "color": "#FF9DA7", "label": "Community 37", "count": 28}, {"cid": 38, "color": "#9C755F", "label": "Community 38", "count": 20}, {"cid": 39, "color": "#BAB0AC", "label": "Community 39", "count": 29}, {"cid": 40, "color": "#4E79A7", "label": "Community 40", "count": 21}, {"cid": 41, "color": "#F28E2B", "label": "Community 41", "count": 20}, {"cid": 42, "color": "#E15759", "label": "Community 42", "count": 73}, {"cid": 43, "color": "#76B7B2", "label": "Community 43", "count": 32}, {"cid": 44, "color": "#59A14F", "label": "Community 44", "count": 14}, {"cid": 45, "color": "#EDC948", "label": "Community 45", "count": 48}, {"cid": 46, "color": "#B07AA1", "label": "Community 46", "count": 30}, {"cid": 47, "color": "#FF9DA7", "label": "Community 47", "count": 1}, {"cid": 48, "color": "#9C755F", "label": "Community 48", "count": 36}, {"cid": 49, "color": "#BAB0AC", "label": "Community 49", "count": 38}, {"cid": 50, "color": "#4E79A7", "label": "Community 50", "count": 20}, {"cid": 51, "color": "#F28E2B", "label": "Community 51", "count": 23}, {"cid": 52, "color": "#E15759", "label": "Community 52", "count": 20}, {"cid": 53, "color": "#76B7B2", "label": "Community 53", "count": 27}, {"cid": 54, "color": "#59A14F", "label": "Community 54", "count": 32}, {"cid": 55, "color": "#EDC948", "label": "Community 55", "count": 51}, {"cid": 56, "color": "#B07AA1", "label": "Community 56", "count": 23}, {"cid": 57, "color": "#FF9DA7", "label": "Community 57", "count": 41}, {"cid": 58, "color": "#9C755F", "label": "Community 58", "count": 13}, {"cid": 59, "color": "#BAB0AC", "label": "Community 59", "count": 18}, {"cid": 60, "color": "#4E79A7", "label": "Community 60", "count": 23}, {"cid": 61, "color": "#F28E2B", "label": "Community 61", "count": 24}, {"cid": 62, "color": "#E15759", "label": "Community 62", "count": 16}, {"cid": 63, "color": "#76B7B2", "label": "Community 63", "count": 25}, {"cid": 64, "color": "#59A14F", "label": "Community 64", "count": 28}, {"cid": 65, "color": "#EDC948", "label": "Community 65", "count": 11}, {"cid": 66, "color": "#B07AA1", "label": "Community 66", "count": 18}, {"cid": 67, "color": "#FF9DA7", "label": "Community 67", "count": 28}, {"cid": 68, "color": "#9C755F", "label": "Community 68", "count": 19}, {"cid": 69, "color": "#BAB0AC", "label": "Community 69", "count": 16}, {"cid": 70, "color": "#4E79A7", "lLine truncated
// HTML-escape helper — prevents XSS when injecting graph data into innerHTML
function esc(s) {
return String(s).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#39;');
}
// Build vis datasets
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({
id: n.id, label: n.label, color: n.color, size: n.size,
font: n.font, title: n.title,
_community: n.community, _community_name: n.community_name,
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
})));
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
id: i, from: e.from, to: e.to,
label: '',
title: e.title,
dashes: e.dashes,
width: e.width,
color: e.color,
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
})));
const container = document.getElementById('graph');
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
physics: {
enabled: true,
solver: 'forceAtlas2Based',
forceAtlas2Based: {
gravitationalConstant: -60,
centralGravity: 0.005,
springLength: 120,
springConstant: 0.08,
damping: 0.4,
avoidOverlap: 0.8,
},
stabilization: { iterations: 200, fit: true },
},
interaction: {
hover: true,
tooltipDelay: 100,
hideEdgesOnDrag: true,
navigationButtons: false,
keyboard: false,
},
nodes: { shape: 'dot', borderWidth: 1.5 },
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
});
network.once('stabilizationIterationsDone', () => {
network.setOptions({ physics: { enabled: false } });
});
function showInfo(nodeId) {
const n = nodesDS.get(nodeId);
if (!n) return;
const neighborIds = network.getConnectedNodes(nodeId);
const neighborItems = neighborIds.map(nid => {
const nb = nodesDS.get(nid);
const color = nb ? nb.color.background : '#555';
return `<span class="neighbor-link" style="border-left-color:${esc(color)}" onclick="focusNode(${JSON.stringify(nid)})">${esc(nb ? nb.label : nid)}</span>`;
}).join('');
document.getElementById('info-content').innerHTML = `
<div class="field"><b>${esc(n.label)}</b></div>
<div class="field">Type: ${esc(n._file_type || 'unknown')}</div>
<div class="field">Community: ${esc(n._community_name)}</div>
<div class="field">Source: ${esc(n._source_file || '-')}</div>
<div class="field">Degree: ${n._degree}</div>
${neighborIds.length ? `<div class="field" style="margin-top:8px;color:#aaa;font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>` : ''}
`;
}
function focusNode(nodeId) {
network.focus(nodeId, { scale: 1.4, animation: true });
network.selectNodes([nodeId]);
showInfo(nodeId);
}
// Track hovered node — hover detection is more reliable than click params
let hoveredNodeId = null;
network.on('hoverNode', params => {
hoveredNodeId = params.node;
container.style.cursor = 'pointer';
});
network.on('blurNode', () => {
hoveredNodeId = null;
container.style.cursor = 'default';
});
container.addEventListener('click', () => {
if (hoveredNodeId !== null) {
showInfo(hoveredNodeId);
network.selectNodes([hoveredNodeId]);
}
});
network.on('click', params => {
if (params.nodes.length > 0) {
showInfo(params.nodes[0]);
} else if (hoveredNodeId === null) {
document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
}
});
const searchInput = document.getElementById('search');
const searchResults = document.getElementById('search-results');
searchInput.addEventListener('input', () => {
const q = searchInput.value.toLowerCase().trim();
searchResults.innerHTML = '';
if (!q) { searchResults.style.display = 'none'; return; }
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
if (!matches.length) { searchResults.style.display = 'none'; return; }
searchResults.style.display = 'block';
matches.forEach(n => {
const el = document.createElement('div');
el.className = 'search-item';
el.textContent = n.label;
el.style.borderLeft = `3px solid ${n.color.background}`;
el.style.paddingLeft = '8px';
el.onclick = () => {
network.focus(n.id, { scale: 1.5, animation: true });
network.selectNodes([n.id]);
showInfo(n.id);
searchResults.style.display = 'none';
searchInput.value = '';
};
searchResults.appendChild(el);
});
});
document.addEventListener('click', e => {
if (!searchResults.contains(e.target) && e.target !== searchInput)
searchResults.style.display = 'none';
});
const hiddenCommunities = new Set();
const selectAllCb = document.getElementById('select-all-cb');
function updateSelectAllState() {
const total = LEGEND.length;
const hidden = hiddenCommunities.size;
selectAllCb.checked = hidden === 0;
selectAllCb.indeterminate = hidden > 0 && hidden < total;
}
function toggleAllCommunities(hide) {
document.querySelectorAll('.legend-item').forEach(item => {
hide ? item.classList.add('dimmed') : item.classList.remove('dimmed');
});
document.querySelectorAll('.legend-cb').forEach(cb => {
cb.checked = !hide;
});
LEGEND.forEach(c => {
if (hide) hiddenCommunities.add(c.cid); else hiddenCommunities.delete(c.cid);
});
const updates = RAW_NODES.map(n => ({ id: n.id, hidden: hide }));
nodesDS.update(updates);
updateSelectAllState();
}
const legendEl = document.getElementById('legend');
LEGEND.forEach(c => {
const item = document.createElement('div');
item.className = 'legend-item';
const cb = document.createElement('input');
cb.type = 'checkbox';
cb.className = 'legend-cb';
cb.checked = true;
cb.addEventListener('change', (e) => {
e.stopPropagation();
if (cb.checked) {
hiddenCommunities.delete(c.cid);
item.classList.remove('dimmed');
} else {
hiddenCommunities.add(c.cid);
item.classList.add('dimmed');
}
const updates = RAW_NODES
.filter(n => n.community === c.cid)
.map(n => ({ id: n.id, hidden: !cb.checked }));
nodesDS.update(updates);
updateSelectAllState();
});
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
<span class="legend-label">${c.label}</span>
<span class="legend-count">${c.count}</span>`;
item.prepend(cb);
item.onclick = (e) => {
if (e.target === cb) return;
cb.checked = !cb.checked;
cb.dispatchEvent(new Event('change'));
};
legendEl.appendChild(item);
});
</script>
<script>
// Render hyperedges as shaded regions
const hyperedges = [];
// afterDrawing passes ctx already transformed to network coordinate space.
// Draw node positions raw — no manual pan/zoom/DPR math needed.
network.on('afterDrawing', function(ctx) {
hyperedges.forEach(h => {
const positions = h.nodes
.map(nid => network.getPositions([nid])[nid])
.filter(p => p !== undefined);
if (positions.length < 2) return;
ctx.save();
ctx.globalAlpha = 0.12;
ctx.fillStyle = '#6366f1';
ctx.strokeStyle = '#6366f1';
ctx.lineWidth = 2;
ctx.beginPath();
// Centroid and expanded hull in network coordinates
const cx = positions.reduce((s, p) => s + p.x, 0) / positions.length;
const cy = positions.reduce((s, p) => s + p.y, 0) / positions.length;
const expanded = positions.map(p => ({
x: cx + (p.x - cx) * 1.15,
y: cy + (p.y - cy) * 1.15
}));
ctx.moveTo(expanded[0].x, expanded[0].y);
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.fill();
ctx.globalAlpha = 0.4;
ctx.stroke();
// Label
ctx.globalAlpha = 0.8;
ctx.fillStyle = '#4f46e5';
ctx.font = 'bold 11px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(h.label, cx, cy - 5);
ctx.restore();
});
});
</script>
</body>
</html>
+186361 -480344
View File
File diff suppressed because it is too large. Load diff
+22 -6
View File
@@ -9,13 +9,29 @@
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
PYTHON="/Users/zlwu/.pyenv/versions/3.12.13/bin/python"
# 检查 graphify 是否可用
if ! "$PYTHON" -m graphify --help >/dev/null 2>&1; then
echo "[graphify] 未安装,请运行: $PYTHON -m pip install graphify"
# 优先使用 PATH 中的 graphify;其次尝试本机常见 Python
run_graphify() {
if command -v graphify >/dev/null 2>&1; then
graphify "$@"
return
fi
local py
for py in \
"${GRAPHIFY_PYTHON:-}" \
"$ROOT_DIR/backend/venv/bin/python" \
"$(command -v python3 2>/dev/null || true)" \
"/Users/zlwu/.pyenv/versions/3.12.13/bin/python"
do
[ -n "$py" ] && [ -x "$py" ] || continue
if "$py" -m graphify --help >/dev/null 2>&1; then
"$py" -m graphify "$@"
return
fi
done
echo "[graphify] 未找到可用的 graphify。请安装 CLI(如: pipx install graphifyy)或设置 GRAPHIFY_PYTHON。"
exit 1
fi
}
# 更新单个项目的图谱
update_graph() {
@@ -30,7 +46,7 @@ update_graph() {
return 1
fi
"$PYTHON" -m graphify update "$ROOT_DIR/$name" --force
run_graphify update "$ROOT_DIR/$name" --force
echo "[graphify] ${label} 图谱更新完成 ✓"
}
+78 -1
View File
@@ -733,8 +733,85 @@
"731": "Community 731",
"732": "Community 732",
"733": "Community 733",
"734": "修复",
"735": "修复",
"736": "修复",
"737": "Community 737",
"738": "Community 738",
"739": "修复",
"740": "修复",
"741": "Community 741",
"742": "Community 742"
"742": "Community 742",
"743": "修复",
"744": "修复",
"745": "修改",
"746": "升级",
"747": "升级",
"748": "升级",
"749": "升级",
"750": "变更类型",
"751": "[已发布]",
"752": "新增",
"753": "新增",
"754": "新增",
"755": "新增",
"756": "新增",
"757": "新增",
"758": "新增",
"759": "新增",
"760": "新增",
"761": "新增",
"762": "新增",
"763": "新增",
"764": "新增",
"765": "新增",
"766": "新增",
"767": "更新日志",
"768": "版本号规则",
"769": "移除",
"770": "移除",
"771": "许可证",
"772": "重构",
"773": "重构",
"774": "重构",
"775": "重构",
"776": "重构",
"777": "重构",
"778": "重构",
"779": "重构",
"780": "重构",
"781": "重构",
"782": "重构",
"783": "重构",
"784": "重构",
"785": "⚠️ 重要提示",
"786": "⚠️ 重要提示",
"787": "⚠️ 重要提示",
"788": "⚠️ 重要提示",
"789": "⚠️ 重要提示",
"790": "⚠️ 重要提示",
"791": "⚠️ 重要提示",
"792": "code:bash (# Install dependencies)",
"793": "code:bash (pnpm clean:dev)",
"794": "技术支持",
"795": "兼容性",
"796": "贡献",
"797": "捐赠",
"798": "code:bash (# 安装依赖)",
"799": "code:bash (pnpm clean:dev)",
"800": "安装运行",
"801": "快速访问",
"802": "持续优化与扩展",
"803": "精简版本",
"804": "这个项目有什么特别的呢?",
"805": "预览",
"806": "handleArrange",
"807": "handleEdit",
"808": "handlePrintDeliverySlip",
"809": "handlePrintInboundSlip",
"810": "handlePrintSubpackSlip",
"811": "handleAdd",
"812": "handleAddDictData",
"813": "handleEdit",
"814": "handleEditDictData"
}
+1 -1
View File
@@ -1 +1 @@
/Users/zlwu/work/00code/shanxia2.0/web-admin
web-admin
File diff suppressed because it is too large. Load diff
+293274 -467996
View File
File diff suppressed because it is too large. Load diff