@versini/sassysaint 8.87.0 → 8.87.1
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/{AboutChangelog.DkbFYL2t.js → AboutChangelog.o0RrePDe.js} +3 -3
- package/dist/chunks/{AboutEntry.DendBA43.js → AboutEntry.B-jI9DmU.js} +5 -5
- package/dist/chunks/{App.QSOXgzIH.js → App.Cw4x07xc.js} +16 -16
- package/dist/chunks/{Chart.C9bHvy2K.js → Chart.Cnr0zcD_.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.Btz9UWKo.js → ChatBubbleAssistant.Dov1Kdlx.js} +4 -4
- package/dist/chunks/{ChatBubbleUser.DS4Vvpe1.js → ChatBubbleUser.BpJ-IsSf.js} +3 -3
- package/dist/chunks/{ChatHistoryTable.FldPAY_P.js → ChatHistoryTable.BjqwKZJO.js} +3 -3
- package/dist/chunks/{HistoryEntry.BvKANXld.js → HistoryEntry.CYnHVo3I.js} +3 -3
- package/dist/chunks/{ProfileEntry.ShOqkzsc.js → ProfileEntry.U3mHnYGY.js} +2 -2
- package/dist/chunks/{SettingsEntry.CN-udzD7.js → SettingsEntry.2ursSi4P.js} +3 -3
- package/dist/chunks/{UsageEntry.DQM0kwWT.js → UsageEntry.BOr75SBT.js} +3 -3
- package/dist/chunks/UserMemoriesPanel.BBBhJt3_.js +756 -0
- package/dist/chunks/{index.rTT6Fa2A.js → index.BUPcQvlr.js} +1 -1
- package/dist/chunks/{index.CwcDgCgg.js → index.Bfo9JTHh.js} +1 -1
- package/dist/chunks/{index.CoKtiw-a.js → index.BrE3_o6F.js} +2 -2
- package/dist/chunks/{index.Cw_qwY4i.js → index.CFqFrOCp.js} +1 -1
- package/dist/chunks/{index.tCwYhDIF.js → index.CpMnKe5v.js} +3 -3
- package/dist/chunks/{index.BOTqIliq.js → index.DoR-38mQ.js} +1 -1
- package/dist/chunks/{index.C2dcBo5d.js → index.euuiion4.js} +1 -1
- package/dist/chunks/{index.s8wrxGpV.js → index.nlBBvIGH.js} +1 -1
- package/dist/chunks/{index.DXPR93d9.js → index.o7M2h5Kz.js} +1 -1
- package/dist/chunks/{useMarkdown.BkKfGoyx.js → useMarkdown.Cwmhcac2.js} +279 -280
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +4 -4
- package/package.json +3 -3
- package/dist/chunks/UserMemoriesPanel.a4D47pAN.js +0 -745
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { L as E, j$1 as f, Button as b, n as ke, useLocalStorage as Q, LOCAL_STORAGE_PREFIX as Z, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as we, e$1 as l, LOCAL_STORAGE_SORT_MEMORY_COLUMN as Te, useUserMemories as Se, useExpiredMemories as ve, useDeleteMemory as De, useDeleteAllActiveMemories as be, useDeleteAllExpiredMemories as Me, useUpdateMemory as Ee, useRestoreMemory as Re, ButtonIcon as O, IconEdit as Ie, IconDelete as ee, IconRestore as Le } from "./index.DoR-38mQ.js";
|
|
3
|
+
import { Panel as se, Toggle as _, ConfirmationPanel as te, Tooltip as z } from "./App.Cw4x07xc.js";
|
|
4
|
+
import { W as re, j as ie, G as D, M as s, F as B, H as oe, D as ne } from "./index.nlBBvIGH.js";
|
|
5
|
+
import A from "clsx";
|
|
6
|
+
import { useState as y, useEffect as Oe, useRef as le } from "react";
|
|
7
|
+
import { TextArea as _e } from "./index.Bfo9JTHh.js";
|
|
8
|
+
const ze = ({
|
|
9
|
+
open: C,
|
|
10
|
+
onOpenChange: M,
|
|
11
|
+
initialText: c,
|
|
12
|
+
metadata: o,
|
|
13
|
+
onSave: R,
|
|
14
|
+
isSaving: m = !1
|
|
15
|
+
}) => {
|
|
16
|
+
const [p, I] = y(c), [h, N] = y("none");
|
|
17
|
+
Oe(() => {
|
|
18
|
+
if (C) {
|
|
19
|
+
I(c);
|
|
20
|
+
const n = o?.expiration || "none";
|
|
21
|
+
N(n);
|
|
22
|
+
}
|
|
23
|
+
}, [C, c, o?.expiration]);
|
|
24
|
+
const w = () => {
|
|
25
|
+
if (p.trim().length >= 3) {
|
|
26
|
+
const n = h === "none" ? null : h;
|
|
27
|
+
R(p.trim(), n);
|
|
28
|
+
}
|
|
29
|
+
}, u = p.trim().length >= 3, T = p.trim() !== c.trim() || h !== (o?.expiration || "none");
|
|
30
|
+
return /* @__PURE__ */ e(
|
|
31
|
+
se,
|
|
32
|
+
{
|
|
33
|
+
open: C,
|
|
34
|
+
onOpenChange: M,
|
|
35
|
+
title: "Edit Memory",
|
|
36
|
+
animation: !0,
|
|
37
|
+
animationType: "fade",
|
|
38
|
+
footer: /* @__PURE__ */ r(E, { columnGap: 2, alignHorizontal: "flex-end", children: [
|
|
39
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
40
|
+
b,
|
|
41
|
+
{
|
|
42
|
+
mode: "dark",
|
|
43
|
+
variant: "secondary",
|
|
44
|
+
noBorder: !0,
|
|
45
|
+
focusMode: "light",
|
|
46
|
+
onClick: () => M(!1),
|
|
47
|
+
disabled: m,
|
|
48
|
+
children: "Cancel"
|
|
49
|
+
}
|
|
50
|
+
) }),
|
|
51
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
52
|
+
b,
|
|
53
|
+
{
|
|
54
|
+
mode: "dark",
|
|
55
|
+
focusMode: "light",
|
|
56
|
+
disabled: m || !u || !T,
|
|
57
|
+
onClick: w,
|
|
58
|
+
children: m ? "Saving..." : "Save"
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
] }),
|
|
62
|
+
children: /* @__PURE__ */ r("div", { className: "flex flex-col pt-2 gap-4", children: [
|
|
63
|
+
/* @__PURE__ */ e(
|
|
64
|
+
_e,
|
|
65
|
+
{
|
|
66
|
+
mode: "dark",
|
|
67
|
+
focusMode: "light",
|
|
68
|
+
label: "Memory text",
|
|
69
|
+
name: "memoryText",
|
|
70
|
+
value: p,
|
|
71
|
+
onChange: (n) => I(n.target.value),
|
|
72
|
+
autoFocus: !0,
|
|
73
|
+
helperText: p.trim().length < 3 ? "Memory text must be at least 3 characters" : `${p.length} characters`
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
|
|
77
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Expiration" }),
|
|
78
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-slate-400 m-0", children: "Set when this memory should expire and be automatically removed." }),
|
|
79
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-2", children: [
|
|
80
|
+
/* @__PURE__ */ e(
|
|
81
|
+
_,
|
|
82
|
+
{
|
|
83
|
+
mode: "dark",
|
|
84
|
+
focusMode: "light",
|
|
85
|
+
noBorder: !0,
|
|
86
|
+
narrow: !0,
|
|
87
|
+
label: "Never expire",
|
|
88
|
+
name: "expiration-none",
|
|
89
|
+
checked: h === "none",
|
|
90
|
+
onChange: (n) => {
|
|
91
|
+
n && N("none");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ e(
|
|
96
|
+
_,
|
|
97
|
+
{
|
|
98
|
+
mode: "dark",
|
|
99
|
+
focusMode: "light",
|
|
100
|
+
noBorder: !0,
|
|
101
|
+
narrow: !0,
|
|
102
|
+
label: "Short (1 month)",
|
|
103
|
+
name: "expiration-short",
|
|
104
|
+
checked: h === "short",
|
|
105
|
+
onChange: (n) => {
|
|
106
|
+
n && N("short");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ e(
|
|
111
|
+
_,
|
|
112
|
+
{
|
|
113
|
+
mode: "dark",
|
|
114
|
+
focusMode: "light",
|
|
115
|
+
noBorder: !0,
|
|
116
|
+
narrow: !0,
|
|
117
|
+
label: "Medium (6 months)",
|
|
118
|
+
name: "expiration-medium",
|
|
119
|
+
checked: h === "medium",
|
|
120
|
+
onChange: (n) => {
|
|
121
|
+
n && N("medium");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ e(
|
|
126
|
+
_,
|
|
127
|
+
{
|
|
128
|
+
mode: "dark",
|
|
129
|
+
focusMode: "light",
|
|
130
|
+
noBorder: !0,
|
|
131
|
+
narrow: !0,
|
|
132
|
+
label: "Long (1 year)",
|
|
133
|
+
name: "expiration-long",
|
|
134
|
+
checked: h === "long",
|
|
135
|
+
onChange: (n) => {
|
|
136
|
+
n && N("long");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] })
|
|
141
|
+
] }),
|
|
142
|
+
o && /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
|
|
143
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Details" }),
|
|
144
|
+
o.categories && o.categories.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
145
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Category" }),
|
|
146
|
+
/* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: o.categories.map((n, S) => /* @__PURE__ */ e(
|
|
147
|
+
"span",
|
|
148
|
+
{
|
|
149
|
+
className: "text-xs px-2 py-1 bg-slate-700/50 text-slate-200 rounded",
|
|
150
|
+
children: n
|
|
151
|
+
},
|
|
152
|
+
`${n}-${S}`
|
|
153
|
+
)) })
|
|
154
|
+
] }),
|
|
155
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col sm:flex-row gap-4", children: [
|
|
156
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
|
|
157
|
+
o.confidence !== void 0 && o.confidence !== null && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
158
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Confidence" }),
|
|
159
|
+
/* @__PURE__ */ r("span", { className: "text-sm text-slate-200", children: [
|
|
160
|
+
(o.confidence * 100).toFixed(0),
|
|
161
|
+
"%"
|
|
162
|
+
] })
|
|
163
|
+
] }),
|
|
164
|
+
o.status && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
165
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Status" }),
|
|
166
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: o.status })
|
|
167
|
+
] }),
|
|
168
|
+
o.sourceType && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
169
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Source Type" }),
|
|
170
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: o.sourceType })
|
|
171
|
+
] })
|
|
172
|
+
] }),
|
|
173
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
|
|
174
|
+
o.quote && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
175
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Original Prompt" }),
|
|
176
|
+
/* @__PURE__ */ r("p", { className: "text-sm text-slate-200 m-0 italic", children: [
|
|
177
|
+
'"',
|
|
178
|
+
o.quote,
|
|
179
|
+
'"'
|
|
180
|
+
] })
|
|
181
|
+
] }),
|
|
182
|
+
o.canonicalText && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
183
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Canonical Text" }),
|
|
184
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-slate-200 m-0 font-mono", children: o.canonicalText })
|
|
185
|
+
] })
|
|
186
|
+
] })
|
|
187
|
+
] })
|
|
188
|
+
] })
|
|
189
|
+
] })
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}, He = ({
|
|
193
|
+
open: C,
|
|
194
|
+
onOpenChange: M,
|
|
195
|
+
user: c
|
|
196
|
+
}) => {
|
|
197
|
+
const { getAccessToken: o } = ke(), [R] = y(void 0), [m, p] = y("active"), [I, h] = Q({
|
|
198
|
+
key: Z + we,
|
|
199
|
+
initialValue: l.DESC
|
|
200
|
+
}), [N, w] = Q({
|
|
201
|
+
key: Z + Te,
|
|
202
|
+
initialValue: "createdAt"
|
|
203
|
+
}), [u, T] = y(I || l.DESC), [n, S] = y(
|
|
204
|
+
N || "createdAt"
|
|
205
|
+
), { data: v, isLoading: U, isError: q } = Se({
|
|
206
|
+
user: c,
|
|
207
|
+
query: R,
|
|
208
|
+
getAccessToken: o,
|
|
209
|
+
enabled: C && m === "active"
|
|
210
|
+
}), {
|
|
211
|
+
data: g,
|
|
212
|
+
isLoading: $,
|
|
213
|
+
isError: H
|
|
214
|
+
} = ve({
|
|
215
|
+
user: c,
|
|
216
|
+
query: R,
|
|
217
|
+
getAccessToken: o,
|
|
218
|
+
enabled: C && m === "expired"
|
|
219
|
+
}), P = De({ getAccessToken: o }), j = be({ getAccessToken: o }), X = Me({ getAccessToken: o }), F = Ee({ getAccessToken: o }), V = Re({ getAccessToken: o }), [ae, Y] = y(!1), k = le(null), [ce, W] = y(!1), [de, G] = y(!1), x = le(null), J = (t, i, a, d) => {
|
|
220
|
+
k.current = { id: t, text: i, description: a, createdAt: d }, Y(!0);
|
|
221
|
+
}, me = () => {
|
|
222
|
+
k.current && P.mutate({ user: c, memoryId: k.current.id });
|
|
223
|
+
}, xe = (t, i, a, d, ge, fe, Ae, ye, Ce, Ne) => {
|
|
224
|
+
x.current = {
|
|
225
|
+
id: t,
|
|
226
|
+
description: i,
|
|
227
|
+
categories: a,
|
|
228
|
+
quote: d,
|
|
229
|
+
canonicalText: ge,
|
|
230
|
+
confidence: fe,
|
|
231
|
+
status: Ae,
|
|
232
|
+
sourceType: ye,
|
|
233
|
+
expiration: Ce,
|
|
234
|
+
expiresAt: Ne
|
|
235
|
+
}, G(!0);
|
|
236
|
+
}, he = (t, i) => {
|
|
237
|
+
x.current && c && F.mutate(
|
|
238
|
+
{
|
|
239
|
+
user: c,
|
|
240
|
+
memoryId: x.current.id,
|
|
241
|
+
description: t,
|
|
242
|
+
expiration: i || void 0
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
onSuccess: () => {
|
|
246
|
+
G(!1);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}, pe = () => {
|
|
251
|
+
c && W(!0);
|
|
252
|
+
}, ue = () => {
|
|
253
|
+
c && (m === "active" ? j.mutate({ user: c }) : X.mutate({ user: c }));
|
|
254
|
+
}, K = (t) => {
|
|
255
|
+
const i = `${t.total} memor${t.total === 1 ? "y" : "ies"}`, a = t.totalTokenUsage ? ` (~${t.totalTokenUsage} tokens)` : "";
|
|
256
|
+
return i + a;
|
|
257
|
+
};
|
|
258
|
+
return /* @__PURE__ */ r(L, { children: [
|
|
259
|
+
/* @__PURE__ */ e(
|
|
260
|
+
ze,
|
|
261
|
+
{
|
|
262
|
+
open: de,
|
|
263
|
+
onOpenChange: G,
|
|
264
|
+
initialText: x.current?.description || "",
|
|
265
|
+
metadata: x.current ? {
|
|
266
|
+
categories: x.current.categories,
|
|
267
|
+
quote: x.current.quote,
|
|
268
|
+
canonicalText: x.current.canonicalText,
|
|
269
|
+
confidence: x.current.confidence,
|
|
270
|
+
status: x.current.status,
|
|
271
|
+
sourceType: x.current.sourceType,
|
|
272
|
+
expiration: x.current.expiration,
|
|
273
|
+
expiresAt: x.current.expiresAt
|
|
274
|
+
} : void 0,
|
|
275
|
+
onSave: he,
|
|
276
|
+
isSaving: F.isPending
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
/* @__PURE__ */ r(
|
|
280
|
+
te,
|
|
281
|
+
{
|
|
282
|
+
showConfirmation: ae,
|
|
283
|
+
setShowConfirmation: Y,
|
|
284
|
+
action: me,
|
|
285
|
+
customStrings: {
|
|
286
|
+
title: "Delete memory",
|
|
287
|
+
confirmAction: "Delete",
|
|
288
|
+
cancelAction: "Cancel"
|
|
289
|
+
},
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
|
|
292
|
+
/* @__PURE__ */ r("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
|
|
293
|
+
/* @__PURE__ */ r("li", { children: [
|
|
294
|
+
"Excerpt:",
|
|
295
|
+
" ",
|
|
296
|
+
(k.current?.description || k.current?.text || "").slice(0, 80)
|
|
297
|
+
] }),
|
|
298
|
+
/* @__PURE__ */ r("li", { children: [
|
|
299
|
+
"Created:",
|
|
300
|
+
" ",
|
|
301
|
+
k.current?.createdAt ? new Date(k.current.createdAt).toLocaleString() : "-"
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
),
|
|
307
|
+
/* @__PURE__ */ e(
|
|
308
|
+
te,
|
|
309
|
+
{
|
|
310
|
+
showConfirmation: ce,
|
|
311
|
+
setShowConfirmation: W,
|
|
312
|
+
action: ue,
|
|
313
|
+
customStrings: {
|
|
314
|
+
title: m === "active" ? "Delete all active memories" : "Delete all expired memories",
|
|
315
|
+
confirmAction: "Delete all",
|
|
316
|
+
cancelAction: "Cancel"
|
|
317
|
+
},
|
|
318
|
+
children: /* @__PURE__ */ e("p", { className: "m-0", children: m === "active" ? "This will permanently delete all active memories for this user. This action cannot be undone." : "This will permanently delete all expired memories for this user. This action cannot be undone." })
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ e(
|
|
322
|
+
se,
|
|
323
|
+
{
|
|
324
|
+
open: C,
|
|
325
|
+
onOpenChange: (t) => M(t),
|
|
326
|
+
title: "User Memories",
|
|
327
|
+
animation: !0,
|
|
328
|
+
animationType: "fade",
|
|
329
|
+
footer: /* @__PURE__ */ r(E, { columnGap: 2, alignHorizontal: "flex-end", children: [
|
|
330
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
331
|
+
b,
|
|
332
|
+
{
|
|
333
|
+
mode: "dark",
|
|
334
|
+
variant: "secondary",
|
|
335
|
+
noBorder: !0,
|
|
336
|
+
focusMode: "light",
|
|
337
|
+
onClick: () => M(!1),
|
|
338
|
+
children: "Close"
|
|
339
|
+
}
|
|
340
|
+
) }),
|
|
341
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
342
|
+
b,
|
|
343
|
+
{
|
|
344
|
+
mode: "dark",
|
|
345
|
+
focusMode: "light",
|
|
346
|
+
variant: "danger",
|
|
347
|
+
disabled: (m === "active" ? j.isPending : X.isPending) || (m === "active" ? (v?.total ?? 0) === 0 : (g?.total ?? 0) === 0),
|
|
348
|
+
onClick: pe,
|
|
349
|
+
children: "Delete All"
|
|
350
|
+
}
|
|
351
|
+
) })
|
|
352
|
+
] }),
|
|
353
|
+
children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 @container/editmemoriespanel", children: [
|
|
354
|
+
/* @__PURE__ */ r(E, { columnGap: 2, alignHorizontal: "center", children: [
|
|
355
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
356
|
+
b,
|
|
357
|
+
{
|
|
358
|
+
focusMode: "light",
|
|
359
|
+
mode: m === "active" ? "dark" : "light",
|
|
360
|
+
size: "small",
|
|
361
|
+
noBorder: !0,
|
|
362
|
+
onClick: () => p("active"),
|
|
363
|
+
children: "Active Memories"
|
|
364
|
+
}
|
|
365
|
+
) }),
|
|
366
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
367
|
+
b,
|
|
368
|
+
{
|
|
369
|
+
focusMode: "light",
|
|
370
|
+
mode: m === "expired" ? "dark" : "light",
|
|
371
|
+
size: "small",
|
|
372
|
+
noBorder: !0,
|
|
373
|
+
onClick: () => p("expired"),
|
|
374
|
+
children: "Expired Memories"
|
|
375
|
+
}
|
|
376
|
+
) })
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ e(
|
|
379
|
+
"div",
|
|
380
|
+
{
|
|
381
|
+
className: A(
|
|
382
|
+
"flex flex-col sm:flex-row",
|
|
383
|
+
"max-h-[75vh]",
|
|
384
|
+
"sm:max-h-[75vh]",
|
|
385
|
+
"min-h-[70vh]"
|
|
386
|
+
),
|
|
387
|
+
children: m === "active" ? /* @__PURE__ */ r(L, { children: [
|
|
388
|
+
U && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading memories..." }),
|
|
389
|
+
q && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load memories." }),
|
|
390
|
+
!U && !q && (v && v.items.length > 0 ? /* @__PURE__ */ r(
|
|
391
|
+
re,
|
|
392
|
+
{
|
|
393
|
+
stickyHeader: !0,
|
|
394
|
+
stickyFooter: !0,
|
|
395
|
+
compact: !0,
|
|
396
|
+
mode: "alt-system",
|
|
397
|
+
caption: K(v),
|
|
398
|
+
children: [
|
|
399
|
+
/* @__PURE__ */ e(ie, { children: /* @__PURE__ */ r(D, { children: [
|
|
400
|
+
/* @__PURE__ */ e(s, { className: "sr-only", children: "Row" }),
|
|
401
|
+
/* @__PURE__ */ e(s, { children: "Memory" }),
|
|
402
|
+
/* @__PURE__ */ e(
|
|
403
|
+
B,
|
|
404
|
+
{
|
|
405
|
+
focusMode: "system",
|
|
406
|
+
buttonClassName: "text-xs sm:text-sm",
|
|
407
|
+
cellId: "createdAt",
|
|
408
|
+
align: "left",
|
|
409
|
+
sortDirection: u,
|
|
410
|
+
sortedCell: n,
|
|
411
|
+
onClick: () => {
|
|
412
|
+
S("createdAt"), w("createdAt"), T((t) => {
|
|
413
|
+
const i = t === l.ASC ? l.DESC : l.ASC;
|
|
414
|
+
return h(i), i;
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
children: "Date"
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
/* @__PURE__ */ e(
|
|
421
|
+
B,
|
|
422
|
+
{
|
|
423
|
+
focusMode: "system",
|
|
424
|
+
buttonClassName: "text-xs sm:text-sm",
|
|
425
|
+
cellId: "expiresAt",
|
|
426
|
+
align: "left",
|
|
427
|
+
sortDirection: u,
|
|
428
|
+
sortedCell: n,
|
|
429
|
+
onClick: () => {
|
|
430
|
+
S("expiresAt"), w("expiresAt"), T((t) => {
|
|
431
|
+
const i = t === l.ASC ? l.DESC : l.ASC;
|
|
432
|
+
return h(i), i;
|
|
433
|
+
});
|
|
434
|
+
},
|
|
435
|
+
children: "Expires"
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
/* @__PURE__ */ e(s, { align: "right", children: "Actions" })
|
|
439
|
+
] }) }),
|
|
440
|
+
/* @__PURE__ */ e(oe, { children: [...v.items].sort((t, i) => {
|
|
441
|
+
if (n === "createdAt") {
|
|
442
|
+
const a = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
|
|
443
|
+
return u === l.ASC ? a - d : d - a;
|
|
444
|
+
}
|
|
445
|
+
if (n === "expiresAt") {
|
|
446
|
+
const a = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
|
|
447
|
+
return u === l.ASC ? a - d : d - a;
|
|
448
|
+
}
|
|
449
|
+
return 0;
|
|
450
|
+
}).map((t, i) => /* @__PURE__ */ r(D, { children: [
|
|
451
|
+
/* @__PURE__ */ e(s, { className: A("dark:text-gray-400"), children: i + 1 }),
|
|
452
|
+
/* @__PURE__ */ e(
|
|
453
|
+
s,
|
|
454
|
+
{
|
|
455
|
+
className: A(
|
|
456
|
+
"dark:text-white",
|
|
457
|
+
"max-w-[100px] sm:max-w-[400px]",
|
|
458
|
+
"text-xs sm:text-sm"
|
|
459
|
+
),
|
|
460
|
+
style: {
|
|
461
|
+
wordBreak: "break-word"
|
|
462
|
+
},
|
|
463
|
+
children: t.description || t.text
|
|
464
|
+
}
|
|
465
|
+
),
|
|
466
|
+
/* @__PURE__ */ e(
|
|
467
|
+
s,
|
|
468
|
+
{
|
|
469
|
+
component: "th",
|
|
470
|
+
scope: "row",
|
|
471
|
+
className: A(
|
|
472
|
+
"dark:text-gray-400",
|
|
473
|
+
"sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
|
|
474
|
+
),
|
|
475
|
+
children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
|
|
476
|
+
}
|
|
477
|
+
),
|
|
478
|
+
/* @__PURE__ */ e(
|
|
479
|
+
s,
|
|
480
|
+
{
|
|
481
|
+
className: A(
|
|
482
|
+
"dark:text-gray-400",
|
|
483
|
+
"sm:whitespace-nowrap text-xs sm:text-sm"
|
|
484
|
+
),
|
|
485
|
+
children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "Never"
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
/* @__PURE__ */ e(
|
|
489
|
+
s,
|
|
490
|
+
{
|
|
491
|
+
className: "align-top border-l border-table-light dark:border-table-dark",
|
|
492
|
+
align: "right",
|
|
493
|
+
children: /* @__PURE__ */ r(
|
|
494
|
+
E,
|
|
495
|
+
{
|
|
496
|
+
columnGap: 2,
|
|
497
|
+
alignHorizontal: "flex-end",
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
500
|
+
z,
|
|
501
|
+
{
|
|
502
|
+
label: "Edit memory",
|
|
503
|
+
mode: "system",
|
|
504
|
+
placement: "top",
|
|
505
|
+
trigger: /* @__PURE__ */ e(
|
|
506
|
+
O,
|
|
507
|
+
{
|
|
508
|
+
focusMode: "system",
|
|
509
|
+
noBorder: !0,
|
|
510
|
+
label: "Edit memory",
|
|
511
|
+
variant: "primary",
|
|
512
|
+
disabled: F.isPending,
|
|
513
|
+
onClick: () => xe(
|
|
514
|
+
t.memoryId,
|
|
515
|
+
t.description || t.text,
|
|
516
|
+
t.categories,
|
|
517
|
+
t.quote,
|
|
518
|
+
t.canonicalText,
|
|
519
|
+
t.confidence,
|
|
520
|
+
t.status,
|
|
521
|
+
t.sourceType,
|
|
522
|
+
t.expiration,
|
|
523
|
+
t.expiresAt
|
|
524
|
+
),
|
|
525
|
+
children: /* @__PURE__ */ e(Ie, { size: "size-3", monotone: !0 })
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
) }),
|
|
530
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
531
|
+
z,
|
|
532
|
+
{
|
|
533
|
+
label: "Delete memory",
|
|
534
|
+
mode: "system",
|
|
535
|
+
placement: "top",
|
|
536
|
+
trigger: /* @__PURE__ */ e(
|
|
537
|
+
O,
|
|
538
|
+
{
|
|
539
|
+
focusMode: "system",
|
|
540
|
+
noBorder: !0,
|
|
541
|
+
label: "Delete memory",
|
|
542
|
+
variant: "primary",
|
|
543
|
+
iconClassName: "text-red-700 dark:text-red-500",
|
|
544
|
+
disabled: P.isPending,
|
|
545
|
+
onClick: () => J(
|
|
546
|
+
t.memoryId,
|
|
547
|
+
t.text,
|
|
548
|
+
t.description,
|
|
549
|
+
t.createdAt
|
|
550
|
+
),
|
|
551
|
+
children: /* @__PURE__ */ e(ee, { size: "size-3", monotone: !0 })
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
}
|
|
555
|
+
) })
|
|
556
|
+
]
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
)
|
|
561
|
+
] }, t.memoryId)) }),
|
|
562
|
+
/* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ e(s, { colSpan: 5, children: K(v) }) }) })
|
|
563
|
+
]
|
|
564
|
+
}
|
|
565
|
+
) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No memories stored." }))
|
|
566
|
+
] }) : /* @__PURE__ */ r(L, { children: [
|
|
567
|
+
$ && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading expired memories..." }),
|
|
568
|
+
H && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load expired memories." }),
|
|
569
|
+
!$ && !H && (g && g.items.length > 0 ? /* @__PURE__ */ r(re, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
|
|
570
|
+
/* @__PURE__ */ e(ie, { children: /* @__PURE__ */ r(D, { children: [
|
|
571
|
+
/* @__PURE__ */ e(s, { className: "sr-only", children: "Row" }),
|
|
572
|
+
/* @__PURE__ */ e(s, { children: "Memory" }),
|
|
573
|
+
/* @__PURE__ */ e(
|
|
574
|
+
B,
|
|
575
|
+
{
|
|
576
|
+
focusMode: "system",
|
|
577
|
+
buttonClassName: "text-xs sm:text-sm",
|
|
578
|
+
cellId: "createdAt",
|
|
579
|
+
align: "left",
|
|
580
|
+
sortDirection: u,
|
|
581
|
+
sortedCell: n,
|
|
582
|
+
onClick: () => {
|
|
583
|
+
S("createdAt"), w("createdAt"), T((t) => {
|
|
584
|
+
const i = t === l.ASC ? l.DESC : l.ASC;
|
|
585
|
+
return h(i), i;
|
|
586
|
+
});
|
|
587
|
+
},
|
|
588
|
+
children: "Date"
|
|
589
|
+
}
|
|
590
|
+
),
|
|
591
|
+
/* @__PURE__ */ e(
|
|
592
|
+
B,
|
|
593
|
+
{
|
|
594
|
+
focusMode: "system",
|
|
595
|
+
buttonClassName: "text-xs sm:text-sm",
|
|
596
|
+
cellId: "expiresAt",
|
|
597
|
+
align: "left",
|
|
598
|
+
sortDirection: u,
|
|
599
|
+
sortedCell: n,
|
|
600
|
+
onClick: () => {
|
|
601
|
+
S("expiresAt"), w("expiresAt"), T((t) => {
|
|
602
|
+
const i = t === l.ASC ? l.DESC : l.ASC;
|
|
603
|
+
return h(i), i;
|
|
604
|
+
});
|
|
605
|
+
},
|
|
606
|
+
children: "Expired"
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ e(s, { align: "right", children: "Actions" })
|
|
610
|
+
] }) }),
|
|
611
|
+
/* @__PURE__ */ e(oe, { children: [...g.items].sort((t, i) => {
|
|
612
|
+
if (n === "createdAt") {
|
|
613
|
+
const a = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
|
|
614
|
+
return u === l.ASC ? a - d : d - a;
|
|
615
|
+
}
|
|
616
|
+
if (n === "expiresAt") {
|
|
617
|
+
const a = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
|
|
618
|
+
return u === l.ASC ? a - d : d - a;
|
|
619
|
+
}
|
|
620
|
+
return 0;
|
|
621
|
+
}).map((t, i) => /* @__PURE__ */ r(D, { children: [
|
|
622
|
+
/* @__PURE__ */ e(s, { className: A("dark:text-gray-400"), children: i + 1 }),
|
|
623
|
+
/* @__PURE__ */ e(
|
|
624
|
+
s,
|
|
625
|
+
{
|
|
626
|
+
className: A(
|
|
627
|
+
"dark:text-white",
|
|
628
|
+
"max-w-[100px] sm:max-w-[400px]",
|
|
629
|
+
"text-xs sm:text-sm"
|
|
630
|
+
),
|
|
631
|
+
style: {
|
|
632
|
+
wordBreak: "break-word"
|
|
633
|
+
},
|
|
634
|
+
children: t.description || t.text
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
/* @__PURE__ */ e(
|
|
638
|
+
s,
|
|
639
|
+
{
|
|
640
|
+
component: "th",
|
|
641
|
+
scope: "row",
|
|
642
|
+
className: A(
|
|
643
|
+
"dark:text-gray-400",
|
|
644
|
+
"sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
|
|
645
|
+
),
|
|
646
|
+
children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
|
|
647
|
+
}
|
|
648
|
+
),
|
|
649
|
+
/* @__PURE__ */ e(
|
|
650
|
+
s,
|
|
651
|
+
{
|
|
652
|
+
className: A(
|
|
653
|
+
"dark:text-gray-400",
|
|
654
|
+
"sm:whitespace-nowrap text-xs sm:text-sm"
|
|
655
|
+
),
|
|
656
|
+
children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "-"
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ e(
|
|
660
|
+
s,
|
|
661
|
+
{
|
|
662
|
+
className: "align-top border-l border-table-light dark:border-table-dark",
|
|
663
|
+
align: "right",
|
|
664
|
+
children: /* @__PURE__ */ r(
|
|
665
|
+
E,
|
|
666
|
+
{
|
|
667
|
+
columnGap: 2,
|
|
668
|
+
alignHorizontal: "flex-end",
|
|
669
|
+
children: [
|
|
670
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
671
|
+
z,
|
|
672
|
+
{
|
|
673
|
+
label: "Restore memory",
|
|
674
|
+
mode: "system",
|
|
675
|
+
placement: "top",
|
|
676
|
+
trigger: /* @__PURE__ */ e(
|
|
677
|
+
O,
|
|
678
|
+
{
|
|
679
|
+
focusMode: "system",
|
|
680
|
+
noBorder: !0,
|
|
681
|
+
label: "Restore memory",
|
|
682
|
+
variant: "primary",
|
|
683
|
+
disabled: V.isPending,
|
|
684
|
+
onClick: () => {
|
|
685
|
+
c && V.mutate({
|
|
686
|
+
user: c,
|
|
687
|
+
memoryId: t.memoryId
|
|
688
|
+
});
|
|
689
|
+
},
|
|
690
|
+
children: /* @__PURE__ */ e(Le, { size: "size-3", monotone: !0 })
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
) }),
|
|
695
|
+
/* @__PURE__ */ e(f, { children: /* @__PURE__ */ e(
|
|
696
|
+
z,
|
|
697
|
+
{
|
|
698
|
+
label: "Delete memory",
|
|
699
|
+
mode: "system",
|
|
700
|
+
placement: "top",
|
|
701
|
+
trigger: /* @__PURE__ */ e(
|
|
702
|
+
O,
|
|
703
|
+
{
|
|
704
|
+
focusMode: "system",
|
|
705
|
+
noBorder: !0,
|
|
706
|
+
label: "Delete memory",
|
|
707
|
+
variant: "primary",
|
|
708
|
+
iconClassName: "text-red-700 dark:text-red-500",
|
|
709
|
+
disabled: P.isPending,
|
|
710
|
+
onClick: () => J(
|
|
711
|
+
t.memoryId,
|
|
712
|
+
t.text,
|
|
713
|
+
t.description,
|
|
714
|
+
t.createdAt
|
|
715
|
+
),
|
|
716
|
+
children: /* @__PURE__ */ e(ee, { size: "size-3", monotone: !0 })
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
) })
|
|
721
|
+
]
|
|
722
|
+
}
|
|
723
|
+
)
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
] }, t.memoryId)) }),
|
|
727
|
+
/* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ r(s, { colSpan: 5, children: [
|
|
728
|
+
g.total,
|
|
729
|
+
" expired memor",
|
|
730
|
+
g.total === 1 ? "y" : "ies",
|
|
731
|
+
g.totalTokenUsage !== void 0 && g.totalTokenUsage > 0 && /* @__PURE__ */ r(L, { children: [
|
|
732
|
+
" ",
|
|
733
|
+
"(approximately",
|
|
734
|
+
" ",
|
|
735
|
+
Math.round(
|
|
736
|
+
g.totalTokenUsage
|
|
737
|
+
).toLocaleString(),
|
|
738
|
+
" ",
|
|
739
|
+
"token",
|
|
740
|
+
Math.round(g.totalTokenUsage) === 1 ? "" : "s",
|
|
741
|
+
")"
|
|
742
|
+
] })
|
|
743
|
+
] }) }) })
|
|
744
|
+
] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No expired memories." }))
|
|
745
|
+
] })
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] })
|
|
749
|
+
}
|
|
750
|
+
)
|
|
751
|
+
] });
|
|
752
|
+
};
|
|
753
|
+
export {
|
|
754
|
+
He as UserMemoriesPanel,
|
|
755
|
+
He as default
|
|
756
|
+
};
|