@abtnode/core 1.17.7-beta-20260104-034806-6a4e6fba → 1.17.8-beta-20260104-120132-cb5b1914
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.
|
@@ -39045,7 +39045,7 @@ module.exports = require("zlib");
|
|
|
39045
39045
|
/***/ ((module) => {
|
|
39046
39046
|
|
|
39047
39047
|
"use strict";
|
|
39048
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.
|
|
39048
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.17.7","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.17.7","@abtnode/auth":"1.17.7","@abtnode/certificate-manager":"1.17.7","@abtnode/constant":"1.17.7","@abtnode/cron":"1.17.7","@abtnode/db-cache":"1.17.7","@abtnode/docker-utils":"1.17.7","@abtnode/logger":"1.17.7","@abtnode/models":"1.17.7","@abtnode/queue":"1.17.7","@abtnode/rbac":"1.17.7","@abtnode/router-provider":"1.17.7","@abtnode/util":"1.17.7","@aigne/aigne-hub":"^0.10.15","@arcblock/did":"^1.27.16","@arcblock/did-connect-js":"^1.27.16","@arcblock/did-ext":"^1.27.16","@arcblock/did-motif":"^1.1.14","@arcblock/did-util":"^1.27.16","@arcblock/event-hub":"^1.27.16","@arcblock/jwt":"^1.27.16","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"^1.27.16","@arcblock/vc":"^1.27.16","@blocklet/constant":"1.17.7","@blocklet/did-space-js":"^1.2.13","@blocklet/env":"1.17.7","@blocklet/error":"^0.3.5","@blocklet/meta":"1.17.7","@blocklet/resolver":"1.17.7","@blocklet/sdk":"1.17.7","@blocklet/server-js":"1.17.7","@blocklet/store":"1.17.7","@blocklet/theme":"^3.3.10","@fidm/x509":"^1.2.1","@ocap/mcrypto":"^1.27.16","@ocap/util":"^1.27.16","@ocap/wallet":"^1.27.16","@slack/webhook":"^7.0.6","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","private-ip":"^2.3.4","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^11.1.0","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"axios-mock-adapter":"^2.1.0","expand-tilde":"^2.0.2","express":"^4.18.2","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
39049
39049
|
|
|
39050
39050
|
/***/ }),
|
|
39051
39051
|
|
package/lib/util/aigne-verify.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 用于验证 aigne 的配置是否正确
|
|
3
3
|
*/
|
|
4
|
-
const { AIGNEHubChatModel } = require('@aigne/aigne-hub');
|
|
5
4
|
const { AIGNE_CONFIG_ENCRYPT_SALT } = require('@abtnode/constant');
|
|
6
5
|
const { decrypt } = require('@abtnode/util/lib/security');
|
|
7
6
|
const axios = require('@abtnode/util/lib/axios');
|
|
@@ -30,6 +29,35 @@ const getAigneHubModelApi = async (url) => {
|
|
|
30
29
|
}
|
|
31
30
|
};
|
|
32
31
|
|
|
32
|
+
/**
|
|
33
|
+
* 通过 api 验证 aigne hub model 是否可用
|
|
34
|
+
*/
|
|
35
|
+
const verifyAigneViaApi = async ({ url, model, apiKey }) => {
|
|
36
|
+
if (!url || !apiKey) {
|
|
37
|
+
return {
|
|
38
|
+
valid: false,
|
|
39
|
+
error: 'url and apiKey are required',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const { data } = await axios.get(joinURL(url, '/api/v2/status'), {
|
|
45
|
+
...(model && { params: { model } }),
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${apiKey}`,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
logger.info('Response data', { data });
|
|
51
|
+
return { valid: data.available };
|
|
52
|
+
} catch (error) {
|
|
53
|
+
logger.error('Failed to verify aigne hub model via api', { error });
|
|
54
|
+
return {
|
|
55
|
+
valid: false,
|
|
56
|
+
error: error.message,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
33
61
|
const verifyAigneHub = async (config, blocklet) => {
|
|
34
62
|
try {
|
|
35
63
|
if (!config.url) {
|
|
@@ -46,24 +74,18 @@ const verifyAigneHub = async (config, blocklet) => {
|
|
|
46
74
|
}
|
|
47
75
|
|
|
48
76
|
const baseUrl = await getAigneHubModelApi(config.url);
|
|
49
|
-
const { did
|
|
77
|
+
const { did } = blocklet?.meta || {};
|
|
78
|
+
const apiKey = decryptValue(config.key, did);
|
|
50
79
|
|
|
51
|
-
const
|
|
52
|
-
|
|
80
|
+
const result = await verifyAigneViaApi({
|
|
81
|
+
url: baseUrl,
|
|
53
82
|
model: !config.model || config.model === 'auto' ? undefined : config.model,
|
|
54
|
-
|
|
55
|
-
clientOptions: {
|
|
56
|
-
clientId: did,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const model = new AIGNEHubChatModel(modelConfig);
|
|
61
|
-
|
|
62
|
-
const result = await model.invoke({
|
|
63
|
-
messages: [{ role: 'user', content: `Hi there! This is ${name} Blocklet speaking. What's your name?` }],
|
|
83
|
+
apiKey,
|
|
64
84
|
});
|
|
65
85
|
|
|
66
|
-
|
|
86
|
+
logger.info('verify aigne hub model via api', { result });
|
|
87
|
+
|
|
88
|
+
return result;
|
|
67
89
|
} catch (error) {
|
|
68
90
|
logger.error(`verify ${config.provider} config error`, { error });
|
|
69
91
|
return { valid: false, error: error.message };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.17.
|
|
6
|
+
"version": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@abtnode/analytics": "1.17.
|
|
21
|
-
"@abtnode/auth": "1.17.
|
|
22
|
-
"@abtnode/certificate-manager": "1.17.
|
|
23
|
-
"@abtnode/constant": "1.17.
|
|
24
|
-
"@abtnode/cron": "1.17.
|
|
25
|
-
"@abtnode/db-cache": "1.17.
|
|
26
|
-
"@abtnode/docker-utils": "1.17.
|
|
27
|
-
"@abtnode/logger": "1.17.
|
|
28
|
-
"@abtnode/models": "1.17.
|
|
29
|
-
"@abtnode/queue": "1.17.
|
|
30
|
-
"@abtnode/rbac": "1.17.
|
|
31
|
-
"@abtnode/router-provider": "1.17.
|
|
32
|
-
"@abtnode/util": "1.17.
|
|
20
|
+
"@abtnode/analytics": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
21
|
+
"@abtnode/auth": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
22
|
+
"@abtnode/certificate-manager": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
23
|
+
"@abtnode/constant": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
24
|
+
"@abtnode/cron": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
25
|
+
"@abtnode/db-cache": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
26
|
+
"@abtnode/docker-utils": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
27
|
+
"@abtnode/logger": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
28
|
+
"@abtnode/models": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
29
|
+
"@abtnode/queue": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
30
|
+
"@abtnode/rbac": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
31
|
+
"@abtnode/router-provider": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
32
|
+
"@abtnode/util": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
33
33
|
"@aigne/aigne-hub": "^0.10.15",
|
|
34
34
|
"@arcblock/did": "^1.27.16",
|
|
35
35
|
"@arcblock/did-connect-js": "^1.27.16",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"@arcblock/pm2-events": "^0.0.5",
|
|
42
42
|
"@arcblock/validator": "^1.27.16",
|
|
43
43
|
"@arcblock/vc": "^1.27.16",
|
|
44
|
-
"@blocklet/constant": "1.17.
|
|
45
|
-
"@blocklet/did-space-js": "^1.2.
|
|
46
|
-
"@blocklet/env": "1.17.
|
|
44
|
+
"@blocklet/constant": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
45
|
+
"@blocklet/did-space-js": "^1.2.13",
|
|
46
|
+
"@blocklet/env": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
47
47
|
"@blocklet/error": "^0.3.5",
|
|
48
|
-
"@blocklet/meta": "1.17.
|
|
49
|
-
"@blocklet/resolver": "1.17.
|
|
50
|
-
"@blocklet/sdk": "1.17.
|
|
51
|
-
"@blocklet/server-js": "1.17.
|
|
52
|
-
"@blocklet/store": "1.17.
|
|
53
|
-
"@blocklet/theme": "^3.3.
|
|
48
|
+
"@blocklet/meta": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
49
|
+
"@blocklet/resolver": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
50
|
+
"@blocklet/sdk": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
51
|
+
"@blocklet/server-js": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
52
|
+
"@blocklet/store": "1.17.8-beta-20260104-120132-cb5b1914",
|
|
53
|
+
"@blocklet/theme": "^3.3.10",
|
|
54
54
|
"@fidm/x509": "^1.2.1",
|
|
55
55
|
"@ocap/mcrypto": "^1.27.16",
|
|
56
56
|
"@ocap/util": "^1.27.16",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"express": "^4.18.2",
|
|
115
115
|
"unzipper": "^0.10.11"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "580106dfb9d3114568737c3b3d06962724903084"
|
|
118
118
|
}
|