From 97d5bf87f3ecea2432d9ef2f649ccc4637e5ed0b Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 11 Aug 2026 20:57:03 +0800 Subject: [PATCH] =?UTF-8?q?demo:=204=20=E4=B8=AA=E7=AE=97=E5=AD=90?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=A0=E3=80=8C=E5=8A=A0=E8=BD=BD=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E3=80=8D=E9=85=8D=E7=BD=AE=E6=91=98=E8=A6=81=E5=8D=A1?= =?UTF-8?q?=E7=89=87=EF=BC=88=E7=82=B9=E5=87=BB=20#load=20=E5=90=8E?= =?UTF-8?q?=E5=8F=AF=E8=A7=81=E5=8F=8D=E9=A6=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit secure_metrics / secure_stats / dp_primitives / aggregator_chain 的 #load 原本只设参数 + 一闪而过的 toast,用户看不到任何变化、觉得没加载。 在 controls 下方加一个可见的 #load-info 卡片,#load 时把参数转成易读描述(如 'n=50 条样本 · 质量=好(ACC>0.8) · 噪声 σ=0.15 · 满例占比~50% · 点击跑密文评估后端会随机生成 n 条 y_true/y_prob 并真跑 nax.ml.metrics'),让用户明确'参数加载上了'。 ole_paillier 与 scql_explain 已有可见的 input/textarea 填充,无需修改。k8s_two_party 按用户要求保持纯文档。 Playwright 真实浏览器验证:4 模块 load-info display:block、内容正确、无 JS 报错。 --- demo/aggregator_chain/index.html | 9 +++++++++ demo/dp_primitives/index.html | 12 ++++++++++++ demo/secure_metrics/index.html | 11 +++++++++++ demo/secure_stats/index.html | 9 +++++++++ 4 files changed, 41 insertions(+) diff --git a/demo/aggregator_chain/index.html b/demo/aggregator_chain/index.html index b67d11d..9e3bcfc 100644 --- a/demo/aggregator_chain/index.html +++ b/demo/aggregator_chain/index.html @@ -54,6 +54,8 @@ + +

链式聚合流程(每参与方一段向量)

@@ -76,6 +78,13 @@ const $ = (s) => document.querySelector(s); $('#load').onclick = () => { $('#n').value = 3; $('#d').value = 4; $('#clip_c').value = 2.0; $('#zero_t').value = 10.0; $('#sigma').value = 0.5; + $('#load-info').innerHTML = + `📦 已加载示例配置 · ` + + `${$('#n').value} 个参与方 · ` + + `每方 ${$('#d').value} 维向量 · ` + + `链路:Clipping(C=${$('#clip_c').value}) → Zeroing(>${$('#zero_t').value}) → SecureSum → Mean(÷N=${$('#n').value}) → GaussianNoise(σ=${$('#sigma').value}) · ` + + `15% 概率生成大值触发裁剪/清零 · 点击「▶ 跑聚合链」真跑 nax.ml.aggregators.build_chain`; + $('#load-info').style.display = ''; toast('已加载示例'); }; diff --git a/demo/dp_primitives/index.html b/demo/dp_primitives/index.html index 7459882..4a3962c 100644 --- a/demo/dp_primitives/index.html +++ b/demo/dp_primitives/index.html @@ -62,6 +62,8 @@ table th, table td { padding: 6px 10px; border-bottom: 1px solid var(--border);
+ +

DP 流程:裁剪 → 加噪 → 隐私账本

@@ -114,6 +116,16 @@ const $ = (s) => document.querySelector(s); $('#load').onclick = () => { $('#n').value = 200; $('#clip_c').value = 5; $('#sigma').value = 1.0; $('#q').value = 0.5; $('#steps').value = 10; $('#mech').value = 'gaussian'; + $('#load-info').innerHTML = + `📦 已加载示例配置 · ` + + `n=${$('#n').value} 条记录 · ` + + `裁剪 C=${$('#clip_c').value} · ` + + `σ=${$('#sigma').value} · ` + + `采样率 q=${$('#q').value} · ` + + `机制=${$('#mech').value === 'gaussian' ? '高斯 (ε,δ)-DP' : '拉普拉斯 ε-DP'} · ` + + `连发 ${$('#steps').value} 次 · ` + + `点击「▶ 跑 DP 释放」真跑 nax.privacy.dp 的 clip_l2 → gaussian_noise/laplace_noise → GaussianAccountant`; + $('#load-info').style.display = ''; toast('已加载示例'); }; diff --git a/demo/secure_metrics/index.html b/demo/secure_metrics/index.html index e059f66..b2322e8 100644 --- a/demo/secure_metrics/index.html +++ b/demo/secure_metrics/index.html @@ -54,6 +54,8 @@ table th, table td { padding: 6px 10px; border-bottom: 1px solid var(--border);
+ +

密文评估结果(reveal to Alice)

@@ -99,6 +101,15 @@ const $ = (s) => document.querySelector(s); $('#load').onclick = () => { $('#n').value = 50; $('#quality').value = 'good'; + const qMap = { good: '好(ACC>0.8)', med: '中(~0.7)', bad: '差(~0.55)' }; + const noiseMap = { good: 0.15, med: 0.30, bad: 0.45 }; + $('#load-info').innerHTML = + `📦 已加载示例配置 · ` + + `n=${$('#n').value} 条样本 · ` + + `质量=${qMap[$('#quality').value]} · ` + + `噪声 σ=${noiseMap[$('#quality').value]} · ` + + `正例占比~50% · 点击「▶ 跑密文评估」后端会随机生成 n 条 y_true/y_prob 并真跑 nax.ml.metrics`; + $('#load-info').style.display = ''; toast('已加载:模型评估示例'); }; diff --git a/demo/secure_stats/index.html b/demo/secure_stats/index.html index 293fe95..2be1372 100644 --- a/demo/secure_stats/index.html +++ b/demo/secure_stats/index.html @@ -53,6 +53,8 @@
+ +

密文均值 / 方差 / 皮尔逊

@@ -107,6 +109,13 @@ const $ = (s) => document.querySelector(s); $('#load').onclick = () => { $('#n').value = 20; $('#r').value = 0.85; + $('#load-info').innerHTML = + `📦 已加载示例配置 · ` + + `n=${$('#n').value} 对 (Alice 年龄 + Bob 保费) · ` + + `真实相关系数 r=${$('#r').value} · ` + + `年龄分布 20-70 岁,保费 ≈ ${$('#r').value} × (年龄-45) × 200 + 噪声 · ` + + `点击「▶ 跑密文统计」真跑 nax.data.stats 算 secure_mean/var/pearson/correlation_matrix`; + $('#load-info').style.display = ''; toast('已加载:医院年龄 vs 保险保费示例'); };