wecool-chat 0.1.0 → 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.
package/dist/index.js CHANGED
@@ -1,40 +1,40 @@
1
- import V, { useState as b, useRef as O, useEffect as j, useCallback as g, forwardRef as P, createElement as I, useMemo as M } from "react";
2
- import { createRoot as X } from "react-dom/client";
3
- import { jsx as l, jsxs as w } from "react/jsx-runtime";
4
- async function* Z(e) {
1
+ import W, { useCallback as p, useRef as C, useState as w, useEffect as E, forwardRef as N, createElement as k, useMemo as A } from "react";
2
+ import { createRoot as q } from "react-dom/client";
3
+ import { jsx as i, jsxs as T } from "react/jsx-runtime";
4
+ async function* V(e) {
5
5
  if (!e) return;
6
- const o = e.getReader(), t = new TextDecoder();
6
+ const t = e.getReader(), o = new TextDecoder();
7
7
  let n = "";
8
8
  try {
9
9
  for (; ; ) {
10
- const { done: d, value: u } = await o.read();
11
- if (d) break;
12
- n += t.decode(u, { stream: !0 });
13
- const p = n.split(`
10
+ const { done: a, value: l } = await t.read();
11
+ if (a) break;
12
+ n += o.decode(l, { stream: !0 });
13
+ const c = n.split(`
14
14
  `);
15
- n = p.pop() ?? "";
16
- for (const a of p) {
17
- const i = D(a);
18
- i && (yield i);
15
+ n = c.pop() ?? "";
16
+ for (const u of c) {
17
+ const d = _(u);
18
+ d && (yield d);
19
19
  }
20
20
  }
21
- const r = n + t.decode(), s = D(r);
21
+ const r = n + o.decode(), s = _(r);
22
22
  s && (yield s);
23
23
  } finally {
24
- o.releaseLock();
24
+ t.releaseLock();
25
25
  }
26
26
  }
27
- const D = (e) => {
27
+ const _ = (e) => {
28
28
  if (!e.startsWith("data:")) return null;
29
- const o = e.slice(5).trim();
30
- return o ? JSON.parse(o) : null;
29
+ const t = e.slice(5).trim();
30
+ return t ? JSON.parse(t) : null;
31
31
  };
32
- class q {
32
+ class X {
33
33
  endpoint;
34
34
  apiKey;
35
35
  conversationId = null;
36
- constructor(o, t) {
37
- this.endpoint = o.replace(/\/$/, ""), this.apiKey = t;
36
+ constructor(t, o) {
37
+ this.endpoint = t.replace(/\/$/, ""), this.apiKey = o;
38
38
  }
39
39
  getConversationId() {
40
40
  return this.conversationId || (this.conversationId = crypto.randomUUID()), this.conversationId;
@@ -45,205 +45,332 @@ class q {
45
45
  /**
46
46
  * Send a chat message or tool results and receive SSE events.
47
47
  */
48
- async *chat(o) {
49
- const t = await fetch(`${this.endpoint}/api/chat`, {
48
+ async *chat(t, o) {
49
+ const n = await fetch(`${this.endpoint}/api/chat`, {
50
50
  method: "POST",
51
51
  headers: this.buildHeaders(),
52
- body: JSON.stringify(this.buildBody(o))
52
+ body: JSON.stringify(this.buildBody(t)),
53
+ signal: o
53
54
  });
54
- if (!t.ok) {
55
- const n = await t.text();
56
- throw new Error(`API error: ${t.status} - ${n}`);
55
+ if (!n.ok) {
56
+ const r = await n.text();
57
+ throw new Error(`API error: ${n.status} - ${r}`);
57
58
  }
58
- for await (const n of Z(t.body))
59
- n.type === "done" && (this.conversationId = n.conversationId), yield n;
59
+ for await (const r of V(n.body))
60
+ r.type === "done" && (this.conversationId = r.conversationId), yield r;
60
61
  }
61
62
  buildHeaders() {
62
- const o = { "Content-Type": "application/json" };
63
- return this.apiKey && (o["X-API-Key"] = this.apiKey), o;
63
+ const t = { "Content-Type": "application/json" };
64
+ return this.apiKey && (t["X-API-Key"] = this.apiKey), t;
64
65
  }
65
- buildBody(o) {
66
+ buildBody(t) {
66
67
  return {
67
68
  conversationId: this.getConversationId(),
68
- message: o.message,
69
- tools: o.tools,
70
- history: o.history?.map((t) => ({
71
- role: t.role,
72
- content: t.content,
73
- toolCall: t.toolCall,
74
- toolResult: t.toolResult
69
+ message: t.message,
70
+ tools: t.tools,
71
+ history: t.history?.map((o) => ({
72
+ role: o.role,
73
+ content: o.content,
74
+ toolCall: o.toolCall,
75
+ toolResult: o.toolResult
75
76
  })),
76
- toolResults: o.toolResults
77
+ toolResults: t.toolResults
77
78
  };
78
79
  }
79
80
  }
80
- function R() {
81
+ function I() {
81
82
  return `msg-${crypto.randomUUID()}`;
82
83
  }
83
- function G(e) {
84
+ function Z(e) {
84
85
  return {
85
- id: R(),
86
+ id: I(),
86
87
  role: "user",
87
88
  content: e,
88
89
  timestamp: Date.now()
89
90
  };
90
91
  }
91
- function E(e) {
92
+ function v(e) {
92
93
  return {
93
- id: R(),
94
+ id: I(),
94
95
  role: "assistant",
95
96
  content: e,
96
97
  timestamp: Date.now()
97
98
  };
98
99
  }
99
- function J(e, o, t) {
100
+ function J(e, t, o) {
100
101
  return {
101
- id: R(),
102
+ id: I(),
102
103
  role: "tool",
103
104
  content: `Executed ${e}`,
104
105
  timestamp: Date.now(),
105
106
  toolCall: {
106
107
  name: e,
107
- arguments: o
108
+ arguments: t
108
109
  },
109
- toolResult: t
110
+ toolResult: o
110
111
  };
111
112
  }
112
- const Y = 3e4, Q = (e, o) => new Error(`Tool "${e}" timed out after ${o}ms`), ee = (e, o, t) => Promise.race([
113
- Promise.resolve(e),
114
- new Promise((n, r) => setTimeout(() => r(Q(t, o)), o))
115
- ]), te = async (e, o, t) => {
116
- const n = o(e.name);
113
+ const G = 3e4, Y = (e, t) => new Error(`Tool "${e}" timed out after ${t}ms`), Q = (e) => new Promise((t, o) => {
114
+ if (e.aborted) {
115
+ o(new DOMException("aborted", "AbortError"));
116
+ return;
117
+ }
118
+ e.addEventListener("abort", () => o(new DOMException("aborted", "AbortError")), {
119
+ once: !0
120
+ });
121
+ }), ee = (e, t, o, n) => {
122
+ const r = [
123
+ Promise.resolve(e),
124
+ new Promise((s, a) => setTimeout(() => a(Y(o, t)), t))
125
+ ];
126
+ return n && r.push(Q(n)), Promise.race(r);
127
+ }, te = async (e, t, o) => {
128
+ const n = t(e.name);
117
129
  if (!n)
118
130
  return { event: e, result: { error: `Tool not found: ${e.name}` } };
119
- t.onToolExecute?.(e.name, e.input);
131
+ o.onToolExecute?.(e.name, e.input);
120
132
  try {
121
133
  const r = await ee(
122
134
  n.handler(e.input),
123
- t.timeoutMs ?? Y,
124
- e.name
135
+ o.timeoutMs ?? G,
136
+ e.name,
137
+ o.signal
125
138
  );
126
- return t.onToolResult?.(e.name, r), { event: e, result: r };
139
+ return o.onToolResult?.(e.name, r), { event: e, result: r };
127
140
  } catch (r) {
128
141
  const s = {
129
142
  error: r instanceof Error ? r.message : "Tool execution failed"
130
143
  };
131
- return t.onToolResult?.(e.name, s), { event: e, result: s };
144
+ return o.onToolResult?.(e.name, s), { event: e, result: s };
132
145
  }
133
- }, $ = 5, _ = "エラーが発生しました。しばらくしてからお試しください。";
134
- function oe(e) {
135
- const [o, t] = b([]), [n, r] = b(!1), [s, d] = b(null), u = O(o);
136
- j(() => {
137
- u.current = o;
138
- }, [o]);
139
- const { client: p, tools: a, toolDefinitions: i, toolTimeout: c, onToolExecute: f, onToolResult: x, onError: h } = e, k = g((m) => a.find((S) => S.name === m), [a]), y = g(
140
- (m) => te(m, k, {
141
- timeoutMs: c,
142
- onToolExecute: f,
143
- onToolResult: x
146
+ }, oe = (e) => {
147
+ const { tools: t, toolTimeout: o, onToolExecute: n, onToolResult: r } = e, s = p((a) => t.find((l) => l.name === a), [t]);
148
+ return p(
149
+ (a, l) => te(a, s, {
150
+ timeoutMs: o,
151
+ onToolExecute: n,
152
+ onToolResult: r,
153
+ signal: l
144
154
  }),
145
- [k, c, f, x]
146
- ), H = g(() => {
147
- t([]), d(null);
148
- }, []), F = g(
149
- async (m) => {
150
- const S = G(m);
151
- t((C) => [...C, S]), r(!0), d(null);
152
- try {
153
- await re({
154
- client: p,
155
- toolDefinitions: i,
156
- initialMessage: m,
157
- initialHistory: [...u.current, S],
158
- setMessages: t,
159
- runTool: y
160
- });
161
- } catch (C) {
162
- d(_), h?.(C instanceof Error ? C : new Error(_)), console.error("Chat error:", C);
163
- } finally {
164
- r(!1);
165
- }
166
- },
167
- [p, i, y, h]
155
+ [s, o, n, r]
168
156
  );
169
- return { messages: o, isLoading: n, error: s, sendMessage: F, clear: H };
170
- }
171
- async function re({
172
- client: e,
173
- toolDefinitions: o,
174
- initialMessage: t,
175
- initialHistory: n,
176
- setMessages: r,
177
- runTool: s
178
- }) {
179
- let d = n, u = t, p;
180
- for (let a = 0; a < $; a++) {
181
- const i = e.chat({
182
- message: u,
183
- tools: o,
184
- history: d,
185
- toolResults: p
186
- }), { toolUses: c, finalized: f } = await ne(i, r, (y) => {
187
- d = [...d, E(y)];
188
- });
189
- if (f || c.length === 0) return;
190
- const x = await Promise.all(c.map(s)), { toolMessages: h, toolResults: k } = se(x);
191
- r((y) => [...y, ...h]), d = [...d, ...h], p = k, u = void 0;
192
- }
193
- throw new Error(`Exceeded ${$} tool-call iterations`);
194
- }
195
- async function ne(e, o, t) {
196
- const n = [];
197
- let r = null, s = "", d = !1;
198
- const u = () => {
199
- if (r) return r;
200
- const a = E("");
201
- return r = a.id, o((i) => [...i, a]), a.id;
202
- }, p = (a, i) => {
203
- o((c) => c.map((f) => f.id === a ? { ...f, content: i } : f));
204
- };
205
- for await (const a of e)
206
- switch (a.type) {
207
- case "tool_use":
208
- n.push(a);
209
- break;
210
- case "text_delta": {
211
- const i = u();
212
- s += a.delta, p(i, s);
213
- break;
214
- }
215
- case "text": {
216
- r ? p(r, a.content) : o((i) => [...i, E(a.content)]), t(a.content), d = !0;
217
- break;
218
- }
219
- case "error":
220
- throw new Error(a.message);
221
- }
222
- return { toolUses: n, finalized: d };
223
- }
224
- function se(e) {
225
- const o = [], t = [];
157
+ }, j = (e, t) => e === t.current, re = (e, t) => {
158
+ e && t(e);
159
+ }, ne = (e) => {
160
+ const t = [], o = [];
226
161
  for (const { event: n, result: r } of e)
227
- o.push(J(n.name, n.input, r)), t.push({
162
+ t.push(J(n.name, n.input, r)), o.push({
228
163
  toolCallId: n.toolCallId,
229
164
  toolName: n.name,
230
165
  toolInput: n.input,
231
166
  result: r
232
167
  });
233
- return { toolMessages: o, toolResults: t };
168
+ return { toolMessages: t, toolResults: o };
169
+ }, se = (e, t) => {
170
+ let o = null;
171
+ const n = () => {
172
+ if (o) return;
173
+ const a = v("");
174
+ o = a.id, t() && e((l) => [...l, a]);
175
+ }, r = (a) => {
176
+ if (!o || !t()) return;
177
+ const l = o;
178
+ e((c) => c.map((u) => u.id === l ? { ...u, content: a } : u));
179
+ };
180
+ return { ensure: n, update: r, appendFinal: (a) => {
181
+ o ? r(a) : t() && e((l) => [...l, v(a)]);
182
+ }, getCurrentId: () => o };
183
+ }, ae = (e, t) => {
184
+ switch (e.type) {
185
+ case "tool_use":
186
+ t.toolUses.push(e);
187
+ return;
188
+ case "text_delta":
189
+ t.placeholder.ensure(), t.state.streamedText += e.delta, t.placeholder.update(t.state.streamedText);
190
+ return;
191
+ case "text":
192
+ t.placeholder.appendFinal(e.content), t.state.finalText = e.content;
193
+ return;
194
+ case "error":
195
+ throw new Error(e.message);
196
+ default:
197
+ return;
198
+ }
199
+ }, le = async (e, t, o, n) => {
200
+ const s = se(t, () => j(o, n)), a = [], l = { streamedText: "", finalText: null };
201
+ for await (const d of e)
202
+ ae(d, { toolUses: a, placeholder: s, state: l });
203
+ const c = s.getCurrentId(), u = c && l.streamedText === "" ? c : null;
204
+ return { toolUses: a, finalText: l.finalText, emptyPlaceholderId: u };
205
+ }, B = 5, $ = (e, t) => e.signal.aborted || !j(e.streamId, e.currentStreamIdRef) ? (re(t, e.removeMessageById), { kind: "interrupted" }) : null, ie = async (e) => {
206
+ if (e.signal.aborted) return { kind: "interrupted" };
207
+ const t = e.client.chat(
208
+ {
209
+ message: e.nextMessage,
210
+ tools: e.toolDefinitions,
211
+ history: e.history,
212
+ toolResults: e.pendingToolResults
213
+ },
214
+ e.signal
215
+ ), { toolUses: o, finalText: n, emptyPlaceholderId: r } = await le(
216
+ t,
217
+ e.setMessages,
218
+ e.streamId,
219
+ e.currentStreamIdRef
220
+ ), s = $(e, r);
221
+ if (s) return s;
222
+ if (n !== null || o.length === 0) return { kind: "done" };
223
+ const a = await Promise.all(o.map((d) => e.runTool(d, e.signal))), l = $(e, r);
224
+ if (l) return l;
225
+ const { toolMessages: c, toolResults: u } = ne(a);
226
+ return e.setMessages((d) => [...d, ...c]), {
227
+ kind: "continue",
228
+ appendedMessages: c,
229
+ toolResults: u,
230
+ assistantText: null
231
+ };
232
+ }, ce = async (e) => {
233
+ let t = e.initialHistory, o = e.initialMessage, n;
234
+ for (let r = 0; r < B; r++) {
235
+ const s = await ie({
236
+ ...e,
237
+ history: t,
238
+ nextMessage: o,
239
+ pendingToolResults: n
240
+ });
241
+ if (s.kind === "done" || s.kind === "interrupted") return;
242
+ s.assistantText && (t = [...t, v(s.assistantText)]), t = [...t, ...s.appendedMessages], n = s.toolResults, o = void 0;
243
+ }
244
+ throw new Error(`Exceeded ${B} tool-call iterations`);
245
+ }, ue = (e) => e instanceof DOMException && e.name === "AbortError", de = (e, t) => ue(e) ? t.aborted ? "user_cancel" : "network_abort" : null, K = (e, t) => {
246
+ console.warn("[wecool-chat] cancelled", { reason: e, detail: t });
247
+ }, fe = "エラーが発生しました。しばらくしてからお試しください。", pe = (e) => {
248
+ const {
249
+ client: t,
250
+ toolDefinitions: o,
251
+ runTool: n,
252
+ lifecycle: r,
253
+ messagesRef: s,
254
+ setMessages: a,
255
+ setError: l,
256
+ removeMessageById: c,
257
+ onError: u,
258
+ genericErrorMessage: d
259
+ } = e, h = d ?? fe;
260
+ return p(
261
+ async (b) => {
262
+ if (r.isLoadingRef.current) return;
263
+ const x = Z(b);
264
+ a((m) => [...m, x]), l(null);
265
+ const { signal: y, streamId: g } = r.begin();
266
+ try {
267
+ await ce({
268
+ client: t,
269
+ toolDefinitions: o,
270
+ initialMessage: b,
271
+ initialHistory: [...s.current, x],
272
+ setMessages: a,
273
+ runTool: n,
274
+ signal: y,
275
+ streamId: g,
276
+ currentStreamIdRef: r.currentStreamIdRef,
277
+ removeMessageById: c
278
+ });
279
+ } catch (m) {
280
+ const f = de(m, y);
281
+ if (f) return K(f, m);
282
+ if (!r.isCurrent(g)) return;
283
+ l(h), u?.(m instanceof Error ? m : new Error(h)), console.error("Chat error:", m);
284
+ } finally {
285
+ r.finalize(g);
286
+ }
287
+ },
288
+ [
289
+ t,
290
+ o,
291
+ n,
292
+ r,
293
+ s,
294
+ a,
295
+ l,
296
+ c,
297
+ u,
298
+ h
299
+ ]
300
+ );
301
+ }, he = (e) => {
302
+ const t = C(null), o = C(!1), n = C(0), r = C(0), s = p(() => {
303
+ t.current?.abort();
304
+ const u = new AbortController();
305
+ t.current = u;
306
+ const d = ++n.current;
307
+ return r.current = d, e(!0), o.current = !0, { signal: u.signal, streamId: d };
308
+ }, [e]), a = p(() => {
309
+ o.current && (t.current?.abort(), r.current = ++n.current, e(!1), o.current = !1);
310
+ }, [e]), l = p(
311
+ (u) => {
312
+ u === r.current && (e(!1), o.current = !1);
313
+ },
314
+ [e]
315
+ ), c = p((u) => u === r.current, []);
316
+ return {
317
+ abortRef: t,
318
+ isLoadingRef: o,
319
+ currentStreamIdRef: r,
320
+ begin: s,
321
+ invalidate: a,
322
+ finalize: l,
323
+ isCurrent: c
324
+ };
325
+ }, ye = (e) => {
326
+ const t = C(e);
327
+ return E(() => {
328
+ t.current = e;
329
+ }, [e]), t;
330
+ };
331
+ function me(e) {
332
+ const [t, o] = w([]), [n, r] = w(!1), [s, a] = w(null), l = ye(t), c = he(r), u = oe({
333
+ tools: e.tools,
334
+ toolTimeout: e.toolTimeout,
335
+ onToolExecute: e.onToolExecute,
336
+ onToolResult: e.onToolResult
337
+ }), d = p((y) => {
338
+ o((g) => g.filter((m) => m.id !== y));
339
+ }, []), h = p(() => {
340
+ c.isLoadingRef.current && (c.invalidate(), K("user_cancel"));
341
+ }, [c]), b = p(() => {
342
+ h(), o([]), a(null);
343
+ }, [h]), x = pe({
344
+ client: e.client,
345
+ toolDefinitions: e.toolDefinitions,
346
+ runTool: u,
347
+ lifecycle: c,
348
+ messagesRef: l,
349
+ setMessages: o,
350
+ setError: a,
351
+ removeMessageById: d,
352
+ onError: e.onError,
353
+ genericErrorMessage: e.messages?.genericError
354
+ });
355
+ return E(() => {
356
+ const y = c.abortRef;
357
+ return () => {
358
+ y.current?.abort();
359
+ };
360
+ }, [c.abortRef]), { messages: t, isLoading: n, error: s, sendMessage: x, cancel: h, clear: b };
234
361
  }
235
- const le = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ae = (e) => e.replace(
362
+ const be = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ge = (e) => e.replace(
236
363
  /^([A-Z])|[\s-_]+(\w)/g,
237
- (o, t, n) => n ? n.toUpperCase() : t.toLowerCase()
238
- ), z = (e) => {
239
- const o = ae(e);
240
- return o.charAt(0).toUpperCase() + o.slice(1);
241
- }, K = (...e) => e.filter((o, t, n) => !!o && o.trim() !== "" && n.indexOf(o) === t).join(" ").trim(), ie = (e) => {
242
- for (const o in e)
243
- if (o.startsWith("aria-") || o === "role" || o === "title")
364
+ (t, o, n) => n ? n.toUpperCase() : o.toLowerCase()
365
+ ), O = (e) => {
366
+ const t = ge(e);
367
+ return t.charAt(0).toUpperCase() + t.slice(1);
368
+ }, F = (...e) => e.filter((t, o, n) => !!t && t.trim() !== "" && n.indexOf(t) === o).join(" ").trim(), xe = (e) => {
369
+ for (const t in e)
370
+ if (t.startsWith("aria-") || t === "role" || t === "title")
244
371
  return !0;
245
372
  };
246
- var ce = {
373
+ var Ce = {
247
374
  xmlns: "http://www.w3.org/2000/svg",
248
375
  width: 24,
249
376
  height: 24,
@@ -254,54 +381,54 @@ var ce = {
254
381
  strokeLinecap: "round",
255
382
  strokeLinejoin: "round"
256
383
  };
257
- const de = P(
384
+ const we = N(
258
385
  ({
259
386
  color: e = "currentColor",
260
- size: o = 24,
261
- strokeWidth: t = 2,
387
+ size: t = 24,
388
+ strokeWidth: o = 2,
262
389
  absoluteStrokeWidth: n,
263
390
  className: r = "",
264
391
  children: s,
265
- iconNode: d,
266
- ...u
267
- }, p) => I(
392
+ iconNode: a,
393
+ ...l
394
+ }, c) => k(
268
395
  "svg",
269
396
  {
270
- ref: p,
271
- ...ce,
272
- width: o,
273
- height: o,
397
+ ref: c,
398
+ ...Ce,
399
+ width: t,
400
+ height: t,
274
401
  stroke: e,
275
- strokeWidth: n ? Number(t) * 24 / Number(o) : t,
276
- className: K("lucide", r),
277
- ...!s && !ie(u) && { "aria-hidden": "true" },
278
- ...u
402
+ strokeWidth: n ? Number(o) * 24 / Number(t) : o,
403
+ className: F("lucide", r),
404
+ ...!s && !xe(l) && { "aria-hidden": "true" },
405
+ ...l
279
406
  },
280
407
  [
281
- ...d.map(([a, i]) => I(a, i)),
408
+ ...a.map(([u, d]) => k(u, d)),
282
409
  ...Array.isArray(s) ? s : [s]
283
410
  ]
284
411
  )
285
412
  );
286
- const T = (e, o) => {
287
- const t = P(
288
- ({ className: n, ...r }, s) => I(de, {
413
+ const S = (e, t) => {
414
+ const o = N(
415
+ ({ className: n, ...r }, s) => k(we, {
289
416
  ref: s,
290
- iconNode: o,
291
- className: K(
292
- `lucide-${le(z(e))}`,
417
+ iconNode: t,
418
+ className: F(
419
+ `lucide-${be(O(e))}`,
293
420
  `lucide-${e}`,
294
421
  n
295
422
  ),
296
423
  ...r
297
424
  })
298
425
  );
299
- return t.displayName = z(e), t;
426
+ return o.displayName = O(e), o;
300
427
  };
301
- const ue = [
428
+ const Te = [
302
429
  ["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
303
- ], pe = T("message-circle", ue);
304
- const fe = [
430
+ ], Se = S("message-circle", Te);
431
+ const Re = [
305
432
  [
306
433
  "path",
307
434
  {
@@ -310,18 +437,21 @@ const fe = [
310
437
  }
311
438
  ],
312
439
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
313
- ], he = T("send", fe);
314
- const xe = [
440
+ ], ke = S("send", Re);
441
+ const ve = [
442
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
443
+ ], Ee = S("square", ve);
444
+ const Ie = [
315
445
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
316
446
  ["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
317
447
  ["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
318
448
  ["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
319
449
  ["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
320
- ], ye = T("trash-2", xe);
321
- const me = [
450
+ ], Me = S("trash-2", Ie);
451
+ const De = [
322
452
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
323
453
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
324
- ], N = T("x", me), B = {
454
+ ], L = S("x", De), z = {
325
455
  display: "flex",
326
456
  alignItems: "center",
327
457
  justifyContent: "flex-end",
@@ -329,7 +459,7 @@ const me = [
329
459
  padding: "0 12px",
330
460
  borderBottom: "1px solid #e4e4e7",
331
461
  backgroundColor: "#ffffff"
332
- }, ge = {
462
+ }, Ae = {
333
463
  display: "flex",
334
464
  alignItems: "center",
335
465
  justifyContent: "center",
@@ -342,31 +472,31 @@ const me = [
342
472
  cursor: "pointer",
343
473
  transition: "all 150ms ease"
344
474
  };
345
- function be({ onClose: e, showClose: o = !1 }) {
346
- return !o || !e ? /* @__PURE__ */ l("div", { style: { ...B, height: "8px", borderBottom: "none" } }) : /* @__PURE__ */ l("div", { style: B, children: /* @__PURE__ */ l(
475
+ function _e({ onClose: e, showClose: t = !1 }) {
476
+ return !t || !e ? /* @__PURE__ */ i("div", { style: { ...z, height: "8px", borderBottom: "none" } }) : /* @__PURE__ */ i("div", { style: z, children: /* @__PURE__ */ i(
347
477
  "button",
348
478
  {
349
479
  onClick: e,
350
- style: ge,
351
- onMouseEnter: (t) => {
352
- t.currentTarget.style.backgroundColor = "#f4f4f5", t.currentTarget.style.color = "#18181b";
480
+ style: Ae,
481
+ onMouseEnter: (o) => {
482
+ o.currentTarget.style.backgroundColor = "#f4f4f5", o.currentTarget.style.color = "#18181b";
353
483
  },
354
- onMouseLeave: (t) => {
355
- t.currentTarget.style.backgroundColor = "transparent", t.currentTarget.style.color = "#71717a";
484
+ onMouseLeave: (o) => {
485
+ o.currentTarget.style.backgroundColor = "transparent", o.currentTarget.style.color = "#71717a";
356
486
  },
357
487
  "aria-label": "Close",
358
- children: /* @__PURE__ */ l(N, { size: 16 })
488
+ children: /* @__PURE__ */ i(L, { size: 16 })
359
489
  }
360
490
  ) });
361
491
  }
362
- const Ce = {
492
+ const Be = {
363
493
  display: "flex",
364
494
  alignItems: "center",
365
495
  gap: "8px",
366
496
  padding: "12px",
367
497
  borderTop: "1px solid #e4e4e7",
368
498
  backgroundColor: "#ffffff"
369
- }, we = {
499
+ }, $e = {
370
500
  flex: 1,
371
501
  height: "40px",
372
502
  padding: "0 14px",
@@ -377,7 +507,7 @@ const Ce = {
377
507
  borderRadius: "8px",
378
508
  outline: "none",
379
509
  transition: "border-color 150ms ease"
380
- }, U = {
510
+ }, M = {
381
511
  display: "flex",
382
512
  alignItems: "center",
383
513
  justifyContent: "center",
@@ -387,86 +517,113 @@ const Ce = {
387
517
  border: "none",
388
518
  cursor: "pointer",
389
519
  transition: "all 150ms ease"
390
- }, ke = {
391
- ...U,
520
+ }, Oe = {
521
+ ...M,
392
522
  backgroundColor: "#18181b",
393
523
  color: "#ffffff"
394
- }, Se = {
395
- ...U,
524
+ }, ze = {
525
+ ...M,
526
+ backgroundColor: "#dc2626",
527
+ color: "#ffffff"
528
+ }, Pe = {
529
+ ...M,
396
530
  backgroundColor: "transparent",
397
531
  color: "#71717a"
532
+ }, Ue = {
533
+ position: "absolute",
534
+ width: "1px",
535
+ height: "1px",
536
+ margin: "-1px",
537
+ padding: 0,
538
+ overflow: "hidden",
539
+ clip: "rect(0, 0, 0, 0)",
540
+ whiteSpace: "nowrap",
541
+ border: 0
398
542
  };
399
- function Te({ onSubmit: e, onClear: o, disabled: t, placeholder: n }) {
400
- const [r, s] = b(""), [d, u] = b(!1), p = g(
401
- (c) => {
402
- c.preventDefault();
403
- const f = r.trim();
404
- f && !t && (e(f), s(""));
543
+ function Ne({
544
+ onSubmit: e,
545
+ onClear: t,
546
+ onCancel: o,
547
+ isLoading: n,
548
+ placeholder: r
549
+ }) {
550
+ const [s, a] = w(""), [l, c] = w(!1), [u, d] = w(""), h = C(null), b = p(
551
+ (f) => {
552
+ const D = f.trim();
553
+ !D || n || (e(D), a(""));
554
+ },
555
+ [n, e]
556
+ ), x = p(
557
+ (f) => {
558
+ f.preventDefault(), b(s);
405
559
  },
406
- [r, t, e]
407
- ), a = g(
408
- (c) => {
409
- if (c.key === "Enter" && !c.shiftKey) {
410
- c.preventDefault();
411
- const f = r.trim();
412
- f && !t && (e(f), s(""));
560
+ [s, b]
561
+ ), y = p(() => {
562
+ o(), d("応答を停止しました"), h.current?.focus();
563
+ }, [o]), g = p(
564
+ (f) => {
565
+ if (!f.nativeEvent.isComposing) {
566
+ if (f.key === "Escape" && n) {
567
+ f.preventDefault(), y();
568
+ return;
569
+ }
570
+ f.key === "Enter" && !f.shiftKey && (f.preventDefault(), b(s));
413
571
  }
414
572
  },
415
- [r, t, e]
416
- ), i = !t && r.trim();
417
- return /* @__PURE__ */ w("form", { onSubmit: p, style: Ce, children: [
418
- /* @__PURE__ */ l(
573
+ [s, n, y, b]
574
+ ), m = !n && s.trim().length > 0;
575
+ return /* @__PURE__ */ T("form", { onSubmit: x, style: Be, children: [
576
+ /* @__PURE__ */ i(
419
577
  "input",
420
578
  {
579
+ ref: h,
421
580
  type: "text",
422
- value: r,
423
- onChange: (c) => s(c.target.value),
424
- onKeyDown: a,
425
- onFocus: () => u(!0),
426
- onBlur: () => u(!1),
427
- placeholder: n || "メッセージを入力...",
428
- disabled: t,
581
+ value: s,
582
+ onChange: (f) => a(f.target.value),
583
+ onKeyDown: g,
584
+ onFocus: () => c(!0),
585
+ onBlur: () => c(!1),
586
+ placeholder: r || "メッセージを入力...",
429
587
  style: {
430
- ...we,
431
- borderColor: d ? "#18181b" : "#e4e4e7",
432
- opacity: t ? 0.5 : 1,
433
- cursor: t ? "not-allowed" : "text"
588
+ ...$e,
589
+ borderColor: l ? "#18181b" : "#e4e4e7"
434
590
  }
435
591
  }
436
592
  ),
437
- /* @__PURE__ */ l(
593
+ n ? /* @__PURE__ */ i("button", { type: "button", onClick: y, style: ze, "aria-label": "Stop", children: /* @__PURE__ */ i(Ee, { size: 18 }) }) : /* @__PURE__ */ i(
438
594
  "button",
439
595
  {
440
596
  type: "submit",
441
- disabled: !i,
597
+ disabled: !m,
442
598
  style: {
443
- ...ke,
444
- opacity: i ? 1 : 0.3,
445
- cursor: i ? "pointer" : "not-allowed"
599
+ ...Oe,
600
+ opacity: m ? 1 : 0.3,
601
+ cursor: m ? "pointer" : "not-allowed"
446
602
  },
447
603
  "aria-label": "Send",
448
- children: /* @__PURE__ */ l(he, { size: 18 })
604
+ children: /* @__PURE__ */ i(ke, { size: 18 })
449
605
  }
450
606
  ),
451
- /* @__PURE__ */ l(
607
+ /* @__PURE__ */ i(
452
608
  "button",
453
609
  {
454
610
  type: "button",
455
- onClick: o,
456
- style: Se,
457
- onMouseEnter: (c) => {
458
- c.currentTarget.style.backgroundColor = "#f4f4f5", c.currentTarget.style.color = "#18181b";
611
+ onClick: t,
612
+ style: Pe,
613
+ onMouseEnter: (f) => {
614
+ f.currentTarget.style.backgroundColor = "#f4f4f5", f.currentTarget.style.color = "#18181b";
459
615
  },
460
- onMouseLeave: (c) => {
461
- c.currentTarget.style.backgroundColor = "transparent", c.currentTarget.style.color = "#71717a";
616
+ onMouseLeave: (f) => {
617
+ f.currentTarget.style.backgroundColor = "transparent", f.currentTarget.style.color = "#71717a";
462
618
  },
463
619
  "aria-label": "Clear",
464
- children: /* @__PURE__ */ l(ye, { size: 18 })
620
+ children: /* @__PURE__ */ i(Me, { size: 18 })
465
621
  }
466
- )
622
+ ),
623
+ /* @__PURE__ */ i("div", { role: "status", "aria-live": "polite", style: Ue, children: u })
467
624
  ] });
468
625
  }
469
- const ve = {
626
+ const je = {
470
627
  flex: 1,
471
628
  overflowY: "auto",
472
629
  padding: "16px",
@@ -474,18 +631,18 @@ const ve = {
474
631
  flexDirection: "column",
475
632
  gap: "12px",
476
633
  backgroundColor: "#ffffff"
477
- }, Ie = {
634
+ }, Ke = {
478
635
  flex: 1,
479
636
  display: "flex",
480
637
  alignItems: "center",
481
638
  justifyContent: "center",
482
639
  color: "#a1a1aa",
483
640
  fontSize: "14px"
484
- }, A = {
641
+ }, P = {
485
642
  display: "flex",
486
643
  flexDirection: "column",
487
644
  maxWidth: "85%"
488
- }, Ee = {
645
+ }, Fe = {
489
646
  padding: "10px 14px",
490
647
  fontSize: "14px",
491
648
  lineHeight: "1.5",
@@ -493,7 +650,7 @@ const ve = {
493
650
  backgroundColor: "#18181b",
494
651
  color: "#fafafa",
495
652
  borderRadius: "16px 16px 4px 16px"
496
- }, Re = {
653
+ }, Le = {
497
654
  padding: "10px 14px",
498
655
  fontSize: "14px",
499
656
  lineHeight: "1.5",
@@ -501,56 +658,56 @@ const ve = {
501
658
  backgroundColor: "#f4f4f5",
502
659
  color: "#18181b",
503
660
  borderRadius: "16px 16px 16px 4px"
504
- }, Me = {
661
+ }, He = {
505
662
  display: "flex",
506
663
  alignItems: "center",
507
664
  gap: "6px",
508
665
  padding: "10px 14px",
509
666
  backgroundColor: "#f4f4f5",
510
667
  borderRadius: "16px 16px 16px 4px"
511
- }, v = {
668
+ }, R = {
512
669
  width: "6px",
513
670
  height: "6px",
514
671
  backgroundColor: "#71717a",
515
672
  borderRadius: "50%",
516
673
  animation: "bounce 1.4s infinite ease-in-out"
517
674
  };
518
- function De({ messages: e, isLoading: o }) {
519
- const t = O(null);
520
- j(() => {
521
- t.current?.scrollIntoView({ behavior: "smooth" });
522
- }, [e, o]);
675
+ function We({ messages: e, isLoading: t }) {
676
+ const o = C(null);
677
+ E(() => {
678
+ o.current?.scrollIntoView({ behavior: "smooth" });
679
+ }, [e, t]);
523
680
  const n = e.filter(
524
681
  (r) => r.role === "user" || r.role === "assistant"
525
682
  );
526
- return /* @__PURE__ */ w("div", { style: ve, children: [
527
- /* @__PURE__ */ l("style", { children: `
683
+ return /* @__PURE__ */ T("div", { style: je, children: [
684
+ /* @__PURE__ */ i("style", { children: `
528
685
  @keyframes bounce {
529
686
  0%, 80%, 100% { transform: scale(0); }
530
687
  40% { transform: scale(1); }
531
688
  }
532
689
  ` }),
533
- n.length === 0 && !o && /* @__PURE__ */ l("div", { style: Ie, children: "メッセージを入力してください" }),
534
- n.map((r) => /* @__PURE__ */ l(
690
+ n.length === 0 && !t && /* @__PURE__ */ i("div", { style: Ke, children: "メッセージを入力してください" }),
691
+ n.map((r) => /* @__PURE__ */ i(
535
692
  "div",
536
693
  {
537
694
  style: {
538
- ...A,
695
+ ...P,
539
696
  alignSelf: r.role === "user" ? "flex-end" : "flex-start"
540
697
  },
541
- children: /* @__PURE__ */ l("div", { style: r.role === "user" ? Ee : Re, children: r.content })
698
+ children: /* @__PURE__ */ i("div", { style: r.role === "user" ? Fe : Le, children: r.content })
542
699
  },
543
700
  r.id
544
701
  )),
545
- o && /* @__PURE__ */ l("div", { style: { ...A, alignSelf: "flex-start" }, children: /* @__PURE__ */ w("div", { style: Me, children: [
546
- /* @__PURE__ */ l("span", { style: { ...v, animationDelay: "-0.32s" } }),
547
- /* @__PURE__ */ l("span", { style: { ...v, animationDelay: "-0.16s" } }),
548
- /* @__PURE__ */ l("span", { style: v })
702
+ t && /* @__PURE__ */ i("div", { style: { ...P, alignSelf: "flex-start" }, children: /* @__PURE__ */ T("div", { style: He, children: [
703
+ /* @__PURE__ */ i("span", { style: { ...R, animationDelay: "-0.32s" } }),
704
+ /* @__PURE__ */ i("span", { style: { ...R, animationDelay: "-0.16s" } }),
705
+ /* @__PURE__ */ i("span", { style: R })
549
706
  ] }) }),
550
- /* @__PURE__ */ l("div", { ref: t })
707
+ /* @__PURE__ */ i("div", { ref: o })
551
708
  ] });
552
709
  }
553
- const $e = {
710
+ const qe = {
554
711
  display: "flex",
555
712
  flexDirection: "column",
556
713
  height: "100%",
@@ -558,7 +715,7 @@ const $e = {
558
715
  border: "1px solid #e4e4e7",
559
716
  borderRadius: "12px",
560
717
  overflow: "hidden"
561
- }, _e = {
718
+ }, Ve = {
562
719
  margin: "0 12px 8px 12px",
563
720
  padding: "10px 12px",
564
721
  backgroundColor: "#fef2f2",
@@ -566,32 +723,34 @@ const $e = {
566
723
  borderRadius: "8px",
567
724
  fontSize: "13px"
568
725
  };
569
- function L({
726
+ function U({
570
727
  messages: e,
571
- isLoading: o,
572
- error: t,
728
+ isLoading: t,
729
+ error: o,
573
730
  onSendMessage: n,
574
- onClear: r,
575
- onClose: s,
576
- showClose: d = !1,
577
- placeholder: u
731
+ onCancel: r,
732
+ onClear: s,
733
+ onClose: a,
734
+ showClose: l = !1,
735
+ placeholder: c
578
736
  }) {
579
- return /* @__PURE__ */ w("div", { style: $e, children: [
580
- /* @__PURE__ */ l(be, { onClose: s, showClose: d }),
581
- /* @__PURE__ */ l(De, { messages: e, isLoading: o }),
582
- t && /* @__PURE__ */ l("div", { style: _e, children: t }),
583
- /* @__PURE__ */ l(
584
- Te,
737
+ return /* @__PURE__ */ T("div", { style: qe, children: [
738
+ /* @__PURE__ */ i(_e, { onClose: a, showClose: l }),
739
+ /* @__PURE__ */ i(We, { messages: e, isLoading: t }),
740
+ o && /* @__PURE__ */ i("div", { style: Ve, children: o }),
741
+ /* @__PURE__ */ i(
742
+ Ne,
585
743
  {
586
744
  onSubmit: n,
587
- onClear: r,
588
- disabled: o,
589
- placeholder: u
745
+ onClear: s,
746
+ onCancel: r,
747
+ isLoading: t,
748
+ placeholder: c
590
749
  }
591
750
  )
592
751
  ] });
593
752
  }
594
- const ze = {
753
+ const Xe = {
595
754
  display: "flex",
596
755
  alignItems: "center",
597
756
  justifyContent: "center",
@@ -605,124 +764,126 @@ const ze = {
605
764
  boxShadow: "0 4px 16px rgba(0, 0, 0, 0.16)",
606
765
  transition: "transform 150ms ease, box-shadow 150ms ease"
607
766
  };
608
- function Be({ isOpen: e, onClick: o }) {
609
- return /* @__PURE__ */ l(
767
+ function Ze({ isOpen: e, onClick: t }) {
768
+ return /* @__PURE__ */ i(
610
769
  "button",
611
770
  {
612
- onClick: o,
613
- style: ze,
614
- onMouseEnter: (t) => {
615
- t.currentTarget.style.transform = "scale(1.05)", t.currentTarget.style.boxShadow = "0 6px 20px rgba(0, 0, 0, 0.2)";
771
+ onClick: t,
772
+ style: Xe,
773
+ onMouseEnter: (o) => {
774
+ o.currentTarget.style.transform = "scale(1.05)", o.currentTarget.style.boxShadow = "0 6px 20px rgba(0, 0, 0, 0.2)";
616
775
  },
617
- onMouseLeave: (t) => {
618
- t.currentTarget.style.transform = "scale(1)", t.currentTarget.style.boxShadow = "0 4px 16px rgba(0, 0, 0, 0.16)";
776
+ onMouseLeave: (o) => {
777
+ o.currentTarget.style.transform = "scale(1)", o.currentTarget.style.boxShadow = "0 4px 16px rgba(0, 0, 0, 0.16)";
619
778
  },
620
779
  "aria-label": e ? "Close chat" : "Open chat",
621
- children: e ? /* @__PURE__ */ l(N, { size: 22 }) : /* @__PURE__ */ l(pe, { size: 22 })
780
+ children: e ? /* @__PURE__ */ i(L, { size: 22 }) : /* @__PURE__ */ i(Se, { size: 22 })
622
781
  }
623
782
  );
624
783
  }
625
- const Ae = (e) => ({
784
+ const Je = (e) => ({
626
785
  name: e.name,
627
786
  description: e.description,
628
787
  parameters: e.parameters
629
- }), Le = {
788
+ }), Ge = {
630
789
  "bottom-right": { position: "fixed", bottom: "24px", right: "24px", zIndex: 9999 },
631
790
  "bottom-left": { position: "fixed", bottom: "24px", left: "24px", zIndex: 9999 },
632
791
  "top-right": { position: "fixed", top: "24px", right: "24px", zIndex: 9999 },
633
792
  "top-left": { position: "fixed", top: "24px", left: "24px", zIndex: 9999 }
634
- }, Oe = {
793
+ }, Ye = {
635
794
  "bottom-right": { position: "absolute", bottom: "64px", right: "0" },
636
795
  "bottom-left": { position: "absolute", bottom: "64px", left: "0" },
637
796
  "top-right": { position: "absolute", top: "64px", right: "0" },
638
797
  "top-left": { position: "absolute", top: "64px", left: "0" }
639
- }, je = {
798
+ }, Qe = {
640
799
  width: "380px",
641
800
  height: "520px",
642
801
  boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12)",
643
802
  borderRadius: "12px",
644
803
  overflow: "hidden"
645
804
  };
646
- function W({
805
+ function H({
647
806
  config: e,
648
- tools: o,
649
- floating: t = !1,
807
+ tools: t,
808
+ floating: o = !1,
650
809
  defaultOpen: n = !1,
651
810
  position: r = "bottom-right"
652
811
  }) {
653
- const [s, d] = b(n), u = o || e.tools || [], p = M(
654
- () => new q(e.endpoint, e.apiKey),
812
+ const [s, a] = w(n), l = t || e.tools || [], c = A(
813
+ () => new X(e.endpoint, e.apiKey),
655
814
  [e.endpoint, e.apiKey]
656
- ), a = M(() => u.map(Ae), [u]), { messages: i, isLoading: c, error: f, sendMessage: x, clear: h } = oe({
657
- client: p,
658
- tools: u,
659
- toolDefinitions: a,
815
+ ), u = A(() => l.map(Je), [l]), { messages: d, isLoading: h, error: b, sendMessage: x, cancel: y, clear: g } = me({
816
+ client: c,
817
+ tools: l,
818
+ toolDefinitions: u,
660
819
  toolTimeout: e.toolTimeout,
661
820
  onToolExecute: e.onToolExecute,
662
821
  onToolResult: e.onToolResult,
663
822
  onError: e.onError
664
823
  });
665
- return t ? /* @__PURE__ */ w("div", { style: Le[r], children: [
666
- s && /* @__PURE__ */ l("div", { style: { ...Oe[r], ...je }, children: /* @__PURE__ */ l(
667
- L,
824
+ return o ? /* @__PURE__ */ T("div", { style: Ge[r], children: [
825
+ s && /* @__PURE__ */ i("div", { style: { ...Ye[r], ...Qe }, children: /* @__PURE__ */ i(
826
+ U,
668
827
  {
669
- messages: i,
670
- isLoading: c,
671
- error: f,
828
+ messages: d,
829
+ isLoading: h,
830
+ error: b,
672
831
  onSendMessage: x,
673
- onClear: h,
674
- onClose: () => d(!1),
832
+ onCancel: y,
833
+ onClear: g,
834
+ onClose: () => a(!1),
675
835
  showClose: !0,
676
836
  placeholder: e.placeholder
677
837
  }
678
838
  ) }),
679
- /* @__PURE__ */ l(Be, { isOpen: s, onClick: () => d(!s) })
680
- ] }) : /* @__PURE__ */ l("div", { style: { height: "100%" }, children: /* @__PURE__ */ l(
681
- L,
839
+ /* @__PURE__ */ i(Ze, { isOpen: s, onClick: () => a(!s) })
840
+ ] }) : /* @__PURE__ */ i("div", { style: { height: "100%" }, children: /* @__PURE__ */ i(
841
+ U,
682
842
  {
683
- messages: i,
684
- isLoading: c,
685
- error: f,
843
+ messages: d,
844
+ isLoading: h,
845
+ error: b,
686
846
  onSendMessage: x,
687
- onClear: h,
847
+ onCancel: y,
848
+ onClear: g,
688
849
  placeholder: e.placeholder
689
850
  }
690
851
  ) });
691
852
  }
692
- function Pe(e, o) {
853
+ function et(e, t) {
693
854
  if (typeof document > "u")
694
855
  throw new Error("initWecoolChat requires a browser environment");
695
- let t;
696
- if (typeof o == "string") {
697
- const s = document.querySelector(o);
856
+ let o;
857
+ if (typeof t == "string") {
858
+ const s = document.querySelector(t);
698
859
  if (!s)
699
- throw new Error(`Container element not found: ${o}`);
700
- t = s;
701
- } else o ? t = o : (t = document.createElement("div"), t.id = "wecool-chat-root", document.body.appendChild(t));
702
- const n = X(t), r = {
860
+ throw new Error(`Container element not found: ${t}`);
861
+ o = s;
862
+ } else t ? o = t : (o = document.createElement("div"), o.id = "wecool-chat-root", document.body.appendChild(o));
863
+ const n = q(o), r = {
703
864
  config: e,
704
865
  tools: e.tools,
705
- floating: !o,
866
+ floating: !t,
706
867
  defaultOpen: !1,
707
868
  position: "bottom-right"
708
869
  };
709
- return n.render(V.createElement(W, r)), () => {
710
- n.unmount(), !o && t.parentNode && t.parentNode.removeChild(t);
870
+ return n.render(W.createElement(H, r)), () => {
871
+ n.unmount(), !t && o.parentNode && o.parentNode.removeChild(o);
711
872
  };
712
873
  }
713
- const We = { initWecoolChat: Pe, ChatWidget: W };
874
+ const nt = { initWecoolChat: et, ChatWidget: H };
714
875
  export {
715
- q as ChatClient,
716
- Te as ChatFooter,
717
- be as ChatHeader,
718
- L as ChatPanel,
719
- W as ChatWidget,
720
- Be as FloatButton,
721
- De as MessageList,
722
- E as createAssistantMessage,
723
- R as createMessageId,
876
+ X as ChatClient,
877
+ Ne as ChatFooter,
878
+ _e as ChatHeader,
879
+ U as ChatPanel,
880
+ H as ChatWidget,
881
+ Ze as FloatButton,
882
+ We as MessageList,
883
+ v as createAssistantMessage,
884
+ I as createMessageId,
724
885
  J as createToolMessage,
725
- G as createUserMessage,
726
- We as default,
727
- Pe as initWecoolChat
886
+ Z as createUserMessage,
887
+ nt as default,
888
+ et as initWecoolChat
728
889
  };