@8wave/ai-elements 0.114.0-beta.14 → 0.114.0-beta.19
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-D3ODaN3E.js → Agent-DK76k05_.js} +2 -2
- package/dist/_chunks/{Agent-D3ODaN3E.js.map → Agent-DK76k05_.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-CYOm47PX.js → PkStreamingMarkdown-DstWSlvS.js} +228 -219
- package/dist/_chunks/{PkStreamingMarkdown-CYOm47PX.js.map → PkStreamingMarkdown-DstWSlvS.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-BY7nXImb.js → PkToolRequestGeolocation-OF1PWhMw.js} +2 -2
- package/{dist-vue/_chunks/PkToolRequestGeolocation-9vfYNaQo.js.map → dist/_chunks/PkToolRequestGeolocation-OF1PWhMw.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-DFOTALFt.js → PkToolRequestOAuthConnection-ChGMAKV7.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-DFOTALFt.js.map → PkToolRequestOAuthConnection-ChGMAKV7.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-DzHRWoru.js → PkToolShowArtifact-DY9H0dxc.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DzHRWoru.js.map → PkToolShowArtifact-DY9H0dxc.js.map} +1 -1
- package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js +72 -0
- package/dist/_chunks/PkToolShowComparison-8d6fAhRp.js.map +1 -0
- package/dist/_chunks/{PkToolShowContactForm-1J6_1AA2.js → PkToolShowContactForm-Cz44l-LN.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-1J6_1AA2.js.map → PkToolShowContactForm-Cz44l-LN.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-DmQYj3v1.js → PkToolShowForm-BMHhgLGo.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-DmQYj3v1.js.map → PkToolShowForm-BMHhgLGo.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-BO8V5rlS.js → PkToolShowSources-C2xLEg1m.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-BO8V5rlS.js.map → PkToolShowSources-C2xLEg1m.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-CTWVG1Zk.js → PkToolShowSuggestedReply-Dl4x_nEJ.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-CTWVG1Zk.js.map → PkToolShowSuggestedReply-Dl4x_nEJ.js.map} +1 -1
- package/dist/_chunks/{markdown-JpLFzufn.js → markdown-BrvkrEUr.js} +12 -12
- package/dist/_chunks/{markdown-JpLFzufn.js.map → markdown-BrvkrEUr.js.map} +1 -1
- package/dist/ai-elements.es.js +1824 -1983
- 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-BNlmK-uJ.js → Agent-tbKw8Mdt.js} +2 -2
- package/dist-vue/_chunks/{Agent-BNlmK-uJ.js.map → Agent-tbKw8Mdt.js.map} +1 -1
- package/dist-vue/_chunks/{Document-2X01-F4Z.js → Document-p2Y_4gk8.js} +9 -9
- package/dist-vue/_chunks/{Document-2X01-F4Z.js.map → Document-p2Y_4gk8.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-BdvDl_Gw.js → PkChatbot-D5kerrVY.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-BdvDl_Gw.js.map → PkChatbot-D5kerrVY.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-DycCrfwz.js → PkChatbotEmptyState-_GJMmvPc.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-DycCrfwz.js.map → PkChatbotEmptyState-_GJMmvPc.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-BCuqLdkT.js → PkChatbotInput-BHIYDooq.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-BCuqLdkT.js.map → PkChatbotInput-BHIYDooq.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotMessages-DcFGzK2p.js +778 -0
- package/dist-vue/_chunks/PkChatbotMessages-DcFGzK2p.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-CI98RiNv.js → PkChatbotStepPayload-C36nXLW7.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-CI98RiNv.js.map → PkChatbotStepPayload-C36nXLW7.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B8zXJOdI.js → PkChatbotStepToolDetail-CBX-AQXv.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-B8zXJOdI.js.map → PkChatbotStepToolDetail-CBX-AQXv.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-CL27pMFS.js → PkChatbotSteps-5OCiyojA.js} +7 -6
- package/dist-vue/_chunks/PkChatbotSteps-5OCiyojA.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-CS-OSJfX.js → PkChatbotViewChat-TYnSR4Qi.js} +7 -7
- package/dist-vue/_chunks/{PkChatbotViewChat-CS-OSJfX.js.map → PkChatbotViewChat-TYnSR4Qi.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js → PkChatbotViewConversations-CHpN4vhm.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-BCdolW0R.js.map → PkChatbotViewConversations-CHpN4vhm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js → PkChatbotViewFiles-BBBO5hyd.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-Cudao8ew.js.map → PkChatbotViewFiles-BBBO5hyd.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js → PkChatbotViewProfile-CosaHA-g.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-DDsKOkcC.js.map → PkChatbotViewProfile-CosaHA-g.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-B2iju0WK.js → PkStreamingMarkdown-BQPMUS_f.js} +214 -205
- package/dist-vue/_chunks/{PkStreamingMarkdown-B2iju0WK.js.map → PkStreamingMarkdown-BQPMUS_f.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-9vfYNaQo.js → PkToolRequestGeolocation-BOVbaCzQ.js} +2 -2
- package/{dist/_chunks/PkToolRequestGeolocation-BY7nXImb.js.map → dist-vue/_chunks/PkToolRequestGeolocation-BOVbaCzQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BorR5NmZ.js → PkToolRequestOAuthConnection-DMvCGPuX.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-BorR5NmZ.js.map → PkToolRequestOAuthConnection-DMvCGPuX.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-C0J71YF6.js → PkToolShowArtifact-ClKehEEG.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-C0J71YF6.js.map → PkToolShowArtifact-ClKehEEG.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js +72 -0
- package/dist-vue/_chunks/PkToolShowComparison-DQs3E6-k.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowContactForm-De3Od9mC.js → PkToolShowContactForm-stJ8WT_G.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-De3Od9mC.js.map → PkToolShowContactForm-stJ8WT_G.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-DmY_hhAS.js → PkToolShowDiagram-Bokc-KWa.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-DmY_hhAS.js.map → PkToolShowDiagram-Bokc-KWa.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowEmail-D_Z15wCS.js → PkToolShowEmail-CgeqOII0.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-D_Z15wCS.js.map → PkToolShowEmail-CgeqOII0.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DUGysIxj.js → PkToolShowForm-DJterU51.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-DUGysIxj.js.map → PkToolShowForm-DJterU51.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowMessage-e5_EI5mV.js → PkToolShowMessage-Dc8ZWZb_.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-e5_EI5mV.js.map → PkToolShowMessage-Dc8ZWZb_.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-B3X7Svyc.js → PkToolShowProductList-BpPA_HW6.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-B3X7Svyc.js.map → PkToolShowProductList-BpPA_HW6.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-BUjBSGc5.js → PkToolShowSources-jdu9js3i.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowSources-BUjBSGc5.js.map → PkToolShowSources-jdu9js3i.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js → PkToolShowSuggestedReply-qAWdCUhr.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-DA4NEjHB.js.map → PkToolShowSuggestedReply-qAWdCUhr.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-DEih8h5k.js → PkToolShowWebPages-BGpGLkoz.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-DEih8h5k.js.map → PkToolShowWebPages-BGpGLkoz.js.map} +1 -1
- package/dist-vue/_chunks/{PkUrl-3NH9t-WA.js → PkUrl-D5eqGgXF.js} +2 -2
- package/dist-vue/_chunks/{PkUrl-3NH9t-WA.js.map → PkUrl-D5eqGgXF.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-CaVLm5W9.js → createChatbotApiClient-BlWs282E.js} +137 -168
- package/dist-vue/_chunks/createChatbotApiClient-BlWs282E.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js → useChatbotStore-CMo47fnS.js} +3 -3
- package/dist-vue/_chunks/{useChatbotStore-BwrBZJCq.js.map → useChatbotStore-CMo47fnS.js.map} +1 -1
- package/dist-vue/_chunks/{utils-BL4Ppr2R.js → utils--8iNpBr_.js} +2 -2
- package/dist-vue/_chunks/{utils-BL4Ppr2R.js.map → utils--8iNpBr_.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +43 -9
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +3332 -3236
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +18 -0
- package/dist-vue/packages/ability/src/index.d.ts +10 -14
- package/dist-vue/packages/components/src/chat/PkChatbotMessages.d.ts +8 -4
- package/dist-vue/packages/components/src/chat/PkChatbotSteps.d.ts +1 -0
- package/dist-vue/packages/components/src/chat/PkTurnEvaluation.d.ts +8 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +60 -0
- package/dist-vue/packages/models/src/schema/Chat.d.ts +42 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js +0 -60
- package/dist/_chunks/PkToolShowComparison-BJ7QBXtf.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js +0 -776
- package/dist-vue/_chunks/PkChatbotMessages-PjKRDNYJ.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-CL27pMFS.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js +0 -61
- package/dist-vue/_chunks/PkToolShowComparison-BLn4pkno.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-CaVLm5W9.js.map +0 -1
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { O as e } from "./Agent-tbKw8Mdt.js";
|
|
2
|
+
import { t } from "./PkStreamingMarkdown-BQPMUS_f.js";
|
|
3
|
+
import "./src-DT8FLE4_.js";
|
|
4
|
+
import { a as n, c as r, o as i, r as a, s as o, t as s } from "./message-RohfrdWS.js";
|
|
5
|
+
import { t as c } from "./PkChatbotError-CuX9C_b9.js";
|
|
6
|
+
import { t as l } from "./PkRelativeTime--1cIphlA.js";
|
|
7
|
+
import { S as u, _ as d, b as f, c as p, d as m, f as h, i as g, n as ee, p as te, t as _, u as v, x as ne, y } from "./utils--8iNpBr_.js";
|
|
8
|
+
import { t as re } from "./PkChatbotFilePreview-CwiVQDF2.js";
|
|
9
|
+
import { t as ie } from "./PkChatbotFeedbackForm-4XWLHOkB.js";
|
|
10
|
+
import { t as ae } from "./PkChatbotMessageFeedback-BYmrVaCE.js";
|
|
11
|
+
import { n as b, t as x } from "./PkChatbotSteps-5OCiyojA.js";
|
|
12
|
+
import { t as S } from "./PkChatbotOutlineRail-np4g6vsz.js";
|
|
13
|
+
import { VvButton as oe, VvButtonGroup as se, VvIcon as ce } from "@volverjs/ui-vue/components";
|
|
14
|
+
import { Fragment as C, Transition as w, computed as T, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createTextVNode as le, createVNode as A, defineAsyncComponent as j, defineComponent as M, mergeProps as ue, nextTick as N, normalizeClass as P, normalizeStyle as de, onBeforeUnmount as F, onMounted as fe, openBlock as I, ref as L, renderList as pe, renderSlot as me, resolveDynamicComponent as he, toDisplayString as R, unref as z, useSlots as ge, useTemplateRef as _e, watch as B, withCtx as V, withModifiers as H } from "vue";
|
|
15
|
+
import { useI18n as ve } from "vue-i18n";
|
|
16
|
+
//#region ../../packages/utils/src/text.ts
|
|
17
|
+
var U = (e) => e.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), ye = (e) => e ? e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[-_]+/g, " ") : "", be = (e) => e ? U(e).replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[^a-zA-Z0-9]+/g, "-").toLowerCase() : "", xe = (e) => e ? U(e).replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").toLowerCase() : "", Se = (e) => e ? e.charAt(0).toUpperCase() + e.slice(1) : "", Ce = {
|
|
18
|
+
requestOAuthConnection: j(() => import("./PkToolRequestOAuthConnection-DMvCGPuX.js")),
|
|
19
|
+
showArtifact: j(() => import("./PkToolShowArtifact-ClKehEEG.js").then((e) => e.n)),
|
|
20
|
+
showCalendarEvent: j(() => import("./PkToolShowCalendarEvent-BsBdsbV0.js").then((e) => e.n)),
|
|
21
|
+
showComparison: j(() => import("./PkToolShowComparison-DQs3E6-k.js").then((e) => e.n)),
|
|
22
|
+
showContactForm: j(() => import("./PkToolShowContactForm-stJ8WT_G.js").then((e) => e.n)),
|
|
23
|
+
showDiagram: j(() => import("./PkToolShowDiagram-Bokc-KWa.js")),
|
|
24
|
+
showEmail: j(() => import("./PkToolShowEmail-CgeqOII0.js").then((e) => e.n)),
|
|
25
|
+
showImageGallery: j(() => import("./PkToolShowImageGallery-DudQzBx4.js").then((e) => e.n)),
|
|
26
|
+
showLocation: j(() => import("./PkToolShowLocation-Bv6sLN5P.js").then((e) => e.n)),
|
|
27
|
+
showMessage: j(() => import("./PkToolShowMessage-Dc8ZWZb_.js").then((e) => e.n)),
|
|
28
|
+
showForm: j(() => import("./PkToolShowForm-DJterU51.js").then((e) => e.n)),
|
|
29
|
+
showMultipleChoice: j(() => import("./PkToolShowForm-DJterU51.js").then((e) => e.n)),
|
|
30
|
+
showProductList: j(() => import("./PkToolShowProductList-BpPA_HW6.js").then((e) => e.n)),
|
|
31
|
+
showQrCode: j(() => import("./PkToolShowQrCode-DEAvfLFu.js").then((e) => e.n)),
|
|
32
|
+
showSources: j(() => import("./PkToolShowSources-jdu9js3i.js").then((e) => e.n)),
|
|
33
|
+
showSuggestedReply: j(() => import("./PkToolShowSuggestedReply-qAWdCUhr.js").then((e) => e.n)),
|
|
34
|
+
showVideo: j(() => import("./PkToolShowVideo-BZOTu2Qe.js")),
|
|
35
|
+
showWeather: j(() => import("./PkToolShowWeather-Bzqalzh8.js")),
|
|
36
|
+
showWebPages: j(() => import("./PkToolShowWebPages-BGpGLkoz.js").then((e) => e.n))
|
|
37
|
+
}, W = {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "text-12 text-word-3 m-0 mb-xs"
|
|
40
|
+
}, G = /* @__PURE__ */ M({
|
|
41
|
+
__name: "PkToolApprovalPreviewMessage",
|
|
42
|
+
props: { input: {} },
|
|
43
|
+
setup(e) {
|
|
44
|
+
let t = e, n = T(() => {
|
|
45
|
+
let e = t.input;
|
|
46
|
+
return typeof e?.message == "string" ? e.message : "";
|
|
47
|
+
});
|
|
48
|
+
return (e, t) => n.value ? (I(), O("p", W, R(n.value), 1)) : D("", !0);
|
|
49
|
+
}
|
|
50
|
+
}), we = { [_]: G }, Te = {
|
|
51
|
+
key: 0,
|
|
52
|
+
class: "text-12 text-word-3 m-0 mb-xs"
|
|
53
|
+
}, Ee = /* @__PURE__ */ M({
|
|
54
|
+
__name: "PkToolApprovalCard",
|
|
55
|
+
props: {
|
|
56
|
+
part: {},
|
|
57
|
+
actionable: { type: Boolean },
|
|
58
|
+
callVerdict: { type: Boolean }
|
|
59
|
+
},
|
|
60
|
+
emits: ["respond"],
|
|
61
|
+
setup(t, { emit: n }) {
|
|
62
|
+
let r = t, i = n, { t: o } = ve({ useScope: "global" }), s = T(() => r.part), c = T(() => a(r.part)), l = T(() => c.value === _), u = T(() => l.value ? (s.value.state === "input-available" || e(s.value.output)) && r.callVerdict === void 0 : s.value.state === "approval-requested"), d = T(() => u.value && r.actionable === !0), f = T(() => u.value && r.actionable !== !0), p = T(() => l.value ? s.value.output === "confirmed" || r.callVerdict === !0 : s.value.approval?.approved === !0), m = T(() => l.value ? s.value.output === "cancelled" || r.callVerdict === !1 : s.value.approval?.approved === !1 || s.value.state === "output-denied"), h = T(() => we[c.value]), g = T(() => {
|
|
63
|
+
if (f.value) return {
|
|
64
|
+
icon: "ri:time-line",
|
|
65
|
+
message: o("toolApproval.expired")
|
|
66
|
+
};
|
|
67
|
+
if (p.value) return {
|
|
68
|
+
icon: "ri:check-line",
|
|
69
|
+
message: o(l.value ? "toolApproval.confirmed" : "toolApproval.approved")
|
|
70
|
+
};
|
|
71
|
+
if (m.value) return {
|
|
72
|
+
icon: "ri:close-line",
|
|
73
|
+
message: o(l.value ? "toolApproval.cancelled" : "toolApproval.denied")
|
|
74
|
+
};
|
|
75
|
+
}), ee = T(() => !!g.value && !h.value);
|
|
76
|
+
return (e, n) => {
|
|
77
|
+
let r = oe, a = se, c = ce;
|
|
78
|
+
return I(), O("div", { class: P(["w-full overflow-hidden transition-all duration-300", { "bg-surface p-sm rounded-xl border border-surface-3": !ee.value }]) }, [
|
|
79
|
+
A(w, null, {
|
|
80
|
+
default: V(() => [!l.value && u.value ? (I(), O("p", Te, R(z(o)("toolApproval.prompt")), 1)) : D("", !0)]),
|
|
81
|
+
_: 1
|
|
82
|
+
}),
|
|
83
|
+
h.value ? (I(), E(he(h.value), {
|
|
84
|
+
key: 0,
|
|
85
|
+
part: t.part,
|
|
86
|
+
input: s.value.input
|
|
87
|
+
}, null, 8, ["part", "input"])) : D("", !0),
|
|
88
|
+
A(w, { mode: "out-in" }, {
|
|
89
|
+
default: V(() => [g.value ? (I(), O("p", {
|
|
90
|
+
key: 1,
|
|
91
|
+
class: P(["flex items-center gap-4 text-12 text-word-3 m-0", { "mt-xs": h.value }])
|
|
92
|
+
}, [A(c, {
|
|
93
|
+
name: g.value.icon,
|
|
94
|
+
class: "shrink-0"
|
|
95
|
+
}, null, 8, ["name"]), le(" " + R(g.value.message), 1)], 2)) : (I(), E(a, { key: 0 }, {
|
|
96
|
+
default: V(() => [A(r, {
|
|
97
|
+
modifiers: "primary-small",
|
|
98
|
+
disabled: !d.value,
|
|
99
|
+
icon: "ri:check-line",
|
|
100
|
+
label: z(o)("action.proceed"),
|
|
101
|
+
onClick: n[0] ||= H((e) => i("respond", !0), ["stop"])
|
|
102
|
+
}, null, 8, ["disabled", "label"]), A(r, {
|
|
103
|
+
modifiers: "action-quiet-small",
|
|
104
|
+
disabled: !d.value,
|
|
105
|
+
icon: "ri:close-line",
|
|
106
|
+
label: z(o)("action.cancel"),
|
|
107
|
+
onClick: n[1] ||= H((e) => i("respond", !1), ["stop"])
|
|
108
|
+
}, null, 8, ["disabled", "label"])]),
|
|
109
|
+
_: 1
|
|
110
|
+
}))]),
|
|
111
|
+
_: 1
|
|
112
|
+
})
|
|
113
|
+
], 2);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}), De = 30, K = 500;
|
|
117
|
+
function Oe(e) {
|
|
118
|
+
let { scrollEl: t, status: n, messagesLength: r, lastMessageRole: i, contentEl: a, beforeNewMessageScroll: o, onScrollUp: s, onScrollDown: c } = e, l = L(!1), u = L(!0), d = !1, f = null, p = null, m = null, h = null, g = 0, ee = (e = "smooth") => {
|
|
119
|
+
if (!t.value || l.value) {
|
|
120
|
+
d = !1;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
d = !0, t.value.scrollTo({
|
|
124
|
+
top: t.value.scrollHeight,
|
|
125
|
+
behavior: e
|
|
126
|
+
}), setTimeout(() => {
|
|
127
|
+
d = !1;
|
|
128
|
+
}, e === "instant" ? 0 : K);
|
|
129
|
+
}, te = (e) => {
|
|
130
|
+
e.deltaY < 0 && (l.value = !0);
|
|
131
|
+
}, _ = 0, v = (e) => {
|
|
132
|
+
_ = e.touches[0]?.clientY ?? 0;
|
|
133
|
+
}, ne = (e) => {
|
|
134
|
+
let t = e.touches[0]?.clientY ?? 0;
|
|
135
|
+
t > _ && (l.value = !0), _ = t;
|
|
136
|
+
}, y = () => {
|
|
137
|
+
if (!t.value) return;
|
|
138
|
+
let { scrollTop: e, scrollHeight: n, clientHeight: r } = t.value;
|
|
139
|
+
if (u.value = n - r - e < De, d) {
|
|
140
|
+
g = e;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
e < g && s?.(), e > g && (u.value && (l.value = !1), c?.()), g = e;
|
|
144
|
+
}, re = () => {
|
|
145
|
+
if (d || l.value || !t.value) return;
|
|
146
|
+
let e = t.value, n = e.scrollHeight - e.clientHeight;
|
|
147
|
+
n <= e.scrollTop || (u.value = !0, d = !0, e.scrollTop = n, requestAnimationFrame(() => {
|
|
148
|
+
d = !1;
|
|
149
|
+
}));
|
|
150
|
+
}, ie = () => {
|
|
151
|
+
!f && t.value && (f = new MutationObserver(re), f.observe(t.value, {
|
|
152
|
+
childList: !0,
|
|
153
|
+
subtree: !0,
|
|
154
|
+
characterData: !0
|
|
155
|
+
}));
|
|
156
|
+
}, ae = () => {
|
|
157
|
+
f?.disconnect(), f = null;
|
|
158
|
+
};
|
|
159
|
+
B(n, (e, t) => {
|
|
160
|
+
if (e === "streaming" || e === "submitted") {
|
|
161
|
+
ie();
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
(e !== "ready" || t !== "streaming") && ae();
|
|
165
|
+
}), B(r, async () => {
|
|
166
|
+
if (r() && i() !== "assistant") {
|
|
167
|
+
S(), l.value = !1, d = !0;
|
|
168
|
+
try {
|
|
169
|
+
await N(), await o?.(), await N();
|
|
170
|
+
} finally {
|
|
171
|
+
ee();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
let b = null, x = () => {
|
|
176
|
+
t.value && (t.value.scrollHeight <= t.value.clientHeight || (t.value.scrollTop = t.value.scrollHeight, b && clearTimeout(b), b = setTimeout(S, 300)));
|
|
177
|
+
}, S = () => {
|
|
178
|
+
p?.disconnect(), p = null, m?.disconnect(), m = null, b &&= (clearTimeout(b), null);
|
|
179
|
+
};
|
|
180
|
+
return fe(() => {
|
|
181
|
+
if (!t.value) return;
|
|
182
|
+
t.value.addEventListener("wheel", te, { passive: !0 }), t.value.addEventListener("touchstart", v, { passive: !0 }), t.value.addEventListener("touchmove", ne, { passive: !0 });
|
|
183
|
+
let e = n() === "submitted" || n() === "streaming";
|
|
184
|
+
e ? ie() : (p = new ResizeObserver(x), p.observe(t.value), m = new MutationObserver(x), m.observe(t.value, {
|
|
185
|
+
childList: !0,
|
|
186
|
+
subtree: !0
|
|
187
|
+
}));
|
|
188
|
+
let r = a?.() ?? t.value.firstElementChild;
|
|
189
|
+
r && (h = new ResizeObserver(re), h.observe(r)), e || x();
|
|
190
|
+
}), F(() => {
|
|
191
|
+
t.value?.removeEventListener("wheel", te), t.value?.removeEventListener("touchstart", v), t.value?.removeEventListener("touchmove", ne), h?.disconnect(), h = null, ae(), S();
|
|
192
|
+
}), {
|
|
193
|
+
handleScroll: y,
|
|
194
|
+
scrollToBottom: ee,
|
|
195
|
+
userScrolledUp: l,
|
|
196
|
+
isAtBottom: u
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region ../../packages/components/src/chat/PkChatbotMessages.vue?vue&type=script&setup=true&lang.ts
|
|
201
|
+
var ke = ["aria-busy"], Ae = {
|
|
202
|
+
key: 0,
|
|
203
|
+
class: "pk-chatbot-messages__outline"
|
|
204
|
+
}, je = {
|
|
205
|
+
key: 0,
|
|
206
|
+
class: "pk-chatbot-divider"
|
|
207
|
+
}, Me = { class: "pk-chatbot-divider__label" }, Ne = { class: "pk-chatbot-message__text" }, Pe = ["title"], Fe = {
|
|
208
|
+
key: 0,
|
|
209
|
+
class: "pk-chatbot-message__reaction-emoji"
|
|
210
|
+
}, Ie = {
|
|
211
|
+
key: 0,
|
|
212
|
+
class: "pk-chatbot-message__loading-info"
|
|
213
|
+
}, Le = { class: "flex gap-8 items-center" }, Re = { class: "font-mono rounded text-12" }, ze = { class: "flex gap-8 items-center" }, Be = {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "pk-chatbot-message__footer"
|
|
216
|
+
}, Ve = {
|
|
217
|
+
key: 0,
|
|
218
|
+
class: "pk-chatbot-message__hover-meta"
|
|
219
|
+
}, He = ["datetime", "title"], Ue = { class: "truncate" }, We = {
|
|
220
|
+
key: 0,
|
|
221
|
+
class: "flex items-center gap-4 min-w-0"
|
|
222
|
+
}, Ge = { class: "truncate" }, Ke = {
|
|
223
|
+
key: 1,
|
|
224
|
+
class: "flex items-center gap-4 text-12 text-word-3"
|
|
225
|
+
}, qe = { class: "truncate" }, Je = ["datetime"], Ye = { class: "truncate" }, Xe = {
|
|
226
|
+
key: 3,
|
|
227
|
+
class: "flex items-center gap-4 text-12 text-word-3"
|
|
228
|
+
}, Ze = { class: "pk-chatbot-message__loading-info" }, Qe = { class: "flex gap-8 items-center" }, $e = { class: "text-12" }, et = ["title", "aria-label"], tt = /* @__PURE__ */ M({
|
|
229
|
+
__name: "PkChatbotMessages",
|
|
230
|
+
props: {
|
|
231
|
+
status: {},
|
|
232
|
+
messages: {},
|
|
233
|
+
error: {},
|
|
234
|
+
actions: {},
|
|
235
|
+
mainColor: {},
|
|
236
|
+
textColor: {},
|
|
237
|
+
revisedAnswers: {},
|
|
238
|
+
messageFeedbacks: {},
|
|
239
|
+
readonlyFeedback: { type: Boolean },
|
|
240
|
+
disableHeightAdjustment: { type: Boolean },
|
|
241
|
+
showMessageDateTime: { type: Boolean },
|
|
242
|
+
showMessageTokensCount: { type: Boolean },
|
|
243
|
+
showAllMessageParts: { type: Boolean },
|
|
244
|
+
interactive: { type: Boolean },
|
|
245
|
+
showExtendedSteps: { type: Boolean },
|
|
246
|
+
awaitingSpokenAnswer: { type: Boolean },
|
|
247
|
+
confirmVerdictsOnCall: {},
|
|
248
|
+
isDark: { type: Boolean },
|
|
249
|
+
showScrollToBottom: { type: Boolean },
|
|
250
|
+
feedbackMessageId: {},
|
|
251
|
+
feedbackLoading: { type: Boolean },
|
|
252
|
+
feedbackSubmitted: { type: Boolean },
|
|
253
|
+
feedbackError: {}
|
|
254
|
+
},
|
|
255
|
+
emits: [
|
|
256
|
+
"show-info",
|
|
257
|
+
"regenerate",
|
|
258
|
+
"revise",
|
|
259
|
+
"upvote",
|
|
260
|
+
"downvote",
|
|
261
|
+
"feedback",
|
|
262
|
+
"feedback-submit",
|
|
263
|
+
"feedback-close",
|
|
264
|
+
"scroll-up",
|
|
265
|
+
"scroll-down",
|
|
266
|
+
"auto-retry",
|
|
267
|
+
"reset-chat",
|
|
268
|
+
"approval-respond",
|
|
269
|
+
"confirm-respond"
|
|
270
|
+
],
|
|
271
|
+
setup(e, { emit: _ }) {
|
|
272
|
+
let j = e, M = _, { t: F, d: U, n: ye } = ve({ useScope: "global" }), xe = ge(), Se = (e, t) => {
|
|
273
|
+
if (f(e)) {
|
|
274
|
+
let n = e.toolCallId;
|
|
275
|
+
n && M("confirm-respond", {
|
|
276
|
+
toolCallId: n,
|
|
277
|
+
confirmed: t
|
|
278
|
+
});
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
let n = h(e);
|
|
282
|
+
n && M("approval-respond", {
|
|
283
|
+
id: n,
|
|
284
|
+
approved: t
|
|
285
|
+
});
|
|
286
|
+
}, W = _e("scrollEl"), G = _e("wrapperEl"), we = T(() => u(j.textColor, j.mainColor)), { handleScroll: Te, scrollToBottom: De, userScrolledUp: K, isAtBottom: tt } = Oe({
|
|
287
|
+
scrollEl: W,
|
|
288
|
+
status: () => j.status,
|
|
289
|
+
messagesLength: () => j.messages?.length,
|
|
290
|
+
lastMessageRole: () => j.messages?.[j.messages.length - 1]?.role,
|
|
291
|
+
contentEl: () => G.value,
|
|
292
|
+
beforeNewMessageScroll: () => lt(),
|
|
293
|
+
onScrollUp: () => M("scroll-up"),
|
|
294
|
+
onScrollDown: () => M("scroll-down")
|
|
295
|
+
}), nt = () => {
|
|
296
|
+
K.value = !1, De();
|
|
297
|
+
}, q = T(() => (j.messages ?? []).filter((e) => e.role === "user").map((e) => ({
|
|
298
|
+
id: e.id,
|
|
299
|
+
preview: e.parts.find(o)?.text.trim().slice(0, 120) || "…"
|
|
300
|
+
}))), rt = L(), it = () => W.value?.querySelectorAll(".pk-chatbot-message--user") ?? [], at = () => {
|
|
301
|
+
let e = W.value;
|
|
302
|
+
if (!e || !j.showScrollToBottom) return;
|
|
303
|
+
let t = e.getBoundingClientRect().top + e.clientHeight / 2, n = q.value[0]?.id;
|
|
304
|
+
it().forEach((e, r) => {
|
|
305
|
+
e.getBoundingClientRect().top <= t && (n = q.value[r]?.id);
|
|
306
|
+
}), rt.value = n;
|
|
307
|
+
};
|
|
308
|
+
B(q, async () => {
|
|
309
|
+
await N(), at();
|
|
310
|
+
});
|
|
311
|
+
let ot = () => {
|
|
312
|
+
Te(), at();
|
|
313
|
+
}, st = (e) => {
|
|
314
|
+
let t = W.value, n = q.value.findIndex((t) => t.id === e), r = it()[n];
|
|
315
|
+
t && r && (K.value = !0, t.scrollTo({
|
|
316
|
+
top: t.scrollTop + r.getBoundingClientRect().top - t.getBoundingClientRect().top - Number.parseFloat(getComputedStyle(t).paddingTop),
|
|
317
|
+
behavior: "smooth"
|
|
318
|
+
}));
|
|
319
|
+
}, J = L(0), ct = L(!1), lt = async () => {
|
|
320
|
+
let e = j.messages;
|
|
321
|
+
if (!e?.length || j.disableHeightAdjustment || e[e.length - 1].role !== "user" && j.status !== "submitted" && j.status !== "streaming" || (ct.value = !1, await N(), !W.value)) return;
|
|
322
|
+
let { paddingTop: t, paddingBottom: n } = getComputedStyle(W.value), r = W.value.clientHeight - Number.parseFloat(t) - Number.parseFloat(n), i = G.value && Number.parseFloat(getComputedStyle(G.value).rowGap) || 0, a = it(), o = r - (a[a.length - 1]?.clientHeight ?? 0) - i;
|
|
323
|
+
r > 0 && (J.value = Math.max(o, 0)), await N();
|
|
324
|
+
};
|
|
325
|
+
B(() => [j.messages?.length, j.messages?.[j.messages.length - 1]?.id], () => lt()), fe(() => {
|
|
326
|
+
(j.status === "submitted" || j.status === "streaming" || j.awaitingSpokenAnswer) && lt();
|
|
327
|
+
}), B(() => j.status, (e) => {
|
|
328
|
+
(e === "ready" || e === "error") && (ct.value = !0, J.value = 0);
|
|
329
|
+
});
|
|
330
|
+
let ut = (e) => j.revisedAnswers?.some((t) => t.messageId === e), Y = (e) => j.messageFeedbacks?.find((t) => t.messageId === e), dt = (e, t) => !j.readonlyFeedback && kt(e, t), ft = (e) => j.readonlyFeedback ? Y(e) : void 0, pt = (e) => ft(e)?.vote, mt = (e) => {
|
|
331
|
+
let t = ft(e);
|
|
332
|
+
if (t?.vote) return;
|
|
333
|
+
let n = t?.metadata?.reactionEmoji;
|
|
334
|
+
return typeof n == "string" && /\p{Extended_Pictographic}/u.test(n) ? n : void 0;
|
|
335
|
+
}, ht = (e) => !!(pt(e) || mt(e)), gt = (e) => {
|
|
336
|
+
if (mt(e)) return "pk-chatbot-message__reaction--neutral";
|
|
337
|
+
let t = pt(e);
|
|
338
|
+
return t === "upvote" ? "pk-chatbot-message__reaction--positive" : t === "downvote" ? "pk-chatbot-message__reaction--negative" : "pk-chatbot-message__reaction--neutral";
|
|
339
|
+
}, _t = (e) => {
|
|
340
|
+
let t = pt(e);
|
|
341
|
+
return F(t === "upvote" ? "hint.userFeedbackPositive" : t === "downvote" ? "hint.userFeedbackNegative" : "hint.userFeedbackReaction");
|
|
342
|
+
}, vt = (e) => {
|
|
343
|
+
let t = xt(e);
|
|
344
|
+
for (let e = t.length - 1; e >= 0; --e) if (o(t[e])) return e;
|
|
345
|
+
return -1;
|
|
346
|
+
}, yt = T(() => j.messages?.[j.messages.length - 1]), X = T(() => {
|
|
347
|
+
let e = yt.value;
|
|
348
|
+
return e ? e.parts[e.parts.length - 1] : null;
|
|
349
|
+
}), bt = T(() => {
|
|
350
|
+
let e = /* @__PURE__ */ new Map();
|
|
351
|
+
for (let t of j.messages ?? []) t.role === "assistant" && e.set(t.id, g(ne(t.parts)));
|
|
352
|
+
return e;
|
|
353
|
+
}), xt = (e) => bt.value.get(e.id) ?? e.parts, Z = T(() => j.status === "submitted" || j.status === "streaming"), St = T(() => j.status === "error"), Ct = T(() => j.awaitingSpokenAnswer === !0 && !Z.value), wt = T(() => Ct.value && yt.value?.role === "user" && !St.value), Tt = T(() => {
|
|
354
|
+
let e = X.value;
|
|
355
|
+
return te(F, e);
|
|
356
|
+
}), Et = T(() => {
|
|
357
|
+
let e = X.value;
|
|
358
|
+
return v(e);
|
|
359
|
+
}), Dt = (e) => j.messages?.findIndex((t) => t.id === e), Q = (e) => e === void 0 || !j.messages ? !1 : e === j.messages.length - 1, Ot = (e) => Q(e) && j.status === "ready" && !!j.actions?.includes("regenerate"), kt = (e, t) => (!Q(t) || j.status === "ready") && !!j.actions?.includes(e), At = (e) => {
|
|
360
|
+
let t = e.parts[e.parts.length - 1];
|
|
361
|
+
return o(t);
|
|
362
|
+
}, jt = (e) => e.parts.some((e) => i(e) || r(e)), Mt = (e) => !!j.showExtendedSteps && $(e) && jt(e), Nt = (e) => r(e) && !y(e) && !!(Ce[a(e)] || xe[e.type] || j.showAllMessageParts), Pt = (e) => e.parts.some((e) => o(e) && !!e.text.trim() || n(e) || d(e) && !y(e) || Nt(e)), $ = (e) => e.role === "assistant", Ft = (e) => e.role === "user", It = (e) => j.messages?.slice(0, e).reverse().find((e) => $(e)), Lt = (e) => j.messages?.slice(e + 1).find((e) => $(e)), Rt = (e) => {
|
|
363
|
+
let t = It(e)?.metadata?.createdAt, n = Lt(e)?.metadata?.createdAt;
|
|
364
|
+
if (!t || !n) return;
|
|
365
|
+
let r = new Date(t), i = new Date(n);
|
|
366
|
+
return r.toDateString() === i.toDateString() ? void 0 : i;
|
|
367
|
+
}, zt = (e, t) => t === 0 || e.role !== "assistant" ? !1 : !!(j.actions?.length || j.showMessageDateTime && e.metadata?.createdAt !== void 0 || e.metadata?.completedAt !== void 0 || j.showMessageTokensCount && e.metadata?.totalTokens !== void 0), Bt = (e) => {
|
|
368
|
+
let t = new Date(e), n = t.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
369
|
+
return U(t, n ? "time" : "date-time");
|
|
370
|
+
}, Vt = (e) => {
|
|
371
|
+
let { createdAt: t, completedAt: n } = e.metadata ?? {};
|
|
372
|
+
if (t && n) return p(ye, n - t);
|
|
373
|
+
}, Ht = _e("feedbackMessageEl");
|
|
374
|
+
return B(() => j.feedbackMessageId, async () => {
|
|
375
|
+
if (await N(), !j.feedbackMessageId) return;
|
|
376
|
+
let e = Ht.value?.[0]?.$el;
|
|
377
|
+
if (e) {
|
|
378
|
+
if (Q(Dt(j.feedbackMessageId))) {
|
|
379
|
+
De();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
e.scrollIntoView({
|
|
383
|
+
behavior: "smooth",
|
|
384
|
+
block: "center"
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}), (r, i) => {
|
|
388
|
+
let u = ce, p = oe, h = se;
|
|
389
|
+
return I(), O("div", {
|
|
390
|
+
ref_key: "scrollEl",
|
|
391
|
+
ref: W,
|
|
392
|
+
class: P(["pk-chatbot-messages", { "pk-chatbot-messages--settling": ct.value }]),
|
|
393
|
+
role: "log",
|
|
394
|
+
"aria-live": "polite",
|
|
395
|
+
"aria-relevant": "additions text",
|
|
396
|
+
"aria-busy": Z.value,
|
|
397
|
+
style: de({
|
|
398
|
+
"--chatbot-main-color": e.mainColor,
|
|
399
|
+
"--chatbot-contrast-color": we.value
|
|
400
|
+
}),
|
|
401
|
+
onScroll: ot
|
|
402
|
+
}, [
|
|
403
|
+
e.showScrollToBottom && q.value.length > 1 ? (I(), O("div", Ae, [A(S, {
|
|
404
|
+
items: q.value,
|
|
405
|
+
"active-id": rt.value,
|
|
406
|
+
onSelect: st
|
|
407
|
+
}, null, 8, ["items", "active-id"])])) : D("", !0),
|
|
408
|
+
k("div", {
|
|
409
|
+
ref_key: "wrapperEl",
|
|
410
|
+
ref: G,
|
|
411
|
+
class: "pk-chatbot-messages__wrapper"
|
|
412
|
+
}, [
|
|
413
|
+
(I(!0), O(C, null, pe(e.messages, (c, g) => (I(), O(C, { key: c.id }, [Ft(c) && Rt(g) ? (I(), O("div", je, [k("span", Me, R(z(U)(Rt(g), "short")), 1)])) : D("", !0), c.parts.length || Q(g) && Z.value && $(c) ? (I(), O("div", {
|
|
414
|
+
key: 1,
|
|
415
|
+
class: P(["pk-chatbot-message", [`pk-chatbot-message--${c.role}`, { "pk-chatbot-message--loading": Z.value && Q(g) && $(c) }]]),
|
|
416
|
+
style: de({ minHeight: Q(g) && $(c) && !St.value ? `${J.value}px` : void 0 })
|
|
417
|
+
}, [
|
|
418
|
+
A(w, {
|
|
419
|
+
appear: "",
|
|
420
|
+
name: "pk-chatbot-part"
|
|
421
|
+
}, {
|
|
422
|
+
default: V(() => [Mt(c) ? (I(), E(x, {
|
|
423
|
+
key: 0,
|
|
424
|
+
message: c,
|
|
425
|
+
"is-streaming": Z.value && Q(g),
|
|
426
|
+
"has-content": Pt(c),
|
|
427
|
+
"is-dark": e.isDark
|
|
428
|
+
}, null, 8, [
|
|
429
|
+
"message",
|
|
430
|
+
"is-streaming",
|
|
431
|
+
"has-content",
|
|
432
|
+
"is-dark"
|
|
433
|
+
])) : D("", !0)]),
|
|
434
|
+
_: 2
|
|
435
|
+
}, 1024),
|
|
436
|
+
(I(!0), O(C, null, pe(xt(c), (i, l) => (I(), O(C, { key: l }, [z(o)(i) && i.text.trim() ? (I(), E(w, {
|
|
437
|
+
key: 0,
|
|
438
|
+
appear: "",
|
|
439
|
+
name: "pk-chatbot-part"
|
|
440
|
+
}, {
|
|
441
|
+
default: V(() => [k("div", Ne, [me(r.$slots, "text", ue({ ref_for: !0 }, {
|
|
442
|
+
message: c,
|
|
443
|
+
part: i,
|
|
444
|
+
index: g,
|
|
445
|
+
isLoading: Z.value
|
|
446
|
+
}), () => [$(c) ? (I(), E(t, {
|
|
447
|
+
key: 0,
|
|
448
|
+
class: "wysiwyg",
|
|
449
|
+
markdown: i.text,
|
|
450
|
+
"is-dark": e.isDark,
|
|
451
|
+
loading: Q(g) && e.status === "streaming"
|
|
452
|
+
}, null, 8, [
|
|
453
|
+
"markdown",
|
|
454
|
+
"is-dark",
|
|
455
|
+
"loading"
|
|
456
|
+
])) : (I(), O(C, { key: 1 }, [le(R(i.text), 1)], 64))]), ht(c.id) && !Y(c.id)?.comment && l === vt(c) ? (I(), O("span", {
|
|
457
|
+
key: 0,
|
|
458
|
+
class: P(["pk-chatbot-message__reaction", gt(c.id)]),
|
|
459
|
+
title: _t(c.id)
|
|
460
|
+
}, [mt(c.id) ? (I(), O("span", Fe, R(mt(c.id)), 1)) : (I(), E(u, {
|
|
461
|
+
key: 1,
|
|
462
|
+
name: pt(c.id) === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-up-fill"
|
|
463
|
+
}, null, 8, ["name"]))], 10, Pe)) : D("", !0)])]),
|
|
464
|
+
_: 2
|
|
465
|
+
}, 1024)) : z(n)(i) ? (I(), E(w, {
|
|
466
|
+
key: 1,
|
|
467
|
+
appear: "",
|
|
468
|
+
name: "pk-chatbot-part"
|
|
469
|
+
}, {
|
|
470
|
+
default: V(() => [A(re, {
|
|
471
|
+
"media-type": i.mediaType,
|
|
472
|
+
url: i.url,
|
|
473
|
+
filename: i.filename,
|
|
474
|
+
size: z(s)(i)?.bytesCount
|
|
475
|
+
}, null, 8, [
|
|
476
|
+
"media-type",
|
|
477
|
+
"url",
|
|
478
|
+
"filename",
|
|
479
|
+
"size"
|
|
480
|
+
])]),
|
|
481
|
+
_: 2
|
|
482
|
+
}, 1024)) : z(d)(i) && !z(y)(i) ? (I(), E(w, {
|
|
483
|
+
key: 2,
|
|
484
|
+
appear: "",
|
|
485
|
+
name: "pk-chatbot-part"
|
|
486
|
+
}, {
|
|
487
|
+
default: V(() => [(I(), E(Ee, {
|
|
488
|
+
key: `approval-${l}`,
|
|
489
|
+
part: i,
|
|
490
|
+
actionable: e.interactive === !0 && (z(f)(i) || Q(g)),
|
|
491
|
+
"call-verdict": e.confirmVerdictsOnCall?.get(i.toolCallId ?? ""),
|
|
492
|
+
onRespond: (e) => Se(i, e)
|
|
493
|
+
}, null, 8, [
|
|
494
|
+
"part",
|
|
495
|
+
"actionable",
|
|
496
|
+
"call-verdict",
|
|
497
|
+
"onRespond"
|
|
498
|
+
]))]),
|
|
499
|
+
_: 2
|
|
500
|
+
}, 1024)) : Nt(i) ? (I(), E(w, {
|
|
501
|
+
key: 3,
|
|
502
|
+
appear: "",
|
|
503
|
+
name: "pk-chatbot-part"
|
|
504
|
+
}, {
|
|
505
|
+
default: V(() => [!z(xe)[i.type] && z(Ce)[z(a)(i)] ? (I(), E(he(z(Ce)[z(a)(i)]), {
|
|
506
|
+
key: `component-${l}-${z(m)(i)}`,
|
|
507
|
+
part: i
|
|
508
|
+
}, null, 8, ["part"])) : me(r.$slots, i.type, ue({ ref_for: !0 }, {
|
|
509
|
+
message: c,
|
|
510
|
+
part: i,
|
|
511
|
+
index: g,
|
|
512
|
+
isLoading: Z.value
|
|
513
|
+
}), () => [e.showAllMessageParts ? (I(), O("div", Ie, [k("div", Le, [z(v)(i) ? (I(), E(u, {
|
|
514
|
+
key: 0,
|
|
515
|
+
name: z(v)(i),
|
|
516
|
+
class: "shrink-0"
|
|
517
|
+
}, null, 8, ["name"])) : D("", !0), k("code", Re, R(z(be)(i.type)), 1)])])) : D("", !0)], void 0, 1)]),
|
|
518
|
+
_: 2
|
|
519
|
+
}, 1024)) : D("", !0), A(w, { mode: "out-in" }, {
|
|
520
|
+
default: V(() => [l === vt(c) && e.readonlyFeedback && Y(c.id)?.comment ? (I(), E(ae, {
|
|
521
|
+
key: 0,
|
|
522
|
+
feedback: Y(c.id)
|
|
523
|
+
}, null, 8, ["feedback"])) : D("", !0)]),
|
|
524
|
+
_: 2
|
|
525
|
+
}, 1024)], 64))), 128)),
|
|
526
|
+
A(w, {
|
|
527
|
+
name: "fade-in",
|
|
528
|
+
mode: "out-in"
|
|
529
|
+
}, {
|
|
530
|
+
default: V(() => [Z.value && Q(g) && !At(c) && $(c) && (!Mt(c) || Pt(c)) ? (I(), O("div", {
|
|
531
|
+
key: `loading-info-${c.id}`,
|
|
532
|
+
class: "pk-chatbot-message__loading-info"
|
|
533
|
+
}, [k("div", ze, [
|
|
534
|
+
A(u, {
|
|
535
|
+
name: "loading-loop",
|
|
536
|
+
class: "shrink-0"
|
|
537
|
+
}),
|
|
538
|
+
A(w, { mode: "out-in" }, {
|
|
539
|
+
default: V(() => [Et.value ? (I(), E(u, {
|
|
540
|
+
key: Et.value,
|
|
541
|
+
class: "shrink-0",
|
|
542
|
+
name: Et.value
|
|
543
|
+
}, null, 8, ["name"])) : D("", !0)]),
|
|
544
|
+
_: 1
|
|
545
|
+
}),
|
|
546
|
+
A(w, { mode: "out-in" }, {
|
|
547
|
+
default: V(() => [Tt.value ? (I(), O("span", {
|
|
548
|
+
key: Tt.value,
|
|
549
|
+
class: "text-12"
|
|
550
|
+
}, R(Tt.value), 1)) : D("", !0)]),
|
|
551
|
+
_: 1
|
|
552
|
+
})
|
|
553
|
+
]), A(w, {
|
|
554
|
+
name: "fade-in",
|
|
555
|
+
mode: "out-in"
|
|
556
|
+
}, {
|
|
557
|
+
default: V(() => [!Mt(c) && X.value && "text" in X.value && X.value.text.trim() ? (I(), E(b, {
|
|
558
|
+
key: 0,
|
|
559
|
+
markdown: X.value.text,
|
|
560
|
+
"is-dark": e.isDark,
|
|
561
|
+
"tail-length": z(ee),
|
|
562
|
+
"inner-class": "wysiwyg",
|
|
563
|
+
class: "border border-surface-3 rounded-md p-4 mt-8 bg-surface-1 max-h-64 text-12 w-full"
|
|
564
|
+
}, null, 8, [
|
|
565
|
+
"markdown",
|
|
566
|
+
"is-dark",
|
|
567
|
+
"tail-length"
|
|
568
|
+
])) : D("", !0)]),
|
|
569
|
+
_: 2
|
|
570
|
+
}, 1024)])) : D("", !0)]),
|
|
571
|
+
_: 2
|
|
572
|
+
}, 1024),
|
|
573
|
+
A(w, { mode: "out-in" }, {
|
|
574
|
+
default: V(() => [zt(c, g) ? (I(), O("div", Be, [
|
|
575
|
+
A(h, {
|
|
576
|
+
modifiers: "compact",
|
|
577
|
+
class: "mr-auto shrink-0"
|
|
578
|
+
}, {
|
|
579
|
+
default: V(() => [
|
|
580
|
+
A(w, { mode: "out-in" }, {
|
|
581
|
+
default: V(() => [Ot(g) ? (I(), E(p, {
|
|
582
|
+
key: 0,
|
|
583
|
+
icon: "ri:reset-right-line",
|
|
584
|
+
modifiers: "action-quiet-small",
|
|
585
|
+
title: z(F)("action.regenerate"),
|
|
586
|
+
"aria-label": z(F)("action.regenerate"),
|
|
587
|
+
onClick: i[0] ||= H((e) => r.$emit("regenerate"), ["stop"])
|
|
588
|
+
}, null, 8, ["title", "aria-label"])) : D("", !0)]),
|
|
589
|
+
_: 2
|
|
590
|
+
}, 1024),
|
|
591
|
+
A(w, { mode: "out-in" }, {
|
|
592
|
+
default: V(() => [kt("show-info", g) ? (I(), E(p, {
|
|
593
|
+
key: 0,
|
|
594
|
+
icon: "ri:information-line",
|
|
595
|
+
title: z(F)("action.getMoreInfo"),
|
|
596
|
+
"aria-label": z(F)("action.getMoreInfo"),
|
|
597
|
+
modifiers: "action-quiet-small",
|
|
598
|
+
onClick: H((e) => r.$emit("show-info", c), ["stop"])
|
|
599
|
+
}, null, 8, [
|
|
600
|
+
"title",
|
|
601
|
+
"aria-label",
|
|
602
|
+
"onClick"
|
|
603
|
+
])) : D("", !0)]),
|
|
604
|
+
_: 2
|
|
605
|
+
}, 1024),
|
|
606
|
+
A(w, { mode: "out-in" }, {
|
|
607
|
+
default: V(() => [kt("revise", g) ? (I(), E(p, {
|
|
608
|
+
key: 0,
|
|
609
|
+
icon: ut(c.id) ? "ri:file-edit-fill" : "ri:file-edit-line",
|
|
610
|
+
title: ut(c.id) ? z(F)("action.editRevise") : z(F)("action.createRevise"),
|
|
611
|
+
"aria-label": ut(c.id) ? z(F)("action.editRevise") : z(F)("action.createRevise"),
|
|
612
|
+
modifiers: "action-quiet-small",
|
|
613
|
+
class: P({ "text-brand": ut(c.id) }),
|
|
614
|
+
onClick: H((e) => r.$emit("revise", c), ["stop"])
|
|
615
|
+
}, null, 8, [
|
|
616
|
+
"icon",
|
|
617
|
+
"title",
|
|
618
|
+
"aria-label",
|
|
619
|
+
"class",
|
|
620
|
+
"onClick"
|
|
621
|
+
])) : D("", !0)]),
|
|
622
|
+
_: 2
|
|
623
|
+
}, 1024),
|
|
624
|
+
A(w, { mode: "out-in" }, {
|
|
625
|
+
default: V(() => [dt("upvote", g) ? (I(), E(p, {
|
|
626
|
+
key: 0,
|
|
627
|
+
icon: Y(c.id)?.vote === "upvote" ? "ri:thumb-up-fill" : "ri:thumb-up-line",
|
|
628
|
+
title: z(F)("action.upvote"),
|
|
629
|
+
"aria-label": z(F)("action.upvote"),
|
|
630
|
+
modifiers: "action-quiet-small",
|
|
631
|
+
onClick: H((e) => r.$emit("upvote", c), ["stop"])
|
|
632
|
+
}, null, 8, [
|
|
633
|
+
"icon",
|
|
634
|
+
"title",
|
|
635
|
+
"aria-label",
|
|
636
|
+
"onClick"
|
|
637
|
+
])) : D("", !0)]),
|
|
638
|
+
_: 2
|
|
639
|
+
}, 1024),
|
|
640
|
+
A(w, { mode: "out-in" }, {
|
|
641
|
+
default: V(() => [dt("downvote", g) ? (I(), E(p, {
|
|
642
|
+
key: 0,
|
|
643
|
+
icon: Y(c.id)?.vote === "downvote" ? "ri:thumb-down-fill" : "ri:thumb-down-line",
|
|
644
|
+
title: z(F)("action.downvote"),
|
|
645
|
+
"aria-label": z(F)("action.downvote"),
|
|
646
|
+
modifiers: "action-quiet-small",
|
|
647
|
+
onClick: H((e) => r.$emit("downvote", c), ["stop"])
|
|
648
|
+
}, null, 8, [
|
|
649
|
+
"icon",
|
|
650
|
+
"title",
|
|
651
|
+
"aria-label",
|
|
652
|
+
"onClick"
|
|
653
|
+
])) : D("", !0)]),
|
|
654
|
+
_: 2
|
|
655
|
+
}, 1024),
|
|
656
|
+
A(w, { mode: "out-in" }, {
|
|
657
|
+
default: V(() => [dt("feedback", g) ? (I(), E(p, {
|
|
658
|
+
key: 0,
|
|
659
|
+
icon: Y(c.id)?.comment ? "ri:feedback-fill" : "ri:feedback-line",
|
|
660
|
+
title: z(F)("action.feedback"),
|
|
661
|
+
"aria-label": z(F)("action.feedback"),
|
|
662
|
+
modifiers: "action-quiet-small",
|
|
663
|
+
onClick: H((e) => r.$emit("feedback", c), ["stop"])
|
|
664
|
+
}, null, 8, [
|
|
665
|
+
"icon",
|
|
666
|
+
"title",
|
|
667
|
+
"aria-label",
|
|
668
|
+
"onClick"
|
|
669
|
+
])) : D("", !0)]),
|
|
670
|
+
_: 2
|
|
671
|
+
}, 1024)
|
|
672
|
+
]),
|
|
673
|
+
_: 2
|
|
674
|
+
}, 1024),
|
|
675
|
+
!e.showMessageDateTime && c.metadata?.createdAt && c.metadata?.completedAt ? (I(), O("div", Ve, [k("time", {
|
|
676
|
+
datetime: new Date(c.metadata.createdAt).toISOString(),
|
|
677
|
+
title: z(U)(new Date(c.metadata.createdAt), "date-time"),
|
|
678
|
+
class: "flex items-center gap-4 min-w-0"
|
|
679
|
+
}, [A(u, {
|
|
680
|
+
name: "ri:time-line",
|
|
681
|
+
class: "shrink-0"
|
|
682
|
+
}), k("span", Ue, R(Bt(c.metadata.createdAt)), 1)], 8, He), Vt(c) ? (I(), O("span", We, [A(u, {
|
|
683
|
+
name: "ri:hourglass-line",
|
|
684
|
+
class: "shrink-0"
|
|
685
|
+
}), k("span", Ge, R(Vt(c)), 1)])) : D("", !0)])) : D("", !0),
|
|
686
|
+
e.showMessageTokensCount && c.metadata?.totalTokens ? (I(), O("span", Ke, [A(u, {
|
|
687
|
+
name: "ri:ai-generate-2-line",
|
|
688
|
+
class: "shrink-0"
|
|
689
|
+
}), k("span", qe, R(z(ye)(c.metadata.totalTokens, "integer")) + " " + R(z(F)("label.tokens")), 1)])) : D("", !0),
|
|
690
|
+
e.showMessageDateTime && c.metadata?.createdAt ? (I(), O("time", {
|
|
691
|
+
key: 2,
|
|
692
|
+
datetime: new Date(c.metadata?.createdAt).toISOString(),
|
|
693
|
+
class: "flex items-center gap-4 text-12 text-word-3"
|
|
694
|
+
}, [A(u, {
|
|
695
|
+
name: "ri:time-line",
|
|
696
|
+
class: "shrink-0"
|
|
697
|
+
}), k("span", Ye, R(z(U)(new Date(c.metadata?.createdAt), "date-time")), 1)], 8, Je)) : D("", !0),
|
|
698
|
+
e.showMessageDateTime && c?.metadata?.completedAt && c?.metadata?.createdAt ? (I(), O("div", Xe, [A(u, {
|
|
699
|
+
name: "ri:hourglass-line",
|
|
700
|
+
class: "shrink-0"
|
|
701
|
+
}), A(l, {
|
|
702
|
+
class: "truncate",
|
|
703
|
+
date: c.metadata?.createdAt,
|
|
704
|
+
"end-date": c.metadata?.completedAt
|
|
705
|
+
}, null, 8, ["date", "end-date"])])) : D("", !0)
|
|
706
|
+
])) : D("", !0)]),
|
|
707
|
+
_: 2
|
|
708
|
+
}, 1024),
|
|
709
|
+
A(w, { mode: "out-in" }, {
|
|
710
|
+
default: V(() => [c.id === e.feedbackMessageId ? (I(), E(ie, {
|
|
711
|
+
key: 0,
|
|
712
|
+
ref_for: !0,
|
|
713
|
+
ref_key: "feedbackMessageEl",
|
|
714
|
+
ref: Ht,
|
|
715
|
+
loading: e.feedbackLoading,
|
|
716
|
+
submitted: e.feedbackSubmitted,
|
|
717
|
+
error: e.feedbackError,
|
|
718
|
+
onSubmit: i[1] ||= (e) => r.$emit("feedback-submit", e),
|
|
719
|
+
onClose: i[2] ||= (e) => r.$emit("feedback-close")
|
|
720
|
+
}, null, 8, [
|
|
721
|
+
"loading",
|
|
722
|
+
"submitted",
|
|
723
|
+
"error"
|
|
724
|
+
])) : D("", !0)]),
|
|
725
|
+
_: 2
|
|
726
|
+
}, 1024)
|
|
727
|
+
], 6)) : D("", !0)], 64))), 128)),
|
|
728
|
+
A(w, {
|
|
729
|
+
appear: "",
|
|
730
|
+
name: "pk-chatbot-part"
|
|
731
|
+
}, {
|
|
732
|
+
default: V(() => [Ct.value ? (I(), O("div", {
|
|
733
|
+
key: 0,
|
|
734
|
+
class: "pk-chatbot-message pk-chatbot-message--assistant pk-chatbot-message--loading",
|
|
735
|
+
style: de({ minHeight: wt.value ? `${J.value}px` : void 0 })
|
|
736
|
+
}, [k("div", Ze, [k("div", Qe, [A(u, {
|
|
737
|
+
name: "loading-loop",
|
|
738
|
+
class: "shrink-0"
|
|
739
|
+
}), k("span", $e, R(z(F)("label.answeringOnTheCall")), 1)])])], 4)) : D("", !0)]),
|
|
740
|
+
_: 1
|
|
741
|
+
}),
|
|
742
|
+
A(w, {
|
|
743
|
+
appear: "",
|
|
744
|
+
name: "pk-chatbot-part"
|
|
745
|
+
}, {
|
|
746
|
+
default: V(() => [St.value ? (I(), E(c, {
|
|
747
|
+
key: 0,
|
|
748
|
+
error: e.error,
|
|
749
|
+
onRetry: i[3] ||= (e) => r.$emit("auto-retry"),
|
|
750
|
+
onReset: i[4] ||= (e) => r.$emit("reset-chat")
|
|
751
|
+
}, null, 8, ["error"])) : D("", !0)]),
|
|
752
|
+
_: 1
|
|
753
|
+
}),
|
|
754
|
+
yt.value?.role === "user" && !wt.value || St.value ? (I(), O("div", {
|
|
755
|
+
key: 0,
|
|
756
|
+
class: "pk-chatbot-messages__spacer",
|
|
757
|
+
style: de({ minHeight: `${J.value}px` })
|
|
758
|
+
}, null, 4)) : D("", !0)
|
|
759
|
+
], 512),
|
|
760
|
+
A(w, { name: "pk-chatbot-messages-fab" }, {
|
|
761
|
+
default: V(() => [e.showScrollToBottom && (z(K) || !z(tt)) ? (I(), O("button", {
|
|
762
|
+
key: 0,
|
|
763
|
+
type: "button",
|
|
764
|
+
class: "pk-chatbot-messages__scroll-to-bottom",
|
|
765
|
+
title: z(F)("action.scrollToBottom"),
|
|
766
|
+
"aria-label": z(F)("action.scrollToBottom"),
|
|
767
|
+
onClick: nt
|
|
768
|
+
}, [A(u, { name: "ri:arrow-down-line" })], 8, et)) : D("", !0)]),
|
|
769
|
+
_: 1
|
|
770
|
+
})
|
|
771
|
+
], 46, ke);
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
//#endregion
|
|
776
|
+
export { xe as a, be as i, Se as n, ye as r, tt as t };
|
|
777
|
+
|
|
778
|
+
//# sourceMappingURL=PkChatbotMessages-DcFGzK2p.js.map
|