@digiwin-aimk/agent-market 0.1.3 → 0.1.4

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/README.md CHANGED
@@ -19,14 +19,13 @@ import AimkMain, { setForwardConfig } from '@digiwin-aimk/agent-market';
19
19
  setForwardConfig({
20
20
  forwardBaseUrl: 'https://<座舱中转网关>',
21
21
  appId: '<应用 id>',
22
- token: '<外层鉴权 token>', // 可选
23
- mode: 'forward',
24
- marketBridgeUrl: 'https://<云市场中间层地址>', // 必填,购买/咨询/试用经此地址 postMessage 通行
22
+ token: '<用户 token>', // 购买/咨询/试用跳转云市场单点登录
23
+ marketBridgeUrl: '<云市场地址>', // 必填,购买/咨询/试用经此地址 postMessage 通行
25
24
  });
26
25
 
27
26
  // 方式二(等价):通过 props 注入
28
27
  <AimkMain
29
- forwardConfig={{ forwardBaseUrl: '...', appId: '...', mode: 'forward' }}
28
+ forwardConfig={{ forwardBaseUrl: '...', appId: '...', token: '...', marketBridgeUrl: '...' }}
30
29
  locale="zh-CN" // 可选:'zh-CN'(默认)| 'zh-TW' | 'en-US'
31
30
  initialAgent={null} // 可选:进入时直接打开某智能体详情
32
31
  onSelectAgent={(agent) => {}} // 可选:点击智能体回调
@@ -40,7 +39,7 @@ import { AimkSDK } from '@digiwin-aimk/agent-market';
40
39
 
41
40
  const sdk = new AimkSDK({
42
41
  container: '#app', // DOM 元素或 CSS 选择器,缺省 document.body
43
- forwardConfig: { forwardBaseUrl: '...', appId: '...', mode: 'forward' },
42
+ forwardConfig: { forwardBaseUrl: '...', appId: '...', token: '...', marketBridgeUrl: '...' },
44
43
  locale: 'zh-TW', // UI 文案语言:'zh-CN'(默认)| 'zh-TW' | 'en-US'
45
44
  initialAgent: null, // 可选:首次挂载时直接打开的智能体详情
46
45
  onSelectAgent: (agent) => console.log('选中:', agent.name),
@@ -50,8 +49,3 @@ sdk.mount(); // 挂载渲染
50
49
  sdk.update({ forwardConfig: { ... } }); // 更新配置并重渲染
51
50
  sdk.destroy(); // 卸载并释放资源(可再次 mount)
52
51
  ```
53
-
54
- ## 中转模式说明
55
-
56
- - `mode: 'forward'`(默认/生产):所有接口经座舱中转接口代理调用(座舱约定的固定 POST 路径),座舱按 `appId` 查环境变量中的 host 后代理到真实接口;`token` / `extraHeaders` 会随中转请求头透传。
57
- - `mode: 'direct'`(联调):直连目标网关,需提供 `directBaseUrl`,`token` 会作为约定的鉴权请求头透传。
package/dist/index.js CHANGED
@@ -527,10 +527,10 @@ async function Ee(e = {}) {
527
527
  };
528
528
  }
529
529
  async function Me() {
530
- const i = (await S({
530
+ const i = await S({
531
531
  method: "GET",
532
532
  api: "/restful/service/default/AgentMarket/HostAgent"
533
- })).response?.data ?? [];
533
+ }) ?? [];
534
534
  return { total: i.length, list: i.map(T) };
535
535
  }
536
536
  async function Le() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digiwin-aimk/agent-market",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "AIMK 智能体市场 SDK:智能体列表 + 详情视图,可嵌入任意 React 宿主应用",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",