dsh-tokenbank 0.1.72 → 0.1.73
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/lib/client.js +20 -24
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -906,6 +906,24 @@ window.__ModuleLoader__.load({
|
|
|
906
906
|
var timer = setInterval(pull, 60000)
|
|
907
907
|
return function () { stopped = true; clearInterval(timer) }
|
|
908
908
|
}, [snap.authOpen])
|
|
909
|
+
// 登录态下每 30 分钟拉一次网关模型目录并刷新进模型列表(仅保留有可用凭证的模型);
|
|
910
|
+
// 退出登录(snap.loggedIn 变 false)即清定时器,不再同步。
|
|
911
|
+
React.useEffect(function () {
|
|
912
|
+
if (!snap.loggedIn) return
|
|
913
|
+
var syncModels = async function () {
|
|
914
|
+
try {
|
|
915
|
+
var d = await api('status')
|
|
916
|
+
if (!d || !d.loggedIn || !runtimeCtx) return
|
|
917
|
+
var models = await api('gateway-models', { accessKey: d.accessKey })
|
|
918
|
+
var list = (models && models.models) || []
|
|
919
|
+
if (!list.length) return
|
|
920
|
+
await addProviderToModels(runtimeCtx, d.baseURL || d.portalUrl || 'https://bank.skillpie.cn', { accessKey: d.accessKey, list: list, protocol: models.protocol })
|
|
921
|
+
} catch (e) { /* 静默:后台同步失败不打扰用户 */ }
|
|
922
|
+
}
|
|
923
|
+
syncModels()
|
|
924
|
+
var t = window.setInterval(syncModels, 30 * 60 * 1000)
|
|
925
|
+
return function () { window.clearInterval(t) }
|
|
926
|
+
}, [snap.loggedIn])
|
|
909
927
|
if (!snap.authOpen || !runtimeCtx) return null
|
|
910
928
|
var close = function () { tbStore.set({ authOpen: false, startRecharge: false }) }
|
|
911
929
|
var data = st[0]
|
|
@@ -1083,7 +1101,7 @@ window.__ModuleLoader__.load({
|
|
|
1083
1101
|
}, 80)
|
|
1084
1102
|
},
|
|
1085
1103
|
}, pageT('goSwitch')) : null,
|
|
1086
|
-
) :
|
|
1104
|
+
) : (checkinFlash[0] ? h('button', {
|
|
1087
1105
|
type: 'button', tabIndex: -1,
|
|
1088
1106
|
style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center', cursor: checkinFlash[0].models ? 'pointer' : 'default', opacity: 0.9 }),
|
|
1089
1107
|
onClick: checkinFlash[0].models ? function () {
|
|
@@ -1097,29 +1115,7 @@ window.__ModuleLoader__.load({
|
|
|
1097
1115
|
}
|
|
1098
1116
|
}, 80)
|
|
1099
1117
|
} : undefined,
|
|
1100
|
-
}, checkinFlash[0].text) :
|
|
1101
|
-
type: 'button', style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center' }),
|
|
1102
|
-
onMouseEnter: function () { showTipOnce('models') },
|
|
1103
|
-
onClick: async function () {
|
|
1104
|
-
try {
|
|
1105
|
-
var models = await api('gateway-models', { accessKey: data.accessKey })
|
|
1106
|
-
var list = Array.isArray(models) ? models : (models.models || models.list || [])
|
|
1107
|
-
await addProviderToModels(runtimeCtx, data.baseURL || portal, { accessKey: data.accessKey, list: list, protocol: models.protocol })
|
|
1108
|
-
tbStore.set({ notify: { kind: 'success', title: pageT('modelLinked').replace('{n}', String(list.length)), detail: '' } })
|
|
1109
|
-
// 模型接入成功即关弹窗,自动弹出宿主模型选择器(与签到闪现按钮同款时序)
|
|
1110
|
-
tbStore.set({ authOpen: false })
|
|
1111
|
-
window.setTimeout(function () {
|
|
1112
|
-
var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
|
|
1113
|
-
for (var q = 0; q < triggers.length; q++) {
|
|
1114
|
-
var lb = triggers[q].getAttribute('aria-label') || ''
|
|
1115
|
-
if (/选择模型|Select model/.test(lb)) { triggers[q].click(); return }
|
|
1116
|
-
}
|
|
1117
|
-
}, 80)
|
|
1118
|
-
} catch (err) {
|
|
1119
|
-
tbStore.set({ notify: { kind: 'error', title: String(err.message || err), detail: '' } })
|
|
1120
|
-
}
|
|
1121
|
-
},
|
|
1122
|
-
}, pageT('addFreeModels'))) : null,
|
|
1118
|
+
}, checkinFlash[0].text) : null),
|
|
1123
1119
|
)
|
|
1124
1120
|
: h(AuthCard, {
|
|
1125
1121
|
mode: snap.authMode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tokenbank",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73",
|
|
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
|
+
}
|