@vunk/plus 1.3.1 → 1.3.4
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.
- package/components/agent-chat-provider/index.mjs +1 -574
- package/components/broadcasting-markdown/index.mjs +47 -18
- package/components/broadcasting-markdown/src/ctx.d.ts +8 -0
- package/components/broadcasting-markdown/src/custom-speech.vue.d.ts +9 -1
- package/components/broadcasting-markdown/src/index.vue.d.ts +39 -0
- package/components/broadcasting-markdown/src/paragraph.vue.d.ts +14 -0
- package/components/broadcasting-markdown/src/web-speech.vue.d.ts +8 -0
- package/components/browser.mjs +575 -0
- package/components/bubble-list/index.mjs +2 -316
- package/components/bubble-list/src/index.vue.d.ts +39 -0
- package/components/bubble-templates/index.mjs +2 -161
- package/components/bubble-templates/src/index.vue.d.ts +39 -0
- package/components/chat-independent/index.mjs +42 -34
- package/components/chat-independent/src/index.vue.d.ts +39 -0
- package/components/tables-v1/src/ctx.d.ts +1 -1
- package/components/tables-v1/src/index.vue.d.ts +1 -1
- package/components/tables-v1-checkbox/src/ctx.d.ts +1 -1
- package/components/tables-v1-checkbox/src/index.vue.d.ts +3 -3
- package/components/typing-markdown/index.mjs +2 -2
- package/index.css +0 -38
- package/package.json +1 -7
- package/components/bubble-list/index.css +0 -18
- package/components/bubble-templates/index.css +0 -18
- package/components/index2.mjs +0 -35980
|
@@ -1,326 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineComponent, createBlock, openBlock, unref, withCtx, createVNode, mergeProps } from 'vue';
|
|
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
5
|
import { ElAutoResizer } from 'element-plus';
|
|
6
|
-
import {
|
|
6
|
+
import { BubbleList } from 'vue-element-plus-x';
|
|
7
7
|
import { noop } from '@vunk/shared/function';
|
|
8
8
|
export { Role } from '@vunk/plus/components/agent-chat-provider';
|
|
9
9
|
|
|
10
|
-
const _sfc_main$2 = {};
|
|
11
|
-
const _hoisted_1 = {
|
|
12
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
-
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
14
|
-
version: "1.1",
|
|
15
|
-
width: "704",
|
|
16
|
-
height: "704",
|
|
17
|
-
viewBox: "0 0 704 704"
|
|
18
|
-
};
|
|
19
|
-
function _sfc_render(_ctx, _cache) {
|
|
20
|
-
return openBlock(), createElementBlock("svg", _hoisted_1, _cache[0] || (_cache[0] = [createStaticVNode('<defs><filter id="master_svg0_62_10054" filterUnits="objectBoundingBox" color-interpolation-filters="sRGB" x="-0.030120481927710843" y="-0.030120481927710843" width="1.0602409638554218" height="1.0602409638554218"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"></feBlend><feGaussianBlur stdDeviation="5" result="effect1_foregroundBlur"></feGaussianBlur></filter><linearGradient id="master_svg1_62_10082" x1="0.5" y1="-0.13192443549633026" x2="0.42319029569625854" y2="1.368432641029358"><stop offset="9.145302325487137%" stop-color="currentColor" stop-opacity="1"></stop><stop offset="13.636428117752075%" stop-color="currentColor" stop-opacity="0.07539999485015869"></stop><stop offset="16.968481242656708%" stop-color="currentColor" stop-opacity="0"></stop></linearGradient></defs><g transform="matrix(0,1,-1,0,704,-664)" filter="url(#master_svg0_62_10054)"><path d="M1016,684C1199.359,684,1348,535.359,1348,352C1348,168.641,1199.359,20,1016,20C832.641,20,684,168.641,684,352C684,535.359,832.641,684,1016,684ZM1016,32C1192.731,32,1336,175.269,1336,352C1336,528.731,1192.731,672,1016,672C839.269,672,696,528.731,696,352C696,175.269,839.269,32,1016,32Z" fill-rule="evenodd" fill="url(#master_svg1_62_10082)" fill-opacity="1"></path></g>', 2)]));
|
|
21
|
-
}
|
|
22
|
-
const loadingBg = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
|
|
23
|
-
|
|
24
|
-
const useScrollDetector = (elementRef) => {
|
|
25
|
-
const hasVertical = ref(false);
|
|
26
|
-
const hasHorizontal = ref(false);
|
|
27
|
-
const check = () => {
|
|
28
|
-
const el = elementRef.value;
|
|
29
|
-
if (!el) return;
|
|
30
|
-
hasVertical.value = el.scrollHeight > el.clientHeight;
|
|
31
|
-
hasHorizontal.value = el.scrollWidth > el.clientWidth;
|
|
32
|
-
};
|
|
33
|
-
onMounted(() => {
|
|
34
|
-
check();
|
|
35
|
-
const observer = new ResizeObserver(check);
|
|
36
|
-
observer.observe(elementRef.value);
|
|
37
|
-
onBeforeUnmount(() => observer.disconnect());
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
hasVertical,
|
|
41
|
-
// 是否有纵向滚动条
|
|
42
|
-
hasHorizontal,
|
|
43
|
-
// 是否有横向滚动条
|
|
44
|
-
check
|
|
45
|
-
// 检查滚动条状态
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const threshold = 20;
|
|
49
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
50
|
-
__name: "index",
|
|
51
|
-
props: {
|
|
52
|
-
list: {
|
|
53
|
-
default: () => []
|
|
54
|
-
},
|
|
55
|
-
maxHeight: {
|
|
56
|
-
default: "500px"
|
|
57
|
-
},
|
|
58
|
-
triggerIndices: {
|
|
59
|
-
default: "only-last"
|
|
60
|
-
},
|
|
61
|
-
alwaysShowScrollbar: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: false
|
|
64
|
-
},
|
|
65
|
-
backButtonThreshold: {
|
|
66
|
-
default: 80
|
|
67
|
-
},
|
|
68
|
-
showBackButton: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: true
|
|
71
|
-
},
|
|
72
|
-
backButtonPosition: {
|
|
73
|
-
default: () => {
|
|
74
|
-
return {
|
|
75
|
-
bottom: "20px",
|
|
76
|
-
left: "calc(50% - 19px)"
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
btnLoading: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: true
|
|
83
|
-
},
|
|
84
|
-
btnColor: {
|
|
85
|
-
default: "#409EFF"
|
|
86
|
-
},
|
|
87
|
-
btnIconSize: {
|
|
88
|
-
default: 24
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
emits: ["complete"],
|
|
92
|
-
setup(__props, {
|
|
93
|
-
expose: __expose,
|
|
94
|
-
emit: __emit
|
|
95
|
-
}) {
|
|
96
|
-
const props = __props;
|
|
97
|
-
const emits = __emit;
|
|
98
|
-
const scrollContainer = ref(null);
|
|
99
|
-
const {
|
|
100
|
-
hasVertical
|
|
101
|
-
} = useScrollDetector(scrollContainer);
|
|
102
|
-
const stopAutoScrollToBottom = ref(false);
|
|
103
|
-
const lastScrollTop = ref(0);
|
|
104
|
-
const accumulatedScrollUpDistance = ref(0);
|
|
105
|
-
const resizeObserver = ref(null);
|
|
106
|
-
const showBackToBottom = ref(false);
|
|
107
|
-
const effectiveTriggerIndices = computed(() => {
|
|
108
|
-
if (props.triggerIndices === "only-last") {
|
|
109
|
-
const triggerIndices = props.list.filter((item) => item.typing).map((_, index) => index);
|
|
110
|
-
return triggerIndices.length > 0 ? [triggerIndices[triggerIndices.length - 1]] : [];
|
|
111
|
-
} else if (props.triggerIndices === "all") {
|
|
112
|
-
return props.list.map((_, index) => index);
|
|
113
|
-
} else if (Array.isArray(props.triggerIndices)) {
|
|
114
|
-
const validIndices = getValidIndices(props.list, props.triggerIndices);
|
|
115
|
-
return validIndices.length > 0 ? [validIndices[validIndices.length - 1]] : [];
|
|
116
|
-
}
|
|
117
|
-
return [];
|
|
118
|
-
});
|
|
119
|
-
function getValidIndices(list, indices) {
|
|
120
|
-
const validIndices = [];
|
|
121
|
-
for (let i = 0; i < indices.length; i++) {
|
|
122
|
-
const index = indices[i];
|
|
123
|
-
if (index < 0 || index >= list.length || !list[index].typing) ;
|
|
124
|
-
else {
|
|
125
|
-
validIndices.push(index);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return validIndices;
|
|
129
|
-
}
|
|
130
|
-
watch(() => props.list.length, () => {
|
|
131
|
-
if (props.list && props.list.length > 0) {
|
|
132
|
-
nextTick(() => {
|
|
133
|
-
autoScroll();
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
immediate: true
|
|
138
|
-
});
|
|
139
|
-
function scrollToTop() {
|
|
140
|
-
stopAutoScrollToBottom.value = true;
|
|
141
|
-
nextTick(() => {
|
|
142
|
-
scrollContainer.value.scrollTop = 0;
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
function scrollToBottom() {
|
|
146
|
-
try {
|
|
147
|
-
if (scrollContainer.value && scrollContainer.value.scrollHeight) {
|
|
148
|
-
nextTick(() => {
|
|
149
|
-
scrollContainer.value.scrollTop = scrollContainer.value.scrollHeight;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
} catch (error) {
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function scrollToBubble(index) {
|
|
156
|
-
const container = scrollContainer.value;
|
|
157
|
-
if (!container) return;
|
|
158
|
-
const bubbles = container.querySelectorAll(".el-bubble");
|
|
159
|
-
if (index >= bubbles.length) return;
|
|
160
|
-
stopAutoScrollToBottom.value = true;
|
|
161
|
-
const targetBubble = bubbles[index];
|
|
162
|
-
const containerRect = container.getBoundingClientRect();
|
|
163
|
-
const bubbleRect = targetBubble.getBoundingClientRect();
|
|
164
|
-
const scrollPosition = bubbleRect.top - containerRect.top + container.scrollTop;
|
|
165
|
-
container.scrollTo({
|
|
166
|
-
top: scrollPosition,
|
|
167
|
-
behavior: "smooth"
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function autoScroll() {
|
|
171
|
-
if (scrollContainer.value) {
|
|
172
|
-
const listBubbles = scrollContainer.value.querySelectorAll(".el-bubble-content-wrapper");
|
|
173
|
-
if (resizeObserver.value) {
|
|
174
|
-
resizeObserver.value.disconnect();
|
|
175
|
-
}
|
|
176
|
-
const lastItem = listBubbles[listBubbles.length - 1];
|
|
177
|
-
if (lastItem) {
|
|
178
|
-
resizeObserver.value = new ResizeObserver(() => {
|
|
179
|
-
if (!stopAutoScrollToBottom.value) {
|
|
180
|
-
scrollToBottom();
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
resizeObserver.value.observe(lastItem);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function handleBubbleComplete(index, instance) {
|
|
188
|
-
if (effectiveTriggerIndices.value.includes(index)) {
|
|
189
|
-
emits("complete", instance, index);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function handleScroll() {
|
|
193
|
-
if (scrollContainer.value) {
|
|
194
|
-
const {
|
|
195
|
-
scrollTop,
|
|
196
|
-
scrollHeight,
|
|
197
|
-
clientHeight
|
|
198
|
-
} = scrollContainer.value;
|
|
199
|
-
const distanceToBottom = scrollHeight - (scrollTop + clientHeight);
|
|
200
|
-
showBackToBottom.value = props.showBackButton && distanceToBottom > props.backButtonThreshold;
|
|
201
|
-
const isCloseToBottom = scrollTop + clientHeight >= scrollHeight - 30;
|
|
202
|
-
const isScrollingUp = lastScrollTop.value > scrollTop;
|
|
203
|
-
const isScrollingDown = lastScrollTop.value < scrollTop;
|
|
204
|
-
const scrollDelta = lastScrollTop.value - scrollTop;
|
|
205
|
-
lastScrollTop.value = scrollTop;
|
|
206
|
-
if (isScrollingUp) {
|
|
207
|
-
accumulatedScrollUpDistance.value += scrollDelta;
|
|
208
|
-
if (accumulatedScrollUpDistance.value >= threshold) {
|
|
209
|
-
if (!stopAutoScrollToBottom.value) {
|
|
210
|
-
stopAutoScrollToBottom.value = true;
|
|
211
|
-
}
|
|
212
|
-
accumulatedScrollUpDistance.value = 0;
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
accumulatedScrollUpDistance.value = 0;
|
|
216
|
-
}
|
|
217
|
-
if (isScrollingDown && isCloseToBottom) {
|
|
218
|
-
if (stopAutoScrollToBottom.value) {
|
|
219
|
-
stopAutoScrollToBottom.value = false;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
__expose({
|
|
225
|
-
scrollToTop,
|
|
226
|
-
scrollToBottom,
|
|
227
|
-
scrollToBubble
|
|
228
|
-
});
|
|
229
|
-
return (_ctx, _cache) => {
|
|
230
|
-
const _component_el_icon = ElIcon;
|
|
231
|
-
return openBlock(), createElementBlock("div", {
|
|
232
|
-
ref_key: "scrollContainer",
|
|
233
|
-
ref: scrollContainer,
|
|
234
|
-
class: normalizeClass(["el-bubble-list", {
|
|
235
|
-
"always-scrollbar": props.alwaysShowScrollbar
|
|
236
|
-
}]),
|
|
237
|
-
style: normalizeStyle({
|
|
238
|
-
"--el-bubble-list-max-height": `${_ctx.maxHeight}`,
|
|
239
|
-
"--el-bubble-list-btn-size": `${props.btnIconSize}px`
|
|
240
|
-
}),
|
|
241
|
-
onScroll: handleScroll
|
|
242
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
|
|
243
|
-
return openBlock(), createBlock(Bubble, {
|
|
244
|
-
key: index,
|
|
245
|
-
content: item.content,
|
|
246
|
-
placement: item.placement,
|
|
247
|
-
loading: item.loading,
|
|
248
|
-
shape: item.shape,
|
|
249
|
-
variant: item.variant,
|
|
250
|
-
"is-markdown": item.isMarkdown,
|
|
251
|
-
"is-fog": item.isFog,
|
|
252
|
-
typing: item.typing,
|
|
253
|
-
"max-width": item.maxWidth,
|
|
254
|
-
avatar: item.avatar,
|
|
255
|
-
"avatar-size": item.avatarSize,
|
|
256
|
-
"avatar-gap": item.avatarGap,
|
|
257
|
-
"avatar-shape": item.avatarShape,
|
|
258
|
-
"avatar-icon": item.avatarIcon,
|
|
259
|
-
"avatar-src-set": item.avatarSrcSet,
|
|
260
|
-
"avatar-alt": item.avatarAlt,
|
|
261
|
-
"avatar-fit": item.avatarFit,
|
|
262
|
-
"no-style": item.noStyle,
|
|
263
|
-
onFinish: (instance) => handleBubbleComplete(index, instance)
|
|
264
|
-
}, createSlots({
|
|
265
|
-
_: 2
|
|
266
|
-
}, [_ctx.$slots.avatar ? {
|
|
267
|
-
name: "avatar",
|
|
268
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "avatar", {
|
|
269
|
-
item
|
|
270
|
-
}, void 0, true)]),
|
|
271
|
-
key: "0"
|
|
272
|
-
} : void 0, _ctx.$slots.header ? {
|
|
273
|
-
name: "header",
|
|
274
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "header", {
|
|
275
|
-
item
|
|
276
|
-
}, void 0, true)]),
|
|
277
|
-
key: "1"
|
|
278
|
-
} : void 0, _ctx.$slots.content ? {
|
|
279
|
-
name: "content",
|
|
280
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "content", {
|
|
281
|
-
item
|
|
282
|
-
}, void 0, true)]),
|
|
283
|
-
key: "2"
|
|
284
|
-
} : void 0, _ctx.$slots.footer ? {
|
|
285
|
-
name: "footer",
|
|
286
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "footer", {
|
|
287
|
-
item
|
|
288
|
-
}, void 0, true)]),
|
|
289
|
-
key: "3"
|
|
290
|
-
} : void 0, _ctx.$slots.loading ? {
|
|
291
|
-
name: "loading",
|
|
292
|
-
fn: withCtx(() => [renderSlot(_ctx.$slots, "loading", {
|
|
293
|
-
item
|
|
294
|
-
}, void 0, true)]),
|
|
295
|
-
key: "4"
|
|
296
|
-
} : void 0]), 1032, ["content", "placement", "loading", "shape", "variant", "is-markdown", "is-fog", "typing", "max-width", "avatar", "avatar-size", "avatar-gap", "avatar-shape", "avatar-icon", "avatar-src-set", "avatar-alt", "avatar-fit", "no-style", "onFinish"]);
|
|
297
|
-
}), 128)), unref(showBackToBottom) && unref(hasVertical) ? (openBlock(), createElementBlock("div", {
|
|
298
|
-
key: 0,
|
|
299
|
-
class: normalizeClass(["el-bubble-list-default-back-button", {
|
|
300
|
-
"el-bubble-list-back-to-bottom-solt": _ctx.$slots.backToBottom
|
|
301
|
-
}]),
|
|
302
|
-
style: normalizeStyle({
|
|
303
|
-
bottom: _ctx.backButtonPosition.bottom,
|
|
304
|
-
left: _ctx.backButtonPosition.left
|
|
305
|
-
}),
|
|
306
|
-
onClick: scrollToBottom
|
|
307
|
-
}, [renderSlot(_ctx.$slots, "backToBottom", {}, () => [createVNode(_component_el_icon, {
|
|
308
|
-
class: "el-bubble-list-back-to-bottom-icon",
|
|
309
|
-
style: normalizeStyle({
|
|
310
|
-
color: props.btnColor
|
|
311
|
-
})
|
|
312
|
-
}, {
|
|
313
|
-
default: withCtx(() => [createVNode(unref(arrow_down_bold_default)), props.btnLoading ? (openBlock(), createBlock(loadingBg, {
|
|
314
|
-
key: 0,
|
|
315
|
-
class: "back-to-bottom-loading-svg-bg"
|
|
316
|
-
})) : createCommentVNode("", true)]),
|
|
317
|
-
_: 1
|
|
318
|
-
}, 8, ["style"])], true)], 6)) : createCommentVNode("", true)], 38);
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
const BubbleList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-a7a18fd5"]]);
|
|
323
|
-
|
|
324
10
|
const props = {
|
|
325
11
|
items: {
|
|
326
12
|
type: Array,
|
|
@@ -36,6 +36,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
36
36
|
initRenderData: (emitSetData: any, props: any) => void;
|
|
37
37
|
typed: (e: import("./types").Item) => import("./types").Item;
|
|
38
38
|
readonly VkBroadcastingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
39
|
+
render: {
|
|
40
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
41
|
+
default: typeof import("../../broadcasting-markdown").defaultRender;
|
|
42
|
+
};
|
|
39
43
|
data: {
|
|
40
44
|
type: {
|
|
41
45
|
(arrayLength: number): import("../../broadcasting-markdown/src/types").Paragraph[];
|
|
@@ -107,6 +111,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
107
111
|
'update:completed': (_: boolean) => boolean;
|
|
108
112
|
'update:error': (_: boolean) => boolean;
|
|
109
113
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
114
|
+
render: {
|
|
115
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
116
|
+
default: typeof import("../../broadcasting-markdown").defaultRender;
|
|
117
|
+
};
|
|
110
118
|
data: {
|
|
111
119
|
type: {
|
|
112
120
|
(arrayLength: number): import("../../broadcasting-markdown/src/types").Paragraph[];
|
|
@@ -174,6 +182,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
174
182
|
source: string;
|
|
175
183
|
delay: number;
|
|
176
184
|
pause: boolean;
|
|
185
|
+
render: (text: string) => string;
|
|
177
186
|
data: import("../../broadcasting-markdown/src/types").Paragraph[];
|
|
178
187
|
separators: string[];
|
|
179
188
|
keepRead: boolean;
|
|
@@ -197,6 +206,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
197
206
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
198
207
|
default: import("@vunk/shared").AnyFunc;
|
|
199
208
|
};
|
|
209
|
+
retryTimes: {
|
|
210
|
+
type: NumberConstructor;
|
|
211
|
+
default: number;
|
|
212
|
+
};
|
|
200
213
|
}>, {
|
|
201
214
|
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
202
215
|
enable: {
|
|
@@ -215,11 +228,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
215
228
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
216
229
|
default: import("@vunk/shared").AnyFunc;
|
|
217
230
|
};
|
|
231
|
+
retryTimes: {
|
|
232
|
+
type: NumberConstructor;
|
|
233
|
+
default: number;
|
|
234
|
+
};
|
|
218
235
|
}>> & Readonly<{
|
|
219
236
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
220
237
|
}> & {}>;
|
|
221
238
|
emit: (event: "update:status", ...args: any[]) => void;
|
|
222
239
|
theDef: import("vue").ShallowRef<import("@vunk/shared/promise").Deferred<any> | undefined, import("@vunk/shared/promise").Deferred<any> | undefined>;
|
|
240
|
+
retryTimes: number;
|
|
223
241
|
processingDef: {
|
|
224
242
|
_ref: import("vue").ShallowRef<unknown, unknown>;
|
|
225
243
|
readonly value: unknown;
|
|
@@ -245,6 +263,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
245
263
|
type: import("vue").PropType<import("@vunk/shared").AnyFunc>;
|
|
246
264
|
default: import("@vunk/shared").AnyFunc;
|
|
247
265
|
};
|
|
266
|
+
retryTimes: {
|
|
267
|
+
type: NumberConstructor;
|
|
268
|
+
default: number;
|
|
269
|
+
};
|
|
248
270
|
}>> & Readonly<{
|
|
249
271
|
"onUpdate:status"?: ((...args: any[]) => any) | undefined;
|
|
250
272
|
}>, {
|
|
@@ -252,6 +274,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
252
274
|
pause: boolean;
|
|
253
275
|
enable: boolean;
|
|
254
276
|
status: import("../../broadcasting-markdown").ParagraphStatus;
|
|
277
|
+
retryTimes: number;
|
|
255
278
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
256
279
|
VkTypingMarkdown: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
257
280
|
source: {
|
|
@@ -326,6 +349,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
326
349
|
type: BooleanConstructor;
|
|
327
350
|
default: boolean;
|
|
328
351
|
};
|
|
352
|
+
render: {
|
|
353
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
354
|
+
required: true;
|
|
355
|
+
};
|
|
329
356
|
}>, (() => null) | (() => false | JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
330
357
|
voice: {
|
|
331
358
|
type: import("vue").PropType<SpeechSynthesisVoice>;
|
|
@@ -343,6 +370,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
343
370
|
type: BooleanConstructor;
|
|
344
371
|
default: boolean;
|
|
345
372
|
};
|
|
373
|
+
render: {
|
|
374
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
375
|
+
required: true;
|
|
376
|
+
};
|
|
346
377
|
}>> & Readonly<{}>, {
|
|
347
378
|
pause: boolean;
|
|
348
379
|
data: import("../../broadcasting-markdown/src/types").Paragraph;
|
|
@@ -424,6 +455,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
424
455
|
type: StringConstructor;
|
|
425
456
|
default: string;
|
|
426
457
|
};
|
|
458
|
+
render: {
|
|
459
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
460
|
+
required: true;
|
|
461
|
+
};
|
|
427
462
|
}>, (() => null) | (() => JSX.Element), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
428
463
|
data: {
|
|
429
464
|
type: import("vue").PropType<import("../../broadcasting-markdown/src/types").Paragraph>;
|
|
@@ -441,6 +476,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
441
476
|
type: StringConstructor;
|
|
442
477
|
default: string;
|
|
443
478
|
};
|
|
479
|
+
render: {
|
|
480
|
+
type: import("vue").PropType<(text: string) => string>;
|
|
481
|
+
required: true;
|
|
482
|
+
};
|
|
444
483
|
}>> & Readonly<{}>, {
|
|
445
484
|
pause: boolean;
|
|
446
485
|
data: import("../../broadcasting-markdown/src/types").Paragraph;
|
|
@@ -1,166 +1,7 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, createElementBlock, openBlock, Fragment, createVNode, unref, withCtx, createBlock, createCommentVNode } from 'vue';
|
|
2
2
|
import { VkBroadcastingMarkdown } from '@vunk/plus/components/broadcasting-markdown';
|
|
3
3
|
import { VkRendererTemplate } from '@vunk/core/components/renderer-template';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const _hoisted_1 = ["disabled"];
|
|
7
|
-
const _hoisted_2 = {
|
|
8
|
-
class: "status-icon"
|
|
9
|
-
};
|
|
10
|
-
const _hoisted_3 = {
|
|
11
|
-
class: "label"
|
|
12
|
-
};
|
|
13
|
-
const _hoisted_4 = {
|
|
14
|
-
class: "content"
|
|
15
|
-
};
|
|
16
|
-
const _hoisted_5 = {
|
|
17
|
-
class: "error-message"
|
|
18
|
-
};
|
|
19
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
20
|
-
__name: "index",
|
|
21
|
-
props: {
|
|
22
|
-
modelValue: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: true
|
|
25
|
-
},
|
|
26
|
-
content: {
|
|
27
|
-
default: ""
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
30
|
-
default: "start"
|
|
31
|
-
},
|
|
32
|
-
disabled: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false
|
|
35
|
-
},
|
|
36
|
-
autoCollapse: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false
|
|
39
|
-
},
|
|
40
|
-
duration: {
|
|
41
|
-
default: "0.2s"
|
|
42
|
-
},
|
|
43
|
-
buttonWidth: {
|
|
44
|
-
default: "160px"
|
|
45
|
-
},
|
|
46
|
-
maxWidth: {
|
|
47
|
-
default: "500px"
|
|
48
|
-
},
|
|
49
|
-
backgroundColor: {
|
|
50
|
-
default: "#fcfcfc"
|
|
51
|
-
},
|
|
52
|
-
color: {
|
|
53
|
-
default: "var(--el-color-info)"
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
emits: ["change", "update:expanded"],
|
|
57
|
-
setup(__props, {
|
|
58
|
-
emit: __emit
|
|
59
|
-
}) {
|
|
60
|
-
const props = __props;
|
|
61
|
-
const emit = __emit;
|
|
62
|
-
const isExpanded = ref(props.modelValue);
|
|
63
|
-
watch(() => props.modelValue, (newVal) => {
|
|
64
|
-
isExpanded.value = newVal;
|
|
65
|
-
});
|
|
66
|
-
function changeExpand() {
|
|
67
|
-
if (props.disabled) return;
|
|
68
|
-
isExpanded.value = !isExpanded.value;
|
|
69
|
-
emit("change", {
|
|
70
|
-
value: isExpanded.value,
|
|
71
|
-
status: props.status
|
|
72
|
-
});
|
|
73
|
-
emit("update:expanded", isExpanded.value);
|
|
74
|
-
}
|
|
75
|
-
const displayedContent = computed(() => {
|
|
76
|
-
return props.status === "error" ? "思考过程中出现错误" : props.content;
|
|
77
|
-
});
|
|
78
|
-
watch(() => props.status, (newVal) => {
|
|
79
|
-
if (newVal === "end" && props.autoCollapse) {
|
|
80
|
-
isExpanded.value = false;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
return (_ctx, _cache) => {
|
|
84
|
-
const _component_el_icon = ElIcon;
|
|
85
|
-
return openBlock(), createElementBlock("div", {
|
|
86
|
-
class: "el-thinking",
|
|
87
|
-
style: normalizeStyle({
|
|
88
|
-
"--el-thinking-button-width": props.buttonWidth,
|
|
89
|
-
"--el-thinking-animation-duration": props.duration,
|
|
90
|
-
"--el-thinking-content-wrapper-width": props.maxWidth,
|
|
91
|
-
"--el-thinking-content-wrapper-background-color": props.backgroundColor,
|
|
92
|
-
"--el-thinking-content-wrapper-color": props.color
|
|
93
|
-
})
|
|
94
|
-
}, [createElementVNode("button", {
|
|
95
|
-
class: normalizeClass(["trigger", [_ctx.status, {
|
|
96
|
-
disabled: !props.disabled
|
|
97
|
-
}]]),
|
|
98
|
-
disabled: props.disabled,
|
|
99
|
-
onClick: changeExpand
|
|
100
|
-
}, [createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "status-icon", {
|
|
101
|
-
status: props.status
|
|
102
|
-
}, () => [_ctx.status === "thinking" ? (openBlock(), createBlock(_component_el_icon, {
|
|
103
|
-
key: 0,
|
|
104
|
-
class: "is-loading el-icon-center"
|
|
105
|
-
}, {
|
|
106
|
-
default: withCtx(() => [createVNode(unref(loading_default))]),
|
|
107
|
-
_: 1
|
|
108
|
-
})) : createCommentVNode("", true), _ctx.status === "start" ? (openBlock(), createBlock(_component_el_icon, {
|
|
109
|
-
key: 1,
|
|
110
|
-
class: "el-icon-center start-color"
|
|
111
|
-
}, {
|
|
112
|
-
default: withCtx(() => [createVNode(unref(opportunity_default))]),
|
|
113
|
-
_: 1
|
|
114
|
-
})) : createCommentVNode("", true), _ctx.status === "end" ? (openBlock(), createBlock(_component_el_icon, {
|
|
115
|
-
key: 2,
|
|
116
|
-
class: "el-icon-center end-color"
|
|
117
|
-
}, {
|
|
118
|
-
default: withCtx(() => [createVNode(unref(success_filled_default))]),
|
|
119
|
-
_: 1
|
|
120
|
-
})) : createCommentVNode("", true), _ctx.status === "error" ? (openBlock(), createBlock(_component_el_icon, {
|
|
121
|
-
key: 3,
|
|
122
|
-
class: "el-icon-center error-color"
|
|
123
|
-
}, {
|
|
124
|
-
default: withCtx(() => [createVNode(unref(circle_close_filled_default))]),
|
|
125
|
-
_: 1
|
|
126
|
-
})) : createCommentVNode("", true)], true)]), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "label", {
|
|
127
|
-
status: props.status
|
|
128
|
-
}, () => [createTextVNode(toDisplayString(_ctx.status === "thinking" ? "思考中..." : _ctx.status === "error" ? "思考遇到问题" : _ctx.status === "end" ? "思考完成" : "开始思考"), 1)], true)]), createVNode(Transition, {
|
|
129
|
-
name: "rotate"
|
|
130
|
-
}, {
|
|
131
|
-
default: withCtx(() => [!props.disabled ? (openBlock(), createElementBlock("span", {
|
|
132
|
-
key: 0,
|
|
133
|
-
class: normalizeClass(["arrow el-icon-center", {
|
|
134
|
-
expanded: unref(isExpanded)
|
|
135
|
-
}])
|
|
136
|
-
}, [renderSlot(_ctx.$slots, "arrow", {}, () => [createVNode(_component_el_icon, {
|
|
137
|
-
class: "el-icon-center"
|
|
138
|
-
}, {
|
|
139
|
-
default: withCtx(() => [createVNode(unref(arrow_up_bold_default))]),
|
|
140
|
-
_: 1
|
|
141
|
-
})], true)], 2)) : createCommentVNode("", true)]),
|
|
142
|
-
_: 3
|
|
143
|
-
})], 10, _hoisted_1), createVNode(Transition, {
|
|
144
|
-
name: "slide"
|
|
145
|
-
}, {
|
|
146
|
-
default: withCtx(() => [unref(displayedContent) ? withDirectives((openBlock(), createElementBlock("div", {
|
|
147
|
-
key: 0,
|
|
148
|
-
class: normalizeClass(["content-wrapper", {
|
|
149
|
-
"error-state": _ctx.status === "error"
|
|
150
|
-
}])
|
|
151
|
-
}, [createElementVNode("div", _hoisted_4, [_ctx.status !== "error" ? renderSlot(_ctx.$slots, "content", {
|
|
152
|
-
key: 0,
|
|
153
|
-
content: unref(displayedContent)
|
|
154
|
-
}, () => [createElementVNode("pre", null, toDisplayString(unref(displayedContent)), 1)], true) : renderSlot(_ctx.$slots, "error", {
|
|
155
|
-
key: 1,
|
|
156
|
-
errorContent: unref(displayedContent)
|
|
157
|
-
}, () => [createElementVNode("div", _hoisted_5, toDisplayString(unref(displayedContent)), 1)], true)])], 2)), [[vShow, unref(isExpanded)]]) : createCommentVNode("", true)]),
|
|
158
|
-
_: 3
|
|
159
|
-
})], 4);
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
const Thinking = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-5eb92e73"]]);
|
|
4
|
+
import { Thinking, Typewriter } from 'vue-element-plus-x';
|
|
164
5
|
|
|
165
6
|
var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
166
7
|
...{
|