@vunk/plus 1.3.8 → 1.3.10

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.
Files changed (105) hide show
  1. package/components/broadcasting-markdown/index.mjs +18 -6
  2. package/components/bubble-list/index.mjs +12 -1
  3. package/components/bubble-templates/index.mjs +21 -5
  4. package/components/chat-independent/index.mjs +41 -15
  5. package/components/recorder-button/index.mjs +4 -7
  6. package/components/sender/index.mjs +11 -8
  7. package/composables/recorder/index.mjs +8 -5
  8. package/package.json +1 -1
  9. package/components/agent-chat-provider/index.d.ts +0 -7
  10. package/components/agent-chat-provider/src/api.d.ts +0 -3
  11. package/components/agent-chat-provider/src/const-roles.d.ts +0 -8
  12. package/components/agent-chat-provider/src/const.d.ts +0 -1
  13. package/components/agent-chat-provider/src/index.vue.d.ts +0 -47
  14. package/components/agent-chat-provider/src/types.d.ts +0 -37
  15. package/components/agent-chat-provider/src/use.d.ts +0 -29
  16. package/components/avatar/index.d.ts +0 -4
  17. package/components/avatar/src/ctx.d.ts +0 -18
  18. package/components/avatar/src/index.vue.d.ts +0 -121
  19. package/components/avatar/src/types.d.ts +0 -1
  20. package/components/broadcasting-markdown/index.d.ts +0 -5
  21. package/components/broadcasting-markdown/src/const.d.ts +0 -18
  22. package/components/broadcasting-markdown/src/ctx.d.ts +0 -101
  23. package/components/broadcasting-markdown/src/custom-speech.vue.d.ts +0 -117
  24. package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +0 -117
  25. package/components/broadcasting-markdown/src/index.vue.d.ts +0 -516
  26. package/components/broadcasting-markdown/src/paragraph.vue.d.ts +0 -92
  27. package/components/broadcasting-markdown/src/speech-error.vue.d.ts +0 -60
  28. package/components/broadcasting-markdown/src/types.d.ts +0 -17
  29. package/components/broadcasting-markdown/src/use.d.ts +0 -3
  30. package/components/broadcasting-markdown/src/web-speech.vue.d.ts +0 -110
  31. package/components/bubble-list/index.d.ts +0 -5
  32. package/components/bubble-list/src/ctx.d.ts +0 -30
  33. package/components/bubble-list/src/index.vue.d.ts +0 -966
  34. package/components/bubble-list/src/types.d.ts +0 -4
  35. package/components/bubble-templates/index.d.ts +0 -4
  36. package/components/bubble-templates/src/index.vue.d.ts +0 -670
  37. package/components/bubble-templates/src/types.d.ts +0 -30
  38. package/components/chat-independent/index.d.ts +0 -4
  39. package/components/chat-independent/src/const.d.ts +0 -13
  40. package/components/chat-independent/src/ctx.d.ts +0 -20
  41. package/components/chat-independent/src/index.vue.d.ts +0 -2427
  42. package/components/chat-independent/src/types.d.ts +0 -13
  43. package/components/index.d.ts +0 -0
  44. package/components/lottie-animation/index.d.ts +0 -4
  45. package/components/lottie-animation/src/ctx.d.ts +0 -10
  46. package/components/lottie-animation/src/index.vue.d.ts +0 -21
  47. package/components/lottie-animation/src/types.d.ts +0 -4
  48. package/components/monaco-editor/index.d.ts +0 -5
  49. package/components/monaco-editor/src/ctx.d.ts +0 -23
  50. package/components/monaco-editor/src/index.vue.d.ts +0 -40
  51. package/components/monaco-editor/src/types.d.ts +0 -1
  52. package/components/monaco-environment/index.d.ts +0 -4
  53. package/components/monaco-environment/src/ctx.d.ts +0 -8
  54. package/components/monaco-environment/src/index.vue.d.ts +0 -2
  55. package/components/monaco-environment/src/types.d.ts +0 -1
  56. package/components/recorder-button/index.d.ts +0 -4
  57. package/components/recorder-button/src/ctx.d.ts +0 -40
  58. package/components/recorder-button/src/index.vue.d.ts +0 -303
  59. package/components/recorder-button/src/speech-to-text.d.ts +0 -1
  60. package/components/recorder-button/src/types.d.ts +0 -7
  61. package/components/routes-menu-content/index.d.ts +0 -4
  62. package/components/routes-menu-content/src/ctx.d.ts +0 -17
  63. package/components/routes-menu-content/src/index.vue.d.ts +0 -472
  64. package/components/routes-menu-content/src/item/core/ctx.d.ts +0 -18
  65. package/components/routes-menu-content/src/item/core/index.vue.d.ts +0 -307
  66. package/components/routes-menu-content/src/item/ctx.d.ts +0 -14
  67. package/components/routes-menu-content/src/item/index.vue.d.ts +0 -438
  68. package/components/routes-menu-content/src/types.d.ts +0 -1
  69. package/components/sender/index.d.ts +0 -4
  70. package/components/sender/src/SenderHeader.vue.d.ts +0 -256
  71. package/components/sender/src/ctx.d.ts +0 -58
  72. package/components/sender/src/index.vue.d.ts +0 -778
  73. package/components/sender/src/types.d.ts +0 -1
  74. package/components/speech-button/index.d.ts +0 -4
  75. package/components/speech-button/src/LoadingIcon.vue.d.ts +0 -2
  76. package/components/speech-button/src/RecordingIcon.vue.d.ts +0 -2
  77. package/components/speech-button/src/ctx.d.ts +0 -10
  78. package/components/speech-button/src/index.vue.d.ts +0 -22
  79. package/components/speech-button/src/types.d.ts +0 -1
  80. package/components/table-columns/index.d.ts +0 -5
  81. package/components/table-columns/src/ctx.d.ts +0 -66
  82. package/components/table-columns/src/el-ctx.d.ts +0 -63
  83. package/components/table-columns/src/index.vue.d.ts +0 -282
  84. package/components/table-columns/src/types.d.ts +0 -21
  85. package/components/tables-v1/index.d.ts +0 -5
  86. package/components/tables-v1/src/ctx.d.ts +0 -281
  87. package/components/tables-v1/src/el-ctx.d.ts +0 -269
  88. package/components/tables-v1/src/index.vue.d.ts +0 -3014
  89. package/components/tables-v1/src/types.d.ts +0 -4
  90. package/components/tables-v1-checkbox/index.d.ts +0 -5
  91. package/components/tables-v1-checkbox/src/ctx.d.ts +0 -321
  92. package/components/tables-v1-checkbox/src/index.vue.d.ts +0 -3796
  93. package/components/tables-v1-checkbox/src/types.d.ts +0 -1
  94. package/components/typing-markdown/index.d.ts +0 -4
  95. package/components/typing-markdown/src/core.d.ts +0 -2
  96. package/components/typing-markdown/src/ctx.d.ts +0 -33
  97. package/components/typing-markdown/src/index.vue.d.ts +0 -57
  98. package/components/typing-markdown/src/types.d.ts +0 -1
  99. package/components/vditor/index.d.ts +0 -5
  100. package/components/vditor/src/ctx.d.ts +0 -37
  101. package/components/vditor/src/handle-fullscreen.vue.d.ts +0 -18
  102. package/components/vditor/src/handle-value.vue.d.ts +0 -18
  103. package/components/vditor/src/index.vue.d.ts +0 -144
  104. package/components/vditor/src/types.d.ts +0 -9
  105. package/components/vditor/src/use.d.ts +0 -4
@@ -98,6 +98,7 @@ const props = {
98
98
  };
99
99
  const emits = {
100
100
  "setData": (e) => e,
101
+ "interrupt": null,
101
102
  "update:broadcasting": (_) => true,
102
103
  "update:completed": (_) => true,
103
104
  "update:error": (_) => true
@@ -3690,7 +3691,7 @@ var _sfc_main = defineComponent({
3690
3691
  },
3691
3692
  props,
3692
3693
  emits,
3693
- setup(props2, { emit }) {
3694
+ setup(props2, { emit, expose }) {
3694
3695
  const _data = ref([]);
3695
3696
  const theData = computed(() => {
3696
3697
  return props2.data ?? _data.value;
@@ -3821,6 +3822,14 @@ var _sfc_main = defineComponent({
3821
3822
  }
3822
3823
  }
3823
3824
  }
3825
+ const isInterrupted = ref(false);
3826
+ const thePause = computed(() => {
3827
+ return isInterrupted.value || props2.pause;
3828
+ });
3829
+ function interrupt() {
3830
+ isInterrupted.value = true;
3831
+ emit("interrupt");
3832
+ }
3824
3833
  const isBroadcasting = computed(() => {
3825
3834
  return theData.value.some(
3826
3835
  (item) => item.broadcast === Broadcast.playing
@@ -3854,13 +3863,17 @@ var _sfc_main = defineComponent({
3854
3863
  const isPrevFulfilled = isPrevParagraphFulfilled(currentIndex2);
3855
3864
  return isPrevFulfilled;
3856
3865
  }
3866
+ expose({
3867
+ interrupt
3868
+ });
3857
3869
  return {
3858
3870
  theData,
3859
3871
  ParagraphStatus,
3860
3872
  fulfilledTextValue,
3861
3873
  isPrevParagraphFulfilled,
3862
3874
  isParagraphEnabled,
3863
- processingParagraph
3875
+ processingParagraph,
3876
+ thePause
3864
3877
  };
3865
3878
  }
3866
3879
  });
@@ -3875,11 +3888,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3875
3888
  null,
3876
3889
  [
3877
3890
  renderSlot(_ctx.$slots, "default", { paragraphs: _ctx.theData }, () => [
3878
- createCommentVNode(' <ElButton @click="() => console.log(theData)">\n log\n </ElButton> '),
3879
3891
  createVNode(_component_VkTypingMarkdown, {
3880
3892
  source: _ctx.fulfilledTextValue,
3881
3893
  delay: 200,
3882
- pause: _ctx.pause
3894
+ pause: _ctx.thePause
3883
3895
  }, null, 8, ["source", "pause"])
3884
3896
  ]),
3885
3897
  (openBlock(true), createElementBlock(
@@ -3901,14 +3913,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3901
3913
  createVNode(_component_HowlerSpeechView, {
3902
3914
  render: _ctx.render,
3903
3915
  url: item.url,
3904
- pause: _ctx.pause,
3916
+ pause: _ctx.thePause,
3905
3917
  deferred,
3906
3918
  data: item
3907
3919
  }, null, 8, ["render", "url", "pause", "deferred", "data"]),
3908
3920
  _ctx.webSpeech ? (openBlock(), createBlock(_component_WebSpeechView, {
3909
3921
  key: 0,
3910
3922
  render: _ctx.render,
3911
- pause: _ctx.pause,
3923
+ pause: _ctx.thePause,
3912
3924
  deferred,
3913
3925
  data: item
3914
3926
  }, null, 8, ["render", "pause", "deferred", "data"])) : createCommentVNode("v-if", true)
@@ -2,6 +2,7 @@ import { defineComponent, createBlock, openBlock, unref, withCtx, createVNode, m
2
2
  import { VkBubbleTemplates } from '@vunk/plus/components/bubble-templates';
3
3
  import { VkRenderer } from '@vunk/core/components/renderer';
4
4
  import { VkRendererTemplateInstancesProvider } from '@vunk/core/components/renderer-template-instances-provider';
5
+ import { VkSpreadTo } from '@vunk/core/components/spread-to';
5
6
  import { ElAutoResizer } from 'element-plus';
6
7
  import { BubbleList } from 'vue-element-plus-x';
7
8
  import { noop } from '@vunk/shared/function';
@@ -29,6 +30,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
29
30
  __name: "index",
30
31
  props: props,
31
32
  setup(__props) {
33
+ function getContentWraper(e) {
34
+ return e.el;
35
+ }
32
36
  return (_ctx, _cache) => {
33
37
  return openBlock(), createBlock(unref(VkRendererTemplateInstancesProvider), null, {
34
38
  default: withCtx(() => [
@@ -44,7 +48,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
44
48
  content: withCtx(({ item }) => [
45
49
  createVNode(unref(VkRenderer), {
46
50
  source: [item]
47
- }, null, 8, ["source"])
51
+ }, null, 8, ["source"]),
52
+ createVNode(unref(VkSpreadTo), {
53
+ target: getContentWraper,
54
+ type: "class",
55
+ data: {
56
+ [`is-${item.role}`]: true
57
+ }
58
+ }, null, 8, ["data"])
48
59
  ]),
49
60
  _: 2
50
61
  /* DYNAMIC */
@@ -1,4 +1,4 @@
1
- import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, unref, withCtx, createBlock, createCommentVNode } from 'vue';
1
+ import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, unref, withCtx, createBlock, createCommentVNode, markRaw } from 'vue';
2
2
  import { VkBroadcastingMarkdown } from '@vunk/plus/components/broadcasting-markdown';
3
3
  import { VkRendererTemplate } from '@vunk/core/components/renderer-template';
4
4
  import { Thinking, Typewriter } from 'vue-element-plus-x';
@@ -18,6 +18,12 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  }
19
19
  },
20
20
  setup(__props) {
21
+ function setRef(emitSetData, props, el) {
22
+ emitSetData?.({
23
+ k: [props.key, "elRef"],
24
+ v: markRaw(el)
25
+ });
26
+ }
21
27
  function initRenderData(emitSetData, props) {
22
28
  emitSetData?.({
23
29
  k: [props.key, "meta"],
@@ -25,7 +31,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
25
31
  });
26
32
  emitSetData?.({
27
33
  k: [props.key, "templateType"],
28
- v: "VkBroadcastingMarkdown"
34
+ v: props.templateType
29
35
  });
30
36
  }
31
37
  return (_ctx, _cache) => {
@@ -34,19 +40,28 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
34
40
  null,
35
41
  [
36
42
  createVNode(unref(VkRendererTemplate), { type: "Typewriter" }, {
37
- default: withCtx(({ props, emitSetData }) => [
43
+ default: withCtx(({ emitSetData, props }) => [
38
44
  props.thinkingContent && __props.modules?.includes("Thinking") ? (openBlock(), createBlock(unref(Thinking), {
39
45
  key: 0,
40
46
  content: props.thinkingContent,
41
47
  status: props.thinkingStatus
42
48
  }, null, 8, ["content", "status"])) : createCommentVNode("v-if", true),
43
49
  createVNode(unref(Typewriter), {
50
+ ref: (el) => setRef(emitSetData, props, el),
44
51
  content: props.content,
45
52
  typing: props.typing,
46
53
  "is-markdown": props.isMarkdown,
47
54
  "is-fog": props.isFog,
48
- onVnodeMounted: ($event) => initRenderData(emitSetData, props)
49
- }, null, 8, ["content", "typing", "is-markdown", "is-fog", "onVnodeMounted"])
55
+ onVnodeMounted: ($event) => initRenderData(emitSetData, props),
56
+ onStart: () => emitSetData({
57
+ k: [props.key, "completed"],
58
+ v: false
59
+ }),
60
+ onFinish: () => emitSetData({
61
+ k: [props.key, "completed"],
62
+ v: true
63
+ })
64
+ }, null, 8, ["content", "typing", "is-markdown", "is-fog", "onVnodeMounted", "onStart", "onFinish"])
50
65
  ]),
51
66
  _: 1
52
67
  /* STABLE */
@@ -59,6 +74,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
59
74
  status: props.thinkingStatus
60
75
  }, null, 8, ["content", "status"])) : createCommentVNode("v-if", true),
61
76
  createVNode(unref(VkBroadcastingMarkdown), {
77
+ ref: (el) => setRef(emitSetData, props, el),
62
78
  source: props.content,
63
79
  "keep-read": !props.seviceEnd,
64
80
  "text-to-speech": __props.textToSpeech,
@@ -1,13 +1,13 @@
1
- import { defineComponent, ref, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, withCtx, createCommentVNode, withDirectives, Fragment, vShow, renderSlot, nextTick } from 'vue';
1
+ import { defineComponent, defineAsyncComponent, ref, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, withCtx, createCommentVNode, withDirectives, Fragment, vShow, renderSlot, normalizeProps, guardReactiveProps, nextTick } from 'vue';
2
2
  import { useAgentChat } from '@vunk/plus/components/agent-chat-provider';
3
3
  import { VkBubbleList } from '@vunk/plus/components/bubble-list';
4
- import { VkRecorderButton } from '@vunk/plus/components/recorder-button';
5
4
  import { VkSender } from '@vunk/plus/components/sender';
6
5
  import { VkKeyboardAvatar } from '@vunk/plus/icons/keyboard';
7
6
  import { VkVoiceAvatar } from '@vunk/plus/icons/voice';
8
7
  import { VkDuplex } from '@vunk/core';
9
8
  import { VkRendererData } from '@vunk/core/components/renderer-data';
10
9
  import { useDataComputed, useDeferred } from '@vunk/core/composables';
10
+ import { isNotEmptyObject } from '@vunk/shared/object';
11
11
 
12
12
  var InputType = /* @__PURE__ */ ((InputType2) => {
13
13
  InputType2["Voice"] = "voice";
@@ -47,6 +47,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  setup(__props, { emit: __emit }) {
48
48
  const props = __props;
49
49
  const emit = __emit;
50
+ const VkRecorderButton = defineAsyncComponent(() => import('@vunk/plus/components/recorder-button'));
50
51
  const [bubbleData, setBubbleData] = useDataComputed({}, props, emit);
51
52
  const mainRef = ref();
52
53
  const inputType = ref(InputType.Text);
@@ -56,11 +57,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
56
57
  const { simplicity } = useAgentChat();
57
58
  const { items: bubbleItems, onRequest } = simplicity;
58
59
  const lastBubbleData = computed(() => {
59
- const key = bubbleItems.value.at(-1)?.key;
60
- if (key && bubbleData.value[key]) {
61
- return bubbleData.value[key];
62
- }
63
- return {};
60
+ return getBubbleDataAt(-1);
61
+ });
62
+ const clientLoading = computed(() => {
63
+ return isNotEmptyObject(lastBubbleData.value) && lastBubbleData.value.completed !== true;
64
64
  });
65
65
  const senderDisabled = computed(() => {
66
66
  if (lastBubbleData.value.error === true) {
@@ -79,6 +79,24 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
79
79
  bubbleListDef.value?.scrollToBottom();
80
80
  }, 400);
81
81
  }
82
+ function onCancel() {
83
+ const lastBubble = bubbleItems.value.at(-1);
84
+ if (!lastBubble)
85
+ return;
86
+ lastBubble.abortController?.abort();
87
+ const lastBubbleData2 = bubbleData.value[lastBubble.key];
88
+ lastBubbleData2.elRef?.interrupt();
89
+ nextTick(() => {
90
+ lastBubbleData2.completed = true;
91
+ });
92
+ }
93
+ function getBubbleDataAt(index) {
94
+ const bubble = bubbleItems.value.at(index);
95
+ if (bubble?.key && bubbleData.value[bubble.key]) {
96
+ return bubbleData.value[bubble.key];
97
+ }
98
+ return {};
99
+ }
82
100
  return (_ctx, _cache) => {
83
101
  return openBlock(), createElementBlock("div", _hoisted_1, [
84
102
  createElementVNode(
@@ -104,11 +122,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
104
122
  "el-ref": unref(bubbleListReslove),
105
123
  items: unref(bubbleItems),
106
124
  "text-to-speech": _ctx.textToSpeech
107
- }, null, 8, ["el-ref", "items", "text-to-speech"])
125
+ }, {
126
+ footer: withCtx((e) => [
127
+ renderSlot(_ctx.$slots, "bubble_footer", normalizeProps(guardReactiveProps(e)))
128
+ ]),
129
+ _: 3
130
+ /* FORWARDED */
131
+ }, 8, ["el-ref", "items", "text-to-speech"])
108
132
  ])
109
133
  ]),
110
- _: 1
111
- /* STABLE */
134
+ _: 3
135
+ /* FORWARDED */
112
136
  }, 8, ["data", "onSetData"])
113
137
  ]),
114
138
  two: withCtx(() => [
@@ -159,15 +183,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
159
183
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => content.value = $event),
160
184
  "auto-size": true,
161
185
  placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
162
- disabled: senderDisabled.value,
163
- onSubmit
164
- }, null, 8, ["modelValue", "disabled"]), [
186
+ "send-disabled": senderDisabled.value,
187
+ loading: clientLoading.value,
188
+ onSubmit,
189
+ onCancel
190
+ }, null, 8, ["modelValue", "send-disabled", "loading"]), [
165
191
  [vShow, inputType.value === unref(InputType).Text]
166
192
  ])
167
193
  ])
168
194
  ]),
169
- _: 1
170
- /* STABLE */
195
+ _: 3
196
+ /* FORWARDED */
171
197
  })
172
198
  ],
173
199
  512
@@ -1,11 +1,6 @@
1
1
  import { useRecorder } from '@vunk/plus/composables/recorder';
2
2
  import { ElButton, ElMessage } from 'element-plus';
3
3
  import { defineComponent, ref, onUnmounted, resolveComponent, createElementBlock, openBlock, createCommentVNode, createBlock, createVNode, Teleport, withDirectives, createElementVNode, toDisplayString, normalizeClass, vShow, mergeProps, withCtx } from 'vue';
4
- import 'recorder-core/src/engine/mp3';
5
- import 'recorder-core/src/engine/wav';
6
- import 'recorder-core/src/engine/mp3-engine';
7
- import 'recorder-core/src/extensions/waveview';
8
- import 'recorder-core/src/app-support/app';
9
4
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
10
5
 
11
6
  const props = {
@@ -44,7 +39,8 @@ const props = {
44
39
  };
45
40
  const emits = {
46
41
  submitText: (text) => typeof text === "string",
47
- submit: (_) => true
42
+ submit: (_) => true,
43
+ error: (_) => true
48
44
  };
49
45
 
50
46
  async function speechToText(url, blob) {
@@ -90,7 +86,8 @@ var _sfc_main = defineComponent({
90
86
  }
91
87
  });
92
88
  } catch (e) {
93
- ElMessage.error(`\u5F55\u97F3\u5931\u8D25:${e}`);
89
+ console.error("\u5F55\u97F3\u5931\u8D25:", e);
90
+ emit("error", e);
94
91
  isDragging.value = false;
95
92
  return;
96
93
  }
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, resolveComponent, createBlock, openBlock, withCtx, withDirectives, createElementVNode, mergeProps, toDisplayString, createVNode, renderSlot, vShow, computed, ref, nextTick, createSlots, createCommentVNode } from 'vue';
2
2
  import { useModelComputed, useDeferred } from '@vunk/core/composables';
3
- import { Button, Tooltip } from 'ant-design-vue';
3
+ import { Button } from 'ant-design-vue';
4
4
  import { Attachments, Sender } from 'ant-design-x-vue';
5
5
  import { noop } from '@vunk/shared/function';
6
6
  import { ElCollapseTransition } from 'element-plus';
@@ -42,6 +42,10 @@ const props = {
42
42
  modules: {
43
43
  type: Array,
44
44
  default: () => []
45
+ },
46
+ sendDisabled: {
47
+ type: Boolean,
48
+ default: false
45
49
  }
46
50
  };
47
51
  const emits = {
@@ -168,16 +172,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
168
172
  LoadingButton
169
173
  } = info.components;
170
174
  const loadingRender = () => {
171
- return createVNode(Tooltip, {
172
- "title": "\u70B9\u51FB\u53D6\u6D88"
173
- }, {
174
- default: () => [createVNode(LoadingButton, null, null)]
175
- });
175
+ return createVNode(LoadingButton, null, null);
176
176
  };
177
177
  const sendRender = () => {
178
178
  return createVNode(SendButton, {
179
179
  "type": "text",
180
- "icon": createVNode(SendOutlined, null, null)
180
+ "icon": createVNode(SendOutlined, null, null),
181
+ "disabled": props2.sendDisabled
181
182
  }, null);
182
183
  };
183
184
  const sendAction = () => loading.value ? loadingRender() : sendRender();
@@ -251,7 +252,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
251
252
  loading: _ctx.loading,
252
253
  "allow-speech": true,
253
254
  actions: _ctx.actionsRender,
254
- "on-submit": (e) => _ctx.$emit("submit", e),
255
+ "on-submit": (e) => {
256
+ !_ctx.sendDisabled && _ctx.$emit("submit", e);
257
+ },
255
258
  "on-cancel": () => _ctx.$emit("cancel"),
256
259
  "onUpdate:value": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:modelValue", $event)),
257
260
  onPasteFile: _ctx.handlePasteFile
@@ -1,6 +1,6 @@
1
1
  import { noop } from '@vunk/shared/function';
2
- import { sleep } from '@vunk/shared/promise';
3
- import { ref, shallowRef } from 'vue';
2
+ import { sleep, waiting } from '@vunk/shared/promise';
3
+ import { ref, shallowRef, unref } from 'vue';
4
4
 
5
5
  const LogLevels = {
6
6
  fatal: 0,
@@ -15004,9 +15004,12 @@ function useRecorder(options) {
15004
15004
  });
15005
15005
  }
15006
15006
  function start() {
15007
- if (Recorder.WaveView && waveViewRef) {
15008
- wave.value = Recorder.WaveView({
15009
- elem: waveViewRef.value
15007
+ const waveView = unref(waveViewRef);
15008
+ if (Recorder.WaveView && waveView && !wave.value) {
15009
+ waiting(() => waveView.clientWidth > 0).then(() => {
15010
+ wave.value = Recorder.WaveView({
15011
+ elem: waveView
15012
+ });
15010
15013
  });
15011
15014
  }
15012
15015
  recorder.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/plus",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -1,7 +0,0 @@
1
- import VkAgentChatProvider from './src/index.vue';
2
- export * from './src/const';
3
- export * from './src/const-roles';
4
- export * as __VkAgentChatProvider from './src/types';
5
- export { useAgentChat } from './src/use';
6
- export { VkAgentChatProvider, };
7
- export default VkAgentChatProvider;
@@ -1,3 +0,0 @@
1
- import type { NormalObject } from '@vunk/shared';
2
- import type { RestFetchReaderOnmessage } from '@vunk/shared/fetch';
3
- export declare function agentRequest(onmessage: RestFetchReaderOnmessage, data: NormalObject): Promise<void>;
@@ -1,8 +0,0 @@
1
- import type { RoleMedia } from './types';
2
- export declare enum Role {
3
- User = "user",
4
- Assistant = "assistant",
5
- Broadcasting = "broadcasting"
6
- }
7
- export declare const roleOptions: RoleMedia[];
8
- export declare const roleMap: Record<Role, RoleMedia>;
@@ -1 +0,0 @@
1
- export declare const ChatAgentInjectKey = "vk_agent_chat_inject_key";
@@ -1,47 +0,0 @@
1
- import type { AnyFunc } from '@vunk/shared';
2
- import type { PropType } from 'vue';
3
- import type { AgentChatContext, AgentMessage, Parser } from './types';
4
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
5
- request: {
6
- type: PropType<AnyFunc>;
7
- };
8
- parser: {
9
- type: PropType<Parser>;
10
- };
11
- }>, import("vue").Slot<any> | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- load: (e: AgentChatContext) => {
13
- agent: import("vue").ComputedRef<import("ant-design-x-vue").XAgent<AgentMessage>>;
14
- chat: {
15
- readonly onRequest: (value: AgentMessage) => void;
16
- readonly messages: import("vue").Ref<import("ant-design-x-vue").MessageInfo<AgentMessage>[], import("ant-design-x-vue").MessageInfo<AgentMessage>[]>;
17
- readonly parsedMessages: import("vue").ComputedRef<import("ant-design-x-vue").MessageInfo<import("./types").BubbleMessage>[]>;
18
- readonly setMessages: (updater: import("ant-design-x-vue").MessageInfo<AgentMessage>[] | ((prev: import("ant-design-x-vue").MessageInfo<AgentMessage>[]) => import("ant-design-x-vue").MessageInfo<AgentMessage>[])) => void;
19
- };
20
- simplicity: {
21
- onRequest: (message: string) => void;
22
- items: import("vue").ComputedRef<import("./types").BubbleItem[]>;
23
- };
24
- };
25
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
26
- request: {
27
- type: PropType<AnyFunc>;
28
- };
29
- parser: {
30
- type: PropType<Parser>;
31
- };
32
- }>> & Readonly<{
33
- onLoad?: ((e: {
34
- agent: import("vue").ComputedRef<import("ant-design-x-vue").XAgent<AgentMessage>>;
35
- chat: {
36
- readonly onRequest: (value: AgentMessage) => void;
37
- readonly messages: import("vue").Ref<import("ant-design-x-vue").MessageInfo<AgentMessage>[], import("ant-design-x-vue").MessageInfo<AgentMessage>[]>;
38
- readonly parsedMessages: import("vue").ComputedRef<import("ant-design-x-vue").MessageInfo<import("./types").BubbleMessage>[]>;
39
- readonly setMessages: (updater: import("ant-design-x-vue").MessageInfo<AgentMessage>[] | ((prev: import("ant-design-x-vue").MessageInfo<AgentMessage>[]) => import("ant-design-x-vue").MessageInfo<AgentMessage>[])) => void;
40
- };
41
- simplicity: {
42
- onRequest: (message: string) => void;
43
- items: import("vue").ComputedRef<import("./types").BubbleItem[]>;
44
- };
45
- }) => any) | undefined;
46
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
47
- export default _default;
@@ -1,37 +0,0 @@
1
- import type { __VkBubbleTemplates } from '@vunk/plus/components/bubble-templates';
2
- import type { Media, NormalObject } from '@vunk/shared';
3
- import type { RequestFn } from 'ant-design-x-vue';
4
- import type { BubbleListItemProps } from 'vue-element-plus-x/types/components/BubbleList/types';
5
- import type { initAgentChat } from './use';
6
- export type AgentChatContext = ReturnType<typeof initAgentChat>;
7
- export type Request = RequestFn<AgentMessage>;
8
- export type Parser = (message: AgentMessage) => BubbleMessage | BubbleMessage[];
9
- /**
10
- * @description useXAgent request onSuccess 发送的数据
11
- */
12
- export type AgentMessage = BubbleMessage & {
13
- seviceLoading?: boolean;
14
- seviceEnd?: boolean;
15
- };
16
- /**
17
- * @description useXChat parser 解析数据
18
- */
19
- export type BubbleMessage = Partial<BubbleListItemProps> & {
20
- role: string;
21
- content: string;
22
- seviceEnd?: boolean;
23
- thinkingStatus?: 'start' | 'thinking' | 'end' | 'error';
24
- thinkingContent?: string;
25
- meta?: NormalObject;
26
- };
27
- export type BubbleItem = BubbleItemBasic & __VkBubbleTemplates.RenderItem;
28
- export type RoleMedia = RoleMediaBasic & __VkBubbleTemplates.RenderItem;
29
- export type BubbleItemModule = 'Thinking';
30
- interface BubbleItemBasic extends BubbleMessage {
31
- key: string;
32
- modules?: BubbleItemModule[];
33
- }
34
- interface RoleMediaBasic extends Partial<BubbleItemBasic>, Media {
35
- value: string;
36
- }
37
- export {};
@@ -1,29 +0,0 @@
1
- import type { RequestFn } from 'ant-design-x-vue';
2
- import type { AgentMessage, BubbleItem, BubbleMessage, Parser } from './types';
3
- export declare function useAgent(request: RequestFn<AgentMessage>): import("vue").ComputedRef<import("ant-design-x-vue").XAgent<AgentMessage>>[];
4
- export declare function initAgentChat(request: RequestFn<AgentMessage>, parser: Parser): {
5
- agent: import("vue").ComputedRef<import("ant-design-x-vue").XAgent<AgentMessage>>;
6
- chat: {
7
- readonly onRequest: (value: AgentMessage) => void;
8
- readonly messages: import("vue").Ref<import("ant-design-x-vue").MessageInfo<AgentMessage>[], import("ant-design-x-vue").MessageInfo<AgentMessage>[]>;
9
- readonly parsedMessages: import("vue").ComputedRef<import("ant-design-x-vue").MessageInfo<BubbleMessage>[]>;
10
- readonly setMessages: (updater: import("ant-design-x-vue").MessageInfo<AgentMessage>[] | ((prev: import("ant-design-x-vue").MessageInfo<AgentMessage>[]) => import("ant-design-x-vue").MessageInfo<AgentMessage>[])) => void;
11
- };
12
- simplicity: {
13
- onRequest: (message: string) => void;
14
- items: import("vue").ComputedRef<BubbleItem[]>;
15
- };
16
- };
17
- export declare function useAgentChat(): {
18
- agent: import("vue").ComputedRef<import("ant-design-x-vue").XAgent<AgentMessage>>;
19
- chat: {
20
- readonly onRequest: (value: AgentMessage) => void;
21
- readonly messages: import("vue").Ref<import("ant-design-x-vue").MessageInfo<AgentMessage>[], import("ant-design-x-vue").MessageInfo<AgentMessage>[]>;
22
- readonly parsedMessages: import("vue").ComputedRef<import("ant-design-x-vue").MessageInfo<BubbleMessage>[]>;
23
- readonly setMessages: (updater: import("ant-design-x-vue").MessageInfo<AgentMessage>[] | ((prev: import("ant-design-x-vue").MessageInfo<AgentMessage>[]) => import("ant-design-x-vue").MessageInfo<AgentMessage>[])) => void;
24
- };
25
- simplicity: {
26
- onRequest: (message: string) => void;
27
- items: import("vue").ComputedRef<BubbleItem[]>;
28
- };
29
- };
@@ -1,4 +0,0 @@
1
- import VkAvatar from './src/index.vue';
2
- export * as __VkAvatar from './src/types';
3
- export { VkAvatar, };
4
- export default VkAvatar;
@@ -1,18 +0,0 @@
1
- export declare const props: {
2
- readonly size: import("element-plus/es/utils").EpPropFinalized<readonly [NumberConstructor, StringConstructor], "" | "small" | "default" | "large", number, "", boolean>;
3
- readonly shape: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "circle" | "square", unknown, "circle", boolean>;
4
- readonly icon: {
5
- readonly type: import("vue").PropType<import("element-plus").ButtonType<(new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, {}, any>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, {}, any>) | ((new (...args: any[]) => (string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, {}, any>) & {}) | (() => string | import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, {}, any>))[], unknown, unknown>>;
6
- readonly required: false;
7
- readonly validator: ((val: unknown) => boolean) | undefined;
8
- __epPropKey: true;
9
- };
10
- readonly src: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
11
- readonly alt: StringConstructor;
12
- readonly srcSet: StringConstructor;
13
- readonly fit: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => "initial" | "fill" | "cover" | "contain" | "none" | "scale-down" | "-moz-initial" | "inherit" | "revert" | "unset") | (() => ObjectFitProperty) | ((new (...args: any[]) => "initial" | "fill" | "cover" | "contain" | "none" | "scale-down" | "-moz-initial" | "inherit" | "revert" | "unset") | (() => ObjectFitProperty))[], unknown, unknown, "cover", boolean>;
14
- } & {
15
- background: never;
16
- color: never;
17
- };
18
- export declare const emits: {};