teodor-new-chat-ui 4.3.413 → 4.3.414
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/features/checkpoint/hooks/useMessageMetadata.d.ts +1 -2
- package/dist/features/checkpoint/{types.d.ts → types/index.d.ts} +15 -5
- package/dist/features/checkpoint/types/models.d.ts +45 -0
- package/dist/features/checkpoint/utils/attemptDetection.d.ts +1 -1
- package/dist/features/checkpoint/utils/checkpointIndex.d.ts +2 -4
- package/dist/features/checkpoint/utils/messageMetadataResolver.d.ts +5 -13
- package/dist/features/checkpoint/utils/messagePreviews.d.ts +1 -1
- package/dist/features/core/api/clients/chatClient.d.ts +2 -2
- package/dist/features/core/types/models.d.ts +3 -168
- package/dist/features/messaging/index.d.ts +1 -0
- package/dist/features/messaging/types/index.d.ts +4 -0
- package/dist/features/messaging/types/models.d.ts +84 -0
- package/dist/features/thread/index.d.ts +1 -0
- package/dist/features/thread/types/index.d.ts +4 -0
- package/dist/features/thread/types/models.d.ts +37 -0
- package/dist/features/ui/components/ui/resizable.d.ts +1 -1
- package/dist/index.esm.js +58 -95
- package/dist/index.umd.js +2 -2
- package/dist/lib/index.d.ts +5 -1
- package/dist/types/models.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -11,48 +11,32 @@ import * as co from "react-dom";
|
|
|
11
11
|
import ki from "react-dom";
|
|
12
12
|
import { ChevronRight as ju, Check as Ts, Circle as Pg, Square as Mg, Send as Og, X as Yn, ExternalLink as Ha, Download as Dg, Image as Lg, FileText as Ul, Loader as Ei, Clock as ha, CheckCircle as $g, Search as _u, ChevronUp as Ri, ChevronDown as Cs, Paperclip as Ua, Bot as ma, Wrench as Fg, User as Bg, ChevronLeft as zg, Copy as Wl, Edit as Vl, RotateCcw as Kl, Loader2 as Kn, Edit3 as Ii, Plus as Hg, FileSpreadsheet as Ug, Calendar as Wg, MoreHorizontal as Vg, Share2 as Kg, Trash2 as qg, MessageSquare as Gg } from "lucide-react";
|
|
13
13
|
function Yg(e, t) {
|
|
14
|
-
|
|
15
|
-
let n = [], r = null, o = {}, s = {}, a = null, i = null, l = null;
|
|
14
|
+
let n = [], r = null, o = null;
|
|
16
15
|
if (!(e && "type" in e && e.type === "default_message") && e) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const v = typeof o.source == "string" ? o.source : typeof s.source == "string" ? s.source : (f == null ? void 0 : f.source) ?? null;
|
|
22
|
-
i = v ? String(v) : null;
|
|
23
|
-
const g = a !== null && i ? `${a}:${i}` : null;
|
|
24
|
-
if (g && t.checkpointIndexByKey.has(g) ? n = t.checkpointIndexByKey.get(g) ?? [] : m && f && (n = [f]), r = m ?? ((d = n[0]) == null ? void 0 : d.id) ?? null, l = m ? t.attemptMetaById.get(m) ?? null : null, !l && p.role === "user" && p.id && t.userMessageIdToAttempts.has(p.id)) {
|
|
25
|
-
const x = t.userMessageIdToAttempts.get(p.id);
|
|
26
|
-
if (x && x.length > 0) {
|
|
27
|
-
const b = x[0].checkpointId;
|
|
28
|
-
l = t.attemptMetaById.get(b) ?? null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (!l && n.length > 0) {
|
|
32
|
-
const x = t.attemptMetaById.get(n[0].id);
|
|
33
|
-
x && (l = x);
|
|
16
|
+
const i = e.checkpointId ?? null;
|
|
17
|
+
if (i) {
|
|
18
|
+
const l = t.checkpointMetaByCheckpointId.get(i) ?? null;
|
|
19
|
+
l && (n = [l], r = i, o = l);
|
|
34
20
|
}
|
|
35
|
-
if (
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
for (const [
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
|
|
21
|
+
if (o && (o.attemptCount ?? 1) > 1) {
|
|
22
|
+
const l = o.baseUserMessageId ?? null;
|
|
23
|
+
if (l) {
|
|
24
|
+
const c = [];
|
|
25
|
+
for (const [d, p] of t.checkpointMetaByCheckpointId.entries())
|
|
26
|
+
if (p.baseUserMessageId === l) {
|
|
27
|
+
const m = t.checkpointMetaByCheckpointId.get(d);
|
|
28
|
+
m && c.push(m);
|
|
43
29
|
}
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
return (
|
|
47
|
-
}), n =
|
|
30
|
+
c.length > 0 && (c.sort((d, p) => {
|
|
31
|
+
const m = d.createdAt ? Date.parse(d.createdAt) : 0;
|
|
32
|
+
return (p.createdAt ? Date.parse(p.createdAt) : 0) - m;
|
|
33
|
+
}), n = c);
|
|
48
34
|
}
|
|
49
35
|
}
|
|
50
36
|
}
|
|
51
37
|
return {
|
|
52
38
|
checkpointCandidates: n,
|
|
53
|
-
defaultCheckpointId: r
|
|
54
|
-
resolvedStep: a,
|
|
55
|
-
resolvedSource: i
|
|
39
|
+
defaultCheckpointId: r
|
|
56
40
|
};
|
|
57
41
|
}
|
|
58
42
|
function Xg(e, t) {
|
|
@@ -137,70 +121,51 @@ function SI(e) {
|
|
|
137
121
|
return t;
|
|
138
122
|
}
|
|
139
123
|
function Qg(e) {
|
|
140
|
-
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(),
|
|
141
|
-
for (let
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if (
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
id:
|
|
164
|
-
messageId:
|
|
165
|
-
step:
|
|
166
|
-
source:
|
|
167
|
-
createdAt:
|
|
168
|
-
next:
|
|
169
|
-
parentConfig:
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
const { attemptMetaById: s, userMessageIdToAttempts: a } = Jg(e), i = /* @__PURE__ */ new Map();
|
|
173
|
-
for (const [p, m] of t.entries()) {
|
|
174
|
-
const f = s.get(p);
|
|
175
|
-
f ? i.set(p, {
|
|
176
|
-
...m,
|
|
177
|
-
attemptIndex: f.attemptIndex,
|
|
178
|
-
attemptCount: f.attemptCount,
|
|
179
|
-
isLatestAttempt: f.isLatestAttempt,
|
|
180
|
-
baseUserMessageId: f.baseUserMessageId ?? null
|
|
181
|
-
}) : i.set(p, {
|
|
182
|
-
...m,
|
|
183
|
-
attemptIndex: 0,
|
|
184
|
-
attemptCount: 1,
|
|
185
|
-
isLatestAttempt: !0,
|
|
186
|
-
baseUserMessageId: null
|
|
124
|
+
const t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Map(), { attemptMetaById: o, userMessageIdToAttempts: s } = Jg(e);
|
|
125
|
+
for (let c = 0; c < e.length; c++) {
|
|
126
|
+
const d = e[c], p = d.checkpointId, m = p ?? `cp-${c}`, f = d.metadata ?? {}, v = typeof f.step == "number" ? f.step : null, g = typeof f.source == "string" ? f.source : null;
|
|
127
|
+
let x = null, b = null;
|
|
128
|
+
const w = Array.isArray(d.messages) ? d.messages : [];
|
|
129
|
+
for (const k of w)
|
|
130
|
+
k.role === "user" && (b || (b = k), k.id && (x = k.id));
|
|
131
|
+
const y = d.next && d.next.length > 0 ? String(d.next[0]) : null, C = d.parentConfig ?? null, S = {
|
|
132
|
+
id: m,
|
|
133
|
+
step: v,
|
|
134
|
+
source: g,
|
|
135
|
+
createdAt: d.createdAt ?? null,
|
|
136
|
+
namespace: d.checkpointNs ?? null,
|
|
137
|
+
parentId: d.parentId ?? null,
|
|
138
|
+
messageId: x,
|
|
139
|
+
next: y,
|
|
140
|
+
parentConfig: C
|
|
141
|
+
}, T = p ? o.get(p) : null;
|
|
142
|
+
if (S.attemptIndex = (T == null ? void 0 : T.attemptIndex) ?? 0, S.attemptCount = (T == null ? void 0 : T.attemptCount) ?? 1, S.isLatestAttempt = (T == null ? void 0 : T.isLatestAttempt) ?? !0, S.baseUserMessageId = (T == null ? void 0 : T.baseUserMessageId) ?? null, p && t.set(p, S), p && b) {
|
|
143
|
+
const k = Pu(b);
|
|
144
|
+
k && r.set(p, k);
|
|
145
|
+
}
|
|
146
|
+
n.push({
|
|
147
|
+
id: m,
|
|
148
|
+
messageId: x,
|
|
149
|
+
step: v,
|
|
150
|
+
source: g,
|
|
151
|
+
createdAt: d.createdAt ?? null,
|
|
152
|
+
next: y,
|
|
153
|
+
parentConfig: C
|
|
187
154
|
});
|
|
188
155
|
}
|
|
189
156
|
return {
|
|
190
157
|
checkpoints: e,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
timeline: r,
|
|
196
|
-
messagePreviews: o,
|
|
158
|
+
checkpointMetaByCheckpointId: t,
|
|
159
|
+
userMessageIdToAttempts: s,
|
|
160
|
+
timeline: n,
|
|
161
|
+
messagePreviews: r,
|
|
197
162
|
getLatest: () => {
|
|
198
|
-
const
|
|
199
|
-
if (
|
|
200
|
-
return t.get(
|
|
163
|
+
const c = n[0];
|
|
164
|
+
if (c)
|
|
165
|
+
return t.get(c.id);
|
|
201
166
|
},
|
|
202
|
-
getCheckpoint: (
|
|
203
|
-
getAttempts: (
|
|
167
|
+
getCheckpoint: (c) => t.get(c),
|
|
168
|
+
getAttempts: (c) => s.get(c) ?? []
|
|
204
169
|
};
|
|
205
170
|
}
|
|
206
171
|
function ex(e) {
|
|
@@ -14963,9 +14928,7 @@ const fh = (e, t) => (e == null ? void 0 : e.id) ?? `message-${t}`, ph = O.memo(
|
|
|
14963
14928
|
t,
|
|
14964
14929
|
w ?? {
|
|
14965
14930
|
checkpoints: [],
|
|
14966
|
-
|
|
14967
|
-
checkpointIndexByKey: /* @__PURE__ */ new Map(),
|
|
14968
|
-
attemptMetaById: /* @__PURE__ */ new Map(),
|
|
14931
|
+
checkpointMetaByCheckpointId: /* @__PURE__ */ new Map(),
|
|
14969
14932
|
userMessageIdToAttempts: /* @__PURE__ */ new Map(),
|
|
14970
14933
|
timeline: [],
|
|
14971
14934
|
messagePreviews: /* @__PURE__ */ new Map(),
|