dsh-tokenbank 0.1.65 → 0.1.66

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/lib/client.js +125 -92
  2. package/package.json +2 -2
package/lib/client.js CHANGED
@@ -28,6 +28,7 @@ window.__ModuleLoader__.load({
28
28
  openPortal: '打开完整门户',
29
29
  openSite: '打开官网',
30
30
  addFreeModels: '获取免费模型',
31
+ getModels: '获取模型',
31
32
  freeModelsTip: '免费使用主流收费模型,点击后自动获取,模型列表 TokenBank 中的模型任意使用。',
32
33
  modelLinked: '已接入 {n} 个模型',
33
34
  reload: '刷新',
@@ -121,6 +122,7 @@ window.__ModuleLoader__.load({
121
122
  openPortal: 'Open full portal',
122
123
  openSite: 'Open website',
123
124
  addFreeModels: 'Get free models',
125
+ getModels: 'Get models',
124
126
  freeModelsTip: 'Use paid-tier models for free — one click links them, and every TokenBank model in the list is available.',
125
127
  rechargeTip: 'Best price anywhere: $1 for ¥6.50 — 10%~25% cheaper than official APIs and relays. Pay with Alipay, credited instantly, credit never expires.',
126
128
  modelLinked: '{n} models linked',
@@ -334,21 +336,60 @@ window.__ModuleLoader__.load({
334
336
  }).catch(function () {})
335
337
  return function () { stopped = true }
336
338
  }, [])
337
- var onClick = function () {
338
- tbStore.set({ authOpen: true, authMode: 'register', anchor: null })
339
+ var onClick = function (e) {
340
+ var rect = e && e.currentTarget && e.currentTarget.getBoundingClientRect()
341
+ tbStore.set({
342
+ authOpen: true, authMode: 'register',
343
+ anchor: rect ? { right: rect.right, top: rect.top } : null,
344
+ })
339
345
  }
346
+ var st = React.useState(null)
347
+ React.useEffect(function () {
348
+ var stopped = false
349
+ api('status').then(function (data) {
350
+ if (!stopped) { st[1](data); tbStore.set({ loggedIn: Boolean(data.loggedIn), portalUrl: data.portalUrl }) }
351
+ }).catch(function () {})
352
+ return function () { stopped = true }
353
+ }, [])
354
+ // 登录态变化(弹窗登录/退出)时刷新余额展示
355
+ React.useEffect(function () {
356
+ var stopped = false
357
+ if (!snap.loggedIn) return
358
+ api('status').then(function (data) {
359
+ if (!stopped) st[1](data)
360
+ }).catch(function () {})
361
+ return function () { stopped = true }
362
+ }, [snap.loggedIn, snap.authOpen])
363
+ var data = st[0]
340
364
  return h('button', {
341
365
  type: 'button',
366
+ id: 'tb-entry-btn',
367
+ className: snap.authOpen ? 'tb-entry-open' : '',
342
368
  title: pageT('composerEntry'), 'aria-label': pageT('composerEntry'),
343
369
  onClick: onClick,
344
- style: {
345
- display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 4,
346
- height: 29, minWidth: 29, padding: '0 2px', borderRadius: 7,
347
- border: 'none', background: 'transparent',
348
- cursor: 'pointer', position: 'relative',
349
- },
370
+ style: snap.loggedIn
371
+ ? {
372
+ display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 4,
373
+ height: 29, padding: '0 8px', borderRadius: 7, boxSizing: 'border-box',
374
+ border: 'none', background: 'transparent',
375
+ cursor: 'pointer', position: 'relative',
376
+ }
377
+ : {
378
+ display: 'inline-flex', alignItems: 'center', cursor: 'pointer', position: 'relative',
379
+ border: 'none', background: 'transparent', padding: 0, boxSizing: 'border-box',
380
+ },
350
381
  },
351
- h(TokenBankLogo, { size: 18 }),
382
+ snap.loggedIn
383
+ ? h('span', { style: { fontSize: 13, fontVariantNumeric: 'tabular-nums', color: 'var(--dsw-alias-label-secondary, #888)' } },
384
+ data && data.account && typeof data.account.balance_nano_usd === 'number'
385
+ ? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '')
386
+ : h('span', {
387
+ style: { fontSize: 12, lineHeight: '25px', padding: '0 10px', borderRadius: 999, color: '#fff', background: '#ff4f1f', fontWeight: 600, letterSpacing: 0.3 },
388
+ }, pageT('freeToken')),
389
+ snap.loggedIn
390
+ ? h('svg', { viewBox: '0 0 24 24', className: 'tb-entry-chevron', width: 14, height: 14, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', style: { color: 'var(--dsw-alias-label-tertiary, #a0a3a8)', flex: 'none' } },
391
+ h('path', { d: 'm6 9 6 6 6-6' }))
392
+ : null,
352
393
  )
353
394
  }
354
395
 
@@ -615,6 +656,14 @@ window.__ModuleLoader__.load({
615
656
  var flash = React.useState(null)
616
657
  var sLogoutArm = React.useState(false)
617
658
  var sLogoutTimer = { ref: null }
659
+ var freeModelsUsed = React.useState(false)
660
+ // 登录态变化时同步一次性入口标记(退出已清 localStorage,重登后重新出现)
661
+ React.useEffect(function () {
662
+ if (!snap.loggedIn) return
663
+ try {
664
+ freeModelsUsed[1](window.localStorage.getItem('tb-free-models-used') === '1')
665
+ } catch (e) {}
666
+ }, [snap.loggedIn])
618
667
  var boxRef = React.useRef(null)
619
668
  React.useEffect(function () {
620
669
  var stopped = false
@@ -637,14 +686,6 @@ window.__ModuleLoader__.load({
637
686
  var openPanel = function (mode, extra) {
638
687
  tbStore.set(Object.assign({ authOpen: true, authMode: mode || snap.authMode || 'login', anchor: null }, extra || {}))
639
688
  }
640
- // 余额行右侧的低调图标按钮(悬停有 title 提示)
641
- var iconBtn = function (label, paths, onClick) {
642
- return h('button', { type: 'button', title: label, 'aria-label': label,
643
- style: { border: 'none', background: 'transparent', cursor: 'pointer', padding: 3, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'var(--dsw-alias-label-secondary, #666)' },
644
- onClick: onClick },
645
- h('svg', { viewBox: '0 0 24 24', width: 14, height: 14, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },
646
- paths.map(function (d) { return h('path', { d: d }) })))
647
- }
648
689
  // 找到宿主模型选择器触发按钮并点开(带重试:刚接入的 provider 需要等一拍渲染)
649
690
  var openModelSwitcher = function (tries) {
650
691
  var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
@@ -674,78 +715,34 @@ window.__ModuleLoader__.load({
674
715
  var loggedIn = snap.loggedIn
675
716
  if (!runtimeCtx) return null
676
717
  var smallBtn = Object.assign({}, buttonStyle, { height: 24, padding: '0 8px', fontSize: 12 })
718
+ // 弱化的文字链按钮:无框无底色,次级灰字,悬停才显主色
719
+ var quietLinkStyle = {
720
+ border: 'none', background: 'transparent', cursor: 'pointer', padding: '2px 4px',
721
+ fontSize: 12, lineHeight: '20px', borderRadius: 6,
722
+ color: 'var(--dsw-alias-label-secondary, #888)',
723
+ }
677
724
  return h('div', {
678
725
  ref: boxRef,
726
+ // 整个长驻板块作为可点击区域:点击任意位置打开账户弹窗(托管等子按钮单独 stopPropagation)
727
+ onClick: function () { openPanel('register') },
679
728
  style: {
729
+ cursor: 'pointer',
680
730
  margin: '4px 10px 8px', display: 'flex', flexDirection: 'column', gap: 6, width: 'calc(100% - 20px)', boxSizing: 'border-box', alignSelf: 'stretch'
681
731
  },
682
732
  },
683
733
  h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
684
734
  h('span', {
685
735
  className: 'tb-wordmark',
686
- style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 14, letterSpacing: 0.5, color: '#ff4f1f', position: 'relative', top: -1, cursor: 'pointer' },
687
- onClick: function () { window.open((data && data.portalUrl) || 'https://bank.skillpie.cn', '_blank', 'noopener') },
736
+ style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 14, letterSpacing: 0.5, color: '#111111', position: 'relative', top: -1 },
688
737
  }, 'TOKENBANK'),
689
- h('a', { href: (data && data.portalUrl) || 'https://bank.skillpie.cn', target: '_blank', rel: 'noopener noreferrer', title: pageT('officialSite'), style: { display: 'inline-flex', color: 'var(--dsw-alias-label-secondary, #888)', textDecoration: 'none' } },
690
- h('svg', { viewBox: '0 0 24 24', width: 12, height: 12, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },
691
- h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
692
- h('path', { d: 'M15 3h6v6' }),
693
- h('path', { d: 'M10 14L21 3' }))),
694
- loggedIn ? h('button', {
695
- type: 'button', title: pageT('logout'), 'aria-label': pageT('logout'),
696
- style: sLogoutArm[0]
697
- ? Object.assign({}, buttonStyle, { height: 20, padding: '0 6px', fontSize: 11, color: '#d03050', borderColor: '#d03050', borderWidth: 1, borderStyle: 'solid', marginLeft: 'auto' })
698
- : { border: 'none', background: 'transparent', cursor: 'pointer', padding: 2, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: '#d03050', marginLeft: 'auto' },
699
- onClick: async function () {
700
- if (!sLogoutArm[0]) {
701
- sLogoutArm[1](true)
702
- // 10 秒不确认自动归位,避免按钮一直停在「退出登录?」态
703
- clearTimeout(sLogoutTimer.ref)
704
- sLogoutTimer.ref = setTimeout(function () { sLogoutArm[1](false) }, 5000)
705
- return
706
- }
707
- clearTimeout(sLogoutTimer.ref)
708
- await api('logout').catch(function () {})
709
- sLogoutArm[1](false)
710
- st[1](null)
711
- tbStore.set({ loggedIn: false })
712
- },
713
- },
714
- h('svg', { viewBox: '0 0 24 24', width: 13, height: 13, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },
715
- h('path', { d: 'M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4' }),
716
- h('path', { d: 'M16 17l5-5-5-5' }),
717
- h('path', { d: 'M21 12H9' })))
718
- : h('button', {
738
+ loggedIn ? h('span', { style: { flex: 1 } }) : h('button', {
719
739
  type: 'button',
720
740
  style: { fontSize: 10, lineHeight: 1, padding: '3px 7px', borderRadius: 999, border: 'none', cursor: 'pointer', color: '#fff', background: '#ff4f1f', fontWeight: 600, letterSpacing: 0.3, marginLeft: 'auto' },
721
741
  onClick: function () { openPanel('register') },
722
- }, pageT('freeToken'))),
723
- loggedIn ? h('div', { style: { display: 'flex', alignItems: 'baseline', justifyContent: 'space-between', gap: 6 } },
724
- h('span', { style: { fontSize: 12, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } },
725
- (data && data.user && (data.user.display_name || data.user.name)) || (data && data.email) || ''),
726
- h('span', { style: { fontSize: 11, color: 'var(--dsw-alias-label-secondary, #888)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, data.email || ''),
727
- ) : null,
728
- loggedIn
729
- ? h('div', { style: { display: 'flex', alignItems: 'center', gap: 2 } },
730
- h('span', { style: { fontSize: 14, fontWeight: 700, fontVariantNumeric: 'tabular-nums', flex: 1 } },
731
- data && data.account && typeof data.account.balance_nano_usd === 'number'
732
- ? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '—'),
733
- iconBtn(pageT('addFreeModels'), [
734
- 'M20 12v9H4v-9',
735
- 'M2 7h20v5H2z',
736
- 'M12 22V7',
737
- 'M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z',
738
- 'M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z',
739
- ], addModels),
740
- iconBtn(pageT('depositManage'), [
741
- 'M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z',
742
- ], function () { openSettingsPage() }),
743
- iconBtn(pageT('recharge'), [
744
- 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z',
745
- 'M12 8v8',
746
- 'M8 12h8',
747
- ], function () { openPanel('login', { startRecharge: true }) }))
748
- : null,
742
+ }, pageT('freeToken')),
743
+ loggedIn ? h('span', { style: { fontSize: 13, fontWeight: 700, fontVariantNumeric: 'tabular-nums' } },
744
+ data && data.account && typeof data.account.balance_nano_usd === 'number'
745
+ ? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '—') : null),
749
746
  loggedIn && flash[0]
750
747
  ? h('div', { style: { fontSize: 11, color: 'var(--dsw-alias-label-secondary, #888)', textAlign: 'center' } }, flash[0].text)
751
748
  : null,
@@ -780,6 +777,12 @@ window.__ModuleLoader__.load({
780
777
  var checkinFlash = React.useState(null) // 签到成功闪现文案(复用获取免费模型按钮样式,2s 回原样)
781
778
  var checkin = React.useState({ busy: false, done: false })
782
779
  var depTip = React.useState(null) // 说明板块:hover 哪个按钮就显示哪段说明('deposit'|'recharge'|'models')
780
+ var tipSeen = React.useState({}) // 引导提示已看标记:每个按钮登录后仅第一次 hover 展示,后续不再弹
781
+ var showTipOnce = function (key) {
782
+ if (rechargeOpen[0] || tipSeen[0][key]) return
783
+ var next = Object.assign({}, tipSeen[0]); next[key] = true
784
+ tipSeen[1](next); depTip[1](key)
785
+ }
783
786
  React.useEffect(function () {
784
787
  if (!snap.authOpen) logoutArm[1](false)
785
788
  }, [snap.authOpen])
@@ -810,12 +813,13 @@ window.__ModuleLoader__.load({
810
813
  var anchor = snap.anchor || { right: window.innerWidth - 16, top: window.innerHeight - 80 }
811
814
  var panelWidth = 256
812
815
  return h('div', { style: { position: 'fixed', inset: 0, zIndex: 1999 } },
813
- h('div', { style: { position: 'absolute', inset: 0, background: 'rgba(0,0,0,0.35)' }, onClick: close }),
816
+ h('div', { style: { position: 'fixed', inset: 0, zIndex: -1 }, onClick: close }),
814
817
  h('div', {
815
818
  style: {
816
819
  position: 'fixed', width: panelWidth, maxWidth: 'calc(100vw - 16px)',
817
- left: '50%', top: '50%', transform: 'translate(-50%, -50%)',
818
- maxHeight: 520, overflow: 'auto',
820
+ right: Math.max(8, window.innerWidth - anchor.right),
821
+ bottom: Math.max(8, window.innerHeight - anchor.top + 8),
822
+ maxHeight: 420, overflow: 'auto',
819
823
  /* 与模型选择器菜单(MenuSurface)完全一致的材质 */
820
824
  background: 'var(--dsw-menu-surface-fill)',
821
825
  backdropFilter: 'var(--dsw-menu-backdrop-filter)',
@@ -835,18 +839,29 @@ window.__ModuleLoader__.load({
835
839
  href: portal, target: '_blank', rel: 'noopener noreferrer',
836
840
  style: { display: 'inline-flex', alignItems: 'center', cursor: 'pointer', textDecoration: 'none' },
837
841
  'aria-label': 'TokenBank',
838
- }, h('span', { className: 'tb-wordmark', style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 17, fontWeight: 400, letterSpacing: 0.5, lineHeight: 1, color: '#111111' } }, 'TOKENBANK')),
842
+ }, h('span', { className: 'tb-wordmark', style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 17, fontWeight: 400, letterSpacing: 0.5, lineHeight: 1, color: '#111111', position: 'relative', top: -1, left: -1 } }, 'TOKENBANK')),
843
+ // 标题右侧紧贴的「打开外部」灰色小按钮:新开 TokenBank 官网
844
+ h('a', {
845
+ href: portal, target: '_blank', rel: 'noopener noreferrer',
846
+ title: pageT('openSite'), 'aria-label': pageT('openSite'),
847
+ style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 17, height: 17, borderRadius: 5, marginLeft: -4, position: 'relative', top: 1, color: 'var(--dsw-alias-label-secondary, #888)', background: 'transparent', border: 'none', outline: 'none', cursor: 'pointer', textDecoration: 'none' },
848
+ },
849
+ h('svg', { width: 13, height: 13, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2.2, strokeLinecap: 'round', strokeLinejoin: 'round' },
850
+ h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
851
+ h('polyline', { points: '15 3 21 3 21 9' }),
852
+ h('line', { x1: 10, y1: 14, x2: 21, y2: 3 }))),
839
853
  h('span', { style: { flex: 1 } }),
840
854
  data && data.loggedIn ? h('button', {
841
855
  type: 'button', title: pageT('logout'), 'aria-label': pageT('logout'),
842
856
  style: logoutArm[0]
843
857
  ? Object.assign({}, buttonStyle, { height: 24, padding: '0 8px', fontSize: 11, color: '#d03050', borderColor: '#d03050', borderWidth: 1, borderStyle: 'solid' })
844
- : { height: 24, minWidth: 24, padding: 0, border: 'none', borderRadius: 6, background: 'transparent', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: '#d03050' },
858
+ : { height: 24, minWidth: 24, padding: 0, border: 'none', borderRadius: 6, background: 'transparent', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'var(--dsw-alias-label-secondary, #999)' },
845
859
  onClick: async function () {
846
860
  if (!logoutArm[0]) { logoutArm[1](true); return }
847
861
  await api('logout').catch(function () {})
848
862
  logoutArm[1](false)
849
863
  st[1](null)
864
+ try { window.localStorage.removeItem('tb-free-models-used') } catch (e) {}
850
865
  tbStore.set({ loggedIn: false })
851
866
  },
852
867
  },
@@ -880,8 +895,9 @@ window.__ModuleLoader__.load({
880
895
  type: 'button', disabled: checkin[0].busy || checkin[0].done,
881
896
  style: Object.assign({}, buttonStyle, {
882
897
  height: 26, padding: '0 12px', fontSize: 12,
898
+ // 边框色与「托管」按钮同口径(border-l2 浅灰弱化),已签到转绿保留
883
899
  color: checkin[0].done ? '#22a04a' : undefined,
884
- borderColor: checkin[0].done ? '#22a04a' : undefined,
900
+ borderColor: checkin[0].done ? '#22a04a' : 'var(--dsw-alias-border-l2, #c9ccd1)',
885
901
  }),
886
902
  onClick: async function () {
887
903
  if (checkin[0].done || checkin[0].busy) return
@@ -906,14 +922,14 @@ window.__ModuleLoader__.load({
906
922
  data && data.loggedIn ? h('button', {
907
923
  type: 'button', 'aria-label': pageT('depositManageTip'),
908
924
  style: Object.assign({}, buttonStyle, { height: 26, padding: '0 12px', fontSize: 12, borderColor: 'var(--dsw-alias-border-l2, #c9ccd1)' }),
909
- onMouseEnter: function () { if (!rechargeOpen[0]) depTip[1]('deposit') },
925
+ onMouseEnter: function () { showTipOnce('deposit') },
910
926
  onClick: function () { depTip[1](null); tbStore.set({ authOpen: false }); openSettingsPage() },
911
927
  }, pageT('depositManage')) : null,
912
928
  (checkin[0].done || (data.account && typeof data.account.balance_nano_usd === 'number' && data.account.balance_nano_usd < 1e9))
913
929
  ? h('button', {
914
930
  type: 'button',
915
931
  style: Object.assign({}, primaryButtonStyle, { height: 26, padding: '0 12px', fontSize: 12 }),
916
- onMouseEnter: function () { if (!rechargeOpen[0]) depTip[1]('recharge') },
932
+ onMouseEnter: function () { showTipOnce('recharge') },
917
933
  onClick: function () { depTip[1](null); rechargeOpen[1](function (v) { return !v }) },
918
934
  }, pageT('recharge'))
919
935
  : null,
@@ -965,7 +981,7 @@ window.__ModuleLoader__.load({
965
981
  } : undefined,
966
982
  }, checkinFlash[0].text) : h('button', {
967
983
  type: 'button', style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center' }),
968
- onMouseEnter: function () { if (!rechargeOpen[0]) depTip[1]('models') },
984
+ onMouseEnter: function () { showTipOnce('models') },
969
985
  onClick: async function () {
970
986
  try {
971
987
  var models = await api('gateway-models', { accessKey: data.accessKey })
@@ -973,6 +989,15 @@ window.__ModuleLoader__.load({
973
989
  await addProviderToModels(runtimeCtx, data.baseURL || portal, { accessKey: data.accessKey, list: list, protocol: models.protocol })
974
990
  checkinFlash[1]({ text: pageT('modelLinked').replace('{n}', String(list.length)), models: true })
975
991
  window.setTimeout(function () { checkinFlash[1](null) }, 3000)
992
+ // 模型接入成功即关弹窗,自动弹出宿主模型选择器(与签到闪现按钮同款时序)
993
+ tbStore.set({ authOpen: false })
994
+ window.setTimeout(function () {
995
+ var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
996
+ for (var q = 0; q < triggers.length; q++) {
997
+ var lb = triggers[q].getAttribute('aria-label') || ''
998
+ if (/选择模型|Select model/.test(lb)) { triggers[q].click(); return }
999
+ }
1000
+ }, 80)
976
1001
  } catch (err) {
977
1002
  tbStore.set({ notify: { kind: 'error', title: String(err.message || err), detail: '' } })
978
1003
  }
@@ -985,6 +1010,8 @@ window.__ModuleLoader__.load({
985
1010
  onAuthed: async function () {
986
1011
  tbStore.set({ authOpen: false })
987
1012
  try {
1013
+ var me = await api('status').catch(function () { return null })
1014
+ if (me) tbStore.set({ loggedIn: Boolean(me.loggedIn), portalUrl: me.portalUrl })
988
1015
  if (!runtimeCtx.remote || !runtimeCtx.remote.settings) return
989
1016
  var fresh = await api('status')
990
1017
  if (fresh && fresh.accessKey) {
@@ -1495,6 +1522,14 @@ window.__ModuleLoader__.load({
1495
1522
  var wmCss = document.createElement('style')
1496
1523
  wmCss.textContent = "@font-face{font-family:'FrizonLocal';src:url(data:font/woff;base64," + FRIZON_WOFF + ") format('woff')}body[data-ds-dark-theme] .tb-wordmark{color:#ffffff!important}"
1497
1524
  document.head.appendChild(wmCss)
1525
+ // 入口按钮 hover 形态:灰底 + 箭头反转(与模型选择器 hover 一致)
1526
+ var entryCss = document.createElement('style')
1527
+ entryCss.textContent = '#tb-entry-btn:hover{background:var(--dsw-alias-interactive-bg-hover, rgba(0,0,0,.05))!important;margin:1px 0;height:27px!important}.tb-entry-open .tb-entry-chevron{transition:transform .15s ease;transform:rotate(180deg)}'
1528
+ document.head.appendChild(entryCss)
1529
+ ctx.effect(function () {
1530
+ return function () { if (entryCss.parentNode) entryCss.parentNode.removeChild(entryCss) }
1531
+ }, 'dsh-tokenbank: entry hover style')
1532
+
1498
1533
  }
1499
1534
  ctx.effect(function () {
1500
1535
  return ctx.locale.register(NS, { zh: zh, en: en })
@@ -1508,15 +1543,13 @@ window.__ModuleLoader__.load({
1508
1543
  runtimeCtx = ctx
1509
1544
 
1510
1545
  // 输入框工具行、模型选择器左侧的紧凑入口按钮(弹账户/注册窗)
1511
- // 对话框输入框入口已移除,侧栏块是唯一入口
1512
-
1513
- // 侧栏底部长驻块(sidebar.footer.action 是 list 槽,渲染为追加项)
1514
- ctx.slots.inject('sidebar.footer.action', function () {
1546
+ ctx.slots.inject('conversation.input.right', function () {
1515
1547
  return ctx.slots.register({
1516
- name: 'sidebar.footer.action',
1517
- id: 'dsh-tokenbank-card',
1548
+ name: 'conversation.input.right',
1549
+ id: 'dsh-tokenbank-entry',
1550
+ order: 0,
1518
1551
  locale: NS,
1519
- }, SidebarCard)
1552
+ }, ComposerEntry)
1520
1553
  })
1521
1554
 
1522
1555
  // 同一个槽只 inject 一次:多次 inject 会互相覆盖(之前 auth 注册被
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tokenbank",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "description": "DSH 免费模型:一键注册 TokenBank 领免费 APIKey 送 $5 体验金,免费 GLM 模型直接进模型列表;自带余额查询、API Key 密钥托管(临时额度转永久)、每日签到、充值入口(支付宝),获取免费模型无需自建中转。致敬 dsh-our-free-model。官网 https://bank.skillpie.cn",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -48,4 +48,4 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  }
51
- }
51
+ }