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