@vunk/plus 1.2.2 → 1.3.1

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 (119) hide show
  1. package/components/SendOutlined.mjs +2 -2
  2. package/components/agent-chat-provider/index.d.ts +7 -0
  3. package/components/agent-chat-provider/index.mjs +789 -0
  4. package/components/agent-chat-provider/src/api.d.ts +3 -0
  5. package/components/agent-chat-provider/src/const-roles.d.ts +8 -0
  6. package/components/agent-chat-provider/src/const.d.ts +1 -0
  7. package/components/agent-chat-provider/src/index.vue.d.ts +47 -0
  8. package/components/agent-chat-provider/src/types.d.ts +37 -0
  9. package/components/agent-chat-provider/src/use.d.ts +29 -0
  10. package/components/avatar/index.mjs +2 -2
  11. package/components/avatar/src/ctx.d.ts +4 -4
  12. package/components/avatar/src/index.vue.d.ts +66 -125
  13. package/components/broadcasting-markdown/index.css +3 -0
  14. package/components/broadcasting-markdown/index.d.ts +5 -0
  15. package/components/broadcasting-markdown/index.mjs +637 -0
  16. package/components/broadcasting-markdown/src/const.d.ts +18 -0
  17. package/components/broadcasting-markdown/src/ctx.d.ts +93 -0
  18. package/components/broadcasting-markdown/src/custom-speech.vue.d.ts +109 -0
  19. package/components/broadcasting-markdown/src/index.vue.d.ts +477 -0
  20. package/components/broadcasting-markdown/src/paragraph.vue.d.ts +78 -0
  21. package/components/broadcasting-markdown/src/speech-error.vue.d.ts +60 -0
  22. package/components/broadcasting-markdown/src/types.d.ts +17 -0
  23. package/components/broadcasting-markdown/src/use.d.ts +3 -0
  24. package/components/broadcasting-markdown/src/web-speech.vue.d.ts +102 -0
  25. package/components/bubble-list/index.css +18 -0
  26. package/components/bubble-list/index.d.ts +5 -0
  27. package/components/bubble-list/index.mjs +386 -0
  28. package/components/bubble-list/src/ctx.d.ts +30 -0
  29. package/components/bubble-list/src/index.vue.d.ts +927 -0
  30. package/components/bubble-list/src/types.d.ts +4 -0
  31. package/components/bubble-templates/index.css +18 -0
  32. package/components/bubble-templates/index.d.ts +4 -0
  33. package/components/bubble-templates/index.mjs +258 -0
  34. package/components/bubble-templates/src/index.vue.d.ts +631 -0
  35. package/components/bubble-templates/src/types.d.ts +30 -0
  36. package/components/chat-independent/index.css +47 -0
  37. package/components/chat-independent/index.d.ts +4 -0
  38. package/components/chat-independent/index.mjs +184 -0
  39. package/components/chat-independent/src/const.d.ts +13 -0
  40. package/components/chat-independent/src/ctx.d.ts +20 -0
  41. package/components/chat-independent/src/index.vue.d.ts +2388 -0
  42. package/components/chat-independent/src/types.d.ts +13 -0
  43. package/components/index.d.ts +0 -0
  44. package/components/index.mjs +1 -0
  45. package/components/index2.mjs +35980 -0
  46. package/components/lottie-animation/index.mjs +2 -2
  47. package/components/lottie-animation/src/index.vue.d.ts +1 -1
  48. package/components/monaco-editor/index.mjs +2 -2
  49. package/components/monaco-editor/src/ctx.d.ts +3 -3
  50. package/components/monaco-editor/src/index.vue.d.ts +3 -3
  51. package/components/monaco-environment/index.mjs +1 -1
  52. package/components/recorder-button/index.css +7 -10
  53. package/components/recorder-button/index.mjs +115 -83
  54. package/components/recorder-button/src/ctx.d.ts +27 -6
  55. package/components/recorder-button/src/index.vue.d.ts +196 -202
  56. package/components/recorder-button/src/types.d.ts +1 -0
  57. package/components/routes-menu-content/index.mjs +5 -5
  58. package/components/routes-menu-content/src/ctx.d.ts +1 -1
  59. package/components/routes-menu-content/src/index.vue.d.ts +223 -101
  60. package/components/routes-menu-content/src/item/core/ctx.d.ts +1 -1
  61. package/components/routes-menu-content/src/item/core/index.vue.d.ts +175 -53
  62. package/components/routes-menu-content/src/item/index.vue.d.ts +221 -99
  63. package/components/sender/index.css +2 -5
  64. package/components/sender/index.mjs +32 -13
  65. package/components/sender/src/SenderHeader.vue.d.ts +31 -45
  66. package/components/sender/src/ctx.d.ts +23 -3
  67. package/components/sender/src/index.vue.d.ts +170 -124
  68. package/components/sender/src/types.d.ts +1 -1
  69. package/components/speech-button/index.mjs +7 -14
  70. package/components/speech-button/src/ctx.d.ts +1 -1
  71. package/components/speech-button/src/index.vue.d.ts +3 -3
  72. package/components/table-columns/index.d.ts +1 -1
  73. package/components/table-columns/index.mjs +3 -6
  74. package/components/table-columns/src/ctx.d.ts +8 -8
  75. package/components/table-columns/src/el-ctx.d.ts +7 -7
  76. package/components/table-columns/src/index.vue.d.ts +38 -36
  77. package/components/tables-v1/index.mjs +3 -3
  78. package/components/tables-v1/src/ctx.d.ts +66 -68
  79. package/components/tables-v1/src/el-ctx.d.ts +48 -51
  80. package/components/tables-v1/src/index.vue.d.ts +1950 -1933
  81. package/components/tables-v1-checkbox/index.mjs +269 -33
  82. package/components/tables-v1-checkbox/src/ctx.d.ts +65 -67
  83. package/components/tables-v1-checkbox/src/index.vue.d.ts +2167 -2159
  84. package/components/typing-markdown/index.mjs +128 -33
  85. package/components/typing-markdown/src/core.d.ts +2 -3
  86. package/components/typing-markdown/src/ctx.d.ts +5 -5
  87. package/components/typing-markdown/src/index.vue.d.ts +9 -9
  88. package/components/vditor/index.mjs +5 -9
  89. package/components/vditor/src/ctx.d.ts +2 -2
  90. package/components/vditor/src/handle-fullscreen.vue.d.ts +3 -3
  91. package/components/vditor/src/handle-value.vue.d.ts +3 -3
  92. package/components/vditor/src/index.vue.d.ts +11 -11
  93. package/composables/el-breakpoints/index.d.ts +1 -1
  94. package/composables/recorder/index.mjs +751 -182
  95. package/icons/_plugin-vue_export-helper.mjs +9 -0
  96. package/icons/end/index.d.ts +4 -0
  97. package/icons/end/index.mjs +36 -0
  98. package/icons/end/src/avatar.d.ts +12 -0
  99. package/icons/end/src/icon.d.ts +57 -0
  100. package/icons/keyboard/index.d.ts +4 -0
  101. package/icons/keyboard/index.mjs +36 -0
  102. package/icons/keyboard/src/avatar.d.ts +12 -0
  103. package/icons/keyboard/src/icon.d.ts +57 -0
  104. package/icons/start/index.d.ts +4 -0
  105. package/icons/start/index.mjs +36 -0
  106. package/icons/start/src/avatar.d.ts +12 -0
  107. package/icons/start/src/icon.d.ts +57 -0
  108. package/icons/voice/index.d.ts +4 -0
  109. package/icons/voice/index.mjs +51 -0
  110. package/icons/voice/src/avatar.d.ts +12 -0
  111. package/icons/voice/src/icon.d.ts +57 -0
  112. package/icons/voice/src/index.vue.d.ts +4 -0
  113. package/index.css +99 -15
  114. package/package.json +51 -7
  115. package/fetch/PlusFetch/index.d.ts +0 -14
  116. package/fetch/PlusFetch/index.mjs +0 -638
  117. package/fetch/PlusFetch/types.d.ts +0 -54
  118. package/fetch/index.d.ts +0 -1
  119. package/fetch/index.mjs +0 -5
@@ -0,0 +1,47 @@
1
+ .vk-chat-independent-main__bubbles {
2
+ padding: 8px 8px 0 12px;
3
+ height: 100%;
4
+ }
5
+ .vk-chat-independent-main .el-bubble-content-wrapper .el-bubble-content-borderless{
6
+ border: none;
7
+ }
8
+ .vk-chat-independent-footer{
9
+ display: flex;
10
+ align-items: center;
11
+ padding: var(--gap-s, 6px);
12
+ background: var(--el-fill-color);
13
+ }
14
+ .vk-chat-independent-footer .vk-recorder-container{
15
+ flex-basis: 100%;
16
+ }
17
+ .vk-chat-independent-footer .el-avatar{
18
+ cursor: pointer;
19
+ align-self: flex-end;
20
+ }
21
+ .vk-chat-independent-footer .ant-sender{
22
+ border-radius: var(--el-border-radius-base, 4px);
23
+ }
24
+ .vk-chat-independent-footer .ant-sender-content{
25
+ padding: 4px;
26
+ /* border-radius: 0; */
27
+ }
28
+ .vk-chat-independent{
29
+ width: 100%;
30
+ height: 100%;
31
+ position: relative;
32
+ }
33
+ .vk-chat-independent-main__duplex{
34
+ height: 100%;
35
+ }
36
+ .vk-chat-independent-main{
37
+ z-index: 1;
38
+ inset: 0;
39
+ position: absolute;
40
+ }
41
+ .vk-chat-independent-background{
42
+ position: absolute;
43
+ inset: 0;
44
+ width: 100%;
45
+ height: 100%;
46
+ z-index: 0;
47
+ }
@@ -0,0 +1,4 @@
1
+ import VkChatIndependent from './src/index.vue';
2
+ export * as __VkChatIndependent from './src/types';
3
+ export { VkChatIndependent, };
4
+ export default VkChatIndependent;
@@ -0,0 +1,184 @@
1
+ import { defineComponent, ref, computed, createElementBlock, openBlock, createElementVNode, createVNode, unref, withCtx, withDirectives, vShow, renderSlot, nextTick } from 'vue';
2
+ import { useAgentChat } from '@vunk/plus/components/agent-chat-provider';
3
+ import { VkBubbleList } from '@vunk/plus/components/bubble-list';
4
+ import { VkRecorderButton } from '@vunk/plus/components/recorder-button';
5
+ import { VkSender } from '@vunk/plus/components/sender';
6
+ import { VkKeyboardAvatar } from '@vunk/plus/icons/keyboard';
7
+ import { VkVoiceAvatar } from '@vunk/plus/icons/voice';
8
+ import { VkDuplex } from '@vunk/core';
9
+ import { VkRendererData } from '@vunk/core/components/renderer-data';
10
+ import { useDataComputed, useDeferred } from '@vunk/core/composables';
11
+
12
+ var InputType = /* @__PURE__ */ ((InputType2) => {
13
+ InputType2["Voice"] = "voice";
14
+ InputType2["Text"] = "text";
15
+ return InputType2;
16
+ })(InputType || {});
17
+
18
+ const props = {
19
+ /**
20
+ * @description BubbleList渲染时数据, 受控于setData
21
+ */
22
+ data: {
23
+ type: Object
24
+ },
25
+ speechToText: {
26
+ type: Function
27
+ },
28
+ textToSpeech: {
29
+ type: Function
30
+ }
31
+ };
32
+ const emits = {
33
+ setData: (e) => e
34
+ };
35
+
36
+ const _hoisted_1 = { class: "vk-chat-independent" };
37
+ const _hoisted_2 = { class: "vk-chat-independent-main__bubbles" };
38
+ const _hoisted_3 = { class: "vk-chat-independent-footer" };
39
+ const _hoisted_4 = { class: "vk-chat-independent-background" };
40
+ var _sfc_main = /* @__PURE__ */ defineComponent({
41
+ ...{
42
+ name: "VkChatIndependent"
43
+ },
44
+ __name: "index",
45
+ props: props,
46
+ emits: emits,
47
+ setup(__props, { emit: __emit }) {
48
+ const props = __props;
49
+ const emit = __emit;
50
+ const [bubbleData, setBubbleData] = useDataComputed({}, props, emit);
51
+ const mainRef = ref();
52
+ const inputType = ref(InputType.Text);
53
+ const content = ref("");
54
+ const bubbleListDef = useDeferred();
55
+ const bubbleListReslove = bubbleListDef.resolve;
56
+ const { simplicity } = useAgentChat();
57
+ const { items: bubbleItems, onRequest } = simplicity;
58
+ 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 {};
64
+ });
65
+ const senderDisabled = computed(() => {
66
+ if (lastBubbleData.value.error === true) {
67
+ return false;
68
+ }
69
+ return bubbleItems.value.at(-1)?.loading === true || lastBubbleData.value.completed === false;
70
+ });
71
+ function onSubmit(nextContent) {
72
+ if (!nextContent)
73
+ return;
74
+ onRequest(nextContent);
75
+ nextTick(() => {
76
+ content.value = "";
77
+ });
78
+ setTimeout(() => {
79
+ bubbleListDef.value?.scrollToBottom();
80
+ }, 400);
81
+ }
82
+ return (_ctx, _cache) => {
83
+ return openBlock(), createElementBlock("div", _hoisted_1, [
84
+ createElementVNode(
85
+ "div",
86
+ {
87
+ ref_key: "mainRef",
88
+ ref: mainRef,
89
+ class: "vk-chat-independent-main"
90
+ },
91
+ [
92
+ createVNode(unref(VkDuplex), {
93
+ "with-flex": "one",
94
+ class: "vk-chat-independent-main__duplex"
95
+ }, {
96
+ one: withCtx(() => [
97
+ createVNode(unref(VkRendererData), {
98
+ data: unref(bubbleData),
99
+ onSetData: unref(setBubbleData)
100
+ }, {
101
+ default: withCtx(() => [
102
+ createElementVNode("div", _hoisted_2, [
103
+ createVNode(unref(VkBubbleList), {
104
+ "el-ref": unref(bubbleListReslove),
105
+ items: unref(bubbleItems),
106
+ "text-to-speech": _ctx.textToSpeech
107
+ }, null, 8, ["el-ref", "items", "text-to-speech"])
108
+ ])
109
+ ]),
110
+ _: 1
111
+ /* STABLE */
112
+ }, 8, ["data", "onSetData"])
113
+ ]),
114
+ two: withCtx(() => [
115
+ createElementVNode("div", _hoisted_3, [
116
+ withDirectives(createVNode(
117
+ unref(VkKeyboardAvatar),
118
+ {
119
+ size: 40,
120
+ onClick: _cache[0] || (_cache[0] = ($event) => inputType.value = unref(InputType).Text)
121
+ },
122
+ null,
123
+ 512
124
+ /* NEED_PATCH */
125
+ ), [
126
+ [vShow, inputType.value === unref(InputType).Voice]
127
+ ]),
128
+ withDirectives(createVNode(
129
+ unref(VkVoiceAvatar),
130
+ {
131
+ size: 40,
132
+ onClick: _cache[1] || (_cache[1] = ($event) => inputType.value = unref(InputType).Voice)
133
+ },
134
+ null,
135
+ 512
136
+ /* NEED_PATCH */
137
+ ), [
138
+ [vShow, inputType.value === unref(InputType).Text]
139
+ ]),
140
+ withDirectives(createVNode(unref(VkRecorderButton), {
141
+ "append-to": mainRef.value,
142
+ disabled: senderDisabled.value,
143
+ "speech-to-text": _ctx.speechToText,
144
+ "submit-to-text": true,
145
+ onSubmitText: onSubmit
146
+ }, null, 8, ["append-to", "disabled", "speech-to-text"]), [
147
+ [vShow, inputType.value === unref(InputType).Voice]
148
+ ]),
149
+ withDirectives(createVNode(unref(VkSender), {
150
+ modelValue: content.value,
151
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => content.value = $event),
152
+ "auto-size": true,
153
+ placeholder: "\u8BF7\u8F93\u5165\u5185\u5BB9",
154
+ disabled: senderDisabled.value,
155
+ onSubmit
156
+ }, null, 8, ["modelValue", "disabled"]), [
157
+ [vShow, inputType.value === unref(InputType).Text]
158
+ ])
159
+ ])
160
+ ]),
161
+ _: 1
162
+ /* STABLE */
163
+ })
164
+ ],
165
+ 512
166
+ /* NEED_PATCH */
167
+ ),
168
+ createElementVNode("div", _hoisted_4, [
169
+ renderSlot(_ctx.$slots, "background")
170
+ ])
171
+ ]);
172
+ };
173
+ }
174
+ });
175
+
176
+ var types = /*#__PURE__*/Object.freeze({
177
+ __proto__: null
178
+ });
179
+
180
+ _sfc_main.install = (app) => {
181
+ app.component(_sfc_main.name || "VkChatIndependent", _sfc_main);
182
+ };
183
+
184
+ export { _sfc_main as VkChatIndependent, types as __VkChatIndependent, _sfc_main as default };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 输入的两种方式 语音和文本
3
+ */
4
+ export declare enum InputType {
5
+ /**
6
+ * 语音
7
+ */
8
+ Voice = "voice",
9
+ /**
10
+ * 文本
11
+ */
12
+ Text = "text"
13
+ }
@@ -0,0 +1,20 @@
1
+ import type { __VkBubbleList } from '@vunk/plus/components/bubble-list';
2
+ import type { SetDataEvent } from '@vunk/core';
3
+ import type { PropType } from 'vue';
4
+ export declare const props: {
5
+ /**
6
+ * @description BubbleList渲染时数据, 受控于setData
7
+ */
8
+ data: {
9
+ type: PropType<import("../../bubble-templates/src/types").RenderData>;
10
+ };
11
+ speechToText: {
12
+ type: PropType<import("./types").SpeechToText>;
13
+ };
14
+ textToSpeech: {
15
+ type: PropType<import("./types").TextToSpeech>;
16
+ };
17
+ };
18
+ export declare const emits: {
19
+ setData: (e: SetDataEvent) => SetDataEvent;
20
+ };