@siact/sime-x-vue 0.0.23 → 0.0.24

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.
@@ -1519,7 +1519,9 @@
1519
1519
  "3你好,世界,今天是想起五天气横扫的缺点"
1520
1520
  ].forEach((text, index) => {
1521
1521
  setTimeout(() => {
1522
- aiChatbotX.speakText(text);
1522
+ aiChatbotX.speakText(text).call(() => {
1523
+ console.log("speak end");
1524
+ });
1523
1525
  }, index * 1e3);
1524
1526
  });
1525
1527
  };
@@ -1687,7 +1689,7 @@
1687
1689
  }
1688
1690
  });
1689
1691
 
1690
- const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-36096054"]]);
1692
+ const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-3d80e12e"]]);
1691
1693
 
1692
1694
  class CommandManager {
1693
1695
  commands = /* @__PURE__ */ new Map();
@@ -1789,7 +1791,8 @@
1789
1791
  voiceAssistantRef.value?.agentInvoke(text);
1790
1792
  },
1791
1793
  speakText: (text) => {
1792
- voiceAssistantRef.value?.speakText(text);
1794
+ return voiceAssistantRef.value?.speakText(text) ?? { call: () => {
1795
+ } };
1793
1796
  },
1794
1797
  stopSpeak: () => {
1795
1798
  voiceAssistantRef.value?.stopSpeak();
@@ -2385,14 +2388,19 @@
2385
2388
  isProcessingSpeakQueue = true;
2386
2389
  tts.hasPendingAudio.value = true;
2387
2390
  while (speakQueue.length > 0) {
2388
- const text = speakQueue.shift();
2391
+ const item = speakQueue.shift();
2389
2392
  bubble.open();
2390
- agent.currentTextContent.value = text;
2393
+ agent.currentTextContent.value = item.text;
2391
2394
  try {
2392
- await tts.speakAndWait(text);
2395
+ await tts.speakAndWait(item.text);
2393
2396
  } catch (e) {
2394
2397
  console.error("[speakQueue] 播报失败:", e);
2395
2398
  }
2399
+ try {
2400
+ item.onComplete?.();
2401
+ } catch (e) {
2402
+ console.error("[speakQueue] onComplete 回调出错:", e);
2403
+ }
2396
2404
  if (speakQueue.length > 0) {
2397
2405
  tts.hasPendingAudio.value = true;
2398
2406
  }
@@ -2402,10 +2410,16 @@
2402
2410
  bubble.scheduleDismiss();
2403
2411
  };
2404
2412
  const speakTextWithBubble = (text) => {
2405
- speakQueue.push(text);
2413
+ const item = { text };
2414
+ speakQueue.push(item);
2406
2415
  if (!isProcessingSpeakQueue) {
2407
2416
  processSpeakQueue();
2408
2417
  }
2418
+ return {
2419
+ call: (fn) => {
2420
+ item.onComplete = fn;
2421
+ }
2422
+ };
2409
2423
  };
2410
2424
  const stopSpeak = () => {
2411
2425
  speakQueue.length = 0;
@@ -2581,7 +2595,7 @@
2581
2595
  }
2582
2596
  });
2583
2597
 
2584
- const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-177013f4"]]);
2598
+ const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8ce9ddda"]]);
2585
2599
 
2586
2600
  var clientCommandKey = /* @__PURE__ */ ((clientCommandKey2) => {
2587
2601
  clientCommandKey2["SET_THEME"] = "SiMeAgent_setTheme";