@8wave/ai-elements 0.119.0-beta.33 → 0.119.0-beta.45

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 (96) hide show
  1. package/dist/_chunks/Agent-Gdgpd3LA.js.map +1 -1
  2. package/dist/_chunks/{PkToolShowSources-D532Worv.js → PkToolShowSources-B1zXilsH.js} +2 -2
  3. package/dist/_chunks/{PkToolShowSources-D532Worv.js.map → PkToolShowSources-B1zXilsH.js.map} +1 -1
  4. package/dist/_chunks/{markdown-BbaLt57-.js → markdown-DtdG9Krq.js} +95 -89
  5. package/dist/_chunks/markdown-DtdG9Krq.js.map +1 -0
  6. package/dist/ai-elements.es.js +405 -403
  7. package/dist/ai-elements.es.js.map +1 -1
  8. package/dist-vue/PkChatbot.js +1 -1
  9. package/dist-vue/PkChatbotEmptyState.js +1 -1
  10. package/dist-vue/PkChatbotInput.js +1 -1
  11. package/dist-vue/PkChatbotMessages.js +1 -1
  12. package/dist-vue/PkChatbotStepPayload.js +1 -1
  13. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  14. package/dist-vue/PkChatbotSteps.js +1 -1
  15. package/dist-vue/PkChatbotViewChat.js +1 -1
  16. package/dist-vue/PkChatbotViewConversations.js +1 -1
  17. package/dist-vue/PkChatbotViewFiles.js +1 -1
  18. package/dist-vue/PkChatbotViewProfile.js +1 -1
  19. package/dist-vue/_chunks/{Agent-DU1WWaHR.js → Agent-DGCZCx4Y.js} +102 -101
  20. package/dist-vue/_chunks/Agent-DGCZCx4Y.js.map +1 -0
  21. package/dist-vue/_chunks/{Document-Cto-Qws0.js → Document-BZea8ewV.js} +8 -4
  22. package/dist-vue/_chunks/Document-BZea8ewV.js.map +1 -0
  23. package/dist-vue/_chunks/{PkChatbot-wODOAtOD.js → PkChatbot-BVWLvaXb.js} +8 -8
  24. package/dist-vue/_chunks/{PkChatbot-wODOAtOD.js.map → PkChatbot-BVWLvaXb.js.map} +1 -1
  25. package/dist-vue/_chunks/{PkChatbotEmptyState-Dx4mTkTX.js → PkChatbotEmptyState-B7fZ51v1.js} +2 -2
  26. package/dist-vue/_chunks/{PkChatbotEmptyState-Dx4mTkTX.js.map → PkChatbotEmptyState-B7fZ51v1.js.map} +1 -1
  27. package/dist-vue/_chunks/{PkChatbotInput-jj3qQl_f.js → PkChatbotInput-Bo4Ewf6A.js} +2 -2
  28. package/dist-vue/_chunks/{PkChatbotInput-jj3qQl_f.js.map → PkChatbotInput-Bo4Ewf6A.js.map} +1 -1
  29. package/dist-vue/_chunks/PkChatbotMessages-DHZNG6YM.js +881 -0
  30. package/dist-vue/_chunks/PkChatbotMessages-DHZNG6YM.js.map +1 -0
  31. package/dist-vue/_chunks/{PkChatbotStepPayload-f2mYAVpu.js → PkChatbotStepPayload-DuI9ZYqp.js} +2 -2
  32. package/dist-vue/_chunks/{PkChatbotStepPayload-f2mYAVpu.js.map → PkChatbotStepPayload-DuI9ZYqp.js.map} +1 -1
  33. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BcYheOnU.js → PkChatbotStepToolDetail-B9hBMl15.js} +3 -3
  34. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BcYheOnU.js.map → PkChatbotStepToolDetail-B9hBMl15.js.map} +1 -1
  35. package/dist-vue/_chunks/PkChatbotSteps-3qySSEYh.js +189 -0
  36. package/dist-vue/_chunks/PkChatbotSteps-3qySSEYh.js.map +1 -0
  37. package/dist-vue/_chunks/{PkChatbotViewChat-DZqXDwzk.js → PkChatbotViewChat-CLyoZH3C.js} +7 -7
  38. package/dist-vue/_chunks/{PkChatbotViewChat-DZqXDwzk.js.map → PkChatbotViewChat-CLyoZH3C.js.map} +1 -1
  39. package/dist-vue/_chunks/{PkChatbotViewConversations-CXcToApC.js → PkChatbotViewConversations-BbXFoEOv.js} +3 -3
  40. package/dist-vue/_chunks/{PkChatbotViewConversations-CXcToApC.js.map → PkChatbotViewConversations-BbXFoEOv.js.map} +1 -1
  41. package/dist-vue/_chunks/{PkChatbotViewFiles-O8lhbXAX.js → PkChatbotViewFiles-7vcERhnZ.js} +3 -3
  42. package/dist-vue/_chunks/{PkChatbotViewFiles-O8lhbXAX.js.map → PkChatbotViewFiles-7vcERhnZ.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotViewProfile-kryFJi0l.js → PkChatbotViewProfile-RgFp-LpV.js} +2 -2
  44. package/dist-vue/_chunks/{PkChatbotViewProfile-kryFJi0l.js.map → PkChatbotViewProfile-RgFp-LpV.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkStreamingMarkdown-CywawRVj.js → PkStreamingMarkdown-Bmm1kZpL.js} +3 -3
  46. package/dist-vue/_chunks/{PkStreamingMarkdown-CywawRVj.js.map → PkStreamingMarkdown-Bmm1kZpL.js.map} +1 -1
  47. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BT4HueLs.js → PkToolEditSpreadsheet-BIQky1RK.js} +2 -2
  48. package/dist-vue/_chunks/{PkToolEditSpreadsheet-BT4HueLs.js.map → PkToolEditSpreadsheet-BIQky1RK.js.map} +1 -1
  49. package/dist-vue/_chunks/{PkToolRequestGeolocation-JZYgc-2X.js → PkToolRequestGeolocation-CYEyXZSh.js} +2 -2
  50. package/dist-vue/_chunks/{PkToolRequestGeolocation-JZYgc-2X.js.map → PkToolRequestGeolocation-CYEyXZSh.js.map} +1 -1
  51. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Ck2tRuls.js → PkToolRequestOAuthConnection-B243GJ1-.js} +2 -2
  52. package/dist-vue/_chunks/{PkToolRequestOAuthConnection-Ck2tRuls.js.map → PkToolRequestOAuthConnection-B243GJ1-.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkToolShowArtifact-BiFJoOTT.js → PkToolShowArtifact-CJG-B9mE.js} +2 -2
  54. package/dist-vue/_chunks/{PkToolShowArtifact-BiFJoOTT.js.map → PkToolShowArtifact-CJG-B9mE.js.map} +1 -1
  55. package/dist-vue/_chunks/{PkToolShowContactForm-B7DvA6O1.js → PkToolShowContactForm-CG1H7xBz.js} +2 -2
  56. package/dist-vue/_chunks/{PkToolShowContactForm-B7DvA6O1.js.map → PkToolShowContactForm-CG1H7xBz.js.map} +1 -1
  57. package/dist-vue/_chunks/{PkToolShowDiagram-DGMwlxqB.js → PkToolShowDiagram-Cq0457a3.js} +2 -2
  58. package/dist-vue/_chunks/{PkToolShowDiagram-DGMwlxqB.js.map → PkToolShowDiagram-Cq0457a3.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkToolShowForm-BZmAnMSD.js → PkToolShowForm-IJ8B8_yT.js} +4 -4
  60. package/dist-vue/_chunks/{PkToolShowForm-BZmAnMSD.js.map → PkToolShowForm-IJ8B8_yT.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkToolShowImageGallery-BsYTRg_W.js → PkToolShowImageGallery-ala8nlAj.js} +2 -2
  62. package/dist-vue/_chunks/{PkToolShowImageGallery-BsYTRg_W.js.map → PkToolShowImageGallery-ala8nlAj.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkToolShowProductList-D1_v79Xm.js → PkToolShowProductList-BDg84ZQN.js} +2 -2
  64. package/dist-vue/_chunks/{PkToolShowProductList-D1_v79Xm.js.map → PkToolShowProductList-BDg84ZQN.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkToolShowSources-Czu2IiGq.js → PkToolShowSources-DaSijN_L.js} +3 -3
  66. package/dist-vue/_chunks/{PkToolShowSources-Czu2IiGq.js.map → PkToolShowSources-DaSijN_L.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkToolShowSuggestedReply-I6FBos-F.js → PkToolShowSuggestedReply-CLEFPrHP.js} +2 -2
  68. package/dist-vue/_chunks/{PkToolShowSuggestedReply-I6FBos-F.js.map → PkToolShowSuggestedReply-CLEFPrHP.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkToolShowVideo-D3D2sTAP.js → PkToolShowVideo-FmE-IRE7.js} +2 -2
  70. package/dist-vue/_chunks/{PkToolShowVideo-D3D2sTAP.js.map → PkToolShowVideo-FmE-IRE7.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkToolShowWebPages-DTq0811l.js → PkToolShowWebPages-B554-MlD.js} +2 -2
  72. package/dist-vue/_chunks/{PkToolShowWebPages-DTq0811l.js.map → PkToolShowWebPages-B554-MlD.js.map} +1 -1
  73. package/dist-vue/_chunks/{createChatbotApiClient-BlJ952Kb.js → createChatbotApiClient-CDS3C4i6.js} +2 -2
  74. package/dist-vue/_chunks/createChatbotApiClient-CDS3C4i6.js.map +1 -0
  75. package/dist-vue/_chunks/{useChatbotStore-CueyhDPB.js → useChatbotStore-CBjBe7GI.js} +3 -3
  76. package/dist-vue/_chunks/{useChatbotStore-CueyhDPB.js.map → useChatbotStore-CBjBe7GI.js.map} +1 -1
  77. package/dist-vue/_chunks/{utils-DmRXPCqa.js → utils-Cvijhryt.js} +2 -2
  78. package/dist-vue/_chunks/{utils-DmRXPCqa.js.map → utils-Cvijhryt.js.map} +1 -1
  79. package/dist-vue/api.js +1 -1
  80. package/dist-vue/composables.js +3 -3
  81. package/dist-vue/index.js +26 -26
  82. package/dist-vue/index.js.map +1 -1
  83. package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +6 -0
  84. package/dist-vue/packages/models/src/schema/Branding.d.ts +5 -0
  85. package/dist-vue/packages/models/src/schema/Chat.d.ts +8 -0
  86. package/dist-vue/packages/models/src/schema/ModelProvider.d.ts +12 -1
  87. package/dist-vue/packages/models/src/schema/constants.d.ts +26 -1
  88. package/package.json +1 -1
  89. package/dist/_chunks/markdown-BbaLt57-.js.map +0 -1
  90. package/dist-vue/_chunks/Agent-DU1WWaHR.js.map +0 -1
  91. package/dist-vue/_chunks/Document-Cto-Qws0.js.map +0 -1
  92. package/dist-vue/_chunks/PkChatbotMessages-5wPl7-j-.js +0 -876
  93. package/dist-vue/_chunks/PkChatbotMessages-5wPl7-j-.js.map +0 -1
  94. package/dist-vue/_chunks/PkChatbotSteps-DKyF0ykL.js +0 -191
  95. package/dist-vue/_chunks/PkChatbotSteps-DKyF0ykL.js.map +0 -1
  96. package/dist-vue/_chunks/createChatbotApiClient-BlJ952Kb.js.map +0 -1
@@ -1,876 +0,0 @@
1
- import { A as e, E as t, S as n, n as r, v as i } from "./schemas-Bu1lick6.js";
2
- import { a } from "./Media-C6RS-s98.js";
3
- import { P as o, T as s, r as c, w as l } from "./Agent-DU1WWaHR.js";
4
- import { t as u } from "./VvButtonLocalized-BuzLsXp3.js";
5
- import { t as d } from "./PkStreamingMarkdown-CywawRVj.js";
6
- import "./src-BZRiAJsH.js";
7
- import { c as f, i as p, l as m, n as h, o as g, s as _, t as v } from "./message-BOiF6Bt5.js";
8
- import { t as y } from "./PkChatbotAudioTranscript-CC9M-zDv.js";
9
- import { A as ee, C as te, E as b, O as ne, S as x, T as re, a as S, b as C, f as w, g as ie, h as ae, m as oe, n as se, o as ce, p as le, t as T, u as ue } from "./utils-DmRXPCqa.js";
10
- import { t as de } from "./PkChatbotError-BV5ga7hk.js";
11
- import { t as fe } from "./PkRelativeTime--1cIphlA.js";
12
- import { t as pe } from "./PkChatbotFilePreview-Lxgu89Hg.js";
13
- import { t as me } from "./PkChatbotFeedbackForm-B5cYsWBr.js";
14
- import { t as he } from "./PkChatbotMessageFeedback-BYmrVaCE.js";
15
- import { n as ge, t as _e } from "./PkChatbotSteps-DKyF0ykL.js";
16
- import { t as ve } from "./PkChatbotOutlineRail-np4g6vsz.js";
17
- import { VvButtonGroup as ye, VvIcon as be } from "@volverjs/ui-vue/components";
18
- import { Fragment as E, Transition as D, computed as O, createBlock as k, createCommentVNode as A, createElementBlock as j, createElementVNode as M, createTextVNode as xe, createVNode as N, defineAsyncComponent as P, defineComponent as Se, mergeProps as Ce, nextTick as F, normalizeClass as I, normalizeStyle as we, onBeforeUnmount as Te, onMounted as Ee, openBlock as L, ref as R, renderList as De, renderSlot as Oe, resolveDynamicComponent as ke, toDisplayString as z, unref as B, useSlots as Ae, useTemplateRef as je, watch as V, withCtx as H, withModifiers as U } from "vue";
19
- import { useI18n as Me } from "vue-i18n";
20
- //#region ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/iso.js
21
- function Ne(t) {
22
- return e(r, t);
23
- }
24
- i({
25
- platform: n(),
26
- threadId: n()
27
- });
28
- var Pe = i({
29
- wakeId: t(),
30
- dueAt: Ne(),
31
- reason: n()
32
- });
33
- i({ pendingWakeup: Pe.nullable() }), i({ wakeId: t() });
34
- var W = (e) => e?.role === "user" && !!e.metadata?.wakeup, Fe = /* @__PURE__ */ new Set([
35
- "input-streaming",
36
- "input-available",
37
- "approval-requested"
38
- ]), Ie = /* @__PURE__ */ new Set([
39
- ...s,
40
- ...l,
41
- "editSpreadsheet"
42
- ]);
43
- [...l, c.ShowContactForm];
44
- var G = (e) => e.state, Le = (e) => e.type.startsWith("tool-") ? e.type.slice(5) : void 0, Re = (e) => e?.role === "assistant" && e.parts.some((e) => {
45
- if (e.type === "text") return e.text.trim().length > 0;
46
- if (e.type === "file") return !0;
47
- let t = G(e);
48
- if (t && Fe.has(t)) return !0;
49
- let n = Le(e);
50
- return n !== void 0 && Ie.has(n) && t === "output-available";
51
- }), ze = (e) => {
52
- if (e?.role !== "assistant" || Re(e)) return !1;
53
- let t = !1;
54
- for (let n of e.parts) n.type === "tool-scheduleWakeup" && (t = G(n) === "output-available" && n.input?.noop === !0);
55
- return t;
56
- }, Be = {
57
- requestOAuthConnection: P(() => import("./PkToolRequestOAuthConnection-Ck2tRuls.js")),
58
- showArtifact: P(() => import("./PkToolShowArtifact-BiFJoOTT.js").then((e) => e.n)),
59
- showCalendarEvent: P(() => import("./PkToolShowCalendarEvent-CFODjoDV.js").then((e) => e.n)),
60
- showComparison: P(() => import("./PkToolShowComparison-c2e239T4.js").then((e) => e.n)),
61
- showContactForm: P(() => import("./PkToolShowContactForm-B7DvA6O1.js").then((e) => e.n)),
62
- showDiagram: P(() => import("./PkToolShowDiagram-DGMwlxqB.js")),
63
- showEmail: P(() => import("./PkToolShowEmail-CUgZN0J5.js").then((e) => e.n)),
64
- showImageGallery: P(() => import("./PkToolShowImageGallery-BsYTRg_W.js").then((e) => e.n)),
65
- showLocation: P(() => import("./PkToolShowLocation-BipZrvw7.js").then((e) => e.n)),
66
- showMessage: P(() => import("./PkToolShowMessage-ATTN5Hac.js").then((e) => e.n)),
67
- showForm: P(() => import("./PkToolShowForm-BZmAnMSD.js").then((e) => e.n)),
68
- showMultipleChoice: P(() => import("./PkToolShowForm-BZmAnMSD.js").then((e) => e.n)),
69
- showProductList: P(() => import("./PkToolShowProductList-D1_v79Xm.js").then((e) => e.n)),
70
- showQrCode: P(() => import("./PkToolShowQrCode-D_5VUtEB.js").then((e) => e.n)),
71
- showSources: P(() => import("./PkToolShowSources-Czu2IiGq.js").then((e) => e.n)),
72
- showSuggestedReply: P(() => import("./PkToolShowSuggestedReply-I6FBos-F.js").then((e) => e.n)),
73
- showVideo: P(() => import("./PkToolShowVideo-D3D2sTAP.js")),
74
- showWeather: P(() => import("./PkToolShowWeather-BD0w6BA1.js")),
75
- showWebPages: P(() => import("./PkToolShowWebPages-DTq0811l.js").then((e) => e.n))
76
- }, Ve = {
77
- key: 0,
78
- class: "text-12 text-word-3 m-0 mb-xs"
79
- }, He = /* @__PURE__ */ Se({
80
- __name: "PkToolApprovalPreviewMessage",
81
- props: { input: {} },
82
- setup(e) {
83
- let t = e, n = O(() => {
84
- let e = t.input;
85
- return typeof e?.message == "string" ? e.message : "";
86
- });
87
- return (e, t) => n.value ? (L(), j("p", Ve, z(n.value), 1)) : A("", !0);
88
- }
89
- }), K = { [T]: He }, Ue = {
90
- key: 0,
91
- class: "text-12 text-word-3 m-0 mb-xs"
92
- }, We = /* @__PURE__ */ Se({
93
- __name: "PkToolApprovalCard",
94
- props: {
95
- part: {},
96
- actionable: { type: Boolean },
97
- callVerdict: { type: Boolean }
98
- },
99
- emits: ["respond"],
100
- setup(e, { emit: t }) {
101
- let n = e, r = t, { t: i, te: a } = Me({ useScope: "global" }), s = O(() => n.part), c = O(() => p(n.part)), l = O(() => c.value === T), d = O(() => l.value ? (s.value.state === "input-available" || o(s.value.output)) && n.callVerdict === void 0 : s.value.state === "approval-requested"), f = O(() => d.value && n.actionable === !0), m = O(() => d.value && n.actionable !== !0), h = O(() => l.value ? s.value.output === "confirmed" || n.callVerdict === !0 : s.value.approval?.approved === !0), g = O(() => l.value ? s.value.output === "cancelled" || n.callVerdict === !1 : s.value.approval?.approved === !1 || s.value.state === "output-denied"), _ = O(() => K[c.value]), v = O(() => _.value ? i("toolApproval.prompt") : i("toolApproval.promptNamed", { tool: ee(c.value, {
102
- t: i,
103
- te: a
104
- }) })), y = O(() => {
105
- if (m.value) return {
106
- icon: "ri:time-line",
107
- message: i("toolApproval.expired")
108
- };
109
- if (h.value) return {
110
- icon: "ri:check-line",
111
- message: i(l.value ? "toolApproval.confirmed" : "toolApproval.approved")
112
- };
113
- if (g.value) return {
114
- icon: "ri:close-line",
115
- message: i(l.value ? "toolApproval.cancelled" : "toolApproval.denied")
116
- };
117
- }), te = O(() => !!y.value && !_.value);
118
- return (t, n) => {
119
- let a = u, o = ye, c = be;
120
- return L(), j("div", { class: I(["w-full overflow-hidden transition-all duration-300", { "bg-surface p-sm rounded-xl border border-surface-3": !te.value }]) }, [
121
- N(D, null, {
122
- default: H(() => [!l.value && d.value ? (L(), j("p", Ue, z(v.value), 1)) : A("", !0)]),
123
- _: 1
124
- }),
125
- _.value ? (L(), k(ke(_.value), {
126
- key: 0,
127
- part: e.part,
128
- input: s.value.input
129
- }, null, 8, ["part", "input"])) : A("", !0),
130
- N(D, { mode: "out-in" }, {
131
- default: H(() => [y.value ? (L(), j("p", {
132
- key: 1,
133
- class: I(["flex items-center gap-4 text-12 text-word-3 m-0", { "mt-xs": _.value }])
134
- }, [N(c, {
135
- name: y.value.icon,
136
- class: "shrink-0"
137
- }, null, 8, ["name"]), xe(" " + z(y.value.message), 1)], 2)) : (L(), k(o, { key: 0 }, {
138
- default: H(() => [N(a, {
139
- modifiers: "primary-small",
140
- disabled: !f.value,
141
- icon: "ri:check-line",
142
- label: B(i)("action.proceed"),
143
- onClick: n[0] ||= U((e) => r("respond", !0), ["stop"])
144
- }, null, 8, ["disabled", "label"]), N(a, {
145
- modifiers: "action-quiet-small",
146
- disabled: !f.value,
147
- icon: "ri:close-line",
148
- label: B(i)("action.cancel"),
149
- onClick: n[1] ||= U((e) => r("respond", !1), ["stop"])
150
- }, null, 8, ["disabled", "label"])]),
151
- _: 1
152
- }))]),
153
- _: 1
154
- })
155
- ], 2);
156
- };
157
- }
158
- }), Ge = 30, q = 500;
159
- function Ke(e) {
160
- let { scrollEl: t, status: n, messagesLength: r, lastMessageRole: i, contentEl: a, beforeNewMessageScroll: o, onScrollUp: s, onScrollDown: c } = e, l = R(!1), u = R(!0), d = !1, f = null, p = null, m = null, h = null, g = 0, _ = (e = "smooth") => {
161
- !t.value || l.value ? d = !1 : (d = !0, t.value.scrollTo({
162
- top: t.value.scrollHeight,
163
- behavior: e
164
- }), setTimeout(() => {
165
- d = !1;
166
- }, e === "instant" ? 0 : q));
167
- }, v = (e) => {
168
- e.deltaY < 0 && (l.value = !0);
169
- }, y = 0, ee = (e) => {
170
- y = e.touches[0]?.clientY ?? 0;
171
- }, te = (e) => {
172
- let t = e.touches[0]?.clientY ?? 0;
173
- t > y && (l.value = !0), y = t;
174
- }, b = () => {
175
- if (!t.value) return;
176
- let { scrollTop: e, scrollHeight: n, clientHeight: r } = t.value;
177
- u.value = n - r - e < Ge, d || (e < g && s?.(), e > g && (u.value && (l.value = !1), c?.())), g = e;
178
- }, ne = () => {
179
- if (d || l.value || !t.value) return;
180
- let e = t.value, n = e.scrollHeight - e.clientHeight;
181
- n <= e.scrollTop || (u.value = !0, d = !0, e.scrollTop = n, requestAnimationFrame(() => {
182
- d = !1;
183
- }));
184
- }, x = () => {
185
- !f && t.value && (f = new MutationObserver(ne), f.observe(t.value, {
186
- childList: !0,
187
- subtree: !0,
188
- characterData: !0
189
- }));
190
- }, re = () => {
191
- f?.disconnect(), f = null;
192
- };
193
- V(n, (e, t) => {
194
- e === "streaming" || e === "submitted" ? x() : (e !== "ready" || t !== "streaming") && re();
195
- }), V(r, async () => {
196
- if (r() && i() !== "assistant") {
197
- w(), l.value = !1, d = !0;
198
- try {
199
- await F(), await o?.(), await F();
200
- } finally {
201
- _();
202
- }
203
- }
204
- });
205
- let S = null, C = () => {
206
- t.value && (t.value.scrollHeight <= t.value.clientHeight || (t.value.scrollTop = t.value.scrollHeight, S && clearTimeout(S), S = setTimeout(w, 300)));
207
- }, w = () => {
208
- p?.disconnect(), p = null, m?.disconnect(), m = null, S &&= (clearTimeout(S), null);
209
- };
210
- return Ee(() => {
211
- if (!t.value) return;
212
- t.value.addEventListener("wheel", v, { passive: !0 }), t.value.addEventListener("touchstart", ee, { passive: !0 }), t.value.addEventListener("touchmove", te, { passive: !0 });
213
- let e = n() === "submitted" || n() === "streaming";
214
- e ? x() : (p = new ResizeObserver(C), p.observe(t.value), m = new MutationObserver(C), m.observe(t.value, {
215
- childList: !0,
216
- subtree: !0
217
- }));
218
- let r = a?.() ?? t.value.firstElementChild;
219
- r && (h = new ResizeObserver(ne), h.observe(r)), e || C();
220
- }), Te(() => {
221
- t.value?.removeEventListener("wheel", v), t.value?.removeEventListener("touchstart", ee), t.value?.removeEventListener("touchmove", te), h?.disconnect(), h = null, re(), w();
222
- }), {
223
- handleScroll: b,
224
- scrollToBottom: _,
225
- userScrolledUp: l,
226
- isAtBottom: u
227
- };
228
- }
229
- //#endregion
230
- //#region ../../packages/components/src/chat/wakeupFeed.ts
231
- function qe(e, t = () => !1) {
232
- let n = (e) => ze(e) && !t(e), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = 0;
233
- for (; a < e.length;) {
234
- let t = e[a];
235
- if (W(t) && n(e[a + 1])) {
236
- let o = t.id, s = 0, c;
237
- for (; W(e[a]) && n(e[a + 1]);) s += 1, c = e[a].metadata?.createdAt ?? c, r.add(e[a].id), r.add(e[a + 1].id), a += 2;
238
- i.set(o, {
239
- count: s,
240
- lastAt: c
241
- });
242
- } else n(t) && r.add(t.id), a += 1;
243
- }
244
- return {
245
- hidden: r,
246
- quietRuns: i
247
- };
248
- }
249
- //#endregion
250
- //#region ../../packages/components/src/chat/PkChatbotMessages.vue?vue&type=script&setup=true&lang.ts
251
- var Je = ["aria-busy"], Ye = {
252
- key: 0,
253
- class: "pk-chatbot-messages__outline"
254
- }, Xe = {
255
- key: 0,
256
- class: "pk-chatbot-divider vv-separator"
257
- }, Ze = { class: "pk-chatbot-divider__label" }, Qe = {
258
- key: 1,
259
- class: "pk-chatbot-wakeup"
260
- }, $e = ["title"], et = { class: "pk-chatbot-message__text" }, tt = ["title"], nt = {
261
- key: 0,
262
- class: "pk-chatbot-message__reaction-emoji"
263
- }, rt = {
264
- key: 0,
265
- class: "flex flex-col items-end gap-8 w-full"
266
- }, it = {
267
- key: 0,
268
- class: "pk-chatbot-message__loading-info"
269
- }, at = { class: "flex gap-8 items-center" }, ot = { class: "text-12" }, st = { class: "flex gap-8 items-center" }, ct = {
270
- key: 0,
271
- class: "pk-chatbot-message__footer"
272
- }, lt = {
273
- key: 0,
274
- class: "pk-chatbot-message__hover-meta"
275
- }, ut = ["datetime", "title"], dt = { class: "truncate" }, ft = {
276
- key: 0,
277
- class: "flex items-center gap-4 min-w-0"
278
- }, pt = { class: "truncate" }, mt = ["title"], ht = {
279
- key: 2,
280
- class: "flex items-center gap-4 text-12 text-word-3"
281
- }, gt = { class: "truncate" }, _t = ["datetime"], vt = { class: "truncate" }, yt = {
282
- key: 4,
283
- class: "flex items-center gap-4 text-12 text-word-3"
284
- }, bt = { class: "pk-chatbot-message__loading-info" }, xt = { class: "flex gap-8 items-center" }, St = { class: "text-12" }, Ct = ["title", "aria-label"], J = /* @__PURE__ */ Se({
285
- __name: "PkChatbotMessages",
286
- props: {
287
- status: {},
288
- messages: {},
289
- error: {},
290
- actions: {},
291
- mainColor: {},
292
- textColor: {},
293
- revisedAnswers: {},
294
- messageFeedbacks: {},
295
- readonlyFeedback: { type: Boolean },
296
- disableHeightAdjustment: { type: Boolean },
297
- showMessageDateTime: { type: Boolean },
298
- showMessageTokensCount: { type: Boolean },
299
- showMessageNumber: { type: Boolean },
300
- showAllMessageParts: { type: Boolean },
301
- interactive: { type: Boolean },
302
- showExtendedSteps: { type: Boolean },
303
- awaitingSpokenAnswer: { type: Boolean },
304
- confirmVerdictsOnCall: {},
305
- isDark: { type: Boolean },
306
- showScrollToBottom: { type: Boolean },
307
- feedbackMessageId: {},
308
- feedbackLoading: { type: Boolean },
309
- feedbackSubmitted: { type: Boolean },
310
- feedbackError: {}
311
- },
312
- emits: [
313
- "show-info",
314
- "regenerate",
315
- "revise",
316
- "upvote",
317
- "downvote",
318
- "feedback",
319
- "feedback-submit",
320
- "feedback-close",
321
- "scroll-up",
322
- "scroll-down",
323
- "auto-retry",
324
- "reset-chat",
325
- "approval-respond",
326
- "confirm-respond"
327
- ],
328
- setup(e, { emit: t }) {
329
- let n = e, r = t, { t: i, te: o, d: s, n: c } = Me({ useScope: "global" }), l = Ae(), ee = (e, t) => {
330
- if (te(e)) {
331
- let n = e.toolCallId;
332
- n && r("confirm-respond", {
333
- toolCallId: n,
334
- confirmed: t
335
- });
336
- return;
337
- }
338
- let n = ae(e);
339
- n && r("approval-respond", {
340
- id: n,
341
- approved: t
342
- });
343
- }, T = je("scrollEl"), P = je("wrapperEl"), Se = O(() => ne(n.textColor, n.mainColor)), { handleScroll: Te, scrollToBottom: Ne, userScrolledUp: Pe, isAtBottom: Fe } = Ke({
344
- scrollEl: T,
345
- status: () => n.status,
346
- messagesLength: () => n.messages?.length,
347
- lastMessageRole: () => n.messages?.[n.messages.length - 1]?.role,
348
- contentEl: () => P.value,
349
- beforeNewMessageScroll: () => Ge(),
350
- onScrollUp: () => r("scroll-up"),
351
- onScrollDown: () => r("scroll-down")
352
- }), Ie = () => {
353
- Pe.value = !1, Ne();
354
- }, G = O(() => (n.messages ?? []).filter((e) => e.role === "user" && !W(e)).map((e) => ({
355
- id: e.id,
356
- preview: e.parts.find(f)?.text.trim().slice(0, 120) || "…"
357
- }))), Le = R(), Re = () => T.value?.querySelectorAll(".pk-chatbot-message--user") ?? [], ze = () => {
358
- let e = T.value;
359
- if (!e || !n.showScrollToBottom) return;
360
- let t = e.getBoundingClientRect().top + e.clientHeight / 2, r = G.value[0]?.id;
361
- Re().forEach((e, n) => {
362
- e.getBoundingClientRect().top <= t && (r = G.value[n]?.id);
363
- }), Le.value = r;
364
- };
365
- V(G, async () => {
366
- await F(), ze();
367
- });
368
- let Ve = () => {
369
- Te(), ze();
370
- }, He = (e) => {
371
- let t = T.value, n = G.value.findIndex((t) => t.id === e), r = Re()[n];
372
- t && r && (Pe.value = !0, t.scrollTo({
373
- top: t.scrollTop + r.getBoundingClientRect().top - t.getBoundingClientRect().top - Number.parseFloat(getComputedStyle(t).paddingTop),
374
- behavior: "smooth"
375
- }));
376
- }, K = R(0), Ue = R(!1), Ge = async () => {
377
- let e = n.messages;
378
- if (!e?.length || n.disableHeightAdjustment || e[e.length - 1].role !== "user" && n.status !== "submitted" && n.status !== "streaming" || (Ue.value = !1, await F(), !T.value)) return;
379
- let { paddingTop: t, paddingBottom: r } = getComputedStyle(T.value), i = T.value.clientHeight - Number.parseFloat(t) - Number.parseFloat(r), a = P.value && Number.parseFloat(getComputedStyle(P.value).rowGap) || 0, o = Re(), s = i - (o[o.length - 1]?.clientHeight ?? 0) - a;
380
- i > 0 && (K.value = Math.max(s, 0)), await F();
381
- };
382
- V(() => [n.messages?.length, n.messages?.[n.messages.length - 1]?.id], () => Ge()), Ee(() => {
383
- (n.status === "submitted" || n.status === "streaming" || n.awaitingSpokenAnswer) && Ge();
384
- }), V(() => n.status, (e) => {
385
- (e === "ready" || e === "error") && (Ue.value = !0, K.value = 0);
386
- });
387
- let q = (e) => n.revisedAnswers?.some((t) => t.messageId === e), J = (e) => n.messageFeedbacks?.find((t) => t.messageId === e), wt = /* @__PURE__ */ new Set(["showContactForm"]), Tt = (e) => !n.interactive && wt.has(p(e)) ? { record: !0 } : {}, Et = (e, t) => !n.readonlyFeedback && Wt(e, t), Dt = (e) => n.readonlyFeedback ? J(e) : void 0, Ot = (e) => Dt(e)?.vote, kt = (e) => {
388
- let t = Dt(e);
389
- if (t?.vote) return;
390
- let n = t?.metadata?.reactionEmoji;
391
- return typeof n == "string" && /\p{Extended_Pictographic}/u.test(n) ? n : void 0;
392
- }, At = (e) => !!(Ot(e) || kt(e)), jt = (e) => {
393
- if (kt(e)) return "pk-chatbot-message__reaction--neutral";
394
- let t = Ot(e);
395
- return t === "upvote" ? "pk-chatbot-message__reaction--positive" : t === "downvote" ? "pk-chatbot-message__reaction--negative" : "pk-chatbot-message__reaction--neutral";
396
- }, Mt = (e) => {
397
- let t = Ot(e);
398
- return i(t === "upvote" ? "hint.userFeedbackPositive" : t === "downvote" ? "hint.userFeedbackNegative" : "hint.userFeedbackReaction");
399
- }, Nt = (e) => {
400
- let t = It(e);
401
- for (let e = t.length - 1; e >= 0; --e) if (f(t[e])) return e;
402
- return -1;
403
- }, Pt = O(() => n.messages?.[n.messages.length - 1]), Y = O(() => {
404
- let e = Pt.value;
405
- return e ? e.parts[e.parts.length - 1] : null;
406
- }), Ft = O(() => {
407
- let e = /* @__PURE__ */ new Map();
408
- for (let t of n.messages ?? []) t.role === "assistant" && e.set(t.id, b(S(re(t.parts))));
409
- return e;
410
- }), It = (e) => Ft.value.get(e.id) ?? e.parts, X = O(() => n.status === "submitted" || n.status === "streaming"), Lt = O(() => n.status === "error"), Rt = O(() => n.awaitingSpokenAnswer === !0 && !X.value), zt = O(() => Rt.value && Pt.value?.role === "user" && !Lt.value), Bt = O(() => {
411
- let e = Y.value;
412
- return ie(i, e);
413
- }), Vt = O(() => {
414
- let e = Y.value;
415
- return w(e);
416
- }), Ht = (e) => n.messages?.findIndex((t) => t.id === e), Z = (e) => e === void 0 || !n.messages ? !1 : e === n.messages.length - 1, Ut = (e) => Z(e) && n.status === "ready" && !!n.actions?.includes("regenerate"), Wt = (e, t) => (!Z(t) || n.status === "ready") && !!n.actions?.includes(e), Gt = (e) => {
417
- let t = e.parts[e.parts.length - 1];
418
- return f(t);
419
- }, Kt = (e) => e.parts.some((e) => _(e) || m(e)), qt = (e) => !!n.showExtendedSteps && Q(e) && Kt(e), Jt = (e) => m(e) && !x(e) && !!(Be[p(e)] || l[e.type] || n.showAllMessageParts), Yt = (e) => e.parts.some((e) => f(e) && !!e.text.trim() || g(e) || C(e) && !x(e) || Jt(e)), Q = (e) => e.role === "assistant", Xt = (e) => e.role === "user", Zt = (e) => n.messages?.slice(0, e).reverse().find((e) => Q(e)), Qt = (e) => n.messages?.slice(e + 1).find((e) => Q(e)), $t = (e) => {
420
- let t = Zt(e)?.metadata?.createdAt, n = Qt(e)?.metadata?.createdAt;
421
- if (!t || !n) return;
422
- let r = new Date(t), i = new Date(n);
423
- return r.toDateString() === i.toDateString() ? void 0 : i;
424
- }, $ = O(() => n.showAllMessageParts ? qe([]) : qe(n.messages ?? [], Yt)), en = O(() => {
425
- let e = 0;
426
- return (n.messages ?? []).map((t) => t.parts.length > 0 ? ++e : void 0);
427
- }), tn = (e, t) => t === 0 || e.role !== "assistant" ? !1 : !!(n.actions?.length || n.showMessageNumber || n.showMessageDateTime && e.metadata?.createdAt !== void 0 || e.metadata?.completedAt !== void 0 || n.showMessageTokensCount && e.metadata?.totalTokens !== void 0), nn = (e) => {
428
- let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
429
- return s(t, n ? "time" : "date-time");
430
- }, rn = (e) => {
431
- let { createdAt: t, completedAt: n } = e.metadata ?? {};
432
- if (t && n) return ue(c, n - t);
433
- }, an = je("feedbackMessageEl");
434
- return V(() => n.feedbackMessageId, async () => {
435
- if (await F(), !n.feedbackMessageId) return;
436
- let e = an.value?.[0]?.$el;
437
- e && (Z(Ht(n.feedbackMessageId)) ? Ne() : e.scrollIntoView({
438
- behavior: "smooth",
439
- block: "center"
440
- }));
441
- }), (t, n) => {
442
- let r = be, m = u, _ = ye;
443
- return L(), j("div", {
444
- ref_key: "scrollEl",
445
- ref: T,
446
- class: I(["pk-chatbot-messages scrollbar-thin", { "pk-chatbot-messages--settling": Ue.value }]),
447
- role: "log",
448
- "aria-live": "polite",
449
- "aria-relevant": "additions text",
450
- "aria-busy": X.value,
451
- style: we({
452
- "--chatbot-main-color": e.mainColor,
453
- "--chatbot-contrast-color": Se.value
454
- }),
455
- onScroll: Ve
456
- }, [
457
- e.showScrollToBottom && G.value.length > 1 ? (L(), j("div", Ye, [N(ve, {
458
- items: G.value,
459
- "active-id": Le.value,
460
- onSelect: He
461
- }, null, 8, ["items", "active-id"])])) : A("", !0),
462
- M("div", {
463
- ref_key: "wrapperEl",
464
- ref: P,
465
- class: "pk-chatbot-messages__wrapper"
466
- }, [
467
- (L(!0), j(E, null, De(e.messages, (u, b) => (L(), j(E, { key: u.id }, [
468
- Xt(u) && $t(b) ? (L(), j("div", Xe, [M("span", Ze, z(B(s)($t(b), "short")), 1)])) : A("", !0),
469
- $.value.quietRuns.has(u.id) ? (L(), j("div", Qe, [N(r, {
470
- name: "ri:alarm-line",
471
- class: "shrink-0"
472
- }), M("span", null, z(B(i)("label.wakeupQuietRun", {
473
- count: $.value.quietRuns.get(u.id).count,
474
- time: B(s)($.value.quietRuns.get(u.id).lastAt ?? Date.now(), "time")
475
- }, $.value.quietRuns.get(u.id).count)), 1)])) : B(W)(u) && !$.value.hidden.has(u.id) && !e.showAllMessageParts ? (L(), j("div", {
476
- key: 2,
477
- class: "pk-chatbot-wakeup",
478
- title: u.metadata?.wakeup?.reason
479
- }, [N(r, {
480
- name: "ri:alarm-line",
481
- class: "shrink-0"
482
- }), M("span", null, [xe(z(B(i)("label.wakeupCheck")) + " ", 1), u.metadata?.createdAt ? (L(), j(E, { key: 0 }, [xe(" · " + z(B(s)(u.metadata.createdAt, "time")), 1)], 64)) : A("", !0)])], 8, $e)) : A("", !0),
483
- (!B(W)(u) || e.showAllMessageParts) && (!$.value.hidden.has(u.id) || X.value && Z(b)) && (u.parts.length || Z(b) && X.value && Q(u)) ? (L(), j("div", {
484
- key: 3,
485
- class: I(["pk-chatbot-message", [`pk-chatbot-message--${u.role}`, { "pk-chatbot-message--loading": X.value && Z(b) && Q(u) }]]),
486
- style: we({ minHeight: Z(b) && Q(u) && !Lt.value ? `${K.value}px` : void 0 })
487
- }, [
488
- N(D, {
489
- appear: "",
490
- name: "pk-chatbot-part"
491
- }, {
492
- default: H(() => [qt(u) ? (L(), k(_e, {
493
- key: 0,
494
- message: u,
495
- "is-streaming": X.value && Z(b),
496
- "has-content": Yt(u),
497
- "is-dark": e.isDark
498
- }, null, 8, [
499
- "message",
500
- "is-streaming",
501
- "has-content",
502
- "is-dark"
503
- ])) : A("", !0)]),
504
- _: 2
505
- }, 1024),
506
- (L(!0), j(E, null, De(It(u), (n, s) => (L(), j(E, { key: B(ce)(n, s) }, [B(f)(n) && n.text.trim() ? (L(), k(D, {
507
- key: 0,
508
- appear: "",
509
- name: "pk-chatbot-part"
510
- }, {
511
- default: H(() => [M("div", et, [Oe(t.$slots, "text", Ce({ ref_for: !0 }, {
512
- message: u,
513
- part: n,
514
- index: b,
515
- isLoading: X.value
516
- }), () => [Q(u) ? (L(), k(d, {
517
- key: 0,
518
- class: "wysiwyg",
519
- markdown: n.text,
520
- "is-dark": e.isDark,
521
- loading: Z(b) && e.status === "streaming"
522
- }, null, 8, [
523
- "markdown",
524
- "is-dark",
525
- "loading"
526
- ])) : (L(), j(E, { key: 1 }, [xe(z(n.text), 1)], 64))]), At(u.id) && !J(u.id)?.comment && s === Nt(u) ? (L(), j("span", {
527
- key: 0,
528
- class: I(["pk-chatbot-message__reaction", jt(u.id)]),
529
- title: Mt(u.id)
530
- }, [kt(u.id) ? (L(), j("span", nt, z(kt(u.id)), 1)) : (L(), k(r, {
531
- key: 1,
532
- name: Ot(u.id) === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-up-fill"
533
- }, null, 8, ["name"]))], 10, tt)) : A("", !0)])]),
534
- _: 2
535
- }, 1024)) : B(g)(n) ? (L(), k(D, {
536
- key: 1,
537
- appear: "",
538
- name: "pk-chatbot-part"
539
- }, {
540
- default: H(() => [B(a)(n.filename, n.mediaType) ? (L(), j("div", rt, [N(pe, {
541
- "media-type": n.mediaType,
542
- url: n.url,
543
- filename: n.filename,
544
- size: B(v)(n)?.bytesCount
545
- }, null, 8, [
546
- "media-type",
547
- "url",
548
- "filename",
549
- "size"
550
- ]), N(y, {
551
- url: n.url,
552
- transcript: B(h)(n),
553
- pending: e.status === "submitted" && Z(b)
554
- }, null, 8, [
555
- "url",
556
- "transcript",
557
- "pending"
558
- ])])) : (L(), k(pe, {
559
- key: 1,
560
- "media-type": n.mediaType,
561
- url: n.url,
562
- filename: n.filename,
563
- size: B(v)(n)?.bytesCount
564
- }, null, 8, [
565
- "media-type",
566
- "url",
567
- "filename",
568
- "size"
569
- ]))]),
570
- _: 2
571
- }, 1024)) : B(C)(n) && !B(x)(n) ? (L(), k(D, {
572
- key: 2,
573
- appear: "",
574
- name: "pk-chatbot-part"
575
- }, {
576
- default: H(() => [(L(), k(We, {
577
- key: `approval-${s}`,
578
- part: n,
579
- actionable: e.interactive === !0 && (B(te)(n) || Z(b)),
580
- "call-verdict": e.confirmVerdictsOnCall?.get(n.toolCallId ?? ""),
581
- onRespond: (e) => ee(n, e)
582
- }, null, 8, [
583
- "part",
584
- "actionable",
585
- "call-verdict",
586
- "onRespond"
587
- ]))]),
588
- _: 2
589
- }, 1024)) : Jt(n) ? (L(), k(D, {
590
- key: 3,
591
- appear: "",
592
- name: "pk-chatbot-part"
593
- }, {
594
- default: H(() => [!B(l)[n.type] && B(Be)[B(p)(n)] ? (L(), k(ke(B(Be)[B(p)(n)]), Ce({
595
- key: `component-${s}-${B(le)(n)}`,
596
- part: n
597
- }, { ref_for: !0 }, Tt(n)), null, 16, ["part"])) : Oe(t.$slots, n.type, Ce({ ref_for: !0 }, {
598
- message: u,
599
- part: n,
600
- index: b,
601
- isLoading: X.value
602
- }), () => [e.showAllMessageParts ? (L(), j("div", it, [M("div", at, [B(w)(n) ? (L(), k(r, {
603
- key: 0,
604
- name: B(w)(n),
605
- class: "shrink-0"
606
- }, null, 8, ["name"])) : A("", !0), M("span", ot, z(B(oe)(n, {
607
- t: B(i),
608
- te: B(o)
609
- })), 1)])])) : A("", !0)], void 0, 1)]),
610
- _: 2
611
- }, 1024)) : A("", !0), N(D, { mode: "out-in" }, {
612
- default: H(() => [s === Nt(u) && e.readonlyFeedback && J(u.id)?.comment ? (L(), k(he, {
613
- key: 0,
614
- feedback: J(u.id)
615
- }, null, 8, ["feedback"])) : A("", !0)]),
616
- _: 2
617
- }, 1024)], 64))), 128)),
618
- N(D, {
619
- name: "fade-in",
620
- mode: "out-in"
621
- }, {
622
- default: H(() => [X.value && Z(b) && !Gt(u) && Q(u) && (!qt(u) || Yt(u)) ? (L(), j("div", {
623
- key: `loading-info-${u.id}`,
624
- class: "pk-chatbot-message__loading-info"
625
- }, [M("div", st, [
626
- N(r, {
627
- name: "loading-loop",
628
- class: "shrink-0"
629
- }),
630
- N(D, { mode: "out-in" }, {
631
- default: H(() => [Vt.value ? (L(), k(r, {
632
- key: Vt.value,
633
- class: "shrink-0",
634
- name: Vt.value
635
- }, null, 8, ["name"])) : A("", !0)]),
636
- _: 1
637
- }),
638
- N(D, { mode: "out-in" }, {
639
- default: H(() => [Bt.value ? (L(), j("span", {
640
- key: Bt.value,
641
- class: "text-12"
642
- }, z(Bt.value), 1)) : A("", !0)]),
643
- _: 1
644
- })
645
- ]), N(D, {
646
- name: "fade-in",
647
- mode: "out-in"
648
- }, {
649
- default: H(() => [!qt(u) && Y.value && "text" in Y.value && Y.value.text.trim() ? (L(), k(ge, {
650
- key: 0,
651
- markdown: Y.value.text,
652
- "is-dark": e.isDark,
653
- "tail-length": B(se),
654
- "inner-class": "wysiwyg",
655
- class: "border border-surface-3 rounded-md p-4 mt-8 bg-surface-1 max-h-64 text-12 w-full"
656
- }, null, 8, [
657
- "markdown",
658
- "is-dark",
659
- "tail-length"
660
- ])) : A("", !0)]),
661
- _: 2
662
- }, 1024)])) : A("", !0)]),
663
- _: 2
664
- }, 1024),
665
- N(D, { mode: "out-in" }, {
666
- default: H(() => [tn(u, b) ? (L(), j("div", ct, [
667
- N(_, {
668
- modifiers: "compact",
669
- class: "mr-auto shrink-0"
670
- }, {
671
- default: H(() => [
672
- N(D, { mode: "out-in" }, {
673
- default: H(() => [Ut(b) ? (L(), k(m, {
674
- key: 0,
675
- icon: "ri:reset-right-line",
676
- modifiers: "action-quiet-small",
677
- title: B(i)("action.regenerate"),
678
- "aria-label": B(i)("action.regenerate"),
679
- onClick: n[0] ||= U((e) => t.$emit("regenerate"), ["stop"])
680
- }, null, 8, ["title", "aria-label"])) : A("", !0)]),
681
- _: 2
682
- }, 1024),
683
- N(D, { mode: "out-in" }, {
684
- default: H(() => [Wt("show-info", b) ? (L(), k(m, {
685
- key: 0,
686
- icon: "ri:information-line",
687
- title: B(i)("action.getMoreInfo"),
688
- "aria-label": B(i)("action.getMoreInfo"),
689
- modifiers: "action-quiet-small",
690
- onClick: U((e) => t.$emit("show-info", u), ["stop"])
691
- }, null, 8, [
692
- "title",
693
- "aria-label",
694
- "onClick"
695
- ])) : A("", !0)]),
696
- _: 2
697
- }, 1024),
698
- N(D, { mode: "out-in" }, {
699
- default: H(() => [Wt("revise", b) ? (L(), k(m, {
700
- key: 0,
701
- icon: q(u.id) ? "ri:file-edit-fill" : "ri:file-edit-line",
702
- title: q(u.id) ? B(i)("action.editRevise") : B(i)("action.createRevise"),
703
- "aria-label": q(u.id) ? B(i)("action.editRevise") : B(i)("action.createRevise"),
704
- modifiers: "action-quiet-small",
705
- class: I({ "text-brand-graphic": q(u.id) }),
706
- onClick: U((e) => t.$emit("revise", u), ["stop"])
707
- }, null, 8, [
708
- "icon",
709
- "title",
710
- "aria-label",
711
- "class",
712
- "onClick"
713
- ])) : A("", !0)]),
714
- _: 2
715
- }, 1024),
716
- N(D, { mode: "out-in" }, {
717
- default: H(() => [Et("upvote", b) ? (L(), k(m, {
718
- key: 0,
719
- icon: J(u.id)?.vote === "upvote" ? "ri:thumb-up-fill" : "ri:thumb-up-line",
720
- title: B(i)("action.upvote"),
721
- "aria-label": B(i)("action.upvote"),
722
- modifiers: "action-quiet-small",
723
- onClick: U((e) => t.$emit("upvote", u), ["stop"])
724
- }, null, 8, [
725
- "icon",
726
- "title",
727
- "aria-label",
728
- "onClick"
729
- ])) : A("", !0)]),
730
- _: 2
731
- }, 1024),
732
- N(D, { mode: "out-in" }, {
733
- default: H(() => [Et("downvote", b) ? (L(), k(m, {
734
- key: 0,
735
- icon: J(u.id)?.vote === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-down-line",
736
- title: B(i)("action.downvote"),
737
- "aria-label": B(i)("action.downvote"),
738
- modifiers: "action-quiet-small",
739
- onClick: U((e) => t.$emit("downvote", u), ["stop"])
740
- }, null, 8, [
741
- "icon",
742
- "title",
743
- "aria-label",
744
- "onClick"
745
- ])) : A("", !0)]),
746
- _: 2
747
- }, 1024),
748
- N(D, { mode: "out-in" }, {
749
- default: H(() => [Et("feedback", b) ? (L(), k(m, {
750
- key: 0,
751
- icon: J(u.id)?.comment ? "ri:feedback-fill" : "ri:feedback-line",
752
- title: B(i)("action.feedback"),
753
- "aria-label": B(i)("action.feedback"),
754
- modifiers: "action-quiet-small",
755
- onClick: U((e) => t.$emit("feedback", u), ["stop"])
756
- }, null, 8, [
757
- "icon",
758
- "title",
759
- "aria-label",
760
- "onClick"
761
- ])) : A("", !0)]),
762
- _: 2
763
- }, 1024)
764
- ]),
765
- _: 2
766
- }, 1024),
767
- !e.showMessageDateTime && u.metadata?.createdAt && u.metadata?.completedAt ? (L(), j("div", lt, [M("time", {
768
- datetime: new Date(u.metadata.createdAt).toISOString(),
769
- title: B(s)(new Date(u.metadata.createdAt), "date-time"),
770
- class: "flex items-center gap-4 min-w-0"
771
- }, [N(r, {
772
- name: "ri:time-line",
773
- class: "shrink-0"
774
- }), M("span", dt, z(nn(u.metadata.createdAt)), 1)], 8, ut), rn(u) ? (L(), j("span", ft, [N(r, {
775
- name: "ri:hourglass-line",
776
- class: "shrink-0"
777
- }), M("span", pt, z(rn(u)), 1)])) : A("", !0)])) : A("", !0),
778
- e.showMessageNumber ? (L(), j("span", {
779
- key: 1,
780
- title: B(i)("label.messageNumber", { n: en.value[b] }),
781
- class: "text-12 text-word-3 tabular-nums"
782
- }, " #" + z(en.value[b]), 9, mt)) : A("", !0),
783
- e.showMessageTokensCount && u.metadata?.totalTokens ? (L(), j("span", ht, [N(r, {
784
- name: "ri:ai-generate-2-line",
785
- class: "shrink-0"
786
- }), M("span", gt, z(B(c)(u.metadata.totalTokens, "integer")) + " " + z(B(i)("label.tokens")), 1)])) : A("", !0),
787
- e.showMessageDateTime && u.metadata?.createdAt ? (L(), j("time", {
788
- key: 3,
789
- datetime: new Date(u.metadata?.createdAt).toISOString(),
790
- class: "flex items-center gap-4 text-12 text-word-3"
791
- }, [N(r, {
792
- name: "ri:time-line",
793
- class: "shrink-0"
794
- }), M("span", vt, z(B(s)(new Date(u.metadata?.createdAt), "date-time")), 1)], 8, _t)) : A("", !0),
795
- e.showMessageDateTime && u?.metadata?.completedAt && u?.metadata?.createdAt ? (L(), j("div", yt, [N(r, {
796
- name: "ri:hourglass-line",
797
- class: "shrink-0"
798
- }), N(fe, {
799
- class: "truncate",
800
- date: u.metadata?.createdAt,
801
- "end-date": u.metadata?.completedAt
802
- }, null, 8, ["date", "end-date"])])) : A("", !0)
803
- ])) : A("", !0)]),
804
- _: 2
805
- }, 1024),
806
- N(D, { mode: "out-in" }, {
807
- default: H(() => [u.id === e.feedbackMessageId ? (L(), k(me, {
808
- key: 0,
809
- ref_for: !0,
810
- ref_key: "feedbackMessageEl",
811
- ref: an,
812
- loading: e.feedbackLoading,
813
- submitted: e.feedbackSubmitted,
814
- error: e.feedbackError,
815
- onSubmit: n[1] ||= (e) => t.$emit("feedback-submit", e),
816
- onClose: n[2] ||= (e) => t.$emit("feedback-close")
817
- }, null, 8, [
818
- "loading",
819
- "submitted",
820
- "error"
821
- ])) : A("", !0)]),
822
- _: 2
823
- }, 1024)
824
- ], 6)) : A("", !0)
825
- ], 64))), 128)),
826
- N(D, {
827
- appear: "",
828
- name: "pk-chatbot-part"
829
- }, {
830
- default: H(() => [Rt.value ? (L(), j("div", {
831
- key: 0,
832
- class: "pk-chatbot-message pk-chatbot-message--assistant pk-chatbot-message--loading",
833
- style: we({ minHeight: zt.value ? `${K.value}px` : void 0 })
834
- }, [M("div", bt, [M("div", xt, [N(r, {
835
- name: "loading-loop",
836
- class: "shrink-0"
837
- }), M("span", St, z(B(i)("label.answeringOnTheCall")), 1)])])], 4)) : A("", !0)]),
838
- _: 1
839
- }),
840
- N(D, {
841
- appear: "",
842
- name: "pk-chatbot-part"
843
- }, {
844
- default: H(() => [Lt.value ? (L(), k(de, {
845
- key: 0,
846
- error: e.error,
847
- onRetry: n[3] ||= (e) => t.$emit("auto-retry"),
848
- onReset: n[4] ||= (e) => t.$emit("reset-chat")
849
- }, null, 8, ["error"])) : A("", !0)]),
850
- _: 1
851
- }),
852
- Pt.value?.role === "user" && !zt.value || Lt.value ? (L(), j("div", {
853
- key: 0,
854
- class: "pk-chatbot-messages__spacer",
855
- style: we({ minHeight: `${K.value}px` })
856
- }, null, 4)) : A("", !0)
857
- ], 512),
858
- N(D, { name: "pk-chatbot-messages-fab" }, {
859
- default: H(() => [e.showScrollToBottom && (B(Pe) || !B(Fe)) ? (L(), j("button", {
860
- key: 0,
861
- type: "button",
862
- class: "pk-chatbot-messages__scroll-to-bottom",
863
- title: B(i)("action.scrollToBottom"),
864
- "aria-label": B(i)("action.scrollToBottom"),
865
- onClick: Ie
866
- }, [N(r, { name: "ri:arrow-down-line" })], 8, Ct)) : A("", !0)]),
867
- _: 1
868
- })
869
- ], 46, Je);
870
- };
871
- }
872
- });
873
- //#endregion
874
- export { J as t };
875
-
876
- //# sourceMappingURL=PkChatbotMessages-5wPl7-j-.js.map