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