teodor-new-chat-ui 4.3.415 → 4.3.416
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/index.esm.js +27 -11
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -77,6 +77,11 @@ function Xg(e) {
|
|
|
77
77
|
const d = s.get(c.userMessageId) ?? [];
|
|
78
78
|
d.push(c), s.set(c.userMessageId, d);
|
|
79
79
|
}
|
|
80
|
+
console.log("🔍 [CheckpointIndex] Built checkpoint metadata:"), console.log(` Total checkpoints: ${o.length}`), console.log(` User message groups: ${s.size}`);
|
|
81
|
+
for (const [c, d] of s.entries())
|
|
82
|
+
console.log(` 📌 User Message "${c}": ${d.length} checkpoint(s)`), d.forEach((p, m) => {
|
|
83
|
+
console.log(` [${m}] checkpoint="${p.id}", step=${p.step}, created=${p.createdAt}`);
|
|
84
|
+
});
|
|
80
85
|
for (const c of s.values()) {
|
|
81
86
|
if (!c.length) continue;
|
|
82
87
|
c.sort((p, m) => {
|
|
@@ -89,6 +94,11 @@ function Xg(e) {
|
|
|
89
94
|
m.attemptCount = d, m.attemptIndex = p, m.isLatestAttempt = p === 0;
|
|
90
95
|
}
|
|
91
96
|
}
|
|
97
|
+
console.log("🔍 [CheckpointIndex] After attempt indexing:");
|
|
98
|
+
for (const [c, d] of s.entries())
|
|
99
|
+
console.log(` 📌 User Message "${c}": ${d.length} attempt(s)`), d.forEach((p) => {
|
|
100
|
+
console.log(` - checkpoint="${p.id}", attemptCount=${p.attemptCount}, attemptIndex=${p.attemptIndex}, isLatest=${p.isLatestAttempt}`);
|
|
101
|
+
});
|
|
92
102
|
return {
|
|
93
103
|
checkpoints: e,
|
|
94
104
|
checkpointMetaByCheckpointId: t,
|
|
@@ -113,15 +123,15 @@ function Xg(e) {
|
|
|
113
123
|
}
|
|
114
124
|
function Jg(e, t) {
|
|
115
125
|
if (!e)
|
|
116
|
-
return { attemptCount: 1, attemptIndex: 0 };
|
|
126
|
+
return console.log("🔍 [getMessageAttemptInfo] No checkpointId provided, returning defaults"), { attemptCount: 1, attemptIndex: 0 };
|
|
117
127
|
const n = t.getCheckpoint(e);
|
|
118
128
|
if (!n || !n.userMessageId)
|
|
119
|
-
return { attemptCount: 1, attemptIndex: 0 };
|
|
129
|
+
return console.log(`🔍 [getMessageAttemptInfo] No checkpoint meta or userMessageId for "${e}"`), { attemptCount: 1, attemptIndex: 0 };
|
|
120
130
|
const r = t.getMessageAttempts(n.userMessageId);
|
|
121
131
|
if (!r.length)
|
|
122
|
-
return { attemptCount: 1, attemptIndex: 0 };
|
|
132
|
+
return console.log(`🔍 [getMessageAttemptInfo] No attempts found for userMessageId "${n.userMessageId}"`), { attemptCount: 1, attemptIndex: 0 };
|
|
123
133
|
const o = r.findIndex((s) => s.id === e);
|
|
124
|
-
return {
|
|
134
|
+
return console.log(`🔍 [getMessageAttemptInfo] checkpoint="${e}", userMsg="${n.userMessageId}", attemptCount=${r.length}, attemptIndex=${o}`), {
|
|
125
135
|
attemptCount: r.length,
|
|
126
136
|
attemptIndex: o >= 0 ? o : 0
|
|
127
137
|
};
|
|
@@ -168,21 +178,27 @@ function Vn(e) {
|
|
|
168
178
|
};
|
|
169
179
|
}
|
|
170
180
|
function ex(e, t) {
|
|
171
|
-
var
|
|
181
|
+
var y;
|
|
172
182
|
if (!e) return null;
|
|
173
|
-
const r = (Array.isArray((
|
|
174
|
-
(
|
|
175
|
-
), o = Kr(e.metadata) ?? {}, s = Gl(e.config), a = Kr(e.parent_config ?? e.parentConfig), i = Gl(a), l = pr(s, ["checkpoint_id", "checkpointId"]), c = pr(s, ["checkpoint_ns", "checkpointNs"]), d = pr(i, ["checkpoint_id", "checkpointId"]), p = pr(i, ["checkpoint_id", "checkpointId"]) ?? null, m = pr(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = Kr(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((
|
|
183
|
+
const r = (Array.isArray((y = e.values) == null ? void 0 : y.messages) ? e.values.messages : []).filter(
|
|
184
|
+
(C) => !!(C && typeof C == "object" && typeof C.role == "string")
|
|
185
|
+
), o = Kr(e.metadata) ?? {}, s = Gl(e.config), a = Kr(e.parent_config ?? e.parentConfig), i = Gl(a), l = pr(s, ["checkpoint_id", "checkpointId"]), c = pr(s, ["checkpoint_ns", "checkpointNs"]), d = pr(i, ["checkpoint_id", "checkpointId"]), p = pr(i, ["checkpoint_id", "checkpointId"]) ?? null, m = pr(i, ["checkpoint_ns", "checkpointNs"]) ?? null, f = Kr(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((C) => ({ ...C })) : e.tasks ?? null, g = Array.isArray(e.next) ? [...e.next] : e.next ?? null, x = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), b = {
|
|
176
186
|
...o,
|
|
177
187
|
step: Qg(o, ["step"]) ?? 0,
|
|
178
188
|
source: pr(o, ["source"]) ?? null
|
|
179
|
-
}
|
|
180
|
-
|
|
189
|
+
}, w = r.map((C) => ({
|
|
190
|
+
...C,
|
|
191
|
+
checkpointId: l ?? null
|
|
192
|
+
}));
|
|
193
|
+
return console.log(`🔍 [normalizeSnapshot] Attaching checkpoint ID to ${w.length} messages:`, {
|
|
194
|
+
checkpointId: l,
|
|
195
|
+
messageIds: w.map((C) => C.id)
|
|
196
|
+
}), {
|
|
181
197
|
checkpointId: l ?? null,
|
|
182
198
|
checkpointNs: c ?? null,
|
|
183
199
|
createdAt: x,
|
|
184
200
|
parentId: d ?? null,
|
|
185
|
-
messages:
|
|
201
|
+
messages: w,
|
|
186
202
|
nextCursor: p,
|
|
187
203
|
nextCursorNs: m,
|
|
188
204
|
interrupt: tx(r, t),
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(z,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("clsx"),require("tailwind-merge"),require("react-dom"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","@radix-ui/react-slot","class-variance-authority","clsx","tailwind-merge","react-dom","lucide-react"],b):(z=typeof globalThis<"u"?globalThis:z||self,b(z.NewChatUI={},z.React,z.reactSlot,z.classVarianceAuthority,z.clsx,z.tailwindMerge,z.ReactDOM,z.LucideReact))})(this,function(z,b,Vt,Dr,Yg,Xg,No,ue){"use strict";var RI=Object.defineProperty;var MI=(z,b,Vt)=>b in z?RI(z,b,{enumerable:!0,configurable:!0,writable:!0,value:Vt}):z[b]=Vt;var qg=(z,b,Vt)=>MI(z,typeof b!="symbol"?b+"":b,Vt);function Xl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=Xl(b),Lr=Xl(No),Jl=120;function Jg(e){if(!Array.isArray(e))return"";const t=e.filter(r=>!!(r&&r.type==="text")).map(r=>(r.text??"").trim()).filter(Boolean);if(!t.length)return"";const n=t.join(" ").replace(/\s+/g," ").trim();return n?n.length>Jl?`${n.slice(0,Jl-3)}…`:n:""}function ui(e){return Jg(e.content)||""}function Zg(e){var n;const t=new Map;for(const r of e){if(!r.checkpointId)continue;const o=(n=r.messages)==null?void 0:n.find(s=>s.role==="user");if(o){const s=ui(o);s&&t.set(r.checkpointId,s)}}return t}function Zl(e){const t=new Map,n=[],r=new Map,o=[];for(let c=0;c<e.length;c++){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;let x=null,y=null;const w=Array.isArray(d.messages)?d.messages:[];for(const T of w)T.role==="user"&&(y||(y=T),T.id&&(x=T.id));const S=d.next&&d.next.length>0?String(d.next[0]):null,k=d.parentConfig??null,C={id:m,step:v,source:g,createdAt:d.createdAt??null,namespace:d.checkpointNs??null,parentId:d.parentId??null,next:S,parentConfig:k,userMessageId:x};if(o.push(C),p&&t.set(p,C),p&&y){const T=ui(y);T&&r.set(p,T)}n.push({id:m,messageId:x,step:v,source:g,createdAt:d.createdAt??null,next:S,parentConfig:k})}const s=new Map;for(const c of o){if(!c.userMessageId)continue;const d=s.get(c.userMessageId)??[];d.push(c),s.set(c.userMessageId,d)}for(const c of s.values()){if(!c.length)continue;c.sort((p,m)=>{const f=p.createdAt?Date.parse(p.createdAt):0;return(m.createdAt?Date.parse(m.createdAt):0)-f});const d=c.length;for(let p=0;p<c.length;p++){const m=c[p];m.attemptCount=d,m.attemptIndex=p,m.isLatestAttempt=p===0}}return{checkpoints:e,checkpointMetaByCheckpointId:t,timeline:n,messagePreviews:r,getLatest:()=>{const c=n[0];if(c)return t.get(c.id)},getCheckpoint:c=>t.get(c),getMessageAttempts:c=>{const d=[];for(const p of t.values())p.userMessageId===c&&d.push(p);return d.length?(d.sort((p,m)=>{const f=typeof p.attemptIndex=="number"?p.attemptIndex:Number.MAX_SAFE_INTEGER,v=typeof m.attemptIndex=="number"?m.attemptIndex:Number.MAX_SAFE_INTEGER;return f-v}),d):[]}}}function Ql(e,t){if(!e)return{attemptCount:1,attemptIndex:0};const n=t.getCheckpoint(e);if(!n||!n.userMessageId)return{attemptCount:1,attemptIndex:0};const r=t.getMessageAttempts(n.userMessageId);if(!r.length)return{attemptCount:1,attemptIndex:0};const o=r.findIndex(s=>s.id===e);return{attemptCount:r.length,attemptIndex:o>=0?o:0}}function Qg(e,t){return e?t.getCheckpoint(e)??null:null}function ec(e){return b.useMemo(()=>Zl(e),[e])}function cr(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return{...e}}function Vn(e,t){if(e)for(const n of t){const r=e[n];if(typeof r=="string"&&r.trim())return r.trim()}}function tc(e,t){if(!e)return null;for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}return null}function di(e){const t=cr(e);if(t)return cr(t.configurable)??t}function Nn(e){const r=[...(Array.isArray(e==null?void 0:e.checkpoints)?(e==null?void 0:e.checkpoints)??[]:e!=null&&e.checkpoints?Object.values(e.checkpoints):[]).map((s,i)=>ex(s,i)).filter(s=>!!s)].sort((s,i)=>nc(i.createdAt)-nc(s.createdAt)),o=r[0]??null;return{threadId:(e==null?void 0:e.threadId)??"",latest:o,checkpoints:r,interrupt:(o==null?void 0:o.interrupt)??null}}function ex(e,t){var
|
|
1
|
+
(function(z,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react"),require("@radix-ui/react-slot"),require("class-variance-authority"),require("clsx"),require("tailwind-merge"),require("react-dom"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","react","@radix-ui/react-slot","class-variance-authority","clsx","tailwind-merge","react-dom","lucide-react"],b):(z=typeof globalThis<"u"?globalThis:z||self,b(z.NewChatUI={},z.React,z.reactSlot,z.classVarianceAuthority,z.clsx,z.tailwindMerge,z.ReactDOM,z.LucideReact))})(this,function(z,b,Vt,Dr,Yg,Xg,No,ue){"use strict";var RI=Object.defineProperty;var MI=(z,b,Vt)=>b in z?RI(z,b,{enumerable:!0,configurable:!0,writable:!0,value:Vt}):z[b]=Vt;var qg=(z,b,Vt)=>MI(z,typeof b!="symbol"?b+"":b,Vt);function Xl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const h=Xl(b),Lr=Xl(No),Jl=120;function Jg(e){if(!Array.isArray(e))return"";const t=e.filter(r=>!!(r&&r.type==="text")).map(r=>(r.text??"").trim()).filter(Boolean);if(!t.length)return"";const n=t.join(" ").replace(/\s+/g," ").trim();return n?n.length>Jl?`${n.slice(0,Jl-3)}…`:n:""}function ui(e){return Jg(e.content)||""}function Zg(e){var n;const t=new Map;for(const r of e){if(!r.checkpointId)continue;const o=(n=r.messages)==null?void 0:n.find(s=>s.role==="user");if(o){const s=ui(o);s&&t.set(r.checkpointId,s)}}return t}function Zl(e){const t=new Map,n=[],r=new Map,o=[];for(let c=0;c<e.length;c++){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;let x=null,y=null;const w=Array.isArray(d.messages)?d.messages:[];for(const T of w)T.role==="user"&&(y||(y=T),T.id&&(x=T.id));const S=d.next&&d.next.length>0?String(d.next[0]):null,k=d.parentConfig??null,C={id:m,step:v,source:g,createdAt:d.createdAt??null,namespace:d.checkpointNs??null,parentId:d.parentId??null,next:S,parentConfig:k,userMessageId:x};if(o.push(C),p&&t.set(p,C),p&&y){const T=ui(y);T&&r.set(p,T)}n.push({id:m,messageId:x,step:v,source:g,createdAt:d.createdAt??null,next:S,parentConfig:k})}const s=new Map;for(const c of o){if(!c.userMessageId)continue;const d=s.get(c.userMessageId)??[];d.push(c),s.set(c.userMessageId,d)}console.log("🔍 [CheckpointIndex] Built checkpoint metadata:"),console.log(` Total checkpoints: ${o.length}`),console.log(` User message groups: ${s.size}`);for(const[c,d]of s.entries())console.log(` 📌 User Message "${c}": ${d.length} checkpoint(s)`),d.forEach((p,m)=>{console.log(` [${m}] checkpoint="${p.id}", step=${p.step}, created=${p.createdAt}`)});for(const c of s.values()){if(!c.length)continue;c.sort((p,m)=>{const f=p.createdAt?Date.parse(p.createdAt):0;return(m.createdAt?Date.parse(m.createdAt):0)-f});const d=c.length;for(let p=0;p<c.length;p++){const m=c[p];m.attemptCount=d,m.attemptIndex=p,m.isLatestAttempt=p===0}}console.log("🔍 [CheckpointIndex] After attempt indexing:");for(const[c,d]of s.entries())console.log(` 📌 User Message "${c}": ${d.length} attempt(s)`),d.forEach(p=>{console.log(` - checkpoint="${p.id}", attemptCount=${p.attemptCount}, attemptIndex=${p.attemptIndex}, isLatest=${p.isLatestAttempt}`)});return{checkpoints:e,checkpointMetaByCheckpointId:t,timeline:n,messagePreviews:r,getLatest:()=>{const c=n[0];if(c)return t.get(c.id)},getCheckpoint:c=>t.get(c),getMessageAttempts:c=>{const d=[];for(const p of t.values())p.userMessageId===c&&d.push(p);return d.length?(d.sort((p,m)=>{const f=typeof p.attemptIndex=="number"?p.attemptIndex:Number.MAX_SAFE_INTEGER,v=typeof m.attemptIndex=="number"?m.attemptIndex:Number.MAX_SAFE_INTEGER;return f-v}),d):[]}}}function Ql(e,t){if(!e)return console.log("🔍 [getMessageAttemptInfo] No checkpointId provided, returning defaults"),{attemptCount:1,attemptIndex:0};const n=t.getCheckpoint(e);if(!n||!n.userMessageId)return console.log(`🔍 [getMessageAttemptInfo] No checkpoint meta or userMessageId for "${e}"`),{attemptCount:1,attemptIndex:0};const r=t.getMessageAttempts(n.userMessageId);if(!r.length)return console.log(`🔍 [getMessageAttemptInfo] No attempts found for userMessageId "${n.userMessageId}"`),{attemptCount:1,attemptIndex:0};const o=r.findIndex(s=>s.id===e);return console.log(`🔍 [getMessageAttemptInfo] checkpoint="${e}", userMsg="${n.userMessageId}", attemptCount=${r.length}, attemptIndex=${o}`),{attemptCount:r.length,attemptIndex:o>=0?o:0}}function Qg(e,t){return e?t.getCheckpoint(e)??null:null}function ec(e){return b.useMemo(()=>Zl(e),[e])}function cr(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return{...e}}function Vn(e,t){if(e)for(const n of t){const r=e[n];if(typeof r=="string"&&r.trim())return r.trim()}}function tc(e,t){if(!e)return null;for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}return null}function di(e){const t=cr(e);if(t)return cr(t.configurable)??t}function Nn(e){const r=[...(Array.isArray(e==null?void 0:e.checkpoints)?(e==null?void 0:e.checkpoints)??[]:e!=null&&e.checkpoints?Object.values(e.checkpoints):[]).map((s,i)=>ex(s,i)).filter(s=>!!s)].sort((s,i)=>nc(i.createdAt)-nc(s.createdAt)),o=r[0]??null;return{threadId:(e==null?void 0:e.threadId)??"",latest:o,checkpoints:r,interrupt:(o==null?void 0:o.interrupt)??null}}function ex(e,t){var S;if(!e)return null;const r=(Array.isArray((S=e.values)==null?void 0:S.messages)?e.values.messages:[]).filter(k=>!!(k&&typeof k=="object"&&typeof k.role=="string")),o=cr(e.metadata)??{},s=di(e.config),i=cr(e.parent_config??e.parentConfig),a=di(i),l=Vn(s,["checkpoint_id","checkpointId"]),c=Vn(s,["checkpoint_ns","checkpointNs"]),d=Vn(a,["checkpoint_id","checkpointId"]),p=Vn(a,["checkpoint_id","checkpointId"])??null,m=Vn(a,["checkpoint_ns","checkpointNs"])??null,f=cr(e.config),v=Array.isArray(e.tasks)?e.tasks.map(k=>({...k})):e.tasks??null,g=Array.isArray(e.next)?[...e.next]:e.next??null,x=typeof e.created_at=="string"&&e.created_at.trim()?e.created_at:typeof e.createdAt=="string"&&e.createdAt.trim()?e.createdAt:new Date(Date.now()-t).toISOString(),y={...o,step:tc(o,["step"])??0,source:Vn(o,["source"])??null},w=r.map(k=>({...k,checkpointId:l??null}));return console.log(`🔍 [normalizeSnapshot] Attaching checkpoint ID to ${w.length} messages:`,{checkpointId:l,messageIds:w.map(k=>k.id)}),{checkpointId:l??null,checkpointNs:c??null,createdAt:x,parentId:d??null,messages:w,nextCursor:p,nextCursorNs:m,interrupt:tx(r,t),metadata:y,config:f??null,parentConfig:i??null,next:g,tasks:v}}function tx(e,t){return nx(e,t)}function nx(e,t){var n;for(let r=e.length-1;r>=0;r--){const o=((n=e[r])==null?void 0:n.content)??[];for(let s=o.length-1;s>=0;s--){const i=o[s];if((i==null?void 0:i.type)==="interrupt"){const a=i;return{id:typeof a.id=="string"&&a.id.trim()?a.id:`interrupt-${t}-${r}-${s}`,value:a.value}}}}return null}function nc(e){if(!e)return 0;const t=Date.parse(e);return Number.isFinite(t)?t:0}var fi={exports:{}},$r={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
package/package.json
CHANGED