teodor-new-chat-ui 4.3.412 → 4.3.413

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.
@@ -1 +1,2 @@
1
1
  export { useFilePreview } from "./useFilePreview";
2
+ export { useParsedMessageContent } from "./useParsedMessageContent";
@@ -1,14 +1,14 @@
1
- export { MessageComponent } from "./MessageComponent";
2
- export type { MessageComponentProps } from "./MessageComponent";
3
- export { MessageList } from "./MessageList";
4
- export type { MessageListProps, MessageListHandle } from "./MessageList";
5
- export { MessageRow, getMessageDomKey } from "./MessageRow";
6
- export type { MessageRowProps } from "./MessageRow";
7
- export { MessageBody } from "./MessageBody";
8
1
  export { PlotArtifact } from "./artifacts/PlotArtifact";
9
2
  export { ResearchTaskArtifact } from "./artifacts/ResearchTaskArtifact";
10
- export { ArtifactRenderer, InterruptPartRenderer, SimpleJsonView, StreamProgress, ToolComponent, ThinkingIndicator, UserTextContent, } from "./renderers";
11
- export { useFilePreview } from "./hooks";
3
+ export { useFilePreview, useParsedMessageContent } from "./hooks";
12
4
  export { MarkdownContent } from "./markdown";
13
5
  export type { MarkdownContentProps } from "./markdown";
6
+ export { MessageBody } from "./MessageBody";
7
+ export { MessageComponent } from "./MessageComponent";
8
+ export type { MessageComponentProps } from "./MessageComponent";
9
+ export { MessageList } from "./MessageList";
10
+ export type { MessageListHandle, MessageListProps } from "./MessageList";
11
+ export { getMessageDomKey, MessageRow } from "./MessageRow";
12
+ export type { MessageRowProps } from "./MessageRow";
14
13
  export { FileViewerModal } from "./modals";
14
+ export { ArtifactRenderer, InterruptPartRenderer, SimpleJsonView, StreamProgress, ThinkingIndicator, ToolComponent, UserTextContent } from "./renderers";
package/dist/index.esm.js CHANGED
@@ -13861,33 +13861,7 @@ function Ro({
13861
13861
  }
13862
13862
  );
13863
13863
  }
13864
- function KC(e, t) {
13865
- return Ue(() => {
13866
- if (t)
13867
- return {
13868
- contentParts: [],
13869
- textContent: "",
13870
- toolMeta: {},
13871
- imageParts: [],
13872
- fileParts: [],
13873
- interruptParts: [],
13874
- toolRaw: "",
13875
- isToolStreaming: !1
13876
- };
13877
- const n = e, r = Array.isArray(n.content) ? n.content : [], o = n.additionalKwargs ?? {};
13878
- return {
13879
- contentParts: r,
13880
- textContent: Qv(r),
13881
- toolMeta: Oi(n),
13882
- imageParts: r.filter((s) => s.type === "image_url"),
13883
- fileParts: r.filter((s) => s.type === "file"),
13884
- interruptParts: r.filter((s) => s.type === "interrupt"),
13885
- toolRaw: ew(r),
13886
- isToolStreaming: !!o.toolStreaming
13887
- };
13888
- }, [e, t]);
13889
- }
13890
- function qC({ preview: e, idx: t }) {
13864
+ function KC({ preview: e, idx: t }) {
13891
13865
  return /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
13892
13866
  e.label && /* @__PURE__ */ u.jsxs("p", { className: "text-[0.65rem] uppercase tracking-wide text-muted-foreground", children: [
13893
13867
  "Artifact: ",
@@ -13914,7 +13888,7 @@ function qC({ preview: e, idx: t }) {
13914
13888
  ) })
13915
13889
  ] });
13916
13890
  }
13917
- function GC({ artifact: e }) {
13891
+ function qC({ artifact: e }) {
13918
13892
  const [t, n] = ge("bg-yellow-500/20 text-yellow-700 dark:text-yellow-300"), [r, o] = ge(/* @__PURE__ */ u.jsx(ha, { className: "w-4 h-4" })), [s, a] = ge("Processing");
13919
13893
  return at(() => {
13920
13894
  switch (e.status || "processing") {
@@ -13982,10 +13956,10 @@ function GC({ artifact: e }) {
13982
13956
  ] })
13983
13957
  ] });
13984
13958
  }
13985
- function YC({ artifact: e, idx: t = 0 }) {
13959
+ function GC({ artifact: e, idx: t = 0 }) {
13986
13960
  const n = Ue(() => e ? (Array.isArray(e.plots) ? e.plots : []).map((o) => sw(o)).filter((o) => o !== null) : [], [e]);
13987
13961
  return (e == null ? void 0 : e.type) === "research_task_info" ? /* @__PURE__ */ u.jsx(
13988
- GC,
13962
+ qC,
13989
13963
  {
13990
13964
  artifact: {
13991
13965
  type: "research_task_info",
@@ -13996,7 +13970,7 @@ function YC({ artifact: e, idx: t = 0 }) {
13996
13970
  createdAt: e.createdAt
13997
13971
  }
13998
13972
  }
13999
- ) : n.length > 0 ? /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: n.map((r, o) => /* @__PURE__ */ u.jsx(qC, { preview: r, idx: o }, `${t}-plot-${o}`)) }) : e && typeof e == "object" ? /* @__PURE__ */ u.jsx("div", { className: "rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/20 p-4", children: /* @__PURE__ */ u.jsxs("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
13973
+ ) : n.length > 0 ? /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: n.map((r, o) => /* @__PURE__ */ u.jsx(KC, { preview: r, idx: o }, `${t}-plot-${o}`)) }) : e && typeof e == "object" ? /* @__PURE__ */ u.jsx("div", { className: "rounded-lg border border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900/20 p-4", children: /* @__PURE__ */ u.jsxs("p", { className: "text-sm text-gray-600 dark:text-gray-400", children: [
14000
13974
  "Unknown artifact type: ",
14001
13975
  /* @__PURE__ */ u.jsx("code", { className: "font-mono", children: e.type || "unknown" })
14002
13976
  ] }) }) : null;
@@ -14054,7 +14028,7 @@ const uh = h.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ u.jsx(
14054
14028
  }
14055
14029
  ));
14056
14030
  uh.displayName = "CardFooter";
14057
- function XC({
14031
+ function YC({
14058
14032
  interruptPart: e,
14059
14033
  onApprove: t,
14060
14034
  onReject: n,
@@ -14112,11 +14086,11 @@ function XC({
14112
14086
  }
14113
14087
  );
14114
14088
  }
14115
- const JC = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";
14089
+ const XC = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";
14116
14090
  function dh({ data: e }) {
14117
- return Array.isArray(e) ? e.every((n) => n === null || ["string", "number", "boolean"].includes(typeof n)) ? /* @__PURE__ */ u.jsx("div", { className: JC, children: /* @__PURE__ */ u.jsx("ul", { className: "list-disc pl-5", children: e.map((n, r) => /* @__PURE__ */ u.jsx("li", { children: String(n) }, r)) }) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: kr(e) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: kr(e) });
14091
+ return Array.isArray(e) ? e.every((n) => n === null || ["string", "number", "boolean"].includes(typeof n)) ? /* @__PURE__ */ u.jsx("div", { className: XC, children: /* @__PURE__ */ u.jsx("ul", { className: "list-disc pl-5", children: e.map((n, r) => /* @__PURE__ */ u.jsx("li", { children: String(n) }, r)) }) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: kr(e) }) : /* @__PURE__ */ u.jsx("pre", { className: "font-mono text-xs bg-background/50 rounded border p-2 whitespace-pre-wrap break-words", children: kr(e) });
14118
14092
  }
14119
- function ZC({ message: e, isStreaming: t = !1 }) {
14093
+ function JC({ message: e, isStreaming: t = !1 }) {
14120
14094
  const n = e.name ?? "tool", r = Ue(() => {
14121
14095
  const i = e.additionalKwargs ?? {};
14122
14096
  return Array.isArray(i.toolProgress) ? [...i.toolProgress] : [];
@@ -14157,7 +14131,7 @@ function ZC({ message: e, isStreaming: t = !1 }) {
14157
14131
  }) })
14158
14132
  ] }) : null;
14159
14133
  }
14160
- function QC({ message: e, viewMode: t, isStreaming: n = !1 }) {
14134
+ function ZC({ message: e, viewMode: t, isStreaming: n = !1 }) {
14161
14135
  const o = Oi(e).name || "tool", s = (l) => {
14162
14136
  if (l == null) return null;
14163
14137
  const c = typeof l == "string" ? Mi(l) ?? l : l;
@@ -14194,11 +14168,11 @@ function QC({ message: e, viewMode: t, isStreaming: n = !1 }) {
14194
14168
  return a(d);
14195
14169
  };
14196
14170
  return /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
14197
- /* @__PURE__ */ u.jsx(ZC, { message: e, isStreaming: n }),
14171
+ /* @__PURE__ */ u.jsx(JC, { message: e, isStreaming: n }),
14198
14172
  t === "expanded" && i()
14199
14173
  ] });
14200
14174
  }
14201
- function ek({ className: e }) {
14175
+ function QC({ className: e }) {
14202
14176
  const [t, n] = ge(0);
14203
14177
  return at(() => {
14204
14178
  const r = setInterval(() => n((o) => (o + 1) % 4), 500);
@@ -14215,7 +14189,7 @@ function ek({ className: e }) {
14215
14189
  }
14216
14190
  );
14217
14191
  }
14218
- function tk({
14192
+ function ek({
14219
14193
  text: e,
14220
14194
  expanded: t,
14221
14195
  onExpandedChange: n,
@@ -14258,7 +14232,7 @@ function tk({
14258
14232
  )
14259
14233
  ] });
14260
14234
  }
14261
- function nk({
14235
+ function tk({
14262
14236
  message: e,
14263
14237
  isToolMessage: t,
14264
14238
  showToolMessages: n,
@@ -14294,7 +14268,7 @@ function nk({
14294
14268
  if (E.type === "text") {
14295
14269
  const R = E.text ?? "", H = R.trim(), M = Mi(H);
14296
14270
  return M && w !== "tool" ? /* @__PURE__ */ u.jsx(dh, { data: M }, U) : w === "user" && y && H.length > C ? /* @__PURE__ */ u.jsx(
14297
- tk,
14271
+ ek,
14298
14272
  {
14299
14273
  text: H,
14300
14274
  expanded: S,
@@ -14342,7 +14316,7 @@ function nk({
14342
14316
  (R == null ? void 0 : R.id) ?? (R == null ? void 0 : R.interrupt_id)
14343
14317
  ), M = !!(A && H && H === A), N = M ? P ?? (R == null ? void 0 : R.value) : R == null ? void 0 : R.value, K = H ? { ...R, id: H, interrupt_id: H } : R;
14344
14318
  return /* @__PURE__ */ u.jsx(
14345
- XC,
14319
+ YC,
14346
14320
  {
14347
14321
  interruptPart: K,
14348
14322
  onApprove: g,
@@ -14375,7 +14349,7 @@ function nk({
14375
14349
  return null;
14376
14350
  if (t)
14377
14351
  return !n && r ? null : n ? /* @__PURE__ */ u.jsx(
14378
- QC,
14352
+ ZC,
14379
14353
  {
14380
14354
  message: e,
14381
14355
  viewMode: o,
@@ -14387,12 +14361,12 @@ function nk({
14387
14361
  const E = /* @__PURE__ */ u.jsx("div", { className: "space-y-2", children: a.map((U, R) => /* @__PURE__ */ u.jsx(V, { part: U, i: R }, R)) });
14388
14362
  return p ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
14389
14363
  E,
14390
- /* @__PURE__ */ u.jsx(ek, { className: L })
14364
+ /* @__PURE__ */ u.jsx(QC, { className: L })
14391
14365
  ] }) : E;
14392
14366
  }
14393
14367
  return null;
14394
14368
  }
14395
- function rk(e) {
14369
+ function nk(e) {
14396
14370
  const { allowFileOpen: t, currentThreadId: n } = e, { toast: r } = Il(), [o, s] = ge({}), [a, i] = ge(null), [l, c] = ge(!1), d = we(() => {
14397
14371
  c(!1), i(null);
14398
14372
  }, []), p = we((f) => {
@@ -14464,6 +14438,32 @@ function rk(e) {
14464
14438
  closeFileViewer: d
14465
14439
  };
14466
14440
  }
14441
+ function rk(e, t) {
14442
+ return Ue(() => {
14443
+ if (t)
14444
+ return {
14445
+ contentParts: [],
14446
+ textContent: "",
14447
+ toolMeta: {},
14448
+ imageParts: [],
14449
+ fileParts: [],
14450
+ interruptParts: [],
14451
+ toolRaw: "",
14452
+ isToolStreaming: !1
14453
+ };
14454
+ const n = e, r = Array.isArray(n.content) ? n.content : [], o = n.additionalKwargs ?? {};
14455
+ return {
14456
+ contentParts: r,
14457
+ textContent: Qv(r),
14458
+ toolMeta: Oi(n),
14459
+ imageParts: r.filter((s) => s.type === "image_url"),
14460
+ fileParts: r.filter((s) => s.type === "file"),
14461
+ interruptParts: r.filter((s) => s.type === "interrupt"),
14462
+ toolRaw: ew(r),
14463
+ isToolStreaming: !!o.toolStreaming
14464
+ };
14465
+ }, [e, t]);
14466
+ }
14467
14467
  const jl = Eg(function({
14468
14468
  message: t,
14469
14469
  messageIndex: n,
@@ -14498,7 +14498,7 @@ const jl = Eg(function({
14498
14498
  fileViewerOpen: W,
14499
14499
  currentFileInfo: D,
14500
14500
  closeFileViewer: Y
14501
- } = rk({ allowFileOpen: q, currentThreadId: H }), Z = Ue(() => {
14501
+ } = nk({ allowFileOpen: q, currentThreadId: H }), Z = Ue(() => {
14502
14502
  switch (K) {
14503
14503
  case "user":
14504
14504
  return "text-[hsl(var(--chat-bubble-user-text))]";
@@ -14511,7 +14511,7 @@ const jl = Eg(function({
14511
14511
  default:
14512
14512
  return "text-[hsl(var(--chat-bubble-ai-text))]";
14513
14513
  }
14514
- }, [K]), ae = KC(t, j), {
14514
+ }, [K]), ae = rk(t, j), {
14515
14515
  contentParts: $,
14516
14516
  imageParts: te,
14517
14517
  fileParts: ve,
@@ -14821,7 +14821,7 @@ const jl = Eg(function({
14821
14821
  ),
14822
14822
  /* @__PURE__ */ u.jsxs("div", { className: "relative", children: [
14823
14823
  /* @__PURE__ */ u.jsx(
14824
- nk,
14824
+ tk,
14825
14825
  {
14826
14826
  message: t,
14827
14827
  isToolMessage: X,
@@ -14852,7 +14852,7 @@ const jl = Eg(function({
14852
14852
  iconForeground: Z
14853
14853
  }
14854
14854
  ),
14855
- m && ze && /* @__PURE__ */ u.jsx("div", { className: "mt-3", children: /* @__PURE__ */ u.jsx(YC, { artifact: ze, idx: 0 }) })
14855
+ m && ze && /* @__PURE__ */ u.jsx("div", { className: "mt-3", children: /* @__PURE__ */ u.jsx(GC, { artifact: ze, idx: 0 }) })
14856
14856
  ] }),
14857
14857
  X && F === "expanded" && (ke.toolCallId || ke.name) && /* @__PURE__ */ u.jsxs("div", { className: ne("mt-2 pt-2 border-t border-current/10 text-xs opacity-60", N && "text-xs"), children: [
14858
14858
  ke.name && /* @__PURE__ */ u.jsxs("div", { children: [
@@ -19378,7 +19378,7 @@ export {
19378
19378
  UI as Api,
19379
19379
  HI as ApiClient,
19380
19380
  Hv as ApiProvider,
19381
- YC as ArtifactRenderer,
19381
+ GC as ArtifactRenderer,
19382
19382
  uC as Badge,
19383
19383
  pt as Button,
19384
19384
  sh as Card,
@@ -19409,15 +19409,15 @@ export {
19409
19409
  IC as FileViewerModal,
19410
19410
  $v as HISTORY_TIMEOUT_MS,
19411
19411
  Wh as Input,
19412
- XC as InterruptPartRenderer,
19412
+ YC as InterruptPartRenderer,
19413
19413
  Zk as Label,
19414
19414
  Ro as MarkdownContent,
19415
- nk as MessageBody,
19415
+ tk as MessageBody,
19416
19416
  jl as MessageComponent,
19417
19417
  hh as MessageList,
19418
19418
  ph as MessageRow,
19419
- qC as PlotArtifact,
19420
- GC as ResearchTaskArtifact,
19419
+ KC as PlotArtifact,
19420
+ qC as ResearchTaskArtifact,
19421
19421
  vd as SETTINGS_STORAGE_KEY,
19422
19422
  Hh as ScrollArea,
19423
19423
  r1 as Select,
@@ -19435,22 +19435,22 @@ export {
19435
19435
  t1 as SimpleChat,
19436
19436
  dh as SimpleJsonView,
19437
19437
  m1 as Sonner,
19438
- ZC as StreamProgress,
19438
+ JC as StreamProgress,
19439
19439
  UE as Switch,
19440
19440
  Qf as Textarea,
19441
- ek as ThinkingIndicator,
19441
+ QC as ThinkingIndicator,
19442
19442
  Vk as ThreadListItem,
19443
19443
  Eu as ThreadManager,
19444
19444
  bw as ThreadStateProvider,
19445
19445
  Xv as ThreadsProvider,
19446
19446
  TI as TimelineColumn,
19447
19447
  h1 as Toaster,
19448
- QC as ToolComponent,
19448
+ ZC as ToolComponent,
19449
19449
  d1 as Tooltip,
19450
19450
  mR as TooltipContent,
19451
19451
  u1 as TooltipProvider,
19452
19452
  f1 as TooltipTrigger,
19453
- tk as UserTextContent,
19453
+ ek as UserTextContent,
19454
19454
  GI as applySettings,
19455
19455
  Jg as buildAttemptMaps,
19456
19456
  Qg as buildCheckpointIndex,
@@ -19488,9 +19488,10 @@ export {
19488
19488
  zt as unwrap,
19489
19489
  As as useApi,
19490
19490
  ex as useCheckpointIndex,
19491
- rk as useFilePreview,
19491
+ nk as useFilePreview,
19492
19492
  KI as useHasChatSession,
19493
19493
  Xg as useMessageMetadata,
19494
+ rk as useParsedMessageContent,
19494
19495
  Tw as useStream,
19495
19496
  Tw as useStreamingHook,
19496
19497
  vw as useThreadHistoryState,