@vunk/plus 1.12.2 → 1.13.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.
- package/components/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/components/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/components/agent-chat-provider/index.cjs +1 -0
- package/components/agent-chat-provider/index.mjs +113 -187
- package/components/agent-chat-provider/src/index.vue.d.ts +3 -2
- package/components/avatar/index.cjs +1 -0
- package/components/avatar/index.mjs +25 -31
- package/components/avatar/src/index.vue.d.ts +40 -39
- package/components/broadcasting-markdown/__tests__/const.test.d.ts +1 -0
- package/components/broadcasting-markdown/__tests__/utils.test.d.ts +1 -0
- package/components/broadcasting-markdown/index.cjs +5 -0
- package/components/broadcasting-markdown/index.mjs +346 -4376
- package/components/broadcasting-markdown/src/howler-speech.vue.d.ts +18 -24
- package/components/broadcasting-markdown/src/index.vue.d.ts +101 -51
- package/components/broadcasting-markdown/src/paragraph.vue.d.ts +17 -29
- package/components/broadcasting-markdown/src/speech-error.vue.d.ts +2 -59
- package/components/bubble-list/index.cjs +1 -0
- package/components/bubble-list/index.mjs +220 -302
- package/components/bubble-list/src/core/index.vue.d.ts +40 -885
- package/components/bubble-list/src/core/loading.vue.d.ts +3 -0
- package/components/bubble-list/src/index.vue.d.ts +29 -1321
- package/components/bubble-templates/index.cjs +1 -0
- package/components/bubble-templates/index.mjs +34 -49
- package/components/bubble-templates/src/index.vue.d.ts +3 -224
- package/components/chat-independent/index.cjs +1 -0
- package/components/chat-independent/index.mjs +105 -212
- package/components/chat-independent/src/index.vue.d.ts +20 -2712
- package/components/components.css +1 -0
- package/components/drawer/index.cjs +1 -0
- package/components/drawer/index.mjs +53 -94
- package/components/drawer/src/ctx.d.ts +22 -22
- package/components/drawer/src/index.vue.d.ts +84 -557
- package/components/index.cjs +1 -0
- package/components/index.d.ts +1 -0
- package/components/lottie-animation/index.cjs +1 -0
- package/components/lottie-animation/index.mjs +36 -55
- package/components/lottie-animation/src/index.vue.d.ts +3 -2
- package/components/metahuman-broadcasting/index.cjs +1 -0
- package/components/metahuman-broadcasting/index.mjs +89 -140
- package/components/metahuman-broadcasting/src/index.vue.d.ts +16 -718
- package/components/monaco-editor/index.cjs +1 -0
- package/components/monaco-editor/index.mjs +68 -95
- package/components/monaco-editor/src/index.vue.d.ts +3 -2
- package/components/monaco-environment/index.cjs +1 -0
- package/components/monaco-environment/index.mjs +23 -38
- package/components/monaco-environment/src/index.vue.d.ts +2 -1
- package/components/pixi-frame/index.cjs +1 -0
- package/components/pixi-frame/index.mjs +941 -1969
- package/components/pixi-frame/src/apng.vue.d.ts +17 -73
- package/components/pixi-frame/src/bitmap-generator.vue.d.ts +24 -66
- package/components/pixi-frame/src/bitmap.vue.d.ts +28 -80
- package/components/pixi-frame/src/buffer-image.vue.d.ts +29 -97
- package/components/pixi-frame/src/core.vue.d.ts +20 -75
- package/components/pixi-frame/src/index.vue.d.ts +302 -237
- package/components/pixi-frame/src/provider.vue.d.ts +12 -1
- package/components/pixi-frame/src/video.vue.d.ts +17 -71
- package/components/pixi-frame/src/view.vue.d.ts +4 -16
- package/components/recorder-button/index.cjs +1 -0
- package/components/recorder-button/index.mjs +140 -269
- package/components/recorder-button/src/index.vue.d.ts +67 -66
- package/components/routes-menu-content/index.cjs +1 -0
- package/components/routes-menu-content/index.mjs +150 -229
- package/components/routes-menu-content/src/index.vue.d.ts +27 -26
- package/components/routes-menu-content/src/item/core/index.vue.d.ts +27 -26
- package/components/routes-menu-content/src/item/index.vue.d.ts +27 -26
- package/components/scrollbar/index.cjs +1 -0
- package/components/scrollbar/index.mjs +288 -567
- package/components/scrollbar/src/bar.vue.d.ts +6 -133
- package/components/scrollbar/src/index.vue.d.ts +66 -337
- package/components/scrollbar/src/thumb.vue.d.ts +3 -80
- package/components/sender/index.cjs +1 -0
- package/components/sender/index.mjs +156 -285
- package/components/sender/src/SenderHeader.vue.d.ts +14 -221
- package/components/sender/src/index.vue.d.ts +16 -505
- package/components/speech-button/index.cjs +1 -0
- package/components/speech-button/index.mjs +98 -144
- package/components/speech-button/src/LoadingIcon.vue.d.ts +2 -1
- package/components/speech-button/src/RecordingIcon.vue.d.ts +2 -1
- package/components/speech-button/src/index.vue.d.ts +6 -5
- package/components/table-columns/index.cjs +1 -0
- package/components/table-columns/index.mjs +48 -78
- package/components/table-columns/src/ctx.d.ts +10 -10
- package/components/table-columns/src/el-ctx.d.ts +1 -1
- package/components/table-columns/src/index.vue.d.ts +24 -23
- package/components/tables-v1/index.cjs +1 -0
- package/components/tables-v1/index.mjs +99 -160
- package/components/tables-v1/src/ctx.d.ts +28 -28
- package/components/tables-v1/src/el-ctx.d.ts +2 -2
- package/components/tables-v1/src/index.vue.d.ts +88 -2243
- package/components/tables-v1-checkbox/index.cjs +98 -0
- package/components/tables-v1-checkbox/index.mjs +1594 -3735
- package/components/tables-v1-checkbox/src/ctx.d.ts +26 -26
- package/components/tables-v1-checkbox/src/index.vue.d.ts +176 -2330
- package/components/text/index.cjs +1 -0
- package/components/text/index.mjs +70 -108
- package/components/text/src/ctx.d.ts +31 -31
- package/components/text/src/index.vue.d.ts +92 -1819
- package/components/thinking/index.cjs +1 -0
- package/components/thinking/index.mjs +127 -227
- package/components/thinking/src/index.vue.d.ts +22 -2044
- package/components/typing-markdown/index.cjs +1 -0
- package/components/typing-markdown/index.mjs +61 -201
- package/components/typing-markdown/src/index.vue.d.ts +3 -2
- package/components/vditor/index.cjs +1 -0
- package/components/vditor/index.mjs +121 -195
- package/components/vditor/src/ctx.d.ts +2 -2
- package/components/vditor/src/handle-fullscreen.vue.d.ts +3 -2
- package/components/vditor/src/handle-value.vue.d.ts +3 -2
- package/components/vditor/src/index.vue.d.ts +5 -4
- package/components/xgplayer/index.cjs +1 -0
- package/components/xgplayer/index.mjs +49 -90
- package/components/xgplayer/src/core.vue.d.ts +13 -18
- package/components/xgplayer/src/index.vue.d.ts +13 -67
- package/composables/el-breakpoints/index.cjs +1 -0
- package/composables/el-breakpoints/index.d.ts +10 -10
- package/composables/el-breakpoints/index.mjs +10 -12
- package/composables/index.cjs +1 -0
- package/composables/index.d.ts +1 -0
- package/composables/recorder/index.cjs +1 -0
- package/composables/recorder/index.mjs +9172 -14803
- package/element/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/element/bubble/index.cjs +3 -0
- package/element/bubble/index.d.ts +1 -1
- package/element/bubble/index.mjs +1 -1
- package/element/bubble/src/index.vue.d.ts +22 -22
- package/element/index.css +1 -1
- package/element/thinking/index.cjs +1 -0
- package/element/thinking/index.d.ts +1 -1
- package/element/thinking/index.mjs +1 -1
- package/element/thinking/src/index.vue.d.ts +26 -26
- package/element/thinking/src/types.d.ts +10 -0
- package/icons/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/icons/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/icons/end/index.cjs +1 -0
- package/icons/end/index.mjs +21 -26
- package/icons/end/src/index.vue.d.ts +3 -0
- package/icons/keyboard/index.cjs +1 -0
- package/icons/keyboard/index.mjs +21 -26
- package/icons/keyboard/src/index.vue.d.ts +3 -0
- package/icons/start/index.cjs +1 -0
- package/icons/start/index.mjs +21 -26
- package/icons/start/src/index.vue.d.ts +3 -0
- package/icons/voice/index.cjs +1 -0
- package/icons/voice/index.mjs +26 -44
- package/icons/voice/src/index.vue.d.ts +2 -3
- package/index.css +2 -558
- package/index.d.ts +1 -0
- package/package.json +78 -87
- package/shared/data/index.cjs +1 -0
- package/shared/data/index.mjs +16 -22
- package/shared/types/index.cjs +1 -0
- package/shared/types/index.d.ts +1 -0
- package/components/LinkOutlined.mjs +0 -1321
- package/components/_commonjsHelpers.mjs +0 -7
- package/components/_plugin-vue_export-helper.mjs +0 -9
- package/components/bubble-list/index.css +0 -70
- package/components/bubble-templates/index.css +0 -4
- package/components/chat-independent/index.css +0 -47
- package/components/drawer/index.css +0 -124
- package/components/index2.mjs +0 -78
- package/components/lottie-animation/index.css +0 -4
- package/components/monaco-editor/index.css +0 -4
- package/components/pixi-frame/index.css +0 -4
- package/components/recorder-button/index.css +0 -69
- package/components/sender/index.css +0 -22
- package/components/speech-button/index.css +0 -10
- package/components/tables-v1/index.css +0 -7
- package/components/tables-v1-checkbox/index.css +0 -8
- package/components/thinking/index.css +0 -125
- package/components/typing-markdown/index.css +0 -31
- package/components/vditor/index.css +0 -12
- package/components/xgplayer/index.css +0 -1
- package/icons/_plugin-vue_export-helper.mjs +0 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=(t,o)=>{const c=t.__vccOpts||t;for(const[r,s]of o)c[r]=s;return c};exports._export_sfc=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("vue"),U=require("@vunk/shared/fetch"),C=require("ant-design-x-vue");async function O(e,t){return U.restFetch.reader({url:"/application/chat_message/69e23792-8162-11f0-8a7b-dee062287042",onmessage:e},{headers:{authorization:"application-8259214f7c6f2777658809d71bdfada3"},data:t})}var d=(e=>(e.User="user",e.Assistant="assistant",e.Broadcasting="broadcasting",e))(d||{});const M=[{label:"用户",value:"user",isMarkdown:!1,placement:"end",templateType:"VkMarkdown"},{label:"AI 助手",value:"assistant",isMarkdown:!0,placement:"start",typing:!0,templateType:"VkMarkdown"}],b=M.reduce((e,t)=>(e[t.value]=t,e),{}),_="vk_agent_chat_inject_key";function P(e){return C.useXAgent({request:e})}function L(e,t,s){const[n]=P(e),o=C.useXChat({agent:n.value,parser:t}),f=r=>{const v=s(r);o.onRequest(v)},h=p.computed(()=>o.parsedMessages.value.map(r=>({key:r.id,...b[r.message.role],...r.message}))),c={agent:n,chat:o,simplicity:{onRequest:f,items:h}};return p.provide(_,c),c}function x(){const e=p.inject(_,null);if(!e)throw new Error("useAgentChat must be used within a provider");return e}const g=p.defineComponent({name:"VkAgentChatProvider",props:{request:{type:Function},parser:{type:Function},formatSend:{type:Function}},emits:{load:null},setup(e,{slots:t,emit:s}){const n=(a,c)=>{const{message:r}=a,{onSuccess:v,onUpdate:S}=c,V=[];if(!r?.content)return;let k="";const q=d.Assistant;let w="",m="start",y=!0,A=!1;const u=()=>{const l={role:q,content:k,thinkingContent:w,thinkingStatus:m,seviceLoading:y,seviceEnd:A};S(l),V.push(l)},j=()=>{v(V)};u(),O(l=>{let i={content:"",reasoning_content:""};typeof l.data=="string"&&(i=JSON.parse(l.data)),i.reasoning_content&&(w+=i.reasoning_content,m="thinking",y=!1,u()),i.content&&(k+=i.content,y=!1,u()),w&&i.content&&(m="end",u()),i.is_end&&(A=!0,u(),j())},{message:r?.content})},o=a=>[{...a,role:a.role??d.User,content:a.content??"",loading:a.seviceLoading}],f=a=>({role:d.User,content:a}),h=L(e.request??n,e.parser??o,e.formatSend??f);return s("load",h),t.default}});class F{views=[];getViews(){return this.views}createView(t){this.views.push(t)}upsertView(t,s={}){let n=this.getLastUpdatingView(t.type);return n?(n.content+=t.content,n.updating=t.updating,s.onUpdate?.(n)):(n=t,this.createView(n),s.onCreate?.(n)),n}getPrevView(t){const s=this.views.indexOf(t);if(s>0)return this.views[s-1]}getLastUpdatingView(t){return this.views.findLast(s=>s.updating&&s.type===t)}allViewUpdated(){this.views.forEach(t=>{t.updating=!1})}}const T=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));g.install=e=>{e.component(g.name||"VkAgentChatProvider",g)};exports.ChatAgentInjectKey=_;exports.MessageViewManager=F;exports.Role=d;exports.VkAgentChatProvider=g;exports.__VkAgentChatProvider=T;exports.default=g;exports.roleMap=b;exports.roleOptions=M;exports.useAgentChat=x;
|
|
@@ -1,96 +1,71 @@
|
|
|
1
|
-
import { computed, provide, inject, defineComponent } from
|
|
2
|
-
import { restFetch } from
|
|
3
|
-
import { useXChat, useXAgent } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
async function agentRequest(onmessage, data) {
|
|
7
|
-
return restFetch.reader({
|
|
1
|
+
import { computed as b, provide as S, inject as U, defineComponent as j } from "vue";
|
|
2
|
+
import { restFetch as q } from "@vunk/shared/fetch";
|
|
3
|
+
import { useXChat as P, useXAgent as x } from "ant-design-x-vue";
|
|
4
|
+
async function L(e, t) {
|
|
5
|
+
return q.reader({
|
|
8
6
|
url: "/application/chat_message/69e23792-8162-11f0-8a7b-dee062287042",
|
|
9
|
-
onmessage
|
|
7
|
+
onmessage: e
|
|
10
8
|
}, {
|
|
11
9
|
headers: {
|
|
12
10
|
authorization: "application-8259214f7c6f2777658809d71bdfada3"
|
|
13
11
|
},
|
|
14
|
-
data
|
|
12
|
+
data: t
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Role2["User"] = "user";
|
|
20
|
-
Role2["Assistant"] = "assistant";
|
|
21
|
-
Role2["Broadcasting"] = "broadcasting";
|
|
22
|
-
return Role2;
|
|
23
|
-
})(Role || {});
|
|
24
|
-
const roleOptions = [
|
|
15
|
+
var d = /* @__PURE__ */ ((e) => (e.User = "user", e.Assistant = "assistant", e.Broadcasting = "broadcasting", e))(d || {});
|
|
16
|
+
const O = [
|
|
25
17
|
{
|
|
26
|
-
label: "
|
|
27
|
-
value: "user"
|
|
28
|
-
isMarkdown:
|
|
18
|
+
label: "用户",
|
|
19
|
+
value: "user",
|
|
20
|
+
isMarkdown: !1,
|
|
29
21
|
placement: "end",
|
|
30
22
|
templateType: "VkMarkdown"
|
|
31
23
|
},
|
|
32
24
|
{
|
|
33
|
-
label: "AI
|
|
34
|
-
value: "assistant"
|
|
35
|
-
isMarkdown:
|
|
25
|
+
label: "AI 助手",
|
|
26
|
+
value: "assistant",
|
|
27
|
+
isMarkdown: !0,
|
|
36
28
|
placement: "start",
|
|
37
|
-
typing:
|
|
29
|
+
typing: !0,
|
|
38
30
|
templateType: "VkMarkdown"
|
|
39
31
|
}
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const ChatAgentInjectKey = "vk_agent_chat_inject_key";
|
|
47
|
-
|
|
48
|
-
function useAgent(request) {
|
|
49
|
-
return useXAgent({
|
|
50
|
-
request
|
|
32
|
+
], F = O.reduce((e, t) => (e[t.value] = t, e), {}), V = "vk_agent_chat_inject_key";
|
|
33
|
+
function E(e) {
|
|
34
|
+
return x({
|
|
35
|
+
// @ts-expect-error ant-design-x-vue generic type mismatch
|
|
36
|
+
request: e
|
|
51
37
|
});
|
|
52
38
|
}
|
|
53
|
-
function
|
|
54
|
-
const [
|
|
55
|
-
|
|
56
|
-
agent:
|
|
39
|
+
function T(e, t, s) {
|
|
40
|
+
const [n] = E(e), o = P({
|
|
41
|
+
// @ts-expect-error ant-design-x-vue generic type mismatch
|
|
42
|
+
agent: n.value,
|
|
57
43
|
// Convert AgentMessage to BubbleMessage
|
|
58
|
-
parser
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const simplicity = {
|
|
74
|
-
onRequest,
|
|
75
|
-
items
|
|
76
|
-
};
|
|
77
|
-
const ctx = {
|
|
78
|
-
agent,
|
|
79
|
-
chat,
|
|
80
|
-
simplicity
|
|
44
|
+
parser: t
|
|
45
|
+
}), p = (r) => {
|
|
46
|
+
const f = s(r);
|
|
47
|
+
o.onRequest(f);
|
|
48
|
+
}, g = b(() => o.parsedMessages.value.map((r) => ({
|
|
49
|
+
key: r.id,
|
|
50
|
+
...F[r.message.role],
|
|
51
|
+
...r.message
|
|
52
|
+
}))), c = {
|
|
53
|
+
agent: n,
|
|
54
|
+
chat: o,
|
|
55
|
+
simplicity: {
|
|
56
|
+
onRequest: p,
|
|
57
|
+
items: g
|
|
58
|
+
}
|
|
81
59
|
};
|
|
82
|
-
|
|
83
|
-
return ctx;
|
|
60
|
+
return S(V, c), c;
|
|
84
61
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
if (!
|
|
62
|
+
function B() {
|
|
63
|
+
const e = U(V, null);
|
|
64
|
+
if (!e)
|
|
88
65
|
throw new Error("useAgentChat must be used within a provider");
|
|
89
|
-
|
|
90
|
-
return ctx;
|
|
66
|
+
return e;
|
|
91
67
|
}
|
|
92
|
-
|
|
93
|
-
var _sfc_main = defineComponent({
|
|
68
|
+
const w = j({
|
|
94
69
|
name: "VkAgentChatProvider",
|
|
95
70
|
props: {
|
|
96
71
|
request: {
|
|
@@ -106,153 +81,104 @@ var _sfc_main = defineComponent({
|
|
|
106
81
|
emits: {
|
|
107
82
|
load: null
|
|
108
83
|
},
|
|
109
|
-
setup(
|
|
110
|
-
const
|
|
111
|
-
const { message } =
|
|
112
|
-
|
|
113
|
-
const chunks = [];
|
|
114
|
-
if (!message?.content) {
|
|
84
|
+
setup(e, { slots: t, emit: s }) {
|
|
85
|
+
const n = (a, c) => {
|
|
86
|
+
const { message: r } = a, { onSuccess: f, onUpdate: A } = c, y = [];
|
|
87
|
+
if (!r?.content)
|
|
115
88
|
return;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
thinkingContent,
|
|
128
|
-
thinkingStatus,
|
|
129
|
-
seviceLoading,
|
|
130
|
-
seviceEnd
|
|
89
|
+
let _ = "";
|
|
90
|
+
const C = d.Assistant;
|
|
91
|
+
let h = "", m = "start", v = !0, k = !1;
|
|
92
|
+
const u = () => {
|
|
93
|
+
const l = {
|
|
94
|
+
role: C,
|
|
95
|
+
content: _,
|
|
96
|
+
thinkingContent: h,
|
|
97
|
+
thinkingStatus: m,
|
|
98
|
+
seviceLoading: v,
|
|
99
|
+
seviceEnd: k
|
|
131
100
|
};
|
|
132
|
-
|
|
133
|
-
|
|
101
|
+
A(l), y.push(l);
|
|
102
|
+
}, M = () => {
|
|
103
|
+
f(y);
|
|
134
104
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
update();
|
|
139
|
-
agentRequest((e) => {
|
|
140
|
-
let json = {
|
|
105
|
+
u(), L((l) => {
|
|
106
|
+
let i = {
|
|
141
107
|
content: "",
|
|
142
108
|
reasoning_content: ""
|
|
143
109
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
update();
|
|
161
|
-
}
|
|
162
|
-
if (json.is_end) {
|
|
163
|
-
seviceEnd = true;
|
|
164
|
-
update();
|
|
165
|
-
success();
|
|
166
|
-
}
|
|
167
|
-
}, { message: message?.content });
|
|
168
|
-
};
|
|
169
|
-
const parser = (message) => {
|
|
170
|
-
const list = [
|
|
171
|
-
{
|
|
172
|
-
...message,
|
|
173
|
-
role: message.role ?? Role.User,
|
|
174
|
-
content: message.content ?? "",
|
|
175
|
-
loading: message.seviceLoading
|
|
176
|
-
}
|
|
177
|
-
];
|
|
178
|
-
return list;
|
|
179
|
-
};
|
|
180
|
-
const formatSend = (message) => {
|
|
181
|
-
return {
|
|
182
|
-
role: Role.User,
|
|
183
|
-
content: message
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
const agentChat = initAgentChat(
|
|
187
|
-
props.request ?? request,
|
|
188
|
-
props.parser ?? parser,
|
|
189
|
-
props.formatSend ?? formatSend
|
|
110
|
+
typeof l.data == "string" && (i = JSON.parse(l.data)), i.reasoning_content && (h += i.reasoning_content, m = "thinking", v = !1, u()), i.content && (_ += i.content, v = !1, u()), h && i.content && (m = "end", u()), i.is_end && (k = !0, u(), M());
|
|
111
|
+
}, { message: r?.content });
|
|
112
|
+
}, o = (a) => [
|
|
113
|
+
{
|
|
114
|
+
...a,
|
|
115
|
+
role: a.role ?? d.User,
|
|
116
|
+
content: a.content ?? "",
|
|
117
|
+
loading: a.seviceLoading
|
|
118
|
+
}
|
|
119
|
+
], p = (a) => ({
|
|
120
|
+
role: d.User,
|
|
121
|
+
content: a
|
|
122
|
+
}), g = T(
|
|
123
|
+
e.request ?? n,
|
|
124
|
+
e.parser ?? o,
|
|
125
|
+
e.formatSend ?? p
|
|
190
126
|
);
|
|
191
|
-
|
|
192
|
-
return slots.default;
|
|
127
|
+
return s("load", g), t.default;
|
|
193
128
|
}
|
|
194
129
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
class MessageViewManager {
|
|
199
|
-
constructor() {
|
|
200
|
-
this.views = [];
|
|
201
|
-
}
|
|
130
|
+
class J {
|
|
131
|
+
views = [];
|
|
202
132
|
getViews() {
|
|
203
133
|
return this.views;
|
|
204
134
|
}
|
|
205
|
-
createView(
|
|
206
|
-
this.views.push(
|
|
135
|
+
createView(t) {
|
|
136
|
+
this.views.push(t);
|
|
207
137
|
}
|
|
208
138
|
/**
|
|
209
139
|
* @description 创建或更新最后一个 view
|
|
210
140
|
*/
|
|
211
|
-
upsertView(
|
|
212
|
-
let
|
|
213
|
-
|
|
214
|
-
lastView.content += data.content;
|
|
215
|
-
lastView.updating = data.updating;
|
|
216
|
-
callbacks.onUpdate?.(lastView);
|
|
217
|
-
} else {
|
|
218
|
-
lastView = data;
|
|
219
|
-
this.createView(lastView);
|
|
220
|
-
callbacks.onCreate?.(lastView);
|
|
221
|
-
}
|
|
222
|
-
return lastView;
|
|
141
|
+
upsertView(t, s = {}) {
|
|
142
|
+
let n = this.getLastUpdatingView(t.type);
|
|
143
|
+
return n ? (n.content += t.content, n.updating = t.updating, s.onUpdate?.(n)) : (n = t, this.createView(n), s.onCreate?.(n)), n;
|
|
223
144
|
}
|
|
224
145
|
/**
|
|
225
146
|
* @description 获取当前view 的上一个 view
|
|
226
147
|
*/
|
|
227
|
-
getPrevView(
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
return this.views[
|
|
231
|
-
}
|
|
232
|
-
return void 0;
|
|
148
|
+
getPrevView(t) {
|
|
149
|
+
const s = this.views.indexOf(t);
|
|
150
|
+
if (s > 0)
|
|
151
|
+
return this.views[s - 1];
|
|
233
152
|
}
|
|
234
153
|
/**
|
|
235
154
|
* @description 获取最后一个正在更新的 view
|
|
236
155
|
*/
|
|
237
|
-
getLastUpdatingView(
|
|
238
|
-
return this.views.findLast((
|
|
156
|
+
getLastUpdatingView(t) {
|
|
157
|
+
return this.views.findLast((s) => s.updating && s.type === t);
|
|
239
158
|
}
|
|
240
159
|
/**
|
|
241
160
|
* @description 所有 view 更新结束
|
|
242
161
|
*/
|
|
243
162
|
allViewUpdated() {
|
|
244
|
-
this.views.forEach((
|
|
245
|
-
|
|
163
|
+
this.views.forEach((t) => {
|
|
164
|
+
t.updating = !1;
|
|
246
165
|
});
|
|
247
166
|
}
|
|
248
167
|
}
|
|
249
|
-
|
|
250
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
168
|
+
const K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
251
169
|
__proto__: null
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
170
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
171
|
+
w.install = (e) => {
|
|
172
|
+
e.component(w.name || "VkAgentChatProvider", w);
|
|
173
|
+
};
|
|
174
|
+
export {
|
|
175
|
+
V as ChatAgentInjectKey,
|
|
176
|
+
J as MessageViewManager,
|
|
177
|
+
d as Role,
|
|
178
|
+
w as VkAgentChatProvider,
|
|
179
|
+
K as __VkAgentChatProvider,
|
|
180
|
+
w as default,
|
|
181
|
+
F as roleMap,
|
|
182
|
+
O as roleOptions,
|
|
183
|
+
B as useAgentChat
|
|
256
184
|
};
|
|
257
|
-
|
|
258
|
-
export { ChatAgentInjectKey, MessageViewManager, Role, VkAgentChatProvider, types as __VkAgentChatProvider, VkAgentChatProvider as default, roleMap, roleOptions, useAgentChat };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AnyFunc } from '@vunk/shared';
|
|
2
2
|
import type { PropType } from 'vue';
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
6
|
request: {
|
|
5
7
|
type: PropType<AnyFunc>;
|
|
6
8
|
};
|
|
@@ -25,4 +27,3 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
25
27
|
}>> & Readonly<{
|
|
26
28
|
onLoad?: ((...args: any[]) => any) | undefined;
|
|
27
29
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
-
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("element-plus"),e=require("vue"),a=require("../_plugin-vue_export-helper-BHFhmbuH.js"),l={background:{default:"transparent"},color:{default:"currentColor"}},s={},c=e.defineComponent({name:"VkAvatar",components:{ElAvatar:n.ElAvatar},props:l,emits:s});function u(t,d,i,_,v,f){const r=e.resolveComponent("ElAvatar");return e.openBlock(),e.createBlock(r,{style:e.normalizeStyle({background:t.background,color:t.color})},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["style"])}const o=a._export_sfc(c,[["render",u]]),p=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));o.install=t=>{t.component(o.name||"VkAvatar",o)};exports.VkAvatar=o;exports.__VkAvatar=p;exports.default=o;
|
|
@@ -1,49 +1,43 @@
|
|
|
1
|
-
import { ElAvatar } from
|
|
2
|
-
import { defineComponent, resolveComponent
|
|
3
|
-
import { _ as
|
|
4
|
-
|
|
5
|
-
const props = {
|
|
1
|
+
import { ElAvatar as r } from "element-plus";
|
|
2
|
+
import { defineComponent as n, resolveComponent as a, createBlock as l, openBlock as s, normalizeStyle as c, withCtx as p, renderSlot as m } from "vue";
|
|
3
|
+
import { _ as d } from "../_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
4
|
+
const f = {
|
|
6
5
|
background: {
|
|
7
6
|
default: "transparent"
|
|
8
7
|
},
|
|
9
8
|
color: {
|
|
10
9
|
default: "currentColor"
|
|
11
10
|
}
|
|
12
|
-
}
|
|
13
|
-
const emits = {};
|
|
14
|
-
|
|
15
|
-
var _sfc_main = defineComponent({
|
|
11
|
+
}, u = {}, _ = n({
|
|
16
12
|
name: "VkAvatar",
|
|
17
13
|
components: {
|
|
18
|
-
ElAvatar
|
|
14
|
+
ElAvatar: r
|
|
19
15
|
},
|
|
20
|
-
props,
|
|
21
|
-
emits
|
|
16
|
+
props: f,
|
|
17
|
+
emits: u
|
|
22
18
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
color: _ctx.color
|
|
19
|
+
function i(o, k, v, A, b, y) {
|
|
20
|
+
const e = a("ElAvatar");
|
|
21
|
+
return s(), l(e, {
|
|
22
|
+
style: c({
|
|
23
|
+
background: o.background,
|
|
24
|
+
color: o.color
|
|
30
25
|
})
|
|
31
26
|
}, {
|
|
32
|
-
default:
|
|
33
|
-
|
|
27
|
+
default: p(() => [
|
|
28
|
+
m(o.$slots, "default")
|
|
34
29
|
]),
|
|
35
30
|
_: 3
|
|
36
|
-
/* FORWARDED */
|
|
37
31
|
}, 8, ["style"]);
|
|
38
32
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var types = /*#__PURE__*/Object.freeze({
|
|
33
|
+
const t = /* @__PURE__ */ d(_, [["render", i]]), S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
42
34
|
__proto__: null
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
36
|
+
t.install = (o) => {
|
|
37
|
+
o.component(t.name || "VkAvatar", t);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
t as VkAvatar,
|
|
41
|
+
S as __VkAvatar,
|
|
42
|
+
t as default
|
|
47
43
|
};
|
|
48
|
-
|
|
49
|
-
export { VkAvatar, types as __VkAvatar, VkAvatar as default };
|