@8wave/ai-elements 0.77.0 → 0.78.0

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 (70) hide show
  1. package/dist/_chunks/{PkStreamingMarkdown-COZApJzT.js → PkStreamingMarkdown-gIAvEY1t.js} +370 -301
  2. package/dist/_chunks/PkStreamingMarkdown-gIAvEY1t.js.map +1 -0
  3. package/dist/_chunks/{PkToolShowArtifact-BZQixk9z.js → PkToolShowArtifact-BwW4Yn6k.js} +2 -2
  4. package/dist/_chunks/{PkToolShowArtifact-BZQixk9z.js.map → PkToolShowArtifact-BwW4Yn6k.js.map} +1 -1
  5. package/dist/_chunks/{PkToolShowContactForm-thS7c8iL.js → PkToolShowContactForm-DTE-iF_c.js} +2 -2
  6. package/dist/_chunks/{PkToolShowContactForm-thS7c8iL.js.map → PkToolShowContactForm-DTE-iF_c.js.map} +1 -1
  7. package/dist/_chunks/PkToolShowImageGallery-CGL-HL6v.js +60 -0
  8. package/dist/_chunks/PkToolShowImageGallery-CGL-HL6v.js.map +1 -0
  9. package/dist/_chunks/{PkToolShowProductList-DEo7XogW.js → PkToolShowProductList-C8YIh0Dw.js} +2 -2
  10. package/dist/_chunks/{PkToolShowProductList-DEo7XogW.js.map → PkToolShowProductList-C8YIh0Dw.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowSources-BMXftK6O.js → PkToolShowSources-TSjtd1ps.js} +3 -3
  12. package/dist/_chunks/{PkToolShowSources-BMXftK6O.js.map → PkToolShowSources-TSjtd1ps.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowSuggestedReply-CPAnHI0c.js → PkToolShowSuggestedReply-c9sLv4n4.js} +2 -2
  14. package/dist/_chunks/{PkToolShowSuggestedReply-CPAnHI0c.js.map → PkToolShowSuggestedReply-c9sLv4n4.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowWeather-DcSUbzx0.js → PkToolShowWeather-ChJ5lB4K.js} +48 -48
  16. package/dist/_chunks/PkToolShowWeather-ChJ5lB4K.js.map +1 -0
  17. package/dist/_chunks/{PkToolShowWebPages-aH_GarEV.js → PkToolShowWebPages-CL2mYxh-.js} +2 -2
  18. package/dist/_chunks/{PkToolShowWebPages-aH_GarEV.js.map → PkToolShowWebPages-CL2mYxh-.js.map} +1 -1
  19. package/dist/_chunks/{PkUrl-BHD0_pal.js → PkUrl-CvztUywv.js} +2 -2
  20. package/dist/_chunks/{PkUrl-BHD0_pal.js.map → PkUrl-CvztUywv.js.map} +1 -1
  21. package/dist/_chunks/{useLightbox-DL_oVBep.js → useLightbox-Ddvue042.js} +5 -3
  22. package/{dist-vue/_chunks/useLightbox-1sB7fmFb.js.map → dist/_chunks/useLightbox-Ddvue042.js.map} +1 -1
  23. package/dist/ai-elements.es.js +3097 -3010
  24. package/dist/ai-elements.es.js.map +1 -1
  25. package/dist-vue/PkChatbot.js +1 -1
  26. package/dist-vue/PkChatbotFilePreview.js +1 -1
  27. package/dist-vue/PkChatbotInput.js +1 -1
  28. package/dist-vue/PkChatbotMessages.js +1 -1
  29. package/dist-vue/PkChatbotViewChat.js +1 -1
  30. package/dist-vue/_chunks/{PkChatbot-B9RSkQmJ.js → PkChatbot-BEJTYq-D.js} +4 -4
  31. package/dist-vue/_chunks/{PkChatbot-B9RSkQmJ.js.map → PkChatbot-BEJTYq-D.js.map} +1 -1
  32. package/dist-vue/_chunks/{PkChatbotFilePreview-DHzuGtz5.js → PkChatbotFilePreview-hRNtv2OJ.js} +2 -2
  33. package/dist-vue/_chunks/{PkChatbotFilePreview-DHzuGtz5.js.map → PkChatbotFilePreview-hRNtv2OJ.js.map} +1 -1
  34. package/dist-vue/_chunks/{PkChatbotInput-C5QSmt21.js → PkChatbotInput-BbGLBVim.js} +124 -116
  35. package/dist-vue/_chunks/PkChatbotInput-BbGLBVim.js.map +1 -0
  36. package/dist-vue/_chunks/PkChatbotMessages-j3ALQmGG.js +467 -0
  37. package/dist-vue/_chunks/PkChatbotMessages-j3ALQmGG.js.map +1 -0
  38. package/dist-vue/_chunks/{PkChatbotViewChat-C2FuDayB.js → PkChatbotViewChat-Z05fqNFE.js} +5 -5
  39. package/dist-vue/_chunks/{PkChatbotViewChat-C2FuDayB.js.map → PkChatbotViewChat-Z05fqNFE.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkStreamingMarkdown-BAhC3uGK.js → PkStreamingMarkdown-BBTAwHd_.js} +311 -252
  41. package/dist-vue/_chunks/PkStreamingMarkdown-BBTAwHd_.js.map +1 -0
  42. package/dist-vue/_chunks/{PkToolShowArtifact-RzrDPcEQ.js → PkToolShowArtifact-CbqpjzCA.js} +2 -2
  43. package/dist-vue/_chunks/{PkToolShowArtifact-RzrDPcEQ.js.map → PkToolShowArtifact-CbqpjzCA.js.map} +1 -1
  44. package/dist-vue/_chunks/{PkToolShowContactForm-5H4jfq1F.js → PkToolShowContactForm-BkgfSyw7.js} +2 -2
  45. package/dist-vue/_chunks/{PkToolShowContactForm-5H4jfq1F.js.map → PkToolShowContactForm-BkgfSyw7.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkToolShowImageGallery-B7Bt6ZGv.js → PkToolShowImageGallery-Ckyxa0mx.js} +18 -21
  47. package/dist-vue/_chunks/PkToolShowImageGallery-Ckyxa0mx.js.map +1 -0
  48. package/dist-vue/_chunks/{PkToolShowSources-Dv0uuvqS.js → PkToolShowSources-7Xt3iK2Z.js} +2 -2
  49. package/dist-vue/_chunks/{PkToolShowSources-Dv0uuvqS.js.map → PkToolShowSources-7Xt3iK2Z.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkToolShowWeather-Coq6H0iv.js → PkToolShowWeather-B5Wp8WAt.js} +26 -26
  51. package/dist-vue/_chunks/PkToolShowWeather-B5Wp8WAt.js.map +1 -0
  52. package/dist-vue/_chunks/{useLightbox-1sB7fmFb.js → useLightbox-Cl8REkfc.js} +5 -3
  53. package/{dist/_chunks/useLightbox-DL_oVBep.js.map → dist-vue/_chunks/useLightbox-Cl8REkfc.js.map} +1 -1
  54. package/dist-vue/index.js +11 -11
  55. package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +4 -5
  56. package/dist-vue/packages/components/src/chat/PkStreamingMarkdown.d.ts +9 -1
  57. package/dist-vue/packages/components/src/chat/useChatScroll.d.ts +15 -0
  58. package/dist-vue/style.css +1 -1
  59. package/package.json +1 -1
  60. package/dist/_chunks/PkStreamingMarkdown-COZApJzT.js.map +0 -1
  61. package/dist/_chunks/PkToolShowImageGallery-DmJztS-Z.js +0 -63
  62. package/dist/_chunks/PkToolShowImageGallery-DmJztS-Z.js.map +0 -1
  63. package/dist/_chunks/PkToolShowWeather-DcSUbzx0.js.map +0 -1
  64. package/dist-vue/_chunks/PkChatbotInput-C5QSmt21.js.map +0 -1
  65. package/dist-vue/_chunks/PkChatbotMessages-DOeUT6YL.js +0 -388
  66. package/dist-vue/_chunks/PkChatbotMessages-DOeUT6YL.js.map +0 -1
  67. package/dist-vue/_chunks/PkStreamingMarkdown-BAhC3uGK.js.map +0 -1
  68. package/dist-vue/_chunks/PkToolShowImageGallery-B7Bt6ZGv.js.map +0 -1
  69. package/dist-vue/_chunks/PkToolShowWeather-Coq6H0iv.js.map +0 -1
  70. /package/dist/_chunks/{_plugin-vue_export-helper-BI3pHb34.js → _plugin-vue_export-helper-C6kC663S.js} +0 -0
@@ -0,0 +1,467 @@
1
+ import { t as e } from "./PkChatbotError-CvZxHGlI.js";
2
+ import { c as t, f as n, o as r, p as i, u as a } from "./src-EtGd6cRz.js";
3
+ import { t as o } from "./PkRelativeTime-WZ2aPcp_.js";
4
+ import { t as s } from "./PkStreamingMarkdown-BBTAwHd_.js";
5
+ import { t as c } from "./PkChatbotFeedbackForm-lj9CHdhn.js";
6
+ import { t as l } from "./PkChatbotFilePreview-hRNtv2OJ.js";
7
+ import { a as u, n as d, o as f, r as p, t as m } from "./utils-BegUBK7s.js";
8
+ import { Fragment as h, Transition as g, computed as _, createBlock as v, createCommentVNode as y, createElementBlock as b, createElementVNode as x, createTextVNode as S, createVNode as C, defineAsyncComponent as w, defineComponent as T, mergeProps as E, nextTick as D, normalizeClass as O, normalizeStyle as k, onBeforeUnmount as A, onMounted as j, openBlock as M, ref as N, renderList as ee, renderSlot as te, resolveDynamicComponent as ne, toDisplayString as P, unref as F, useSlots as re, useTemplateRef as ie, watch as I, withCtx as L, withModifiers as R } from "vue";
9
+ import { VvButton as ae, VvButtonGroup as oe, VvIcon as se } from "@volverjs/ui-vue/components";
10
+ import { useI18n as ce } from "vue-i18n";
11
+ //#region ../../packages/components/src/chat/toolComponentMap.ts
12
+ var z = {
13
+ showArtifact: w(() => import("./PkToolShowArtifact-CbqpjzCA.js").then((e) => e.n)),
14
+ showCalendarEvent: w(() => import("./PkToolShowCalendarEvent-DXRAzzKm.js").then((e) => e.n)),
15
+ showComparison: w(() => import("./PkToolShowComparison-CqN_pqBW.js").then((e) => e.n)),
16
+ showContactForm: w(() => import("./PkToolShowContactForm-BkgfSyw7.js").then((e) => e.n)),
17
+ showEmail: w(() => import("./PkToolShowEmail-B7YiliCE.js").then((e) => e.n)),
18
+ showImageGallery: w(() => import("./PkToolShowImageGallery-Ckyxa0mx.js").then((e) => e.n)),
19
+ showLocation: w(() => import("./PkToolShowLocation-DteWf0Cs.js").then((e) => e.n)),
20
+ showMessage: w(() => import("./PkToolShowMessage-ujP26Ae3.js").then((e) => e.n)),
21
+ showMultipleChoice: w(() => import("./PkToolShowMultipleChoice-DZXfWtQp.js").then((e) => e.n)),
22
+ showProductList: w(() => import("./PkToolShowProductList-CtqWK0x4.js").then((e) => e.n)),
23
+ showQrCode: w(() => import("./PkToolShowQrCode-B4ex3m8i.js").then((e) => e.n)),
24
+ showSources: w(() => import("./PkToolShowSources-7Xt3iK2Z.js").then((e) => e.n)),
25
+ showSuggestedReply: w(() => import("./PkToolShowSuggestedReply-30m9yWDL.js").then((e) => e.n)),
26
+ showWeather: w(() => import("./PkToolShowWeather-B5Wp8WAt.js")),
27
+ showWebPages: w(() => import("./PkToolShowWebPages-DZIdrdWs.js").then((e) => e.n))
28
+ }, le = /* @__PURE__ */ T({
29
+ __name: "PkStreamingMarkdownAutoscroll",
30
+ props: {
31
+ markdown: {},
32
+ innerClass: {}
33
+ },
34
+ setup(e) {
35
+ let t = e, n = N(), r = N(0), i = N(!1), a = () => {
36
+ if (!n.value) return;
37
+ let e = n.value.scrollTop;
38
+ e < r.value && r.value - e < 50 && (i.value = !0), e > r.value && e === n.value.scrollHeight - n.value.clientHeight && (i.value = !1), r.value = e;
39
+ };
40
+ return I(() => t.markdown, async () => {
41
+ await D(), n.value && !i.value && (n.value.scrollTop = n.value.scrollHeight);
42
+ }, { immediate: !0 }), (t, r) => (M(), b("div", {
43
+ ref_key: "scrollEl",
44
+ ref: n,
45
+ class: "overflow-auto light-scrollbar",
46
+ onScroll: a
47
+ }, [C(s, {
48
+ markdown: e.markdown,
49
+ class: O(e.innerClass)
50
+ }, null, 8, ["markdown", "class"])], 544));
51
+ }
52
+ }), B = 30, V = 50, H = 500;
53
+ function ue(e) {
54
+ let { scrollEl: t, status: n, messagesLength: r, lastMessageRole: i, onScrollUp: a, onScrollDown: o } = e, s = N(!1), c = !1, l = null, u = null, d = null, f = 0, p = (e = "smooth") => {
55
+ !t.value || s.value || (c = !0, t.value.scrollTo({
56
+ top: t.value.scrollHeight,
57
+ behavior: e
58
+ }), setTimeout(() => {
59
+ c = !1;
60
+ }, e === "instant" ? 0 : H));
61
+ }, m = () => {
62
+ if (!t.value) return;
63
+ let e = t.value.scrollTop;
64
+ if (c) {
65
+ f = e;
66
+ return;
67
+ }
68
+ if (e < f && (f - e < V && (s.value = !0), a?.()), e > f) {
69
+ let { scrollHeight: n, clientHeight: r } = t.value;
70
+ n - r - e < B && (s.value = !1), o?.();
71
+ }
72
+ f = e;
73
+ }, h = () => {
74
+ l || !t.value || (l = new MutationObserver(() => {
75
+ c || s.value || !t.value || (c = !0, t.value.scrollTop = t.value.scrollHeight, requestAnimationFrame(() => {
76
+ c = !1;
77
+ }));
78
+ }), l.observe(t.value, {
79
+ childList: !0,
80
+ subtree: !0,
81
+ characterData: !0
82
+ }));
83
+ }, g = () => {
84
+ l?.disconnect(), l = null;
85
+ };
86
+ I(n, (e, t) => {
87
+ if (e === "streaming" || e === "submitted") {
88
+ h();
89
+ return;
90
+ }
91
+ e === "ready" && t === "streaming" || g();
92
+ }), I(r, async () => {
93
+ r() && i() !== "assistant" && (s.value = !1, c = !0, await D(), p());
94
+ });
95
+ let _ = null, v = () => {
96
+ t.value && (t.value.scrollHeight <= t.value.clientHeight || (t.value.scrollTop = t.value.scrollHeight, _ && clearTimeout(_), _ = setTimeout(y, 300)));
97
+ }, y = () => {
98
+ u?.disconnect(), u = null, d?.disconnect(), d = null, _ &&= (clearTimeout(_), null);
99
+ };
100
+ return j(() => {
101
+ t.value && (u = new ResizeObserver(v), u.observe(t.value), d = new MutationObserver(v), d.observe(t.value, {
102
+ childList: !0,
103
+ subtree: !0
104
+ }), v());
105
+ }), A(() => {
106
+ g(), y();
107
+ }), {
108
+ handleScroll: m,
109
+ scrollToBottom: p,
110
+ userScrolledUp: s
111
+ };
112
+ }
113
+ //#endregion
114
+ //#region ../../packages/components/src/chat/PkChatbotMessages.vue?vue&type=script&setup=true&lang.ts
115
+ var de = { class: "pk-chatbot-messages__wrapper" }, fe = {
116
+ key: 0,
117
+ class: "pk-chatbot-divider"
118
+ }, pe = { class: "pk-chatbot-divider__label" }, me = { class: "pk-chatbot-message__text" }, he = {
119
+ key: 0,
120
+ class: "pk-chatbot-message__loading-info"
121
+ }, ge = { class: "flex gap-8 items-center" }, _e = { class: "font-mono rounded text-10" }, ve = { class: "flex gap-8 items-center" }, ye = {
122
+ key: 0,
123
+ class: "pk-chatbot-message__footer"
124
+ }, be = {
125
+ key: 0,
126
+ class: "flex items-center gap-4 text-12 text-word-3"
127
+ }, xe = ["datetime"], Se = {
128
+ key: 2,
129
+ class: "flex items-center gap-4 text-12 text-word-3"
130
+ }, Ce = /* @__PURE__ */ T({
131
+ __name: "PkChatbotMessages",
132
+ props: {
133
+ status: {},
134
+ messages: {},
135
+ logo: {},
136
+ name: {},
137
+ error: {},
138
+ actions: {},
139
+ mainColor: {},
140
+ textColor: {},
141
+ revisedAnswers: {},
142
+ messageFeedbacks: {},
143
+ disableHeightAdjustment: { type: Boolean },
144
+ showMessageDateTime: { type: Boolean },
145
+ showMessageTokensCount: { type: Boolean },
146
+ showAllMessageParts: { type: Boolean },
147
+ feedbackMessageId: {},
148
+ feedbackLoading: { type: Boolean },
149
+ feedbackSubmitted: { type: Boolean },
150
+ feedbackError: {}
151
+ },
152
+ emits: [
153
+ "show-info",
154
+ "regenerate",
155
+ "revise",
156
+ "upvote",
157
+ "downvote",
158
+ "feedback",
159
+ "feedback-submit",
160
+ "feedback-close",
161
+ "scroll-up",
162
+ "scroll-down",
163
+ "auto-retry",
164
+ "reset-chat"
165
+ ],
166
+ setup(w, { emit: T }) {
167
+ let A = w, j = T, { t: B } = ce({ useScope: "global" }), V = re(), H = ie("scrollEl"), Ce = _(() => f(A.textColor, A.mainColor)), { handleScroll: we, scrollToBottom: Te } = ue({
168
+ scrollEl: H,
169
+ status: () => A.status,
170
+ messagesLength: () => A.messages?.length,
171
+ lastMessageRole: () => A.messages?.[A.messages.length - 1]?.role,
172
+ onScrollUp: () => j("scroll-up"),
173
+ onScrollDown: () => j("scroll-down")
174
+ }), Ee = ie("messagesEl"), U = N(0);
175
+ I(() => A.messages, async (e) => {
176
+ if (!e?.length || A.disableHeightAdjustment) return;
177
+ await D();
178
+ let t = (H.value?.clientHeight ?? 0) - 48, n = e.map((e) => e.role).lastIndexOf("user"), r = t - (Ee.value?.[n]?.clientHeight ?? 0);
179
+ r && (U.value = r);
180
+ }, { deep: !0 });
181
+ let W = (e) => A.revisedAnswers?.some((t) => t.messageId === e), G = (e) => A.messageFeedbacks?.find((t) => t.messageId === e), De = _(() => A.messages?.[A.messages.length - 1]), K = _(() => {
182
+ let e = De.value;
183
+ return e ? e.parts[e.parts.length - 1] : null;
184
+ }), q = _(() => A.status === "submitted" || A.status === "streaming"), J = _(() => A.status === "error"), Y = _(() => {
185
+ let e = K.value;
186
+ return p(B, e);
187
+ }), X = _(() => {
188
+ let e = K.value;
189
+ return m(e);
190
+ }), Oe = (e) => A.messages?.findIndex((t) => t.id === e), Z = (e) => e === void 0 || !A.messages ? !1 : e === (A.messages?.length ?? 0) - 1, ke = (e) => Z(e) && A.status === "ready" && A.actions?.includes("regenerate"), Q = (e, t) => (Z(t) && A.status === "ready" || !Z(t)) && A.actions?.includes(e), Ae = (e) => {
191
+ let t = e.parts[e.parts.length - 1];
192
+ return n(t);
193
+ }, $ = (e) => e.role === "assistant", je = (e) => e.role === "user", Me = (e) => A.messages?.slice(0, e).reverse().find((e) => $(e)), Ne = (e) => A.messages?.slice(e + 1).find((e) => $(e)), Pe = (e) => {
194
+ let t = Me(e), n = Ne(e);
195
+ if (!t?.metadata?.createdAt || !n?.metadata?.createdAt) return !1;
196
+ let r = new Date(t.metadata.createdAt), i = new Date(n.metadata.createdAt);
197
+ return r.getFullYear() !== i.getFullYear() || r.getMonth() !== i.getMonth() || r.getDate() !== i.getDate();
198
+ }, Fe = (e, t) => t === 0 || e.role !== "assistant" ? !1 : A.actions?.length || A.showMessageDateTime && e.metadata?.createdAt !== void 0 || A.showMessageTokensCount && e.metadata?.totalTokens !== void 0, Ie = N();
199
+ return I(() => A.feedbackMessageId, async () => {
200
+ if (await D(), !A.feedbackMessageId) return;
201
+ let e = Ie.value?.[0]?.$el;
202
+ if (e) {
203
+ if (Z(Oe(A.feedbackMessageId))) {
204
+ Te();
205
+ return;
206
+ }
207
+ e.scrollIntoView({
208
+ behavior: "smooth",
209
+ block: "center"
210
+ });
211
+ }
212
+ }), (f, p) => {
213
+ let _ = se, T = ae, D = oe;
214
+ return M(), b("div", {
215
+ ref_key: "scrollEl",
216
+ ref: H,
217
+ class: "pk-chatbot-messages",
218
+ style: k({
219
+ "--chatbot-main-color": w.mainColor,
220
+ "--chatbot-contrast-color": Ce.value
221
+ }),
222
+ onScroll: p[5] ||= (...e) => F(we) && F(we)(...e)
223
+ }, [x("div", de, [
224
+ (M(!0), b(h, null, ee(w.messages, (e, A) => (M(), b(h, { key: e.id }, [A > 0 && je(e) && Pe(A) ? (M(), b("div", fe, [x("span", pe, P(f.$d(new Date(Ne(A)?.metadata?.createdAt ?? ""), "short")), 1)])) : y("", !0), e.parts.length || Z(A) && q.value && $(e) ? (M(), b("div", {
225
+ key: 1,
226
+ ref_for: !0,
227
+ ref: "messagesEl",
228
+ class: O(["pk-chatbot-message", [`pk-chatbot-message--${e.role}`, { "pk-chatbot-message--loading": q.value && Z(A) && $(e) }]]),
229
+ style: k({ minHeight: Z(A) && $(e) && !J.value ? `${U.value}px` : void 0 })
230
+ }, [
231
+ (M(!0), b(h, null, ee(e.parts, (o, c) => (M(), b(h, { key: c }, [F(n)(o) && o.text.trim() ? (M(), v(g, {
232
+ key: 0,
233
+ appear: "",
234
+ name: "pk-chatbot-part"
235
+ }, {
236
+ default: L(() => [x("div", me, [te(f.$slots, "text", E({ ref_for: !0 }, {
237
+ message: e,
238
+ part: o,
239
+ index: A,
240
+ isLoading: q.value
241
+ }), () => [$(e) ? (M(), v(s, {
242
+ key: 0,
243
+ class: "wysiwyg",
244
+ markdown: o.text,
245
+ loading: A === (w.messages?.length ?? 0) - 1 && w.status === "streaming"
246
+ }, null, 8, ["markdown", "loading"])) : (M(), b(h, { key: 1 }, [S(P(o.text), 1)], 64))])])]),
247
+ _: 2
248
+ }, 1024)) : F(a)(o) ? (M(), v(g, {
249
+ key: 1,
250
+ appear: "",
251
+ name: "pk-chatbot-part"
252
+ }, {
253
+ default: L(() => [C(l, {
254
+ "media-type": o.mediaType,
255
+ url: o.url,
256
+ filename: o.filename
257
+ }, null, 8, [
258
+ "media-type",
259
+ "url",
260
+ "filename"
261
+ ])]),
262
+ _: 2
263
+ }, 1024)) : F(i)(o) && !F(u)(o) && (F(z)[F(t)(o)] || F(V)[o.type] || w.showAllMessageParts) ? (M(), v(g, {
264
+ key: 2,
265
+ appear: "",
266
+ name: "pk-chatbot-part"
267
+ }, {
268
+ default: L(() => [!F(V)[o.type] && F(z)[F(t)(o)] ? (M(), v(ne(F(z)[F(t)(o)]), {
269
+ key: `component-${c}-${F(d)(o)}`,
270
+ part: o
271
+ }, null, 8, ["part"])) : te(f.$slots, o.type, E({
272
+ key: 1,
273
+ ref_for: !0
274
+ }, {
275
+ message: e,
276
+ part: o,
277
+ index: A,
278
+ isLoading: q.value
279
+ }), () => [w.showAllMessageParts ? (M(), b("div", he, [x("div", ge, [F(m)(o) ? (M(), v(_, {
280
+ key: 0,
281
+ name: F(m)(o),
282
+ class: "shrink-0"
283
+ }, null, 8, ["name"])) : y("", !0), x("code", _e, P(F(r)(o.type)), 1)])])) : y("", !0)])]),
284
+ _: 2
285
+ }, 1024)) : y("", !0)], 64))), 128)),
286
+ C(g, {
287
+ name: "pk-chatbot-fade",
288
+ mode: "out-in"
289
+ }, {
290
+ default: L(() => [q.value && Z(A) && !Ae(e) && $(e) ? (M(), b("div", {
291
+ key: `loading-info-${e.id}`,
292
+ class: "pk-chatbot-message__loading-info"
293
+ }, [x("div", ve, [
294
+ C(_, {
295
+ name: "line-md:loading-loop",
296
+ class: "shrink-0"
297
+ }),
298
+ C(g, { mode: "out-in" }, {
299
+ default: L(() => [X.value ? (M(), v(_, {
300
+ key: X.value,
301
+ class: "shrink-0",
302
+ name: X.value
303
+ }, null, 8, ["name"])) : y("", !0)]),
304
+ _: 1
305
+ }),
306
+ C(g, { mode: "out-in" }, {
307
+ default: L(() => [Y.value ? (M(), b("span", {
308
+ key: Y.value,
309
+ class: "text-10"
310
+ }, P(Y.value), 1)) : y("", !0)]),
311
+ _: 1
312
+ })
313
+ ]), C(g, { mode: "out-in" }, {
314
+ default: L(() => [K.value && "text" in K.value && K.value.text.trim() ? (M(), v(le, {
315
+ key: 0,
316
+ markdown: K.value.text,
317
+ "inner-class": "wysiwyg",
318
+ class: "border border-surface-4 rounded p-4 mt-8 bg-surface-1 max-h-64 text-10 w-full"
319
+ }, null, 8, ["markdown"])) : y("", !0)]),
320
+ _: 1
321
+ })])) : y("", !0)]),
322
+ _: 2
323
+ }, 1024),
324
+ C(g, { mode: "out-in" }, {
325
+ default: L(() => [Fe(e, A) ? (M(), b("div", ye, [
326
+ C(D, {
327
+ modifiers: "compact",
328
+ class: "mr-auto"
329
+ }, {
330
+ default: L(() => [
331
+ C(g, { mode: "out-in" }, {
332
+ default: L(() => [ke(A) ? (M(), v(T, {
333
+ key: 0,
334
+ icon: "ri:reset-right-line",
335
+ modifiers: "action-quiet-small",
336
+ title: F(B)("action.regenerate"),
337
+ onClick: p[0] ||= R((e) => f.$emit("regenerate"), ["stop"])
338
+ }, null, 8, ["title"])) : y("", !0)]),
339
+ _: 2
340
+ }, 1024),
341
+ C(g, { mode: "out-in" }, {
342
+ default: L(() => [Q("show-info", A) ? (M(), v(T, {
343
+ key: 0,
344
+ icon: "ri:information-line",
345
+ title: F(B)("action.getMoreInfo"),
346
+ modifiers: "action-quiet-small",
347
+ onClick: R((t) => f.$emit("show-info", e), ["stop"])
348
+ }, null, 8, ["title", "onClick"])) : y("", !0)]),
349
+ _: 2
350
+ }, 1024),
351
+ C(g, { mode: "out-in" }, {
352
+ default: L(() => [Q("revise", A) ? (M(), v(T, {
353
+ key: 0,
354
+ icon: W(e.id) ? "ri:file-edit-fill" : "ri:file-edit-line",
355
+ title: W(e.id) ? F(B)("action.editRevise") : F(B)("action.createRevise"),
356
+ modifiers: "action-quiet-small",
357
+ class: O({ "text-brand": W(e.id) }),
358
+ onClick: R((t) => f.$emit("revise", e), ["stop"])
359
+ }, null, 8, [
360
+ "icon",
361
+ "title",
362
+ "class",
363
+ "onClick"
364
+ ])) : y("", !0)]),
365
+ _: 2
366
+ }, 1024),
367
+ C(g, { mode: "out-in" }, {
368
+ default: L(() => [Q("upvote", A) ? (M(), v(T, {
369
+ key: 0,
370
+ icon: G(e.id)?.vote === "upvote" ? "ri:thumb-up-fill" : "ri:thumb-up-line",
371
+ title: F(B)("action.upvote"),
372
+ modifiers: "action-quiet-small",
373
+ onClick: R((t) => f.$emit("upvote", e), ["stop"])
374
+ }, null, 8, [
375
+ "icon",
376
+ "title",
377
+ "onClick"
378
+ ])) : y("", !0)]),
379
+ _: 2
380
+ }, 1024),
381
+ C(g, { mode: "out-in" }, {
382
+ default: L(() => [Q("downvote", A) ? (M(), v(T, {
383
+ key: 0,
384
+ icon: G(e.id)?.vote === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-down-line",
385
+ title: F(B)("action.downvote"),
386
+ modifiers: "action-quiet-small",
387
+ onClick: R((t) => f.$emit("downvote", e), ["stop"])
388
+ }, null, 8, [
389
+ "icon",
390
+ "title",
391
+ "onClick"
392
+ ])) : y("", !0)]),
393
+ _: 2
394
+ }, 1024),
395
+ C(g, { mode: "out-in" }, {
396
+ default: L(() => [Q("feedback", A) ? (M(), v(T, {
397
+ key: 0,
398
+ icon: G(e.id)?.comment ? "ri:feedback-fill" : "ri:feedback-line",
399
+ title: F(B)("action.feedback"),
400
+ modifiers: "action-quiet-small",
401
+ onClick: R((t) => f.$emit("feedback", e), ["stop"])
402
+ }, null, 8, [
403
+ "icon",
404
+ "title",
405
+ "onClick"
406
+ ])) : y("", !0)]),
407
+ _: 2
408
+ }, 1024)
409
+ ]),
410
+ _: 2
411
+ }, 1024),
412
+ w.showMessageTokensCount && e.metadata?.totalTokens ? (M(), b("span", be, [C(_, { name: "ri:ai-generate-2-line" }), S(" " + P(f.$n(e.metadata.totalTokens, "integer")) + " " + P(F(B)("label.tokens")), 1)])) : y("", !0),
413
+ w.showMessageDateTime && e.metadata?.createdAt ? (M(), b("time", {
414
+ key: 1,
415
+ datetime: new Date(e.metadata?.createdAt).toISOString(),
416
+ class: "flex items-center gap-4 text-12 text-word-3"
417
+ }, [C(_, { name: "ri:time-line" }), S(" " + P(f.$d(new Date(e.metadata?.createdAt), "date-time")), 1)], 8, xe)) : y("", !0),
418
+ w.showMessageDateTime && e?.metadata?.completedAt && e?.metadata?.createdAt ? (M(), b("div", Se, [C(_, { name: "ri:hourglass-line" }), C(o, {
419
+ date: e.metadata?.createdAt,
420
+ "end-date": e.metadata?.completedAt
421
+ }, null, 8, ["date", "end-date"])])) : y("", !0)
422
+ ])) : y("", !0)]),
423
+ _: 2
424
+ }, 1024),
425
+ C(g, { mode: "out-in" }, {
426
+ default: L(() => [e.id === w.feedbackMessageId ? (M(), v(c, {
427
+ key: 0,
428
+ ref_for: !0,
429
+ ref_key: "feedbackMessageEl",
430
+ ref: Ie,
431
+ loading: w.feedbackLoading,
432
+ submitted: w.feedbackSubmitted,
433
+ error: w.feedbackError,
434
+ onSubmit: p[1] ||= (e) => f.$emit("feedback-submit", e),
435
+ onClose: p[2] ||= (e) => f.$emit("feedback-close")
436
+ }, null, 8, [
437
+ "loading",
438
+ "submitted",
439
+ "error"
440
+ ])) : y("", !0)]),
441
+ _: 2
442
+ }, 1024)
443
+ ], 6)) : y("", !0)], 64))), 128)),
444
+ C(g, {
445
+ appear: "",
446
+ name: "pk-chatbot-part"
447
+ }, {
448
+ default: L(() => [J.value ? (M(), v(e, {
449
+ key: 0,
450
+ error: w.error,
451
+ onRetry: p[3] ||= (e) => f.$emit("auto-retry"),
452
+ onReset: p[4] ||= (e) => f.$emit("reset-chat")
453
+ }, null, 8, ["error"])) : y("", !0)]),
454
+ _: 1
455
+ }),
456
+ De.value?.role === "user" || J.value ? (M(), b("div", {
457
+ key: 0,
458
+ style: k({ minHeight: `${U.value}px` })
459
+ }, null, 4)) : y("", !0)
460
+ ])], 36);
461
+ };
462
+ }
463
+ });
464
+ //#endregion
465
+ export { le as n, Ce as t };
466
+
467
+ //# sourceMappingURL=PkChatbotMessages-j3ALQmGG.js.map