@versini/sassysaint 8.44.1 → 8.44.3

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 (24) hide show
  1. package/dist/chunks/{AboutChangelog.BcAh3Diw.js → AboutChangelog.BdZzSUba.js} +2 -2
  2. package/dist/chunks/{AboutEntry.B8XKsNz6.js → AboutEntry.DzSi7ibC.js} +5 -5
  3. package/dist/chunks/{App.B_z-iC81.js → App.DDTKqerX.js} +4137 -5868
  4. package/dist/chunks/{Chart.CC78baxd.js → Chart.PHloGZi7.js} +2 -2
  5. package/dist/chunks/ChatBubbleAssistant.DxGv-_Rb.js +76 -0
  6. package/dist/chunks/ChatHistoryTable.DnkLt1Je.js +1205 -0
  7. package/dist/chunks/HistoryEntry.De2vGpPR.js +282 -0
  8. package/dist/chunks/{LNWAZHJI.CQGzM2uj.js → LNWAZHJI.DBPRjK8f.js} +1 -1
  9. package/dist/chunks/{ProfileEntry.DGw-bmJD.js → ProfileEntry.B9ur9Dzf.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.B_-nqp2P.js → SettingsEntry.DeQAT_-t.js} +2 -2
  11. package/dist/chunks/{UsageEntry.COgGtck2.js → UsageEntry.BmEHDYHp.js} +3 -3
  12. package/dist/chunks/{index.DR_lquuI.js → index.C1S2cFkO.js} +2 -2
  13. package/dist/chunks/{index.DtvRHloF.js → index.CrwhT53o.js} +3 -3
  14. package/dist/chunks/{index.BTVpPOuB.js → index.CsbwtA6h.js} +1 -1
  15. package/dist/chunks/{index.4XJr9Y3j.js → index.CvN58Fp8.js} +1 -1
  16. package/dist/chunks/index.CyMvgyLB.js +804 -0
  17. package/dist/chunks/{index.C5nUMIev.js → index.DI9PexVP.js} +1 -1
  18. package/dist/chunks/{index.B2mnuHfs.js → index.DNSGhajh.js} +2 -2
  19. package/dist/chunks/{useMarkdown.CM-gEMEy.js → useMarkdown.CujEnDtN.js} +8 -8
  20. package/dist/components/SassySaint/SassySaint.js +1 -1
  21. package/dist/index.js +4 -4
  22. package/package.json +3 -3
  23. package/dist/chunks/ChatBubbleAssistant.SNSTBHB6.js +0 -75
  24. package/dist/chunks/HistoryEntry.DSiLUTEb.js +0 -538
@@ -1,538 +0,0 @@
1
- import { jsxs as h, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
- import { I as z, ue$1 as A, pe as M, INFINITE_SCROLL_THRESHOLD as F, CARDS as ce, pluralize as ie, ue as I, numberFormatter as le, Ae as de, isProbablyMobile as me, E as he, a as ue, i as pe, n as Y, INFINITE_SCROLL_LIMIT as U, LOCAL_STORAGE_PREFIX as v, LOCAL_STORAGE_SORT_TIMESTAMP as Ce, LOCAL_STORAGE_SORT_TOKEN_USAGE as Se, LOCAL_STORAGE_SORT as Te, APP_CLASSNAME as ge, ACTION_SORT as Ee, TOAST_CHAT_DELETED as xe, TOAST_PROVIDER_CHANGED as fe, LOCAL_STORAGE_SEARCH as ye, HISTORY_TITLE as Ae, pe$1 as De, debounce as Oe, ACTION_SEARCH as Re } from "./index.B2mnuHfs.js";
3
- import { De as Ne, He as ve, qe as k, Ge as we, Fe as Me, Pe as C, Ye as V, st as $, p$1 as _e, z as ke, p$2 as Ie, HistoryContext as K, ChatContext as W, useAiChat as be, E as w, E$1 as y, useUserPreferences as Le, ConfirmationPanel as ze, LazyToastContainerWrapper as He, mutateCall as B, SERVICE_TYPES as G, showErrorToast as Pe, setNewProvider as Ue, CHAT_SET_PROVIDER as Ve, showSuccessToast as $e, CHAT_SET_STATUS as Be, useChatsHistory as Ge, tt as Fe, a as Ye } from "./App.B_z-iC81.js";
4
- import { Fragment as Ke, useRef as b, useState as L, useContext as _, useCallback as We, useEffect as j } from "react";
5
- const je = ({
6
- className: c,
7
- viewBox: o,
8
- title: d,
9
- monotone: m,
10
- ...i
11
- }) => /* @__PURE__ */ h(
12
- z,
13
- {
14
- defaultViewBox: "0 0 448 512",
15
- size: "size-5",
16
- viewBox: o,
17
- className: c,
18
- title: d || "Delete",
19
- ...i,
20
- children: [
21
- /* @__PURE__ */ e(
22
- "path",
23
- {
24
- d: "M32 96v352c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V96zm80 80c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16zm96 0c0-8.8 7.2-16 16-16s16 7.2 16 16v224c0 8.8-7.2 16-16 16s-16-7.2-16-16z",
25
- opacity: m ? "1" : "0.4"
26
- }
27
- ),
28
- /* @__PURE__ */ e("path", { d: "M163.8 0c-12.1 0-23.2 6.8-28.6 17.7L128 32H32C14.3 32 0 46.3 0 64s14.3 32 32 32h384c17.7 0 32-14.3 32-32s-14.3-32-32-32h-96l-7.2-14.3C307.4 6.8 296.3 0 284.2 0z" })
29
- ]
30
- }
31
- ), qe = ({
32
- className: c,
33
- viewBox: o,
34
- title: d,
35
- monotone: m,
36
- ...i
37
- }) => /* @__PURE__ */ h(
38
- z,
39
- {
40
- defaultViewBox: "0 0 512 512",
41
- size: "size-5",
42
- viewBox: o,
43
- className: c,
44
- title: d || "Restore",
45
- ...i,
46
- children: [
47
- /* @__PURE__ */ e(
48
- "path",
49
- {
50
- d: "M128 80v16h64V80c0-8.8 7.2-16 16-16h224c8.8 0 16 7.2 16 16v224c0 8.8-7.2 16-16 16h-16v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80",
51
- opacity: m ? "1" : "0.4"
52
- }
53
- ),
54
- /* @__PURE__ */ e("path", { d: "M64 128c-35.3 0-64 28.7-64 64v256c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64zm32 64h192c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32" })
55
- ]
56
- }
57
- ), Xe = ({
58
- className: c,
59
- viewBox: o,
60
- title: d,
61
- monotone: m,
62
- ...i
63
- }) => /* @__PURE__ */ h(
64
- z,
65
- {
66
- defaultViewBox: "0 0 512 512",
67
- size: "size-5",
68
- viewBox: o,
69
- className: c,
70
- title: d || "Search",
71
- ...i,
72
- children: [
73
- /* @__PURE__ */ e(
74
- "path",
75
- {
76
- d: "M0 208a208 208 0 1 0 416 0 208 208 0 1 0-416 0m352 0a144 144 0 1 1-288 0 144 144 0 1 1 288 0",
77
- opacity: m ? "1" : "0.4"
78
- }
79
- ),
80
- /* @__PURE__ */ e("path", { d: "m330.7 376 126.7 126.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L376 330.7c-12.7 17.3-28 32.6-45.3 45.3" })
81
- ]
82
- }
83
- ), Je = {
84
- [pe]: Ie,
85
- [ue]: ke,
86
- [he]: _e
87
- }, r = {
88
- ROW: "row",
89
- TIMESTAMP: A,
90
- SUMMARY: "summary",
91
- PROVIDER: "provider",
92
- TOKEN_USAGE: M,
93
- ACTIONS: "actions"
94
- }, Qe = [
95
- r.ROW,
96
- r.TIMESTAMP,
97
- r.SUMMARY,
98
- r.ACTIONS
99
- ], Ze = [
100
- r.ROW,
101
- r.SUMMARY,
102
- r.TIMESTAMP,
103
- r.TOKEN_USAGE,
104
- r.PROVIDER,
105
- r.ACTIONS
106
- ], et = ({
107
- filteredHistory: c,
108
- historyState: o,
109
- lastEntryToLoad: d,
110
- onClickSort: m,
111
- onClickRestore: i,
112
- onClickDelete: E,
113
- infinityScrollMarkerRef: x
114
- }) => {
115
- const l = me() ? Qe : Ze, D = (t) => {
116
- switch (t) {
117
- case r.ROW:
118
- return /* @__PURE__ */ e(C, { className: "sr-only", children: "Row" }, t);
119
- case r.TIMESTAMP:
120
- return /* @__PURE__ */ e(
121
- V,
122
- {
123
- buttonClassName: "text-xs sm:text-sm",
124
- cellId: A,
125
- align: "left",
126
- sortDirection: o.sortDirection,
127
- sortedCell: o.sortedCell,
128
- onClick: () => {
129
- m(A);
130
- },
131
- children: "Date"
132
- },
133
- t
134
- );
135
- case r.SUMMARY:
136
- return /* @__PURE__ */ e(C, { className: "text-xs sm:text-sm", children: "Summary" }, t);
137
- case r.PROVIDER:
138
- return /* @__PURE__ */ e(C, { className: "text-xs sm:text-sm", children: "Provider" }, t);
139
- case r.TOKEN_USAGE:
140
- return /* @__PURE__ */ e(
141
- V,
142
- {
143
- buttonClassName: "text-xs sm:text-sm",
144
- cellId: M,
145
- align: "right",
146
- sortDirection: o.sortDirection,
147
- sortedCell: o.sortedCell,
148
- onClick: () => {
149
- m(M);
150
- },
151
- children: "Tokens"
152
- },
153
- t
154
- );
155
- case r.ACTIONS:
156
- return /* @__PURE__ */ e(C, { className: "text-xs sm:text-sm text-right", children: "Actions" }, t);
157
- default:
158
- return null;
159
- }
160
- }, f = (t, s, T) => {
161
- switch (t) {
162
- case r.ROW:
163
- return /* @__PURE__ */ e(C, { children: T + 1 }, t);
164
- case r.TIMESTAMP:
165
- return /* @__PURE__ */ e(
166
- C,
167
- {
168
- component: "th",
169
- scope: "row",
170
- className: "text-gray-400 sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
171
- children: s.timestamp.split(",")[0]
172
- },
173
- t
174
- );
175
- case r.SUMMARY: {
176
- const S = s.summary || (s.messages.length > 0 ? s.messages[0]?.content : "");
177
- return /* @__PURE__ */ e(
178
- C,
179
- {
180
- className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
181
- style: {
182
- wordBreak: "break-word"
183
- },
184
- children: S
185
- },
186
- t
187
- );
188
- }
189
- case r.PROVIDER: {
190
- const S = s.model ? de(s.model) : null, O = S ? Je[S] : null;
191
- return /* @__PURE__ */ e(
192
- C,
193
- {
194
- component: "th",
195
- scope: "row",
196
- className: "text-gray-400",
197
- align: "center",
198
- children: O ? /* @__PURE__ */ e(
199
- O,
200
- {
201
- size: "size-4 sm:size-5",
202
- semantic: !0,
203
- title: s.model || S
204
- }
205
- ) : null
206
- },
207
- t
208
- );
209
- }
210
- case r.TOKEN_USAGE:
211
- return /* @__PURE__ */ e(
212
- C,
213
- {
214
- className: "text-gray-400 text-xs sm:text-sm",
215
- align: "right",
216
- children: s.tokenUsage ? le.format(s.tokenUsage) : "0"
217
- },
218
- t
219
- );
220
- case r.ACTIONS:
221
- return /* @__PURE__ */ e(C, { children: /* @__PURE__ */ h("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
222
- /* @__PURE__ */ e(
223
- $,
224
- {
225
- label: "Restore chat",
226
- mode: "alt-system",
227
- placement: "top",
228
- trigger: /* @__PURE__ */ e(
229
- I,
230
- {
231
- focusMode: "alt-system",
232
- noBorder: !0,
233
- label: "Restore chat",
234
- variant: "primary",
235
- iconClassName: "text-green-800 dark:text-green-500",
236
- onClick: async () => {
237
- await i(s);
238
- },
239
- children: /* @__PURE__ */ e(qe, { size: "size-3", monotone: !0 })
240
- }
241
- )
242
- }
243
- ),
244
- /* @__PURE__ */ e(
245
- $,
246
- {
247
- label: "Delete chat",
248
- mode: "alt-system",
249
- placement: "top",
250
- trigger: /* @__PURE__ */ e(
251
- I,
252
- {
253
- focusMode: "alt-system",
254
- noBorder: !0,
255
- label: "Delete chat",
256
- variant: "primary",
257
- iconClassName: "text-red-700 dark:text-red-500",
258
- onClick: () => {
259
- E(s);
260
- },
261
- children: /* @__PURE__ */ e(je, { size: "size-3", monotone: !0 })
262
- }
263
- )
264
- }
265
- )
266
- ] }) }, t);
267
- default:
268
- return null;
269
- }
270
- };
271
- return /* @__PURE__ */ h(Ne, { stickyHeader: !0, stickyFooter: !0, compact: !0, children: [
272
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(k, { children: l.map((t) => D(t)) }) }),
273
- /* @__PURE__ */ e(we, { children: c.slice(0, d).map((t, s) => t?.messages?.length > 0 ? /* @__PURE__ */ h(Ke, { children: [
274
- s === d - F && /* @__PURE__ */ e("tr", { ref: x }),
275
- /* @__PURE__ */ e(k, { children: l.map(
276
- (T) => f(T, t, s)
277
- ) })
278
- ] }, `${ce.HISTORY.TITLE}-${t.id}-${s}`) : null) }),
279
- /* @__PURE__ */ e(Me, { children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(C, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: ie(
280
- `${c.length} chat`,
281
- c.length
282
- ) }) }) }) })
283
- ] });
284
- }, tt = ({
285
- filteredHistory: c,
286
- dispatch: o,
287
- onOpenChange: d,
288
- mutate: m
289
- }) => {
290
- const { user: i, getAccessToken: E } = Y(), x = b(null), u = b({
291
- id: "",
292
- timestamp: "",
293
- message: ""
294
- }), [l, D] = L(!1), [f, t] = L(
295
- U + F
296
- ), { state: s, dispatch: T } = _(K), S = {
297
- searchString: s.searchString || "",
298
- sortDirection: s.sortDirection || y.DESC,
299
- sortedCell: s.sortedCell || A
300
- }, {
301
- state: { provider: O },
302
- setChatId: g,
303
- setInitialMessages: q
304
- } = _(W), { setInput: X } = be(), [H, P] = w({
305
- key: v + Ce,
306
- initialValue: y.DESC
307
- }), [J, Q] = w({
308
- key: v + Se,
309
- initialValue: y.ASC
310
- }), [, Z] = w({
311
- key: v + Te,
312
- initialValue: A
313
- }), { refetch: ee } = Le({
314
- user: i?.username,
315
- getAccessToken: E
316
- }), te = (a) => {
317
- const p = s.sortedCell === a;
318
- let n, R;
319
- switch (a) {
320
- case A:
321
- R = P, n = p ? s.sortDirection : H;
322
- break;
323
- case M:
324
- R = Q, n = p ? s.sortDirection : J;
325
- break;
326
- default:
327
- R = P, n = p ? s.sortDirection : H;
328
- break;
329
- }
330
- let N;
331
- switch (n) {
332
- case y.ASC:
333
- N = y.DESC;
334
- break;
335
- default:
336
- N = y.ASC;
337
- break;
338
- }
339
- R(N), Z(a), T({
340
- type: Ee,
341
- payload: {
342
- sortedCell: a,
343
- sortDirection: N
344
- }
345
- });
346
- }, se = async () => {
347
- const a = u.current;
348
- try {
349
- await B({
350
- accessToken: await E(),
351
- type: G.DELETE_CHAT,
352
- params: {
353
- userId: i?.username || "",
354
- id: a.id
355
- }
356
- }), m(""), await Pe(xe, {
357
- autoClose: 2e3,
358
- containerId: "history-table"
359
- });
360
- } catch {
361
- }
362
- }, re = async (a) => {
363
- try {
364
- const p = await E(), n = await B({
365
- accessToken: p,
366
- type: G.GET_CHAT,
367
- params: {
368
- id: a.id
369
- }
370
- });
371
- n.status === 200 && (n.data.provider !== O && (await Ue({
372
- provider: n.data.provider,
373
- accessToken: p,
374
- username: i?.username || ""
375
- }), o({
376
- type: Ve,
377
- payload: {
378
- provider: n.data.provider
379
- }
380
- }), ee(), await $e(
381
- `${fe} ${n.data.provider}`,
382
- {
383
- containerId: "toggle-provider"
384
- }
385
- )), o({
386
- type: Be,
387
- payload: {
388
- restoring: !0,
389
- restoredModel: n.data?.model || "",
390
- restoredUsage: n.data?.tokenUsage || 0
391
- }
392
- }), X(""), g(a.id), q(n.data.messages), d(!1));
393
- } catch {
394
- }
395
- }, ae = (a) => {
396
- u.current = {
397
- id: a.id,
398
- timestamp: a.timestamp,
399
- message: a.messages.length > 0 ? a.messages[0]?.content : ""
400
- }, D(!l);
401
- }, oe = We((a) => {
402
- a[0].isIntersecting && t((n) => n + U);
403
- }, []);
404
- return j(() => {
405
- const a = {
406
- // root: null,
407
- rootMargin: "20px"
408
- }, p = new IntersectionObserver(oe, a);
409
- x.current && p.observe(x.current);
410
- }), /* @__PURE__ */ h(ne, { children: [
411
- /* @__PURE__ */ h(
412
- ze,
413
- {
414
- showConfirmation: l,
415
- setShowConfirmation: D,
416
- action: se,
417
- customStrings: {
418
- confirmAction: "Delete",
419
- cancelAction: "Cancel",
420
- title: "Delete chat"
421
- },
422
- children: [
423
- /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
424
- /* @__PURE__ */ h("ul", { className: "m-0", children: [
425
- /* @__PURE__ */ h("li", { children: [
426
- "Timestamp:",
427
- " ",
428
- /* @__PURE__ */ e("span", { className: "text-lg", children: u.current && u.current.timestamp })
429
- ] }),
430
- /* @__PURE__ */ h("li", { children: [
431
- "First message:",
432
- " ",
433
- /* @__PURE__ */ e("span", { className: "text-lg", children: u.current?.message })
434
- ] })
435
- ] })
436
- ]
437
- }
438
- ),
439
- /* @__PURE__ */ e("div", { className: ge, children: /* @__PURE__ */ e(He, { containerId: "history-table" }) }),
440
- /* @__PURE__ */ e(
441
- et,
442
- {
443
- filteredHistory: c,
444
- historyState: S,
445
- lastEntryToLoad: f,
446
- onClickSort: te,
447
- onClickRestore: re,
448
- onClickDelete: ae,
449
- infinityScrollMarkerRef: x
450
- }
451
- )
452
- ] });
453
- }, nt = ({
454
- open: c,
455
- onOpenChange: o
456
- }) => {
457
- const { getAccessToken: d, user: m } = Y(), { dispatch: i } = _(W), [E, x] = L([]), u = b(null), { state: l, dispatch: D } = _(K), { data: f, refetch: t } = Ge({
458
- enabled: c,
459
- user: m?.username || "",
460
- searchString: l.searchString || "",
461
- sortDirection: l.sortDirection || y.DESC,
462
- sortedCell: l.sortedCell || A,
463
- getAccessToken: d
464
- }), [, s] = w({
465
- key: v + ye,
466
- initialValue: l.searchString
467
- });
468
- j(() => {
469
- f && x(f);
470
- }, [f]);
471
- const T = async (g) => {
472
- s(g), D({
473
- type: Re,
474
- payload: { searchString: g }
475
- });
476
- }, S = Oe((g) => {
477
- T(g.target.value.trim());
478
- }, 500);
479
- return /* @__PURE__ */ h(
480
- Fe,
481
- {
482
- open: c,
483
- onOpenChange: o,
484
- title: Ae,
485
- animation: !0,
486
- animationType: "fade",
487
- children: [
488
- /* @__PURE__ */ e("form", { autoComplete: "off", onSubmit: async (g) => {
489
- g.preventDefault();
490
- }, children: /* @__PURE__ */ e(
491
- De,
492
- {
493
- placeholder: "Search",
494
- labelHidden: !0,
495
- noBorder: !0,
496
- autoCapitalize: "off",
497
- autoComplete: "off",
498
- autoCorrect: "off",
499
- ref: u,
500
- defaultValue: l.searchString,
501
- focusMode: "light",
502
- mode: "light",
503
- name: "Search",
504
- label: "Search",
505
- onChange: S,
506
- className: "my-2",
507
- rightElement: /* @__PURE__ */ e("div", { className: "text-copy-dark", children: /* @__PURE__ */ e(
508
- I,
509
- {
510
- mode: "dark",
511
- focusMode: "dark",
512
- label: "Search",
513
- size: "small",
514
- onClick: () => {
515
- T(""), u.current?.value && (u.current.value = "", u.current.focus());
516
- },
517
- disabled: l.searchString === "",
518
- children: l.searchString !== "" ? /* @__PURE__ */ e(Ye, { monotone: !0, size: "size-3" }) : /* @__PURE__ */ e(Xe, { monotone: !0, size: "size-3" })
519
- }
520
- ) })
521
- }
522
- ) }),
523
- /* @__PURE__ */ e("div", { className: "flex flex-col sm:flex-row max-h-[75vh] min-h-[60vh]", children: /* @__PURE__ */ e(
524
- tt,
525
- {
526
- mutate: t,
527
- filteredHistory: E,
528
- dispatch: i,
529
- onOpenChange: o
530
- }
531
- ) })
532
- ]
533
- }
534
- );
535
- };
536
- export {
537
- nt as HistoryPanel
538
- };