web-dc-api 0.0.71 → 0.0.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.
@@ -128,6 +128,8 @@ export interface AIProxyConfig {
128
128
  modelConfig: ModelConfig; // 模型配置
129
129
  remark: string;
130
130
  blockheight?: number; // 可以不设置,由sdk自动设置
131
+ timestamp?: number; // 设置时间戳,DC节点自动设置
132
+ userPubkey?: string; // 设置配置用户公钥,DC节点自动设置
131
133
  }
132
134
 
133
135
  // 函数定义结构
@@ -507,9 +507,24 @@ export class AIProxyManager {
507
507
  continue; // 如果格式不正确,跳过
508
508
  }
509
509
 
510
- const value = contentStr.substring((parts[0]||"").length + 1);
510
+ const valueWithExtra = contentStr.substring((parts[0]||"").length + 1);
511
511
  try {
512
+ //解析出扩展信息(时间戳,用户公钥等)
513
+ const valueParts = valueWithExtra.split("$$$dckv_extra$$$");
514
+ const value = valueParts[0] || "{}";
512
515
  const content = JSON.parse(value);
516
+ if (valueParts.length > 1) {
517
+ const extraStr = valueParts[1] || "{}";
518
+ const extra = JSON.parse(extraStr);
519
+ if (extra) {
520
+ if (extra.timestamp) {
521
+ content.timestamp = extra.timestamp;
522
+ }
523
+ if (extra.opuser) {
524
+ content.userPubkey = extra.opuser;
525
+ }
526
+ }
527
+ }
513
528
  allContent.push(content as AIProxyConfig);
514
529
  } catch (error) {
515
530
  console.error("解析内容错误:", error);
@@ -468,8 +468,8 @@ export class AuthModule implements DCModule, IAuthOperations {
468
468
  }
469
469
  this.tokenTask = true;
470
470
 
471
- // 60秒一次心跳维持连接
472
- const period = 60000;
471
+ // 300秒一次心跳维持连接
472
+ const period = 300000;
473
473
  let count = 0;
474
474
 
475
475
  // 启动ticker
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-dc-api",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "web相关的dcapi",
5
5
  "type": "module",
6
6
  "browser": "dist/dc.min.js",
@@ -33,7 +33,6 @@
33
33
  "license": "ISC",
34
34
  "keywords": [],
35
35
  "dependencies": {
36
- "grpc-libp2p-client": "^0.0.10",
37
36
  "@helia/block-brokers": "4.1.0",
38
37
  "@helia/dag-cbor": "^4.0.3",
39
38
  "@helia/interface": "4.0.1",
@@ -57,6 +56,7 @@
57
56
  "datastore-idb": "^3.0.1",
58
57
  "datastore-level": "^11.0.1",
59
58
  "google-protobuf": "~3.21.2",
59
+ "grpc-libp2p-client": "^0.0.14",
60
60
  "helia": "5.3.0",
61
61
  "interface-ipld-format": "^1.0.1",
62
62
  "it-to-buffer": "^4.0.7",
@@ -77,11 +77,6 @@
77
77
  "lib": "lib"
78
78
  },
79
79
  "devDependencies": {
80
- "cbor-x": "^1.6.0",
81
- "crypto-js": "^4.2.0",
82
- "ethers": "^6.14.1",
83
- "lodash": "~4.17.0",
84
- "mp4box": "^0.5.4",
85
80
  "@babel/core": "^7.27.4",
86
81
  "@babel/preset-env": "^7.27.2",
87
82
  "@rollup/plugin-babel": "^6.0.4",
@@ -93,12 +88,17 @@
93
88
  "@rollup/plugin-typescript": "^12.1.2",
94
89
  "@types/google-protobuf": "^3.15.12",
95
90
  "@types/jsbn": "^1.2.33",
91
+ "cbor-x": "^1.6.0",
96
92
  "core-js": "^3.43.0",
93
+ "crypto-js": "^4.2.0",
94
+ "ethers": "^6.14.1",
95
+ "lodash": "~4.17.0",
96
+ "mp4box": "^0.5.4",
97
97
  "nodemon": "^3.1.9",
98
98
  "rollup-plugin-dts": "^6.2.1",
99
99
  "typescript": "^5.8.3",
100
- "webpack-bundle-analyzer": "^4.10.2",
101
100
  "vite": "^7.1.2",
102
- "vite-plugin-dts": "^4.5.4"
101
+ "vite-plugin-dts": "^4.5.4",
102
+ "webpack-bundle-analyzer": "^4.10.2"
103
103
  }
104
104
  }