@siact/sime-x-vue 0.0.19 → 0.0.21

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.
@@ -107,7 +107,7 @@
107
107
  const _hoisted_10$2 = { class: "ai-chat__messages-inner" };
108
108
  const _hoisted_11$2 = { class: "ai-chat__message-content" };
109
109
  const _hoisted_12$2 = ["innerHTML"];
110
- const _hoisted_13$1 = {
110
+ const _hoisted_13$2 = {
111
111
  key: 1,
112
112
  class: "ai-chat__reasoning"
113
113
  };
@@ -470,7 +470,7 @@
470
470
  innerHTML: renderMarkdown(part.text)
471
471
  }, null, 8, _hoisted_12$2)
472
472
  ])
473
- ], 2)) : part.type === "reasoning" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$1, [
473
+ ], 2)) : part.type === "reasoning" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_13$2, [
474
474
  vue.createElementVNode("button", {
475
475
  class: "ai-chat__reasoning-trigger",
476
476
  onClick: ($event) => toggleReasoning(message.id)
@@ -1465,7 +1465,7 @@
1465
1465
  };
1466
1466
  const _hoisted_11$1 = { class: "input-bar" };
1467
1467
  const _hoisted_12$1 = ["disabled"];
1468
- const _hoisted_13 = ["disabled"];
1468
+ const _hoisted_13$1 = ["disabled"];
1469
1469
  const _hoisted_14 = {
1470
1470
  key: 0,
1471
1471
  class: "btn-spinner",
@@ -1513,7 +1513,7 @@
1513
1513
  }
1514
1514
  };
1515
1515
  const test = () => {
1516
- aiChatbotX.invokeText("你好");
1516
+ aiChatbotX.speakText("你好,世界,今天是想起五天气横扫的缺点");
1517
1517
  };
1518
1518
  const test1 = () => {
1519
1519
  aiChatbotX.abortInvoke();
@@ -1672,14 +1672,14 @@
1672
1672
  "stroke-linejoin": "round"
1673
1673
  }, null, -1)
1674
1674
  ])]))
1675
- ], 8, _hoisted_13)
1675
+ ], 8, _hoisted_13$1)
1676
1676
  ])
1677
1677
  ]);
1678
1678
  };
1679
1679
  }
1680
1680
  });
1681
1681
 
1682
- const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-93ed98f5"]]);
1682
+ const commandTest = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2d2cea1f"]]);
1683
1683
 
1684
1684
  class CommandManager {
1685
1685
  commands = /* @__PURE__ */ new Map();
@@ -1752,9 +1752,7 @@
1752
1752
  });
1753
1753
  const stopBroadcastRef = vue.shallowRef(async () => {
1754
1754
  });
1755
- const voiceAssistantRef = vue.shallowRef(
1756
- null
1757
- );
1755
+ const voiceAssistantRef = vue.shallowRef(null);
1758
1756
  vue.provide(AiChatbotXKey, {
1759
1757
  appToken: () => props.appToken,
1760
1758
  organizationId: () => props.organizationId,
@@ -1779,9 +1777,15 @@
1779
1777
  async executeCommand(commandName, args = []) {
1780
1778
  return await commandManager.value.executeCommand(commandName, args);
1781
1779
  },
1782
- invokeText: async (text) => {
1780
+ sendMessage: async (text) => {
1783
1781
  voiceAssistantRef.value?.agentInvoke(text);
1784
1782
  },
1783
+ speakText: (text) => {
1784
+ voiceAssistantRef.value?.speakText(text);
1785
+ },
1786
+ stopSpeak: () => {
1787
+ voiceAssistantRef.value?.stopSpeak();
1788
+ },
1785
1789
  abortInvoke: () => {
1786
1790
  voiceAssistantRef.value?.agentAbort();
1787
1791
  }
@@ -2251,8 +2255,12 @@
2251
2255
  key: 2,
2252
2256
  class: "agent-text"
2253
2257
  };
2254
- const _hoisted_11 = { class: "fab-avatar-wrapper" };
2255
- const _hoisted_12 = ["src"];
2258
+ const _hoisted_11 = {
2259
+ key: 0,
2260
+ class: "status-pill"
2261
+ };
2262
+ const _hoisted_12 = { class: "fab-avatar-wrapper" };
2263
+ const _hoisted_13 = ["src"];
2256
2264
  const currentTheme = "dark";
2257
2265
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
2258
2266
  __name: "voice-assistant",
@@ -2323,6 +2331,15 @@
2323
2331
  tts.stop();
2324
2332
  bubble.hide();
2325
2333
  };
2334
+ const speakTextWithBubble = async (text) => {
2335
+ bubble.open();
2336
+ agent.currentTextContent.value = text;
2337
+ try {
2338
+ await tts.speak(text);
2339
+ } finally {
2340
+ bubble.scheduleDismiss();
2341
+ }
2342
+ };
2326
2343
  const voice = useVoiceRecognition({
2327
2344
  modelPath: props.modelPath,
2328
2345
  wakeWords: props.wakeWords,
@@ -2341,7 +2358,7 @@
2341
2358
  tts.warmUpAudio();
2342
2359
  await voice.toggleVoiceMode(targetState);
2343
2360
  };
2344
- const { voiceStatus, wakeAnimating, isTranscribing } = voice;
2361
+ const { voiceStatus, transcriptionText, wakeAnimating, isTranscribing } = voice;
2345
2362
  const { isInvoking, currentTextContent, currentToolParts, executingTools, hasAnyContent, toolDisplayName } = agent;
2346
2363
  aiChatbotX?.registerVoiceMethods({
2347
2364
  stopBroadcast: async () => interruptCurrentResponse(),
@@ -2350,7 +2367,9 @@
2350
2367
  });
2351
2368
  aiChatbotX?.registerVoiceAssistant({
2352
2369
  agentInvoke: agent.invoke,
2353
- agentAbort: agent.abort
2370
+ agentAbort: agent.abort,
2371
+ speakText: speakTextWithBubble,
2372
+ stopSpeak: tts.stop
2354
2373
  });
2355
2374
  vue.onBeforeUnmount(async () => {
2356
2375
  bubble.destroy();
@@ -2439,14 +2458,15 @@
2439
2458
  class: "assistant-fab",
2440
2459
  onClick: _cache[0] || (_cache[0] = ($event) => toggleVoiceMode())
2441
2460
  }, [
2442
- vue.createElementVNode("div", _hoisted_11, [
2461
+ vue.unref(transcriptionText) || vue.unref(isInvoking) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, vue.toDisplayString(vue.unref(isInvoking) ? "正在思考中..." : vue.unref(transcriptionText)), 1)) : vue.createCommentVNode("", true),
2462
+ vue.createElementVNode("div", _hoisted_12, [
2443
2463
  vue.createElementVNode("img", {
2444
2464
  src: __props.xLogo ? __props.xLogo : "/x.png",
2445
2465
  alt: "voice assistant",
2446
2466
  style: vue.normalizeStyle({
2447
2467
  width: `${__props.xSize?.width || 88}px`
2448
2468
  })
2449
- }, null, 12, _hoisted_12),
2469
+ }, null, 12, _hoisted_13),
2450
2470
  vue.createVNode(vue.Transition, { name: "indicator-fade" }, {
2451
2471
  default: vue.withCtx(() => [
2452
2472
  vue.unref(voiceStatus) === "listening" ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -2488,7 +2508,7 @@
2488
2508
  }
2489
2509
  });
2490
2510
 
2491
- const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d1d9b351"]]);
2511
+ const voiceAssistant = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ac1884ea"]]);
2492
2512
 
2493
2513
  var clientCommandKey = /* @__PURE__ */ ((clientCommandKey2) => {
2494
2514
  clientCommandKey2["SET_THEME"] = "SiMeAgent_setTheme";