@8wave/ai-elements 0.121.0-beta.58 → 0.121.0-beta.59
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/ai-elements.es.js +2303 -2267
- 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/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/PkAvatar-DwtZWSW4.js +38 -0
- package/dist-vue/_chunks/PkAvatar-DwtZWSW4.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-BjD_4yaD.js → PkChatbot-DtyJG8HB.js} +7 -8
- package/dist-vue/_chunks/PkChatbot-DtyJG8HB.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CMNmmQdu.js → PkChatbotEmptyState-CivaIYxu.js} +2 -3
- package/dist-vue/_chunks/PkChatbotEmptyState-CivaIYxu.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-CdpjDIzr.js → PkChatbotInput-mBl1PWIU.js} +88 -88
- package/dist-vue/_chunks/PkChatbotInput-mBl1PWIU.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-BqFY0Evp.js → PkChatbotViewChat-ZOpF5REL.js} +248 -243
- package/dist-vue/_chunks/PkChatbotViewChat-ZOpF5REL.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DF_c4X6k.js → PkChatbotViewConversations-THKK5wGp.js} +52 -34
- package/dist-vue/_chunks/PkChatbotViewConversations-THKK5wGp.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-B76IwGGP.js → PkChatbotViewFiles-BOGd3r0o.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewFiles-B76IwGGP.js.map → PkChatbotViewFiles-BOGd3r0o.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-Bt0eH8fO.js → PkChatbotViewProfile-XtL9RfC7.js} +3 -4
- package/dist-vue/_chunks/PkChatbotViewProfile-XtL9RfC7.js.map +1 -0
- package/dist-vue/_chunks/{createChatbotApiClient-BYGLKd_e.js → createChatbotApiClient-Bt387Z64.js} +6 -5
- package/dist-vue/_chunks/createChatbotApiClient-Bt387Z64.js.map +1 -0
- package/dist-vue/_chunks/{useChatbotStore-O0u7mVit.js → useChatbotStore-pnj_3y4N.js} +718 -687
- package/dist-vue/_chunks/useChatbotStore-pnj_3y4N.js.map +1 -0
- package/dist-vue/_chunks/useDialogConfirm-fn7iV-iE.js +86 -0
- package/dist-vue/_chunks/useDialogConfirm-fn7iV-iE.js.map +1 -0
- package/dist-vue/api.js +1 -1
- package/dist-vue/composables.js +12 -4
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4252 -4009
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +22 -12
- package/dist-vue/packages/components/src/chat/PkAvatar.d.ts +6 -7
- package/dist-vue/packages/components/src/chat/PkChatSearchDialog.d.ts +19 -0
- package/dist-vue/packages/components/src/chat/{PkAgentSelectorInline.d.ts → PkChatShortcutsDialog.d.ts} +8 -5
- package/dist-vue/packages/components/src/chat/PkChatSidebar.d.ts +7 -8
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -2
- package/dist-vue/packages/components/src/chat/PkChatbotInput.d.ts +4 -1
- package/dist-vue/packages/components/src/chat/index.d.ts +1 -2
- package/dist-vue/packages/composable/src/chatbot/api/createChatbotApiClient.d.ts +11 -1
- package/dist-vue/packages/composable/src/chatbot/useChatbotStore.d.ts +21 -3
- package/dist-vue/packages/composable/src/chatbot/useConversationActions.d.ts +54 -1
- package/dist-vue/packages/models/src/schema/Chat.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist-vue/_chunks/PkAvatar-uVRs_DD9.js +0 -43
- package/dist-vue/_chunks/PkAvatar-uVRs_DD9.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-BjD_4yaD.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotEmptyState-CMNmmQdu.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotInput-CdpjDIzr.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-BqFY0Evp.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-DF_c4X6k.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewProfile-Bt0eH8fO.js.map +0 -1
- package/dist-vue/_chunks/createChatbotApiClient-BYGLKd_e.js.map +0 -1
- package/dist-vue/_chunks/useChatbotStore-O0u7mVit.js.map +0 -1
- package/dist-vue/_chunks/useDialogConfirm-CyD9VTKg.js +0 -84
- package/dist-vue/_chunks/useDialogConfirm-CyD9VTKg.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as e } from "./VvButtonLocalized-C-vx25u4.js";
|
|
2
|
-
import { n as t } from "./useChatbotStore-
|
|
2
|
+
import { n as t } from "./useChatbotStore-pnj_3y4N.js";
|
|
3
3
|
import "./src-B-ZKEhTU.js";
|
|
4
4
|
import { t as n } from "./markdown-BiG_7-9D.js";
|
|
5
5
|
import { r } from "./message-DuibQyHy.js";
|
|
6
6
|
import { D as i } from "./utils-CqPytB2D.js";
|
|
7
|
-
import { t as a } from "./useDialogConfirm-
|
|
7
|
+
import { t as a } from "./useDialogConfirm-fn7iV-iE.js";
|
|
8
8
|
import { t as o } from "./PkRelativeTime-CZF5CYHv.js";
|
|
9
9
|
import { t as s } from "./chatbotProfileContext-b-nve-mR.js";
|
|
10
10
|
import { VvButtonGroup as c, VvDropdown as l, VvDropdownAction as ee, VvIcon as te, VvInputText as ne } from "@volverjs/ui-vue/components";
|
|
@@ -15,7 +15,25 @@ import { storeToRefs as oe } from "pinia";
|
|
|
15
15
|
function O(e) {
|
|
16
16
|
return n(e.title) || n(r(e.messages?.find((e) => e.role === "user"))) || "";
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
var k = 864e5;
|
|
19
|
+
function A(e) {
|
|
20
|
+
let t = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), n = {
|
|
21
|
+
today: [],
|
|
22
|
+
yesterday: [],
|
|
23
|
+
last7Days: [],
|
|
24
|
+
last30Days: [],
|
|
25
|
+
older: []
|
|
26
|
+
};
|
|
27
|
+
for (let r of e) {
|
|
28
|
+
let e = r.lastMessageAt ? new Date(r.lastMessageAt).getTime() : 0;
|
|
29
|
+
e >= t ? n.today.push(r) : e >= t - k ? n.yesterday.push(r) : e >= t - 7 * k ? n.last7Days.push(r) : e >= t - 30 * k ? n.last30Days.push(r) : n.older.push(r);
|
|
30
|
+
}
|
|
31
|
+
return Object.entries(n).filter(([, e]) => e.length > 0).map(([e, t]) => ({
|
|
32
|
+
key: e,
|
|
33
|
+
items: t
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
function j(e) {
|
|
19
37
|
let t = S(null), r = S(""), i = (e, i = "") => {
|
|
20
38
|
t.value = e.id, r.value = n(e.title) || i;
|
|
21
39
|
}, o = async (n) => {
|
|
@@ -47,24 +65,24 @@ function k(e) {
|
|
|
47
65
|
var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
48
66
|
key: 0,
|
|
49
67
|
class: "vv-item-group vv-item-group--fill"
|
|
50
|
-
}, le = { class: "vv-item-group__list" }, ue = { class: "vv-item__entry" }, de = { class: "flex flex-col gap-6 flex-1 min-w-0" },
|
|
68
|
+
}, le = { class: "vv-item-group__list" }, ue = { class: "vv-item__entry" }, de = { class: "flex flex-col gap-6 flex-1 min-w-0" }, M = {
|
|
51
69
|
key: 1,
|
|
52
70
|
class: "flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center"
|
|
53
|
-
},
|
|
71
|
+
}, N = { class: "w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center" }, P = { class: "flex flex-col gap-4" }, F = { class: "text-16 font-semibold text-word-1" }, I = { class: "text-14 text-word-3 leading-relaxed" }, L = {
|
|
54
72
|
key: 2,
|
|
55
73
|
class: "vv-item-group vv-item-group--fill"
|
|
56
|
-
},
|
|
74
|
+
}, R = { class: "vv-item-group__list overflow-y-auto pb-64 light-scrollbar" }, z = {
|
|
57
75
|
key: 0,
|
|
58
76
|
class: "flex flex-1 items-center gap-8 min-w-0 px-md py-12"
|
|
59
|
-
},
|
|
77
|
+
}, B = ["aria-current", "onClick"], V = { class: "min-w-0 flex-1" }, H = { class: "flex items-center gap-8" }, fe = { class: "vv-item__title font-medium flex-1" }, pe = { class: "text-12 text-word-4 line-clamp-2" }, me = { class: "vv-item__actions" }, he = {
|
|
60
78
|
key: 3,
|
|
61
79
|
class: "absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none",
|
|
62
80
|
style: { background: "linear-gradient(to top, var(--color-surface) 55%, transparent)" }
|
|
63
|
-
},
|
|
81
|
+
}, U = /* @__PURE__ */ v({
|
|
64
82
|
__name: "PkChatbotViewConversations",
|
|
65
83
|
props: { agentId: {} },
|
|
66
84
|
setup(v) {
|
|
67
|
-
let O = v, { t:
|
|
85
|
+
let O = v, { t: k } = ae({ useScope: "global" }), A = t(O.agentId), { conversations: U, isLoadingConversations: ge, localChatId: W, runningChatIds: _e } = oe(A), { navigate: ve, startNewChat: G, renameChatTitle: ye, deleteChat: be } = A, { editingId: K, editingTitle: q, startEdit: xe, confirmEdit: Se, cancelEdit: Ce, onRenameKeydown: we, requestDelete: Te } = j({
|
|
68
86
|
renameChatTitle: ye,
|
|
69
87
|
deleteChat: be
|
|
70
88
|
}), J = (e) => {
|
|
@@ -74,14 +92,14 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
74
92
|
}, { openDialogConfirm: De } = a(), Z = y(s, void 0), Q = d(() => !!Z?.eraseConversations && !(Z.isExternalAuth?.value ?? !1)), $ = S(!1), Oe = async () => {
|
|
75
93
|
let e = Z?.eraseConversations;
|
|
76
94
|
if (e && Q.value && await De({
|
|
77
|
-
title:
|
|
78
|
-
questionLabel:
|
|
95
|
+
title: k("confirmTitle.deleteMyConversations"),
|
|
96
|
+
questionLabel: k("message.deleteMyConversationsConfirm")
|
|
79
97
|
})) {
|
|
80
98
|
$.value = !0;
|
|
81
99
|
try {
|
|
82
100
|
await e(), U.value = [], G();
|
|
83
101
|
} catch {
|
|
84
|
-
|
|
102
|
+
A.loadConversations(O.agentId);
|
|
85
103
|
} finally {
|
|
86
104
|
$.value = !1;
|
|
87
105
|
}
|
|
@@ -96,23 +114,23 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
96
114
|
h("div", { class: b(["vv-skeleton h-16 rounded", e % 2 ? "w-192" : "w-128"]) }, [...r[5] ||= [h("div", { class: "vv-skeleton__item" }, null, -1)]], 2),
|
|
97
115
|
r[6] ||= h("div", { class: "vv-skeleton h-12 rounded" }, [h("div", { class: "vv-skeleton__item" })], -1),
|
|
98
116
|
r[7] ||= h("div", { class: "vv-skeleton h-12 rounded w-160" }, [h("div", { class: "vv-skeleton__item" })], -1)
|
|
99
|
-
])])])), 64))])])) : T(U).length === 0 ? (x(), m("div",
|
|
100
|
-
h("div",
|
|
117
|
+
])])])), 64))])])) : T(U).length === 0 ? (x(), m("div", M, [
|
|
118
|
+
h("div", N, [_(a, {
|
|
101
119
|
name: "ri:chat-3-line",
|
|
102
120
|
class: "w-28 h-28 text-word-4"
|
|
103
121
|
})]),
|
|
104
|
-
h("div",
|
|
122
|
+
h("div", P, [h("strong", F, w(T(k)("message.noConversations")), 1), h("span", I, w(T(k)("message.noConversationsHint")), 1)]),
|
|
105
123
|
_(s, {
|
|
106
124
|
modifiers: "primary rounded",
|
|
107
125
|
icon: "ri:add-line",
|
|
108
126
|
class: "mt-8",
|
|
109
|
-
label: T(
|
|
127
|
+
label: T(k)("action.startNewChat"),
|
|
110
128
|
onClick: r[0] ||= (e) => T(G)()
|
|
111
129
|
}, null, 8, ["label"])
|
|
112
|
-
])) : (x(), m("div",
|
|
130
|
+
])) : (x(), m("div", L, [h("ul", R, [(x(!0), m(u, null, C(T(U), (e) => (x(), m("li", {
|
|
113
131
|
key: e.id,
|
|
114
132
|
class: b(["vv-item vv-item--roomy", { "vv-item--current": Y(e) }])
|
|
115
|
-
}, [T(K) === e.id ? (x(), m("div",
|
|
133
|
+
}, [T(K) === e.id ? (x(), m("div", z, [_(d, {
|
|
116
134
|
modelValue: T(q),
|
|
117
135
|
"onUpdate:modelValue": r[1] ||= (e) => re(q) ? q.value = e : null,
|
|
118
136
|
class: "flex-1 mb-0",
|
|
@@ -120,8 +138,8 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
120
138
|
autofocus: "",
|
|
121
139
|
"select-on-focus": "",
|
|
122
140
|
maxlength: 255,
|
|
123
|
-
"aria-label": T(
|
|
124
|
-
placeholder: T(
|
|
141
|
+
"aria-label": T(k)("placeholder.insert"),
|
|
142
|
+
placeholder: T(k)("placeholder.insert"),
|
|
125
143
|
onKeydown: (t) => T(we)(t, e.id)
|
|
126
144
|
}, null, 8, [
|
|
127
145
|
"modelValue",
|
|
@@ -131,12 +149,12 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
131
149
|
]), _(v, { modifiers: "compact" }, {
|
|
132
150
|
default: E(() => [_(s, {
|
|
133
151
|
icon: "ri:save-line",
|
|
134
|
-
title: T(
|
|
152
|
+
title: T(k)("action.save"),
|
|
135
153
|
modifiers: "action-quiet-small",
|
|
136
154
|
onClick: (t) => T(Se)(e.id)
|
|
137
155
|
}, null, 8, ["title", "onClick"]), _(s, {
|
|
138
156
|
icon: "ri:close-line",
|
|
139
|
-
title: T(
|
|
157
|
+
title: T(k)("action.cancel"),
|
|
140
158
|
modifiers: "action-quiet-small",
|
|
141
159
|
onClick: r[2] ||= (e) => T(Ce)()
|
|
142
160
|
}, null, 8, ["title"])]),
|
|
@@ -146,21 +164,21 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
146
164
|
class: "vv-item__entry",
|
|
147
165
|
"aria-current": Y(e) ? "true" : void 0,
|
|
148
166
|
onClick: (t) => J(e.id)
|
|
149
|
-
}, [h("div",
|
|
150
|
-
h("strong",
|
|
167
|
+
}, [h("div", V, [h("div", H, [
|
|
168
|
+
h("strong", fe, w(T(n)(e.title) || X(e.messages, "assistant")), 1),
|
|
151
169
|
T(_e).includes(e.id) ? (x(), f(a, {
|
|
152
170
|
key: 0,
|
|
153
171
|
name: "loading-loop",
|
|
154
172
|
role: "img",
|
|
155
|
-
title: T(
|
|
156
|
-
"aria-label": T(
|
|
173
|
+
title: T(k)("label.answeringInBackground"),
|
|
174
|
+
"aria-label": T(k)("label.answeringInBackground"),
|
|
157
175
|
class: "w-16 h-16 shrink-0 text-word-3"
|
|
158
176
|
}, null, 8, ["title", "aria-label"])) : p("", !0),
|
|
159
177
|
_(o, {
|
|
160
178
|
class: "text-word-4 text-smaller shrink-0",
|
|
161
179
|
date: e.lastMessageAt
|
|
162
180
|
}, null, 8, ["date"])
|
|
163
|
-
]), h("span",
|
|
181
|
+
]), h("span", pe, w(T(n)(T(i)(e.summary, T(k))) || X(e.messages, "user")), 1)])], 8, B), h("div", me, [_(S, ie({ ref_for: !0 }, {
|
|
164
182
|
placement: "bottom-end",
|
|
165
183
|
modifiers: "menu",
|
|
166
184
|
flip: !0,
|
|
@@ -168,15 +186,15 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
168
186
|
strategy: "fixed"
|
|
169
187
|
}), {
|
|
170
188
|
items: E(() => [_(y, { onClick: (t) => Ee(e) }, {
|
|
171
|
-
default: E(() => [_(a, { name: "ri:pencil-line" }), g(" " + w(T(
|
|
189
|
+
default: E(() => [_(a, { name: "ri:pencil-line" }), g(" " + w(T(k)("action.renameChat")), 1)]),
|
|
172
190
|
_: 1
|
|
173
191
|
}, 8, ["onClick"]), _(y, { onClick: (t) => T(Te)(e.id) }, {
|
|
174
|
-
default: E(() => [_(a, { name: "ri:delete-bin-line" }), g(" " + w(T(
|
|
192
|
+
default: E(() => [_(a, { name: "ri:delete-bin-line" }), g(" " + w(T(k)("action.delete")), 1)]),
|
|
175
193
|
_: 1
|
|
176
194
|
}, 8, ["onClick"])]),
|
|
177
195
|
default: E(() => [_(s, {
|
|
178
196
|
icon: "ri:more-2-fill",
|
|
179
|
-
title: T(
|
|
197
|
+
title: T(k)("action.moreActions"),
|
|
180
198
|
modifiers: "action-quiet-small"
|
|
181
199
|
}, null, 8, ["title"])]),
|
|
182
200
|
_: 2
|
|
@@ -184,7 +202,7 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
184
202
|
class: "text-14 pointer-events-auto",
|
|
185
203
|
modifiers: "primary rounded",
|
|
186
204
|
icon: "ri:add-line",
|
|
187
|
-
label: T(
|
|
205
|
+
label: T(k)("action.startNewChat"),
|
|
188
206
|
onClick: r[3] ||= D((e) => T(G)(), ["stop"])
|
|
189
207
|
}, null, 8, ["label"]), Q.value ? (x(), f(s, {
|
|
190
208
|
key: 0,
|
|
@@ -193,7 +211,7 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
193
211
|
icon: "ri:delete-bin-line",
|
|
194
212
|
loading: $.value,
|
|
195
213
|
disabled: $.value,
|
|
196
|
-
label: T(
|
|
214
|
+
label: T(k)("action.deleteMyConversations"),
|
|
197
215
|
onClick: r[4] ||= D((e) => Oe(), ["stop"])
|
|
198
216
|
}, null, 8, [
|
|
199
217
|
"loading",
|
|
@@ -203,6 +221,6 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
|
|
|
203
221
|
};
|
|
204
222
|
}
|
|
205
223
|
});
|
|
206
|
-
export { O as n,
|
|
224
|
+
export { j as i, O as n, A as r, U as t };
|
|
207
225
|
|
|
208
|
-
//# sourceMappingURL=PkChatbotViewConversations-
|
|
226
|
+
//# sourceMappingURL=PkChatbotViewConversations-THKK5wGp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotViewConversations-THKK5wGp.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","__unplugin_components_5","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_isRef","_withCtx","_createBlock","_createCommentVNode","PkRelativeTime","_mergeProps","_createTextVNode","_withModifiers","_sfc_main","VvButtonLocalized","useChatbotStore","stripMarkdown","localizeSummaryLabels","useDialogConfirm","PkRelativeTime_default","ChatbotProfileContextKey","getConversationPreview","conversation","getTextPart","message","DAY_MS","groupConversationsByDate","startOfToday","buckets","conversations","time","items","key","useConversationActions","editingId","ref","editingTitle","startEdit","fallbackTitle","confirmEdit","trimmed","actions","id","cancelEdit","onRenameKeydown","event","openDialogConfirm","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","PkChatbotViewConversations_default","defineComponent","props","__props","$t","useI18n","store","storeToRefs","startEditConversation","handleDelete","openConversation","navigate","isCurrentConversation","localChatId","getLastMessage","messages","m","role","profile","inject","canEraseConversations","computed","isErasingConversations","handleEraseAll","eraseConversations","startNewChat","_component_VvIcon","VvIcon","_component_VvButton","_component_VvInputText","VvInputText","_component_VvButtonGroup","VvButtonGroup","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","openBlock","createElementBlock","unref","isLoadingConversations","createElementVNode","Fragment","renderList","i","normalizeClass","_cache","createVNode","toDisplayString","isRef","$event","withCtx","runningChatIds","createBlock","createCommentVNode","mergeProps","createTextVNode","withModifiers"],"sources":["../../../../packages/composable/src/chatbot/useConversationActions.ts","../../../../packages/components/src/chat/PkChatbotViewConversations.vue","../../../../packages/components/src/chat/PkChatbotViewConversations.vue"],"sourcesContent":["import { ref } from 'vue'\nimport type { Chat as Conversation } from 'models'\nimport { getTextPart, stripMarkdown } from 'utils'\nimport { useDialogConfirm } from '../useDialogConfirm'\n\n/**\n * Single-line preview for a conversation: explicit title, otherwise the\n * first user message. Used as list label and as search haystack.\n */\nexport function getConversationPreview(conversation: Conversation): string {\n return (\n stripMarkdown(conversation.title) ||\n stripMarkdown(\n getTextPart(\n // The list endpoint isn't Zod-parsed: don't trust the\n // declared types at runtime\n conversation.messages?.find(\n (message) => message.role === 'user',\n ),\n ),\n ) ||\n ''\n )\n}\n\nconst DAY_MS = 86_400_000\n\n/**\n * Date sections of the conversation lists (PkChatSidebar,\n * PkChatSearchDialog), newest first: today, yesterday, the last 7 and 30\n * days, older. Keeps the order of the input and drops the empty sections.\n */\nexport function groupConversationsByDate(conversations: Conversation[]) {\n const startOfToday = new Date().setHours(0, 0, 0, 0)\n const buckets = {\n today: [] as Conversation[],\n yesterday: [] as Conversation[],\n last7Days: [] as Conversation[],\n last30Days: [] as Conversation[],\n older: [] as Conversation[],\n }\n for (const conversation of conversations) {\n // lastMessageAt is typed as Date but arrives as an ISO string at\n // runtime (the chatbot API client doesn't parse through Zod)\n const time = conversation.lastMessageAt\n ? new Date(conversation.lastMessageAt).getTime()\n : 0\n if (time >= startOfToday) {\n buckets.today.push(conversation)\n } else if (time >= startOfToday - DAY_MS) {\n buckets.yesterday.push(conversation)\n } else if (time >= startOfToday - 7 * DAY_MS) {\n buckets.last7Days.push(conversation)\n } else if (time >= startOfToday - 30 * DAY_MS) {\n buckets.last30Days.push(conversation)\n } else {\n buckets.older.push(conversation)\n }\n }\n return (Object.entries(buckets) as [keyof typeof buckets, Conversation[]][])\n .filter(([, items]) => items.length > 0)\n .map(([key, items]) => ({ key, items }))\n}\n\n/**\n * Inline-rename and delete-with-confirm state shared by the conversation\n * lists (PkChatbotViewConversations, PkChatSidebar). Renames are optimistic:\n * on failure the next conversations load reconciles with the server state.\n */\nexport function useConversationActions(actions: {\n renameChatTitle: (chatId: string, title: string) => Promise<unknown>\n deleteChat: (chatId: string) => Promise<unknown>\n}) {\n const editingId = ref<string | null>(null)\n const editingTitle = ref('')\n\n const startEdit = (conversation: Conversation, fallbackTitle = '') => {\n editingId.value = conversation.id\n editingTitle.value = stripMarkdown(conversation.title) || fallbackTitle\n }\n\n const confirmEdit = async (id: string) => {\n const trimmed = editingTitle.value.trim()\n editingId.value = null\n if (trimmed && trimmed.length <= 255) {\n try {\n await actions.renameChatTitle(id, trimmed)\n } catch {\n // Revert optimistically: reload will pick up server state\n }\n }\n }\n\n const cancelEdit = () => {\n editingId.value = null\n }\n\n const onRenameKeydown = (event: KeyboardEvent, id: string) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n confirmEdit(id)\n } else if (event.key === 'Escape') {\n event.preventDefault()\n cancelEdit()\n }\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n const requestDelete = async (id: string) => {\n try {\n const proceed = await openDialogConfirm()\n if (!proceed) {\n return\n }\n await actions.deleteChat(id)\n } catch {\n // Silently fail: next load will reconcile\n }\n }\n\n return {\n editingId,\n editingTitle,\n startEdit,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete,\n }\n}\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;AASA,SAAgB+B,EAAuB,GAAoC;CACvE,OACIL,EAAcM,EAAa,KAAK,KAChCN,EACIO,EAGID,EAAa,UAAU,MAClB,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e, n as t, o as n } from "./Document-C06S5S5M.js";
|
|
2
2
|
import { t as r } from "./VvButtonLocalized-C-vx25u4.js";
|
|
3
|
-
import { n as i } from "./useChatbotStore-
|
|
4
|
-
import { t as a } from "./useDialogConfirm-
|
|
3
|
+
import { n as i } from "./useChatbotStore-pnj_3y4N.js";
|
|
4
|
+
import { t as a } from "./useDialogConfirm-fn7iV-iE.js";
|
|
5
5
|
import { t as o } from "./useImageFallback-HUe4GHah.js";
|
|
6
6
|
import { VvIcon as s } from "@volverjs/ui-vue/components";
|
|
7
7
|
import { Fragment as c, createBlock as l, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, normalizeClass as m, openBlock as h, ref as g, renderList as _, toDisplayString as v, unref as y } from "vue";
|
|
@@ -121,4 +121,4 @@ var w = { class: "flex flex-col flex-1 min-h-0 relative" }, T = {
|
|
|
121
121
|
});
|
|
122
122
|
export { V as t };
|
|
123
123
|
|
|
124
|
-
//# sourceMappingURL=PkChatbotViewFiles-
|
|
124
|
+
//# sourceMappingURL=PkChatbotViewFiles-BOGd3r0o.js.map
|
package/dist-vue/_chunks/{PkChatbotViewFiles-B76IwGGP.js.map → PkChatbotViewFiles-BOGd3r0o.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotViewFiles-B76IwGGP.js","names":["__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_createBlock","_sfc_main","isImageMime","fileIconForMime","isInlineViewable","VvButtonLocalized","useChatbotStore","useDialogConfirm","useImageFallback","useFileRow","useI18n","thumbUrl","urls","file","canShowImage","inline","download","iso","locale","useUserFileKind","isChatFile","t","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","PkChatbotViewFiles_default","defineComponent","props","__props","$t","store","storeToRefs","deletingId","ref","handleExclude","openDialogConfirm","removeConfirm","_component_VvIcon","VvIcon","_component_VvButton","openBlock","createElementBlock","unref","isLoadingChatFiles","chatFiles","createElementVNode","Fragment","renderList","i","_cache","normalizeClass","createVNode","toDisplayString","openFile","showThumb","onThumbError","createBlock","formatDate","kindNote","removeLabel"],"sources":["../../../../packages/composable/src/useFileRow.ts","../../../../packages/components/src/chat/PkChatbotViewFiles.vue","../../../../packages/components/src/chat/PkChatbotViewFiles.vue"],"sourcesContent":["import { useI18n } from 'vue-i18n'\nimport { isImageMime, isInlineViewable, type UserFileKind } from 'models'\nimport { useImageFallback } from './useImageFallback'\n\n/** Minimal shape a file-list row needs for the shared display helpers. */\nexport interface FileRowLike {\n documentId: string\n mimeType: string | null\n}\n\n/**\n * Shared display logic for the user-files list rows, used by both the in-app\n * table (PjUserFilesTable) and the embedded widget (PkChatbotViewFiles). The two\n * surfaces differ only in how they build URLs (authenticated store vs widget API\n * client), so the URL builders are injected.\n *\n * - `view(id, inline)` → opens/downloads the original file.\n * - `preview(id)` → small resized blob for the row thumbnail.\n */\nexport function useFileRow(urls: {\n view: (documentId: string, inline: boolean) => string\n preview: (documentId: string) => string\n}) {\n const { locale } = useI18n({ useScope: 'global' })\n\n // Image rows show a thumbnail; if it fails to load (auth/redirect, or the\n // preview isn't generated yet) we fall back to the file-type icon.\n const { canShowImage, onImageError } = useImageFallback()\n const thumbUrl = (file: FileRowLike): string =>\n urls.preview(file.documentId)\n const showThumb = (file: FileRowLike): boolean =>\n isImageMime(file.mimeType) && canShowImage(thumbUrl(file))\n const onThumbError = (file: FileRowLike): void => {\n onImageError(thumbUrl(file))\n }\n\n // Name click previews images/PDF inline; an explicit download forces an\n // attachment (inline=false → download SAS).\n const openFile = (file: FileRowLike, download = false): void => {\n const inline = !download && isInlineViewable(file.mimeType)\n window.open(urls.view(file.documentId, inline), '_blank', 'noopener')\n }\n\n const formatDate = (iso: string): string =>\n new Date(iso).toLocaleDateString(locale.value, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })\n\n return { showThumb, thumbUrl, onThumbError, openFile, formatDate }\n}\n\n/** What tells a chat file row (a spreadsheet, a Word document) apart from a KB document. */\nexport interface FileKindLike {\n kind?: UserFileKind\n sourceAttachmentId?: string | null\n createdByAgent?: boolean\n}\n\n/**\n * The wording that depends on what a \"My files\" row is. A KB document is a\n * copy of the upload: removing it only takes it out of the assistant's reach.\n * A spreadsheet or a Word document is the chat attachment itself, uploaded or\n * created by the assistant, and never enters the KB: its row says so, and\n * removing it deletes it from its chat with every version the assistant wrote\n * of it.\n */\nexport function useUserFileKind() {\n const { t } = useI18n({ useScope: 'global' })\n\n const isChatFile = (file: FileKindLike): boolean =>\n file.kind === 'spreadsheet' || file.kind === 'wordDocument'\n\n /** A short note for the row; undefined for a KB document. */\n const kindNote = (file: FileKindLike): string | undefined => {\n if (!isChatFile(file)) {\n return undefined\n }\n if (file.sourceAttachmentId) {\n return t('userFiles.chatFileVersion')\n }\n return file.createdByAgent\n ? t('userFiles.chatFileCreated')\n : t('userFiles.chatFileInChatOnly')\n }\n\n const removeLabel = (file: FileKindLike): string =>\n isChatFile(file)\n ? t('userFiles.deleteChatFile')\n : t('userFiles.exclude')\n\n /** The options of the confirmation dialog before removing the file. */\n const removeConfirm = (file: FileKindLike) =>\n isChatFile(file)\n ? {\n title:\n file.kind === 'wordDocument'\n ? t('confirmTitle.deleteWordDocument')\n : t('confirmTitle.deleteSpreadsheet'),\n questionLabel: file.createdByAgent\n ? t('userFiles.deleteCreatedFileConfirm')\n : t('userFiles.deleteChatFileConfirm'),\n }\n : {\n title: t('confirmTitle.excludeUserFile'),\n questionLabel: t('userFiles.excludeConfirm'),\n }\n\n return { isChatFile, kindNote, removeLabel, removeConfirm }\n}\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-96\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"chatFiles.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-96\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"chatFiles.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;AAmBA,SAAgBoB,EAAW,GAGxB;CACC,IAAM,EAAE,cAAWC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAI3C,EAAE,iBAAc,oBAAiBF,EAAiB,GAClDG,KAAY,MACdC,EAAK,QAAQC,EAAK,UAAU;CAqBhC,OAAO;EAAE,YApBU,MACfX,EAAYW,EAAK,QAAQ,KAAKC,EAAaH,EAASE,CAAI,CAAC;EAmBzC;EAAU,eAlBR,MAA4B;GAC9C,EAAaF,EAASE,CAAI,CAAC;EAC/B;EAgB4C,WAZ1B,GAAmB,IAAW,OAAgB;GAC5D,IAAME,IAAS,CAACC,KAAYZ,EAAiBS,EAAK,QAA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CAACtD,GAAI,EAAA;G,mCACzBf,EAMmCuD,GAAA;IAL/B,WAAU;IACV,MAAK;IACJ,OAAO5D,EAAAgF,CAAA,CAAW,CAAC5D,CAAI;IACvB,SAASiC,EAAA,UAAejC,EAAK;IAC7B,UAAUiC,EAAA,UAAejC,EAAK;IAC9B,UAAK,MAAEmC,EAAcnC,CAAI"}
|
|
1
|
+
{"version":3,"file":"PkChatbotViewFiles-BOGd3r0o.js","names":["__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_createBlock","_sfc_main","isImageMime","fileIconForMime","isInlineViewable","VvButtonLocalized","useChatbotStore","useDialogConfirm","useImageFallback","useFileRow","useI18n","thumbUrl","urls","file","canShowImage","inline","download","iso","locale","useUserFileKind","isChatFile","t","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","PkChatbotViewFiles_default","defineComponent","props","__props","$t","store","storeToRefs","deletingId","ref","handleExclude","openDialogConfirm","removeConfirm","_component_VvIcon","VvIcon","_component_VvButton","openBlock","createElementBlock","unref","isLoadingChatFiles","chatFiles","createElementVNode","Fragment","renderList","i","_cache","normalizeClass","createVNode","toDisplayString","openFile","showThumb","onThumbError","createBlock","formatDate","kindNote","removeLabel"],"sources":["../../../../packages/composable/src/useFileRow.ts","../../../../packages/components/src/chat/PkChatbotViewFiles.vue","../../../../packages/components/src/chat/PkChatbotViewFiles.vue"],"sourcesContent":["import { useI18n } from 'vue-i18n'\nimport { isImageMime, isInlineViewable, type UserFileKind } from 'models'\nimport { useImageFallback } from './useImageFallback'\n\n/** Minimal shape a file-list row needs for the shared display helpers. */\nexport interface FileRowLike {\n documentId: string\n mimeType: string | null\n}\n\n/**\n * Shared display logic for the user-files list rows, used by both the in-app\n * table (PjUserFilesTable) and the embedded widget (PkChatbotViewFiles). The two\n * surfaces differ only in how they build URLs (authenticated store vs widget API\n * client), so the URL builders are injected.\n *\n * - `view(id, inline)` → opens/downloads the original file.\n * - `preview(id)` → small resized blob for the row thumbnail.\n */\nexport function useFileRow(urls: {\n view: (documentId: string, inline: boolean) => string\n preview: (documentId: string) => string\n}) {\n const { locale } = useI18n({ useScope: 'global' })\n\n // Image rows show a thumbnail; if it fails to load (auth/redirect, or the\n // preview isn't generated yet) we fall back to the file-type icon.\n const { canShowImage, onImageError } = useImageFallback()\n const thumbUrl = (file: FileRowLike): string =>\n urls.preview(file.documentId)\n const showThumb = (file: FileRowLike): boolean =>\n isImageMime(file.mimeType) && canShowImage(thumbUrl(file))\n const onThumbError = (file: FileRowLike): void => {\n onImageError(thumbUrl(file))\n }\n\n // Name click previews images/PDF inline; an explicit download forces an\n // attachment (inline=false → download SAS).\n const openFile = (file: FileRowLike, download = false): void => {\n const inline = !download && isInlineViewable(file.mimeType)\n window.open(urls.view(file.documentId, inline), '_blank', 'noopener')\n }\n\n const formatDate = (iso: string): string =>\n new Date(iso).toLocaleDateString(locale.value, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })\n\n return { showThumb, thumbUrl, onThumbError, openFile, formatDate }\n}\n\n/** What tells a chat file row (a spreadsheet, a Word document) apart from a KB document. */\nexport interface FileKindLike {\n kind?: UserFileKind\n sourceAttachmentId?: string | null\n createdByAgent?: boolean\n}\n\n/**\n * The wording that depends on what a \"My files\" row is. A KB document is a\n * copy of the upload: removing it only takes it out of the assistant's reach.\n * A spreadsheet or a Word document is the chat attachment itself, uploaded or\n * created by the assistant, and never enters the KB: its row says so, and\n * removing it deletes it from its chat with every version the assistant wrote\n * of it.\n */\nexport function useUserFileKind() {\n const { t } = useI18n({ useScope: 'global' })\n\n const isChatFile = (file: FileKindLike): boolean =>\n file.kind === 'spreadsheet' || file.kind === 'wordDocument'\n\n /** A short note for the row; undefined for a KB document. */\n const kindNote = (file: FileKindLike): string | undefined => {\n if (!isChatFile(file)) {\n return undefined\n }\n if (file.sourceAttachmentId) {\n return t('userFiles.chatFileVersion')\n }\n return file.createdByAgent\n ? t('userFiles.chatFileCreated')\n : t('userFiles.chatFileInChatOnly')\n }\n\n const removeLabel = (file: FileKindLike): string =>\n isChatFile(file)\n ? t('userFiles.deleteChatFile')\n : t('userFiles.exclude')\n\n /** The options of the confirmation dialog before removing the file. */\n const removeConfirm = (file: FileKindLike) =>\n isChatFile(file)\n ? {\n title:\n file.kind === 'wordDocument'\n ? t('confirmTitle.deleteWordDocument')\n : t('confirmTitle.deleteSpreadsheet'),\n questionLabel: file.createdByAgent\n ? t('userFiles.deleteCreatedFileConfirm')\n : t('userFiles.deleteChatFileConfirm'),\n }\n : {\n title: t('confirmTitle.excludeUserFile'),\n questionLabel: t('userFiles.excludeConfirm'),\n }\n\n return { isChatFile, kindNote, removeLabel, removeConfirm }\n}\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-96\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"chatFiles.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-96\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"chatFiles.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;AAmBA,SAAgBoB,EAAW,GAGxB;CACC,IAAM,EAAE,cAAWC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAI3C,EAAE,iBAAc,oBAAiBF,EAAiB,GAClDG,KAAY,MACdC,EAAK,QAAQC,EAAK,UAAU;CAqBhC,OAAO;EAAE,YApBU,MACfX,EAAYW,EAAK,QAAQ,KAAKC,EAAaH,EAASE,CAAI,CAAC;EAmBzC;EAAU,eAlBR,MAA4B;GAC9C,EAAaF,EAASE,CAAI,CAAC;EAC/B;EAgB4C,WAZ1B,GAAmB,IAAW,OAAgB;GAC5D,IAAME,IAAS,CAACC,KAAYZ,EAAiBS,EAAK,QAAQ;GAC1D,OAAO,KAAKD,EAAK,KAAKC,EAAK,YAAYE,CAAM,GAAG,UAAU,UAAU;EACxE;EASsD,aAPlC,MAChB,IAAI,KAAKE,CAAG,CAAC,CAAC,mBAAmBC,EAAO,OAAO;GAC3C,MAAM;GACN,OAAO;GACP,KAAK;EACT,CAAC;CAE4D;AACrE;AAiBA,SAAgBC,IAAkB;CAC9B,IAAM,EAAE,SAAMT,EAAQ,EAAE,UAAU,SAAS,CAAC,GAEtCU,KAAc,MAChBP,EAAK,SAAS,iBAAiBA,EAAK,SAAS;CAqCjD,OAAO;EAAE;EAAY,WAlCH,MAA2C;GACzD,IAAKO,EAAWP,CAAI,GAMpB,OAHIA,EAAK,qBACEQ,EAAE,2BAA2B,IAEjCR,EAAK,iBACNQ,EAAE,2BAA2B,IAC7BA,EAAE,8BAA8B;EAC1C;EAwB+B,cAtBV,MACjBD,EAAWP,CAAI,IACTQ,EAAE,0BAA0B,IAC5BA,EAAE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E,CAAA,CAAY,CAACxD,CAAI;G,oBAC7BtB,EAAA,GAAAS,EAE6CmD,GAAA;;IAAxC,MAAM1D,EAAAU,CAAA,CAAe,CAACU,EAAK,QAAQ;G,0BAE5CnB,EAWO,QAXPyC,GAWO,CAVHzC,EAEO,QAFP0C,GAEOrC,EADAc,EAAK,QAAQpB,EAAAkD,CAAA,CAAE,CAAA,oBAAA,CAAA,GAAA,CAAA,GAEtBjD,EAMO,QANP2C,GAMOtC,EAAA,CAJEN,EAAA8E,CAAA,CAAU,CAAC1D,EAAK,SAAS,GAAGpB,EAAA+E,CAAA,CAAQ,CAAC3D,CAAI,CAAA,CAAA,CAA4C,OAAO,OAAO,CAAA,CAA2C,KAAI,KAAA,CAAA,GAAA,CAAA,C,YAOnKnB,EAaM,OAbN4C,GAaM,CAZFxC,EAIoCuD,GAAA;IAHhC,WAAU;IACV,MAAK;IACJ,OAAO5D,EAAAkD,CAAA,CAAE,CAAA,iBAAA;IACT,UAAK,MAAElD,EAAA0E,CAAA,CAAQ,CAACtD,GAAI,EAAA;G,mCACzBf,EAMmCuD,GAAA;IAL/B,WAAU;IACV,MAAK;IACJ,OAAO5D,EAAAgF,CAAA,CAAW,CAAC5D,CAAI;IACvB,SAASiC,EAAA,UAAejC,EAAK;IAC7B,UAAUiC,EAAA,UAAejC,EAAK;IAC9B,UAAK,MAAEmC,EAAcnC,CAAI"}
|
package/dist-vue/_chunks/{PkChatbotViewProfile-Bt0eH8fO.js → PkChatbotViewProfile-XtL9RfC7.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./VvButtonLocalized-C-vx25u4.js";
|
|
2
|
-
import { n as t } from "./useChatbotStore-
|
|
3
|
-
import { t as n } from "./PkAvatar-
|
|
2
|
+
import { n as t } from "./useChatbotStore-pnj_3y4N.js";
|
|
3
|
+
import { t as n } from "./PkAvatar-DwtZWSW4.js";
|
|
4
4
|
import { t as r } from "./chatbotProfileContext-b-nve-mR.js";
|
|
5
5
|
import { VvAlert as i, VvIcon as a } from "@volverjs/ui-vue/components";
|
|
6
6
|
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, inject as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v } from "vue";
|
|
@@ -37,7 +37,6 @@ var x = { class: "flex flex-col flex-1 min-h-0 overflow-y-auto" }, S = { class:
|
|
|
37
37
|
let o = i, f = a, p = e;
|
|
38
38
|
return m(), l("div", x, [
|
|
39
39
|
u("div", S, [d(n, {
|
|
40
|
-
modifiers: "surface ring",
|
|
41
40
|
class: "w-64 h-64",
|
|
42
41
|
name: z.value?.name ?? v(I),
|
|
43
42
|
"img-src": z.value?.image ?? v(L)?.logo
|
|
@@ -83,4 +82,4 @@ var x = { class: "flex flex-col flex-1 min-h-0 overflow-y-auto" }, S = { class:
|
|
|
83
82
|
});
|
|
84
83
|
export { N as t };
|
|
85
84
|
|
|
86
|
-
//# sourceMappingURL=PkChatbotViewProfile-
|
|
85
|
+
//# sourceMappingURL=PkChatbotViewProfile-XtL9RfC7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotViewProfile-XtL9RfC7.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","PkAvatar","_unref","_toDisplayString","_createCommentVNode","_createBlock","_renderSlot","_sfc_main","VvButtonLocalized","useChatbotStore","PkAvatar_default","ChatbotProfileContextKey","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","PkChatbotViewProfile_default","defineComponent","props","__props","$t","useI18n","store","agentName","storeToRefs","profile","inject","user","computed","canManage","profileUrl","isExternalAuth","isSigningOut","ref","errorMessage","onSignOut","error","_component_VvAlert","VvAlert","_component_VvIcon","VvIcon","_component_VvButton","openBlock","createElementBlock","createElementVNode","createVNode","unref","agentInterface","toDisplayString","createCommentVNode","createBlock","renderSlot","_ctx"],"sources":["../../../../packages/components/src/chat/PkChatbotViewProfile.vue","../../../../packages/components/src/chat/PkChatbotViewProfile.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { useChatbotStore } from 'composables'\n import PkAvatar from './PkAvatar.vue'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const { name: agentName, agentInterface } = storeToRefs(store)\n\n const profile = inject(ChatbotProfileContextKey, undefined)\n const user = computed(() => profile?.user.value ?? null)\n const canManage = computed(() => profile?.canManageProfile.value ?? false)\n const profileUrl = computed(() => profile?.profileUrl.value)\n // External token mode: the host owns the auth lifecycle, so the widget\n // offers no sign-out nor profile management (the main site is not\n // accessible to externally authenticated users).\n const isExternalAuth = computed(\n () => profile?.isExternalAuth?.value ?? false,\n )\n\n const isSigningOut = ref(false)\n const errorMessage = ref<string>()\n\n async function onSignOut() {\n if (!profile) {\n return\n }\n isSigningOut.value = true\n try {\n await profile.signOut()\n } catch (error) {\n errorMessage.value =\n error instanceof Error ? error.message : $t('message.error')\n } finally {\n isSigningOut.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 overflow-y-auto\">\n <!-- Hero: user identity -->\n <div\n class=\"flex flex-col items-center gap-sm pt-lg px-lg pb-md bg-surface-1 border-b border-surface-3\">\n <PkAvatar\n class=\"w-64 h-64\"\n :name=\"user?.name ?? agentName\"\n :img-src=\"user?.image ?? agentInterface?.logo\" />\n <div class=\"flex flex-col items-center gap-6 text-center\">\n <strong\n v-if=\"user?.name ?? agentName\"\n class=\"text-16 font-semibold text-word-1 leading-tight\">\n {{ user?.name ?? agentName }}\n </strong>\n <span\n v-if=\"user?.email\"\n class=\"text-12 text-word-3 leading-none\">\n {{ user.email }}\n </span>\n </div>\n </div>\n\n <!-- Actions -->\n <div class=\"flex flex-col gap-sm p-md flex-1\">\n <VvAlert\n v-if=\"errorMessage\"\n modifiers=\"danger\"\n :content=\"errorMessage\" />\n\n <!-- Manage profile link card -->\n <a\n v-if=\"canManage && profileUrl && !isExternalAuth\"\n :href=\"profileUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"flex items-center gap-12 p-12 rounded-lg border border-surface-3 hover:border-surface-5 hover:bg-surface-1 transition-colors cursor-pointer no-underline\">\n <div\n class=\"w-40 h-40 rounded-lg bg-surface-2 border border-surface-3 flex items-center justify-center shrink-0\">\n <VvIcon\n name=\"ri:user-settings-line\"\n class=\"w-20 h-20 text-word-2\" />\n </div>\n <div class=\"flex flex-col flex-1 min-w-0 gap-1\">\n <span class=\"text-14 font-medium text-word-1 leading-tight\">\n {{ $t('action.manageProfile') }}\n </span>\n <span class=\"text-12 text-word-3 leading-tight\">\n {{ $t('label.manageProfileDescription') }}\n </span>\n </div>\n <VvIcon\n name=\"ri:arrow-right-s-line\"\n class=\"w-16 h-16 text-word-4 shrink-0\" />\n </a>\n </div>\n\n <!-- Footer: sign out -->\n <div v-if=\"!isExternalAuth\" class=\"px-md py-sm\">\n <VvButton\n modifiers=\"secondary-danger\"\n class=\"w-full\"\n icon=\"ri:logout-box-line\"\n :loading=\"isSigningOut\"\n :disabled=\"isSigningOut\"\n :label=\"$t('action.signOut')\"\n @click=\"onSignOut\" />\n </div>\n\n <slot />\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { useChatbotStore } from 'composables'\n import PkAvatar from './PkAvatar.vue'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const { name: agentName, agentInterface } = storeToRefs(store)\n\n const profile = inject(ChatbotProfileContextKey, undefined)\n const user = computed(() => profile?.user.value ?? null)\n const canManage = computed(() => profile?.canManageProfile.value ?? false)\n const profileUrl = computed(() => profile?.profileUrl.value)\n // External token mode: the host owns the auth lifecycle, so the widget\n // offers no sign-out nor profile management (the main site is not\n // accessible to externally authenticated users).\n const isExternalAuth = computed(\n () => profile?.isExternalAuth?.value ?? false,\n )\n\n const isSigningOut = ref(false)\n const errorMessage = ref<string>()\n\n async function onSignOut() {\n if (!profile) {\n return\n }\n isSigningOut.value = true\n try {\n await profile.signOut()\n } catch (error) {\n errorMessage.value =\n error instanceof Error ? error.message : $t('message.error')\n } finally {\n isSigningOut.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 overflow-y-auto\">\n <!-- Hero: user identity -->\n <div\n class=\"flex flex-col items-center gap-sm pt-lg px-lg pb-md bg-surface-1 border-b border-surface-3\">\n <PkAvatar\n class=\"w-64 h-64\"\n :name=\"user?.name ?? agentName\"\n :img-src=\"user?.image ?? agentInterface?.logo\" />\n <div class=\"flex flex-col items-center gap-6 text-center\">\n <strong\n v-if=\"user?.name ?? agentName\"\n class=\"text-16 font-semibold text-word-1 leading-tight\">\n {{ user?.name ?? agentName }}\n </strong>\n <span\n v-if=\"user?.email\"\n class=\"text-12 text-word-3 leading-none\">\n {{ user.email }}\n </span>\n </div>\n </div>\n\n <!-- Actions -->\n <div class=\"flex flex-col gap-sm p-md flex-1\">\n <VvAlert\n v-if=\"errorMessage\"\n modifiers=\"danger\"\n :content=\"errorMessage\" />\n\n <!-- Manage profile link card -->\n <a\n v-if=\"canManage && profileUrl && !isExternalAuth\"\n :href=\"profileUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"flex items-center gap-12 p-12 rounded-lg border border-surface-3 hover:border-surface-5 hover:bg-surface-1 transition-colors cursor-pointer no-underline\">\n <div\n class=\"w-40 h-40 rounded-lg bg-surface-2 border border-surface-3 flex items-center justify-center shrink-0\">\n <VvIcon\n name=\"ri:user-settings-line\"\n class=\"w-20 h-20 text-word-2\" />\n </div>\n <div class=\"flex flex-col flex-1 min-w-0 gap-1\">\n <span class=\"text-14 font-medium text-word-1 leading-tight\">\n {{ $t('action.manageProfile') }}\n </span>\n <span class=\"text-12 text-word-3 leading-tight\">\n {{ $t('label.manageProfileDescription') }}\n </span>\n </div>\n <VvIcon\n name=\"ri:arrow-right-s-line\"\n class=\"w-16 h-16 text-word-4 shrink-0\" />\n </a>\n </div>\n\n <!-- Footer: sign out -->\n <div v-if=\"!isExternalAuth\" class=\"px-md py-sm\">\n <VvButton\n modifiers=\"secondary-danger\"\n class=\"w-full\"\n icon=\"ri:logout-box-line\"\n :loading=\"isSigningOut\"\n :disabled=\"isSigningOut\"\n :label=\"$t('action.signOut')\"\n @click=\"onSignOut\" />\n </div>\n\n <slot />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAQI,IAAMgC,IAAQC,GAER,EAAE,GAAGC,MAAOC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1CC,IAAQrB,EAAgBiB,EAAM,OAAO,GACrC,EAAE,MAAMK,GAAW,sBAAmBC,EAAYF,CAAK,GAEvDG,IAAUC,EAAOvB,GAA0B,KAAA,CAAS,GACpDwB,IAAOC,QAAeH,GAAS,KAAK,SAAS,IAAI,GACjDI,IAAYD,QAAeH,GAAS,iBAAiB,SAAS,EAAK,GACnEK,IAAaF,QAAeH,GAAS,WAAW,KAAK,GAIrDM,IAAiBH,QACbH,GAAS,gBAAgB,SAAS,EAC5C,GAEMO,IAAeC,EAAI,EAAK,GACxBC,IAAeD,EAAY;EAEjC,eAAeE,IAAY;GACvB,IAAKV,GAGL;MAAa,QAAQ;IACrB,IAAI;KACA,MAAMA,EAAQ,QAAQ;IAC1B,SAASW,GAAO;KACZ,EAAa,QACTA,aAAiB,QAAQA,EAAM,UAAUhB,EAAG,eAAe;IACnE,UAAU;KACN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KACN,MAAK;KACJ,SAAST,EAAA;KACT,UAAUA,EAAA;KACV,OAAOtC,EAAA0B,CAAA,CAAE,CAAA,gBAAA;KACT,SAAOe;;;;;;IAGhBrC,EAAQsD,EAAA,QAAA,SAAA"}
|
package/dist-vue/_chunks/{createChatbotApiClient-BYGLKd_e.js → createChatbotApiClient-Bt387Z64.js}
RENAMED
|
@@ -175,7 +175,8 @@ c({
|
|
|
175
175
|
...m.range("lastMessageAt"),
|
|
176
176
|
...m.ids(),
|
|
177
177
|
startDate: e().optional(),
|
|
178
|
-
endDate: e().optional()
|
|
178
|
+
endDate: e().optional(),
|
|
179
|
+
search: e().trim().max(200).optional()
|
|
179
180
|
});
|
|
180
181
|
var P = c({
|
|
181
182
|
id: e(),
|
|
@@ -416,9 +417,9 @@ function ze(e) {
|
|
|
416
417
|
if (i !== "void" && a.status !== 204) return a.json();
|
|
417
418
|
}
|
|
418
419
|
return {
|
|
419
|
-
async getConversations(e, t) {
|
|
420
|
-
let
|
|
421
|
-
return (await i(`/agents/${encodeURIComponent(e)}/chats?sort=-lastMessageAt&page[size]=100${
|
|
420
|
+
async getConversations(e, t, n) {
|
|
421
|
+
let r = t ? `&filter[userId]=${encodeURIComponent(t)}` : "", a = n?.page ? `&page[number]=${n.page}` : "", o = n?.search ? `&search=${encodeURIComponent(n.search)}` : "";
|
|
422
|
+
return (await i(`/agents/${encodeURIComponent(e)}/chats?sort=-lastMessageAt&page[size]=100${a}${r}${o}`)).map($);
|
|
422
423
|
},
|
|
423
424
|
async getChatFiles(t) {
|
|
424
425
|
let n = await fetch(`${r}/me/documents?filter[chatId]=${encodeURIComponent(t)}&page[size]=100`, {
|
|
@@ -607,4 +608,4 @@ function ze(e) {
|
|
|
607
608
|
}
|
|
608
609
|
export { A as a, j as i, Z as n, M as r, ze as t };
|
|
609
610
|
|
|
610
|
-
//# sourceMappingURL=createChatbotApiClient-
|
|
611
|
+
//# sourceMappingURL=createChatbotApiClient-Bt387Z64.js.map
|