@siact/sime-x-vue 0.0.22 → 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.
@@ -1518,7 +1518,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1518
1518
  "3你好,世界,今天是想起五天气横扫的缺点"
1519
1519
  ].forEach((text, index) => {
1520
1520
  setTimeout(() => {
1521
- aiChatbotX.speakText(text);
1521
+ aiChatbotX.speakText(text).call(() => {
1522
+ console.log("speak end");
1523
+ });
1522
1524
  }, index * 1e3);
1523
1525
  });
1524
1526
  };
@@ -1686,7 +1688,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1686
1688
  }
1687
1689
  });
1688
1690
 
1689
- const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-36096054"]]);
1691
+ const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-3d80e12e"]]);
1690
1692
 
1691
1693
  class CommandManager {
1692
1694
  commands = /* @__PURE__ */ new Map();
@@ -1788,7 +1790,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1788
1790
  voiceAssistantRef.value?.agentInvoke(text);
1789
1791
  },
1790
1792
  speakText: (text) => {
1791
- voiceAssistantRef.value?.speakText(text);
1793
+ return voiceAssistantRef.value?.speakText(text) ?? { call: () => {
1794
+ } };
1792
1795
  },
1793
1796
  stopSpeak: () => {
1794
1797
  voiceAssistantRef.value?.stopSpeak();
@@ -2322,8 +2325,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2322
2325
  bubbleSize: {},
2323
2326
  bubbleDismissDelay: {}
2324
2327
  },
2325
- setup(__props) {
2328
+ emits: ["wake-up"],
2329
+ setup(__props, { emit: __emit }) {
2326
2330
  const props = __props;
2331
+ const emit = __emit;
2327
2332
  const aiChatbotX = injectStrict(AiChatbotXKey);
2328
2333
  const getVoiceConfig = () => {
2329
2334
  if (props.voiceConfig) return props.voiceConfig;
@@ -2382,14 +2387,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2382
2387
  isProcessingSpeakQueue = true;
2383
2388
  tts.hasPendingAudio.value = true;
2384
2389
  while (speakQueue.length > 0) {
2385
- const text = speakQueue.shift();
2390
+ const item = speakQueue.shift();
2386
2391
  bubble.open();
2387
- agent.currentTextContent.value = text;
2392
+ agent.currentTextContent.value = item.text;
2388
2393
  try {
2389
- await tts.speakAndWait(text);
2394
+ await tts.speakAndWait(item.text);
2390
2395
  } catch (e) {
2391
2396
  console.error("[speakQueue] 播报失败:", e);
2392
2397
  }
2398
+ try {
2399
+ item.onComplete?.();
2400
+ } catch (e) {
2401
+ console.error("[speakQueue] onComplete 回调出错:", e);
2402
+ }
2393
2403
  if (speakQueue.length > 0) {
2394
2404
  tts.hasPendingAudio.value = true;
2395
2405
  }
@@ -2399,10 +2409,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2399
2409
  bubble.scheduleDismiss();
2400
2410
  };
2401
2411
  const speakTextWithBubble = (text) => {
2402
- speakQueue.push(text);
2412
+ const item = { text };
2413
+ speakQueue.push(item);
2403
2414
  if (!isProcessingSpeakQueue) {
2404
2415
  processSpeakQueue();
2405
2416
  }
2417
+ return {
2418
+ call: (fn) => {
2419
+ item.onComplete = fn;
2420
+ }
2421
+ };
2406
2422
  };
2407
2423
  const stopSpeak = () => {
2408
2424
  speakQueue.length = 0;
@@ -2414,6 +2430,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2414
2430
  wakeWords: props.wakeWords,
2415
2431
  getVoiceConfig,
2416
2432
  onWake: () => {
2433
+ emit("wake-up");
2417
2434
  interruptCurrentResponse();
2418
2435
  tts.warmUpAudio();
2419
2436
  const text = wakeResponses.value[Math.floor(Math.random() * wakeResponses.value.length)];
@@ -2577,7 +2594,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
2577
2594
  }
2578
2595
  });
2579
2596
 
2580
- const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d15c792e"]]);
2597
+ const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8ce9ddda"]]);
2581
2598
 
2582
2599
  var clientCommandKey = /* @__PURE__ */ ((clientCommandKey2) => {
2583
2600
  clientCommandKey2["SET_THEME"] = "SiMeAgent_setTheme";