laif-ds 0.1.98 → 0.2.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.
@@ -1,228 +1,259 @@
1
1
  "use client";
2
- import { jsxs as C, jsx as t, Fragment as j } from "react/jsx-runtime";
3
- import { forwardRef as g, useRef as L, useCallback as N, useState as z } from "react";
4
- import { cn as B } from "../../lib/utils.js";
5
- import { useAutoScroll as D } from "../../hooks/use-auto-scroll.js";
6
- import { Button as x } from "./button.js";
7
- import { CopyButton as T } from "./copy-button.js";
8
- import { MessageInput as P } from "./message-input.js";
9
- import { MessageList as U } from "./message-list.js";
10
- import { PromptSuggestions as E } from "./prompt-suggestions.js";
11
- import O from "../../node_modules/lucide-react/dist/esm/icons/thumbs-up.js";
12
- import q from "../../node_modules/lucide-react/dist/esm/icons/thumbs-down.js";
13
- import H from "../../node_modules/lucide-react/dist/esm/icons/arrow-down.js";
14
- function J({
15
- messages: e,
16
- handleSubmit: n,
2
+ import { jsxs as N, Fragment as T, jsx as t } from "react/jsx-runtime";
3
+ import { forwardRef as g, useRef as U, useCallback as I, useState as E } from "react";
4
+ import { cn as M } from "../../lib/utils.js";
5
+ import { useAutoScroll as O } from "../../hooks/use-auto-scroll.js";
6
+ import { Button as w } from "./button.js";
7
+ import { CopyButton as k } from "./copy-button.js";
8
+ import { MessageInput as q } from "./message-input.js";
9
+ import { MessageList as H } from "./message-list.js";
10
+ import { PromptSuggestions as J } from "./prompt-suggestions.js";
11
+ import S from "../../node_modules/lucide-react/dist/esm/icons/save.js";
12
+ import K from "../../node_modules/lucide-react/dist/esm/icons/thumbs-up.js";
13
+ import Q from "../../node_modules/lucide-react/dist/esm/icons/thumbs-down.js";
14
+ import V from "../../node_modules/lucide-react/dist/esm/icons/arrow-down.js";
15
+ function W({
16
+ messages: o,
17
+ handleSubmit: r,
17
18
  input: i,
18
19
  handleInputChange: u,
19
- stop: s,
20
+ stop: a,
20
21
  isGenerating: c,
21
- append: d,
22
- suggestions: f,
23
- className: w,
24
- onRateResponse: p,
25
- setMessages: v,
26
- transcribeAudio: M
22
+ append: f,
23
+ suggestions: m,
24
+ className: v,
25
+ onRateResponse: b,
26
+ setMessages: C,
27
+ transcribeAudio: F,
28
+ allowAttachments: _ = !1,
29
+ onEdit: j,
30
+ onMessageSave: d
27
31
  }) {
28
- const k = e.at(-1), A = e.length === 0, y = k?.role === "user", b = L(e);
29
- b.current = e;
30
- const F = N(() => {
31
- if (s?.(), !v) return;
32
- const r = [...b.current], l = r.findLast(
33
- (a) => a.role === "assistant"
32
+ const L = o.at(-1), B = o.length === 0, y = L?.role === "user", x = U(o);
33
+ x.current = o;
34
+ const D = I(() => {
35
+ if (a?.(), !C) return;
36
+ const e = [...x.current], l = e.findLast(
37
+ (s) => s.role === "assistant"
34
38
  );
35
39
  if (!l) return;
36
- let m = !1, h = { ...l };
40
+ let h = !1, p = { ...l };
37
41
  if (l.toolInvocations) {
38
- const a = l.toolInvocations.map(
39
- (o) => o.state === "call" ? (m = !0, {
40
- ...o,
42
+ const s = l.toolInvocations.map(
43
+ (n) => n.state === "call" ? (h = !0, {
44
+ ...n,
41
45
  state: "result",
42
46
  result: {
43
47
  content: "Tool execution was cancelled",
44
48
  __cancelled: !0
45
49
  // Special marker to indicate cancellation
46
50
  }
47
- }) : o
51
+ }) : n
48
52
  );
49
- m && (h = {
50
- ...h,
51
- toolInvocations: a
53
+ h && (p = {
54
+ ...p,
55
+ toolInvocations: s
52
56
  });
53
57
  }
54
58
  if (l.parts && l.parts.length > 0) {
55
- const a = l.parts.map((o) => o.type === "tool-invocation" && o.toolInvocation && o.toolInvocation.state === "call" ? (m = !0, {
56
- ...o,
59
+ const s = l.parts.map((n) => n.type === "tool-invocation" && n.toolInvocation && n.toolInvocation.state === "call" ? (h = !0, {
60
+ ...n,
57
61
  toolInvocation: {
58
- ...o.toolInvocation,
62
+ ...n.toolInvocation,
59
63
  state: "result",
60
64
  result: {
61
65
  content: "Tool execution was cancelled",
62
66
  __cancelled: !0
63
67
  }
64
68
  }
65
- }) : o);
66
- m && (h = {
67
- ...h,
68
- parts: a
69
+ }) : n);
70
+ h && (p = {
71
+ ...p,
72
+ parts: s
69
73
  });
70
74
  }
71
- if (m) {
72
- const a = r.findIndex(
73
- (o) => o.id === l.id
75
+ if (h) {
76
+ const s = e.findIndex(
77
+ (n) => n.id === l.id
74
78
  );
75
- a !== -1 && (r[a] = h, v(r));
79
+ s !== -1 && (e[s] = p, C(e));
76
80
  }
77
- }, [s, v, b]), _ = N(
78
- (r) => ({
79
- actions: p ? /* @__PURE__ */ C(j, { children: [
81
+ }, [a, C, x]), P = I(
82
+ (e) => ({
83
+ actions: b ? /* @__PURE__ */ N(T, { children: [
80
84
  /* @__PURE__ */ t("div", { className: "border-d-border border-r pr-1", children: /* @__PURE__ */ t(
81
- T,
85
+ k,
82
86
  {
83
- content: r.content,
87
+ content: e.content,
84
88
  copyMessage: "Copied response to clipboard!"
85
89
  }
86
90
  ) }),
91
+ d && /* @__PURE__ */ t("div", { className: "border-d-border border-r pr-1", children: /* @__PURE__ */ t(
92
+ w,
93
+ {
94
+ size: "icon",
95
+ variant: "ghost",
96
+ className: "h-6 w-6",
97
+ onClick: () => d(e.id, e.content),
98
+ title: "Save message",
99
+ children: /* @__PURE__ */ t(S, { className: "h-4 w-4" })
100
+ }
101
+ ) }),
87
102
  /* @__PURE__ */ t(
88
- x,
103
+ w,
89
104
  {
90
105
  size: "icon",
91
106
  variant: "ghost",
92
107
  className: "h-6 w-6",
93
- onClick: () => p(r.id, "thumbs-up"),
94
- children: /* @__PURE__ */ t(O, { className: "h-4 w-4" })
108
+ onClick: () => b(e.id, "thumbs-up"),
109
+ children: /* @__PURE__ */ t(K, { className: "h-4 w-4" })
95
110
  }
96
111
  ),
97
112
  /* @__PURE__ */ t(
98
- x,
113
+ w,
99
114
  {
100
115
  size: "icon",
101
116
  variant: "ghost",
102
117
  className: "h-6 w-6",
103
- onClick: () => p(r.id, "thumbs-down"),
104
- children: /* @__PURE__ */ t(q, { className: "h-4 w-4" })
118
+ onClick: () => b(e.id, "thumbs-down"),
119
+ children: /* @__PURE__ */ t(Q, { className: "h-4 w-4" })
105
120
  }
106
121
  )
107
- ] }) : /* @__PURE__ */ t(
108
- T,
109
- {
110
- content: r.content,
111
- copyMessage: "Copied response to clipboard!"
112
- }
113
- )
122
+ ] }) : /* @__PURE__ */ N(T, { children: [
123
+ /* @__PURE__ */ t(
124
+ k,
125
+ {
126
+ content: e.content,
127
+ copyMessage: "Copied response to clipboard!"
128
+ }
129
+ ),
130
+ d && /* @__PURE__ */ t("div", { className: "border-d-border border-l pl-1", children: /* @__PURE__ */ t(
131
+ w,
132
+ {
133
+ size: "icon",
134
+ variant: "ghost",
135
+ className: "h-6 w-6",
136
+ onClick: () => d(e.id, e.content),
137
+ title: "Save message",
138
+ children: /* @__PURE__ */ t(S, { className: "h-4 w-4" })
139
+ }
140
+ ) })
141
+ ] }),
142
+ onMessageSave: d
114
143
  }),
115
- [p]
144
+ [b, d]
116
145
  );
117
- return /* @__PURE__ */ C(S, { className: w, children: [
118
- A && d && f ? /* @__PURE__ */ t(
119
- E,
146
+ return /* @__PURE__ */ N(z, { className: v, children: [
147
+ B && f && m ? /* @__PURE__ */ t(
148
+ J,
120
149
  {
121
150
  label: "Try these prompts ✨",
122
- append: d,
123
- suggestions: f
151
+ append: f,
152
+ suggestions: m
124
153
  }
125
154
  ) : null,
126
- e.length > 0 ? /* @__PURE__ */ t(K, { messages: e, children: /* @__PURE__ */ t(
127
- U,
155
+ o.length > 0 ? /* @__PURE__ */ t(X, { messages: o, children: /* @__PURE__ */ t(
156
+ H,
128
157
  {
129
- messages: e,
158
+ messages: o,
130
159
  isTyping: y,
131
- messageOptions: _
160
+ messageOptions: P,
161
+ onEdit: j,
162
+ onMessageSave: d
132
163
  }
133
164
  ) }) : null,
134
165
  /* @__PURE__ */ t(
135
- I,
166
+ A,
136
167
  {
137
168
  className: "flex-shrink-0",
138
169
  isPending: c || y,
139
- handleSubmit: n,
140
- children: ({ files: r, setFiles: l }) => /* @__PURE__ */ t(
141
- P,
170
+ handleSubmit: r,
171
+ children: ({ files: e, setFiles: l }) => /* @__PURE__ */ t(
172
+ q,
142
173
  {
143
174
  value: i,
144
175
  onChange: u,
145
- allowAttachments: !0,
146
- files: r,
176
+ allowAttachments: _,
177
+ files: e,
147
178
  setFiles: l,
148
- stop: F,
179
+ stop: D,
149
180
  isGenerating: c,
150
- transcribeAudio: M
181
+ transcribeAudio: F
151
182
  }
152
183
  )
153
184
  }
154
185
  )
155
186
  ] });
156
187
  }
157
- J.displayName = "Chat";
158
- function K({
159
- messages: e,
160
- children: n
188
+ W.displayName = "Chat";
189
+ function X({
190
+ messages: o,
191
+ children: r
161
192
  }) {
162
193
  const {
163
194
  containerRef: i,
164
195
  scrollToBottom: u,
165
- handleScroll: s,
196
+ handleScroll: a,
166
197
  shouldAutoScroll: c,
167
- handleTouchStart: d
168
- } = D([e]);
169
- return /* @__PURE__ */ C(
198
+ handleTouchStart: f
199
+ } = O([o]);
200
+ return /* @__PURE__ */ N(
170
201
  "div",
171
202
  {
172
203
  className: "relative flex-1 overflow-y-auto pb-4",
173
204
  ref: i,
174
- onScroll: s,
175
- onTouchStart: d,
205
+ onScroll: a,
206
+ onTouchStart: f,
176
207
  children: [
177
- /* @__PURE__ */ t("div", { className: "max-w-full", children: n }),
208
+ /* @__PURE__ */ t("div", { className: "max-w-full", children: r }),
178
209
  !c && /* @__PURE__ */ t("div", { className: "pointer-events-none absolute right-0 bottom-0 left-0 flex items-end justify-end", children: /* @__PURE__ */ t("div", { className: "sticky bottom-0 left-0 flex w-full justify-end", children: /* @__PURE__ */ t(
179
- x,
210
+ w,
180
211
  {
181
212
  onClick: u,
182
213
  className: "animate-in fade-in-0 slide-in-from-bottom-1 pointer-events-auto h-8 w-8 rounded-full ease-in-out",
183
214
  size: "icon",
184
215
  variant: "ghost",
185
- children: /* @__PURE__ */ t(H, { className: "h-4 w-4" })
216
+ children: /* @__PURE__ */ t(V, { className: "h-4 w-4" })
186
217
  }
187
218
  ) }) })
188
219
  ]
189
220
  }
190
221
  );
191
222
  }
192
- const S = g(({ className: e, ...n }, i) => /* @__PURE__ */ t(
223
+ const z = g(({ className: o, ...r }, i) => /* @__PURE__ */ t(
193
224
  "div",
194
225
  {
195
226
  ref: i,
196
- className: B("flex h-full max-h-full w-full flex-col", e),
197
- ...n
227
+ className: M("flex h-full max-h-full w-full flex-col", o),
228
+ ...r
198
229
  }
199
230
  ));
200
- S.displayName = "ChatContainer";
201
- const I = g(
202
- ({ children: e, handleSubmit: n, className: i }, u) => {
203
- const [s, c] = z(null);
204
- return /* @__PURE__ */ t("form", { ref: u, onSubmit: (f) => {
205
- if (!s) {
206
- n(f);
231
+ z.displayName = "ChatContainer";
232
+ const A = g(
233
+ ({ children: o, handleSubmit: r, className: i }, u) => {
234
+ const [a, c] = E(null);
235
+ return /* @__PURE__ */ t("form", { ref: u, onSubmit: (m) => {
236
+ if (!a) {
237
+ r(m);
207
238
  return;
208
239
  }
209
- const w = Q(s);
210
- n(f, { experimental_attachments: w }), c(null);
211
- }, className: i, children: e({ files: s, setFiles: c }) });
240
+ const v = Y(a);
241
+ r(m, { experimental_attachments: v }), c(null);
242
+ }, className: i, children: o({ files: a, setFiles: c }) });
212
243
  }
213
244
  );
214
- I.displayName = "ChatForm";
215
- function Q(e) {
245
+ A.displayName = "ChatForm";
246
+ function Y(o) {
216
247
  if (typeof window > "u")
217
248
  return {};
218
- const n = new DataTransfer();
219
- for (const i of Array.from(e))
220
- n.items.add(i);
221
- return n.files;
249
+ const r = new DataTransfer();
250
+ for (const i of Array.from(o))
251
+ r.items.add(i);
252
+ return r.files;
222
253
  }
223
254
  export {
224
- J as Chat,
225
- S as ChatContainer,
226
- I as ChatForm,
227
- K as ChatMessages
255
+ W as Chat,
256
+ z as ChatContainer,
257
+ A as ChatForm,
258
+ X as ChatMessages
228
259
  };
@@ -1,34 +1,34 @@
1
1
  "use client";
2
2
  import { jsx as a, jsxs as n } from "react/jsx-runtime";
3
- import { Root as l, Trigger as d, Content as c, Close as s, Title as g, Description as f, Portal as u, Overlay as m } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
3
+ import { Root as c, Trigger as g, Content as f, Close as l, Title as u, Description as m, Portal as p, Overlay as x } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
4
4
  import { cn as o } from "../../lib/utils.js";
5
- import p from "../../node_modules/lucide-react/dist/esm/icons/x.js";
6
- function w({
5
+ import D from "../../node_modules/lucide-react/dist/esm/icons/x.js";
6
+ function C({
7
7
  ...t
8
8
  }) {
9
- return /* @__PURE__ */ a(l, { "data-slot": "dialog", ...t });
9
+ return /* @__PURE__ */ a(c, { "data-slot": "dialog", ...t });
10
10
  }
11
- function z({
11
+ function k({
12
12
  ...t
13
13
  }) {
14
- return /* @__PURE__ */ a(d, { "data-slot": "dialog-trigger", ...t });
14
+ return /* @__PURE__ */ a(g, { "data-slot": "dialog-trigger", ...t });
15
15
  }
16
- function x({
16
+ function v({
17
17
  ...t
18
18
  }) {
19
- return /* @__PURE__ */ a(u, { "data-slot": "dialog-portal", ...t });
19
+ return /* @__PURE__ */ a(p, { "data-slot": "dialog-portal", ...t });
20
20
  }
21
- function C({
21
+ function T({
22
22
  ...t
23
23
  }) {
24
- return /* @__PURE__ */ a(s, { "data-slot": "dialog-close", ...t });
24
+ return /* @__PURE__ */ a(l, { "data-slot": "dialog-close", ...t });
25
25
  }
26
- function D({
26
+ function b({
27
27
  className: t,
28
28
  ...e
29
29
  }) {
30
30
  return /* @__PURE__ */ a(
31
- m,
31
+ x,
32
32
  {
33
33
  "data-slot": "dialog-overlay",
34
34
  className: o(
@@ -39,29 +39,37 @@ function D({
39
39
  }
40
40
  );
41
41
  }
42
- function k({
42
+ function j({
43
43
  className: t,
44
44
  children: e,
45
+ size: r = "default",
45
46
  ...i
46
47
  }) {
47
- return /* @__PURE__ */ n(x, { "data-slot": "dialog-portal", children: [
48
- /* @__PURE__ */ a(D, {}),
48
+ const d = {
49
+ sm: "sm:max-w-sm",
50
+ default: "sm:max-w-lg",
51
+ lg: "sm:max-w-2xl",
52
+ xl: "sm:max-w-3xl"
53
+ }[r];
54
+ return /* @__PURE__ */ n(v, { "data-slot": "dialog-portal", children: [
55
+ /* @__PURE__ */ a(b, {}),
49
56
  /* @__PURE__ */ n(
50
- c,
57
+ f,
51
58
  {
52
59
  "data-slot": "dialog-content",
53
- onPointerDownOutside: (r) => {
54
- r.target?.closest("[data-command-portal]") && r.preventDefault();
60
+ onPointerDownOutside: (s) => {
61
+ s.target?.closest("[data-command-portal]") && s.preventDefault();
55
62
  },
56
63
  className: o(
57
- "bg-d-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-d-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
64
+ "bg-d-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 border-d-border fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200",
65
+ d,
58
66
  t
59
67
  ),
60
68
  ...i,
61
69
  children: [
62
70
  e,
63
- /* @__PURE__ */ n(s, { className: "ring-offset-d-background focus:ring-d-ring data-[state=open]:bg-d-accent data-[state=open]:text-d-secondary-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
64
- /* @__PURE__ */ a(p, {}),
71
+ /* @__PURE__ */ n(l, { className: "ring-offset-d-background focus:ring-d-ring data-[state=open]:bg-d-accent data-[state=open]:text-d-secondary-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [
72
+ /* @__PURE__ */ a(D, {}),
65
73
  /* @__PURE__ */ a("span", { className: "sr-only", children: "Close" })
66
74
  ] })
67
75
  ]
@@ -69,7 +77,7 @@ function k({
69
77
  )
70
78
  ] });
71
79
  }
72
- function T({ className: t, ...e }) {
80
+ function O({ className: t, ...e }) {
73
81
  return /* @__PURE__ */ a(
74
82
  "div",
75
83
  {
@@ -79,7 +87,7 @@ function T({ className: t, ...e }) {
79
87
  }
80
88
  );
81
89
  }
82
- function j({ className: t, ...e }) {
90
+ function P({ className: t, ...e }) {
83
91
  return /* @__PURE__ */ a(
84
92
  "div",
85
93
  {
@@ -92,12 +100,12 @@ function j({ className: t, ...e }) {
92
100
  }
93
101
  );
94
102
  }
95
- function O({
103
+ function _({
96
104
  className: t,
97
105
  ...e
98
106
  }) {
99
107
  return /* @__PURE__ */ a(
100
- g,
108
+ u,
101
109
  {
102
110
  "data-slot": "dialog-title",
103
111
  className: o("text-lg leading-none font-semibold", t),
@@ -105,12 +113,12 @@ function O({
105
113
  }
106
114
  );
107
115
  }
108
- function P({
116
+ function F({
109
117
  className: t,
110
118
  ...e
111
119
  }) {
112
120
  return /* @__PURE__ */ a(
113
- f,
121
+ m,
114
122
  {
115
123
  "data-slot": "dialog-description",
116
124
  className: o("text-d-secondary-foreground text-sm", t),
@@ -119,14 +127,14 @@ function P({
119
127
  );
120
128
  }
121
129
  export {
122
- w as Dialog,
123
- C as DialogClose,
124
- k as DialogContent,
125
- P as DialogDescription,
126
- j as DialogFooter,
127
- T as DialogHeader,
128
- D as DialogOverlay,
129
- x as DialogPortal,
130
- O as DialogTitle,
131
- z as DialogTrigger
130
+ C as Dialog,
131
+ T as DialogClose,
132
+ j as DialogContent,
133
+ F as DialogDescription,
134
+ P as DialogFooter,
135
+ O as DialogHeader,
136
+ b as DialogOverlay,
137
+ v as DialogPortal,
138
+ _ as DialogTitle,
139
+ k as DialogTrigger
132
140
  };
@@ -127,7 +127,7 @@ function ie({
127
127
  onPaste: K,
128
128
  onKeyDown: U,
129
129
  className: C(
130
- "border-d-input bg-d-background ring-offset-d-background placeholder:text-d-secondary-foreground focus-visible:border-d-primary z-10 w-full grow resize-none rounded-xl border p-3 pr-24 text-sm transition-[border] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
130
+ "border-d-input bg-d-input ring-offset-d-background placeholder:text-d-muted-foreground focus-visible:border-d-primary z-10 w-full grow resize-none rounded-xl border p-3 pr-24 text-sm transition-[border] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
131
131
  z && "pb-16",
132
132
  n
133
133
  ),
@@ -1,29 +1,33 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
3
- import { ChatMessage as f } from "./chat-message.js";
4
- import { TypingIndicator as p } from "./typing-indicator.js";
5
- function d({
6
- messages: r,
2
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
3
+ import { ChatMessage as s } from "./chat-message.js";
4
+ import { TypingIndicator as m } from "./typing-indicator.js";
5
+ function x({
6
+ messages: n,
7
7
  showTimeStamps: e = !0,
8
- isTyping: n = !1,
9
- messageOptions: t
8
+ isTyping: a = !1,
9
+ messageOptions: i,
10
+ onEdit: t,
11
+ onMessageSave: c
10
12
  }) {
11
- return /* @__PURE__ */ c("div", { className: "space-y-4 overflow-visible", children: [
12
- r.map((i, a) => {
13
- const s = typeof t == "function" ? t(i) : t;
14
- return /* @__PURE__ */ o(
15
- f,
13
+ return /* @__PURE__ */ l("div", { className: "space-y-4 overflow-visible", children: [
14
+ n.map((o, f) => {
15
+ const p = typeof i == "function" ? i(o) : i;
16
+ return /* @__PURE__ */ r(
17
+ s,
16
18
  {
17
19
  showTimeStamp: e,
18
- ...i,
19
- ...s
20
+ ...o,
21
+ ...p,
22
+ onEdit: t ? (d) => t(o.id, d) : void 0,
23
+ onMessageSave: c
20
24
  },
21
- a
25
+ f
22
26
  );
23
27
  }),
24
- n && /* @__PURE__ */ o(p, {})
28
+ a && /* @__PURE__ */ r(m, {})
25
29
  ] });
26
30
  }
27
31
  export {
28
- d as MessageList
32
+ x as MessageList
29
33
  };
package/dist/index.d.ts CHANGED
@@ -436,7 +436,7 @@ export declare function ChartTooltipContent({ active, payload, className, indica
436
436
  labelKey?: string;
437
437
  } & React_2.HTMLAttributes<HTMLDivElement>): JSX.Element | null;
438
438
 
439
- export declare function Chat({ messages, handleSubmit, input, handleInputChange, stop, isGenerating, append, suggestions, className, onRateResponse, setMessages, transcribeAudio, }: ChatProps): JSX.Element;
439
+ export declare function Chat({ messages, handleSubmit, input, handleInputChange, stop, isGenerating, append, suggestions, className, onRateResponse, setMessages, transcribeAudio, allowAttachments, onEdit, onMessageSave, }: ChatProps): JSX.Element;
440
440
 
441
441
  export declare namespace Chat {
442
442
  var displayName: string;
@@ -471,6 +471,8 @@ export declare interface ChatMessageProps extends Message {
471
471
  showTimeStamp?: boolean;
472
472
  animation?: Animation_2;
473
473
  actions?: default_3.ReactNode;
474
+ onEdit?: (newContent: string) => void;
475
+ onMessageSave?: (messageId: string, content: string) => void;
474
476
  }
475
477
 
476
478
  export declare function ChatMessages({ messages, children, }: React.PropsWithChildren<{
@@ -494,6 +496,9 @@ declare interface ChatPropsBase {
494
496
  onRateResponse?: (messageId: string, rating: "thumbs-up" | "thumbs-down") => void;
495
497
  setMessages?: (messages: any[]) => void;
496
498
  transcribeAudio?: (blob: Blob) => Promise<string>;
499
+ allowAttachments?: boolean;
500
+ onEdit?: (messageId: string, newContent: string) => void;
501
+ onMessageSave?: (messageId: string, content: string) => void;
497
502
  }
498
503
 
499
504
  declare interface ChatPropsWithoutSuggestions extends ChatPropsBase {
@@ -791,7 +796,9 @@ declare interface DatePickerProps {
791
796
 
792
797
  export declare function Dialog({ ...props }: React_2.ComponentProps<typeof DialogPrimitive.Root>): JSX.Element;
793
798
 
794
- export declare function DialogContent({ className, children, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content>): JSX.Element;
799
+ export declare function DialogContent({ className, children, size, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Content> & {
800
+ size?: "sm" | "default" | "lg";
801
+ }): JSX.Element;
795
802
 
796
803
  export declare function DialogDescription({ className, ...props }: React_2.ComponentProps<typeof DialogPrimitive.Description>): JSX.Element;
797
804
 
@@ -1171,13 +1178,15 @@ declare interface MessageInputWithoutAttachmentProps extends MessageInputBasePro
1171
1178
  allowAttachments?: false;
1172
1179
  }
1173
1180
 
1174
- export declare function MessageList({ messages, showTimeStamps, isTyping, messageOptions, }: MessageListProps): JSX.Element;
1181
+ export declare function MessageList({ messages, showTimeStamps, isTyping, messageOptions, onEdit, onMessageSave, }: MessageListProps): JSX.Element;
1175
1182
 
1176
1183
  declare interface MessageListProps {
1177
1184
  messages: Message[];
1178
1185
  showTimeStamps?: boolean;
1179
1186
  isTyping?: boolean;
1180
1187
  messageOptions?: AdditionalMessageOptions | ((message: Message) => AdditionalMessageOptions);
1188
+ onEdit?: (messageId: string, newContent: string) => void;
1189
+ onMessageSave?: (messageId: string, content: string) => void;
1181
1190
  }
1182
1191
 
1183
1192
  declare type MessagePart = TextPart | ReasoningPart | ToolInvocationPart | SourcePart;