@8wave/ai-elements 0.126.0-beta.32 → 0.126.0-beta.33
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-COa7L9GK.js → Agent-DZEyfr8D.js} +2 -1
- package/dist/_chunks/Agent-DZEyfr8D.js.map +1 -0
- package/dist/_chunks/{PkFilePreview-SBGa95Ca.js → PkFilePreview-C6ZZablL.js} +3 -3
- package/dist/_chunks/{PkFilePreview-SBGa95Ca.js.map → PkFilePreview-C6ZZablL.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-Cc7iZWCl.js → PkFilePreviewDialog-BzBHAt8l.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-Cc7iZWCl.js.map → PkFilePreviewDialog-BzBHAt8l.js.map} +1 -1
- package/dist/_chunks/{PkImageEditorDialog-D13bWv-N.js → PkImageEditorDialog-Dm34WFmS.js} +2 -2
- package/dist/_chunks/{PkImageEditorDialog-D13bWv-N.js.map → PkImageEditorDialog-Dm34WFmS.js.map} +1 -1
- package/dist/_chunks/{PkSelectionActions-BaX_rsCt.js → PkSelectionActions-CYqbMEjg.js} +2 -2
- package/dist/_chunks/{PkSelectionActions-BaX_rsCt.js.map → PkSelectionActions-CYqbMEjg.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-GRB3Gg_x.js → PkStreamingMarkdown-B8rZbprU.js} +3 -3
- package/dist/_chunks/{PkStreamingMarkdown-GRB3Gg_x.js.map → PkStreamingMarkdown-B8rZbprU.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-DTm5-CE4.js → PkToolChatFile-C0emIVfS.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-DTm5-CE4.js.map → PkToolChatFile-C0emIVfS.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-DZenn1az.js → PkToolRequestGeolocation-DNzNRszE.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-DZenn1az.js.map → PkToolRequestGeolocation-DNzNRszE.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-Dz0qfYu5.js → PkToolRequestOAuthConnection-BDxYXz4s.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-Dz0qfYu5.js.map → PkToolRequestOAuthConnection-BDxYXz4s.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-C9_DHr5Y.js → PkToolShowArtifact-B_KIIjEn.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-C9_DHr5Y.js.map → PkToolShowArtifact-B_KIIjEn.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DhyelktO.js → PkToolShowContactForm-DiHb3fRQ.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DhyelktO.js.map → PkToolShowContactForm-DiHb3fRQ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-Dz2Hnzts.js → PkToolShowForm-BmUAhIQy.js} +4 -4
- package/dist/_chunks/{PkToolShowForm-Dz2Hnzts.js.map → PkToolShowForm-BmUAhIQy.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-CiDfIboY.js → PkToolShowImageGallery-CZ394fdT.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-CiDfIboY.js.map → PkToolShowImageGallery-CZ394fdT.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-CY96IGWn.js → PkToolShowProductList-uNvUr2s9.js} +2 -2
- package/dist/_chunks/{PkToolShowProductList-CY96IGWn.js.map → PkToolShowProductList-uNvUr2s9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CRk-MOoE.js → PkToolShowSources-Dm0L4prK.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-CRk-MOoE.js.map → PkToolShowSources-Dm0L4prK.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-DKuV4mmV.js → PkToolShowSuggestedReply-B_dRrZfj.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-DKuV4mmV.js.map → PkToolShowSuggestedReply-B_dRrZfj.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-DI6ohcVU.js → PkToolShowVideo-DLgQjTq_.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-DI6ohcVU.js.map → PkToolShowVideo-DLgQjTq_.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-Dh6L_n9T.js → PkToolShowWebPages-Cj2mJrs5.js} +2 -2
- package/dist/_chunks/{PkToolShowWebPages-Dh6L_n9T.js.map → PkToolShowWebPages-Cj2mJrs5.js.map} +1 -1
- package/dist/_chunks/{chatImagePolicy-Ckz-KAHA.js → chatImagePolicy-DMt6O5iK.js} +2 -2
- package/dist/_chunks/{chatImagePolicy-Ckz-KAHA.js.map → chatImagePolicy-DMt6O5iK.js.map} +1 -1
- package/dist/_chunks/{markdown-DHayRAiy.js → markdown-nw5sXwU0.js} +2 -2
- package/dist/_chunks/{markdown-DHayRAiy.js.map → markdown-nw5sXwU0.js.map} +1 -1
- package/dist/_chunks/{utils-3jpXeGGy.js → utils-DPGBO-HU.js} +2 -2
- package/dist/_chunks/{utils-3jpXeGGy.js.map → utils-DPGBO-HU.js.map} +1 -1
- package/dist/ai-elements.es.js +3927 -3858
- 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-CRwhrv5Z.js → Agent-CBAd3F7k.js} +2 -1
- package/dist-vue/_chunks/Agent-CBAd3F7k.js.map +1 -0
- package/dist-vue/_chunks/{Document-Bp-qpa8v.js → Document-B3w5H0R0.js} +2 -2
- package/dist-vue/_chunks/{Document-Bp-qpa8v.js.map → Document-B3w5H0R0.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbot-CtrcDgBe.js → PkChatbot-CXpftmWm.js} +8 -8
- package/dist-vue/_chunks/{PkChatbot-CtrcDgBe.js.map → PkChatbot-CXpftmWm.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-BF3Odn3v.js → PkChatbotEmptyState-vA2v4FES.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-BF3Odn3v.js.map → PkChatbotEmptyState-vA2v4FES.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotInput-CIIJ1bpF.js +584 -0
- package/dist-vue/_chunks/PkChatbotInput-CIIJ1bpF.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotMessages-10eBKpC5.js → PkChatbotMessages-15R8RxAq.js} +18 -18
- package/dist-vue/_chunks/{PkChatbotMessages-10eBKpC5.js.map → PkChatbotMessages-15R8RxAq.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-C4ahOq6Z.js → PkChatbotStepPayload-BbNSav-U.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-C4ahOq6Z.js.map → PkChatbotStepPayload-BbNSav-U.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CkIX0aKu.js → PkChatbotStepToolDetail-B_4pmbLe.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-CkIX0aKu.js.map → PkChatbotStepToolDetail-B_4pmbLe.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BalLo6DZ.js → PkChatbotSteps-h4E6DH_g.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-BalLo6DZ.js.map → PkChatbotSteps-h4E6DH_g.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotViewChat-CLQ0J9_f.js +1382 -0
- package/dist-vue/_chunks/PkChatbotViewChat-CLQ0J9_f.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-D0vDYTyo.js → PkChatbotViewConversations-DFBbypGg.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewConversations-D0vDYTyo.js.map → PkChatbotViewConversations-DFBbypGg.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BwfAnywk.js → PkChatbotViewFiles-PHdrHZOf.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-BwfAnywk.js.map → PkChatbotViewFiles-PHdrHZOf.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-GW0WuMOy.js → PkChatbotViewProfile-B0AZvHTr.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-GW0WuMOy.js.map → PkChatbotViewProfile-B0AZvHTr.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreview-qizsvSVW.js → PkFilePreview-Cb-1YRPN.js} +616 -666
- package/dist-vue/_chunks/PkFilePreview-Cb-1YRPN.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-WsVzH9hg.js → PkFilePreviewDialog-Bd7kEoCB.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-WsVzH9hg.js.map → PkFilePreviewDialog-Bd7kEoCB.js.map} +1 -1
- package/dist-vue/_chunks/{PkImageEditorDialog-NQFpdqCU.js → PkImageEditorDialog-Bj4sUHXM.js} +2 -2
- package/dist-vue/_chunks/{PkImageEditorDialog-NQFpdqCU.js.map → PkImageEditorDialog-Bj4sUHXM.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-CMxiJTMR.js → PkStreamingMarkdown-BcUq4ThC.js} +3 -3
- package/dist-vue/_chunks/{PkStreamingMarkdown-CMxiJTMR.js.map → PkStreamingMarkdown-BcUq4ThC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolChatFile-Bd6Ci7i1.js → PkToolChatFile-BOexrlLt.js} +3 -3
- package/dist-vue/_chunks/{PkToolChatFile-Bd6Ci7i1.js.map → PkToolChatFile-BOexrlLt.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestGeolocation-C2OmF31d.js → PkToolRequestGeolocation-CyL_M1Rm.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestGeolocation-C2OmF31d.js.map → PkToolRequestGeolocation-CyL_M1Rm.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CgD-o99C.js → PkToolRequestOAuthConnection-DWkeVLpx.js} +2 -2
- package/dist-vue/_chunks/{PkToolRequestOAuthConnection-CgD-o99C.js.map → PkToolRequestOAuthConnection-DWkeVLpx.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-rlZ-AGWh.js → PkToolShowArtifact-C4gHB6lH.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-rlZ-AGWh.js.map → PkToolShowArtifact-C4gHB6lH.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowChart-B8xJi1yY.js → PkToolShowChart-CsPXNAb9.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowChart-B8xJi1yY.js.map → PkToolShowChart-CsPXNAb9.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BVBL7Unx.js → PkToolShowContactForm-2_HBPZaa.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BVBL7Unx.js.map → PkToolShowContactForm-2_HBPZaa.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-Bs39QQZ3.js → PkToolShowDiagram-cCbeL6MK.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-Bs39QQZ3.js.map → PkToolShowDiagram-cCbeL6MK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-D-RJeA2F.js → PkToolShowForm-DjB3fji5.js} +4 -4
- package/dist-vue/_chunks/{PkToolShowForm-D-RJeA2F.js.map → PkToolShowForm-DjB3fji5.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-CrkkKCVI.js → PkToolShowImageGallery-C22TCUKW.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-CrkkKCVI.js.map → PkToolShowImageGallery-C22TCUKW.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-BwfUG41_.js → PkToolShowProductList-BvtmiHBf.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-BwfUG41_.js.map → PkToolShowProductList-BvtmiHBf.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-q9gQIuam.js → PkToolShowSources-uKO4MQgd.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-q9gQIuam.js.map → PkToolShowSources-uKO4MQgd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-75Kc8-OQ.js → PkToolShowSuggestedReply-wKgwHTRO.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSuggestedReply-75Kc8-OQ.js.map → PkToolShowSuggestedReply-wKgwHTRO.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-BK-jDVJd.js → PkToolShowVideo-DKj5N1vo.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-BK-jDVJd.js.map → PkToolShowVideo-DKj5N1vo.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-K3Jml1f7.js → PkToolShowWebPages-BNZmbCSf.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-K3Jml1f7.js.map → PkToolShowWebPages-BNZmbCSf.js.map} +1 -1
- package/dist-vue/_chunks/{createChatbotApiClient-Pb7_cU2s.js → createChatbotApiClient-DBKfGL6y.js} +5 -2
- package/dist-vue/_chunks/{createChatbotApiClient-Pb7_cU2s.js.map → createChatbotApiClient-DBKfGL6y.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-ChrZVIDt.js → useChatbotStore-Hb5EjISl.js} +94 -85
- package/dist-vue/_chunks/useChatbotStore-Hb5EjISl.js.map +1 -0
- package/dist-vue/_chunks/{utils-Bdk5kFfi.js → utils-waie4Gfn.js} +2 -2
- package/dist-vue/_chunks/{utils-Bdk5kFfi.js.map → utils-waie4Gfn.js.map} +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +2 -0
- package/dist-vue/composables.js +8 -8
- package/dist-vue/index.js +408 -389
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +6 -0
- package/dist-vue/packages/components/src/chat/PkAgentSettingsPanel.d.ts +9 -2
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +6 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +5 -0
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +10 -1
- package/dist-vue/packages/models/src/schema/Agent.d.ts +8 -0
- package/dist-vue/packages/models/src/schema/ReasoningChat.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/SubAgent.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/constants.d.ts +11 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/Agent-COa7L9GK.js.map +0 -1
- package/dist-vue/_chunks/Agent-CRwhrv5Z.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-DNXvFvyG.js +0 -520
- package/dist-vue/_chunks/PkChatbotInput-DNXvFvyG.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-U6T-gG-c.js +0 -1336
- package/dist-vue/_chunks/PkChatbotViewChat-U6T-gG-c.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-qizsvSVW.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-ChrZVIDt.js.map +0 -1
|
@@ -0,0 +1,1382 @@
|
|
|
1
|
+
import { B as e, b as t, n, p as r, r as i, u as a } from "./utils-waie4Gfn.js";
|
|
2
|
+
import { o } from "./Media-0U2B_qCS.js";
|
|
3
|
+
import { t as s } from "./PkChatbotMessages-15R8RxAq.js";
|
|
4
|
+
import { t as c } from "./VvButtonLocalized-C-vx25u4.js";
|
|
5
|
+
import { t as l } from "./useLightbox-DrEFS3gx.js";
|
|
6
|
+
import { a as u, n as d, t as f } from "./useChatbotStore-Hb5EjISl.js";
|
|
7
|
+
import { n as p } from "./src-nb8MU1sh.js";
|
|
8
|
+
import { s as m, t as h } from "./message-DuibQyHy.js";
|
|
9
|
+
import { t as g } from "./useLocalizedString-Dmn92nix.js";
|
|
10
|
+
import { n as _, r as v, t as y } from "./PkChatbotInput-CIIJ1bpF.js";
|
|
11
|
+
import { t as b } from "./PkAvatar-DwtZWSW4.js";
|
|
12
|
+
import { t as ee } from "./PkChatbotQueuedMessages-CIJFAvE2.js";
|
|
13
|
+
import { t as te } from "./PkChatbotEmptyState-vA2v4FES.js";
|
|
14
|
+
import { t as x } from "./PkChatbotWakeupBar-DOCJYxzV.js";
|
|
15
|
+
import { VvIcon as ne } from "@volverjs/ui-vue/components";
|
|
16
|
+
import { Fragment as S, Teleport as re, Transition as ie, computed as C, createBlock as w, createCommentVNode as T, createElementBlock as E, createElementVNode as D, createSlots as ae, createTextVNode as oe, createVNode as O, defineAsyncComponent as k, defineComponent as se, inject as ce, isRef as le, nextTick as ue, normalizeClass as A, normalizeStyle as de, onBeforeUnmount as fe, onMounted as pe, onScopeDispose as me, onUnmounted as he, openBlock as j, provide as ge, ref as M, renderList as _e, shallowRef as ve, toDisplayString as N, toValue as ye, unref as P, useTemplateRef as be, watch as F, withCtx as I } from "vue";
|
|
17
|
+
import { useI18n as xe } from "vue-i18n";
|
|
18
|
+
import { useDropZone as Se, useResizeObserver as Ce } from "@vueuse/core";
|
|
19
|
+
import { storeToRefs as we } from "pinia";
|
|
20
|
+
// ../../packages/utils/src/next-message.ts
|
|
21
|
+
var L = 15, Te = 120, R = /* @__PURE__ */ new Set([
|
|
22
|
+
"sì",
|
|
23
|
+
"si",
|
|
24
|
+
"no",
|
|
25
|
+
"ok",
|
|
26
|
+
"okay",
|
|
27
|
+
"certo",
|
|
28
|
+
"procedi",
|
|
29
|
+
"continua",
|
|
30
|
+
"perché",
|
|
31
|
+
"yes",
|
|
32
|
+
"sure",
|
|
33
|
+
"go",
|
|
34
|
+
"continue",
|
|
35
|
+
"why"
|
|
36
|
+
]), z = (e) => (e.match(/\+?\d[\d\s./-]*\d/g) ?? []).some((e) => e.replace(/\D/g, "").length >= 9), Ee = [
|
|
37
|
+
/[.!?]\s+\p{Lu}/u,
|
|
38
|
+
/[\n*#`]/,
|
|
39
|
+
/^[([{<]/,
|
|
40
|
+
/^(nothing|none|niente|nulla|nessuno)(\W*$|\s*[:,;])/i,
|
|
41
|
+
/^(no suggestion|nessun suggerimento|silence|silenzio)\W*$/i,
|
|
42
|
+
/\b(stay(s|ing)? silent|conversation is over|la conversazione è (chiusa|finita))\b/i,
|
|
43
|
+
/\b(grazie|thanks|thank you)\b/i,
|
|
44
|
+
/^(perfetto|ottimo|fantastico|great|perfect|awesome|nice|looks good|sounds good)\P{L}*$/iu,
|
|
45
|
+
/^(ecco|lascia che|ti mostro|ti spiego|let me|here's|here is)\b/i,
|
|
46
|
+
/\S+@\S+\.\S+/
|
|
47
|
+
];
|
|
48
|
+
function De(e) {
|
|
49
|
+
let t = e.replace(/<\/?think>/gi, "").replace(/[\u200B-\u200D\uFEFF]/g, "").trim().replace(/^["'«“‘](.*)["'»”’]$/s, "$1").trim(), n = t.split(/\s+/);
|
|
50
|
+
if (!(!t || t.length > Te || n.length > L || n.length < 2 && !R.has(t.toLowerCase().replace(/\P{L}/gu, "")) || Ee.some((e) => e.test(t)) || z(t))) return t;
|
|
51
|
+
}
|
|
52
|
+
// ../../packages/composable/src/chatbot/useGreeting.ts
|
|
53
|
+
function Oe(e, t) {
|
|
54
|
+
let { locale: n, t: r, te: i } = xe({ useScope: "global" });
|
|
55
|
+
return C(() => B(ye(e)?.greeting?.[0]?.[n.value] ?? "", ye(t)) || (i("message.defaultAgentWelcome") ? r("message.defaultAgentWelcome") : ""));
|
|
56
|
+
}
|
|
57
|
+
function B(e, t) {
|
|
58
|
+
return (t ? e.replace(/\{name\}/g, t) : e.replace(/[,\s]*\{name\}[!?]?/g, "")).trim();
|
|
59
|
+
}
|
|
60
|
+
// ../../packages/components/src/chat/PkAuroraCanvas.vue?vue&type=script&setup=true&lang.ts
|
|
61
|
+
var ke = {
|
|
62
|
+
key: 1,
|
|
63
|
+
class: "pk-aurora__fallback"
|
|
64
|
+
}, Ae = "\nattribute vec2 a_position;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", je = "\nprecision mediump float;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_color;\nuniform vec3 u_color2;\nuniform float u_duo;\nuniform vec2 u_center;\nuniform vec2 u_half;\nuniform float u_spread;\n\nvec3 permute(vec3 x) { return mod(((x * 34.0) + 1.0) * x, 289.0); }\n\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n -0.577350269189626, 0.024390243902439);\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod(i, 289.0);\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n dot(x12.zw, x12.zw)), 0.0);\n m = m * m;\n m = m * m;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n\nvoid main() {\n vec2 px = gl_FragCoord.xy;\n vec2 rel = px - u_center;\n\n // Ignition: the ellipse lights up expanding from the center on mount\n float intro = smoothstep(0.0, 1.4, u_time);\n\n // Breathing: size and brightness oscillate gently but visibly\n float breath = 1.0\n + 0.12 * sin(u_time * 0.55)\n + 0.06 * snoise(vec2(u_time * 0.1, 3.7));\n float pulse = 1.0 + 0.2 * sin(u_time * 0.55 + 1.3);\n\n // Keep it simple (Gemini-style): one huge soft elliptical glow\n // centered on the pill. Its height follows the pill's, but each half\n // ends inside the canvas: at most the room to that edge over 1.75, so\n // at the widest breath (1.24) the glow there is about 1% of its peak,\n // under one 8-bit step, and the edge fade below finds nothing to cut.\n // Uncapped, a taller pill (a second line, an attachment) or a short\n // canvas left a quarter of the glow or more at the edge, cut straight.\n vec2 radii = vec2(u_half.x * 0.95, u_half.y * 6.5) * u_spread;\n float room = rel.y > 0.0 ? u_resolution.y - u_center.y : u_center.y;\n radii.y = min(radii.y, room / 1.75);\n radii *= breath * mix(0.15, 1.0, intro);\n float r = length(rel / max(radii, vec2(1.0)));\n float glow = exp(-r * r * 2.2);\n\n // Never cut hard against the canvas bounds\n vec2 m = min(px, u_resolution - px);\n glow *= smoothstep(0.0, 32.0, min(m.x, m.y));\n\n // Dither: breaks the 8-bit banding rings of the very soft gradient\n // (no CSS blur on the canvas, the noise must fully mask the bands)\n glow = max(glow + (snoise(px * 0.9) - 0.5) * 0.03, 0.0);\n\n float alpha = glow * 0.2 * pulse * intro;\n\n // Two tones: left to right the glow passes from the first to the\n // second, along a border a slow noise field keeps bending\n vec2 q = rel / max(radii, vec2(1.0));\n float bands = q.x * 0.9\n + 0.7 * snoise(q * 0.8 + vec2(u_time * 0.07, -u_time * 0.05));\n vec3 color = mix(u_color, u_color2, u_duo * smoothstep(-0.6, 0.6, bands));\n\n // Premultiplied alpha (default canvas compositing)\n gl_FragColor = vec4(color * alpha, alpha);\n}", Me = /* @__PURE__ */ se({
|
|
65
|
+
__name: "PkAuroraCanvas",
|
|
66
|
+
props: {
|
|
67
|
+
sourceSelector: {},
|
|
68
|
+
mainColor: {},
|
|
69
|
+
tones: {},
|
|
70
|
+
secondColor: {}
|
|
71
|
+
},
|
|
72
|
+
setup(t) {
|
|
73
|
+
let n = t, r = be("rootEl"), i = be("canvasEl"), a = M(!1), o = M(null), s = C(() => o.value ? {
|
|
74
|
+
"--pk-aurora-tint": `rgb(${o.value.first.join(" ")})`,
|
|
75
|
+
"--pk-aurora-tint-2": `rgb(${(o.value.duo ? o.value.second : o.value.first).join(" ")})`
|
|
76
|
+
} : void 0), c = null, l = 0, u = null, d = null, f = null, p = null, m = null, h = null, g = null, _ = null, v = null, y = performance.now(), b = (e, t) => {
|
|
77
|
+
if (!c) return null;
|
|
78
|
+
let n = c.createShader(e);
|
|
79
|
+
return !n || (c.shaderSource(n, t), c.compileShader(n), !c.getShaderParameter(n, c.COMPILE_STATUS)) ? null : n;
|
|
80
|
+
}, ee = (e) => e.map((e) => e / 255), te = () => {
|
|
81
|
+
r.value && (o.value = e(r.value, {
|
|
82
|
+
mainColor: n.mainColor,
|
|
83
|
+
tones: n.tones,
|
|
84
|
+
secondColor: n.secondColor
|
|
85
|
+
}), c && !a.value && o.value && (c.uniform3f(g, ...ee(o.value.first)), c.uniform3f(_, ...ee(o.value.second)), c.uniform1f(v, +!!o.value.duo), S(ne() ? 10 : void 0)));
|
|
86
|
+
};
|
|
87
|
+
F([
|
|
88
|
+
() => n.mainColor,
|
|
89
|
+
() => n.tones,
|
|
90
|
+
() => n.secondColor
|
|
91
|
+
], te);
|
|
92
|
+
let x = () => {
|
|
93
|
+
if (!c || !i.value) return;
|
|
94
|
+
let e = Math.min(window.devicePixelRatio || 1, 1.5), { clientWidth: t, clientHeight: r } = i.value;
|
|
95
|
+
i.value.width = Math.max(1, Math.round(t * e)), i.value.height = Math.max(1, Math.round(r * e)), c.viewport(0, 0, i.value.width, i.value.height);
|
|
96
|
+
let a = i.value.parentElement?.offsetParent, o = (n.sourceSelector ? a?.querySelector(n.sourceSelector) : a) ?? a, s = i.value.getBoundingClientRect(), l = o?.getBoundingClientRect();
|
|
97
|
+
if (l && s.width > 0) {
|
|
98
|
+
let e = i.value.width / s.width, t = i.value.height / s.height, n = (l.left + l.width / 2 - s.left) * e, r = (s.bottom - (l.top + l.height / 2)) * t, a = l.width / 2 * e, o = l.height / 2 * t;
|
|
99
|
+
c.uniform2f(p, n, r), c.uniform2f(m, a, o);
|
|
100
|
+
let u = Number.parseFloat(getComputedStyle(i.value).getPropertyValue("--aurora-spread"));
|
|
101
|
+
c.uniform1f(h, Number.isNaN(u) ? 1 : u);
|
|
102
|
+
}
|
|
103
|
+
S(ne() ? 10 : void 0);
|
|
104
|
+
}, ne = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, S = (e) => {
|
|
105
|
+
c && i.value && (c.uniform1f(d, e ?? (performance.now() - y) / 1e3), c.uniform2f(f, i.value.width, i.value.height), c.drawArrays(c.TRIANGLE_STRIP, 0, 4));
|
|
106
|
+
}, re = () => {
|
|
107
|
+
S(), l = requestAnimationFrame(re);
|
|
108
|
+
};
|
|
109
|
+
return pe(() => {
|
|
110
|
+
let e = i.value;
|
|
111
|
+
if (te(), c = e?.getContext("webgl", { alpha: !0 }) ?? null, !e || !c || !o.value) {
|
|
112
|
+
a.value = !0;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
let t = b(c.VERTEX_SHADER, Ae), n = b(c.FRAGMENT_SHADER, je), r = c.createProgram();
|
|
116
|
+
if (!t || !n || !r || (c.attachShader(r, t), c.attachShader(r, n), c.linkProgram(r), !c.getProgramParameter(r, c.LINK_STATUS))) {
|
|
117
|
+
a.value = !0;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
c.useProgram(r);
|
|
121
|
+
let s = c.createBuffer();
|
|
122
|
+
c.bindBuffer(c.ARRAY_BUFFER, s), c.bufferData(c.ARRAY_BUFFER, new Float32Array([
|
|
123
|
+
-1,
|
|
124
|
+
-1,
|
|
125
|
+
1,
|
|
126
|
+
-1,
|
|
127
|
+
-1,
|
|
128
|
+
1,
|
|
129
|
+
1,
|
|
130
|
+
1
|
|
131
|
+
]), c.STATIC_DRAW);
|
|
132
|
+
let l = c.getAttribLocation(r, "a_position");
|
|
133
|
+
c.enableVertexAttribArray(l), c.vertexAttribPointer(l, 2, c.FLOAT, !1, 0, 0), d = c.getUniformLocation(r, "u_time"), f = c.getUniformLocation(r, "u_resolution"), p = c.getUniformLocation(r, "u_center"), m = c.getUniformLocation(r, "u_half"), h = c.getUniformLocation(r, "u_spread"), g = c.getUniformLocation(r, "u_color"), _ = c.getUniformLocation(r, "u_color2"), v = c.getUniformLocation(r, "u_duo"), te(), u = new ResizeObserver(x), u.observe(e), x(), ue(x), ne() ? S(10) : re();
|
|
134
|
+
}), fe(() => {
|
|
135
|
+
cancelAnimationFrame(l), u?.disconnect();
|
|
136
|
+
}), he(() => {
|
|
137
|
+
let e = c;
|
|
138
|
+
c = null, setTimeout(() => {
|
|
139
|
+
e?.getExtension("WEBGL_lose_context")?.loseContext();
|
|
140
|
+
}, 150);
|
|
141
|
+
}), (e, t) => (j(), E("div", {
|
|
142
|
+
ref_key: "rootEl",
|
|
143
|
+
ref: r,
|
|
144
|
+
class: "pk-aurora",
|
|
145
|
+
"aria-hidden": "true",
|
|
146
|
+
style: de(s.value)
|
|
147
|
+
}, [a.value ? (j(), E("div", ke)) : (j(), E("canvas", {
|
|
148
|
+
key: 0,
|
|
149
|
+
ref_key: "canvasEl",
|
|
150
|
+
ref: i,
|
|
151
|
+
class: "pk-aurora__canvas"
|
|
152
|
+
}, null, 512))], 4));
|
|
153
|
+
}
|
|
154
|
+
}), V = .18, Ne = .35, H = /* @__PURE__ */ se({
|
|
155
|
+
__name: "PkVoiceOrb",
|
|
156
|
+
props: {
|
|
157
|
+
sample: {},
|
|
158
|
+
spectrum: {
|
|
159
|
+
type: Function,
|
|
160
|
+
default: void 0
|
|
161
|
+
},
|
|
162
|
+
state: {},
|
|
163
|
+
bars: { default: 5 }
|
|
164
|
+
},
|
|
165
|
+
setup(e) {
|
|
166
|
+
let t = e, n = be("barsEl"), r = Array.from({ length: t.bars }, () => V), i, a = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === !0, o = () => {
|
|
167
|
+
let e = Math.min(1, Math.max(0, t.sample())), n = t.spectrum?.(), i = r.length;
|
|
168
|
+
if (!n?.length) {
|
|
169
|
+
let t = Date.now() / 260;
|
|
170
|
+
return Array.from({ length: i }, (n, r) => {
|
|
171
|
+
let i = .65 + .35 * Math.sin(t + r * .9);
|
|
172
|
+
return V + e * 2.4 * i;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
let a = Math.max(1, Math.floor(n.length / 2)), o = Math.max(1, Math.floor(a / i));
|
|
176
|
+
return Array.from({ length: i }, (e, t) => {
|
|
177
|
+
let r = 0;
|
|
178
|
+
for (let e = 0; e < o; e += 1) r += n[t * o + e] ?? 0;
|
|
179
|
+
return V + r / o / 255 * 2.2;
|
|
180
|
+
});
|
|
181
|
+
}, s = () => {
|
|
182
|
+
let e = n.value?.children;
|
|
183
|
+
e && r.forEach((t, n) => {
|
|
184
|
+
e[n]?.style.setProperty("--pk-voice-orb-scale", String(t));
|
|
185
|
+
});
|
|
186
|
+
}, c = () => {
|
|
187
|
+
let e = o();
|
|
188
|
+
r = r.map((t, n) => t + (Math.min(1, Math.max(V, e[n] ?? V)) - t) * Ne), s(), i = requestAnimationFrame(c);
|
|
189
|
+
}, l = () => {
|
|
190
|
+
i !== void 0 && (cancelAnimationFrame(i), i = void 0);
|
|
191
|
+
};
|
|
192
|
+
return F(() => t.state, async (e) => {
|
|
193
|
+
e !== "listening" && e !== "speaking" || a() ? (l(), r = r.map(() => V * 1.6), await ue(), s()) : i === void 0 && (i = requestAnimationFrame(c));
|
|
194
|
+
}, { immediate: !0 }), fe(l), (t, r) => (j(), E("div", {
|
|
195
|
+
class: A(["pk-voice-orb", `pk-voice-orb--${e.state}`]),
|
|
196
|
+
"aria-hidden": "true"
|
|
197
|
+
}, [D("div", {
|
|
198
|
+
ref_key: "barsEl",
|
|
199
|
+
ref: n,
|
|
200
|
+
class: "pk-voice-orb__bars"
|
|
201
|
+
}, [(j(!0), E(S, null, _e(e.bars, (e) => (j(), E("span", {
|
|
202
|
+
key: e,
|
|
203
|
+
class: "pk-voice-orb__bar"
|
|
204
|
+
}))), 128))], 512)], 2));
|
|
205
|
+
}
|
|
206
|
+
}), U = {
|
|
207
|
+
key: 0,
|
|
208
|
+
class: "pk-voice-session__badge",
|
|
209
|
+
"aria-hidden": "true"
|
|
210
|
+
}, Pe = {
|
|
211
|
+
class: "pk-voice-session__status",
|
|
212
|
+
role: "status"
|
|
213
|
+
}, Fe = {
|
|
214
|
+
key: 0,
|
|
215
|
+
class: "pk-voice-session__live-dot",
|
|
216
|
+
"aria-hidden": "true"
|
|
217
|
+
}, Ie = ["title"], Le = ["title"], Re = { class: "pk-voice-session__actions" }, ze = /* @__PURE__ */ se({
|
|
218
|
+
__name: "PkVoiceSession",
|
|
219
|
+
props: {
|
|
220
|
+
state: {},
|
|
221
|
+
sample: { type: Function },
|
|
222
|
+
spectrum: { type: Function },
|
|
223
|
+
remainingSeconds: {},
|
|
224
|
+
muted: { type: Boolean },
|
|
225
|
+
error: {},
|
|
226
|
+
rawError: {},
|
|
227
|
+
live: { type: Boolean }
|
|
228
|
+
},
|
|
229
|
+
emits: [
|
|
230
|
+
"toggle-mute",
|
|
231
|
+
"hang-up",
|
|
232
|
+
"retry",
|
|
233
|
+
"dismiss"
|
|
234
|
+
],
|
|
235
|
+
setup(e, { emit: t }) {
|
|
236
|
+
let n = e, r = t, { t: i } = xe({ useScope: "global" }), a = C(() => n.error ? i("message.voiceFailed") : n.state === "connecting" ? i("message.voiceConnecting") : n.state === "speaking" ? i("message.voiceSpeaking") : n.muted ? i("message.voiceMuted") : i("message.voiceListening")), o = C(() => {
|
|
237
|
+
if (n.remainingSeconds === void 0) return;
|
|
238
|
+
let e = Math.floor(n.remainingSeconds / 60), t = n.remainingSeconds % 60;
|
|
239
|
+
return `${e}:${String(t).padStart(2, "0")}`;
|
|
240
|
+
}), s = C(() => n.remainingSeconds !== void 0 && n.remainingSeconds <= 30), c = C(() => !n.error && (n.state === "listening" || n.state === "speaking")), l = C(() => {
|
|
241
|
+
if (c.value) return n.state === "speaking" ? "speaking" : n.muted ? void 0 : "listening";
|
|
242
|
+
});
|
|
243
|
+
return (t, n) => {
|
|
244
|
+
let u = ne;
|
|
245
|
+
return j(), E("div", { class: A(["pk-voice-session", { "pk-voice-session--failed": !!e.error }]) }, [
|
|
246
|
+
e.error ? (j(), E("span", U, [O(u, { name: "ri:error-warning-line" })])) : (j(), w(H, {
|
|
247
|
+
key: 1,
|
|
248
|
+
state: e.state,
|
|
249
|
+
sample: e.sample,
|
|
250
|
+
spectrum: e.spectrum
|
|
251
|
+
}, null, 8, [
|
|
252
|
+
"state",
|
|
253
|
+
"sample",
|
|
254
|
+
"spectrum"
|
|
255
|
+
])),
|
|
256
|
+
D("div", Pe, [D("span", { class: A(["pk-voice-session__state", l.value && `pk-voice-session__state--${l.value}`]) }, [c.value ? (j(), E("span", Fe)) : T("", !0), oe(" " + N(a.value), 1)], 2), e.error ? (j(), E("p", {
|
|
257
|
+
key: 0,
|
|
258
|
+
class: "pk-voice-session__detail",
|
|
259
|
+
title: e.rawError ?? e.error
|
|
260
|
+
}, N(e.error), 9, Ie)) : T("", !0)]),
|
|
261
|
+
o.value ? (j(), E("span", {
|
|
262
|
+
key: 2,
|
|
263
|
+
class: A(["pk-voice-session__timer", { "pk-voice-session__timer--warning": s.value }]),
|
|
264
|
+
title: P(i)("hint.voiceRemaining"),
|
|
265
|
+
"aria-hidden": "true"
|
|
266
|
+
}, N(o.value), 11, Le)) : T("", !0),
|
|
267
|
+
D("div", Re, [e.error ? (j(), E(S, { key: 0 }, [O(_, {
|
|
268
|
+
icon: "ri:refresh-line",
|
|
269
|
+
label: P(i)("action.retry"),
|
|
270
|
+
onClick: n[0] ||= (e) => r("retry")
|
|
271
|
+
}, null, 8, ["label"]), e.live ? (j(), w(_, {
|
|
272
|
+
key: 0,
|
|
273
|
+
icon: "ri:stop-circle-line",
|
|
274
|
+
modifiers: "danger",
|
|
275
|
+
title: P(i)("action.hangUp"),
|
|
276
|
+
"aria-label": P(i)("action.hangUp"),
|
|
277
|
+
onClick: n[1] ||= (e) => r("hang-up")
|
|
278
|
+
}, null, 8, ["title", "aria-label"])) : (j(), w(_, {
|
|
279
|
+
key: 1,
|
|
280
|
+
icon: "ri:close-line",
|
|
281
|
+
label: P(i)("action.close"),
|
|
282
|
+
onClick: n[2] ||= (e) => r("dismiss")
|
|
283
|
+
}, null, 8, ["label"]))], 64)) : (j(), E(S, { key: 1 }, [O(_, {
|
|
284
|
+
icon: e.muted ? "ri:mic-off-line" : "ri:mic-line",
|
|
285
|
+
title: e.muted ? P(i)("action.unmute") : P(i)("action.mute"),
|
|
286
|
+
"aria-label": e.muted ? P(i)("action.unmute") : P(i)("action.mute"),
|
|
287
|
+
"aria-pressed": e.muted,
|
|
288
|
+
onClick: n[3] ||= (e) => r("toggle-mute")
|
|
289
|
+
}, null, 8, [
|
|
290
|
+
"icon",
|
|
291
|
+
"title",
|
|
292
|
+
"aria-label",
|
|
293
|
+
"aria-pressed"
|
|
294
|
+
]), O(_, {
|
|
295
|
+
icon: "ri:stop-circle-line",
|
|
296
|
+
modifiers: "danger",
|
|
297
|
+
title: P(i)("action.hangUp"),
|
|
298
|
+
"aria-label": P(i)("action.hangUp"),
|
|
299
|
+
onClick: n[4] ||= (e) => r("hang-up")
|
|
300
|
+
}, null, 8, ["title", "aria-label"])], 64))])
|
|
301
|
+
], 2);
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}), Be = (e) => {
|
|
305
|
+
let t = ve(), n = M("disconnected"), r = M("listening"), i = M(), a = M([]), o = M(), s = M(), c, l, u = 0, d = !1, f = () => {
|
|
306
|
+
l &&= (clearInterval(l), void 0), o.value = void 0;
|
|
307
|
+
}, m = (e) => {
|
|
308
|
+
let t = Date.now() + e * 1e3, n = () => {
|
|
309
|
+
let e = Math.max(0, Math.ceil((t - Date.now()) / 1e3));
|
|
310
|
+
o.value = e, e === 0 && g();
|
|
311
|
+
};
|
|
312
|
+
n(), l = setInterval(n, 1e3);
|
|
313
|
+
}, h = async (t) => {
|
|
314
|
+
t && (c === t && (c = void 0), await e.closeGrant?.(t).catch(() => void 0));
|
|
315
|
+
}, g = async () => {
|
|
316
|
+
u += 1, f();
|
|
317
|
+
let e = c;
|
|
318
|
+
c = void 0;
|
|
319
|
+
let i = t.value;
|
|
320
|
+
t.value = void 0, await i?.endSession().catch(() => void 0), await h(e), n.value = "disconnected", r.value = "listening";
|
|
321
|
+
}, _ = async () => {
|
|
322
|
+
if (d || t.value || n.value === "connecting") return;
|
|
323
|
+
i.value = void 0, a.value = [], r.value = "listening", s.value = void 0, n.value = "connecting", u += 1;
|
|
324
|
+
let o = u, l = () => o === u && !d, p;
|
|
325
|
+
try {
|
|
326
|
+
let o = import("./web-CCRwq-Go.js");
|
|
327
|
+
o.catch(() => void 0);
|
|
328
|
+
let u = await e.fetchGrant();
|
|
329
|
+
if (!l()) {
|
|
330
|
+
await e.closeGrant?.(u.sessionId).catch(() => void 0);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
c = u.sessionId, p = u.sessionId, s.value = u.chatId;
|
|
334
|
+
let { VoiceConversation: d } = await o;
|
|
335
|
+
if (!l()) {
|
|
336
|
+
await h(u.sessionId);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
let g = await d.startSession({
|
|
340
|
+
signedUrl: u.signedUrl,
|
|
341
|
+
customLlmExtraBody: { voice_session_id: u.sessionId },
|
|
342
|
+
clientTools: e.clientTools?.() ?? {},
|
|
343
|
+
onStatusChange: ({ status: e }) => {
|
|
344
|
+
l() && (n.value = e);
|
|
345
|
+
},
|
|
346
|
+
onModeChange: ({ mode: t }) => {
|
|
347
|
+
if (!l()) return;
|
|
348
|
+
let n = r.value === "speaking";
|
|
349
|
+
r.value = t, n && t !== "speaking" && e.onTurnEnd?.();
|
|
350
|
+
},
|
|
351
|
+
onMessage: ({ message: t, role: n }) => {
|
|
352
|
+
if (!l()) return;
|
|
353
|
+
let r = {
|
|
354
|
+
role: n,
|
|
355
|
+
text: t
|
|
356
|
+
};
|
|
357
|
+
a.value = [...a.value, r], e.onTranscript?.(r);
|
|
358
|
+
},
|
|
359
|
+
onError: (e) => {
|
|
360
|
+
l() && (i.value = e);
|
|
361
|
+
},
|
|
362
|
+
onDisconnect: (a) => {
|
|
363
|
+
l() && (f(), t.value = void 0, n.value = "disconnected", r.value = "listening", a.reason === "error" && (i.value = a.message), h(u.sessionId), e.onTurnEnd?.());
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
if (!l()) {
|
|
367
|
+
await g.endSession().catch(() => void 0), await h(u.sessionId);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
t.value = g, m(u.maxSessionSeconds);
|
|
371
|
+
} catch (e) {
|
|
372
|
+
if (await h(p), !l()) return;
|
|
373
|
+
t.value = void 0, f(), n.value = "disconnected", i.value = e instanceof Error ? e.message : String(e);
|
|
374
|
+
}
|
|
375
|
+
}, v = () => {
|
|
376
|
+
i.value = void 0;
|
|
377
|
+
}, y = (e) => {
|
|
378
|
+
t.value?.setMicMuted(e);
|
|
379
|
+
}, b = (e) => {
|
|
380
|
+
let n = t.value;
|
|
381
|
+
if (!n || !e.trim()) return !1;
|
|
382
|
+
try {
|
|
383
|
+
return n.sendUserMessage(e), !0;
|
|
384
|
+
} catch (e) {
|
|
385
|
+
return p.warn("The spoken answer could not be sent", e), !1;
|
|
386
|
+
}
|
|
387
|
+
}, ee = (e) => {
|
|
388
|
+
let n = t.value;
|
|
389
|
+
if (!n) return 0;
|
|
390
|
+
try {
|
|
391
|
+
return e === "input" ? n.getInputVolume() : n.getOutputVolume();
|
|
392
|
+
} catch {
|
|
393
|
+
return 0;
|
|
394
|
+
}
|
|
395
|
+
}, te = (e) => {
|
|
396
|
+
let n = t.value;
|
|
397
|
+
if (n) try {
|
|
398
|
+
return e === "input" ? n.getInputByteFrequencyData() : n.getOutputByteFrequencyData();
|
|
399
|
+
} catch {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
}, x = () => {
|
|
403
|
+
let e = c;
|
|
404
|
+
c = void 0, u += 1, f(), h(e);
|
|
405
|
+
let r = t.value;
|
|
406
|
+
t.value = void 0, r?.endSession().catch(() => void 0), n.value = "disconnected";
|
|
407
|
+
};
|
|
408
|
+
return typeof window < "u" && window.addEventListener("pagehide", x), me(() => {
|
|
409
|
+
d = !0, typeof window < "u" && window.removeEventListener("pagehide", x), g();
|
|
410
|
+
}), {
|
|
411
|
+
status: n,
|
|
412
|
+
mode: r,
|
|
413
|
+
error: i,
|
|
414
|
+
transcript: a,
|
|
415
|
+
remainingSeconds: o,
|
|
416
|
+
chatId: s,
|
|
417
|
+
isActive: C(() => n.value === "connected" || n.value === "connecting"),
|
|
418
|
+
isConnecting: C(() => n.value === "connecting"),
|
|
419
|
+
isSpeaking: C(() => n.value === "connected" && r.value === "speaking"),
|
|
420
|
+
isListening: C(() => n.value === "connected" && r.value === "listening"),
|
|
421
|
+
start: _,
|
|
422
|
+
stop: g,
|
|
423
|
+
dismissError: v,
|
|
424
|
+
setMuted: y,
|
|
425
|
+
sendUserMessage: b,
|
|
426
|
+
readLevel: ee,
|
|
427
|
+
readSpectrum: te
|
|
428
|
+
};
|
|
429
|
+
}, Ve = Symbol("ChatFilePreviewDock");
|
|
430
|
+
function He(e) {
|
|
431
|
+
ge(Ve, e);
|
|
432
|
+
}
|
|
433
|
+
function Ue() {
|
|
434
|
+
return ce(Ve, void 0);
|
|
435
|
+
}
|
|
436
|
+
// ../../packages/components/src/chat/useWakeupWatch.ts
|
|
437
|
+
var We = 4e3, W = [
|
|
438
|
+
3e3,
|
|
439
|
+
5e3,
|
|
440
|
+
1e4
|
|
441
|
+
], Ge = 12e4, Ke = 6e4, qe = 216e5, Je = 3e4;
|
|
442
|
+
function Ye(e) {
|
|
443
|
+
let t = M(null), n = M(!1), r, i = !1, a = () => {
|
|
444
|
+
clearTimeout(r), r = void 0;
|
|
445
|
+
}, o = (e, t) => {
|
|
446
|
+
a(), i || (r = setTimeout(() => void t(), e));
|
|
447
|
+
}, s = (t) => {
|
|
448
|
+
let n = Date.parse(t.dueAt) - Ke;
|
|
449
|
+
return e.messages().some((e) => {
|
|
450
|
+
let r = e.metadata?.wakeup;
|
|
451
|
+
return r?.id === t.wakeId || t.kind === "task" && r?.taskId === t.taskId && (e.metadata?.createdAt ?? 0) >= n;
|
|
452
|
+
});
|
|
453
|
+
}, c = (e) => {
|
|
454
|
+
let t = Date.parse(e.dueAt) - Date.now() + We;
|
|
455
|
+
t > qe ? o(qe, l) : o(Math.max(We, t), () => u(e, Date.now(), 0));
|
|
456
|
+
};
|
|
457
|
+
async function l() {
|
|
458
|
+
a();
|
|
459
|
+
let n = e.chatId();
|
|
460
|
+
try {
|
|
461
|
+
let r = await e.apiClient().getChatWakeup(e.agentId(), n);
|
|
462
|
+
if (n !== e.chatId()) return;
|
|
463
|
+
t.value = r.pendingWakeup;
|
|
464
|
+
} catch {
|
|
465
|
+
t.value = null;
|
|
466
|
+
}
|
|
467
|
+
t.value && c(t.value);
|
|
468
|
+
}
|
|
469
|
+
async function u(t, n, r) {
|
|
470
|
+
await e.refreshMessages(), i || (s(t) || Date.now() - n >= Ge ? await l() : o(W[Math.min(r, W.length - 1)], () => u(t, n, r + 1)));
|
|
471
|
+
}
|
|
472
|
+
async function d() {
|
|
473
|
+
let r = t.value;
|
|
474
|
+
n.value = !0;
|
|
475
|
+
try {
|
|
476
|
+
let n = e.apiClient(), i = r?.kind === "task" && r.taskId ? await n.deleteChatTask(e.agentId(), e.chatId(), r.taskId) : await n.stopChatWakeup(e.agentId(), e.chatId());
|
|
477
|
+
a(), t.value = i.pendingWakeup, i.pendingWakeup && c(i.pendingWakeup);
|
|
478
|
+
} finally {
|
|
479
|
+
n.value = !1;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
function f() {
|
|
483
|
+
a(), t.value = null;
|
|
484
|
+
}
|
|
485
|
+
let p;
|
|
486
|
+
function m() {
|
|
487
|
+
p = e.chatId();
|
|
488
|
+
}
|
|
489
|
+
function h() {
|
|
490
|
+
p === e.chatId() && (p = void 0, l());
|
|
491
|
+
}
|
|
492
|
+
function g() {
|
|
493
|
+
p = void 0;
|
|
494
|
+
}
|
|
495
|
+
let _ = C(() => e.messages().some((e) => e.role === "user"));
|
|
496
|
+
F([e.chatId, _], ([, t]) => {
|
|
497
|
+
f();
|
|
498
|
+
let n = e.status(), r = n === "submitted" || n === "streaming" || p === e.chatId();
|
|
499
|
+
t && !r && l();
|
|
500
|
+
}, { immediate: !0 }), F(e.status, (e, t) => {
|
|
501
|
+
e === "ready" && t !== "ready" && _.value && l();
|
|
502
|
+
});
|
|
503
|
+
let v;
|
|
504
|
+
function y() {
|
|
505
|
+
t.value && document.visibilityState === "visible" && e.apiClient().markChatWakeupPresence(e.agentId(), e.chatId()).catch(() => void 0);
|
|
506
|
+
}
|
|
507
|
+
let b = () => y();
|
|
508
|
+
return document.addEventListener("visibilitychange", b), F(() => t.value?.wakeId, (e) => {
|
|
509
|
+
clearInterval(v), v = void 0, e && !i && (y(), v = setInterval(y, Je));
|
|
510
|
+
}), fe(() => {
|
|
511
|
+
i = !0, a(), clearInterval(v), document.removeEventListener("visibilitychange", b);
|
|
512
|
+
}), {
|
|
513
|
+
pendingWakeup: t,
|
|
514
|
+
isStopping: n,
|
|
515
|
+
check: l,
|
|
516
|
+
reset: f,
|
|
517
|
+
stop: d,
|
|
518
|
+
spokenTurnStarted: m,
|
|
519
|
+
spokenTurnsWritten: h,
|
|
520
|
+
forgetSpokenTurns: g
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
// ../../packages/components/src/chat/previewChanges.ts
|
|
524
|
+
var Xe = 1e6, Ze = (e, t) => {
|
|
525
|
+
let n = 0;
|
|
526
|
+
for (; n < e.length && n < t.length && e[n] === t[n];) n += 1;
|
|
527
|
+
let r = 0;
|
|
528
|
+
for (; r < e.length - n && r < t.length - n && e[e.length - 1 - r] === t[t.length - 1 - r];) r += 1;
|
|
529
|
+
let i = e.length - n - r, a = t.length - n - r, o = /* @__PURE__ */ new Map(), s = (e, t, n, r) => {
|
|
530
|
+
for (let i = n; i < r; i++) {
|
|
531
|
+
let r = e + (i - n);
|
|
532
|
+
o.set(i, r < t ? r : void 0);
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
if (!a) return o;
|
|
536
|
+
if (!i || i * a > Xe) return s(n, n + i, n, n + a), o;
|
|
537
|
+
let c = new Uint32Array((i + 1) * (a + 1));
|
|
538
|
+
for (let r = i - 1; r >= 0; r--) for (let i = a - 1; i >= 0; i--) c[r * (a + 1) + i] = e[n + r] === t[n + i] ? c[(r + 1) * (a + 1) + i + 1] + 1 : Math.max(c[(r + 1) * (a + 1) + i], c[r * (a + 1) + i + 1]);
|
|
539
|
+
let l = 0, u = 0, d = 0, f = 0;
|
|
540
|
+
for (; l < i && u < a;) e[n + l] === t[n + u] ? (s(n + d, n + l, n + f, n + u), l += 1, u += 1, d = l, f = u) : c[(l + 1) * (a + 1) + u] >= c[l * (a + 1) + u + 1] ? l += 1 : u += 1;
|
|
541
|
+
return s(n + d, n + i, n + f, n + a), o;
|
|
542
|
+
}, G = (e, t) => e === "id" || e === "ids" ? void 0 : t, K = (e) => JSON.stringify(e, G), Qe = (e, t) => {
|
|
543
|
+
let n = (e) => e.flatMap((e) => e.ids ?? []);
|
|
544
|
+
return t?.kind === "table" ? [...Ze(t.rows.map(K), e.rows.map(K))].flatMap(([r, i]) => {
|
|
545
|
+
let a = i === void 0 ? void 0 : t.rows[i];
|
|
546
|
+
return n(e.rows[r].filter((e, t) => !a?.[t] || K(a[t]) !== K(e)));
|
|
547
|
+
}) : n(e.rows.flat());
|
|
548
|
+
}, $e = (e, t) => {
|
|
549
|
+
let n = /* @__PURE__ */ new Set(), r = Ze(e.blocks.map(K), t.blocks.map(K));
|
|
550
|
+
for (let [i, a] of r) {
|
|
551
|
+
let r = t.blocks[i];
|
|
552
|
+
if (r.kind === "table") {
|
|
553
|
+
let t = a === void 0 ? void 0 : e.blocks[a];
|
|
554
|
+
for (let e of Qe(r, t)) n.add(e);
|
|
555
|
+
} else r.id && n.add(r.id);
|
|
556
|
+
}
|
|
557
|
+
return n;
|
|
558
|
+
}, et = (e, t) => {
|
|
559
|
+
let n = /* @__PURE__ */ new Map();
|
|
560
|
+
for (let r of t.rows) for (let t of r.cells) n.set(`${r.row}:${t.col}`, JSON.stringify({
|
|
561
|
+
...t,
|
|
562
|
+
style: t.style === void 0 ? void 0 : e.styles[t.style],
|
|
563
|
+
numFmt: t.numFmt === void 0 ? void 0 : e.numberFormats?.[t.numFmt]
|
|
564
|
+
}));
|
|
565
|
+
return n;
|
|
566
|
+
}, tt = (e, t) => {
|
|
567
|
+
let n = /* @__PURE__ */ new Map();
|
|
568
|
+
for (let r of t.sheets) {
|
|
569
|
+
let i = e.sheets.find((e) => e.name === r.name), a = et(t, r), o = i ? et(e, i) : /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set();
|
|
570
|
+
for (let [e, t] of a) o.get(e) !== t && s.add(e);
|
|
571
|
+
for (let e of o.keys()) a.has(e) || s.add(e);
|
|
572
|
+
s.size && n.set(r.name, s);
|
|
573
|
+
}
|
|
574
|
+
return n;
|
|
575
|
+
}, nt = (e, t) => {
|
|
576
|
+
if (e.kind === "word" && t.kind === "word") {
|
|
577
|
+
let n = $e(e, t);
|
|
578
|
+
return n.size ? {
|
|
579
|
+
kind: "word",
|
|
580
|
+
paragraphs: n
|
|
581
|
+
} : void 0;
|
|
582
|
+
}
|
|
583
|
+
if (e.kind === "spreadsheet" && t.kind === "spreadsheet") {
|
|
584
|
+
let n = tt(e, t);
|
|
585
|
+
return n.size ? {
|
|
586
|
+
kind: "spreadsheet",
|
|
587
|
+
cells: n
|
|
588
|
+
} : void 0;
|
|
589
|
+
}
|
|
590
|
+
}, rt = (e, t) => {
|
|
591
|
+
let n = e?.querySelector(t);
|
|
592
|
+
if (!e || !n) return !1;
|
|
593
|
+
let r = e.getBoundingClientRect(), i = n.getBoundingClientRect();
|
|
594
|
+
return (i.top < r.top || i.bottom > r.bottom) && (e.scrollTop += i.top - r.top - (r.height - i.height) / 2), (i.left < r.left || i.right > r.right) && (e.scrollLeft += i.left - r.left - (r.width - i.width) / 2), !0;
|
|
595
|
+
}, it = 4e3;
|
|
596
|
+
function at(e) {
|
|
597
|
+
let t = M(), n = M(), r = M(!1), i = M(!1), a = ve(), o = /* @__PURE__ */ new Map(), s, c = 0, l = 0, u = () => {
|
|
598
|
+
clearTimeout(s), a.value = void 0;
|
|
599
|
+
}, d = (e, t) => {
|
|
600
|
+
u();
|
|
601
|
+
let r = e && t ? nt(t, e) : void 0;
|
|
602
|
+
r && (a.value = r, s = setTimeout(u, it)), n.value = e;
|
|
603
|
+
}, f = async (n, a) => {
|
|
604
|
+
let s = ++c, u = l, f = a ? o.get(a) : void 0;
|
|
605
|
+
t.value = n, i.value = !1;
|
|
606
|
+
let p = o.get(n.storedFileName);
|
|
607
|
+
if (d(p, f), r.value = !1, p) return;
|
|
608
|
+
r.value = !0;
|
|
609
|
+
let m = () => s === c;
|
|
610
|
+
try {
|
|
611
|
+
let t = await e(n.storedFileName);
|
|
612
|
+
u === l && o.set(n.storedFileName, t), m() && d(t, f);
|
|
613
|
+
} catch {
|
|
614
|
+
m() && (i.value = !0);
|
|
615
|
+
} finally {
|
|
616
|
+
m() && (r.value = !1);
|
|
617
|
+
}
|
|
618
|
+
}, p = () => {
|
|
619
|
+
t.value = void 0, c += 1, u();
|
|
620
|
+
};
|
|
621
|
+
return {
|
|
622
|
+
target: t,
|
|
623
|
+
preview: n,
|
|
624
|
+
loading: r,
|
|
625
|
+
error: i,
|
|
626
|
+
changes: a,
|
|
627
|
+
open: f,
|
|
628
|
+
close: p,
|
|
629
|
+
reset: () => {
|
|
630
|
+
p(), o.clear(), l += 1;
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
// ../../packages/components/src/chat/PkChatbotViewChat.vue?vue&type=script&setup=true&lang.ts
|
|
635
|
+
var ot = { class: "pk-chatbot-view-chat__input-stage" }, st = {
|
|
636
|
+
key: 1,
|
|
637
|
+
class: "p-md border-t border-surface-3 text-center text-12 text-danger bg-surface-danger"
|
|
638
|
+
}, ct = {
|
|
639
|
+
key: 2,
|
|
640
|
+
class: "pk-chatbot-view-chat__read-only",
|
|
641
|
+
role: "status"
|
|
642
|
+
}, lt = { class: "pk-chatbot-view-chat__read-only-text" }, ut = { class: "pk-chatbot-view-chat__agent-chip" }, dt = {
|
|
643
|
+
key: 0,
|
|
644
|
+
class: "pk-chatbot-view-chat__agent-chip-name"
|
|
645
|
+
}, ft = {
|
|
646
|
+
key: 0,
|
|
647
|
+
class: "pk-chatbot-view-chat__drop-overlay"
|
|
648
|
+
}, pt = 1e3, mt = 3e3, ht = 6e4, gt = 3e5, _t = 6e5, vt = /* @__PURE__ */ se({
|
|
649
|
+
__name: "PkChatbotViewChat",
|
|
650
|
+
props: {
|
|
651
|
+
agentId: {},
|
|
652
|
+
modifier: {},
|
|
653
|
+
userName: {}
|
|
654
|
+
},
|
|
655
|
+
emits: [
|
|
656
|
+
"show-info",
|
|
657
|
+
"revise",
|
|
658
|
+
"selection-action"
|
|
659
|
+
],
|
|
660
|
+
setup(e, { emit: p }) {
|
|
661
|
+
let _ = k(() => import("./PkToolShowForm-DjB3fji5.js").then((e) => e.n)), S = k(() => import("./PkToolShowContactForm-2_HBPZaa.js").then((e) => e.n)), oe = k(() => import("./PkToolShowSuggestedReply-wKgwHTRO.js").then((e) => e.n)), se = k(() => import("./PkToolShowSources-uKO4MQgd.js").then((e) => e.n)), ce = k(() => import("./PkToolRequestGeolocation-CyL_M1Rm.js").then((e) => e.n)), ue = k(() => import("./PkToolRequestOAuthConnection-DWkeVLpx.js")), de = k(() => import("./PkToolShowLocation-CqqtwH_R.js").then((e) => e.n)), pe = k(() => import("./PkToolShowChart-CsPXNAb9.js")), me = k(() => import("./PkToolShowDiagram-cCbeL6MK.js")), he = k(() => import("./PkToolChatFile-BOexrlLt.js").then((e) => e.n)), _e = k(() => import("./PkToolShareDocument-Bkt9JVqk.js").then((e) => e.n)), ve = k(() => import("./PkFilePreview-Cb-1YRPN.js").then((e) => e.n)), ye = k(() => import("./PkFilePreviewDialog-Bd7kEoCB.js").then((e) => e.n)), L = e, Te = p, R = d(L.agentId), { isReadOnlyChat: z, chatProjectId: Ee, agentInterface: B, agentFileUpload: ke, agentType: Ae, agentVoice: je, actions: V, revisedAnswers: Ne, messages: H, chat: U, messageFeedbacks: Pe, feedbackDialogMessage: Fe, isFeedbackSubmitting: Ie, isFeedbackSubmitted: Le, feedbackSubmitError: Re, isLeadSubmitted: Ve, isLoadingSubmitLead: He, submitLeadError: We, input: W, inputMessagePlaceholder: Ge, isConversationBlocked: Ke, baseUrl: qe, pendingAttachments: Je, isAttachmentLimitReached: Xe, fileLimitError: Ze, apiClient: G, isDark: K, hostToolsPending: Qe, pageNoticeLevel: $e, hostConfirmation: et, agentPageAccess: tt, hostStepTitles: nt, hostStepChanges: rt, confirmationMode: it, canQueue: vt, queuedMessages: yt, backgroundAnswers: bt, inputFocusRequest: xt, pagePointer: St, pagePointerAvailable: Ct, pagePointing: wt, agentSelectionActions: Tt } = we(R);
|
|
662
|
+
ge(i, nt), ge(n, rt);
|
|
663
|
+
let Et = be("inputEl");
|
|
664
|
+
F(xt, () => {
|
|
665
|
+
Et.value?.focus();
|
|
666
|
+
}), F(St, (e) => {
|
|
667
|
+
e && Et.value?.focus();
|
|
668
|
+
});
|
|
669
|
+
let Dt = C(() => St.value ? {
|
|
670
|
+
kind: St.value.kind,
|
|
671
|
+
label: St.value.label
|
|
672
|
+
} : void 0), q = C(() => Ae.value === "reasoning" ? void 0 : ke.value), Ot = C(() => {
|
|
673
|
+
let e = q.value?.allowedMimeTypes ?? [];
|
|
674
|
+
return !!q.value?.enabled && (!e.length || e.some((e) => e.startsWith("image/")));
|
|
675
|
+
});
|
|
676
|
+
l({
|
|
677
|
+
available: () => !!Et.value && Ot.value && !Xe.value,
|
|
678
|
+
annotate: (e) => Et.value?.annotateImage(e)
|
|
679
|
+
});
|
|
680
|
+
let J = (e) => G.value.getMediaDownloadUrl(L.agentId, R.localChatId, e), { handleSubmit: kt, stopGeneration: At, regenerate: jt, onUpvote: Mt, onDownvote: Nt, onFeedback: Pt, onFeedbackSubmit: Ft, onLeadSubmit: It, startNewChat: Lt, addToolOutput: Rt, addToolApprovalResponse: zt, handleFileSelect: Bt, discardPendingAttachment: Vt, replacePendingAttachment: Ht, retryPendingAttachment: Ut, clearFileLimitError: Wt, refreshMessages: Gt, appendMessage: Kt, closePageNotice: qt, respondHostConfirmation: Jt, editQueuedMessage: Yt, removeQueuedMessage: Xt, openBackgroundAnswer: Zt, dismissBackgroundAnswer: Qt } = R, { t: Y } = xe({ useScope: "global" }), $t = C(() => Qe.value > 0), en = C(() => $t.value && U.value.status === "ready" ? "streaming" : U.value.status), tn = C(() => {
|
|
681
|
+
let { messages: e } = U.value, t = e[e.length - 1];
|
|
682
|
+
return en.value === "ready" && t?.role === "assistant" ? t.id : void 0;
|
|
683
|
+
}), nn = M(), rn;
|
|
684
|
+
F([tn, () => B.value?.nextMessageSuggestion], async ([e, t]) => {
|
|
685
|
+
if (!e || !t || v() || nn.value?.messageId === e || rn === e) return;
|
|
686
|
+
rn = e;
|
|
687
|
+
let n = await R.suggestNextMessage(e), r = n ? De(n) : void 0;
|
|
688
|
+
r && tn.value === e && (nn.value = {
|
|
689
|
+
messageId: e,
|
|
690
|
+
message: r
|
|
691
|
+
});
|
|
692
|
+
}, { immediate: !0 });
|
|
693
|
+
let an = C(() => B.value?.nextMessageSuggestion && nn.value?.messageId === tn.value ? nn.value?.message : void 0), on = g(() => tt.value?.notice), sn = C(() => $e.value ? on.value || Y(`message.pageAccessNotice.${$e.value}`) : void 0), cn = C(() => {
|
|
694
|
+
let e = Ze.value;
|
|
695
|
+
if (e) return e.reason === "per-chat" ? Y("message.fileLimitPerChat", { max: e.max }) : Y("message.fileLimitPerMessage", { max: e.max });
|
|
696
|
+
}), ln = C(() => bt.value.map(({ chatId: e, title: t }) => ({
|
|
697
|
+
id: e,
|
|
698
|
+
text: t ? Y("message.backgroundAnswerReady", { title: t }) : Y("message.backgroundAnswerReadyUntitled")
|
|
699
|
+
}))), un = g(() => B.value?.dismissableNotice), dn = C(() => H.value.some((e) => e.role === "user")), fn = C(() => L.modifier === "fullscreen" && !dn.value), pn = Oe(B, () => L.userName), mn = be("chatViewEl"), hn = Ue(), gn = C(() => !!hn?.value), _n = C(() => hn?.value ?? "body"), vn = M(0), yn = M(0);
|
|
700
|
+
Ce([mn, C(() => hn?.value ?? void 0)], (e) => {
|
|
701
|
+
for (let t of e) {
|
|
702
|
+
let e = t.borderBoxSize?.[0]?.inlineSize ?? t.contentRect.width;
|
|
703
|
+
t.target === mn.value ? vn.value = e : yn.value = e;
|
|
704
|
+
}
|
|
705
|
+
}, { box: "border-box" });
|
|
706
|
+
let bn = C(() => vn.value + (gn.value ? yn.value : 0) >= pt), xn = C(() => vn.value > 0 && vn.value < 576), { target: X, preview: Sn, loading: Cn, error: wn, changes: Tn, open: En, close: Dn, reset: On } = at((e) => G.value.getChatFilePreview(L.agentId, R.localChatId, e)), Z = M({}), kn = (e, t) => {
|
|
707
|
+
let n = (e) => e?.fileId ?? e?.storedFileName;
|
|
708
|
+
return n(e) !== n(X.value) && (Z.value = {}), En(e, t);
|
|
709
|
+
}, An = M(!1), jn = C(() => !!X.value && bn.value && !An.value), Mn = () => {
|
|
710
|
+
Dn(), An.value = !1;
|
|
711
|
+
}, Nn = /* @__PURE__ */ new Set([
|
|
712
|
+
"tool-editSpreadsheet",
|
|
713
|
+
"tool-editWordDocument",
|
|
714
|
+
"tool-createSpreadsheet",
|
|
715
|
+
"tool-createWordDocument"
|
|
716
|
+
]), Pn = C(() => {
|
|
717
|
+
let e = /* @__PURE__ */ new Map();
|
|
718
|
+
for (let t of H.value) for (let n of t.parts) {
|
|
719
|
+
let { type: t, state: r, output: i } = n;
|
|
720
|
+
if (Nn.has(t) && r === "output-available" && i?.fileId && i.version && i.storedFileName) {
|
|
721
|
+
let t = e.get(i.fileId) ?? /* @__PURE__ */ new Map();
|
|
722
|
+
t.set(i.version, i.storedFileName), e.set(i.fileId, t);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
for (let [t, n] of e) n.has(1) || n.set(1, t);
|
|
726
|
+
return e;
|
|
727
|
+
}), Fn = C(() => [...Pn.value.get(X.value?.fileId ?? "")?.keys() ?? []].sort((e, t) => e - t)), In = (e, t) => {
|
|
728
|
+
let n = X.value, r = Pn.value.get(n?.fileId ?? "")?.get(e);
|
|
729
|
+
n && r && kn({
|
|
730
|
+
...n,
|
|
731
|
+
version: e,
|
|
732
|
+
storedFileName: r
|
|
733
|
+
}, t);
|
|
734
|
+
}, Ln = C(() => {
|
|
735
|
+
let e = X.value, t = Fn.value;
|
|
736
|
+
return !!wr.value && !!e?.fileId && !!e.version && t.length > 0 && e.version < t[t.length - 1];
|
|
737
|
+
}), Rn = () => {
|
|
738
|
+
let e = X.value;
|
|
739
|
+
e?.fileId && e.version && (wr.value?.({
|
|
740
|
+
fileId: e.fileId,
|
|
741
|
+
version: e.version,
|
|
742
|
+
filename: e.filename
|
|
743
|
+
}), Mn());
|
|
744
|
+
};
|
|
745
|
+
F(() => R.localChatId, On), F(() => {
|
|
746
|
+
let e = X.value?.fileId;
|
|
747
|
+
return e ? {
|
|
748
|
+
fileId: e,
|
|
749
|
+
newest: Math.max(0, ...Fn.value)
|
|
750
|
+
} : void 0;
|
|
751
|
+
}, (e, t) => {
|
|
752
|
+
e && t && e.fileId === t.fileId && e.newest > t.newest && X.value?.version === t.newest && In(e.newest, X.value.storedFileName);
|
|
753
|
+
});
|
|
754
|
+
let zn = C(() => {
|
|
755
|
+
let e = U.value?.status;
|
|
756
|
+
if (!(Ke.value || z.value || e === "submitted" || e === "streaming")) return X.value?.kind === "word" ? Tt.value?.word : Tt.value?.excel;
|
|
757
|
+
}), Bn = C(() => en.value === "submitted" || en.value === "streaming"), Vn = () => {
|
|
758
|
+
bn.value ? An.value = !1 : Mn();
|
|
759
|
+
}, Hn = (e, t, n) => {
|
|
760
|
+
R.sendSelection(e, { filePointer: t }) && Te("selection-action", {
|
|
761
|
+
surface: t.format === "docx" ? "word" : "excel",
|
|
762
|
+
action: n.id,
|
|
763
|
+
state: "chat",
|
|
764
|
+
size: String(n.size)
|
|
765
|
+
});
|
|
766
|
+
}, Un = async (e) => (await G.value.expandSourceContext(L.agentId, e.documentId, e.chunkIndex)).content, Wn = async (e) => {
|
|
767
|
+
let t = await G.value.downloadSourceDocument(L.agentId, e);
|
|
768
|
+
window.open(t.downloadUrl, "_blank");
|
|
769
|
+
}, { isOverDropZone: Gn } = Se(mn, {
|
|
770
|
+
dataTypes: (e) => !z.value && o(e, q.value?.allowedMimeTypes ?? []),
|
|
771
|
+
onDrop: (e) => {
|
|
772
|
+
if (q.value?.enabled && e) for (let t of e) Bt(t);
|
|
773
|
+
}
|
|
774
|
+
}), Kn = M(!1), qn = !1, Q = M(!1), Jn = [
|
|
775
|
+
3e3,
|
|
776
|
+
5e3,
|
|
777
|
+
1e4
|
|
778
|
+
], Yn, Xn, Zn = !1, Qn = 0, $n = !1;
|
|
779
|
+
function er() {
|
|
780
|
+
clearTimeout(Yn), Yn = void 0, Xn = void 0, Zn = !1, Qn = 0, Q.value = !1;
|
|
781
|
+
}
|
|
782
|
+
function tr(e) {
|
|
783
|
+
qn || (clearTimeout(Yn), Yn = setTimeout(() => {
|
|
784
|
+
nr();
|
|
785
|
+
}, e));
|
|
786
|
+
}
|
|
787
|
+
async function nr() {
|
|
788
|
+
if (qn || $n) return;
|
|
789
|
+
$n = !0;
|
|
790
|
+
let e;
|
|
791
|
+
try {
|
|
792
|
+
e = await Gt();
|
|
793
|
+
} finally {
|
|
794
|
+
$n = !1;
|
|
795
|
+
}
|
|
796
|
+
if (qn) return;
|
|
797
|
+
if (e === "caught-up" && (Q.value = !1, Nr()), $.isActive.value) {
|
|
798
|
+
Xn = void 0, Zn = !1, Qn = 0, tr(mt);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
Xn === void 0 && (Xn = Date.now(), Zn = !!$.error.value);
|
|
802
|
+
let t = Date.now() - Xn;
|
|
803
|
+
if (e === "caught-up" && t >= (Zn ? gt : ht) || t >= _t) {
|
|
804
|
+
er(), Pr();
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let n = Jn[Math.min(Qn, Jn.length - 1)];
|
|
808
|
+
Qn += 1, tr(n);
|
|
809
|
+
}
|
|
810
|
+
let rr = (e = 1200) => {
|
|
811
|
+
tr(e);
|
|
812
|
+
}, ir, $ = Be({
|
|
813
|
+
fetchGrant: async () => {
|
|
814
|
+
ir = R.voicePageTools();
|
|
815
|
+
let e = await G.value.createVoiceSession(L.agentId, R.localChatId, {
|
|
816
|
+
deviceContext: R.buildDeviceContext(),
|
|
817
|
+
externalContext: R.externalContext,
|
|
818
|
+
pageTools: ir?.declaration,
|
|
819
|
+
...R.confirmationMode === "automatic" && { confirmations: "automatic" }
|
|
820
|
+
});
|
|
821
|
+
return e.chatId !== R.localChatId && (R.localChatId = e.chatId), e;
|
|
822
|
+
},
|
|
823
|
+
closeGrant: (e) => G.value.closeVoiceSession(L.agentId, e),
|
|
824
|
+
clientTools: () => ir?.clientTools,
|
|
825
|
+
onTranscript: (e) => {
|
|
826
|
+
e.role === "user" ? (Q.value = !0, Mr(), Kt({
|
|
827
|
+
id: `${f}user-${u()}`,
|
|
828
|
+
role: "user",
|
|
829
|
+
parts: [{
|
|
830
|
+
type: "text",
|
|
831
|
+
text: e.text
|
|
832
|
+
}]
|
|
833
|
+
})) : Q.value = !1;
|
|
834
|
+
},
|
|
835
|
+
onTurnEnd: () => {
|
|
836
|
+
rr();
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
F(() => $.isActive.value, (e) => {
|
|
840
|
+
e || R.cancelVoicePageCalls();
|
|
841
|
+
}), F(() => $.error.value, (e) => {
|
|
842
|
+
e && (Q.value = !1);
|
|
843
|
+
});
|
|
844
|
+
let ar = C(() => je.value?.enabled === !0), or = C(() => $.error.value ? "error" : $.isConnecting.value ? "connecting" : $.isSpeaking.value ? "speaking" : $.isActive.value ? "listening" : "idle"), sr = C(() => {
|
|
845
|
+
let e = $.error.value;
|
|
846
|
+
if (e) return /took too long/i.test(e) ? Y("message.voiceTookTooLong") : /cascade|no response|custom_llm_error/i.test(e) ? Y("message.voiceNoAnswer") : Y("message.voiceInterrupted");
|
|
847
|
+
}), cr = C(() => $.isSpeaking.value ? "output" : "input"), lr = () => $.readLevel(cr.value), ur = () => $.readSpectrum(cr.value), dr = async () => {
|
|
848
|
+
Kn.value = !1, await $.start(), $.isActive.value && (er(), tr(mt));
|
|
849
|
+
}, fr = async () => {
|
|
850
|
+
Q.value = !1, await $.stop(), qn || rr(0);
|
|
851
|
+
}, pr = () => {
|
|
852
|
+
$.dismissError();
|
|
853
|
+
}, mr = async () => {
|
|
854
|
+
$.dismissError(), await $.stop(), await dr();
|
|
855
|
+
}, hr = (e) => e?.toolCallId ?? "", gr = M(/* @__PURE__ */ new Set()), _r = (e) => gr.value.has(hr(e)), vr = M(/* @__PURE__ */ new Map()), yr = (e, t) => $.isActive.value ? ($.sendUserMessage(t) && (gr.value = new Set(gr.value).add(hr(e)), rr()), !0) : !1, br = (e, t, n) => {
|
|
856
|
+
yr(t, r(t, n)) || Rt({
|
|
857
|
+
tool: e,
|
|
858
|
+
toolCallId: hr(t),
|
|
859
|
+
output: n
|
|
860
|
+
});
|
|
861
|
+
}, xr = (e) => {
|
|
862
|
+
let t = e.confirmed ? Y("message.voiceConfirmed") : Y("message.voiceCancelled");
|
|
863
|
+
yr({ toolCallId: e.toolCallId }, t) ? gr.value.has(e.toolCallId) && (vr.value = new Map(vr.value).set(e.toolCallId, e.confirmed)) : Rt({
|
|
864
|
+
tool: "requestConfirm",
|
|
865
|
+
toolCallId: e.toolCallId,
|
|
866
|
+
output: e.confirmed ? "confirmed" : "cancelled"
|
|
867
|
+
});
|
|
868
|
+
}, Sr = C(() => {
|
|
869
|
+
let e = /* @__PURE__ */ new Map();
|
|
870
|
+
for (let t of H.value) for (let n of t.parts) {
|
|
871
|
+
let { type: t, state: r, output: i } = n;
|
|
872
|
+
Nn.has(t) && r === "output-available" && i?.fileId && i.version && e.set(i.fileId, Math.max(e.get(i.fileId) ?? 0, i.version));
|
|
873
|
+
}
|
|
874
|
+
return e;
|
|
875
|
+
}), Cr = C(() => {
|
|
876
|
+
let e = /* @__PURE__ */ new Map(), t = (t, n) => {
|
|
877
|
+
if (t && n) {
|
|
878
|
+
let r = t.toLowerCase();
|
|
879
|
+
e.set(r, (e.get(r) ?? /* @__PURE__ */ new Set()).add(n));
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
for (let e of H.value) for (let n of e.parts) {
|
|
883
|
+
if (m(n)) {
|
|
884
|
+
t(n.filename, h(n)?.storedFileName);
|
|
885
|
+
continue;
|
|
886
|
+
}
|
|
887
|
+
let { type: e, state: r, output: i } = n;
|
|
888
|
+
Nn.has(e) && r === "output-available" && i?.filename && t(a(i.filename, i.version), i.fileId);
|
|
889
|
+
}
|
|
890
|
+
return e;
|
|
891
|
+
}), wr = C(() => Ke.value || z.value ? void 0 : (e) => {
|
|
892
|
+
let t = (Cr.value.get(e.filename.toLowerCase())?.size ?? 0) > 1;
|
|
893
|
+
W.value = Y(t ? "messagePart.chatFileRestoreRequestById" : "messagePart.chatFileRestoreRequest", e), kt();
|
|
894
|
+
}), Tr = (e, t) => {
|
|
895
|
+
yr(e, t) || (W.value = t, kt());
|
|
896
|
+
}, Er = (e, t) => {
|
|
897
|
+
let n = t.error ? Y("message.voiceLocationRefused") : Y("message.voiceLocationShared", { place: t.displayName ?? `${t.latitude}, ${t.longitude}` });
|
|
898
|
+
yr(e, n) || Rt({
|
|
899
|
+
tool: "requestGeolocation",
|
|
900
|
+
toolCallId: hr(e),
|
|
901
|
+
output: t
|
|
902
|
+
});
|
|
903
|
+
}, Dr = (e, t) => {
|
|
904
|
+
yr(e, Y("message.voiceConnectionDone")) || Rt({
|
|
905
|
+
tool: "requestOAuthConnection",
|
|
906
|
+
toolCallId: hr(e),
|
|
907
|
+
output: {
|
|
908
|
+
connected: !0,
|
|
909
|
+
mcpServerId: t
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
}, Or = () => {
|
|
913
|
+
Kn.value = !Kn.value, $.setMuted(Kn.value);
|
|
914
|
+
};
|
|
915
|
+
fe(() => {
|
|
916
|
+
qn = !0, er();
|
|
917
|
+
});
|
|
918
|
+
let { pendingWakeup: kr, isStopping: Ar, stop: jr, spokenTurnStarted: Mr, spokenTurnsWritten: Nr, forgetSpokenTurns: Pr } = Ye({
|
|
919
|
+
agentId: () => L.agentId,
|
|
920
|
+
chatId: () => R.localChatId,
|
|
921
|
+
apiClient: () => G.value,
|
|
922
|
+
messages: () => H.value,
|
|
923
|
+
refreshMessages: Gt,
|
|
924
|
+
status: () => U.value.status
|
|
925
|
+
});
|
|
926
|
+
return (n, r) => {
|
|
927
|
+
let i = ne, a = c;
|
|
928
|
+
return j(), E("div", {
|
|
929
|
+
ref_key: "chatViewEl",
|
|
930
|
+
ref: mn,
|
|
931
|
+
class: A(["pk-chatbot-view-chat", {
|
|
932
|
+
"pk-chatbot-view-chat--dragover": P(Gn) && q.value?.enabled,
|
|
933
|
+
"pk-chatbot-view-chat--empty": fn.value,
|
|
934
|
+
"pk-chatbot-view-chat--with-preview": jn.value && !gn.value
|
|
935
|
+
}])
|
|
936
|
+
}, [
|
|
937
|
+
O(ie, {
|
|
938
|
+
name: "pk-chatbot-view-chat-fade",
|
|
939
|
+
mode: "out-in"
|
|
940
|
+
}, {
|
|
941
|
+
default: I(() => [fn.value ? (j(), w(te, {
|
|
942
|
+
key: 0,
|
|
943
|
+
greeting: P(pn),
|
|
944
|
+
logo: P(B)?.logo,
|
|
945
|
+
name: P(R).name
|
|
946
|
+
}, null, 8, [
|
|
947
|
+
"greeting",
|
|
948
|
+
"logo",
|
|
949
|
+
"name"
|
|
950
|
+
])) : (j(), w(s, {
|
|
951
|
+
key: 1,
|
|
952
|
+
class: "flex flex-col flex-1 min-h-0 p-md overflow-y-auto",
|
|
953
|
+
interactive: !P(z),
|
|
954
|
+
messages: P(H),
|
|
955
|
+
"confirm-verdicts-on-call": vr.value,
|
|
956
|
+
status: P(U).status,
|
|
957
|
+
error: P(U).error,
|
|
958
|
+
"main-color": P(B)?.mainColor,
|
|
959
|
+
"text-color": P(B)?.textColor,
|
|
960
|
+
"revised-answers": P(Ne),
|
|
961
|
+
actions: P(z) ? [] : P(V),
|
|
962
|
+
"message-feedbacks": P(Pe),
|
|
963
|
+
"feedback-message-id": P(Fe)?.id,
|
|
964
|
+
"feedback-loading": P(Ie),
|
|
965
|
+
"feedback-submitted": P(Le),
|
|
966
|
+
"feedback-error": P(Re),
|
|
967
|
+
"show-extended-steps": P(B)?.showExtendedSteps,
|
|
968
|
+
"hide-reasoning": P(B)?.showReasoning === !1,
|
|
969
|
+
"awaiting-spoken-answer": Q.value,
|
|
970
|
+
"host-working": $t.value,
|
|
971
|
+
"host-confirmation": P(et),
|
|
972
|
+
"is-dark": P(K),
|
|
973
|
+
"show-scroll-to-bottom": e.modifier === "fullscreen",
|
|
974
|
+
onFeedbackSubmit: r[0] ||= (e) => P(Ft)(e),
|
|
975
|
+
onFeedbackClose: r[1] ||= (e) => Fe.value = void 0,
|
|
976
|
+
onRegenerate: P(jt),
|
|
977
|
+
onAutoRetry: P(jt),
|
|
978
|
+
onResetChat: P(Lt),
|
|
979
|
+
onShowInfo: r[2] ||= (e) => Te("show-info", e),
|
|
980
|
+
onRevise: r[3] ||= (e) => Te("revise", e),
|
|
981
|
+
onUpvote: P(Mt),
|
|
982
|
+
onDownvote: P(Nt),
|
|
983
|
+
onFeedback: P(Pt),
|
|
984
|
+
onApprovalRespond: P(zt),
|
|
985
|
+
onConfirmRespond: xr,
|
|
986
|
+
onHostConfirmRespond: P(Jt)
|
|
987
|
+
}, {
|
|
988
|
+
"tool-showContactForm": I(({ part: e }) => [O(P(S), {
|
|
989
|
+
part: e,
|
|
990
|
+
record: P(z),
|
|
991
|
+
readonly: !P(qe),
|
|
992
|
+
submitted: P(Ve),
|
|
993
|
+
loading: P(He),
|
|
994
|
+
error: P(We),
|
|
995
|
+
"privacy-policy-notice": P(B)?.privacyPolicyNotice,
|
|
996
|
+
onSubmit: P(It)
|
|
997
|
+
}, null, 8, [
|
|
998
|
+
"part",
|
|
999
|
+
"record",
|
|
1000
|
+
"readonly",
|
|
1001
|
+
"submitted",
|
|
1002
|
+
"loading",
|
|
1003
|
+
"error",
|
|
1004
|
+
"privacy-policy-notice",
|
|
1005
|
+
"onSubmit"
|
|
1006
|
+
])]),
|
|
1007
|
+
"tool-showSuggestedReply": I(({ part: e }) => [O(P(oe), {
|
|
1008
|
+
part: e,
|
|
1009
|
+
record: P(z),
|
|
1010
|
+
onSelect: (t) => Tr(e, t)
|
|
1011
|
+
}, null, 8, [
|
|
1012
|
+
"part",
|
|
1013
|
+
"record",
|
|
1014
|
+
"onSelect"
|
|
1015
|
+
])]),
|
|
1016
|
+
"tool-showSources": I(({ part: e }) => [O(P(se), {
|
|
1017
|
+
part: e,
|
|
1018
|
+
"on-expand-context": Un,
|
|
1019
|
+
"on-download": Wn
|
|
1020
|
+
}, null, 8, ["part"])]),
|
|
1021
|
+
"tool-showForm": I(({ part: e }) => [O(ie, { mode: "out-in" }, {
|
|
1022
|
+
default: I(() => [O(P(_), {
|
|
1023
|
+
part: e,
|
|
1024
|
+
record: P(z),
|
|
1025
|
+
answered: _r(e),
|
|
1026
|
+
onSelect: (t) => br("showForm", e, t)
|
|
1027
|
+
}, null, 8, [
|
|
1028
|
+
"part",
|
|
1029
|
+
"record",
|
|
1030
|
+
"answered",
|
|
1031
|
+
"onSelect"
|
|
1032
|
+
])]),
|
|
1033
|
+
_: 2
|
|
1034
|
+
}, 1024)]),
|
|
1035
|
+
"tool-showMultipleChoice": I(({ part: e }) => [O(ie, { mode: "out-in" }, {
|
|
1036
|
+
default: I(() => [O(P(_), {
|
|
1037
|
+
part: e,
|
|
1038
|
+
"allow-custom-answer": "",
|
|
1039
|
+
record: P(z),
|
|
1040
|
+
answered: _r(e),
|
|
1041
|
+
onSelect: (t) => br("showMultipleChoice", e, t)
|
|
1042
|
+
}, null, 8, [
|
|
1043
|
+
"part",
|
|
1044
|
+
"record",
|
|
1045
|
+
"answered",
|
|
1046
|
+
"onSelect"
|
|
1047
|
+
])]),
|
|
1048
|
+
_: 2
|
|
1049
|
+
}, 1024)]),
|
|
1050
|
+
"tool-requestOAuthConnection": I(({ part: e }) => [O(P(ue), {
|
|
1051
|
+
part: e,
|
|
1052
|
+
"backend-url": P(qe),
|
|
1053
|
+
"resolve-connection": (e) => P(G).getOAuthAuthorizeUrl(L.agentId, e),
|
|
1054
|
+
"check-connection": (e) => P(G).getOAuthConnectionStatus(L.agentId, e),
|
|
1055
|
+
onConnected: (t) => Dr(e, t)
|
|
1056
|
+
}, null, 8, [
|
|
1057
|
+
"part",
|
|
1058
|
+
"backend-url",
|
|
1059
|
+
"resolve-connection",
|
|
1060
|
+
"check-connection",
|
|
1061
|
+
"onConnected"
|
|
1062
|
+
])]),
|
|
1063
|
+
"tool-requestGeolocation": I(({ part: e }) => [O(P(ce), {
|
|
1064
|
+
part: e,
|
|
1065
|
+
"call-live": P($).isActive.value,
|
|
1066
|
+
"reverse-geocode": (e, t) => P(G).reverseGeocode(e, t),
|
|
1067
|
+
onResult: (t) => Er(e, t)
|
|
1068
|
+
}, null, 8, [
|
|
1069
|
+
"part",
|
|
1070
|
+
"call-live",
|
|
1071
|
+
"reverse-geocode",
|
|
1072
|
+
"onResult"
|
|
1073
|
+
])]),
|
|
1074
|
+
"tool-showLocation": I(({ part: e }) => [O(P(de), {
|
|
1075
|
+
part: e,
|
|
1076
|
+
"is-dark": P(K),
|
|
1077
|
+
"main-color": P(B)?.mainColor,
|
|
1078
|
+
"forward-geocode": (e, t) => P(G).forwardGeocode(e, t)
|
|
1079
|
+
}, null, 8, [
|
|
1080
|
+
"part",
|
|
1081
|
+
"is-dark",
|
|
1082
|
+
"main-color",
|
|
1083
|
+
"forward-geocode"
|
|
1084
|
+
])]),
|
|
1085
|
+
"tool-showChart": I(({ part: e }) => [O(P(pe), {
|
|
1086
|
+
part: e,
|
|
1087
|
+
"is-dark": P(K)
|
|
1088
|
+
}, null, 8, ["part", "is-dark"])]),
|
|
1089
|
+
"tool-showDiagram": I(({ part: e }) => [O(P(me), {
|
|
1090
|
+
part: e,
|
|
1091
|
+
"is-dark": P(K)
|
|
1092
|
+
}, null, 8, ["part", "is-dark"])]),
|
|
1093
|
+
"tool-editSpreadsheet": I(({ part: e }) => [(j(), w(P(he), {
|
|
1094
|
+
key: P(t)(e),
|
|
1095
|
+
part: e,
|
|
1096
|
+
"file-url": J,
|
|
1097
|
+
preview: kn,
|
|
1098
|
+
"latest-versions": Sr.value,
|
|
1099
|
+
restore: wr.value
|
|
1100
|
+
}, null, 8, [
|
|
1101
|
+
"part",
|
|
1102
|
+
"latest-versions",
|
|
1103
|
+
"restore"
|
|
1104
|
+
]))]),
|
|
1105
|
+
"tool-editWordDocument": I(({ part: e }) => [(j(), w(P(he), {
|
|
1106
|
+
key: P(t)(e),
|
|
1107
|
+
part: e,
|
|
1108
|
+
"file-url": J,
|
|
1109
|
+
preview: kn,
|
|
1110
|
+
"latest-versions": Sr.value,
|
|
1111
|
+
restore: wr.value
|
|
1112
|
+
}, null, 8, [
|
|
1113
|
+
"part",
|
|
1114
|
+
"latest-versions",
|
|
1115
|
+
"restore"
|
|
1116
|
+
]))]),
|
|
1117
|
+
"tool-createSpreadsheet": I(({ part: e }) => [(j(), w(P(he), {
|
|
1118
|
+
key: P(t)(e),
|
|
1119
|
+
part: e,
|
|
1120
|
+
"file-url": J,
|
|
1121
|
+
preview: kn,
|
|
1122
|
+
"latest-versions": Sr.value,
|
|
1123
|
+
restore: wr.value
|
|
1124
|
+
}, null, 8, [
|
|
1125
|
+
"part",
|
|
1126
|
+
"latest-versions",
|
|
1127
|
+
"restore"
|
|
1128
|
+
]))]),
|
|
1129
|
+
"tool-createWordDocument": I(({ part: e }) => [(j(), w(P(he), {
|
|
1130
|
+
key: P(t)(e),
|
|
1131
|
+
part: e,
|
|
1132
|
+
"file-url": J,
|
|
1133
|
+
preview: kn,
|
|
1134
|
+
"latest-versions": Sr.value,
|
|
1135
|
+
restore: wr.value
|
|
1136
|
+
}, null, 8, [
|
|
1137
|
+
"part",
|
|
1138
|
+
"latest-versions",
|
|
1139
|
+
"restore"
|
|
1140
|
+
]))]),
|
|
1141
|
+
"tool-shareDocument": I(({ part: e }) => [(j(), w(P(_e), {
|
|
1142
|
+
key: P(t)(e),
|
|
1143
|
+
part: e,
|
|
1144
|
+
"on-download": Wn
|
|
1145
|
+
}, null, 8, ["part"]))]),
|
|
1146
|
+
_: 1
|
|
1147
|
+
}, 8, /* @__PURE__ */ "interactive.messages.confirm-verdicts-on-call.status.error.main-color.text-color.revised-answers.actions.message-feedbacks.feedback-message-id.feedback-loading.feedback-submitted.feedback-error.show-extended-steps.hide-reasoning.awaiting-spoken-answer.host-working.host-confirmation.is-dark.show-scroll-to-bottom.onRegenerate.onAutoRetry.onResetChat.onUpvote.onDownvote.onFeedback.onApprovalRespond.onHostConfirmRespond".split(".")))]),
|
|
1148
|
+
_: 1
|
|
1149
|
+
}),
|
|
1150
|
+
P(yt).length ? (j(), w(ee, {
|
|
1151
|
+
key: 0,
|
|
1152
|
+
messages: P(yt),
|
|
1153
|
+
onEdit: P(Yt),
|
|
1154
|
+
onRemove: P(Xt)
|
|
1155
|
+
}, null, 8, [
|
|
1156
|
+
"messages",
|
|
1157
|
+
"onEdit",
|
|
1158
|
+
"onRemove"
|
|
1159
|
+
])) : T("", !0),
|
|
1160
|
+
D("div", ot, [
|
|
1161
|
+
O(ie, { name: "pk-chatbot-view-chat-fade" }, {
|
|
1162
|
+
default: I(() => [fn.value ? (j(), w(Me, {
|
|
1163
|
+
key: 0,
|
|
1164
|
+
class: "pk-chatbot-view-chat__aurora",
|
|
1165
|
+
"source-selector": ".pk-chatbot-input__form",
|
|
1166
|
+
"main-color": P(B)?.mainColor,
|
|
1167
|
+
tones: P(B)?.glowTones,
|
|
1168
|
+
"second-color": P(B)?.glowSecondColor
|
|
1169
|
+
}, null, 8, [
|
|
1170
|
+
"main-color",
|
|
1171
|
+
"tones",
|
|
1172
|
+
"second-color"
|
|
1173
|
+
])) : T("", !0)]),
|
|
1174
|
+
_: 1
|
|
1175
|
+
}),
|
|
1176
|
+
P(kr) && !P(Ke) && !P(z) ? (j(), w(x, {
|
|
1177
|
+
key: 0,
|
|
1178
|
+
pending: P(kr),
|
|
1179
|
+
stopping: P(Ar),
|
|
1180
|
+
onStop: P(jr)
|
|
1181
|
+
}, null, 8, [
|
|
1182
|
+
"pending",
|
|
1183
|
+
"stopping",
|
|
1184
|
+
"onStop"
|
|
1185
|
+
])) : T("", !0),
|
|
1186
|
+
P(Ke) ? (j(), E("div", st, N(P(Y)("message.chatErrorConversationBlocked")), 1)) : P(z) ? (j(), E("div", ct, [
|
|
1187
|
+
O(i, {
|
|
1188
|
+
name: "ri:eye-line",
|
|
1189
|
+
class: "shrink-0 w-18 h-18"
|
|
1190
|
+
}),
|
|
1191
|
+
D("span", lt, N(P(Y)("chatProjects.readOnly")), 1),
|
|
1192
|
+
P(Ee) ? (j(), w(a, {
|
|
1193
|
+
key: 0,
|
|
1194
|
+
modifiers: "action-quiet",
|
|
1195
|
+
icon: "ri:edit-box-line",
|
|
1196
|
+
label: P(Y)("chatProjects.newChat"),
|
|
1197
|
+
onClick: r[4] ||= (e) => P(R).startNewChat({ projectId: P(Ee) })
|
|
1198
|
+
}, null, 8, ["label"])) : T("", !0)
|
|
1199
|
+
])) : or.value === "idle" ? (j(), w(y, {
|
|
1200
|
+
key: 4,
|
|
1201
|
+
ref_key: "inputEl",
|
|
1202
|
+
ref: Et,
|
|
1203
|
+
modelValue: P(W),
|
|
1204
|
+
"onUpdate:modelValue": r[5] ||= (e) => le(W) ? W.value = e : null,
|
|
1205
|
+
"pending-attachments": P(Je),
|
|
1206
|
+
"onUpdate:pendingAttachments": r[6] ||= (e) => le(Je) ? Je.value = e : null,
|
|
1207
|
+
placeholder: P(Ge),
|
|
1208
|
+
suggestion: an.value,
|
|
1209
|
+
"dismissable-notice": P(un) && P(U).messages.length <= 1 ? P(un) : void 0,
|
|
1210
|
+
"page-notice": sn.value,
|
|
1211
|
+
status: en.value,
|
|
1212
|
+
"max-message-length": P(B)?.maxMessageLength,
|
|
1213
|
+
"file-upload": q.value,
|
|
1214
|
+
"attachment-limit-reached": P(Xe),
|
|
1215
|
+
"attachment-notice": cn.value,
|
|
1216
|
+
"voice-enabled": ar.value,
|
|
1217
|
+
"queue-enabled": P(vt),
|
|
1218
|
+
"answer-notices": ln.value,
|
|
1219
|
+
"pointer-available": P(Ct),
|
|
1220
|
+
pointing: P(wt),
|
|
1221
|
+
pointer: Dt.value,
|
|
1222
|
+
"automatic-confirmations": P(it) === "automatic",
|
|
1223
|
+
"editable-images": "",
|
|
1224
|
+
"retryable-attachments": "",
|
|
1225
|
+
onPoint: r[7] ||= (e) => P(R).pagePointerStart?.(),
|
|
1226
|
+
onRemovePointer: r[8] ||= (e) => St.value = void 0,
|
|
1227
|
+
onManualConfirmations: r[9] ||= (e) => P(R).setConfirmationMode("manual"),
|
|
1228
|
+
onStopGeneration: P(At),
|
|
1229
|
+
onSubmit: P(kt),
|
|
1230
|
+
onFileSelect: P(Bt),
|
|
1231
|
+
onRemoveAttachment: P(Vt),
|
|
1232
|
+
onReplaceAttachment: P(Ht),
|
|
1233
|
+
onRetryAttachment: P(Ut),
|
|
1234
|
+
onDismissAttachmentNotice: P(Wt),
|
|
1235
|
+
onDismissPageNotice: P(qt),
|
|
1236
|
+
onOpenAnswerNotice: P(Zt),
|
|
1237
|
+
onDismissAnswerNotice: P(Qt),
|
|
1238
|
+
onVoiceStart: dr
|
|
1239
|
+
}, ae({ _: 2 }, [e.modifier === "fullscreen" ? {
|
|
1240
|
+
name: "prepend",
|
|
1241
|
+
fn: I(() => [D("span", ut, [O(b, {
|
|
1242
|
+
class: "pk-chatbot-view-chat__agent-chip-avatar",
|
|
1243
|
+
"img-src": P(B)?.logo,
|
|
1244
|
+
name: P(R).name
|
|
1245
|
+
}, null, 8, ["img-src", "name"]), P(R).name ? (j(), E("strong", dt, N(P(R).name), 1)) : T("", !0)])]),
|
|
1246
|
+
key: "0"
|
|
1247
|
+
} : void 0]), 1032, /* @__PURE__ */ "modelValue.pending-attachments.placeholder.suggestion.dismissable-notice.page-notice.status.max-message-length.file-upload.attachment-limit-reached.attachment-notice.voice-enabled.queue-enabled.answer-notices.pointer-available.pointing.pointer.automatic-confirmations.onStopGeneration.onSubmit.onFileSelect.onRemoveAttachment.onReplaceAttachment.onRetryAttachment.onDismissAttachmentNotice.onDismissPageNotice.onOpenAnswerNotice.onDismissAnswerNotice".split("."))) : (j(), w(ze, {
|
|
1248
|
+
key: 3,
|
|
1249
|
+
state: or.value,
|
|
1250
|
+
sample: lr,
|
|
1251
|
+
spectrum: ur,
|
|
1252
|
+
"remaining-seconds": P($).remainingSeconds.value,
|
|
1253
|
+
muted: Kn.value,
|
|
1254
|
+
error: sr.value,
|
|
1255
|
+
"raw-error": P($).error.value,
|
|
1256
|
+
live: P($).isActive.value,
|
|
1257
|
+
class: "pk-chatbot-view-chat__voice",
|
|
1258
|
+
onToggleMute: Or,
|
|
1259
|
+
onHangUp: fr,
|
|
1260
|
+
onRetry: mr,
|
|
1261
|
+
onDismiss: pr
|
|
1262
|
+
}, null, 8, [
|
|
1263
|
+
"state",
|
|
1264
|
+
"remaining-seconds",
|
|
1265
|
+
"muted",
|
|
1266
|
+
"error",
|
|
1267
|
+
"raw-error",
|
|
1268
|
+
"live"
|
|
1269
|
+
]))
|
|
1270
|
+
]),
|
|
1271
|
+
O(ie, null, {
|
|
1272
|
+
default: I(() => [P(Gn) && q.value?.enabled ? (j(), E("div", ft, [O(i, {
|
|
1273
|
+
name: "ri:upload-cloud-2-line",
|
|
1274
|
+
class: "pk-chatbot-view-chat__drop-overlay-icon"
|
|
1275
|
+
}), D("span", null, N(P(Y)("action.dropFile")), 1)])) : T("", !0)]),
|
|
1276
|
+
_: 1
|
|
1277
|
+
}),
|
|
1278
|
+
jn.value ? (j(), w(re, {
|
|
1279
|
+
key: 1,
|
|
1280
|
+
to: _n.value,
|
|
1281
|
+
disabled: !gn.value
|
|
1282
|
+
}, [D("aside", { class: A(["pk-chatbot-view-chat__preview", { "pk-chatbot-view-chat__preview--docked": gn.value }]) }, [P(X) ? (j(), w(P(ve), {
|
|
1283
|
+
key: 0,
|
|
1284
|
+
mode: Z.value.mode,
|
|
1285
|
+
"onUpdate:mode": r[10] ||= (e) => Z.value.mode = e,
|
|
1286
|
+
sheet: Z.value.sheet,
|
|
1287
|
+
"onUpdate:sheet": r[11] ||= (e) => Z.value.sheet = e,
|
|
1288
|
+
zoom: Z.value.zoom,
|
|
1289
|
+
"onUpdate:zoom": r[12] ||= (e) => Z.value.zoom = e,
|
|
1290
|
+
fit: Z.value.fit,
|
|
1291
|
+
"onUpdate:fit": r[13] ||= (e) => Z.value.fit = e,
|
|
1292
|
+
kind: P(X).kind,
|
|
1293
|
+
filename: P(X).filename,
|
|
1294
|
+
version: P(X).version,
|
|
1295
|
+
versions: Fn.value,
|
|
1296
|
+
"download-url": J(P(X).storedFileName),
|
|
1297
|
+
preview: P(Sn),
|
|
1298
|
+
changes: P(Tn),
|
|
1299
|
+
loading: P(Cn),
|
|
1300
|
+
error: P(wn),
|
|
1301
|
+
restorable: Ln.value,
|
|
1302
|
+
resize: "expand",
|
|
1303
|
+
"file-id": P(X).fileId,
|
|
1304
|
+
"stored-file-name": P(X).storedFileName,
|
|
1305
|
+
"selection-actions": zn.value,
|
|
1306
|
+
onVersion: In,
|
|
1307
|
+
onRestore: Rn,
|
|
1308
|
+
onResize: r[14] ||= (e) => An.value = !0,
|
|
1309
|
+
onSelectionSend: Hn,
|
|
1310
|
+
onClose: Mn
|
|
1311
|
+
}, null, 8, [
|
|
1312
|
+
"mode",
|
|
1313
|
+
"sheet",
|
|
1314
|
+
"zoom",
|
|
1315
|
+
"fit",
|
|
1316
|
+
"kind",
|
|
1317
|
+
"filename",
|
|
1318
|
+
"version",
|
|
1319
|
+
"versions",
|
|
1320
|
+
"download-url",
|
|
1321
|
+
"preview",
|
|
1322
|
+
"changes",
|
|
1323
|
+
"loading",
|
|
1324
|
+
"error",
|
|
1325
|
+
"restorable",
|
|
1326
|
+
"file-id",
|
|
1327
|
+
"stored-file-name",
|
|
1328
|
+
"selection-actions"
|
|
1329
|
+
])) : T("", !0)], 2)], 8, ["to", "disabled"])) : T("", !0),
|
|
1330
|
+
P(X) && !jn.value ? (j(), w(P(ye), {
|
|
1331
|
+
key: 2,
|
|
1332
|
+
mode: Z.value.mode,
|
|
1333
|
+
"onUpdate:mode": r[15] ||= (e) => Z.value.mode = e,
|
|
1334
|
+
sheet: Z.value.sheet,
|
|
1335
|
+
"onUpdate:sheet": r[16] ||= (e) => Z.value.sheet = e,
|
|
1336
|
+
zoom: Z.value.zoom,
|
|
1337
|
+
"onUpdate:zoom": r[17] ||= (e) => Z.value.zoom = e,
|
|
1338
|
+
fit: Z.value.fit,
|
|
1339
|
+
"onUpdate:fit": r[18] ||= (e) => Z.value.fit = e,
|
|
1340
|
+
target: P(X),
|
|
1341
|
+
versions: Fn.value,
|
|
1342
|
+
"download-url": J(P(X).storedFileName),
|
|
1343
|
+
preview: P(Sn),
|
|
1344
|
+
changes: P(Tn),
|
|
1345
|
+
loading: P(Cn),
|
|
1346
|
+
error: P(wn),
|
|
1347
|
+
restorable: Ln.value,
|
|
1348
|
+
resize: bn.value ? "shrink" : void 0,
|
|
1349
|
+
fullscreen: xn.value,
|
|
1350
|
+
"selection-actions": zn.value,
|
|
1351
|
+
working: Bn.value,
|
|
1352
|
+
onVersion: In,
|
|
1353
|
+
onRestore: Rn,
|
|
1354
|
+
onResize: r[19] ||= (e) => An.value = !1,
|
|
1355
|
+
onSelectionSend: Hn,
|
|
1356
|
+
onShowChat: Vn,
|
|
1357
|
+
onClose: Mn
|
|
1358
|
+
}, null, 8, [
|
|
1359
|
+
"mode",
|
|
1360
|
+
"sheet",
|
|
1361
|
+
"zoom",
|
|
1362
|
+
"fit",
|
|
1363
|
+
"target",
|
|
1364
|
+
"versions",
|
|
1365
|
+
"download-url",
|
|
1366
|
+
"preview",
|
|
1367
|
+
"changes",
|
|
1368
|
+
"loading",
|
|
1369
|
+
"error",
|
|
1370
|
+
"restorable",
|
|
1371
|
+
"resize",
|
|
1372
|
+
"fullscreen",
|
|
1373
|
+
"selection-actions",
|
|
1374
|
+
"working"
|
|
1375
|
+
])) : T("", !0)
|
|
1376
|
+
], 2);
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
export { ze as a, He as i, at as n, H as o, rt as r, Me as s, vt as t };
|
|
1381
|
+
|
|
1382
|
+
//# sourceMappingURL=PkChatbotViewChat-CLQ0J9_f.js.map
|