@versini/sassysaint 8.81.1 → 8.83.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AboutChangelog.C1wdrYSy.js → AboutChangelog.Dnae3ZET.js} +3 -3
- package/dist/chunks/{AboutEntry.BBP0FMsE.js → AboutEntry.DaKcxQlb.js} +7 -7
- package/dist/chunks/{App.DXUu7noN.js → App.CfJzwyx5.js} +380 -389
- package/dist/chunks/{Chart.BU6Zc5b7.js → Chart.CmXf5ahL.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.D-RvTGFO.js → ChatBubbleAssistant.rQ0E9CSF.js} +4 -4
- package/dist/chunks/{ChatBubbleUser.BneldyFS.js → ChatBubbleUser.iSkDnxmM.js} +3 -3
- package/dist/chunks/ChatHistoryTable.3HSGoZd4.js +215 -0
- package/dist/chunks/HistoryEntry.4IXWZ8qq.js +298 -0
- package/dist/chunks/{ProfileEntry.COb4Ix5z.js → ProfileEntry.Chfyj-dQ.js} +2 -2
- package/dist/chunks/{SettingsEntry.BVpLsSfw.js → SettingsEntry.SAurNjp0.js} +3 -3
- package/dist/chunks/{UsageEntry.P4bknnZZ.js → UsageEntry.DPp3sbic.js} +3 -3
- package/dist/chunks/{UserMemoriesPanel.CvpKKLRV.js → UserMemoriesPanel.DiSRjoNR.js} +4 -4
- package/dist/chunks/{index.BlptHNvh.js → index.9ZW-D7id.js} +1 -1
- package/dist/chunks/{index.BD8hmCW6.js → index.B6gxiXab.js} +1 -1
- package/dist/chunks/{index.8j5Dq4sI.js → index.BQXkk0E7.js} +984 -989
- package/dist/chunks/{index.qjNo6KZO.js → index.CoVeibJJ.js} +1 -1
- package/dist/chunks/{index.DClQQbmr.js → index.D4xbtPpm.js} +3 -3
- package/dist/chunks/{index.BYK-C5Zz.js → index.DNDgXAMw.js} +2 -2
- package/dist/chunks/{index.BjkO_ONr.js → index.HO-K8Z3S.js} +1 -1
- package/dist/chunks/{index.BPUn0gZ3.js → index.ZpurL-_2.js} +1 -1
- package/dist/chunks/{index.BKDGy5qf.js → index.iKl0E1mP.js} +1 -1
- package/dist/chunks/{useMarkdown.Cw4b4qiL.js → useMarkdown.D1WsA7gy.js} +6 -6
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/chunks/ChatHistoryTable.CZe2E7YV.js +0 -237
- package/dist/chunks/HistoryEntry.wQYZDKWF.js +0 -316
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { f as p, h as u, INFINITE_SCROLL_THRESHOLD as k, CARDS as D, pluralize as T, ButtonIcon as d, IconRestore as y, IconStarInCircle as U, IconStarInCircleLight as z, IconDelete as P, numberFormatter as L, C as _, IconGoogleGemini as G, IconOpenAI as $, IconAnthropic as B, isProbablyMobile as K, K as W, q as Y, E as H } from "./index.8j5Dq4sI.js";
|
|
3
|
-
import { W as F, j as V, G as h, H as j, M as n, F as N } from "./index.BPUn0gZ3.js";
|
|
4
|
-
import { Tooltip as x } from "./App.DXUu7noN.js";
|
|
5
|
-
import l from "clsx";
|
|
6
|
-
import { Fragment as q } from "react";
|
|
7
|
-
const J = {
|
|
8
|
-
[H]: B,
|
|
9
|
-
[Y]: $,
|
|
10
|
-
[W]: G
|
|
11
|
-
}, s = {
|
|
12
|
-
ROW: "row",
|
|
13
|
-
TIMESTAMP: p,
|
|
14
|
-
SUMMARY: "summary",
|
|
15
|
-
PROVIDER: "provider",
|
|
16
|
-
TOKEN_USAGE: u,
|
|
17
|
-
ACTIONS: "actions"
|
|
18
|
-
}, Q = [
|
|
19
|
-
s.ROW,
|
|
20
|
-
s.TIMESTAMP,
|
|
21
|
-
s.SUMMARY,
|
|
22
|
-
s.ACTIONS
|
|
23
|
-
], X = [
|
|
24
|
-
s.ROW,
|
|
25
|
-
s.SUMMARY,
|
|
26
|
-
s.TIMESTAMP,
|
|
27
|
-
s.TOKEN_USAGE,
|
|
28
|
-
s.PROVIDER,
|
|
29
|
-
s.ACTIONS
|
|
30
|
-
], le = ({
|
|
31
|
-
filteredHistory: c,
|
|
32
|
-
historyState: o,
|
|
33
|
-
lastEntryToLoad: g,
|
|
34
|
-
onClickSort: C,
|
|
35
|
-
onClickRestore: R,
|
|
36
|
-
onClickDelete: S,
|
|
37
|
-
onClickFavorite: O,
|
|
38
|
-
infinityScrollMarkerRef: A,
|
|
39
|
-
isLoading: I = !1,
|
|
40
|
-
totalHistoryCount: E,
|
|
41
|
-
isFiltered: v = !1
|
|
42
|
-
}) => {
|
|
43
|
-
const M = K() ? Q : X, w = (t) => {
|
|
44
|
-
switch (t) {
|
|
45
|
-
case s.ROW:
|
|
46
|
-
return /* @__PURE__ */ e(n, { className: "sr-only", children: "Row" }, t);
|
|
47
|
-
case s.TIMESTAMP:
|
|
48
|
-
return /* @__PURE__ */ e(
|
|
49
|
-
N,
|
|
50
|
-
{
|
|
51
|
-
focusMode: "system",
|
|
52
|
-
buttonClassName: "text-xs sm:text-sm",
|
|
53
|
-
cellId: p,
|
|
54
|
-
align: "left",
|
|
55
|
-
sortDirection: o.sortDirection,
|
|
56
|
-
sortedCell: o.sortedCell,
|
|
57
|
-
onClick: () => {
|
|
58
|
-
C(p);
|
|
59
|
-
},
|
|
60
|
-
children: "Date"
|
|
61
|
-
},
|
|
62
|
-
t
|
|
63
|
-
);
|
|
64
|
-
case s.SUMMARY:
|
|
65
|
-
return /* @__PURE__ */ e(n, { className: "text-xs sm:text-sm", children: "Summary" }, t);
|
|
66
|
-
case s.PROVIDER:
|
|
67
|
-
return /* @__PURE__ */ e(n, { className: "text-xs sm:text-sm", children: "Provider" }, t);
|
|
68
|
-
case s.TOKEN_USAGE:
|
|
69
|
-
return /* @__PURE__ */ e(
|
|
70
|
-
N,
|
|
71
|
-
{
|
|
72
|
-
focusMode: "system",
|
|
73
|
-
buttonClassName: "text-xs sm:text-sm",
|
|
74
|
-
cellId: u,
|
|
75
|
-
align: "right",
|
|
76
|
-
sortDirection: o.sortDirection,
|
|
77
|
-
sortedCell: o.sortedCell,
|
|
78
|
-
onClick: () => {
|
|
79
|
-
C(u);
|
|
80
|
-
},
|
|
81
|
-
children: "Tokens"
|
|
82
|
-
},
|
|
83
|
-
t
|
|
84
|
-
);
|
|
85
|
-
case s.ACTIONS:
|
|
86
|
-
return /* @__PURE__ */ e(n, { className: "text-xs sm:text-sm text-right", children: "Actions" }, t);
|
|
87
|
-
default:
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
}, b = (t, r, i) => {
|
|
91
|
-
switch (t) {
|
|
92
|
-
case s.ROW:
|
|
93
|
-
return /* @__PURE__ */ e(n, { children: i + 1 }, t);
|
|
94
|
-
case s.TIMESTAMP:
|
|
95
|
-
return /* @__PURE__ */ e(
|
|
96
|
-
n,
|
|
97
|
-
{
|
|
98
|
-
component: "th",
|
|
99
|
-
scope: "row",
|
|
100
|
-
className: l(
|
|
101
|
-
"dark:text-gray-400",
|
|
102
|
-
"sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
|
|
103
|
-
),
|
|
104
|
-
children: r.timestamp.split(",")[0]
|
|
105
|
-
},
|
|
106
|
-
t
|
|
107
|
-
);
|
|
108
|
-
case s.SUMMARY: {
|
|
109
|
-
const a = r.summary || (r.messages.length > 0 ? r.messages[0]?.content : "");
|
|
110
|
-
return /* @__PURE__ */ e(
|
|
111
|
-
n,
|
|
112
|
-
{
|
|
113
|
-
className: l(
|
|
114
|
-
"dark:text-white",
|
|
115
|
-
"max-w-[100px] sm:max-w-full text-xs sm:text-sm"
|
|
116
|
-
),
|
|
117
|
-
style: {
|
|
118
|
-
wordBreak: "break-word"
|
|
119
|
-
},
|
|
120
|
-
children: a
|
|
121
|
-
},
|
|
122
|
-
t
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
case s.PROVIDER: {
|
|
126
|
-
const a = r.model ? _(r.model) : null, f = a ? J[a] : null;
|
|
127
|
-
return /* @__PURE__ */ e(
|
|
128
|
-
n,
|
|
129
|
-
{
|
|
130
|
-
component: "th",
|
|
131
|
-
scope: "row",
|
|
132
|
-
className: l("dark:text-gray-400"),
|
|
133
|
-
align: "center",
|
|
134
|
-
children: f ? /* @__PURE__ */ e(
|
|
135
|
-
f,
|
|
136
|
-
{
|
|
137
|
-
size: "size-4 sm:size-5",
|
|
138
|
-
semantic: !0,
|
|
139
|
-
title: r.model || a
|
|
140
|
-
}
|
|
141
|
-
) : null
|
|
142
|
-
},
|
|
143
|
-
t
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
case s.TOKEN_USAGE:
|
|
147
|
-
return /* @__PURE__ */ e(
|
|
148
|
-
n,
|
|
149
|
-
{
|
|
150
|
-
className: l("dark:text-gray-400", "text-xs sm:text-sm"),
|
|
151
|
-
align: "right",
|
|
152
|
-
children: r.tokenUsage ? L.format(r.tokenUsage) : "0"
|
|
153
|
-
},
|
|
154
|
-
t
|
|
155
|
-
);
|
|
156
|
-
case s.ACTIONS:
|
|
157
|
-
return /* @__PURE__ */ e(n, { children: /* @__PURE__ */ m("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
|
|
158
|
-
/* @__PURE__ */ e(
|
|
159
|
-
x,
|
|
160
|
-
{
|
|
161
|
-
label: "Restore chat",
|
|
162
|
-
placement: "top",
|
|
163
|
-
trigger: /* @__PURE__ */ e(
|
|
164
|
-
d,
|
|
165
|
-
{
|
|
166
|
-
noBorder: !0,
|
|
167
|
-
label: "Restore chat",
|
|
168
|
-
variant: "primary",
|
|
169
|
-
iconClassName: "text-green-800 dark:text-green-500",
|
|
170
|
-
onClick: async () => {
|
|
171
|
-
await R(r);
|
|
172
|
-
},
|
|
173
|
-
children: /* @__PURE__ */ e(y, { size: "size-3", monotone: !0 })
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
),
|
|
178
|
-
/* @__PURE__ */ e(
|
|
179
|
-
x,
|
|
180
|
-
{
|
|
181
|
-
label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
|
|
182
|
-
placement: "top",
|
|
183
|
-
trigger: /* @__PURE__ */ e(
|
|
184
|
-
d,
|
|
185
|
-
{
|
|
186
|
-
noBorder: !0,
|
|
187
|
-
label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
|
|
188
|
-
variant: "primary",
|
|
189
|
-
onClick: async () => {
|
|
190
|
-
await O(r);
|
|
191
|
-
},
|
|
192
|
-
children: r.favoriteChat ? /* @__PURE__ */ e(U, { size: "size-4", monotone: !0 }) : /* @__PURE__ */ e(z, { size: "size-4", monotone: !0 })
|
|
193
|
-
}
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
),
|
|
197
|
-
/* @__PURE__ */ e(
|
|
198
|
-
x,
|
|
199
|
-
{
|
|
200
|
-
label: "Delete chat",
|
|
201
|
-
placement: "top",
|
|
202
|
-
trigger: /* @__PURE__ */ e(
|
|
203
|
-
d,
|
|
204
|
-
{
|
|
205
|
-
noBorder: !0,
|
|
206
|
-
label: "Delete chat",
|
|
207
|
-
variant: "primary",
|
|
208
|
-
iconClassName: "text-red-700 dark:text-red-500",
|
|
209
|
-
onClick: () => {
|
|
210
|
-
S(r);
|
|
211
|
-
},
|
|
212
|
-
children: /* @__PURE__ */ e(P, { size: "size-3", monotone: !0 })
|
|
213
|
-
}
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
] }) }, t);
|
|
218
|
-
default:
|
|
219
|
-
return null;
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
return /* @__PURE__ */ m(F, { stickyHeader: !0, compact: !0, mode: "alt-system", caption: (() => {
|
|
223
|
-
const t = c.length, r = E ?? t;
|
|
224
|
-
return v && r > t ? `Showing ${T(`${t} chat`, t)} out of ${r}` : T(`${t} chat`, t);
|
|
225
|
-
})(), children: [
|
|
226
|
-
/* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(h, { children: M.map((t) => w(t)) }) }),
|
|
227
|
-
/* @__PURE__ */ e(j, { children: I && c.length === 0 ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(n, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: "Loading..." }) }) }) : c.slice(0, g).map((t, r) => t?.messages?.length > 0 ? /* @__PURE__ */ m(q, { children: [
|
|
228
|
-
r === g - k && /* @__PURE__ */ e("tr", { ref: A }),
|
|
229
|
-
/* @__PURE__ */ e(h, { children: M.map(
|
|
230
|
-
(i) => b(i, t, r)
|
|
231
|
-
) })
|
|
232
|
-
] }, `${D.HISTORY.TITLE}-${t.id}-${r}`) : null) })
|
|
233
|
-
] });
|
|
234
|
-
};
|
|
235
|
-
export {
|
|
236
|
-
le as ChatHistoryTable
|
|
237
|
-
};
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as re, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { n as M, INFINITE_SCROLL_LIMIT as G, INFINITE_SCROLL_THRESHOLD as ae, HistoryContext as U, ChatContext as B, useLocalStorage as p, LOCAL_STORAGE_PREFIX as y, LOCAL_STORAGE_SORT_TIMESTAMP as se, e as h, LOCAL_STORAGE_SORT_TOKEN_USAGE as oe, LOCAL_STORAGE_SORT as ne, f as R, useUserPreferences as ie, useDeleteChat as ce, useToggleFavoriteChat as le, APP_CLASSNAME as de, TOAST_CHAT_DELETED as he, graphQLRequest as ue, SERVICE_TYPES as me, setNewProvider as Ce, ACTION_SORT as Se, h as fe, TOAST_PROVIDER_CHANGED as pe, useChatsHistory as ye, useUserChatStats as Te, LOCAL_STORAGE_SEARCH as ge, LOCAL_STORAGE_FAVORITES_ONLY as Ae, HISTORY_TITLE as Ee, Card as ve, TextInput as _e, debounce as De, IconSearch as Oe, Button as Re, ACTION_SEARCH as Ie } from "./index.8j5Dq4sI.js";
|
|
3
|
-
import { useAiChat as Le, ConfirmationPanel as ke, LazyToastContainerWrapper as be, showErrorToast as Ne, CHAT_SET_PROVIDER as we, showSuccessToast as xe, CHAT_SET_STATUS as He, Panel as Fe, Toggle as Pe } from "./App.DXUu7noN.js";
|
|
4
|
-
import { useRef as H, useState as F, useContext as I, useCallback as z, Suspense as Ve, lazy as Ge, useEffect as ze } from "react";
|
|
5
|
-
const Me = Ge(
|
|
6
|
-
() => import(
|
|
7
|
-
/* webpackChunkName: "history-table" */
|
|
8
|
-
"./ChatHistoryTable.CZe2E7YV.js"
|
|
9
|
-
).then((u) => ({ default: u.ChatHistoryTable }))
|
|
10
|
-
), Ue = ({
|
|
11
|
-
filteredHistory: u,
|
|
12
|
-
dispatch: C,
|
|
13
|
-
onOpenChange: T,
|
|
14
|
-
mutate: S,
|
|
15
|
-
isLoading: L = !1,
|
|
16
|
-
totalHistoryCount: k,
|
|
17
|
-
isFiltered: g = !1
|
|
18
|
-
}) => {
|
|
19
|
-
const { user: i, getAccessToken: a } = M(), f = H(null), n = H({
|
|
20
|
-
id: "",
|
|
21
|
-
timestamp: "",
|
|
22
|
-
message: ""
|
|
23
|
-
}), [A, E] = F(!1), [v, d] = F(
|
|
24
|
-
G + ae
|
|
25
|
-
), { state: c, dispatch: b } = I(U), m = {
|
|
26
|
-
searchString: c.searchString || "",
|
|
27
|
-
sortDirection: c.sortDirection || h.DESC,
|
|
28
|
-
sortedCell: c.sortedCell || R
|
|
29
|
-
}, {
|
|
30
|
-
state: { provider: N },
|
|
31
|
-
setChatId: _,
|
|
32
|
-
setInitialMessages: w
|
|
33
|
-
} = I(B), { setInput: x } = Le(), [D, s] = p({
|
|
34
|
-
key: y + se,
|
|
35
|
-
initialValue: h.DESC
|
|
36
|
-
}), [j, Y] = p({
|
|
37
|
-
key: y + oe,
|
|
38
|
-
initialValue: h.ASC
|
|
39
|
-
}), [, $] = p({
|
|
40
|
-
key: y + ne,
|
|
41
|
-
initialValue: R
|
|
42
|
-
}), { refetch: q } = ie({
|
|
43
|
-
user: i?.username,
|
|
44
|
-
getAccessToken: a
|
|
45
|
-
}), { mutateAsync: K } = ce({ getAccessToken: a }), { mutateAsync: Q } = le({
|
|
46
|
-
getAccessToken: a
|
|
47
|
-
}), W = (e) => {
|
|
48
|
-
const o = c.sortedCell === e;
|
|
49
|
-
let t, O;
|
|
50
|
-
switch (e) {
|
|
51
|
-
case R:
|
|
52
|
-
O = s, t = o ? c.sortDirection : D;
|
|
53
|
-
break;
|
|
54
|
-
case fe:
|
|
55
|
-
O = Y, t = o ? c.sortDirection : j;
|
|
56
|
-
break;
|
|
57
|
-
default:
|
|
58
|
-
O = s, t = o ? c.sortDirection : D;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
const V = t === h.ASC ? h.DESC : h.ASC;
|
|
62
|
-
O(V), $(e), b({
|
|
63
|
-
type: Se,
|
|
64
|
-
payload: {
|
|
65
|
-
sortedCell: e,
|
|
66
|
-
sortDirection: V
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}, X = async () => {
|
|
70
|
-
const e = n.current;
|
|
71
|
-
try {
|
|
72
|
-
await K({
|
|
73
|
-
userId: i?.username || "",
|
|
74
|
-
id: e.id
|
|
75
|
-
}), S(""), await Ne(he, {
|
|
76
|
-
autoClose: 2e3,
|
|
77
|
-
containerId: "history-table"
|
|
78
|
-
});
|
|
79
|
-
} catch {
|
|
80
|
-
}
|
|
81
|
-
}, J = async (e) => {
|
|
82
|
-
try {
|
|
83
|
-
const o = await a(), t = await ue({
|
|
84
|
-
accessToken: o,
|
|
85
|
-
type: me.GET_CHAT,
|
|
86
|
-
params: {
|
|
87
|
-
id: e.id
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
t.data.provider !== N && (await Ce({
|
|
91
|
-
provider: t.data.provider,
|
|
92
|
-
model: t.data.model,
|
|
93
|
-
accessToken: o,
|
|
94
|
-
username: i?.username || ""
|
|
95
|
-
}), C({
|
|
96
|
-
type: we,
|
|
97
|
-
payload: {
|
|
98
|
-
provider: t.data.provider
|
|
99
|
-
}
|
|
100
|
-
}), q(), await xe(
|
|
101
|
-
`${pe} ${t.data.provider}`,
|
|
102
|
-
{
|
|
103
|
-
containerId: "toggle-provider"
|
|
104
|
-
}
|
|
105
|
-
)), C({
|
|
106
|
-
type: He,
|
|
107
|
-
payload: {
|
|
108
|
-
restoring: !0,
|
|
109
|
-
restoredModel: t.data?.model || "",
|
|
110
|
-
restoredUsage: t.data?.tokenUsage || 0
|
|
111
|
-
}
|
|
112
|
-
}), x(""), _(e.id), w(t.data.messages), T(!1);
|
|
113
|
-
} catch {
|
|
114
|
-
}
|
|
115
|
-
}, Z = (e) => {
|
|
116
|
-
n.current = {
|
|
117
|
-
id: e.id,
|
|
118
|
-
timestamp: e.timestamp,
|
|
119
|
-
message: e.messages.length > 0 ? e.messages[0]?.content : ""
|
|
120
|
-
}, E(!A);
|
|
121
|
-
}, ee = async (e) => {
|
|
122
|
-
try {
|
|
123
|
-
await Q({
|
|
124
|
-
userId: i?.username || "",
|
|
125
|
-
id: e.id
|
|
126
|
-
}), S("");
|
|
127
|
-
} catch {
|
|
128
|
-
}
|
|
129
|
-
}, P = z((e) => {
|
|
130
|
-
e[0].isIntersecting && d((t) => t + G);
|
|
131
|
-
}, []), te = z(
|
|
132
|
-
(e) => {
|
|
133
|
-
if (f.current && f.current.disconnect(), e) {
|
|
134
|
-
const o = {
|
|
135
|
-
rootMargin: "20px"
|
|
136
|
-
}, t = new IntersectionObserver(P, o);
|
|
137
|
-
t.observe(e), f.current = t;
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
[P]
|
|
141
|
-
);
|
|
142
|
-
return /* @__PURE__ */ l(re, { children: [
|
|
143
|
-
/* @__PURE__ */ l(
|
|
144
|
-
ke,
|
|
145
|
-
{
|
|
146
|
-
showConfirmation: A,
|
|
147
|
-
setShowConfirmation: E,
|
|
148
|
-
action: X,
|
|
149
|
-
customStrings: {
|
|
150
|
-
confirmAction: "Delete",
|
|
151
|
-
cancelAction: "Cancel",
|
|
152
|
-
title: "Delete chat"
|
|
153
|
-
},
|
|
154
|
-
children: [
|
|
155
|
-
/* @__PURE__ */ r("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
|
|
156
|
-
/* @__PURE__ */ l("ul", { className: "m-0", children: [
|
|
157
|
-
/* @__PURE__ */ l("li", { children: [
|
|
158
|
-
"Timestamp:",
|
|
159
|
-
" ",
|
|
160
|
-
/* @__PURE__ */ r("span", { className: "text-lg", children: n.current && n.current.timestamp })
|
|
161
|
-
] }),
|
|
162
|
-
/* @__PURE__ */ l("li", { children: [
|
|
163
|
-
"First message:",
|
|
164
|
-
" ",
|
|
165
|
-
/* @__PURE__ */ r("span", { className: "text-lg", children: n.current?.message })
|
|
166
|
-
] })
|
|
167
|
-
] })
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
),
|
|
171
|
-
/* @__PURE__ */ r("div", { className: de, children: /* @__PURE__ */ r(be, { containerId: "history-table" }) }),
|
|
172
|
-
/* @__PURE__ */ r(Ve, { fallback: /* @__PURE__ */ r("div", {}), children: /* @__PURE__ */ r(
|
|
173
|
-
Me,
|
|
174
|
-
{
|
|
175
|
-
filteredHistory: u,
|
|
176
|
-
historyState: m,
|
|
177
|
-
lastEntryToLoad: v,
|
|
178
|
-
onClickSort: W,
|
|
179
|
-
onClickRestore: J,
|
|
180
|
-
onClickDelete: Z,
|
|
181
|
-
onClickFavorite: ee,
|
|
182
|
-
infinityScrollMarkerRef: te,
|
|
183
|
-
isLoading: L,
|
|
184
|
-
totalHistoryCount: k,
|
|
185
|
-
isFiltered: g
|
|
186
|
-
}
|
|
187
|
-
) })
|
|
188
|
-
] });
|
|
189
|
-
}, qe = ({
|
|
190
|
-
open: u,
|
|
191
|
-
onOpenChange: C
|
|
192
|
-
}) => {
|
|
193
|
-
const { getAccessToken: T, user: S } = M(), { dispatch: L } = I(B), [k, g] = F([]), i = H(null), { state: a, dispatch: f } = I(U), {
|
|
194
|
-
data: n,
|
|
195
|
-
refetch: A,
|
|
196
|
-
isLoading: E,
|
|
197
|
-
isError: v
|
|
198
|
-
} = ye({
|
|
199
|
-
enabled: u,
|
|
200
|
-
user: S?.username || "",
|
|
201
|
-
searchString: a.searchString || "",
|
|
202
|
-
sortDirection: a.sortDirection || h.DESC,
|
|
203
|
-
sortedCell: a.sortedCell || R,
|
|
204
|
-
getAccessToken: T
|
|
205
|
-
}), { data: d } = Te({
|
|
206
|
-
user: S?.username,
|
|
207
|
-
getAccessToken: T
|
|
208
|
-
}), c = d && d.totalChats ? d.totalChats - d.privateChats - d.deletedChats : 0, [, b] = p({
|
|
209
|
-
key: y + ge,
|
|
210
|
-
initialValue: a.searchString
|
|
211
|
-
}), [m, N] = p({
|
|
212
|
-
key: y + Ae,
|
|
213
|
-
initialValue: !1
|
|
214
|
-
});
|
|
215
|
-
ze(() => {
|
|
216
|
-
n && g(
|
|
217
|
-
m ? n.filter((s) => s.favoriteChat === !0) : n
|
|
218
|
-
);
|
|
219
|
-
}, [n, m]);
|
|
220
|
-
const _ = async (s) => {
|
|
221
|
-
b(s), f({
|
|
222
|
-
type: Ie,
|
|
223
|
-
payload: { searchString: s }
|
|
224
|
-
});
|
|
225
|
-
}, w = De((s) => {
|
|
226
|
-
_(s.target.value.trim());
|
|
227
|
-
}, 500), x = async (s) => {
|
|
228
|
-
s.preventDefault();
|
|
229
|
-
}, D = (s) => {
|
|
230
|
-
N(s);
|
|
231
|
-
};
|
|
232
|
-
return /* @__PURE__ */ l(
|
|
233
|
-
Fe,
|
|
234
|
-
{
|
|
235
|
-
open: u,
|
|
236
|
-
onOpenChange: C,
|
|
237
|
-
title: Ee,
|
|
238
|
-
animation: !0,
|
|
239
|
-
animationType: "fade",
|
|
240
|
-
children: [
|
|
241
|
-
/* @__PURE__ */ r(
|
|
242
|
-
ve,
|
|
243
|
-
{
|
|
244
|
-
header: a.searchString ? "Filters applied" : "Filters",
|
|
245
|
-
className: "prose-dark dark:prose-lighter mb-4",
|
|
246
|
-
noBorder: !0,
|
|
247
|
-
compact: !0,
|
|
248
|
-
children: /* @__PURE__ */ l("form", { autoComplete: "off", onSubmit: x, children: [
|
|
249
|
-
/* @__PURE__ */ r(
|
|
250
|
-
_e,
|
|
251
|
-
{
|
|
252
|
-
placeholder: "Search",
|
|
253
|
-
labelHidden: !0,
|
|
254
|
-
noBorder: !0,
|
|
255
|
-
autoCapitalize: "off",
|
|
256
|
-
autoComplete: "off",
|
|
257
|
-
autoCorrect: "off",
|
|
258
|
-
ref: i,
|
|
259
|
-
defaultValue: a.searchString,
|
|
260
|
-
mode: "alt-system",
|
|
261
|
-
name: "Search",
|
|
262
|
-
label: "Search",
|
|
263
|
-
onChange: w,
|
|
264
|
-
className: "my-2",
|
|
265
|
-
rightElement: /* @__PURE__ */ r("div", { className: "dark:text-copy-dark text-copy-light", children: /* @__PURE__ */ r(Oe, { monotone: !0, size: "size-3" }) })
|
|
266
|
-
}
|
|
267
|
-
),
|
|
268
|
-
/* @__PURE__ */ l("div", { className: "flex flex-col justify-between sm:flex-row gap-2 sm:mb-0 mb-1", children: [
|
|
269
|
-
/* @__PURE__ */ r("div", { className: "order-1 sm:order-0", children: /* @__PURE__ */ r(
|
|
270
|
-
Pe,
|
|
271
|
-
{
|
|
272
|
-
name: "favorites-only",
|
|
273
|
-
checked: m,
|
|
274
|
-
onChange: D,
|
|
275
|
-
label: "Show favorites only",
|
|
276
|
-
narrow: !0,
|
|
277
|
-
noBorder: !0
|
|
278
|
-
}
|
|
279
|
-
) }),
|
|
280
|
-
/* @__PURE__ */ r(
|
|
281
|
-
Re,
|
|
282
|
-
{
|
|
283
|
-
size: "small",
|
|
284
|
-
disabled: a.searchString === "",
|
|
285
|
-
onClick: () => {
|
|
286
|
-
_(""), i.current?.value && (i.current.value = "", i.current.focus());
|
|
287
|
-
},
|
|
288
|
-
children: "Reset Search"
|
|
289
|
-
}
|
|
290
|
-
)
|
|
291
|
-
] })
|
|
292
|
-
] })
|
|
293
|
-
}
|
|
294
|
-
),
|
|
295
|
-
/* @__PURE__ */ l("div", { className: "flex flex-col sm:flex-row max-h-[65vh] sm:max-h-[75vh] min-h-[60vh]", children: [
|
|
296
|
-
v && /* @__PURE__ */ r("p", { className: "m-0 text-red-500", children: "Failed to load history." }),
|
|
297
|
-
!v && /* @__PURE__ */ r(
|
|
298
|
-
Ue,
|
|
299
|
-
{
|
|
300
|
-
mutate: A,
|
|
301
|
-
filteredHistory: k,
|
|
302
|
-
dispatch: L,
|
|
303
|
-
onOpenChange: C,
|
|
304
|
-
isLoading: E,
|
|
305
|
-
totalHistoryCount: c,
|
|
306
|
-
isFiltered: !!(a.searchString || m)
|
|
307
|
-
}
|
|
308
|
-
)
|
|
309
|
-
] })
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
);
|
|
313
|
-
};
|
|
314
|
-
export {
|
|
315
|
-
qe as HistoryPanel
|
|
316
|
-
};
|