@ai-wendao/ant 0.3.19 → 0.3.20
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/index.js +5 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const name = 'ant'
|
|
2
2
|
|
|
3
3
|
import { createHash } from 'node:crypto'
|
|
4
|
+
import { createRequire } from 'node:module'
|
|
4
5
|
import { installSkill, listSkills, uninstallSkill } from './skill-install.js'
|
|
5
6
|
|
|
6
7
|
export const inject = []
|
|
@@ -18,6 +19,7 @@ const SKILL_INSTALL_PATH = '/api/ant-teams/skills/install'
|
|
|
18
19
|
const SKILL_UNINSTALL_PATH = '/api/ant-teams/skills/uninstall'
|
|
19
20
|
const PLUGINS_PATH = '/api/ant-teams/plugins'
|
|
20
21
|
const ANT_NPM_PACKAGE_NAME = '@ai-wendao/ant'
|
|
22
|
+
const BUNDLE_VERSION = createRequire(import.meta.url)('./package.json').version
|
|
21
23
|
const MAX_MODEL_RESPONSE_BYTES = 1024 * 1024
|
|
22
24
|
const MODEL_TOKEN_REF = 'ANT_MODEL_API_KEY'
|
|
23
25
|
const SERVICE_RECORD_KEY = 'ant/team-service'
|
|
@@ -105,9 +107,11 @@ async function readMemberConnection(credentials, settings) {
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
async function updateModelSession(serviceUrl, token, action) {
|
|
110
|
+
const headers = { authorization: `Bearer ${token}`, accept: 'application/json' }
|
|
111
|
+
if (action === 'heartbeat') headers['x-ant-bundle-version'] = BUNDLE_VERSION
|
|
108
112
|
return fetch(new URL(`/auth/dsh-session/${action}`, serviceUrl), {
|
|
109
113
|
method: 'POST',
|
|
110
|
-
headers
|
|
114
|
+
headers,
|
|
111
115
|
redirect: 'manual',
|
|
112
116
|
signal: AbortSignal.timeout(10_000),
|
|
113
117
|
})
|