@vunk/plus 1.4.3 → 1.4.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.
|
@@ -53,15 +53,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
53
|
"is-markdown": props.isMarkdown,
|
|
54
54
|
"is-fog": props.isFog,
|
|
55
55
|
onVnodeMounted: ($event) => initRenderData(emitSetData, props),
|
|
56
|
-
|
|
57
|
-
k: [props.key, "completed"],
|
|
58
|
-
v: false
|
|
59
|
-
}),
|
|
60
|
-
onFinish: () => emitSetData({
|
|
56
|
+
onFinish: () => props.seviceEnd && emitSetData({
|
|
61
57
|
k: [props.key, "completed"],
|
|
62
58
|
v: true
|
|
63
59
|
})
|
|
64
|
-
}, null, 8, ["content", "typing", "is-markdown", "is-fog", "onVnodeMounted", "
|
|
60
|
+
}, null, 8, ["content", "typing", "is-markdown", "is-fog", "onVnodeMounted", "onFinish"])
|
|
65
61
|
]),
|
|
66
62
|
_: 1
|
|
67
63
|
/* STABLE */
|
|
@@ -8,6 +8,7 @@ import { VkDuplex } from '@vunk/core';
|
|
|
8
8
|
import { VkRendererData } from '@vunk/core/components/renderer-data';
|
|
9
9
|
import { useDataComputed, useDeferred } from '@vunk/core/composables';
|
|
10
10
|
import { isNotEmptyObject } from '@vunk/shared/object';
|
|
11
|
+
import { waiting } from '@vunk/shared/promise';
|
|
11
12
|
|
|
12
13
|
var InputType = /* @__PURE__ */ ((InputType2) => {
|
|
13
14
|
InputType2["Voice"] = "voice";
|
|
@@ -56,17 +57,26 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
56
57
|
const bubbleListReslove = bubbleListDef.resolve;
|
|
57
58
|
const { simplicity } = useAgentChat();
|
|
58
59
|
const { items: bubbleItems, onRequest } = simplicity;
|
|
60
|
+
const lastBubbleItem = computed(() => {
|
|
61
|
+
return bubbleItems.value.at(-1);
|
|
62
|
+
});
|
|
59
63
|
const lastBubbleData = computed(() => {
|
|
60
64
|
return getBubbleDataAt(-1);
|
|
61
65
|
});
|
|
62
66
|
const clientLoading = computed(() => {
|
|
63
|
-
|
|
67
|
+
if (lastBubbleItem.value?.loading === true) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
if (isNotEmptyObject(lastBubbleData.value) && lastBubbleData.value.completed !== true) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
return false;
|
|
64
74
|
});
|
|
65
75
|
const senderDisabled = computed(() => {
|
|
66
76
|
if (lastBubbleData.value.error === true) {
|
|
67
77
|
return false;
|
|
68
78
|
}
|
|
69
|
-
return
|
|
79
|
+
return lastBubbleItem.value?.loading === true || lastBubbleData.value.completed === false;
|
|
70
80
|
});
|
|
71
81
|
function onSubmit(nextContent) {
|
|
72
82
|
if (!nextContent)
|
|
@@ -84,10 +94,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
84
94
|
if (!lastBubble)
|
|
85
95
|
return;
|
|
86
96
|
lastBubble.abortController?.abort();
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
lastBubbleData2.completed = true;
|
|
97
|
+
waiting(() => bubbleData.value[lastBubble.key], 60).then((lastBubbleData2) => {
|
|
98
|
+
lastBubbleData2.elRef?.interrupt();
|
|
99
|
+
bubbleData.value[lastBubble.key].completed = true;
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
function getBubbleDataAt(index) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { __VkBubbleList } from '@vunk/plus/components/bubble-list';
|
|
2
|
+
import type { __VkBubbleTemplates } from '@vunk/plus/components/bubble-templates';
|
|
2
3
|
import { InputType } from './const';
|
|
3
4
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
5
|
data: {
|
|
5
|
-
type: import("vue").PropType<
|
|
6
|
+
type: import("vue").PropType<__VkBubbleTemplates.RenderData>;
|
|
6
7
|
};
|
|
7
8
|
speechToText: {
|
|
8
9
|
type: import("vue").PropType<import("./types").SpeechToText>;
|
|
@@ -13,7 +14,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
13
14
|
}>, {
|
|
14
15
|
props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
|
|
15
16
|
data: {
|
|
16
|
-
type: import("vue").PropType<
|
|
17
|
+
type: import("vue").PropType<__VkBubbleTemplates.RenderData>;
|
|
17
18
|
};
|
|
18
19
|
speechToText: {
|
|
19
20
|
type: import("vue").PropType<import("./types").SpeechToText>;
|
|
@@ -323,7 +324,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
323
324
|
});
|
|
324
325
|
};
|
|
325
326
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
326
|
-
bubbleData: import("vue").ComputedRef<
|
|
327
|
+
bubbleData: import("vue").ComputedRef<__VkBubbleTemplates.RenderData>;
|
|
327
328
|
setBubbleData: (e: import("@vunk/core").SetDataEvent) => void;
|
|
328
329
|
mainRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
|
|
329
330
|
inputType: import("vue").Ref<InputType, InputType>;
|
|
@@ -350,12 +351,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
350
351
|
};
|
|
351
352
|
bubbleItems: import("vue").ComputedRef<import("../../agent-chat-provider/src/types").BubbleItem[]>;
|
|
352
353
|
onRequest: (message: string) => void;
|
|
353
|
-
|
|
354
|
+
lastBubbleItem: import("vue").ComputedRef<import("../../agent-chat-provider/src/types").BubbleItem | undefined>;
|
|
355
|
+
lastBubbleData: import("vue").ComputedRef<__VkBubbleTemplates.RenderDataRecord>;
|
|
354
356
|
clientLoading: import("vue").ComputedRef<boolean>;
|
|
355
357
|
senderDisabled: import("vue").ComputedRef<boolean>;
|
|
356
358
|
onSubmit: (nextContent: string) => void;
|
|
357
359
|
onCancel: () => void;
|
|
358
|
-
getBubbleDataAt: (index: number) =>
|
|
360
|
+
getBubbleDataAt: (index: number) => __VkBubbleTemplates.RenderDataRecord;
|
|
359
361
|
readonly VkBubbleList: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
360
362
|
items: {
|
|
361
363
|
type: {
|
|
@@ -2329,7 +2331,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2329
2331
|
setData: (e: import("@vunk/core").SetDataEvent) => import("@vunk/core").SetDataEvent;
|
|
2330
2332
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
2331
2333
|
data: {
|
|
2332
|
-
type: import("vue").PropType<
|
|
2334
|
+
type: import("vue").PropType<__VkBubbleTemplates.RenderData>;
|
|
2333
2335
|
};
|
|
2334
2336
|
speechToText: {
|
|
2335
2337
|
type: import("vue").PropType<import("./types").SpeechToText>;
|