dsh-model 0.19.0 → 0.19.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin/client.js +34 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-model",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Many model sources behind one authenticated OpenAI-compatible endpoint for DeepSeek Harness (dsh) and your tools: WorkBuddy, OpenCode Zen and your CLI subscriptions (Codex, Kimi…), with a management page inside dsh. 多家模型汇成一个 OpenAI 兼容地址,dsh 和其他软件都能直接用。",
5
5
  "keywords": [
6
6
  "dsh-plugin",
package/plugin/client.js CHANGED
@@ -328,6 +328,16 @@ window.__ModuleLoader__.load({
328
328
 
329
329
  // —— 来源 ——
330
330
  const RISKY_KEY = 'dsh-model.showRisky'
331
+ const REST_KEY = 'dsh-model.showSignedOut'
332
+ /** 用户选过就按他选的;没选过返回 null(由是否已有登录的来源决定) */
333
+ const readShowRest = () => {
334
+ try {
335
+ const v = window.localStorage.getItem(REST_KEY)
336
+ return v === '1' ? true : v === '0' ? false : null
337
+ } catch {
338
+ return null
339
+ }
340
+ }
331
341
  const readRisky = () => {
332
342
  try { return window.localStorage.getItem(RISKY_KEY) === '1' } catch { return false }
333
343
  }
@@ -430,16 +440,16 @@ window.__ModuleLoader__.load({
430
440
  if (!window.confirm(s.kind === 'apikey' ? L(`删除 ${s.label} 的 key?(它的模型会从 dsh 里消失)`, `Remove the ${s.label} key? (its models disappear from dsh)`) : L(`退出 ${s.label} 的登录?(它的模型会从 dsh 里消失)`, `Sign out of ${s.label}? (its models disappear from dsh)`))) return
431
441
  try { await api('POST', `/sources/${s.id}/logout`); await reload() } catch (e) { setErr(e.message) }
432
442
  }
433
- return h('div', { style: S.section },
434
- h('div', { style: S.line },
435
- h('div', { style: { ...S.h, ...S.grow, margin: 0 } }, L('来源', 'Sources')),
436
- h('label', { style: { ...S.meta, display: 'flex', alignItems: 'center', gap: 6, cursor: 'pointer' } },
437
- h('input', { type: 'checkbox', checked: showRisky, onChange: (e) => toggleRisky(e.target.checked) }),
438
- L(`显示高风险来源${!showRisky && hidden ? `(${hidden})` : ''}`, `Show high-risk sources${!showRisky && hidden ? ` (${hidden})` : ''}`))),
439
- h('p', { style: S.note }, L('打开就接入,没登录会弹出登录;关闭只停用,登录保留。标「需付费」的来源,要先在那家开通套餐,登录后才能用。', 'Turn on to connect (signs in if needed); turning off keeps the sign-in. Sources marked Paid need a plan from that provider before they work.')),
440
- err ? h('div', { style: { fontSize: 12, color: C.err, margin: '0 0 8px' } }, err) : null,
441
- showRisky ? h('p', { style: { ...S.note, color: C.warn } }, L('高风险来源(Claude、Antigravity):服务商有封禁第三方使用订阅的先例,账号可能被封。仅在你清楚风险时使用。', 'High-risk sources (Claude, Antigravity): the providers have banned third-party use of subscriptions before; your account may be suspended. Use only if you accept the risk.')) : null,
442
- h('div', { style: S.card }, visible.map((s, i) => h('div', { key: s.id, style: i ? S.row : S.rowFirst },
443
+ // 已登录的照常列出;没登录的收进一个可折叠的列表(默认收起;一个都没登录时默认展开)
444
+ const signedIn = visible.filter((s) => s.loggedIn)
445
+ const rest = visible.filter((s) => !s.loggedIn)
446
+ const [restPref, setRestPref] = useState(readShowRest)
447
+ const openRest = restPref ?? signedIn.length === 0
448
+ const toggleRest = (v) => {
449
+ setRestPref(v)
450
+ try { window.localStorage.setItem(REST_KEY, v ? '1' : '0') } catch { /* 无痕模式:只在本次生效 */ }
451
+ }
452
+ const row = (s, i) => h('div', { key: s.id, style: i ? S.row : S.rowFirst },
443
453
  h('div', { style: S.line },
444
454
  h(Switch, { on: s.enabled, busy: busy[s.id], label: s.label, onChange: (on) => toggle(s, on) }),
445
455
  h('div', { style: S.grow },
@@ -459,7 +469,20 @@ window.__ModuleLoader__.load({
459
469
  L(s.pricing.zh, s.pricing.en),
460
470
  s.subscribeUrl && s.kind === 'local' ? h('a', { href: s.subscribeUrl, target: '_blank', rel: 'noopener noreferrer', style: { color: C.accent, marginLeft: 8 } }, L('去下载 ↗', 'Download ↗')) : null,
461
471
  s.subscribeUrl && s.pricing.tier !== 'free' ? h('a', { href: s.subscribeUrl, target: '_blank', rel: 'noopener noreferrer', style: { color: C.accent, marginLeft: 8 } }, s.kind === 'opencode' ? L('去充值 ↗', 'Top up ↗') : L('看套餐 ↗', 'Plans ↗')) : null) : null,
462
- !s.loggedIn && s.detail ? h('div', { style: { ...S.meta, paddingLeft: 46, marginTop: 4 } }, s.detail) : null))))
472
+ !s.loggedIn && s.detail ? h('div', { style: { ...S.meta, paddingLeft: 46, marginTop: 4 } }, s.detail) : null)
473
+ return h('div', { style: S.section },
474
+ h('div', { style: S.line },
475
+ h('div', { style: { ...S.h, ...S.grow, margin: 0 } }, L('来源', 'Sources')),
476
+ h('label', { style: { ...S.meta, display: 'flex', alignItems: 'center', gap: 6, cursor: 'pointer' } },
477
+ h('input', { type: 'checkbox', checked: showRisky, onChange: (e) => toggleRisky(e.target.checked) }),
478
+ L(`显示高风险来源${!showRisky && hidden ? `(${hidden})` : ''}`, `Show high-risk sources${!showRisky && hidden ? ` (${hidden})` : ''}`))),
479
+ h('p', { style: S.note }, L('打开就接入,没登录会弹出登录;关闭只停用,登录保留。标「需付费」的来源,要先在那家开通套餐,登录后才能用。', 'Turn on to connect (signs in if needed); turning off keeps the sign-in. Sources marked Paid need a plan from that provider before they work.')),
480
+ err ? h('div', { style: { fontSize: 12, color: C.err, margin: '0 0 8px' } }, err) : null,
481
+ showRisky ? h('p', { style: { ...S.note, color: C.warn } }, L('高风险来源(Claude、Antigravity):服务商有封禁第三方使用订阅的先例,账号可能被封。仅在你清楚风险时使用。', 'High-risk sources (Claude, Antigravity): the providers have banned third-party use of subscriptions before; your account may be suspended. Use only if you accept the risk.')) : null,
482
+ signedIn.length ? h('div', { style: S.card }, signedIn.map(row)) : h('div', { style: { ...S.note, margin: '0 0 8px' } }, L('还没有接入任何来源:展开下面的列表挑一个。', 'No source connected yet: open the list below and pick one.')),
483
+ rest.length ? h('button', { type: 'button', style: { ...S.btn, marginTop: 10 }, 'aria-expanded': openRest, onClick: () => toggleRest(!openRest) },
484
+ openRest ? L(`▾ 收起未登录的来源(${rest.length} 个)`, `▾ Hide signed-out sources (${rest.length})`) : L(`▸ 未登录的来源(${rest.length} 个)`, `▸ Signed-out sources (${rest.length})`)) : null,
485
+ openRest && rest.length ? h('div', { style: { ...S.card, marginTop: 8 } }, rest.map(row)) : null)
463
486
  }
464
487
 
465
488
  /** 费用标签:免费 / 免费·额度少 / 需付费 */