@zeewain/3d-avatar-sdk 1.2.4-1 → 1.2.5

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
@@ -305,8 +305,14 @@ interface IBroadcastAPI {
305
305
  isActive: boolean;
306
306
  isGeneratingAudio: boolean;
307
307
  hasReceivedAudio: boolean;
308
- pendingCallbacks: number;
309
- hasController: boolean;
308
+ queueInfo?: {
309
+ totalTasks: number;
310
+ requestingTasks: number;
311
+ completedTasks: number;
312
+ failedTasks: number;
313
+ totalPendingResponses: number;
314
+ currentSendingSequence: number;
315
+ };
310
316
  };
311
317
  /**
312
318
  * 销毁播报服务
@@ -546,8 +552,14 @@ declare class ZEEAvatarSDK {
546
552
  isActive: boolean;
547
553
  isGeneratingAudio: boolean;
548
554
  hasReceivedAudio: boolean;
549
- pendingCallbacks: number;
550
- hasController: boolean;
555
+ queueInfo?: {
556
+ totalTasks: number;
557
+ requestingTasks: number;
558
+ completedTasks: number;
559
+ failedTasks: number;
560
+ totalPendingResponses: number;
561
+ currentSendingSequence: number;
562
+ };
551
563
  };
552
564
  /**
553
565
  * 销毁SDK实例
@@ -845,14 +857,14 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
845
857
  private taskSequence;
846
858
  /** 当前发送任务的序号 */
847
859
  private currentSendingSequence;
848
- /** 是否正在生成音频 */
849
- private isGeneratingAudio;
860
+ /** 是否正在播报音频 */
861
+ private isBroadcastingAudio;
850
862
  /** 是否已经收到音频 */
851
863
  private hasReceivedAudio;
852
864
  /** 队列处理定时器 */
853
865
  private queueProcessTimer;
854
- /** 主请求控制器(兼容性保留) */
855
- private activeController;
866
+ /** 播报完成次数 */
867
+ private broadcastCompletedCount;
856
868
  /**
857
869
  * 构造函数
858
870
  * @param config - 播报服务配置
@@ -959,8 +971,6 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
959
971
  isActive: boolean;
960
972
  isGeneratingAudio: boolean;
961
973
  hasReceivedAudio: boolean;
962
- pendingCallbacks: number;
963
- hasController: boolean;
964
974
  queueInfo?: {
965
975
  totalTasks: number;
966
976
  requestingTasks: number;
@@ -1084,6 +1094,12 @@ declare class BroadcastService extends UnityBaseService<BroadcastOperationType>
1084
1094
  * @private
1085
1095
  */
1086
1096
  private handleBroadcastError;
1097
+ /**
1098
+ * 清理队列处理定时器
1099
+ * @description 清理队列处理定时器
1100
+ * @private
1101
+ */
1102
+ private clearQueueProcessTimer;
1087
1103
  }
1088
1104
 
1089
1105
  /**
package/dist/index.es5.js CHANGED
@@ -13816,14 +13816,14 @@ var ZEEAvatarSDKLib = (function (exports) {
13816
13816
  _this.taskSequence = 0;
13817
13817
  /** 当前发送任务的序号 */
13818
13818
  _this.currentSendingSequence = 0;
13819
- /** 是否正在生成音频 */
13820
- _this.isGeneratingAudio = false;
13819
+ /** 是否正在播报音频 */
13820
+ _this.isBroadcastingAudio = false;
13821
13821
  /** 是否已经收到音频 */
13822
13822
  _this.hasReceivedAudio = false;
13823
13823
  /** 队列处理定时器 */
13824
13824
  _this.queueProcessTimer = null;
13825
- /** 主请求控制器(兼容性保留) */
13826
- _this.activeController = null;
13825
+ /** 播报完成次数 */
13826
+ _this.broadcastCompletedCount = 0;
13827
13827
  _this.callbacks = config.callbacks || {};
13828
13828
  _this.logger.info('Broadcast service initialized', {
13829
13829
  config: config
@@ -13840,7 +13840,7 @@ var ZEEAvatarSDKLib = (function (exports) {
13840
13840
  * @override
13841
13841
  */
13842
13842
  BroadcastService.prototype.handleCallback = function (operation, code, message, data) {
13843
- var _a, _b, _c, _d, _e, _f, _g, _h;
13843
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13844
13844
  // 提取 isBroadcastCompleted 参数
13845
13845
  var isBroadcastCompleted = JSON.parse(data || '{}').isBroadcastCompleted;
13846
13846
  // 先调用基类处理逻辑
@@ -13850,19 +13850,31 @@ var ZEEAvatarSDKLib = (function (exports) {
13850
13850
  switch (operation) {
13851
13851
  case exports.BroadcastOperationType.START_BROADCAST:
13852
13852
  if (isBroadcastCompleted) {
13853
- (_b = (_a = this.callbacks).onFinish) === null || _b === void 0 ? void 0 : _b.call(_a);
13853
+ this.broadcastCompletedCount++;
13854
+ var status_1 = this.getStatus();
13855
+ if (((_a = status_1.queueInfo) === null || _a === void 0 ? void 0 : _a.completedTasks) === this.broadcastCompletedCount) {
13856
+ // 重置状态、计数
13857
+ this.isBroadcastingAudio = false;
13858
+ this.hasReceivedAudio = false;
13859
+ this.currentSendingSequence = 0;
13860
+ // 清理已完成的任务
13861
+ this.cleanupCompletedTasks();
13862
+ this.logger.warn('Broadcast all completed');
13863
+ }
13864
+ // this.logger.warn('AAAAAA', { status: this.getStatus(), broadcastCompletedCount: this.broadcastCompletedCount });
13865
+ (_c = (_b = this.callbacks).onFinish) === null || _c === void 0 ? void 0 : _c.call(_b);
13854
13866
  }
13855
13867
  break;
13856
13868
  case exports.BroadcastOperationType.PAUSE_BROADCAST:
13857
- (_d = (_c = this.callbacks).onPause) === null || _d === void 0 ? void 0 : _d.call(_c);
13869
+ (_e = (_d = this.callbacks).onPause) === null || _e === void 0 ? void 0 : _e.call(_d);
13858
13870
  this.logger.debug('Broadcast paused callback triggered');
13859
13871
  break;
13860
13872
  case exports.BroadcastOperationType.RESUME_BROADCAST:
13861
- (_f = (_e = this.callbacks).onResume) === null || _f === void 0 ? void 0 : _f.call(_e);
13873
+ (_g = (_f = this.callbacks).onResume) === null || _g === void 0 ? void 0 : _g.call(_f);
13862
13874
  this.logger.debug('Broadcast resumed callback triggered');
13863
13875
  break;
13864
13876
  case exports.BroadcastOperationType.STOP_BROADCAST:
13865
- (_h = (_g = this.callbacks).onStop) === null || _h === void 0 ? void 0 : _h.call(_g);
13877
+ (_j = (_h = this.callbacks).onStop) === null || _j === void 0 ? void 0 : _j.call(_h);
13866
13878
  this.logger.debug('Broadcast stopped callback triggered');
13867
13879
  break;
13868
13880
  }
@@ -13933,7 +13945,7 @@ var ZEEAvatarSDKLib = (function (exports) {
13933
13945
  });
13934
13946
  // 触发开始回调
13935
13947
  (_b = (_a = this.callbacks).onStart) === null || _b === void 0 ? void 0 : _b.call(_a);
13936
- this.isGeneratingAudio = true;
13948
+ this.isBroadcastingAudio = true;
13937
13949
  _c.label = 2;
13938
13950
  case 2:
13939
13951
  task = this.createBroadcastTask(params);
@@ -14041,8 +14053,9 @@ var ZEEAvatarSDKLib = (function (exports) {
14041
14053
  // 取消所有队列中的任务
14042
14054
  this.cancelAllTasks();
14043
14055
  // 重置状态
14044
- this.isGeneratingAudio = false;
14056
+ this.isBroadcastingAudio = false;
14045
14057
  this.hasReceivedAudio = false;
14058
+ this.broadcastCompletedCount = 0;
14046
14059
  _a.label = 1;
14047
14060
  case 1:
14048
14061
  _a.trys.push([1, 3,, 4]);
@@ -14076,27 +14089,32 @@ var ZEEAvatarSDKLib = (function (exports) {
14076
14089
  * @description 获取当前播报服务的状态信息,包括队列状态
14077
14090
  */
14078
14091
  BroadcastService.prototype.getStatus = function () {
14092
+ var completedTasks = this.taskQueue.filter(function (t) {
14093
+ return t.status === BroadcastTaskStatus.COMPLETED;
14094
+ }).length;
14095
+ var requestingTasks = this.taskQueue.filter(function (t) {
14096
+ return t.status === BroadcastTaskStatus.REQUESTING;
14097
+ }).length;
14098
+ var failedTasks = this.taskQueue.filter(function (t) {
14099
+ return t.status === BroadcastTaskStatus.FAILED;
14100
+ }).length;
14101
+ var totalPendingResponses = this.taskQueue.reduce(function (sum, t) {
14102
+ return sum + t.pendingResponses.length;
14103
+ }, 0);
14104
+ var currentSendingSequence = this.currentSendingSequence;
14105
+ var isGeneratingAudio = completedTasks + failedTasks !== this.taskQueue.length;
14079
14106
  return {
14080
- isActive: this.taskQueue.length > 0 || this.isGeneratingAudio,
14081
- isGeneratingAudio: this.isGeneratingAudio,
14107
+ isActive: this.isBroadcastingAudio || isGeneratingAudio,
14108
+ // 是否正在播报音频或正在生成音频
14109
+ isGeneratingAudio: isGeneratingAudio,
14082
14110
  hasReceivedAudio: this.hasReceivedAudio,
14083
- pendingCallbacks: this.getPendingCallbackCount(),
14084
- hasController: this.activeController !== null,
14085
14111
  queueInfo: {
14086
14112
  totalTasks: this.taskQueue.length,
14087
- requestingTasks: this.taskQueue.filter(function (t) {
14088
- return t.status === BroadcastTaskStatus.REQUESTING;
14089
- }).length,
14090
- completedTasks: this.taskQueue.filter(function (t) {
14091
- return t.status === BroadcastTaskStatus.COMPLETED;
14092
- }).length,
14093
- failedTasks: this.taskQueue.filter(function (t) {
14094
- return t.status === BroadcastTaskStatus.FAILED;
14095
- }).length,
14096
- totalPendingResponses: this.taskQueue.reduce(function (sum, t) {
14097
- return sum + t.pendingResponses.length;
14098
- }, 0),
14099
- currentSendingSequence: this.currentSendingSequence
14113
+ requestingTasks: requestingTasks,
14114
+ completedTasks: completedTasks,
14115
+ failedTasks: failedTasks,
14116
+ totalPendingResponses: totalPendingResponses,
14117
+ currentSendingSequence: currentSendingSequence
14100
14118
  }
14101
14119
  };
14102
14120
  };
@@ -14106,10 +14124,7 @@ var ZEEAvatarSDKLib = (function (exports) {
14106
14124
  */
14107
14125
  BroadcastService.prototype.destroy = function () {
14108
14126
  // 清理队列处理定时器
14109
- if (this.queueProcessTimer) {
14110
- clearInterval(this.queueProcessTimer);
14111
- this.queueProcessTimer = null;
14112
- }
14127
+ this.clearQueueProcessTimer();
14113
14128
  // 取消所有任务
14114
14129
  this.cancelAllTasks();
14115
14130
  // 调用基类销毁方法
@@ -14187,12 +14202,12 @@ var ZEEAvatarSDKLib = (function (exports) {
14187
14202
  if (nextTask) {
14188
14203
  this.sendNextResponse(nextTask);
14189
14204
  }
14190
- // 清理已完成的任务
14191
- this.cleanupCompletedTasks();
14192
- // 如果队列为空,停止定时器
14193
- if (this.taskQueue.length === 0 && this.queueProcessTimer) {
14194
- clearInterval(this.queueProcessTimer);
14195
- this.queueProcessTimer = null;
14205
+ // 如果队列中没有剩余任务,则停止定时器
14206
+ var remainingTasks = this.taskQueue.filter(function (task) {
14207
+ return task.status !== BroadcastTaskStatus.COMPLETED && task.status !== BroadcastTaskStatus.FAILED && task.status !== BroadcastTaskStatus.CANCELLED;
14208
+ });
14209
+ if (remainingTasks.length === 0) {
14210
+ this.clearQueueProcessTimer();
14196
14211
  }
14197
14212
  };
14198
14213
  /**
@@ -14271,6 +14286,7 @@ var ZEEAvatarSDKLib = (function (exports) {
14271
14286
  }
14272
14287
  // 处理音频数据
14273
14288
  if (response.data) {
14289
+ this.hasReceivedAudio = true;
14274
14290
  // 自定义音频播报时,如果服务器未返回音频URL,使用传入的audioUrl
14275
14291
  if (task.params.type === exports.BroadcastType.AUDIO && task.params.audioUrl && !response.data.voiceUrl) {
14276
14292
  response.data.voiceUrl = task.params.audioUrl;
@@ -14423,20 +14439,12 @@ var ZEEAvatarSDKLib = (function (exports) {
14423
14439
  * @private
14424
14440
  */
14425
14441
  BroadcastService.prototype.getBroadcastApiPath = function (type) {
14426
- var env = ConfigManager.getInstance().getEnv();
14442
+ ConfigManager.getInstance().getEnv();
14427
14443
  switch (type) {
14428
14444
  case exports.BroadcastType.TEXT:
14429
- // 临时处理,开发和测试环境使用新接口
14430
- if (env === 'dev' || env === 'test') {
14431
- return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
14432
- }
14433
- return '/dh-talker/user/agent/broadcast/text';
14445
+ return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
14434
14446
  case exports.BroadcastType.AUDIO:
14435
- // 临时处理,开发和测试环境使用新接口
14436
- if (env === 'dev' || env === 'test') {
14437
- return '/aiep-openapi/avatar-interaction/v1/broadcast/audio';
14438
- }
14439
- return '/dh-talker/user/agent/broadcast/customAudio';
14447
+ return '/aiep-openapi/avatar-interaction/v1/broadcast/audio';
14440
14448
  default:
14441
14449
  throw new SDKError(exports.ConfigErrorCode.INVALID_CONFIG, "\u672A\u77E5\u7684\u64AD\u62A5\u7C7B\u578B: ".concat(type));
14442
14450
  }
@@ -14468,11 +14476,6 @@ var ZEEAvatarSDKLib = (function (exports) {
14468
14476
  BroadcastService.prototype.handleError = function (error) {
14469
14477
  var _a, _b;
14470
14478
  this.logger.error('Broadcast error occurred', error);
14471
- // 清理控制器
14472
- if (this.activeController) {
14473
- this.activeController.abort();
14474
- this.activeController = null;
14475
- }
14476
14479
  // 触发错误回调
14477
14480
  (_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
14478
14481
  };
@@ -14501,6 +14504,17 @@ var ZEEAvatarSDKLib = (function (exports) {
14501
14504
  break;
14502
14505
  }
14503
14506
  };
14507
+ /**
14508
+ * 清理队列处理定时器
14509
+ * @description 清理队列处理定时器
14510
+ * @private
14511
+ */
14512
+ BroadcastService.prototype.clearQueueProcessTimer = function () {
14513
+ if (this.queueProcessTimer) {
14514
+ clearInterval(this.queueProcessTimer);
14515
+ this.queueProcessTimer = null;
14516
+ }
14517
+ };
14504
14518
  return BroadcastService;
14505
14519
  }(UnityBaseService);
14506
14520
 
@@ -13819,14 +13819,14 @@
13819
13819
  _this.taskSequence = 0;
13820
13820
  /** 当前发送任务的序号 */
13821
13821
  _this.currentSendingSequence = 0;
13822
- /** 是否正在生成音频 */
13823
- _this.isGeneratingAudio = false;
13822
+ /** 是否正在播报音频 */
13823
+ _this.isBroadcastingAudio = false;
13824
13824
  /** 是否已经收到音频 */
13825
13825
  _this.hasReceivedAudio = false;
13826
13826
  /** 队列处理定时器 */
13827
13827
  _this.queueProcessTimer = null;
13828
- /** 主请求控制器(兼容性保留) */
13829
- _this.activeController = null;
13828
+ /** 播报完成次数 */
13829
+ _this.broadcastCompletedCount = 0;
13830
13830
  _this.callbacks = config.callbacks || {};
13831
13831
  _this.logger.info('Broadcast service initialized', {
13832
13832
  config: config
@@ -13843,7 +13843,7 @@
13843
13843
  * @override
13844
13844
  */
13845
13845
  BroadcastService.prototype.handleCallback = function (operation, code, message, data) {
13846
- var _a, _b, _c, _d, _e, _f, _g, _h;
13846
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
13847
13847
  // 提取 isBroadcastCompleted 参数
13848
13848
  var isBroadcastCompleted = JSON.parse(data || '{}').isBroadcastCompleted;
13849
13849
  // 先调用基类处理逻辑
@@ -13853,19 +13853,31 @@
13853
13853
  switch (operation) {
13854
13854
  case exports.BroadcastOperationType.START_BROADCAST:
13855
13855
  if (isBroadcastCompleted) {
13856
- (_b = (_a = this.callbacks).onFinish) === null || _b === void 0 ? void 0 : _b.call(_a);
13856
+ this.broadcastCompletedCount++;
13857
+ var status_1 = this.getStatus();
13858
+ if (((_a = status_1.queueInfo) === null || _a === void 0 ? void 0 : _a.completedTasks) === this.broadcastCompletedCount) {
13859
+ // 重置状态、计数
13860
+ this.isBroadcastingAudio = false;
13861
+ this.hasReceivedAudio = false;
13862
+ this.currentSendingSequence = 0;
13863
+ // 清理已完成的任务
13864
+ this.cleanupCompletedTasks();
13865
+ this.logger.warn('Broadcast all completed');
13866
+ }
13867
+ // this.logger.warn('AAAAAA', { status: this.getStatus(), broadcastCompletedCount: this.broadcastCompletedCount });
13868
+ (_c = (_b = this.callbacks).onFinish) === null || _c === void 0 ? void 0 : _c.call(_b);
13857
13869
  }
13858
13870
  break;
13859
13871
  case exports.BroadcastOperationType.PAUSE_BROADCAST:
13860
- (_d = (_c = this.callbacks).onPause) === null || _d === void 0 ? void 0 : _d.call(_c);
13872
+ (_e = (_d = this.callbacks).onPause) === null || _e === void 0 ? void 0 : _e.call(_d);
13861
13873
  this.logger.debug('Broadcast paused callback triggered');
13862
13874
  break;
13863
13875
  case exports.BroadcastOperationType.RESUME_BROADCAST:
13864
- (_f = (_e = this.callbacks).onResume) === null || _f === void 0 ? void 0 : _f.call(_e);
13876
+ (_g = (_f = this.callbacks).onResume) === null || _g === void 0 ? void 0 : _g.call(_f);
13865
13877
  this.logger.debug('Broadcast resumed callback triggered');
13866
13878
  break;
13867
13879
  case exports.BroadcastOperationType.STOP_BROADCAST:
13868
- (_h = (_g = this.callbacks).onStop) === null || _h === void 0 ? void 0 : _h.call(_g);
13880
+ (_j = (_h = this.callbacks).onStop) === null || _j === void 0 ? void 0 : _j.call(_h);
13869
13881
  this.logger.debug('Broadcast stopped callback triggered');
13870
13882
  break;
13871
13883
  }
@@ -13936,7 +13948,7 @@
13936
13948
  });
13937
13949
  // 触发开始回调
13938
13950
  (_b = (_a = this.callbacks).onStart) === null || _b === void 0 ? void 0 : _b.call(_a);
13939
- this.isGeneratingAudio = true;
13951
+ this.isBroadcastingAudio = true;
13940
13952
  _c.label = 2;
13941
13953
  case 2:
13942
13954
  task = this.createBroadcastTask(params);
@@ -14044,8 +14056,9 @@
14044
14056
  // 取消所有队列中的任务
14045
14057
  this.cancelAllTasks();
14046
14058
  // 重置状态
14047
- this.isGeneratingAudio = false;
14059
+ this.isBroadcastingAudio = false;
14048
14060
  this.hasReceivedAudio = false;
14061
+ this.broadcastCompletedCount = 0;
14049
14062
  _a.label = 1;
14050
14063
  case 1:
14051
14064
  _a.trys.push([1, 3,, 4]);
@@ -14079,27 +14092,32 @@
14079
14092
  * @description 获取当前播报服务的状态信息,包括队列状态
14080
14093
  */
14081
14094
  BroadcastService.prototype.getStatus = function () {
14095
+ var completedTasks = this.taskQueue.filter(function (t) {
14096
+ return t.status === BroadcastTaskStatus.COMPLETED;
14097
+ }).length;
14098
+ var requestingTasks = this.taskQueue.filter(function (t) {
14099
+ return t.status === BroadcastTaskStatus.REQUESTING;
14100
+ }).length;
14101
+ var failedTasks = this.taskQueue.filter(function (t) {
14102
+ return t.status === BroadcastTaskStatus.FAILED;
14103
+ }).length;
14104
+ var totalPendingResponses = this.taskQueue.reduce(function (sum, t) {
14105
+ return sum + t.pendingResponses.length;
14106
+ }, 0);
14107
+ var currentSendingSequence = this.currentSendingSequence;
14108
+ var isGeneratingAudio = completedTasks + failedTasks !== this.taskQueue.length;
14082
14109
  return {
14083
- isActive: this.taskQueue.length > 0 || this.isGeneratingAudio,
14084
- isGeneratingAudio: this.isGeneratingAudio,
14110
+ isActive: this.isBroadcastingAudio || isGeneratingAudio,
14111
+ // 是否正在播报音频或正在生成音频
14112
+ isGeneratingAudio: isGeneratingAudio,
14085
14113
  hasReceivedAudio: this.hasReceivedAudio,
14086
- pendingCallbacks: this.getPendingCallbackCount(),
14087
- hasController: this.activeController !== null,
14088
14114
  queueInfo: {
14089
14115
  totalTasks: this.taskQueue.length,
14090
- requestingTasks: this.taskQueue.filter(function (t) {
14091
- return t.status === BroadcastTaskStatus.REQUESTING;
14092
- }).length,
14093
- completedTasks: this.taskQueue.filter(function (t) {
14094
- return t.status === BroadcastTaskStatus.COMPLETED;
14095
- }).length,
14096
- failedTasks: this.taskQueue.filter(function (t) {
14097
- return t.status === BroadcastTaskStatus.FAILED;
14098
- }).length,
14099
- totalPendingResponses: this.taskQueue.reduce(function (sum, t) {
14100
- return sum + t.pendingResponses.length;
14101
- }, 0),
14102
- currentSendingSequence: this.currentSendingSequence
14116
+ requestingTasks: requestingTasks,
14117
+ completedTasks: completedTasks,
14118
+ failedTasks: failedTasks,
14119
+ totalPendingResponses: totalPendingResponses,
14120
+ currentSendingSequence: currentSendingSequence
14103
14121
  }
14104
14122
  };
14105
14123
  };
@@ -14109,10 +14127,7 @@
14109
14127
  */
14110
14128
  BroadcastService.prototype.destroy = function () {
14111
14129
  // 清理队列处理定时器
14112
- if (this.queueProcessTimer) {
14113
- clearInterval(this.queueProcessTimer);
14114
- this.queueProcessTimer = null;
14115
- }
14130
+ this.clearQueueProcessTimer();
14116
14131
  // 取消所有任务
14117
14132
  this.cancelAllTasks();
14118
14133
  // 调用基类销毁方法
@@ -14190,12 +14205,12 @@
14190
14205
  if (nextTask) {
14191
14206
  this.sendNextResponse(nextTask);
14192
14207
  }
14193
- // 清理已完成的任务
14194
- this.cleanupCompletedTasks();
14195
- // 如果队列为空,停止定时器
14196
- if (this.taskQueue.length === 0 && this.queueProcessTimer) {
14197
- clearInterval(this.queueProcessTimer);
14198
- this.queueProcessTimer = null;
14208
+ // 如果队列中没有剩余任务,则停止定时器
14209
+ var remainingTasks = this.taskQueue.filter(function (task) {
14210
+ return task.status !== BroadcastTaskStatus.COMPLETED && task.status !== BroadcastTaskStatus.FAILED && task.status !== BroadcastTaskStatus.CANCELLED;
14211
+ });
14212
+ if (remainingTasks.length === 0) {
14213
+ this.clearQueueProcessTimer();
14199
14214
  }
14200
14215
  };
14201
14216
  /**
@@ -14274,6 +14289,7 @@
14274
14289
  }
14275
14290
  // 处理音频数据
14276
14291
  if (response.data) {
14292
+ this.hasReceivedAudio = true;
14277
14293
  // 自定义音频播报时,如果服务器未返回音频URL,使用传入的audioUrl
14278
14294
  if (task.params.type === exports.BroadcastType.AUDIO && task.params.audioUrl && !response.data.voiceUrl) {
14279
14295
  response.data.voiceUrl = task.params.audioUrl;
@@ -14426,20 +14442,12 @@
14426
14442
  * @private
14427
14443
  */
14428
14444
  BroadcastService.prototype.getBroadcastApiPath = function (type) {
14429
- var env = ConfigManager.getInstance().getEnv();
14445
+ ConfigManager.getInstance().getEnv();
14430
14446
  switch (type) {
14431
14447
  case exports.BroadcastType.TEXT:
14432
- // 临时处理,开发和测试环境使用新接口
14433
- if (env === 'dev' || env === 'test') {
14434
- return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
14435
- }
14436
- return '/dh-talker/user/agent/broadcast/text';
14448
+ return '/aiep-openapi/avatar-interaction/v1/broadcast/text';
14437
14449
  case exports.BroadcastType.AUDIO:
14438
- // 临时处理,开发和测试环境使用新接口
14439
- if (env === 'dev' || env === 'test') {
14440
- return '/aiep-openapi/avatar-interaction/v1/broadcast/audio';
14441
- }
14442
- return '/dh-talker/user/agent/broadcast/customAudio';
14450
+ return '/aiep-openapi/avatar-interaction/v1/broadcast/audio';
14443
14451
  default:
14444
14452
  throw new SDKError(exports.ConfigErrorCode.INVALID_CONFIG, "\u672A\u77E5\u7684\u64AD\u62A5\u7C7B\u578B: ".concat(type));
14445
14453
  }
@@ -14471,11 +14479,6 @@
14471
14479
  BroadcastService.prototype.handleError = function (error) {
14472
14480
  var _a, _b;
14473
14481
  this.logger.error('Broadcast error occurred', error);
14474
- // 清理控制器
14475
- if (this.activeController) {
14476
- this.activeController.abort();
14477
- this.activeController = null;
14478
- }
14479
14482
  // 触发错误回调
14480
14483
  (_b = (_a = this.callbacks).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
14481
14484
  };
@@ -14504,6 +14507,17 @@
14504
14507
  break;
14505
14508
  }
14506
14509
  };
14510
+ /**
14511
+ * 清理队列处理定时器
14512
+ * @description 清理队列处理定时器
14513
+ * @private
14514
+ */
14515
+ BroadcastService.prototype.clearQueueProcessTimer = function () {
14516
+ if (this.queueProcessTimer) {
14517
+ clearInterval(this.queueProcessTimer);
14518
+ this.queueProcessTimer = null;
14519
+ }
14520
+ };
14507
14521
  return BroadcastService;
14508
14522
  }(UnityBaseService);
14509
14523