@8wave/ai-elements 0.122.0-beta.9 → 0.122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/PkStreamingMarkdown-Dc0R0GHe.js.map +1 -1
- package/dist/_chunks/PkToolChatFile-CScP_O0D.js +193 -0
- package/dist/_chunks/PkToolChatFile-CScP_O0D.js.map +1 -0
- package/dist/_chunks/PkWordPreview-COVeYzqX.js +120 -0
- package/dist/_chunks/PkWordPreview-COVeYzqX.js.map +1 -0
- package/dist/ai-elements.es.js +516 -401
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.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/{PkChatbot-B7JaLUZw.js → PkChatbot-CxbPkjhQ.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-B7JaLUZw.js.map → PkChatbot-CxbPkjhQ.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotViewChat-gcim5jsW.js +1003 -0
- package/dist-vue/_chunks/PkChatbotViewChat-gcim5jsW.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-4ZJF-y5q.js → PkChatbotViewConversations-ZdDraX9c.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-4ZJF-y5q.js.map → PkChatbotViewConversations-ZdDraX9c.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-CfPwNcvf.js → PkChatbotViewFiles-BqZ3CJm5.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-CfPwNcvf.js.map → PkChatbotViewFiles-BqZ3CJm5.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dd8EhOx3.js → PkChatbotViewProfile-CANtq-SY.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-Dd8EhOx3.js.map → PkChatbotViewProfile-CANtq-SY.js.map} +1 -1
- package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js +191 -0
- package/dist-vue/_chunks/PkToolChatFile-iOyeQBp6.js.map +1 -0
- package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js +115 -0
- package/dist-vue/_chunks/PkWordPreview-azW8wfJe.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-y6jA42S0.js → createChatbotApiClient-Cu1nDV3E.js} +4 -1
- package/dist-vue/_chunks/{createChatbotApiClient-y6jA42S0.js.map → createChatbotApiClient-Cu1nDV3E.js.map} +1 -1
- package/dist-vue/_chunks/{useChatbotStore-DCXyql8U.js → useChatbotStore-CPl6KHny.js} +2 -2
- package/dist-vue/_chunks/{useChatbotStore-DCXyql8U.js.map → useChatbotStore-CPl6KHny.js.map} +1 -1
- package/dist-vue/_chunks/utils-DaAIWTtt.js.map +1 -1
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +32 -2
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +6 -6
- package/dist-vue/locales.js +28 -0
- package/dist-vue/packages/components/src/chat/PkToolChatFile.d.ts +3 -0
- package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +29 -0
- package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +13 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +6 -0
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +3 -1
- package/dist-vue/packages/models/src/schema/WordPreview.d.ts +134 -0
- package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkToolChatFile-BsvJIdgo.js +0 -181
- package/dist/_chunks/PkToolChatFile-BsvJIdgo.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-Djts78Oq.js +0 -921
- package/dist-vue/_chunks/PkChatbotViewChat-Djts78Oq.js.map +0 -1
- package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js +0 -179
- package/dist-vue/_chunks/PkToolChatFile-s46esp0O.js.map +0 -1
|
@@ -1,921 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./PkChatbotMessages-qkodgdDE.js";
|
|
2
|
-
import { o as t } from "./Media-DylqhvaF.js";
|
|
3
|
-
import { a as n, n as r, t as i } from "./useChatbotStore-DCXyql8U.js";
|
|
4
|
-
import { n as a } from "./src-B-ZKEhTU.js";
|
|
5
|
-
import { c as o, h as s, n as c } from "./utils-DaAIWTtt.js";
|
|
6
|
-
import { t as l } from "./useLocalizedString-Dmn92nix.js";
|
|
7
|
-
import { t as u } from "./PkAvatar-DwtZWSW4.js";
|
|
8
|
-
import { n as d, t as f } from "./PkChatbotInput-BT51V-v4.js";
|
|
9
|
-
import { t as p } from "./PkChatbotQueuedMessages-CIJFAvE2.js";
|
|
10
|
-
import { t as ee } from "./PkChatbotEmptyState-B76oD7fB.js";
|
|
11
|
-
import { t as m } from "./PkChatbotWakeupBar-DEP-d-Fp.js";
|
|
12
|
-
import { VvIcon as h } from "@volverjs/ui-vue/components";
|
|
13
|
-
import { Fragment as g, Transition as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createSlots as te, createTextVNode as ne, createVNode as C, defineAsyncComponent as w, defineComponent as T, isRef as re, nextTick as ie, normalizeClass as E, onBeforeUnmount as ae, onMounted as oe, onScopeDispose as se, onUnmounted as ce, openBlock as D, provide as le, ref as O, renderList as ue, shallowRef as k, toDisplayString as A, toValue as de, unref as j, useTemplateRef as M, watch as N, withCtx as P } from "vue";
|
|
14
|
-
import { useI18n as fe } from "vue-i18n";
|
|
15
|
-
import { useDropZone as pe } from "@vueuse/core";
|
|
16
|
-
import { storeToRefs as me } from "pinia";
|
|
17
|
-
// ../../packages/composable/src/chatbot/useGreeting.ts
|
|
18
|
-
function he(e, t) {
|
|
19
|
-
let { locale: n, t: r, te: i } = fe({ useScope: "global" });
|
|
20
|
-
return v(() => F(de(e)?.greeting?.[0]?.[n.value] ?? "", de(t)) || (i("message.defaultAgentWelcome") ? r("message.defaultAgentWelcome") : ""));
|
|
21
|
-
}
|
|
22
|
-
function F(e, t) {
|
|
23
|
-
return (t ? e.replace(/\{name\}/g, t) : e.replace(/[,\s]*\{name\}[!?]?/g, "")).trim();
|
|
24
|
-
}
|
|
25
|
-
// ../../packages/components/src/chat/PkAuroraCanvas.vue?vue&type=script&setup=true&lang.ts
|
|
26
|
-
var ge = {
|
|
27
|
-
class: "pk-aurora",
|
|
28
|
-
"aria-hidden": "true"
|
|
29
|
-
}, I = {
|
|
30
|
-
key: 1,
|
|
31
|
-
class: "pk-aurora__fallback"
|
|
32
|
-
}, L = "\nattribute vec2 a_position;\nvoid main() {\n gl_Position = vec4(a_position, 0.0, 1.0);\n}", _e = "\nprecision mediump float;\nuniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_color;\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\n vec2 radii = vec2(u_half.x * 0.95, u_half.y * 6.5)\n * u_spread\n * breath\n * 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 // Premultiplied alpha (default canvas compositing)\n gl_FragColor = vec4(u_color * alpha, alpha);\n}", ve = /* @__PURE__ */ T({
|
|
33
|
-
__name: "PkAuroraCanvas",
|
|
34
|
-
props: { sourceSelector: {} },
|
|
35
|
-
setup(e) {
|
|
36
|
-
let t = e, n = M("canvasEl"), r = O(!1), i = null, a = 0, o = null, s = null, c = null, l = null, u = null, d = null, f = performance.now(), p = (e, t) => {
|
|
37
|
-
if (!i) return null;
|
|
38
|
-
let n = i.createShader(e);
|
|
39
|
-
return !n || (i.shaderSource(n, t), i.compileShader(n), !i.getShaderParameter(n, i.COMPILE_STATUS)) ? null : n;
|
|
40
|
-
}, ee = () => {
|
|
41
|
-
if (!n.value) return null;
|
|
42
|
-
let e = getComputedStyle(n.value).color.match(/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/);
|
|
43
|
-
return e ? [
|
|
44
|
-
Number(e[1]) / 255,
|
|
45
|
-
Number(e[2]) / 255,
|
|
46
|
-
Number(e[3]) / 255
|
|
47
|
-
] : null;
|
|
48
|
-
}, m = () => {
|
|
49
|
-
if (!i || !n.value) return;
|
|
50
|
-
let e = Math.min(window.devicePixelRatio || 1, 1.5), { clientWidth: r, clientHeight: a } = n.value;
|
|
51
|
-
n.value.width = Math.max(1, Math.round(r * e)), n.value.height = Math.max(1, Math.round(a * e)), i.viewport(0, 0, n.value.width, n.value.height);
|
|
52
|
-
let o = n.value.parentElement?.offsetParent, s = (t.sourceSelector ? o?.querySelector(t.sourceSelector) : o) ?? o, c = n.value.getBoundingClientRect(), f = s?.getBoundingClientRect();
|
|
53
|
-
if (f && c.width > 0) {
|
|
54
|
-
let e = n.value.width / c.width, t = n.value.height / c.height, r = (f.left + f.width / 2 - c.left) * e, a = (c.bottom - (f.top + f.height / 2)) * t, o = f.width / 2 * e, s = f.height / 2 * t;
|
|
55
|
-
i.uniform2f(l, r, a), i.uniform2f(u, o, s);
|
|
56
|
-
let p = Number.parseFloat(getComputedStyle(n.value).getPropertyValue("--aurora-spread"));
|
|
57
|
-
i.uniform1f(d, Number.isNaN(p) ? 1 : p);
|
|
58
|
-
}
|
|
59
|
-
g(h() ? 10 : void 0);
|
|
60
|
-
}, h = () => window.matchMedia("(prefers-reduced-motion: reduce)").matches, g = (e) => {
|
|
61
|
-
i && n.value && (i.uniform1f(s, e ?? (performance.now() - f) / 1e3), i.uniform2f(c, n.value.width, n.value.height), i.drawArrays(i.TRIANGLE_STRIP, 0, 4));
|
|
62
|
-
}, _ = () => {
|
|
63
|
-
g(), a = requestAnimationFrame(_);
|
|
64
|
-
};
|
|
65
|
-
return oe(() => {
|
|
66
|
-
let e = n.value;
|
|
67
|
-
i = e?.getContext("webgl", { alpha: !0 }) ?? null;
|
|
68
|
-
let t = ee();
|
|
69
|
-
if (!e || !i || !t) {
|
|
70
|
-
r.value = !0;
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
let a = p(i.VERTEX_SHADER, L), f = p(i.FRAGMENT_SHADER, _e), v = i.createProgram();
|
|
74
|
-
if (!a || !f || !v || (i.attachShader(v, a), i.attachShader(v, f), i.linkProgram(v), !i.getProgramParameter(v, i.LINK_STATUS))) {
|
|
75
|
-
r.value = !0;
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
i.useProgram(v);
|
|
79
|
-
let y = i.createBuffer();
|
|
80
|
-
i.bindBuffer(i.ARRAY_BUFFER, y), i.bufferData(i.ARRAY_BUFFER, new Float32Array([
|
|
81
|
-
-1,
|
|
82
|
-
-1,
|
|
83
|
-
1,
|
|
84
|
-
-1,
|
|
85
|
-
-1,
|
|
86
|
-
1,
|
|
87
|
-
1,
|
|
88
|
-
1
|
|
89
|
-
]), i.STATIC_DRAW);
|
|
90
|
-
let b = i.getAttribLocation(v, "a_position");
|
|
91
|
-
i.enableVertexAttribArray(b), i.vertexAttribPointer(b, 2, i.FLOAT, !1, 0, 0), s = i.getUniformLocation(v, "u_time"), c = i.getUniformLocation(v, "u_resolution"), l = i.getUniformLocation(v, "u_center"), u = i.getUniformLocation(v, "u_half"), d = i.getUniformLocation(v, "u_spread"), i.uniform3f(i.getUniformLocation(v, "u_color"), ...t), o = new ResizeObserver(m), o.observe(e), m(), ie(m), h() ? g(10) : _();
|
|
92
|
-
}), ae(() => {
|
|
93
|
-
cancelAnimationFrame(a), o?.disconnect();
|
|
94
|
-
}), ce(() => {
|
|
95
|
-
let e = i;
|
|
96
|
-
i = null, setTimeout(() => {
|
|
97
|
-
e?.getExtension("WEBGL_lose_context")?.loseContext();
|
|
98
|
-
}, 150);
|
|
99
|
-
}), (e, t) => (D(), x("div", ge, [r.value ? (D(), x("div", I)) : (D(), x("canvas", {
|
|
100
|
-
key: 0,
|
|
101
|
-
ref_key: "canvasEl",
|
|
102
|
-
ref: n,
|
|
103
|
-
class: "pk-aurora__canvas"
|
|
104
|
-
}, null, 512))]));
|
|
105
|
-
}
|
|
106
|
-
}), R = .18, ye = .35, be = /* @__PURE__ */ T({
|
|
107
|
-
__name: "PkVoiceOrb",
|
|
108
|
-
props: {
|
|
109
|
-
sample: {},
|
|
110
|
-
spectrum: {
|
|
111
|
-
type: Function,
|
|
112
|
-
default: void 0
|
|
113
|
-
},
|
|
114
|
-
state: {},
|
|
115
|
-
bars: { default: 5 }
|
|
116
|
-
},
|
|
117
|
-
setup(e) {
|
|
118
|
-
let t = e, n = M("barsEl"), r = Array.from({ length: t.bars }, () => R), i, a = () => typeof window < "u" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === !0, o = () => {
|
|
119
|
-
let e = Math.min(1, Math.max(0, t.sample())), n = t.spectrum?.(), i = r.length;
|
|
120
|
-
if (!n?.length) {
|
|
121
|
-
let t = Date.now() / 260;
|
|
122
|
-
return Array.from({ length: i }, (n, r) => {
|
|
123
|
-
let i = .65 + .35 * Math.sin(t + r * .9);
|
|
124
|
-
return R + e * 2.4 * i;
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
let a = Math.max(1, Math.floor(n.length / 2)), o = Math.max(1, Math.floor(a / i));
|
|
128
|
-
return Array.from({ length: i }, (e, t) => {
|
|
129
|
-
let r = 0;
|
|
130
|
-
for (let e = 0; e < o; e += 1) r += n[t * o + e] ?? 0;
|
|
131
|
-
return R + r / o / 255 * 2.2;
|
|
132
|
-
});
|
|
133
|
-
}, s = () => {
|
|
134
|
-
let e = n.value?.children;
|
|
135
|
-
e && r.forEach((t, n) => {
|
|
136
|
-
e[n]?.style.setProperty("--pk-voice-orb-scale", String(t));
|
|
137
|
-
});
|
|
138
|
-
}, c = () => {
|
|
139
|
-
let e = o();
|
|
140
|
-
r = r.map((t, n) => t + (Math.min(1, Math.max(R, e[n] ?? R)) - t) * ye), s(), i = requestAnimationFrame(c);
|
|
141
|
-
}, l = () => {
|
|
142
|
-
i !== void 0 && (cancelAnimationFrame(i), i = void 0);
|
|
143
|
-
};
|
|
144
|
-
return N(() => t.state, async (e) => {
|
|
145
|
-
e !== "listening" && e !== "speaking" || a() ? (l(), r = r.map(() => R * 1.6), await ie(), s()) : i === void 0 && (i = requestAnimationFrame(c));
|
|
146
|
-
}, { immediate: !0 }), ae(l), (t, r) => (D(), x("div", {
|
|
147
|
-
class: E(["pk-voice-orb", `pk-voice-orb--${e.state}`]),
|
|
148
|
-
"aria-hidden": "true"
|
|
149
|
-
}, [S("div", {
|
|
150
|
-
ref_key: "barsEl",
|
|
151
|
-
ref: n,
|
|
152
|
-
class: "pk-voice-orb__bars"
|
|
153
|
-
}, [(D(!0), x(g, null, ue(e.bars, (e) => (D(), x("span", {
|
|
154
|
-
key: e,
|
|
155
|
-
class: "pk-voice-orb__bar"
|
|
156
|
-
}))), 128))], 512)], 2));
|
|
157
|
-
}
|
|
158
|
-
}), xe = {
|
|
159
|
-
key: 0,
|
|
160
|
-
class: "pk-voice-session__badge",
|
|
161
|
-
"aria-hidden": "true"
|
|
162
|
-
}, z = {
|
|
163
|
-
class: "pk-voice-session__status",
|
|
164
|
-
role: "status"
|
|
165
|
-
}, B = {
|
|
166
|
-
key: 0,
|
|
167
|
-
class: "pk-voice-session__live-dot",
|
|
168
|
-
"aria-hidden": "true"
|
|
169
|
-
}, Se = ["title"], Ce = ["title"], we = { class: "pk-voice-session__actions" }, Te = /* @__PURE__ */ T({
|
|
170
|
-
__name: "PkVoiceSession",
|
|
171
|
-
props: {
|
|
172
|
-
state: {},
|
|
173
|
-
sample: { type: Function },
|
|
174
|
-
spectrum: { type: Function },
|
|
175
|
-
remainingSeconds: {},
|
|
176
|
-
muted: { type: Boolean },
|
|
177
|
-
error: {},
|
|
178
|
-
rawError: {},
|
|
179
|
-
live: { type: Boolean }
|
|
180
|
-
},
|
|
181
|
-
emits: [
|
|
182
|
-
"toggle-mute",
|
|
183
|
-
"hang-up",
|
|
184
|
-
"retry",
|
|
185
|
-
"dismiss"
|
|
186
|
-
],
|
|
187
|
-
setup(e, { emit: t }) {
|
|
188
|
-
let n = e, r = t, { t: i } = fe({ useScope: "global" }), a = v(() => 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 = v(() => {
|
|
189
|
-
if (n.remainingSeconds === void 0) return;
|
|
190
|
-
let e = Math.floor(n.remainingSeconds / 60), t = n.remainingSeconds % 60;
|
|
191
|
-
return `${e}:${String(t).padStart(2, "0")}`;
|
|
192
|
-
}), s = v(() => n.remainingSeconds !== void 0 && n.remainingSeconds <= 30), c = v(() => !n.error && (n.state === "listening" || n.state === "speaking")), l = v(() => {
|
|
193
|
-
if (c.value) return n.state === "speaking" ? "speaking" : n.muted ? void 0 : "listening";
|
|
194
|
-
});
|
|
195
|
-
return (t, n) => {
|
|
196
|
-
let u = h;
|
|
197
|
-
return D(), x("div", { class: E(["pk-voice-session", { "pk-voice-session--failed": !!e.error }]) }, [
|
|
198
|
-
e.error ? (D(), x("span", xe, [C(u, { name: "ri:error-warning-line" })])) : (D(), y(be, {
|
|
199
|
-
key: 1,
|
|
200
|
-
state: e.state,
|
|
201
|
-
sample: e.sample,
|
|
202
|
-
spectrum: e.spectrum
|
|
203
|
-
}, null, 8, [
|
|
204
|
-
"state",
|
|
205
|
-
"sample",
|
|
206
|
-
"spectrum"
|
|
207
|
-
])),
|
|
208
|
-
S("div", z, [S("span", { class: E(["pk-voice-session__state", l.value && `pk-voice-session__state--${l.value}`]) }, [c.value ? (D(), x("span", B)) : b("", !0), ne(" " + A(a.value), 1)], 2), e.error ? (D(), x("p", {
|
|
209
|
-
key: 0,
|
|
210
|
-
class: "pk-voice-session__detail",
|
|
211
|
-
title: e.rawError ?? e.error
|
|
212
|
-
}, A(e.error), 9, Se)) : b("", !0)]),
|
|
213
|
-
o.value ? (D(), x("span", {
|
|
214
|
-
key: 2,
|
|
215
|
-
class: E(["pk-voice-session__timer", { "pk-voice-session__timer--warning": s.value }]),
|
|
216
|
-
title: j(i)("hint.voiceRemaining"),
|
|
217
|
-
"aria-hidden": "true"
|
|
218
|
-
}, A(o.value), 11, Ce)) : b("", !0),
|
|
219
|
-
S("div", we, [e.error ? (D(), x(g, { key: 0 }, [C(d, {
|
|
220
|
-
icon: "ri:refresh-line",
|
|
221
|
-
label: j(i)("action.retry"),
|
|
222
|
-
onClick: n[0] ||= (e) => r("retry")
|
|
223
|
-
}, null, 8, ["label"]), e.live ? (D(), y(d, {
|
|
224
|
-
key: 0,
|
|
225
|
-
icon: "ri:stop-circle-line",
|
|
226
|
-
modifiers: "danger",
|
|
227
|
-
title: j(i)("action.hangUp"),
|
|
228
|
-
"aria-label": j(i)("action.hangUp"),
|
|
229
|
-
onClick: n[1] ||= (e) => r("hang-up")
|
|
230
|
-
}, null, 8, ["title", "aria-label"])) : (D(), y(d, {
|
|
231
|
-
key: 1,
|
|
232
|
-
icon: "ri:close-line",
|
|
233
|
-
label: j(i)("action.close"),
|
|
234
|
-
onClick: n[2] ||= (e) => r("dismiss")
|
|
235
|
-
}, null, 8, ["label"]))], 64)) : (D(), x(g, { key: 1 }, [C(d, {
|
|
236
|
-
icon: e.muted ? "ri:mic-off-line" : "ri:mic-line",
|
|
237
|
-
title: e.muted ? j(i)("action.unmute") : j(i)("action.mute"),
|
|
238
|
-
"aria-label": e.muted ? j(i)("action.unmute") : j(i)("action.mute"),
|
|
239
|
-
"aria-pressed": e.muted,
|
|
240
|
-
onClick: n[3] ||= (e) => r("toggle-mute")
|
|
241
|
-
}, null, 8, [
|
|
242
|
-
"icon",
|
|
243
|
-
"title",
|
|
244
|
-
"aria-label",
|
|
245
|
-
"aria-pressed"
|
|
246
|
-
]), C(d, {
|
|
247
|
-
icon: "ri:stop-circle-line",
|
|
248
|
-
modifiers: "danger",
|
|
249
|
-
title: j(i)("action.hangUp"),
|
|
250
|
-
"aria-label": j(i)("action.hangUp"),
|
|
251
|
-
onClick: n[4] ||= (e) => r("hang-up")
|
|
252
|
-
}, null, 8, ["title", "aria-label"])], 64))])
|
|
253
|
-
], 2);
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}), Ee = (e) => {
|
|
257
|
-
let t = k(), n = O("disconnected"), r = O("listening"), i = O(), o = O([]), s = O(), c = O(), l, u, d = 0, f = !1, p = () => {
|
|
258
|
-
u &&= (clearInterval(u), void 0), s.value = void 0;
|
|
259
|
-
}, ee = (e) => {
|
|
260
|
-
let t = Date.now() + e * 1e3, n = () => {
|
|
261
|
-
let e = Math.max(0, Math.ceil((t - Date.now()) / 1e3));
|
|
262
|
-
s.value = e, e === 0 && h();
|
|
263
|
-
};
|
|
264
|
-
n(), u = setInterval(n, 1e3);
|
|
265
|
-
}, m = async (t) => {
|
|
266
|
-
t && (l === t && (l = void 0), await e.closeGrant?.(t).catch(() => void 0));
|
|
267
|
-
}, h = async () => {
|
|
268
|
-
d += 1, p();
|
|
269
|
-
let e = l;
|
|
270
|
-
l = void 0;
|
|
271
|
-
let i = t.value;
|
|
272
|
-
t.value = void 0, await i?.endSession().catch(() => void 0), await m(e), n.value = "disconnected", r.value = "listening";
|
|
273
|
-
}, g = async () => {
|
|
274
|
-
if (f || t.value || n.value === "connecting") return;
|
|
275
|
-
i.value = void 0, o.value = [], r.value = "listening", c.value = void 0, n.value = "connecting", d += 1;
|
|
276
|
-
let a = d, s = () => a === d && !f, u;
|
|
277
|
-
try {
|
|
278
|
-
let a = import("./web-BIOlKgFq.js");
|
|
279
|
-
a.catch(() => void 0);
|
|
280
|
-
let d = await e.fetchGrant();
|
|
281
|
-
if (!s()) {
|
|
282
|
-
await e.closeGrant?.(d.sessionId).catch(() => void 0);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
l = d.sessionId, u = d.sessionId, c.value = d.chatId;
|
|
286
|
-
let { VoiceConversation: f } = await a;
|
|
287
|
-
if (!s()) {
|
|
288
|
-
await m(d.sessionId);
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
let h = await f.startSession({
|
|
292
|
-
signedUrl: d.signedUrl,
|
|
293
|
-
customLlmExtraBody: { voice_session_id: d.sessionId },
|
|
294
|
-
onStatusChange: ({ status: e }) => {
|
|
295
|
-
s() && (n.value = e);
|
|
296
|
-
},
|
|
297
|
-
onModeChange: ({ mode: t }) => {
|
|
298
|
-
if (!s()) return;
|
|
299
|
-
let n = r.value === "speaking";
|
|
300
|
-
r.value = t, n && t !== "speaking" && e.onTurnEnd?.();
|
|
301
|
-
},
|
|
302
|
-
onMessage: ({ message: t, role: n }) => {
|
|
303
|
-
if (!s()) return;
|
|
304
|
-
let r = {
|
|
305
|
-
role: n,
|
|
306
|
-
text: t
|
|
307
|
-
};
|
|
308
|
-
o.value = [...o.value, r], e.onTranscript?.(r);
|
|
309
|
-
},
|
|
310
|
-
onError: (e) => {
|
|
311
|
-
s() && (i.value = e);
|
|
312
|
-
},
|
|
313
|
-
onDisconnect: (a) => {
|
|
314
|
-
s() && (p(), t.value = void 0, n.value = "disconnected", r.value = "listening", a.reason === "error" && (i.value = a.message), m(d.sessionId), e.onTurnEnd?.());
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
if (!s()) {
|
|
318
|
-
await h.endSession().catch(() => void 0), await m(d.sessionId);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
t.value = h, ee(d.maxSessionSeconds);
|
|
322
|
-
} catch (e) {
|
|
323
|
-
if (await m(u), !s()) return;
|
|
324
|
-
t.value = void 0, p(), n.value = "disconnected", i.value = e instanceof Error ? e.message : String(e);
|
|
325
|
-
}
|
|
326
|
-
}, _ = () => {
|
|
327
|
-
i.value = void 0;
|
|
328
|
-
}, y = (e) => {
|
|
329
|
-
t.value?.setMicMuted(e);
|
|
330
|
-
}, b = (e) => {
|
|
331
|
-
let n = t.value;
|
|
332
|
-
if (!n || !e.trim()) return !1;
|
|
333
|
-
try {
|
|
334
|
-
return n.sendUserMessage(e), !0;
|
|
335
|
-
} catch (e) {
|
|
336
|
-
return a.warn("The spoken answer could not be sent", e), !1;
|
|
337
|
-
}
|
|
338
|
-
}, x = (e) => {
|
|
339
|
-
let n = t.value;
|
|
340
|
-
if (!n) return 0;
|
|
341
|
-
try {
|
|
342
|
-
return e === "input" ? n.getInputVolume() : n.getOutputVolume();
|
|
343
|
-
} catch {
|
|
344
|
-
return 0;
|
|
345
|
-
}
|
|
346
|
-
}, S = (e) => {
|
|
347
|
-
let n = t.value;
|
|
348
|
-
if (n) try {
|
|
349
|
-
return e === "input" ? n.getInputByteFrequencyData() : n.getOutputByteFrequencyData();
|
|
350
|
-
} catch {
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
}, te = () => {
|
|
354
|
-
let e = l;
|
|
355
|
-
l = void 0, d += 1, p(), m(e);
|
|
356
|
-
let r = t.value;
|
|
357
|
-
t.value = void 0, r?.endSession().catch(() => void 0), n.value = "disconnected";
|
|
358
|
-
};
|
|
359
|
-
return typeof window < "u" && window.addEventListener("pagehide", te), se(() => {
|
|
360
|
-
f = !0, typeof window < "u" && window.removeEventListener("pagehide", te), h();
|
|
361
|
-
}), {
|
|
362
|
-
status: n,
|
|
363
|
-
mode: r,
|
|
364
|
-
error: i,
|
|
365
|
-
transcript: o,
|
|
366
|
-
remainingSeconds: s,
|
|
367
|
-
chatId: c,
|
|
368
|
-
isActive: v(() => n.value === "connected" || n.value === "connecting"),
|
|
369
|
-
isConnecting: v(() => n.value === "connecting"),
|
|
370
|
-
isSpeaking: v(() => n.value === "connected" && r.value === "speaking"),
|
|
371
|
-
isListening: v(() => n.value === "connected" && r.value === "listening"),
|
|
372
|
-
start: g,
|
|
373
|
-
stop: h,
|
|
374
|
-
dismissError: _,
|
|
375
|
-
setMuted: y,
|
|
376
|
-
sendUserMessage: b,
|
|
377
|
-
readLevel: x,
|
|
378
|
-
readSpectrum: S
|
|
379
|
-
};
|
|
380
|
-
}, De = 4e3, Oe = [
|
|
381
|
-
3e3,
|
|
382
|
-
5e3,
|
|
383
|
-
1e4
|
|
384
|
-
], ke = 12e4, Ae = 3e4;
|
|
385
|
-
function je(e) {
|
|
386
|
-
let t = O(null), n = O(!1), r, i = !1, a = () => {
|
|
387
|
-
clearTimeout(r), r = void 0;
|
|
388
|
-
}, o = (e, t) => {
|
|
389
|
-
a(), i || (r = setTimeout(() => void t(), e));
|
|
390
|
-
}, s = (t) => e.messages().some((e) => e.metadata?.wakeup?.id === t);
|
|
391
|
-
async function c() {
|
|
392
|
-
a();
|
|
393
|
-
let n = e.chatId();
|
|
394
|
-
try {
|
|
395
|
-
let r = await e.apiClient().getChatWakeup(e.agentId(), n);
|
|
396
|
-
if (n !== e.chatId()) return;
|
|
397
|
-
t.value = r.pendingWakeup;
|
|
398
|
-
} catch {
|
|
399
|
-
t.value = null;
|
|
400
|
-
}
|
|
401
|
-
let r = t.value;
|
|
402
|
-
if (r) {
|
|
403
|
-
let e = Date.parse(r.dueAt) - Date.now() + De;
|
|
404
|
-
o(Math.max(De, e), () => l(r.wakeId, Date.now(), 0));
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
async function l(t, n, r) {
|
|
408
|
-
await e.refreshMessages(), !i && (s(t) || Date.now() - n >= ke ? await c() : o(Oe[Math.min(r, Oe.length - 1)], () => l(t, n, r + 1)));
|
|
409
|
-
}
|
|
410
|
-
async function u() {
|
|
411
|
-
n.value = !0;
|
|
412
|
-
try {
|
|
413
|
-
let n = await e.apiClient().stopChatWakeup(e.agentId(), e.chatId());
|
|
414
|
-
a(), t.value = n.pendingWakeup;
|
|
415
|
-
} finally {
|
|
416
|
-
n.value = !1;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function d() {
|
|
420
|
-
a(), t.value = null;
|
|
421
|
-
}
|
|
422
|
-
let f;
|
|
423
|
-
function p() {
|
|
424
|
-
f = e.chatId();
|
|
425
|
-
}
|
|
426
|
-
function ee() {
|
|
427
|
-
f === e.chatId() && (f = void 0, c());
|
|
428
|
-
}
|
|
429
|
-
function m() {
|
|
430
|
-
f = void 0;
|
|
431
|
-
}
|
|
432
|
-
let h = v(() => e.messages().some((e) => e.role === "user"));
|
|
433
|
-
N([e.chatId, h], ([, t]) => {
|
|
434
|
-
d();
|
|
435
|
-
let n = e.status(), r = n === "submitted" || n === "streaming" || f === e.chatId();
|
|
436
|
-
t && !r && c();
|
|
437
|
-
}, { immediate: !0 }), N(e.status, (e, t) => {
|
|
438
|
-
e === "ready" && t !== "ready" && h.value && c();
|
|
439
|
-
});
|
|
440
|
-
let g;
|
|
441
|
-
function _() {
|
|
442
|
-
t.value && document.visibilityState === "visible" && e.apiClient().markChatWakeupPresence(e.agentId(), e.chatId()).catch(() => void 0);
|
|
443
|
-
}
|
|
444
|
-
let y = () => _();
|
|
445
|
-
return document.addEventListener("visibilitychange", y), N(() => t.value?.wakeId, (e) => {
|
|
446
|
-
clearInterval(g), g = void 0, e && !i && (_(), g = setInterval(_, Ae));
|
|
447
|
-
}), ae(() => {
|
|
448
|
-
i = !0, a(), clearInterval(g), document.removeEventListener("visibilitychange", y);
|
|
449
|
-
}), {
|
|
450
|
-
pendingWakeup: t,
|
|
451
|
-
isStopping: n,
|
|
452
|
-
check: c,
|
|
453
|
-
reset: d,
|
|
454
|
-
stop: u,
|
|
455
|
-
spokenTurnStarted: p,
|
|
456
|
-
spokenTurnsWritten: ee,
|
|
457
|
-
forgetSpokenTurns: m
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
// ../../packages/components/src/chat/PkChatbotViewChat.vue?vue&type=script&setup=true&lang.ts
|
|
461
|
-
var Me = { class: "pk-chatbot-view-chat__input-stage" }, Ne = {
|
|
462
|
-
key: 1,
|
|
463
|
-
class: "p-md border-t border-surface-3 text-center text-12 text-danger bg-surface-danger"
|
|
464
|
-
}, Pe = { class: "pk-chatbot-view-chat__agent-chip" }, Fe = {
|
|
465
|
-
key: 0,
|
|
466
|
-
class: "pk-chatbot-view-chat__agent-chip-name"
|
|
467
|
-
}, Ie = {
|
|
468
|
-
key: 0,
|
|
469
|
-
class: "pk-chatbot-view-chat__drop-overlay"
|
|
470
|
-
}, Le = 3e3, Re = 6e4, ze = 3e5, Be = 6e5, Ve = /* @__PURE__ */ T({
|
|
471
|
-
__name: "PkChatbotViewChat",
|
|
472
|
-
props: {
|
|
473
|
-
agentId: {},
|
|
474
|
-
modifier: {},
|
|
475
|
-
userName: {}
|
|
476
|
-
},
|
|
477
|
-
emits: ["show-info", "revise"],
|
|
478
|
-
setup(a, { emit: d }) {
|
|
479
|
-
let g = w(() => import("./PkToolShowForm-Fv4iV0VY.js").then((e) => e.n)), ne = w(() => import("./PkToolShowContactForm-xHBTmITM.js").then((e) => e.n)), T = w(() => import("./PkToolShowSuggestedReply-Bnhgsh4l.js").then((e) => e.n)), ie = w(() => import("./PkToolShowSources-C4rKpypf.js").then((e) => e.n)), oe = w(() => import("./PkToolRequestGeolocation-e8vyxTI_.js")), se = w(() => import("./PkToolRequestOAuthConnection-3zLvNF_c.js")), ce = w(() => import("./PkToolShowLocation-Cq0IXye1.js").then((e) => e.n)), ue = w(() => import("./PkToolShowDiagram-DrJs92dg.js")), k = w(() => import("./PkToolChatFile-s46esp0O.js")), de = w(() => import("./PkToolShareDocument-CRghPfep.js").then((e) => e.n)), F = a, ge = d, I = r(F.agentId), { agentInterface: L, agentFileUpload: _e, agentType: R, agentVoice: ye, actions: be, revisedAnswers: xe, messages: z, chat: B, messageFeedbacks: Se, feedbackDialogMessage: Ce, isFeedbackSubmitting: we, isFeedbackSubmitted: De, feedbackSubmitError: Oe, isLeadSubmitted: ke, isLoadingSubmitLead: Ae, submitLeadError: Ve, input: He, inputMessagePlaceholder: Ue, isConversationBlocked: We, baseUrl: Ge, pendingAttachments: Ke, isAttachmentLimitReached: qe, fileLimitError: Je, apiClient: V, isDark: Ye, hostToolsPending: Xe, pageNoticeLevel: Ze, hostConfirmation: Qe, agentPageAccess: $e, hostStepTitles: et, canQueue: tt, queuedMessages: nt, backgroundAnswers: rt, inputFocusRequest: it } = me(I);
|
|
480
|
-
le(c, et);
|
|
481
|
-
let at = M("inputEl");
|
|
482
|
-
N(it, () => {
|
|
483
|
-
at.value?.focus();
|
|
484
|
-
});
|
|
485
|
-
let H = v(() => R.value === "reasoning" ? void 0 : _e.value), U = (e) => V.value.getMediaDownloadUrl(F.agentId, I.localChatId, e), { handleSubmit: ot, stopGeneration: st, regenerate: ct, onUpvote: lt, onDownvote: ut, onFeedback: dt, onFeedbackSubmit: ft, onLeadSubmit: pt, startNewChat: mt, addToolOutput: W, addToolApprovalResponse: ht, handleFileSelect: gt, clearFileLimitError: _t, refreshMessages: vt, appendMessage: yt, closePageNotice: bt, respondHostConfirmation: xt, editQueuedMessage: St, removeQueuedMessage: Ct, openBackgroundAnswer: wt, dismissBackgroundAnswer: Tt } = I, { t: G } = fe({ useScope: "global" }), Et = v(() => Xe.value > 0), Dt = v(() => Et.value && B.value.status === "ready" ? "streaming" : B.value.status), Ot = l(() => $e.value?.notice), kt = v(() => Ze.value ? Ot.value || G(`message.pageAccessNotice.${Ze.value}`) : void 0), At = v(() => {
|
|
486
|
-
let e = Je.value;
|
|
487
|
-
if (e) return e.reason === "per-chat" ? G("message.fileLimitPerChat", { max: e.max }) : G("message.fileLimitPerMessage", { max: e.max });
|
|
488
|
-
}), jt = v(() => rt.value.map(({ chatId: e, title: t }) => ({
|
|
489
|
-
id: e,
|
|
490
|
-
text: t ? G("message.backgroundAnswerReady", { title: t }) : G("message.backgroundAnswerReadyUntitled")
|
|
491
|
-
}))), Mt = l(() => L.value?.dismissableNotice), Nt = v(() => z.value.some((e) => e.role === "user")), Pt = v(() => F.modifier === "fullscreen" && !Nt.value), Ft = he(L, () => F.userName), It = M("chatViewEl"), Lt = async (e) => (await V.value.expandSourceContext(F.agentId, e.documentId, e.chunkIndex)).content, Rt = async (e) => {
|
|
492
|
-
let t = await V.value.downloadSourceDocument(F.agentId, e);
|
|
493
|
-
window.open(t.downloadUrl, "_blank");
|
|
494
|
-
}, { isOverDropZone: zt } = pe(It, {
|
|
495
|
-
dataTypes: (e) => t(e, H.value?.allowedMimeTypes ?? []),
|
|
496
|
-
onDrop: (e) => {
|
|
497
|
-
if (H.value?.enabled && e) for (let t of e) gt(t);
|
|
498
|
-
}
|
|
499
|
-
}), K = O(!1), q = !1, J = O(!1), Bt = [
|
|
500
|
-
3e3,
|
|
501
|
-
5e3,
|
|
502
|
-
1e4
|
|
503
|
-
], Y, X, Vt = !1, Ht = 0, Ut = !1;
|
|
504
|
-
function Wt() {
|
|
505
|
-
clearTimeout(Y), Y = void 0, X = void 0, Vt = !1, Ht = 0, J.value = !1;
|
|
506
|
-
}
|
|
507
|
-
function Gt(e) {
|
|
508
|
-
q || (clearTimeout(Y), Y = setTimeout(() => {
|
|
509
|
-
Kt();
|
|
510
|
-
}, e));
|
|
511
|
-
}
|
|
512
|
-
async function Kt() {
|
|
513
|
-
if (q || Ut) return;
|
|
514
|
-
Ut = !0;
|
|
515
|
-
let e;
|
|
516
|
-
try {
|
|
517
|
-
e = await vt();
|
|
518
|
-
} finally {
|
|
519
|
-
Ut = !1;
|
|
520
|
-
}
|
|
521
|
-
if (q) return;
|
|
522
|
-
if (e === "caught-up" && (J.value = !1, vn()), Z.isActive.value) {
|
|
523
|
-
X = void 0, Vt = !1, Ht = 0, Gt(Le);
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
X === void 0 && (X = Date.now(), Vt = !!Z.error.value);
|
|
527
|
-
let t = Date.now() - X;
|
|
528
|
-
if (e === "caught-up" && t >= (Vt ? ze : Re) || t >= Be) {
|
|
529
|
-
Wt(), yn();
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
let n = Bt[Math.min(Ht, Bt.length - 1)];
|
|
533
|
-
Ht += 1, Gt(n);
|
|
534
|
-
}
|
|
535
|
-
let qt = (e = 1200) => {
|
|
536
|
-
Gt(e);
|
|
537
|
-
}, Z = Ee({
|
|
538
|
-
fetchGrant: async () => {
|
|
539
|
-
let e = await V.value.createVoiceSession(F.agentId, I.localChatId, {
|
|
540
|
-
deviceContext: I.buildDeviceContext(),
|
|
541
|
-
externalContext: I.externalContext
|
|
542
|
-
});
|
|
543
|
-
return e.chatId !== I.localChatId && (I.localChatId = e.chatId), e;
|
|
544
|
-
},
|
|
545
|
-
closeGrant: (e) => V.value.closeVoiceSession(F.agentId, e),
|
|
546
|
-
onTranscript: (e) => {
|
|
547
|
-
e.role === "user" ? (J.value = !0, _n(), yt({
|
|
548
|
-
id: `${i}user-${n()}`,
|
|
549
|
-
role: "user",
|
|
550
|
-
parts: [{
|
|
551
|
-
type: "text",
|
|
552
|
-
text: e.text
|
|
553
|
-
}]
|
|
554
|
-
})) : J.value = !1;
|
|
555
|
-
},
|
|
556
|
-
onTurnEnd: () => {
|
|
557
|
-
qt();
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
N(() => Z.error.value, (e) => {
|
|
561
|
-
e && (J.value = !1);
|
|
562
|
-
});
|
|
563
|
-
let Jt = v(() => ye.value?.enabled === !0), Yt = v(() => Z.error.value ? "error" : Z.isConnecting.value ? "connecting" : Z.isSpeaking.value ? "speaking" : Z.isActive.value ? "listening" : "idle"), Xt = v(() => {
|
|
564
|
-
let e = Z.error.value;
|
|
565
|
-
if (e) return /took too long/i.test(e) ? G("message.voiceTookTooLong") : /cascade|no response|custom_llm_error/i.test(e) ? G("message.voiceNoAnswer") : G("message.voiceInterrupted");
|
|
566
|
-
}), Zt = v(() => Z.isSpeaking.value ? "output" : "input"), Qt = () => Z.readLevel(Zt.value), $t = () => Z.readSpectrum(Zt.value), en = async () => {
|
|
567
|
-
K.value = !1, await Z.start(), Z.isActive.value && (Wt(), Gt(Le));
|
|
568
|
-
}, tn = async () => {
|
|
569
|
-
J.value = !1, await Z.stop(), !q && qt(0);
|
|
570
|
-
}, nn = () => {
|
|
571
|
-
Z.dismissError();
|
|
572
|
-
}, rn = async () => {
|
|
573
|
-
Z.dismissError(), await Z.stop(), await en();
|
|
574
|
-
}, Q = (e) => e?.toolCallId ?? "", an = O(/* @__PURE__ */ new Set()), on = (e) => an.value.has(Q(e)), sn = O(/* @__PURE__ */ new Map()), $ = (e, t) => Z.isActive.value ? (Z.sendUserMessage(t) && (an.value = new Set(an.value).add(Q(e)), qt()), !0) : !1, cn = (e, t, n) => {
|
|
575
|
-
$(t, o(t, n)) || W({
|
|
576
|
-
tool: e,
|
|
577
|
-
toolCallId: Q(t),
|
|
578
|
-
output: n
|
|
579
|
-
});
|
|
580
|
-
}, ln = (e) => {
|
|
581
|
-
let t = e.confirmed ? G("message.voiceConfirmed") : G("message.voiceCancelled");
|
|
582
|
-
$({ toolCallId: e.toolCallId }, t) ? an.value.has(e.toolCallId) && (sn.value = new Map(sn.value).set(e.toolCallId, e.confirmed)) : W({
|
|
583
|
-
tool: "requestConfirm",
|
|
584
|
-
toolCallId: e.toolCallId,
|
|
585
|
-
output: e.confirmed ? "confirmed" : "cancelled"
|
|
586
|
-
});
|
|
587
|
-
}, un = (e, t) => {
|
|
588
|
-
$(e, t) || (He.value = t, ot());
|
|
589
|
-
}, dn = (e, t) => {
|
|
590
|
-
let n = t.error ? G("message.voiceLocationRefused") : G("message.voiceLocationShared", { place: t.displayName ?? `${t.latitude}, ${t.longitude}` });
|
|
591
|
-
$(e, n) || W({
|
|
592
|
-
tool: "requestGeolocation",
|
|
593
|
-
toolCallId: Q(e),
|
|
594
|
-
output: t
|
|
595
|
-
});
|
|
596
|
-
}, fn = (e, t) => {
|
|
597
|
-
$(e, G("message.voiceConnectionDone")) || W({
|
|
598
|
-
tool: "requestOAuthConnection",
|
|
599
|
-
toolCallId: Q(e),
|
|
600
|
-
output: {
|
|
601
|
-
connected: !0,
|
|
602
|
-
mcpServerId: t
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
}, pn = () => {
|
|
606
|
-
K.value = !K.value, Z.setMuted(K.value);
|
|
607
|
-
};
|
|
608
|
-
ae(() => {
|
|
609
|
-
q = !0, Wt();
|
|
610
|
-
});
|
|
611
|
-
let { pendingWakeup: mn, isStopping: hn, stop: gn, spokenTurnStarted: _n, spokenTurnsWritten: vn, forgetSpokenTurns: yn } = je({
|
|
612
|
-
agentId: () => F.agentId,
|
|
613
|
-
chatId: () => I.localChatId,
|
|
614
|
-
apiClient: () => V.value,
|
|
615
|
-
messages: () => z.value,
|
|
616
|
-
refreshMessages: vt,
|
|
617
|
-
status: () => B.value.status
|
|
618
|
-
});
|
|
619
|
-
return (t, n) => {
|
|
620
|
-
let r = h;
|
|
621
|
-
return D(), x("div", {
|
|
622
|
-
ref_key: "chatViewEl",
|
|
623
|
-
ref: It,
|
|
624
|
-
class: E(["pk-chatbot-view-chat", {
|
|
625
|
-
"pk-chatbot-view-chat--dragover": j(zt) && H.value?.enabled,
|
|
626
|
-
"pk-chatbot-view-chat--empty": Pt.value
|
|
627
|
-
}])
|
|
628
|
-
}, [
|
|
629
|
-
C(_, {
|
|
630
|
-
name: "pk-chatbot-view-chat-fade",
|
|
631
|
-
mode: "out-in"
|
|
632
|
-
}, {
|
|
633
|
-
default: P(() => [Pt.value ? (D(), y(ee, {
|
|
634
|
-
key: 0,
|
|
635
|
-
greeting: j(Ft),
|
|
636
|
-
logo: j(L)?.logo,
|
|
637
|
-
name: j(I).name
|
|
638
|
-
}, null, 8, [
|
|
639
|
-
"greeting",
|
|
640
|
-
"logo",
|
|
641
|
-
"name"
|
|
642
|
-
])) : (D(), y(e, {
|
|
643
|
-
key: 1,
|
|
644
|
-
class: "flex flex-col flex-1 min-h-0 p-md overflow-y-auto",
|
|
645
|
-
interactive: "",
|
|
646
|
-
messages: j(z),
|
|
647
|
-
"confirm-verdicts-on-call": sn.value,
|
|
648
|
-
status: j(B).status,
|
|
649
|
-
error: j(B).error,
|
|
650
|
-
"main-color": j(L)?.mainColor,
|
|
651
|
-
"text-color": j(L)?.textColor,
|
|
652
|
-
"revised-answers": j(xe),
|
|
653
|
-
actions: j(be),
|
|
654
|
-
"message-feedbacks": j(Se),
|
|
655
|
-
"feedback-message-id": j(Ce)?.id,
|
|
656
|
-
"feedback-loading": j(we),
|
|
657
|
-
"feedback-submitted": j(De),
|
|
658
|
-
"feedback-error": j(Oe),
|
|
659
|
-
"show-extended-steps": j(L)?.showExtendedSteps,
|
|
660
|
-
"hide-reasoning": j(L)?.showReasoning === !1,
|
|
661
|
-
"awaiting-spoken-answer": J.value,
|
|
662
|
-
"host-working": Et.value,
|
|
663
|
-
"host-confirmation": j(Qe),
|
|
664
|
-
"is-dark": j(Ye),
|
|
665
|
-
"show-scroll-to-bottom": a.modifier === "fullscreen",
|
|
666
|
-
onFeedbackSubmit: n[0] ||= (e) => j(ft)(e),
|
|
667
|
-
onFeedbackClose: n[1] ||= (e) => Ce.value = void 0,
|
|
668
|
-
onRegenerate: j(ct),
|
|
669
|
-
onAutoRetry: j(ct),
|
|
670
|
-
onResetChat: j(mt),
|
|
671
|
-
onShowInfo: n[2] ||= (e) => ge("show-info", e),
|
|
672
|
-
onRevise: n[3] ||= (e) => ge("revise", e),
|
|
673
|
-
onUpvote: j(lt),
|
|
674
|
-
onDownvote: j(ut),
|
|
675
|
-
onFeedback: j(dt),
|
|
676
|
-
onApprovalRespond: j(ht),
|
|
677
|
-
onConfirmRespond: ln,
|
|
678
|
-
onHostConfirmRespond: j(xt)
|
|
679
|
-
}, {
|
|
680
|
-
"tool-showContactForm": P(({ part: e }) => [C(j(ne), {
|
|
681
|
-
part: e,
|
|
682
|
-
readonly: !j(Ge),
|
|
683
|
-
submitted: j(ke),
|
|
684
|
-
loading: j(Ae),
|
|
685
|
-
error: j(Ve),
|
|
686
|
-
"privacy-policy-notice": j(L)?.privacyPolicyNotice,
|
|
687
|
-
onSubmit: j(pt)
|
|
688
|
-
}, null, 8, [
|
|
689
|
-
"part",
|
|
690
|
-
"readonly",
|
|
691
|
-
"submitted",
|
|
692
|
-
"loading",
|
|
693
|
-
"error",
|
|
694
|
-
"privacy-policy-notice",
|
|
695
|
-
"onSubmit"
|
|
696
|
-
])]),
|
|
697
|
-
"tool-showSuggestedReply": P(({ part: e }) => [C(j(T), {
|
|
698
|
-
part: e,
|
|
699
|
-
onSelect: (t) => un(e, t)
|
|
700
|
-
}, null, 8, ["part", "onSelect"])]),
|
|
701
|
-
"tool-showSources": P(({ part: e }) => [C(j(ie), {
|
|
702
|
-
part: e,
|
|
703
|
-
"on-expand-context": Lt,
|
|
704
|
-
"on-download": Rt
|
|
705
|
-
}, null, 8, ["part"])]),
|
|
706
|
-
"tool-showForm": P(({ part: e }) => [C(_, { mode: "out-in" }, {
|
|
707
|
-
default: P(() => [C(j(g), {
|
|
708
|
-
part: e,
|
|
709
|
-
answered: on(e),
|
|
710
|
-
onSelect: (t) => cn("showForm", e, t)
|
|
711
|
-
}, null, 8, [
|
|
712
|
-
"part",
|
|
713
|
-
"answered",
|
|
714
|
-
"onSelect"
|
|
715
|
-
])]),
|
|
716
|
-
_: 2
|
|
717
|
-
}, 1024)]),
|
|
718
|
-
"tool-showMultipleChoice": P(({ part: e }) => [C(_, { mode: "out-in" }, {
|
|
719
|
-
default: P(() => [C(j(g), {
|
|
720
|
-
part: e,
|
|
721
|
-
"allow-custom-answer": "",
|
|
722
|
-
answered: on(e),
|
|
723
|
-
onSelect: (t) => cn("showMultipleChoice", e, t)
|
|
724
|
-
}, null, 8, [
|
|
725
|
-
"part",
|
|
726
|
-
"answered",
|
|
727
|
-
"onSelect"
|
|
728
|
-
])]),
|
|
729
|
-
_: 2
|
|
730
|
-
}, 1024)]),
|
|
731
|
-
"tool-requestOAuthConnection": P(({ part: e }) => [C(j(se), {
|
|
732
|
-
part: e,
|
|
733
|
-
"backend-url": j(Ge),
|
|
734
|
-
"resolve-connection": (e) => j(V).getOAuthAuthorizeUrl(F.agentId, e),
|
|
735
|
-
"check-connection": (e) => j(V).getOAuthConnectionStatus(F.agentId, e),
|
|
736
|
-
onConnected: (t) => fn(e, t)
|
|
737
|
-
}, null, 8, [
|
|
738
|
-
"part",
|
|
739
|
-
"backend-url",
|
|
740
|
-
"resolve-connection",
|
|
741
|
-
"check-connection",
|
|
742
|
-
"onConnected"
|
|
743
|
-
])]),
|
|
744
|
-
"tool-requestGeolocation": P(({ part: e }) => [C(j(oe), {
|
|
745
|
-
part: e,
|
|
746
|
-
"call-live": j(Z).isActive.value,
|
|
747
|
-
"reverse-geocode": (e, t) => j(V).reverseGeocode(e, t),
|
|
748
|
-
onResult: (t) => dn(e, t)
|
|
749
|
-
}, null, 8, [
|
|
750
|
-
"part",
|
|
751
|
-
"call-live",
|
|
752
|
-
"reverse-geocode",
|
|
753
|
-
"onResult"
|
|
754
|
-
])]),
|
|
755
|
-
"tool-showLocation": P(({ part: e }) => [C(j(ce), {
|
|
756
|
-
part: e,
|
|
757
|
-
"is-dark": j(Ye),
|
|
758
|
-
"main-color": j(L)?.mainColor,
|
|
759
|
-
"forward-geocode": (e, t) => j(V).forwardGeocode(e, t)
|
|
760
|
-
}, null, 8, [
|
|
761
|
-
"part",
|
|
762
|
-
"is-dark",
|
|
763
|
-
"main-color",
|
|
764
|
-
"forward-geocode"
|
|
765
|
-
])]),
|
|
766
|
-
"tool-showDiagram": P(({ part: e }) => [C(j(ue), {
|
|
767
|
-
part: e,
|
|
768
|
-
"is-dark": j(Ye)
|
|
769
|
-
}, null, 8, ["part", "is-dark"])]),
|
|
770
|
-
"tool-editSpreadsheet": P(({ part: e }) => [(D(), y(j(k), {
|
|
771
|
-
key: j(s)(e),
|
|
772
|
-
part: e,
|
|
773
|
-
"file-url": U
|
|
774
|
-
}, null, 8, ["part"]))]),
|
|
775
|
-
"tool-editWordDocument": P(({ part: e }) => [(D(), y(j(k), {
|
|
776
|
-
key: j(s)(e),
|
|
777
|
-
part: e,
|
|
778
|
-
"file-url": U
|
|
779
|
-
}, null, 8, ["part"]))]),
|
|
780
|
-
"tool-createSpreadsheet": P(({ part: e }) => [(D(), y(j(k), {
|
|
781
|
-
key: j(s)(e),
|
|
782
|
-
part: e,
|
|
783
|
-
"file-url": U
|
|
784
|
-
}, null, 8, ["part"]))]),
|
|
785
|
-
"tool-createWordDocument": P(({ part: e }) => [(D(), y(j(k), {
|
|
786
|
-
key: j(s)(e),
|
|
787
|
-
part: e,
|
|
788
|
-
"file-url": U
|
|
789
|
-
}, null, 8, ["part"]))]),
|
|
790
|
-
"tool-shareDocument": P(({ part: e }) => [(D(), y(j(de), {
|
|
791
|
-
key: j(s)(e),
|
|
792
|
-
part: e,
|
|
793
|
-
"on-download": Rt
|
|
794
|
-
}, null, 8, ["part"]))]),
|
|
795
|
-
_: 1
|
|
796
|
-
}, 8, /* @__PURE__ */ "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(".")))]),
|
|
797
|
-
_: 1
|
|
798
|
-
}),
|
|
799
|
-
j(nt).length ? (D(), y(p, {
|
|
800
|
-
key: 0,
|
|
801
|
-
messages: j(nt),
|
|
802
|
-
onEdit: j(St),
|
|
803
|
-
onRemove: j(Ct)
|
|
804
|
-
}, null, 8, [
|
|
805
|
-
"messages",
|
|
806
|
-
"onEdit",
|
|
807
|
-
"onRemove"
|
|
808
|
-
])) : b("", !0),
|
|
809
|
-
S("div", Me, [
|
|
810
|
-
C(_, { name: "pk-chatbot-view-chat-fade" }, {
|
|
811
|
-
default: P(() => [Pt.value ? (D(), y(ve, {
|
|
812
|
-
key: 0,
|
|
813
|
-
class: "pk-chatbot-view-chat__aurora",
|
|
814
|
-
"source-selector": ".pk-chatbot-input__form"
|
|
815
|
-
})) : b("", !0)]),
|
|
816
|
-
_: 1
|
|
817
|
-
}),
|
|
818
|
-
j(mn) && !j(We) ? (D(), y(m, {
|
|
819
|
-
key: 0,
|
|
820
|
-
pending: j(mn),
|
|
821
|
-
stopping: j(hn),
|
|
822
|
-
onStop: j(gn)
|
|
823
|
-
}, null, 8, [
|
|
824
|
-
"pending",
|
|
825
|
-
"stopping",
|
|
826
|
-
"onStop"
|
|
827
|
-
])) : b("", !0),
|
|
828
|
-
j(We) ? (D(), x("div", Ne, A(j(G)("message.chatErrorConversationBlocked")), 1)) : Yt.value === "idle" ? (D(), y(f, {
|
|
829
|
-
key: 3,
|
|
830
|
-
ref_key: "inputEl",
|
|
831
|
-
ref: at,
|
|
832
|
-
modelValue: j(He),
|
|
833
|
-
"onUpdate:modelValue": n[4] ||= (e) => re(He) ? He.value = e : null,
|
|
834
|
-
"pending-attachments": j(Ke),
|
|
835
|
-
"onUpdate:pendingAttachments": n[5] ||= (e) => re(Ke) ? Ke.value = e : null,
|
|
836
|
-
placeholder: j(Ue),
|
|
837
|
-
"dismissable-notice": j(Mt) && j(B).messages.length <= 1 ? j(Mt) : void 0,
|
|
838
|
-
"page-notice": kt.value,
|
|
839
|
-
status: Dt.value,
|
|
840
|
-
"max-message-length": j(L)?.maxMessageLength,
|
|
841
|
-
"file-upload": H.value,
|
|
842
|
-
"attachment-limit-reached": j(qe),
|
|
843
|
-
"attachment-notice": At.value,
|
|
844
|
-
"voice-enabled": Jt.value,
|
|
845
|
-
"queue-enabled": j(tt),
|
|
846
|
-
"answer-notices": jt.value,
|
|
847
|
-
onStopGeneration: j(st),
|
|
848
|
-
onSubmit: j(ot),
|
|
849
|
-
onFileSelect: j(gt),
|
|
850
|
-
onDismissAttachmentNotice: j(_t),
|
|
851
|
-
onDismissPageNotice: j(bt),
|
|
852
|
-
onOpenAnswerNotice: j(wt),
|
|
853
|
-
onDismissAnswerNotice: j(Tt),
|
|
854
|
-
onVoiceStart: en
|
|
855
|
-
}, te({ _: 2 }, [a.modifier === "fullscreen" ? {
|
|
856
|
-
name: "prepend",
|
|
857
|
-
fn: P(() => [S("span", Pe, [C(u, {
|
|
858
|
-
class: "pk-chatbot-view-chat__agent-chip-avatar",
|
|
859
|
-
"img-src": j(L)?.logo,
|
|
860
|
-
name: j(I).name
|
|
861
|
-
}, null, 8, ["img-src", "name"]), j(I).name ? (D(), x("strong", Fe, A(j(I).name), 1)) : b("", !0)])]),
|
|
862
|
-
key: "0"
|
|
863
|
-
} : void 0]), 1032, [
|
|
864
|
-
"modelValue",
|
|
865
|
-
"pending-attachments",
|
|
866
|
-
"placeholder",
|
|
867
|
-
"dismissable-notice",
|
|
868
|
-
"page-notice",
|
|
869
|
-
"status",
|
|
870
|
-
"max-message-length",
|
|
871
|
-
"file-upload",
|
|
872
|
-
"attachment-limit-reached",
|
|
873
|
-
"attachment-notice",
|
|
874
|
-
"voice-enabled",
|
|
875
|
-
"queue-enabled",
|
|
876
|
-
"answer-notices",
|
|
877
|
-
"onStopGeneration",
|
|
878
|
-
"onSubmit",
|
|
879
|
-
"onFileSelect",
|
|
880
|
-
"onDismissAttachmentNotice",
|
|
881
|
-
"onDismissPageNotice",
|
|
882
|
-
"onOpenAnswerNotice",
|
|
883
|
-
"onDismissAnswerNotice"
|
|
884
|
-
])) : (D(), y(Te, {
|
|
885
|
-
key: 2,
|
|
886
|
-
state: Yt.value,
|
|
887
|
-
sample: Qt,
|
|
888
|
-
spectrum: $t,
|
|
889
|
-
"remaining-seconds": j(Z).remainingSeconds.value,
|
|
890
|
-
muted: K.value,
|
|
891
|
-
error: Xt.value,
|
|
892
|
-
"raw-error": j(Z).error.value,
|
|
893
|
-
live: j(Z).isActive.value,
|
|
894
|
-
class: "pk-chatbot-view-chat__voice",
|
|
895
|
-
onToggleMute: pn,
|
|
896
|
-
onHangUp: tn,
|
|
897
|
-
onRetry: rn,
|
|
898
|
-
onDismiss: nn
|
|
899
|
-
}, null, 8, [
|
|
900
|
-
"state",
|
|
901
|
-
"remaining-seconds",
|
|
902
|
-
"muted",
|
|
903
|
-
"error",
|
|
904
|
-
"raw-error",
|
|
905
|
-
"live"
|
|
906
|
-
]))
|
|
907
|
-
]),
|
|
908
|
-
C(_, null, {
|
|
909
|
-
default: P(() => [j(zt) && H.value?.enabled ? (D(), x("div", Ie, [C(r, {
|
|
910
|
-
name: "ri:upload-cloud-2-line",
|
|
911
|
-
class: "pk-chatbot-view-chat__drop-overlay-icon"
|
|
912
|
-
}), S("span", null, A(j(G)("action.dropFile")), 1)])) : b("", !0)]),
|
|
913
|
-
_: 1
|
|
914
|
-
})
|
|
915
|
-
], 2);
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
});
|
|
919
|
-
export { ve as i, Te as n, be as r, Ve as t };
|
|
920
|
-
|
|
921
|
-
//# sourceMappingURL=PkChatbotViewChat-Djts78Oq.js.map
|