@versini/sassysaint 8.81.1 → 8.82.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.
Files changed (26) hide show
  1. package/dist/chunks/{AboutChangelog.C1wdrYSy.js → AboutChangelog.BSx_46oO.js} +3 -3
  2. package/dist/chunks/{AboutEntry.BBP0FMsE.js → AboutEntry.BpkbOp-E.js} +5 -5
  3. package/dist/chunks/{App.DXUu7noN.js → App.CpK3vbuC.js} +380 -389
  4. package/dist/chunks/{Chart.BU6Zc5b7.js → Chart.BQTk2pK3.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.D-RvTGFO.js → ChatBubbleAssistant.BFj2pLII.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.BneldyFS.js → ChatBubbleUser.Cpvxvebn.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.CZe2E7YV.js → ChatHistoryTable.B8sWhUDq.js} +3 -3
  8. package/dist/chunks/HistoryEntry.Bair25TG.js +298 -0
  9. package/dist/chunks/{ProfileEntry.COb4Ix5z.js → ProfileEntry.DpxtnxMi.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.BVpLsSfw.js → SettingsEntry.CAf7JHHN.js} +3 -3
  11. package/dist/chunks/{UsageEntry.P4bknnZZ.js → UsageEntry.WJO19NIA.js} +3 -3
  12. package/dist/chunks/{UserMemoriesPanel.CvpKKLRV.js → UserMemoriesPanel.Cc8bs-bq.js} +4 -4
  13. package/dist/chunks/{index.BPUn0gZ3.js → index.B8DHTZep.js} +1 -1
  14. package/dist/chunks/{index.8j5Dq4sI.js → index.BHptKcss.js} +1 -2
  15. package/dist/chunks/{index.qjNo6KZO.js → index.BW2JmieU.js} +1 -1
  16. package/dist/chunks/{index.BlptHNvh.js → index.CHqfXZtZ.js} +1 -1
  17. package/dist/chunks/{index.BjkO_ONr.js → index.CPHEqdrL.js} +1 -1
  18. package/dist/chunks/{index.BKDGy5qf.js → index.CtTF1DFp.js} +1 -1
  19. package/dist/chunks/{index.DClQQbmr.js → index.DYgM3w1D.js} +3 -3
  20. package/dist/chunks/{index.BYK-C5Zz.js → index.DmgNCKlb.js} +2 -2
  21. package/dist/chunks/{index.BD8hmCW6.js → index.qXgqxbjy.js} +1 -1
  22. package/dist/chunks/{useMarkdown.Cw4b4qiL.js → useMarkdown.ovqec__Y.js} +6 -6
  23. package/dist/components/SassySaint/SassySaint.js +1 -1
  24. package/dist/index.js +4 -4
  25. package/package.json +3 -3
  26. package/dist/chunks/HistoryEntry.wQYZDKWF.js +0 -316
@@ -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
- };