@axiom-lattice/client-sdk 1.0.44 → 1.0.45

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/dist/index.d.ts CHANGED
@@ -506,9 +506,9 @@ declare class WeChatClient extends AbstractClient {
506
506
  decodeUint8Array(uint8Array: ArrayBuffer): any;
507
507
  buf2hex(arrayBuffer: ArrayBuffer): string;
508
508
  /**
509
- * 十六进制字符串转中文
510
- * @param {String} hex 为十六进制字符串
511
- * @return {String} 包含中文的字符串
509
+ * Convert hexadecimal string to text (supports Chinese characters)
510
+ * @param {String} hex - Hexadecimal string
511
+ * @return {String} Decoded string including Chinese characters
512
512
  */
513
513
  hexToStr(hex: string): any;
514
514
  }
package/dist/index.js CHANGED
@@ -2445,14 +2445,14 @@ var WeChatClient = class extends AbstractClient {
2445
2445
  headers["x-tenant-id"] = this.tenantId;
2446
2446
  }
2447
2447
  const requestParams = this.buildStreamRequestParams(options);
2448
- const taskId = wx.request({
2448
+ const requestTask = wx.request({
2449
2449
  url: `${this.config.baseURL}${requestParams.url}`,
2450
2450
  method: requestParams.method,
2451
2451
  data: requestParams.body,
2452
2452
  header: headers,
2453
2453
  responseType: "text",
2454
2454
  enableChunked: true,
2455
- success: async () => {
2455
+ success: () => {
2456
2456
  },
2457
2457
  fail: (err) => {
2458
2458
  if (onError) {
@@ -2472,35 +2472,30 @@ var WeChatClient = class extends AbstractClient {
2472
2472
  onComplete();
2473
2473
  }
2474
2474
  }
2475
- },
2476
- // Using WeChat's chunked data capability
2477
- dataReceived: (res) => {
2478
- if (!res.data)
2479
- return;
2480
- const text = this.decodeUint8Array(res.data);
2481
- const lines = text.split("\n");
2482
- for (const line of lines) {
2483
- if (line.trim().startsWith("data: ")) {
2484
- try {
2485
- const eventData = JSON.parse(line.trim().slice(6));
2486
- onEvent(eventData);
2487
- } catch (error) {
2488
- if (onError) {
2489
- onError(
2490
- error instanceof Error ? error : new Error(String(error))
2491
- );
2492
- }
2475
+ }
2476
+ });
2477
+ requestTask.onChunkReceived((res) => {
2478
+ if (!res.data)
2479
+ return;
2480
+ const text = this.decodeUint8Array(res.data);
2481
+ const lines = text.split("\n");
2482
+ for (const line of lines) {
2483
+ if (line.trim().startsWith("data: ")) {
2484
+ try {
2485
+ const eventData = JSON.parse(line.trim().slice(6));
2486
+ onEvent(eventData);
2487
+ } catch (error) {
2488
+ if (onError) {
2489
+ onError(
2490
+ error instanceof Error ? error : new Error(String(error))
2491
+ );
2493
2492
  }
2494
2493
  }
2495
2494
  }
2496
2495
  }
2497
2496
  });
2498
2497
  return () => {
2499
- wx.abortRequest({
2500
- requestId: taskId,
2501
- success: () => console.log("Stream request aborted"),
2502
- fail: (err) => console.error("Failed to abort stream request:", err.errMsg)
2503
- });
2498
+ requestTask.abort();
2504
2499
  };
2505
2500
  }
2506
2501
  decodeUint8Array(uint8Array) {
@@ -2515,9 +2510,9 @@ var WeChatClient = class extends AbstractClient {
2515
2510
  ).join("");
2516
2511
  }
2517
2512
  /**
2518
- * 十六进制字符串转中文
2519
- * @param {String} hex 为十六进制字符串
2520
- * @return {String} 包含中文的字符串
2513
+ * Convert hexadecimal string to text (supports Chinese characters)
2514
+ * @param {String} hex - Hexadecimal string
2515
+ * @return {String} Decoded string including Chinese characters
2521
2516
  */
2522
2517
  hexToStr(hex) {
2523
2518
  let trimedStr = hex.trim();