mslxdff 0.1.82 → 0.1.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mslxdff",
3
- "version": "0.1.82",
3
+ "version": "0.1.83",
4
4
  "description": "测试项目,请勿使用。",
5
5
  "type": "module",
6
6
  "bin": {
@@ -91,7 +91,15 @@ export function formatViaReport(results, { peers = [], meta = {}, json = false }
91
91
  const isDirectBest = bestKey === "direct";
92
92
  const directCell = pad(`${directTxt}${isDirectBest ? "★" : ""}`, colW, "right");
93
93
  const viaCells = peerIds.map((pid) => {
94
- const v = r.via?.[pid];
94
+ // via keys 可能存为完整 url(如 http://172...)而 peerIds 已短化,兼容两者
95
+ let v = r.via?.[pid];
96
+ if (!v) {
97
+ // 尝试完整 url 变体
98
+ const full = Object.keys(r.via || {}).find((k) => {
99
+ try { const u = new URL(k); return (u.hostname + (u.port ? `:${u.port}` : "")) === pid; } catch { return false; }
100
+ });
101
+ if (full) v = r.via[full];
102
+ }
95
103
  if (!v) return pad("—", colW, "right");
96
104
  if (v.ok) {
97
105
  const txt = `${v.ttfbMs ?? v.totalMs ?? "—"}ms`;
package/src/bench/via.js CHANGED
@@ -101,8 +101,10 @@ export async function orchestrateVia({
101
101
  for (const peer of peers) {
102
102
  const raw = String(peer.name || peer.id || peer.url || "peer");
103
103
  let peerId = raw;
104
- // 仅当 raw 本身就是 url 时才短化;显式 name/id 保持原样,避免 B b:8989
105
- if (!peer.name && !peer.id && raw.includes("://")) { try { const u = new URL(raw); peerId = u.hostname + (u.port ? `:${u.port}` : ""); } catch { peerId = raw.slice(-16); } }
104
+ // 组员 name 可能存为完整 url(如 http://172.93...),统一短化为 host:port,防止 report peerIds 与 via keys 不一致导致表格空白
105
+ if (raw.includes("://")) {
106
+ try { const u = new URL(raw); const host = u.hostname; const port = u.port ? `:${u.port}` : ""; if (host) peerId = `${host}${port}`; else peerId = raw.slice(-16); } catch { peerId = raw.slice(-16); }
107
+ }
106
108
  const peerToken = peer.token || token || "";
107
109
  try {
108
110
  const r = await viaProbeFn({ peerUrl: peer.url, token: peerToken, providerId: provider, model, prompt: "hi", maxTokens: 5, timeoutMs, clock });