langgraph-vue3-chatbot 0.1.19 → 0.1.21

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-lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { inject as Pe, computed as z, defineComponent as S, openBlock as o, createElementBlock as x, createElementVNode as k, toDisplayString as H, createBlock as $, unref as n, createVNode as I, createCommentVNode as F, ref as M, Fragment as le, renderList as pe, withDirectives as we, normalizeClass as G, resolveDynamicComponent as ge, vShow as Be, mergeProps as oe, withCtx as C, renderSlot as D, createTextVNode as Oe, provide as je, watch as Te, onMounted as Ze, onBeforeUnmount as Qe, Transition as et, nextTick as ft, isRef as gt, vModelText as vt, normalizeProps as xe, guardReactiveProps as ke, useModel as ht, mergeModels as Ne, createStaticVNode as yt, useSlots as _t, normalizeStyle as tt } from "vue";
1
+ import { inject as Pe, computed as z, defineComponent as S, openBlock as n, createElementBlock as x, createElementVNode as k, toDisplayString as H, createBlock as $, unref as a, createVNode as I, createCommentVNode as F, ref as M, Fragment as le, renderList as pe, withDirectives as we, normalizeClass as G, resolveDynamicComponent as ge, vShow as Be, mergeProps as oe, withCtx as C, renderSlot as D, createTextVNode as Oe, provide as je, watch as Te, onMounted as Ze, onBeforeUnmount as Qe, Transition as et, nextTick as ft, isRef as gt, vModelText as vt, normalizeProps as xe, guardReactiveProps as ke, useModel as ht, mergeModels as Ne, createStaticVNode as yt, useSlots as _t, normalizeStyle as tt } from "vue";
2
2
  import { Client as bt } from "@langchain/langgraph-sdk";
3
- import { Minimize2Icon as xt, Maximize2Icon as kt, XIcon as st, ChevronDownIcon as nt, PlayCircle as Ke, XCircle as wt, CheckCircle as $t, Loader as Ct, BookOpenCheck as It, ListTodoIcon as zt, ZapIcon as St, FileSearch as At, FolderSearch as Mt, SquarePen as Tt, FileEditIcon as Bt, EyeIcon as Pt, FolderSearchIcon as Ot, FileTextIcon as at, GlobeIcon as ot, BrainIcon as jt, WrenchIcon as Et, ArrowDownIcon as Dt, PaperclipIcon as rt, Music2Icon as Lt, VideoIcon as Rt, ImageIcon as Ut, Loader2Icon as Wt, CornerDownLeftIcon as Ft, CheckIcon as Vt, ArrowUpRight as Nt, ChevronsDown as Kt, ChevronsUp as Ht, Circle as Gt, LoaderCircle as qt, Ban as Jt, CircleCheckBig as Xt, BotMessageSquare as Yt, X as Zt } from "lucide-vue-next";
3
+ import { Minimize2Icon as xt, Maximize2Icon as kt, XIcon as st, ChevronDownIcon as at, PlayCircle as Ke, XCircle as wt, CheckCircle as $t, Loader as Ct, BookOpenCheck as It, ListTodoIcon as zt, ZapIcon as St, FileSearch as At, FolderSearch as Mt, SquarePen as Tt, FileEditIcon as Bt, EyeIcon as Pt, FolderSearchIcon as Ot, FileTextIcon as nt, GlobeIcon as ot, BrainIcon as jt, WrenchIcon as Et, ArrowDownIcon as Dt, PaperclipIcon as rt, Music2Icon as Lt, VideoIcon as Rt, ImageIcon as Ut, Loader2Icon as Wt, CornerDownLeftIcon as Ft, CheckIcon as Vt, ArrowUpRight as Nt, ChevronsDown as Kt, ChevronsUp as Ht, Circle as Gt, LoaderCircle as qt, Ban as Jt, CircleCheckBig as Xt, BotMessageSquare as Yt, X as Zt } from "lucide-vue-next";
4
4
  import { clsx as Qt } from "clsx";
5
5
  import { twMerge as es } from "tailwind-merge";
6
6
  import { reactiveOmit as Re, useVModel as ts } from "@vueuse/core";
7
- import { StickToBottom as ss, useStickToBottomContext as ns } from "vue-stick-to-bottom";
7
+ import { StickToBottom as ss, useStickToBottomContext as as } from "vue-stick-to-bottom";
8
8
  import { cva as Ue } from "class-variance-authority";
9
- import { Primitive as as, useForwardPropsEmits as it, DropdownMenuRoot as os, DropdownMenuPortal as rs, DropdownMenuContent as is, useForwardProps as lt, DropdownMenuItem as ls, DropdownMenuTrigger as us } from "reka-ui";
9
+ import { Primitive as ns, useForwardPropsEmits as it, DropdownMenuRoot as os, DropdownMenuPortal as rs, DropdownMenuContent as is, useForwardProps as lt, DropdownMenuItem as ls, DropdownMenuTrigger as us } from "reka-ui";
10
10
  import cs from "markstream-vue";
11
11
  import { nanoid as He } from "nanoid";
12
12
  import { motion as Ge } from "motion-v";
@@ -33,24 +33,24 @@ async function ms(s, t, e) {
33
33
  user_id: e || "user001"
34
34
  }
35
35
  })).thread_id || t || "";
36
- } catch (a) {
37
- return console.error("Failed to create thread:", a), t || "";
36
+ } catch (o) {
37
+ return console.error("Failed to create thread:", o), t || "";
38
38
  }
39
39
  }
40
- async function fs(s, t, e, a) {
40
+ async function fs(s, t, e, o) {
41
41
  var i;
42
42
  if (!t) return [];
43
43
  try {
44
- const m = (await s.threads.getState(t)).values;
45
- if (!(m != null && m.messages) || !Array.isArray(m.messages))
44
+ const l = (await s.threads.getState(t)).values;
45
+ if (!(l != null && l.messages) || !Array.isArray(l.messages))
46
46
  return [];
47
- const l = [], v = m.messages;
47
+ const r = [], v = l.messages;
48
48
  let T = 0;
49
49
  for (; T < v.length; ) {
50
50
  const B = v[T], q = B.type, J = B.content;
51
51
  if (q === "human" || q === "user") {
52
52
  const re = typeof J == "string" ? J : Array.isArray(J) ? J.filter((U) => U.type === "text").map((U) => U.text).join("") : "";
53
- l.push({
53
+ r.push({
54
54
  key: B.id || `human-${Date.now()}-${Math.random()}`,
55
55
  type: "human",
56
56
  content: re
@@ -65,7 +65,7 @@ async function fs(s, t, e, a) {
65
65
  state: "completed",
66
66
  result: ""
67
67
  }))) || [];
68
- if (l.push({
68
+ if (r.push({
69
69
  key: B.id || `ai-${Date.now()}-${Math.random()}`,
70
70
  type: "ai",
71
71
  content: re,
@@ -75,7 +75,7 @@ async function fs(s, t, e, a) {
75
75
  for (; X < v.length; ) {
76
76
  const V = v[X];
77
77
  if (V.type === "tool") {
78
- const Z = typeof V.content == "string" ? V.content : JSON.stringify(V.content), ee = V.tool_call_id, E = V.status, c = ((y) => {
78
+ const Z = typeof V.content == "string" ? V.content : JSON.stringify(V.content), ee = V.tool_call_id, E = V.status, d = ((y) => {
79
79
  switch (y) {
80
80
  case "success":
81
81
  return "completed";
@@ -86,9 +86,9 @@ async function fs(s, t, e, a) {
86
86
  }
87
87
  })(E), g = U.find((y) => y.id === ee);
88
88
  if (g) {
89
- g.result = Z, g.state = c;
89
+ g.result = Z, g.state = d;
90
90
  const y = `tool-${ee}-${Date.now()}`;
91
- l.push({
91
+ r.push({
92
92
  key: y,
93
93
  type: "tool",
94
94
  content: Z,
@@ -97,7 +97,7 @@ async function fs(s, t, e, a) {
97
97
  name: g.name,
98
98
  args: g.args,
99
99
  result: Z,
100
- state: c,
100
+ state: d,
101
101
  error: E === "error" ? Z : void 0
102
102
  }]
103
103
  });
@@ -112,25 +112,25 @@ async function fs(s, t, e, a) {
112
112
  }
113
113
  T++;
114
114
  }
115
- const w = m.generated_files;
115
+ const w = l.generated_files;
116
116
  if (w && Array.isArray(w) && w.length > 0) {
117
117
  const B = {
118
118
  type: "generated_files",
119
119
  content: w
120
120
  };
121
- l.push({
121
+ r.push({
122
122
  key: `custom-generated_files-${Date.now()}-${Math.random()}`,
123
123
  type: "custom",
124
124
  content: "",
125
125
  customContent: B
126
126
  });
127
127
  }
128
- const A = m.suggested_questions;
128
+ const A = l.suggested_questions;
129
129
  A && Array.isArray(A) && A.length > 0 && e && e(A);
130
- const f = m.todos;
131
- return a && Array.isArray(f) && f.length > 0 && a(f), l;
132
- } catch (r) {
133
- return console.error("Failed to load thread history:", r), [];
130
+ const f = l.todos;
131
+ return o && Array.isArray(f) && f.length > 0 && o(f), r;
132
+ } catch (c) {
133
+ return console.error("Failed to load thread history:", c), [];
134
134
  }
135
135
  }
136
136
  const ut = Symbol("AiBotPortalHost");
@@ -152,43 +152,43 @@ const vs = { class: "chat-header" }, hs = { class: "chat-title" }, ys = { class:
152
152
  },
153
153
  emits: ["close", "toggleMaximize"],
154
154
  setup(s, { emit: t }) {
155
- const e = s, a = t;
156
- return (i, r) => (o(), x("div", vs, [
155
+ const e = s, o = t;
156
+ return (i, c) => (n(), x("div", vs, [
157
157
  k("div", hs, [
158
158
  k("span", ys, H(s.title), 1)
159
159
  ]),
160
- e.showHeaderActions ? (o(), x("div", _s, [
160
+ e.showHeaderActions ? (n(), x("div", _s, [
161
161
  k("button", {
162
162
  class: "action-btn",
163
- onClick: r[0] || (r[0] = (m) => a("toggleMaximize")),
163
+ onClick: c[0] || (c[0] = (l) => o("toggleMaximize")),
164
164
  type: "button",
165
165
  title: s.isMaximized ? "还原" : "最大化"
166
166
  }, [
167
- s.isMaximized ? (o(), $(n(xt), {
167
+ s.isMaximized ? (n(), $(a(xt), {
168
168
  key: 0,
169
169
  class: "size-4"
170
- })) : (o(), $(n(kt), {
170
+ })) : (n(), $(a(kt), {
171
171
  key: 1,
172
172
  class: "size-4"
173
173
  }))
174
174
  ], 8, bs),
175
175
  k("button", {
176
176
  class: "action-btn",
177
- onClick: r[1] || (r[1] = (m) => a("close")),
177
+ onClick: c[1] || (c[1] = (l) => o("close")),
178
178
  type: "button",
179
179
  title: "关闭"
180
180
  }, [
181
- I(n(st), { class: "size-4" })
181
+ I(a(st), { class: "size-4" })
182
182
  ])
183
183
  ])) : F("", !0)
184
184
  ]));
185
185
  }
186
- }), ce = (s, t) => {
186
+ }), ue = (s, t) => {
187
187
  const e = s.__vccOpts || s;
188
- for (const [a, i] of t)
189
- e[a] = i;
188
+ for (const [o, i] of t)
189
+ e[o] = i;
190
190
  return e;
191
- }, ks = /* @__PURE__ */ ce(xs, [["__scopeId", "data-v-f35439d8"]]);
191
+ }, ks = /* @__PURE__ */ ue(xs, [["__scopeId", "data-v-f35439d8"]]);
192
192
  function R(...s) {
193
193
  return es(Qt(s));
194
194
  }
@@ -224,10 +224,10 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
224
224
  execute: "执行命令",
225
225
  write_todos: "待办事项",
226
226
  task: "子任务"
227
- }, a = {
227
+ }, o = {
228
228
  think_tool: jt,
229
229
  fetch_markdown: ot,
230
- convert_to_markdown: at,
230
+ convert_to_markdown: nt,
231
231
  ls: Ot,
232
232
  read_file: Pt,
233
233
  write_file: Bt,
@@ -237,11 +237,11 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
237
237
  execute: St,
238
238
  write_todos: zt,
239
239
  task: It
240
- }, i = (w) => e[w] || w, r = (w) => a[w] || Et, m = (w) => w === "write_todos" || w.includes("todo"), l = (w) => w ? w.length > 50 ? w.slice(0, 100) + "..." : w : "", v = M({}), T = (w) => {
240
+ }, i = (w) => e[w] || w, c = (w) => o[w] || Et, l = (w) => w === "write_todos" || w.includes("todo"), r = (w) => w ? w.length > 50 ? w.slice(0, 100) + "..." : w : "", v = M({}), T = (w) => {
241
241
  v.value[w] = !v.value[w];
242
242
  };
243
- return (w, A) => (o(), x("div", ws, [
244
- (o(!0), x(le, null, pe(s.toolCalls, (f) => we((o(), x("div", {
243
+ return (w, A) => (n(), x("div", ws, [
244
+ (n(!0), x(le, null, pe(s.toolCalls, (f) => we((n(), x("div", {
245
245
  key: f.id,
246
246
  class: "overflow-hidden"
247
247
  }, [
@@ -249,14 +249,14 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
249
249
  class: "flex items-center gap-2 w-full text-left hover:bg-muted/50 rounded px-2 py-1.5 transition-colors cursor-pointer",
250
250
  onClick: (B) => T(f.id)
251
251
  }, [
252
- I(n(nt), {
252
+ I(a(at), {
253
253
  class: G(["h-4 w-4 shrink-0", v.value[f.id] ? "" : "-rotate-90"])
254
254
  }, null, 8, ["class"]),
255
- (o(), $(ge(r(f.name)), { class: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })),
255
+ (n(), $(ge(c(f.name)), { class: "h-3.5 w-3.5 shrink-0 text-muted-foreground" })),
256
256
  k("span", Cs, H(i(f.name)), 1),
257
- k("span", Is, H(l(f.args)), 1),
258
- (o(), $(ge(t(f.state).icon), {
259
- class: G(n(R)("h-3 w-3 shrink-0 ml-auto", t(f.state).color))
257
+ k("span", Is, H(r(f.args)), 1),
258
+ (n(), $(ge(t(f.state).icon), {
259
+ class: G(a(R)("h-3 w-3 shrink-0 ml-auto", t(f.state).color))
260
260
  }, null, 8, ["class"]))
261
261
  ], 8, $s),
262
262
  we(k("div", zs, [
@@ -264,11 +264,11 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
264
264
  A[0] || (A[0] = k("p", { class: "text-muted-foreground mb-1" }, "请求:", -1)),
265
265
  k("pre", Ss, H(f.args), 1)
266
266
  ]),
267
- f.result || f.error ? (o(), x("div", As, [
267
+ f.result || f.error ? (n(), x("div", As, [
268
268
  k("p", Ms, H(f.state === "error" ? "Error:" : "结果:"), 1),
269
269
  k("pre", {
270
270
  class: G(
271
- n(R)(
271
+ a(R)(
272
272
  "bg-muted p-2 rounded text-[10px] overflow-x-auto max-w-full",
273
273
  f.state === "error" && "text-red-500"
274
274
  )
@@ -279,7 +279,7 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
279
279
  [Be, v.value[f.id]]
280
280
  ])
281
281
  ])), [
282
- [Be, !m(f.name)]
282
+ [Be, !l(f.name)]
283
283
  ])), 128))
284
284
  ]));
285
285
  }
@@ -297,17 +297,17 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
297
297
  },
298
298
  setup(s) {
299
299
  const t = s, e = Re(t, "class");
300
- return (a, i) => (o(), $(n(ss), oe(n(e), {
301
- class: n(R)("relative flex-1 overflow-y-hidden", t.class),
300
+ return (o, i) => (n(), $(a(ss), oe(a(e), {
301
+ class: a(R)("relative flex-1 overflow-y-hidden", t.class),
302
302
  role: "log"
303
303
  }), {
304
304
  default: C(() => [
305
- D(a.$slots, "default")
305
+ D(o.$slots, "default", {}, void 0, !0)
306
306
  ]),
307
307
  _: 3
308
308
  }, 16, ["class"]));
309
309
  }
310
- }), Ps = /* @__PURE__ */ S({
310
+ }), Ps = /* @__PURE__ */ ue(Bs, [["__scopeId", "data-v-3b638d4b"]]), Os = /* @__PURE__ */ S({
311
311
  __name: "ConversationContent",
312
312
  props: {
313
313
  class: { type: [Boolean, null, String, Object, Array] }
@@ -319,10 +319,10 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
319
319
  // 无边框
320
320
  t.class
321
321
  ));
322
- return (a, i) => (o(), x("div", {
322
+ return (o, i) => (n(), x("div", {
323
323
  class: G(e.value)
324
324
  }, [
325
- D(a.$slots, "default")
325
+ D(o.$slots, "default")
326
326
  ], 2));
327
327
  }
328
328
  }), Ee = /* @__PURE__ */ S({
@@ -336,13 +336,13 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
336
336
  },
337
337
  setup(s) {
338
338
  const t = s;
339
- return (e, a) => (o(), $(n(as), {
339
+ return (e, o) => (n(), $(a(ns), {
340
340
  "data-slot": "button",
341
341
  "data-variant": s.variant,
342
342
  "data-size": s.size,
343
343
  as: s.as,
344
344
  "as-child": s.asChild,
345
- class: G(n(R)(n(Os)({ variant: s.variant, size: s.size }), t.class))
345
+ class: G(a(R)(a(js)({ variant: s.variant, size: s.size }), t.class))
346
346
  }, {
347
347
  default: C(() => [
348
348
  D(e.$slots, "default")
@@ -350,7 +350,7 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
350
350
  _: 3
351
351
  }, 8, ["data-variant", "data-size", "as", "as-child", "class"]));
352
352
  }
353
- }), Os = Ue(
353
+ }), js = Ue(
354
354
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
355
355
  {
356
356
  variants: {
@@ -378,19 +378,19 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
378
378
  size: "default"
379
379
  }
380
380
  }
381
- ), js = /* @__PURE__ */ S({
381
+ ), Es = /* @__PURE__ */ S({
382
382
  __name: "ConversationScrollButton",
383
383
  props: {
384
384
  class: { type: [Boolean, null, String, Object, Array] }
385
385
  },
386
386
  setup(s) {
387
- const t = s, { isAtBottom: e, scrollToBottom: a } = ns(), i = z(() => !e.value);
388
- function r() {
389
- a();
387
+ const t = s, { isAtBottom: e, scrollToBottom: o } = as(), i = z(() => !e.value);
388
+ function c() {
389
+ o();
390
390
  }
391
- return (m, l) => i.value ? (o(), $(n(Ee), oe({
391
+ return (l, r) => i.value ? (n(), $(a(Ee), oe({
392
392
  key: 0,
393
- class: n(R)(
393
+ class: a(R)(
394
394
  "absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full cursor-pointer dark:bg-background dark:hover:bg-muted",
395
395
  t.class
396
396
  ),
@@ -398,9 +398,9 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
398
398
  size: "icon",
399
399
  type: "button",
400
400
  variant: "outline"
401
- }, m.$attrs, { onClick: r }), {
401
+ }, l.$attrs, { onClick: c }), {
402
402
  default: C(() => [
403
- I(n(Dt), { class: "size-4" })
403
+ I(a(Dt), { class: "size-4" })
404
404
  ]),
405
405
  _: 1
406
406
  }, 16, ["class"])) : F("", !0);
@@ -413,8 +413,8 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
413
413
  },
414
414
  setup(s) {
415
415
  const t = s;
416
- return (e, a) => (o(), x("div", oe({
417
- class: n(R)(
416
+ return (e, o) => (n(), x("div", oe({
417
+ class: a(R)(
418
418
  "group flex w-full max-w-[80%]",
419
419
  t.from === "user" ? "is-user ml-auto" : "is-assistant mr-auto",
420
420
  t.class
@@ -430,8 +430,8 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
430
430
  },
431
431
  setup(s) {
432
432
  const t = s;
433
- return (e, a) => (o(), x("div", oe({
434
- class: n(R)(
433
+ return (e, o) => (n(), x("div", oe({
434
+ class: a(R)(
435
435
  "is-user:dark flex w-fit flex-col overflow-hidden text-sm",
436
436
  "group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-[var(--ai-user-bubble-bg)] group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-[var(--ai-user-bubble-text)]",
437
437
  "group-[.is-assistant]:bg-transparent group-[.is-assistant]:p-0 group-[.is-assistant]:text-foreground",
@@ -441,43 +441,48 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
441
441
  D(e.$slots, "default")
442
442
  ], 16));
443
443
  }
444
- }), Es = /* @__PURE__ */ S({
444
+ }), Ds = /* @__PURE__ */ S({
445
445
  __name: "ChatMessages",
446
446
  props: {
447
447
  messages: {},
448
- isStreaming: { type: Boolean, default: !1 }
448
+ isStreaming: { type: Boolean, default: !1 },
449
+ theme: { default: "light" }
449
450
  },
450
451
  setup(s) {
451
- const t = s;
452
- function e(a) {
453
- return a === 0 ? "" : t.messages[a].type === "human" ? "my-4" : "";
452
+ const t = s, e = ["vitesse-dark", "vitesse-light"];
453
+ function o(i) {
454
+ return i === 0 ? "" : t.messages[i].type === "human" ? "my-4" : "";
454
455
  }
455
- return (a, i) => (o(), $(n(Bs), null, {
456
+ return (i, c) => (n(), $(a(Ps), null, {
456
457
  default: C(() => [
457
- I(n(Ps), null, {
458
+ I(a(Os), null, {
458
459
  default: C(() => [
459
- (o(!0), x(le, null, pe(s.messages, (r, m) => (o(), $(n(Je), {
460
- key: r.key,
461
- from: r.type === "tool" || r.type === "system" || r.type === "custom" ? "assistant" : r.type === "human" ? "user" : "assistant",
462
- class: G(e(m))
460
+ (n(!0), x(le, null, pe(s.messages, (l, r) => (n(), $(a(Je), {
461
+ key: l.key,
462
+ from: l.type === "tool" || l.type === "system" || l.type === "custom" ? "assistant" : l.type === "human" ? "user" : "assistant",
463
+ class: G(o(r))
463
464
  }, {
464
465
  default: C(() => [
465
- r.type === "tool" ? (o(), $(Ts, {
466
+ l.type === "tool" ? (n(), $(Ts, {
466
467
  key: 0,
467
- "tool-calls": r.toolCalls
468
- }, null, 8, ["tool-calls"])) : r.type === "custom" ? (o(), $(n(Xe), { key: 1 }, {
468
+ "tool-calls": l.toolCalls
469
+ }, null, 8, ["tool-calls"])) : l.type === "custom" ? (n(), $(a(Xe), { key: 1 }, {
469
470
  default: C(() => [
470
- D(a.$slots, "custom", {
471
- customContent: r.customContent
471
+ D(i.$slots, "custom", {
472
+ customContent: l.customContent
472
473
  }, void 0, !0)
473
474
  ]),
474
475
  _: 2
475
- }, 1024)) : (o(), $(n(Xe), { key: 2 }, {
476
+ }, 1024)) : (n(), $(a(Xe), { key: 2 }, {
476
477
  default: C(() => [
477
- r.type === "ai" || r.type === "system" ? (o(), $(n(cs), {
478
+ l.type === "ai" || l.type === "system" ? (n(), $(a(cs), {
478
479
  key: 0,
479
480
  class: "markdown-body",
480
- content: r.content || "",
481
+ content: l.content || "",
482
+ "is-dark": t.theme === "dark",
483
+ "code-block-dark-theme": "vitesse-dark",
484
+ "code-block-light-theme": "vitesse-light",
485
+ themes: e,
481
486
  typewriter: !0,
482
487
  "initial-render-batch-size": 12,
483
488
  "render-batch-size": 24,
@@ -485,8 +490,8 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
485
490
  "max-live-nodes": 0,
486
491
  "defer-nodes-until-visible": !0,
487
492
  "viewport-priority": !0
488
- }, null, 8, ["content"])) : (o(), x(le, { key: 1 }, [
489
- Oe(H(r.content), 1)
493
+ }, null, 8, ["content", "is-dark"])) : (n(), x(le, { key: 1 }, [
494
+ Oe(H(l.content), 1)
490
495
  ], 64))
491
496
  ]),
492
497
  _: 2
@@ -494,11 +499,11 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
494
499
  ]),
495
500
  _: 2
496
501
  }, 1032, ["from", "class"]))), 128)),
497
- s.isStreaming ? (o(), $(n(Je), {
502
+ s.isStreaming ? (n(), $(a(Je), {
498
503
  key: 0,
499
504
  from: "assistant"
500
505
  }, {
501
- default: C(() => [...i[0] || (i[0] = [
506
+ default: C(() => [...c[0] || (c[0] = [
502
507
  k("div", { class: "loading-indicator" }, [
503
508
  k("span", { class: "dot" }),
504
509
  k("span", { class: "dot" }),
@@ -510,20 +515,20 @@ const ws = { class: "mb-3 text-xs max-w-full" }, $s = ["onClick"], Cs = { class:
510
515
  ]),
511
516
  _: 3
512
517
  }),
513
- I(n(js))
518
+ I(a(Es))
514
519
  ]),
515
520
  _: 3
516
521
  }));
517
522
  }
518
- }), Ds = /* @__PURE__ */ ce(Es, [["__scopeId", "data-v-338205e3"]]), ct = Symbol("PromptInputContext");
519
- function Ls() {
523
+ }), Ls = /* @__PURE__ */ ue(Ds, [["__scopeId", "data-v-5b2cc192"]]), ct = Symbol("PromptInputContext");
524
+ function Rs() {
520
525
  const s = Pe(ct);
521
526
  if (!s)
522
527
  throw new Error("usePromptInput must be used within a PromptInput component");
523
528
  return s;
524
529
  }
525
530
  const dt = Symbol("Attachments");
526
- function Rs() {
531
+ function Us() {
527
532
  const s = Pe(dt);
528
533
  return s || {
529
534
  variant: z(() => "grid")
@@ -542,13 +547,13 @@ function mt(s) {
542
547
  const t = s.mediaType ?? "";
543
548
  return t.startsWith("image/") ? "image" : t.startsWith("video/") ? "video" : t.startsWith("audio/") ? "audio" : t.startsWith("application/") || t.startsWith("text/") ? "document" : "unknown";
544
549
  }
545
- function Us(s) {
550
+ function Ws(s) {
546
551
  if (s.type === "source-document")
547
552
  return s.title || s.filename || "Source";
548
553
  const t = mt(s);
549
554
  return s.filename || (t === "image" ? "Image" : "Attachment");
550
555
  }
551
- const Ws = /* @__PURE__ */ S({
556
+ const Fs = /* @__PURE__ */ S({
552
557
  __name: "Attachment",
553
558
  props: {
554
559
  data: {},
@@ -556,26 +561,26 @@ const Ws = /* @__PURE__ */ S({
556
561
  },
557
562
  emits: ["remove"],
558
563
  setup(s, { emit: t }) {
559
- const e = s, a = t, { variant: i } = Rs(), r = z(() => e.data), m = z(() => mt(e.data));
560
- function l() {
561
- a("remove");
564
+ const e = s, o = t, { variant: i } = Us(), c = z(() => e.data), l = z(() => mt(e.data));
565
+ function r() {
566
+ o("remove");
562
567
  }
563
568
  return je(pt, {
564
- data: r,
565
- mediaCategory: m,
566
- remove: l,
569
+ data: c,
570
+ mediaCategory: l,
571
+ remove: r,
567
572
  variant: i
568
- }), (v, T) => (o(), x("div", oe({
569
- class: n(R)(
573
+ }), (v, T) => (n(), x("div", oe({
574
+ class: a(R)(
570
575
  "group relative",
571
- n(i) === "grid" && "size-24 overflow-hidden rounded-lg",
572
- n(i) === "inline" && [
576
+ a(i) === "grid" && "size-24 overflow-hidden rounded-lg",
577
+ a(i) === "inline" && [
573
578
  "flex h-8 cursor-pointer select-none items-center gap-1",
574
579
  "rounded-md border border-border px-1",
575
580
  "font-medium text-sm transition-all",
576
581
  "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
577
582
  ],
578
- n(i) === "list" && [
583
+ a(i) === "list" && [
579
584
  "flex w-full items-center gap-3 rounded-lg border p-3",
580
585
  "hover:bg-accent/50"
581
586
  ],
@@ -585,116 +590,116 @@ const Ws = /* @__PURE__ */ S({
585
590
  D(v.$slots, "default")
586
591
  ], 16));
587
592
  }
588
- }), Fs = { class: "block truncate" }, Vs = {
593
+ }), Vs = { class: "block truncate" }, Ns = {
589
594
  key: 0,
590
595
  class: "block truncate text-muted-foreground text-xs"
591
- }, Ns = /* @__PURE__ */ S({
596
+ }, Ks = /* @__PURE__ */ S({
592
597
  __name: "AttachmentInfo",
593
598
  props: {
594
599
  showMediaType: { type: Boolean, default: !1 },
595
600
  class: { type: [Boolean, null, String, Object, Array] }
596
601
  },
597
602
  setup(s) {
598
- const t = s, { data: e, variant: a } = We(), i = z(() => Us(e.value));
599
- return (r, m) => n(a) !== "grid" ? (o(), x("div", oe({
603
+ const t = s, { data: e, variant: o } = We(), i = z(() => Ws(e.value));
604
+ return (c, l) => a(o) !== "grid" ? (n(), x("div", oe({
600
605
  key: 0,
601
- class: n(R)("min-w-0 flex-1", t.class)
602
- }, r.$attrs), [
603
- k("span", Fs, H(i.value), 1),
604
- t.showMediaType && n(e).mediaType ? (o(), x("span", Vs, H(n(e).mediaType), 1)) : F("", !0)
606
+ class: a(R)("min-w-0 flex-1", t.class)
607
+ }, c.$attrs), [
608
+ k("span", Vs, H(i.value), 1),
609
+ t.showMediaType && a(e).mediaType ? (n(), x("span", Ns, H(a(e).mediaType), 1)) : F("", !0)
605
610
  ], 16)) : F("", !0);
606
611
  }
607
- }), Ks = ["alt", "height", "src", "width"], Hs = ["src"], Gs = /* @__PURE__ */ S({
612
+ }), Hs = ["alt", "height", "src", "width"], Gs = ["src"], qs = /* @__PURE__ */ S({
608
613
  __name: "AttachmentPreview",
609
614
  props: {
610
615
  fallbackIcon: {},
611
616
  class: { type: [Boolean, null, String, Object, Array] }
612
617
  },
613
618
  setup(s) {
614
- const t = s, { data: e, mediaCategory: a, variant: i } = We(), r = z(() => i.value === "grid"), m = z(() => i.value === "inline" ? "size-3" : "size-4"), l = z(() => e.value.type === "file" ? e.value.url : void 0), v = z(
615
- () => a.value === "image" && e.value.type === "file" && !!l.value
619
+ const t = s, { data: e, mediaCategory: o, variant: i } = We(), c = z(() => i.value === "grid"), l = z(() => i.value === "inline" ? "size-3" : "size-4"), r = z(() => e.value.type === "file" ? e.value.url : void 0), v = z(
620
+ () => o.value === "image" && e.value.type === "file" && !!r.value
616
621
  ), T = z(
617
- () => a.value === "video" && e.value.type === "file" && !!l.value
622
+ () => o.value === "video" && e.value.type === "file" && !!r.value
618
623
  ), w = {
619
624
  image: Ut,
620
625
  video: Rt,
621
626
  audio: Lt,
622
627
  source: ot,
623
- document: at,
628
+ document: nt,
624
629
  unknown: rt
625
- }, A = z(() => w[a.value]), f = z(
630
+ }, A = z(() => w[o.value]), f = z(
626
631
  () => (e.value.type === "file" ? e.value.filename : void 0) || "Image"
627
632
  );
628
- return (B, q) => (o(), x("div", oe({
629
- class: n(R)(
633
+ return (B, q) => (n(), x("div", oe({
634
+ class: a(R)(
630
635
  "flex shrink-0 items-center justify-center overflow-hidden",
631
- n(i) === "grid" && "size-full bg-muted",
632
- n(i) === "inline" && "size-5 rounded bg-background",
633
- n(i) === "list" && "size-12 rounded bg-muted",
636
+ a(i) === "grid" && "size-full bg-muted",
637
+ a(i) === "inline" && "size-5 rounded bg-background",
638
+ a(i) === "list" && "size-12 rounded bg-muted",
634
639
  t.class
635
640
  )
636
641
  }, B.$attrs), [
637
- v.value ? (o(), x("img", {
642
+ v.value ? (n(), x("img", {
638
643
  key: 0,
639
644
  alt: f.value,
640
- class: G(r.value ? "size-full object-cover" : "size-full rounded object-cover"),
641
- height: r.value ? 96 : 20,
642
- src: l.value,
643
- width: r.value ? 96 : 20
644
- }, null, 10, Ks)) : T.value ? (o(), x("video", {
645
+ class: G(c.value ? "size-full object-cover" : "size-full rounded object-cover"),
646
+ height: c.value ? 96 : 20,
647
+ src: r.value,
648
+ width: c.value ? 96 : 20
649
+ }, null, 10, Hs)) : T.value ? (n(), x("video", {
645
650
  key: 1,
646
651
  class: "size-full object-cover",
647
652
  muted: "",
648
- src: l.value
649
- }, null, 8, Hs)) : t.fallbackIcon ? (o(), $(ge(t.fallbackIcon), { key: 2 })) : (o(), $(ge(A.value), {
653
+ src: r.value
654
+ }, null, 8, Gs)) : t.fallbackIcon ? (n(), $(ge(t.fallbackIcon), { key: 2 })) : (n(), $(ge(A.value), {
650
655
  key: 3,
651
- class: G(n(R)(m.value, "text-muted-foreground"))
656
+ class: G(a(R)(l.value, "text-muted-foreground"))
652
657
  }, null, 8, ["class"]))
653
658
  ], 16));
654
659
  }
655
- }), qs = { class: "sr-only" }, Js = /* @__PURE__ */ S({
660
+ }), Js = { class: "sr-only" }, Xs = /* @__PURE__ */ S({
656
661
  __name: "AttachmentRemove",
657
662
  props: {
658
663
  label: { default: "Remove" },
659
664
  class: { type: [Boolean, null, String, Object, Array] }
660
665
  },
661
666
  setup(s) {
662
- const t = s, { remove: e, variant: a } = We(), { variant: i, ...r } = t;
663
- function m(l) {
664
- l.stopPropagation(), e == null || e();
667
+ const t = s, { remove: e, variant: o } = We(), { variant: i, ...c } = t;
668
+ function l(r) {
669
+ r.stopPropagation(), e == null || e();
665
670
  }
666
- return (l, v) => n(e) ? (o(), $(n(Ee), oe({
671
+ return (r, v) => a(e) ? (n(), $(a(Ee), oe({
667
672
  key: 0,
668
673
  "aria-label": t.label,
669
- class: n(R)(
670
- n(a) === "grid" && [
674
+ class: a(R)(
675
+ a(o) === "grid" && [
671
676
  "absolute top-2 right-2 size-6 rounded-full p-0",
672
677
  "bg-background/80 backdrop-blur-sm",
673
678
  "opacity-0 transition-opacity group-hover:opacity-100",
674
679
  "hover:bg-background",
675
680
  "[&>svg]:size-3"
676
681
  ],
677
- n(a) === "inline" && [
682
+ a(o) === "inline" && [
678
683
  "size-5 rounded-sm p-0 cursor-pointer min-w-0",
679
684
  "opacity-0 transition-opacity group-hover:opacity-100",
680
685
  "[&>svg]:size-2.5"
681
686
  ],
682
- n(a) === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"],
687
+ a(o) === "list" && ["size-8 shrink-0 rounded p-0", "[&>svg]:size-4"],
683
688
  t.class
684
689
  ),
685
690
  type: "button",
686
691
  variant: "ghost"
687
- }, r, { onClick: m }), {
692
+ }, c, { onClick: l }), {
688
693
  default: C(() => [
689
- D(l.$slots, "default", {}, () => [
690
- I(n(st))
694
+ D(r.$slots, "default", {}, () => [
695
+ I(a(st))
691
696
  ]),
692
- k("span", qs, H(t.label), 1)
697
+ k("span", Js, H(t.label), 1)
693
698
  ]),
694
699
  _: 3
695
700
  }, 16, ["aria-label", "class"])) : F("", !0);
696
701
  }
697
- }), Xs = /* @__PURE__ */ S({
702
+ }), Ys = /* @__PURE__ */ S({
698
703
  __name: "Attachments",
699
704
  props: {
700
705
  variant: { default: "grid" },
@@ -702,43 +707,43 @@ const Ws = /* @__PURE__ */ S({
702
707
  },
703
708
  setup(s) {
704
709
  const t = s, e = z(() => t.variant);
705
- return je(dt, { variant: e }), (a, i) => (o(), x("div", oe({
706
- class: n(R)(
710
+ return je(dt, { variant: e }), (o, i) => (n(), x("div", oe({
711
+ class: a(R)(
707
712
  "flex items-start",
708
713
  e.value === "list" ? "flex-col gap-2" : "flex-wrap gap-2",
709
714
  e.value === "grid" && "ml-auto w-fit",
710
715
  t.class
711
716
  )
712
- }, a.$attrs), [
713
- D(a.$slots, "default")
717
+ }, o.$attrs), [
718
+ D(o.$slots, "default")
714
719
  ], 16));
715
720
  }
716
- }), Ys = /* @__PURE__ */ S({
721
+ }), Zs = /* @__PURE__ */ S({
717
722
  __name: "InputAttachmentsDisplay",
718
723
  setup(s) {
719
- const { files: t, removeFile: e } = Ls();
720
- function a(i) {
724
+ const { files: t, removeFile: e } = Rs();
725
+ function o(i) {
721
726
  return i;
722
727
  }
723
- return (i, r) => n(t).length > 0 ? (o(), $(n(Xs), {
728
+ return (i, c) => a(t).length > 0 ? (n(), $(a(Ys), {
724
729
  key: 0,
725
730
  variant: "inline",
726
731
  class: "attachments-inline"
727
732
  }, {
728
733
  default: C(() => [
729
- (o(!0), x(le, null, pe(n(t), (m) => (o(), $(n(Ws), {
730
- key: m.id,
731
- data: m,
732
- title: m.filename,
733
- onRemove: (l) => n(e)(m.id)
734
+ (n(!0), x(le, null, pe(a(t), (l) => (n(), $(a(Fs), {
735
+ key: l.id,
736
+ data: l,
737
+ title: l.filename,
738
+ onRemove: (r) => a(e)(l.id)
734
739
  }, {
735
740
  default: C(() => [
736
- I(n(Gs)),
737
- I(n(Ns), {
741
+ I(a(qs)),
742
+ I(a(Ks), {
738
743
  class: "attachment-info",
739
- title: m.filename
744
+ title: l.filename
740
745
  }, null, 8, ["title"]),
741
- I(n(Js))
746
+ I(a(Xs))
742
747
  ]),
743
748
  _: 2
744
749
  }, 1032, ["data", "title", "onRemove"]))), 128))
@@ -746,7 +751,7 @@ const Ws = /* @__PURE__ */ S({
746
751
  _: 1
747
752
  })) : F("", !0);
748
753
  }
749
- }), Zs = /* @__PURE__ */ ce(Ys, [["__scopeId", "data-v-26befc49"]]), Ye = /* @__PURE__ */ S({
754
+ }), Qs = /* @__PURE__ */ ue(Zs, [["__scopeId", "data-v-26befc49"]]), Ye = /* @__PURE__ */ S({
750
755
  __name: "Suggestion",
751
756
  props: {
752
757
  suggestion: {},
@@ -756,50 +761,50 @@ const Ws = /* @__PURE__ */ S({
756
761
  },
757
762
  emits: ["click"],
758
763
  setup(s, { emit: t }) {
759
- const e = s, a = t;
764
+ const e = s, o = t;
760
765
  function i() {
761
- a("click", e.suggestion);
766
+ o("click", e.suggestion);
762
767
  }
763
- return (r, m) => (o(), $(n(Ee), oe({
764
- class: n(R)("cursor-pointer rounded-full px-4", e.class),
768
+ return (c, l) => (n(), $(a(Ee), oe({
769
+ class: a(R)("cursor-pointer rounded-full px-4", e.class),
765
770
  size: e.size,
766
771
  type: "button",
767
772
  variant: e.variant
768
- }, r.$attrs, { onClick: i }), {
773
+ }, c.$attrs, { onClick: i }), {
769
774
  default: C(() => [
770
- D(r.$slots, "default", {}, () => [
775
+ D(c.$slots, "default", {}, () => [
771
776
  Oe(H(e.suggestion), 1)
772
777
  ])
773
778
  ]),
774
779
  _: 3
775
780
  }, 16, ["class", "size", "variant"]));
776
781
  }
777
- }), Qs = {
782
+ }), ea = {
778
783
  class: "suggestions-measurements",
779
784
  "aria-hidden": "true"
780
- }, en = 3200, tn = 5, sn = /* @__PURE__ */ S({
785
+ }, ta = 3200, sa = 5, aa = /* @__PURE__ */ S({
781
786
  __name: "ChatSuggestions",
782
787
  props: {
783
788
  suggestions: {}
784
789
  },
785
790
  emits: ["select"],
786
791
  setup(s, { emit: t }) {
787
- const e = s, a = t, i = M(null), r = M([]), m = M([]), l = M(0), v = M(!1);
792
+ const e = s, o = t, i = M(null), c = M([]), l = M([]), r = M(0), v = M(!1);
788
793
  let T = null, w = null;
789
- const A = z(() => m.value.length > 1), f = z(() => {
790
- const Z = m.value[l.value];
794
+ const A = z(() => l.value.length > 1), f = z(() => {
795
+ const Z = l.value[r.value];
791
796
  return Z ? e.suggestions.slice(Z.start, Z.end) : e.suggestions;
792
797
  });
793
798
  function B(Z, ee) {
794
- r.value[ee] = Z;
799
+ c.value[ee] = Z;
795
800
  }
796
801
  function q() {
797
802
  T && (clearInterval(T), T = null);
798
803
  }
799
804
  function J() {
800
805
  q(), !(!A.value || v.value) && (T = setInterval(() => {
801
- l.value = (l.value + 1) % m.value.length;
802
- }, en));
806
+ r.value = (r.value + 1) % l.value.length;
807
+ }, ta));
803
808
  }
804
809
  function re() {
805
810
  v.value = !0, q();
@@ -809,28 +814,28 @@ const Ws = /* @__PURE__ */ S({
809
814
  }
810
815
  function X() {
811
816
  var g;
812
- const Z = ((g = i.value) == null ? void 0 : g.clientWidth) ?? 0, ee = e.suggestions.map((y, ne) => {
817
+ const Z = ((g = i.value) == null ? void 0 : g.clientWidth) ?? 0, ee = e.suggestions.map((y, ae) => {
813
818
  var b;
814
- return ((b = r.value[ne]) == null ? void 0 : b.offsetWidth) ?? 0;
819
+ return ((b = c.value[ae]) == null ? void 0 : b.offsetWidth) ?? 0;
815
820
  });
816
821
  if (!e.suggestions.length) {
817
- m.value = [], l.value = 0, q();
822
+ l.value = [], r.value = 0, q();
818
823
  return;
819
824
  }
820
825
  if (!Z || ee.some((y) => y === 0)) {
821
- m.value = [{ start: 0, end: e.suggestions.length }], l.value = 0, q();
826
+ l.value = [{ start: 0, end: e.suggestions.length }], r.value = 0, q();
822
827
  return;
823
828
  }
824
829
  const E = [];
825
- let te = 0, c = 0;
826
- e.suggestions.forEach((y, ne) => {
827
- const b = ee[ne], O = te === ne ? b : c + tn + b;
828
- if (te !== ne && O > Z) {
829
- E.push({ start: te, end: ne }), te = ne, c = b;
830
+ let te = 0, d = 0;
831
+ e.suggestions.forEach((y, ae) => {
832
+ const b = ee[ae], O = te === ae ? b : d + sa + b;
833
+ if (te !== ae && O > Z) {
834
+ E.push({ start: te, end: ae }), te = ae, d = b;
830
835
  return;
831
836
  }
832
- c = O;
833
- }), E.push({ start: te, end: e.suggestions.length }), m.value = E, l.value = Math.min(l.value, Math.max(E.length - 1, 0)), J();
837
+ d = O;
838
+ }), E.push({ start: te, end: e.suggestions.length }), l.value = E, r.value = Math.min(r.value, Math.max(E.length - 1, 0)), J();
834
839
  }
835
840
  async function V() {
836
841
  await ft(), X();
@@ -838,16 +843,16 @@ const Ws = /* @__PURE__ */ S({
838
843
  return Te(
839
844
  () => e.suggestions,
840
845
  async () => {
841
- r.value = [], l.value = 0, q(), await V();
846
+ c.value = [], r.value = 0, q(), await V();
842
847
  },
843
848
  { immediate: !0 }
844
849
  ), Ze(() => {
845
850
  w = new ResizeObserver(() => {
846
- l.value = 0, V();
851
+ r.value = 0, V();
847
852
  }), i.value && w.observe(i.value);
848
853
  }), Qe(() => {
849
854
  q(), w == null || w.disconnect();
850
- }), (Z, ee) => (o(), x("div", {
855
+ }), (Z, ee) => (n(), x("div", {
851
856
  class: "suggestions-wrapper",
852
857
  onMouseenter: re,
853
858
  onMouseleave: U
@@ -862,26 +867,26 @@ const Ws = /* @__PURE__ */ S({
862
867
  mode: "out-in"
863
868
  }, {
864
869
  default: C(() => [
865
- (o(), x("div", {
866
- key: l.value,
870
+ (n(), x("div", {
871
+ key: r.value,
867
872
  class: "suggestions-row"
868
873
  }, [
869
- (o(!0), x(le, null, pe(f.value, (E) => (o(), $(n(Ye), {
874
+ (n(!0), x(le, null, pe(f.value, (E) => (n(), $(a(Ye), {
870
875
  key: E,
871
876
  suggestion: E,
872
877
  class: "suggestion-chip",
873
- onClick: (te) => a("select", E)
878
+ onClick: (te) => o("select", E)
874
879
  }, null, 8, ["suggestion", "onClick"]))), 128))
875
880
  ]))
876
881
  ]),
877
882
  _: 1
878
883
  })
879
884
  ], 2),
880
- k("div", Qs, [
881
- (o(!0), x(le, null, pe(s.suggestions, (E, te) => (o(), $(n(Ye), {
885
+ k("div", ea, [
886
+ (n(!0), x(le, null, pe(s.suggestions, (E, te) => (n(), $(a(Ye), {
882
887
  key: `measure-${E}-${te}`,
883
888
  ref_for: !0,
884
- ref: (c) => B((c == null ? void 0 : c.$el) || c, te),
889
+ ref: (d) => B((d == null ? void 0 : d.$el) || d, te),
885
890
  suggestion: E,
886
891
  class: "suggestion-chip",
887
892
  tabindex: "-1"
@@ -889,17 +894,17 @@ const Ws = /* @__PURE__ */ S({
889
894
  ])
890
895
  ], 32));
891
896
  }
892
- }), nn = /* @__PURE__ */ ce(sn, [["__scopeId", "data-v-7c935d5c"]]), an = /* @__PURE__ */ S({
897
+ }), na = /* @__PURE__ */ ue(aa, [["__scopeId", "data-v-7c935d5c"]]), oa = /* @__PURE__ */ S({
893
898
  __name: "InputGroup",
894
899
  props: {
895
900
  class: { type: [Boolean, null, String, Object, Array] }
896
901
  },
897
902
  setup(s) {
898
903
  const t = s;
899
- return (e, a) => (o(), x("div", {
904
+ return (e, o) => (n(), x("div", {
900
905
  "data-slot": "input-group",
901
906
  role: "group",
902
- class: G(n(R)(
907
+ class: G(a(R)(
903
908
  "group/input-group relative flex w-full items-center rounded-md border border-[var(--ai-input-border)] bg-[var(--ai-input-bg)] shadow-xs transition-[color,box-shadow,border-color] outline-none",
904
909
  "h-9 min-w-0 has-[>textarea]:h-auto",
905
910
  // Variants based on alignment.
@@ -917,7 +922,7 @@ const Ws = /* @__PURE__ */ S({
917
922
  D(e.$slots, "default")
918
923
  ], 2));
919
924
  }
920
- }), on = ["data-align"], rn = /* @__PURE__ */ S({
925
+ }), ra = ["data-align"], ia = /* @__PURE__ */ S({
921
926
  __name: "InputGroupAddon",
922
927
  props: {
923
928
  align: { default: "inline-start" },
@@ -925,20 +930,20 @@ const Ws = /* @__PURE__ */ S({
925
930
  },
926
931
  setup(s) {
927
932
  const t = s;
928
- function e(a) {
929
- var m, l;
930
- const i = a.currentTarget, r = a.target;
931
- r && r.closest("button") || i && (i != null && i.parentElement) && ((l = (m = i.parentElement) == null ? void 0 : m.querySelector("input")) == null || l.focus());
933
+ function e(o) {
934
+ var l, r;
935
+ const i = o.currentTarget, c = o.target;
936
+ c && c.closest("button") || i && (i != null && i.parentElement) && ((r = (l = i.parentElement) == null ? void 0 : l.querySelector("input")) == null || r.focus());
932
937
  }
933
- return (a, i) => (o(), x("div", {
938
+ return (o, i) => (n(), x("div", {
934
939
  role: "group",
935
940
  "data-slot": "input-group-addon",
936
941
  "data-align": t.align,
937
- class: G(n(R)(n(cn)({ align: t.align }), t.class)),
942
+ class: G(a(R)(a(ca)({ align: t.align }), t.class)),
938
943
  onClick: e
939
944
  }, [
940
- D(a.$slots, "default")
941
- ], 10, on));
945
+ D(o.$slots, "default")
946
+ ], 10, ra));
942
947
  }
943
948
  }), Le = /* @__PURE__ */ S({
944
949
  __name: "InputGroupButton",
@@ -949,10 +954,10 @@ const Ws = /* @__PURE__ */ S({
949
954
  },
950
955
  setup(s) {
951
956
  const t = s;
952
- return (e, a) => (o(), $(n(Ee), {
957
+ return (e, o) => (n(), $(a(Ee), {
953
958
  "data-size": t.size,
954
959
  variant: t.variant,
955
- class: G(n(R)(n(dn)({ size: t.size }), t.class))
960
+ class: G(a(R)(a(da)({ size: t.size }), t.class))
956
961
  }, {
957
962
  default: C(() => [
958
963
  D(e.$slots, "default")
@@ -960,7 +965,7 @@ const Ws = /* @__PURE__ */ S({
960
965
  _: 3
961
966
  }, 8, ["data-size", "variant", "class"]));
962
967
  }
963
- }), ln = /* @__PURE__ */ S({
968
+ }), la = /* @__PURE__ */ S({
964
969
  __name: "Textarea",
965
970
  props: {
966
971
  class: { type: [Boolean, null, String, Object, Array] },
@@ -973,30 +978,30 @@ const Ws = /* @__PURE__ */ S({
973
978
  passive: !0,
974
979
  defaultValue: e.defaultValue
975
980
  });
976
- return (r, m) => we((o(), x("textarea", {
977
- "onUpdate:modelValue": m[0] || (m[0] = (l) => gt(i) ? i.value = l : null),
981
+ return (c, l) => we((n(), x("textarea", {
982
+ "onUpdate:modelValue": l[0] || (l[0] = (r) => gt(i) ? i.value = r : null),
978
983
  "data-slot": "textarea",
979
- class: G(n(R)("border-input text-[var(--ai-input-text)] placeholder:text-[var(--ai-input-placeholder)] focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", e.class))
984
+ class: G(a(R)("border-input text-[var(--ai-input-text)] placeholder:text-[var(--ai-input-placeholder)] focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", e.class))
980
985
  }, null, 2)), [
981
- [vt, n(i)]
986
+ [vt, a(i)]
982
987
  ]);
983
988
  }
984
- }), un = /* @__PURE__ */ S({
989
+ }), ua = /* @__PURE__ */ S({
985
990
  __name: "InputGroupTextarea",
986
991
  props: {
987
992
  class: { type: [Boolean, null, String, Object, Array] }
988
993
  },
989
994
  setup(s) {
990
995
  const t = s;
991
- return (e, a) => (o(), $(n(ln), {
996
+ return (e, o) => (n(), $(a(la), {
992
997
  "data-slot": "input-group-control",
993
- class: G(n(R)(
998
+ class: G(a(R)(
994
999
  "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
995
1000
  t.class
996
1001
  ))
997
1002
  }, null, 8, ["class"]));
998
1003
  }
999
- }), cn = Ue(
1004
+ }), ca = Ue(
1000
1005
  "text-[var(--ai-control-muted)] flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
1001
1006
  {
1002
1007
  variants: {
@@ -1011,7 +1016,7 @@ const Ws = /* @__PURE__ */ S({
1011
1016
  align: "inline-start"
1012
1017
  }
1013
1018
  }
1014
- ), dn = Ue(
1019
+ ), da = Ue(
1015
1020
  "text-sm shadow-none flex gap-2 items-center",
1016
1021
  {
1017
1022
  variants: {
@@ -1026,7 +1031,7 @@ const Ws = /* @__PURE__ */ S({
1026
1031
  size: "xs"
1027
1032
  }
1028
1033
  }
1029
- ), pn = /* @__PURE__ */ S({
1034
+ ), pa = /* @__PURE__ */ S({
1030
1035
  __name: "DropdownMenu",
1031
1036
  props: {
1032
1037
  defaultOpen: { type: Boolean },
@@ -1037,14 +1042,14 @@ const Ws = /* @__PURE__ */ S({
1037
1042
  emits: ["update:open"],
1038
1043
  setup(s, { emit: t }) {
1039
1044
  const i = it(s, t);
1040
- return (r, m) => (o(), $(n(os), oe({ "data-slot": "dropdown-menu" }, n(i)), {
1041
- default: C((l) => [
1042
- D(r.$slots, "default", xe(ke(l)))
1045
+ return (c, l) => (n(), $(a(os), oe({ "data-slot": "dropdown-menu" }, a(i)), {
1046
+ default: C((r) => [
1047
+ D(c.$slots, "default", xe(ke(r)))
1043
1048
  ]),
1044
1049
  _: 3
1045
1050
  }, 16));
1046
1051
  }
1047
- }), mn = /* @__PURE__ */ S({
1052
+ }), ma = /* @__PURE__ */ S({
1048
1053
  inheritAttrs: !1,
1049
1054
  __name: "DropdownMenuContent",
1050
1055
  props: {
@@ -1074,16 +1079,16 @@ const Ws = /* @__PURE__ */ S({
1074
1079
  },
1075
1080
  emits: ["escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "closeAutoFocus"],
1076
1081
  setup(s, { emit: t }) {
1077
- const e = s, a = t, i = Re(e, "class"), r = it(i, a), { portalHost: m } = gs();
1078
- return (l, v) => (o(), $(n(rs), {
1079
- to: n(m) || void 0
1082
+ const e = s, o = t, i = Re(e, "class"), c = it(i, o), { portalHost: l } = gs();
1083
+ return (r, v) => (n(), $(a(rs), {
1084
+ to: a(l) || void 0
1080
1085
  }, {
1081
1086
  default: C(() => [
1082
- I(n(is), oe({ "data-slot": "dropdown-menu-content" }, { ...l.$attrs, ...n(r) }, {
1083
- class: n(R)("bg-[var(--ai-layer-bg)] text-[var(--ai-layer-text)] 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--reka-dropdown-menu-content-available-height) min-w-[8rem] origin-(--reka-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-[var(--ai-layer-border)] p-1 shadow-[var(--ai-layer-shadow)]", e.class)
1087
+ I(a(is), oe({ "data-slot": "dropdown-menu-content" }, { ...r.$attrs, ...a(c) }, {
1088
+ class: a(R)("bg-[var(--ai-layer-bg)] text-[var(--ai-layer-text)] 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 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--reka-dropdown-menu-content-available-height) min-w-[8rem] origin-(--reka-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-[var(--ai-layer-border)] p-1 shadow-[var(--ai-layer-shadow)]", e.class)
1084
1089
  }), {
1085
1090
  default: C(() => [
1086
- D(l.$slots, "default")
1091
+ D(r.$slots, "default")
1087
1092
  ]),
1088
1093
  _: 3
1089
1094
  }, 16, ["class"])
@@ -1091,7 +1096,7 @@ const Ws = /* @__PURE__ */ S({
1091
1096
  _: 3
1092
1097
  }, 8, ["to"]));
1093
1098
  }
1094
- }), fn = /* @__PURE__ */ S({
1099
+ }), fa = /* @__PURE__ */ S({
1095
1100
  __name: "DropdownMenuItem",
1096
1101
  props: {
1097
1102
  disabled: { type: Boolean },
@@ -1103,13 +1108,13 @@ const Ws = /* @__PURE__ */ S({
1103
1108
  variant: { default: "default" }
1104
1109
  },
1105
1110
  setup(s) {
1106
- const t = s, e = Re(t, "inset", "variant", "class"), a = lt(e);
1107
- return (i, r) => (o(), $(n(ls), oe({
1111
+ const t = s, e = Re(t, "inset", "variant", "class"), o = lt(e);
1112
+ return (i, c) => (n(), $(a(ls), oe({
1108
1113
  "data-slot": "dropdown-menu-item",
1109
1114
  "data-inset": s.inset ? "" : void 0,
1110
1115
  "data-variant": s.variant
1111
- }, n(a), {
1112
- class: n(R)("focus:bg-[var(--ai-control-hover-bg)] focus:text-[var(--ai-control-hover-text)] data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-[var(--ai-control-muted)] relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t.class)
1116
+ }, a(o), {
1117
+ class: a(R)("focus:bg-[var(--ai-control-hover-bg)] focus:text-[var(--ai-control-hover-text)] data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-[var(--ai-control-muted)] relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t.class)
1113
1118
  }), {
1114
1119
  default: C(() => [
1115
1120
  D(i.$slots, "default")
@@ -1117,7 +1122,7 @@ const Ws = /* @__PURE__ */ S({
1117
1122
  _: 3
1118
1123
  }, 16, ["data-inset", "data-variant", "class"]));
1119
1124
  }
1120
- }), gn = /* @__PURE__ */ S({
1125
+ }), ga = /* @__PURE__ */ S({
1121
1126
  __name: "DropdownMenuTrigger",
1122
1127
  props: {
1123
1128
  disabled: { type: Boolean },
@@ -1126,32 +1131,32 @@ const Ws = /* @__PURE__ */ S({
1126
1131
  },
1127
1132
  setup(s) {
1128
1133
  const e = lt(s);
1129
- return (a, i) => (o(), $(n(us), oe({ "data-slot": "dropdown-menu-trigger" }, n(e)), {
1134
+ return (o, i) => (n(), $(a(us), oe({ "data-slot": "dropdown-menu-trigger" }, a(e)), {
1130
1135
  default: C(() => [
1131
- D(a.$slots, "default")
1136
+ D(o.$slots, "default")
1132
1137
  ]),
1133
1138
  _: 3
1134
1139
  }, 16));
1135
1140
  }
1136
- }), vn = { class: "input-wrapper" }, hn = { class: "w-full" }, yn = { class: "input-top" }, _n = {
1141
+ }), va = { class: "input-wrapper" }, ha = { class: "w-full" }, ya = { class: "input-top" }, _a = {
1137
1142
  key: 0,
1138
1143
  class: "input-suggestions"
1139
- }, bn = {
1144
+ }, ba = {
1140
1145
  key: 1,
1141
1146
  class: "attachments-divider"
1142
- }, xn = {
1147
+ }, xa = {
1143
1148
  key: 2,
1144
1149
  class: "input-attachments"
1145
- }, kn = { class: "contents" }, wn = { class: "flex items-center gap-1" }, $n = { class: "flex items-center gap-1" }, Cn = ["src", "alt"], In = {
1150
+ }, ka = { class: "contents" }, wa = { class: "flex items-center gap-1" }, $a = { class: "flex items-center gap-1" }, Ca = ["src", "alt"], Ia = {
1146
1151
  key: 1,
1147
1152
  class: "whitespace-nowrap"
1148
- }, zn = {
1153
+ }, za = {
1149
1154
  key: 2,
1150
1155
  class: "text-muted-foreground"
1151
- }, Sn = ["src", "alt"], An = { class: "flex-1 truncate" }, Mn = {
1156
+ }, Sa = ["src", "alt"], Aa = { class: "flex-1 truncate" }, Ma = {
1152
1157
  key: 0,
1153
1158
  class: "ml-1.5 rounded bg-[var(--ai-muted-surface)] px-1.5 py-0.5 text-[11px] text-[var(--ai-menu-heading)]"
1154
- }, Tn = /* @__PURE__ */ S({
1159
+ }, Ta = /* @__PURE__ */ S({
1155
1160
  __name: "ChatInput",
1156
1161
  props: /* @__PURE__ */ Ne({
1157
1162
  status: {},
@@ -1165,26 +1170,26 @@ const Ws = /* @__PURE__ */ S({
1165
1170
  }),
1166
1171
  emits: /* @__PURE__ */ Ne(["submit", "stop", "selectSuggestion", "update:currentModel", "update:useWebSearch"], ["update:modelSelectorOpen"]),
1167
1172
  setup(s, { emit: t }) {
1168
- const e = s, a = t, i = ht(s, "modelSelectorOpen"), r = M(""), m = M(!1), l = M([]), v = M(null), T = M(!1);
1173
+ const e = s, o = t, i = ht(s, "modelSelectorOpen"), c = M(""), l = M(!1), r = M([]), v = M(null), T = M(!1);
1169
1174
  Qe(() => {
1170
- l.value.forEach((u) => {
1175
+ r.value.forEach((u) => {
1171
1176
  u.url && u.url.startsWith("blob:") && URL.revokeObjectURL(u.url);
1172
1177
  });
1173
1178
  });
1174
1179
  const w = (u) => {
1175
- r.value = u;
1180
+ c.value = u;
1176
1181
  };
1177
- function A(u, p, _) {
1178
- return u.type === "file_url" ? "file_url" : u.type === "image" ? "image" : u.type === "file" ? "file" : _ && !_.startsWith("blob:") && !_.startsWith("data:") ? "file_url" : ((p == null ? void 0 : p.type) || "").startsWith("image/") ? "image" : "file";
1182
+ function A(u, m, _) {
1183
+ return u.type === "file_url" ? "file_url" : u.type === "image" ? "image" : u.type === "file" ? "file" : _ && !_.startsWith("blob:") && !_.startsWith("data:") ? "file_url" : ((m == null ? void 0 : m.type) || "").startsWith("image/") ? "image" : "file";
1179
1184
  }
1180
1185
  const f = (u) => {
1181
- const p = new Set(
1182
- l.value.map((h) => {
1186
+ const m = new Set(
1187
+ r.value.map((h) => {
1183
1188
  var j;
1184
1189
  return (j = h.filename) == null ? void 0 : j.trim();
1185
1190
  }).filter((h) => !!h)
1186
1191
  ), _ = u.flatMap((h) => {
1187
- var ue, _e;
1192
+ var ce, _e;
1188
1193
  const j = h.type === "file_url" ? {
1189
1194
  ...h,
1190
1195
  id: h.id || He(),
@@ -1203,25 +1208,25 @@ const Ws = /* @__PURE__ */ S({
1203
1208
  filename: h.filename || (Y == null ? void 0 : Y.name),
1204
1209
  file: Y
1205
1210
  };
1206
- })(), K = (ue = j.filename) == null ? void 0 : ue.trim();
1207
- return K && p.has(K) ? ((_e = j.url) != null && _e.startsWith("blob:") && URL.revokeObjectURL(j.url), []) : (K && p.add(K), [j]);
1211
+ })(), K = (ce = j.filename) == null ? void 0 : ce.trim();
1212
+ return K && m.has(K) ? ((_e = j.url) != null && _e.startsWith("blob:") && URL.revokeObjectURL(j.url), []) : (K && m.add(K), [j]);
1208
1213
  });
1209
- l.value = [...l.value, ..._], m.value = l.value.length > 0;
1214
+ r.value = [...r.value, ..._], l.value = r.value.length > 0;
1210
1215
  }, B = (u) => {
1211
- const p = Array.from(u);
1212
- f(p.map((_) => ({
1216
+ const m = Array.from(u);
1217
+ f(m.map((_) => ({
1213
1218
  type: _.type.startsWith("image/") ? "image" : "file",
1214
1219
  file: _
1215
1220
  })));
1216
1221
  }, q = (u) => {
1217
- const p = l.value.find((_) => _.id === u);
1218
- p != null && p.url && p.url.startsWith("blob:") && URL.revokeObjectURL(p.url), l.value = l.value.filter((_) => _.id !== u), m.value = l.value.length > 0;
1222
+ const m = r.value.find((_) => _.id === u);
1223
+ m != null && m.url && m.url.startsWith("blob:") && URL.revokeObjectURL(m.url), r.value = r.value.filter((_) => _.id !== u), l.value = r.value.length > 0;
1219
1224
  }, J = () => {
1220
- l.value.forEach((u) => {
1225
+ r.value.forEach((u) => {
1221
1226
  u.url && u.url.startsWith("blob:") && URL.revokeObjectURL(u.url);
1222
- }), l.value = [], m.value = !1;
1227
+ }), r.value = [], l.value = !1;
1223
1228
  }, re = () => {
1224
- r.value = "";
1229
+ c.value = "";
1225
1230
  }, U = () => {
1226
1231
  var u;
1227
1232
  (u = v.value) == null || u.click();
@@ -1237,7 +1242,7 @@ const Ws = /* @__PURE__ */ S({
1237
1242
  }
1238
1243
  }, V = async () => {
1239
1244
  const u = await Promise.all(
1240
- l.value.map(async (_) => {
1245
+ r.value.map(async (_) => {
1241
1246
  if (_.url && _.url.startsWith("blob:")) {
1242
1247
  const h = await X(_.url);
1243
1248
  return {
@@ -1249,15 +1254,15 @@ const Ws = /* @__PURE__ */ S({
1249
1254
  }
1250
1255
  return _;
1251
1256
  })
1252
- ), p = {
1253
- text: r.value,
1257
+ ), m = {
1258
+ text: c.value,
1254
1259
  files: u
1255
1260
  };
1256
- a("submit", p), re(), J();
1261
+ o("submit", m), re(), J();
1257
1262
  };
1258
1263
  je(ct, {
1259
- textInput: r,
1260
- files: l,
1264
+ textInput: c,
1265
+ files: r,
1261
1266
  fileInputRef: v,
1262
1267
  isLoading: T,
1263
1268
  setTextInput: w,
@@ -1269,19 +1274,19 @@ const Ws = /* @__PURE__ */ S({
1269
1274
  openFileDialog: U,
1270
1275
  sendMessage: V
1271
1276
  });
1272
- const ee = z(() => !r.value.trim() && !m.value), E = z(() => e.currentModel || e.models.find((u) => u.is_default) || e.models[0]), te = z(() => {
1277
+ const ee = z(() => !c.value.trim() && !l.value), E = z(() => e.currentModel || e.models.find((u) => u.is_default) || e.models[0]), te = z(() => {
1273
1278
  const u = {};
1274
- return e.models.forEach((p) => {
1275
- const _ = p.provider || "Other";
1276
- u[_] || (u[_] = []), u[_].push(p);
1279
+ return e.models.forEach((m) => {
1280
+ const _ = m.provider || "Other";
1281
+ u[_] || (u[_] = []), u[_].push(m);
1277
1282
  }), u;
1278
- }), c = z(() => Object.keys(te.value));
1283
+ }), d = z(() => Object.keys(te.value));
1279
1284
  function g(u) {
1280
- const p = e.models.find((_) => _.name === u);
1281
- p && a("update:currentModel", p), i.value = !1;
1285
+ const m = e.models.find((_) => _.name === u);
1286
+ m && o("update:currentModel", m), i.value = !1;
1282
1287
  }
1283
1288
  const y = M(!1);
1284
- function ne(u) {
1289
+ function ae(u) {
1285
1290
  if (u.key === "Enter") {
1286
1291
  if (de.value) {
1287
1292
  u.shiftKey || u.preventDefault();
@@ -1291,18 +1296,18 @@ const Ws = /* @__PURE__ */ S({
1291
1296
  return;
1292
1297
  u.preventDefault(), V();
1293
1298
  }
1294
- if (u.key === "Backspace" && r.value === "" && l.value.length > 0) {
1295
- const p = l.value[l.value.length - 1];
1296
- p && q(p.id);
1299
+ if (u.key === "Backspace" && c.value === "" && r.value.length > 0) {
1300
+ const m = r.value[r.value.length - 1];
1301
+ m && q(m.id);
1297
1302
  }
1298
1303
  }
1299
1304
  function b(u) {
1300
1305
  var h;
1301
- const p = (h = u.clipboardData) == null ? void 0 : h.items;
1302
- if (!p)
1306
+ const m = (h = u.clipboardData) == null ? void 0 : h.items;
1307
+ if (!m)
1303
1308
  return;
1304
1309
  const _ = [];
1305
- for (const j of Array.from(p))
1310
+ for (const j of Array.from(m))
1306
1311
  if (j.kind === "file") {
1307
1312
  const K = j.getAsFile();
1308
1313
  K && _.push(K);
@@ -1311,17 +1316,17 @@ const Ws = /* @__PURE__ */ S({
1311
1316
  }
1312
1317
  const O = z(() => e.status === "streaming" ? "destructive" : "submit"), W = z(() => e.status === "streaming" ? Wt : Ft), he = z(() => e.status === "streaming" ? "size-4 animate-spin" : "size-4"), me = z(() => de.value ? !1 : ee.value), de = z(() => e.status === "streaming");
1313
1318
  function $e() {
1314
- de.value ? a("stop") : V();
1319
+ de.value ? o("stop") : V();
1315
1320
  }
1316
1321
  function ye(u) {
1317
- const p = u.target;
1318
- p.src = "https://models.dev/logos/openai.svg";
1322
+ const m = u.target;
1323
+ m.src = "https://models.dev/logos/openai.svg";
1319
1324
  }
1320
1325
  function Ce(u) {
1321
- const p = u.target;
1322
- p.files && B(p.files), p.value = "";
1326
+ const m = u.target;
1327
+ m.files && B(m.files), m.value = "";
1323
1328
  }
1324
- return (u, p) => (o(), x("div", vn, [
1329
+ return (u, m) => (n(), x("div", va, [
1325
1330
  k("input", {
1326
1331
  ref_key: "fileInputRef",
1327
1332
  ref: v,
@@ -1331,85 +1336,85 @@ const Ws = /* @__PURE__ */ S({
1331
1336
  accept: "image/*,.pdf,.doc,.docx,.txt",
1332
1337
  onChange: Ce
1333
1338
  }, null, 544),
1334
- k("div", hn, [
1335
- I(n(an), { class: "input-group-shell overflow-hidden" }, {
1339
+ k("div", ha, [
1340
+ I(a(oa), { class: "input-group-shell overflow-hidden" }, {
1336
1341
  default: C(() => [
1337
- k("div", yn, [
1338
- e.suggestions.length > 0 ? (o(), x("div", _n, [
1339
- I(nn, {
1342
+ k("div", ya, [
1343
+ e.suggestions.length > 0 ? (n(), x("div", _a, [
1344
+ I(na, {
1340
1345
  suggestions: e.suggestions,
1341
- onSelect: p[0] || (p[0] = (_) => a("selectSuggestion", _))
1346
+ onSelect: m[0] || (m[0] = (_) => o("selectSuggestion", _))
1342
1347
  }, null, 8, ["suggestions"])
1343
1348
  ])) : F("", !0),
1344
- e.suggestions.length > 0 ? (o(), x("div", bn)) : F("", !0),
1345
- l.value.length > 0 ? (o(), x("div", xn, [
1346
- I(Zs)
1349
+ e.suggestions.length > 0 ? (n(), x("div", ba)) : F("", !0),
1350
+ r.value.length > 0 ? (n(), x("div", xa, [
1351
+ I(Qs)
1347
1352
  ])) : F("", !0)
1348
1353
  ]),
1349
- k("div", kn, [
1350
- I(n(un), {
1351
- modelValue: r.value,
1352
- "onUpdate:modelValue": p[1] || (p[1] = (_) => r.value = _),
1354
+ k("div", ka, [
1355
+ I(a(ua), {
1356
+ modelValue: c.value,
1357
+ "onUpdate:modelValue": m[1] || (m[1] = (_) => c.value = _),
1353
1358
  placeholder: "有什么我能帮您的?",
1354
1359
  name: "message",
1355
1360
  class: "field-sizing-content max-h-48 min-h-16 pt-2 pb-3",
1356
- onKeydown: ne,
1361
+ onKeydown: ae,
1357
1362
  onPaste: b,
1358
- onCompositionstart: p[2] || (p[2] = (_) => y.value = !0),
1359
- onCompositionend: p[3] || (p[3] = (_) => y.value = !1)
1363
+ onCompositionstart: m[2] || (m[2] = (_) => y.value = !0),
1364
+ onCompositionend: m[3] || (m[3] = (_) => y.value = !1)
1360
1365
  }, null, 8, ["modelValue"])
1361
1366
  ]),
1362
- I(n(rn), {
1367
+ I(a(ia), {
1363
1368
  align: "block-end",
1364
1369
  class: "justify-between gap-1"
1365
1370
  }, {
1366
1371
  default: C(() => [
1367
- k("div", wn, [
1368
- I(n(Le), {
1372
+ k("div", wa, [
1373
+ I(a(Le), {
1369
1374
  type: "button",
1370
1375
  class: "attachment-button cursor-pointer text-muted-foreground",
1371
1376
  onClick: U
1372
1377
  }, {
1373
1378
  default: C(() => [
1374
- I(n(rt), { class: "size-4" })
1379
+ I(a(rt), { class: "size-4" })
1375
1380
  ]),
1376
1381
  _: 1
1377
1382
  }),
1378
1383
  D(u.$slots, "attachment-trigger", { addAttachments: f }, void 0, !0)
1379
1384
  ]),
1380
- k("div", $n, [
1381
- I(n(pn), {
1385
+ k("div", $a, [
1386
+ I(a(pa), {
1382
1387
  open: i.value,
1383
- "onUpdate:open": p[4] || (p[4] = (_) => i.value = _)
1388
+ "onUpdate:open": m[4] || (m[4] = (_) => i.value = _)
1384
1389
  }, {
1385
1390
  default: C(() => [
1386
- I(n(gn), { "as-child": "" }, {
1391
+ I(a(ga), { "as-child": "" }, {
1387
1392
  default: C(() => [
1388
- I(n(Le), {
1393
+ I(a(Le), {
1389
1394
  type: "button",
1390
1395
  class: "flex items-center gap-1 cursor-pointer"
1391
1396
  }, {
1392
1397
  default: C(() => [
1393
- E.value ? (o(), x("img", {
1398
+ E.value ? (n(), x("img", {
1394
1399
  key: 0,
1395
- src: `https://models.dev/logos/${n(qe)(E.value.name)}.svg`,
1400
+ src: `https://models.dev/logos/${a(qe)(E.value.name)}.svg`,
1396
1401
  class: "size-4 rounded-sm object-contain",
1397
1402
  alt: E.value.name,
1398
1403
  onError: ye
1399
- }, null, 40, Cn)) : F("", !0),
1400
- E.value ? (o(), x("span", In, H(E.value.name), 1)) : (o(), x("span", zn, "选择模型")),
1401
- I(n(nt), { class: "size-4 opacity-50 shrink-0" })
1404
+ }, null, 40, Ca)) : F("", !0),
1405
+ E.value ? (n(), x("span", Ia, H(E.value.name), 1)) : (n(), x("span", za, "选择模型")),
1406
+ I(a(at), { class: "size-4 opacity-50 shrink-0" })
1402
1407
  ]),
1403
1408
  _: 1
1404
1409
  })
1405
1410
  ]),
1406
1411
  _: 1
1407
1412
  }),
1408
- I(n(mn), { align: "start" }, {
1413
+ I(a(ma), { align: "start" }, {
1409
1414
  default: C(() => [
1410
- (o(!0), x(le, null, pe(c.value, (_) => (o(), x(le, { key: _ }, [
1411
- p[5] || (p[5] = k("div", { class: "px-2 py-1.5 text-xs font-semibold text-[var(--ai-menu-heading)]" }, " 请选择模型 ", -1)),
1412
- (o(!0), x(le, null, pe(te.value[_], (h) => (o(), $(n(fn), {
1415
+ (n(!0), x(le, null, pe(d.value, (_) => (n(), x(le, { key: _ }, [
1416
+ m[5] || (m[5] = k("div", { class: "px-2 py-1.5 text-xs font-semibold text-[var(--ai-menu-heading)]" }, " 请选择模型 ", -1)),
1417
+ (n(!0), x(le, null, pe(te.value[_], (h) => (n(), $(a(fa), {
1413
1418
  key: h.name,
1414
1419
  onSelect: () => g(h.name),
1415
1420
  class: "cursor-pointer gap-1 text-[13px] text-[var(--ai-menu-text)]"
@@ -1418,16 +1423,16 @@ const Ws = /* @__PURE__ */ S({
1418
1423
  var j;
1419
1424
  return [
1420
1425
  k("img", {
1421
- src: `https://models.dev/logos/${n(qe)(h.name)}.svg`,
1426
+ src: `https://models.dev/logos/${a(qe)(h.name)}.svg`,
1422
1427
  class: "size-4 rounded-sm object-contain",
1423
1428
  alt: h.name,
1424
1429
  onError: ye
1425
- }, null, 40, Sn),
1426
- k("span", An, [
1430
+ }, null, 40, Sa),
1431
+ k("span", Aa, [
1427
1432
  Oe(H(h.name) + " ", 1),
1428
- h.is_default ? (o(), x("span", Mn, " 默认 ")) : F("", !0)
1433
+ h.is_default ? (n(), x("span", Ma, " 默认 ")) : F("", !0)
1429
1434
  ]),
1430
- ((j = E.value) == null ? void 0 : j.name) === h.name ? (o(), $(n(Vt), {
1435
+ ((j = E.value) == null ? void 0 : j.name) === h.name ? (n(), $(a(Vt), {
1431
1436
  key: 0,
1432
1437
  class: "size-4"
1433
1438
  })) : F("", !0)
@@ -1442,7 +1447,7 @@ const Ws = /* @__PURE__ */ S({
1442
1447
  ]),
1443
1448
  _: 1
1444
1449
  }, 8, ["open"]),
1445
- I(n(Le), {
1450
+ I(a(Le), {
1446
1451
  "aria-label": "Submit",
1447
1452
  type: "button",
1448
1453
  size: "icon-sm",
@@ -1452,7 +1457,7 @@ const Ws = /* @__PURE__ */ S({
1452
1457
  onClick: $e
1453
1458
  }, {
1454
1459
  default: C(() => [
1455
- (o(), $(ge(W.value), {
1460
+ (n(), $(ge(W.value), {
1456
1461
  class: G(he.value)
1457
1462
  }, null, 8, ["class"]))
1458
1463
  ]),
@@ -1468,13 +1473,13 @@ const Ws = /* @__PURE__ */ S({
1468
1473
  ])
1469
1474
  ]));
1470
1475
  }
1471
- }), Bn = /* @__PURE__ */ ce(Tn, [["__scopeId", "data-v-e33fe8e8"]]), Pn = ["height", "width"], On = /* @__PURE__ */ S({
1476
+ }), Ba = /* @__PURE__ */ ue(Ta, [["__scopeId", "data-v-c7820daf"]]), Pa = ["height", "width"], Oa = /* @__PURE__ */ S({
1472
1477
  __name: "LoaderIcon",
1473
1478
  props: {
1474
1479
  size: { default: 16 }
1475
1480
  },
1476
1481
  setup(s) {
1477
- return (t, e) => (o(), x("svg", {
1482
+ return (t, e) => (n(), x("svg", {
1478
1483
  height: s.size,
1479
1484
  "stroke-linejoin": "round",
1480
1485
  style: { color: "currentcolor" },
@@ -1482,9 +1487,9 @@ const Ws = /* @__PURE__ */ S({
1482
1487
  width: s.size
1483
1488
  }, [...e[0] || (e[0] = [
1484
1489
  yt('<title>Loader</title><g clip-path="url(#clip0_2393_1490)"><path d="M8 0V4" stroke="currentColor" stroke-width="1.5"></path><path d="M8 16V12" opacity="0.5" stroke="currentColor" stroke-width="1.5"></path><path d="M3.29773 1.52783L5.64887 4.7639" opacity="0.9" stroke="currentColor" stroke-width="1.5"></path><path d="M12.7023 1.52783L10.3511 4.7639" opacity="0.1" stroke="currentColor" stroke-width="1.5"></path><path d="M12.7023 14.472L10.3511 11.236" opacity="0.4" stroke="currentColor" stroke-width="1.5"></path><path d="M3.29773 14.472L5.64887 11.236" opacity="0.6" stroke="currentColor" stroke-width="1.5"></path><path d="M15.6085 5.52783L11.8043 6.7639" opacity="0.2" stroke="currentColor" stroke-width="1.5"></path><path d="M0.391602 10.472L4.19583 9.23598" opacity="0.7" stroke="currentColor" stroke-width="1.5"></path><path d="M15.6085 10.4722L11.8043 9.2361" opacity="0.3" stroke="currentColor" stroke-width="1.5"></path><path d="M0.391602 5.52783L4.19583 6.7639" opacity="0.8" stroke="currentColor" stroke-width="1.5"></path></g><defs><clipPath id="clip0_2393_1490"><rect fill="white" height="16" width="16"></rect></clipPath></defs>', 3)
1485
- ])], 8, Pn));
1490
+ ])], 8, Pa));
1486
1491
  }
1487
- }), jn = /* @__PURE__ */ S({
1492
+ }), ja = /* @__PURE__ */ S({
1488
1493
  __name: "Loader",
1489
1494
  props: {
1490
1495
  size: { default: 16 },
@@ -1492,21 +1497,21 @@ const Ws = /* @__PURE__ */ S({
1492
1497
  },
1493
1498
  setup(s) {
1494
1499
  const t = s;
1495
- return (e, a) => (o(), x("div", oe({
1496
- class: n(R)("inline-flex animate-spin items-center justify-center", t.class),
1500
+ return (e, o) => (n(), x("div", oe({
1501
+ class: a(R)("inline-flex animate-spin items-center justify-center", t.class),
1497
1502
  "aria-label": "Loading",
1498
1503
  "aria-live": "polite",
1499
1504
  role: "status"
1500
1505
  }, e.$attrs), [
1501
- I(On, {
1506
+ I(Oa, {
1502
1507
  size: t.size
1503
1508
  }, null, 8, ["size"])
1504
1509
  ], 16));
1505
1510
  }
1506
- }), En = {
1511
+ }), Ea = {
1507
1512
  key: 0,
1508
1513
  class: "generated-files"
1509
- }, Dn = ["href"], Ln = /* @__PURE__ */ S({
1514
+ }, Da = ["href"], La = /* @__PURE__ */ S({
1510
1515
  __name: "GeneratedFiles",
1511
1516
  props: {
1512
1517
  customContent: {},
@@ -1514,22 +1519,22 @@ const Ws = /* @__PURE__ */ S({
1514
1519
  threadId: {}
1515
1520
  },
1516
1521
  setup(s) {
1517
- var a;
1518
- const t = s, e = ((a = t.customContent) == null ? void 0 : a.type) === "generated_files" ? t.customContent.content : null;
1519
- return (i, r) => n(e) && Array.isArray(n(e)) ? (o(), x("div", En, [
1520
- (o(!0), x(le, null, pe(n(e), (m, l) => (o(), x("a", {
1521
- key: l,
1522
+ var o;
1523
+ const t = s, e = ((o = t.customContent) == null ? void 0 : o.type) === "generated_files" ? t.customContent.content : null;
1524
+ return (i, c) => a(e) && Array.isArray(a(e)) ? (n(), x("div", Ea, [
1525
+ (n(!0), x(le, null, pe(a(e), (l, r) => (n(), x("a", {
1526
+ key: r,
1522
1527
  class: "file-item",
1523
- href: `${t.apiUrl}/webapp/download/${t.threadId}?path=${encodeURIComponent(m)}`,
1528
+ href: `${t.apiUrl}/webapp/download/${t.threadId}?path=${encodeURIComponent(l)}`,
1524
1529
  target: "_blank",
1525
1530
  rel: "noopener noreferrer"
1526
1531
  }, [
1527
- k("span", null, H(m), 1),
1528
- I(n(Nt), { class: "file-icon" })
1529
- ], 8, Dn))), 128))
1532
+ k("span", null, H(l), 1),
1533
+ I(a(Nt), { class: "file-icon" })
1534
+ ], 8, Da))), 128))
1530
1535
  ])) : F("", !0);
1531
1536
  }
1532
- }), Rn = /* @__PURE__ */ ce(Ln, [["__scopeId", "data-v-bb033040"]]), Un = /* @__PURE__ */ S({
1537
+ }), Ra = /* @__PURE__ */ ue(La, [["__scopeId", "data-v-bb033040"]]), Ua = /* @__PURE__ */ S({
1533
1538
  __name: "Shimmer",
1534
1539
  props: {
1535
1540
  as: { default: "p" },
@@ -1538,20 +1543,20 @@ const Ws = /* @__PURE__ */ S({
1538
1543
  spread: { default: 2 }
1539
1544
  },
1540
1545
  setup(s) {
1541
- const t = s, e = _t(), a = z(() => {
1546
+ const t = s, e = _t(), o = z(() => {
1542
1547
  var T;
1543
1548
  const v = (T = e.default) == null ? void 0 : T.call(e);
1544
1549
  return !v || v.length === 0 ? "" : v.map((w) => typeof w.children == "string" ? w.children : "").join("");
1545
1550
  }), i = z(() => {
1546
1551
  var v;
1547
- return (((v = a.value) == null ? void 0 : v.length) ?? 0) * t.spread;
1548
- }), r = z(() => R("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", t.class)), m = z(() => ({
1552
+ return (((v = o.value) == null ? void 0 : v.length) ?? 0) * t.spread;
1553
+ }), c = z(() => R("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent", "[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]", t.class)), l = z(() => ({
1549
1554
  "--spread": `${i.value}px`,
1550
1555
  backgroundImage: "var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"
1551
- })), l = z(() => Ge[t.as] || Ge.p);
1552
- return (v, T) => (o(), $(ge(l.value), {
1553
- class: G(r.value),
1554
- style: tt(m.value),
1556
+ })), r = z(() => Ge[t.as] || Ge.p);
1557
+ return (v, T) => (n(), $(ge(r.value), {
1558
+ class: G(c.value),
1559
+ style: tt(l.value),
1555
1560
  initial: { backgroundPosition: "100% center" },
1556
1561
  animate: { backgroundPosition: "0% center" },
1557
1562
  transition: {
@@ -1566,16 +1571,16 @@ const Ws = /* @__PURE__ */ S({
1566
1571
  _: 3
1567
1572
  }, 8, ["class", "style", "transition"]));
1568
1573
  }
1569
- }), Wn = {
1574
+ }), Wa = {
1570
1575
  key: 0,
1571
1576
  class: "todo-section"
1572
- }, Fn = { class: "todo-card" }, Vn = { class: "title" }, Nn = { class: "title-summary" }, Kn = { class: "title-meta" }, Hn = { class: "todo-list" }, Gn = { class: "todo-row" }, qn = { class: "todo-index" }, Jn = {
1577
+ }, Fa = { class: "todo-card" }, Va = { class: "title" }, Na = { class: "title-summary" }, Ka = { class: "title-meta" }, Ha = { class: "todo-list" }, Ga = { class: "todo-row" }, qa = { class: "todo-index" }, Ja = {
1573
1578
  class: "indicator",
1574
1579
  "aria-hidden": "true"
1575
- }, Xn = {
1580
+ }, Xa = {
1576
1581
  key: 1,
1577
1582
  class: "title-text-base title-text"
1578
- }, Yn = /* @__PURE__ */ S({
1583
+ }, Ya = /* @__PURE__ */ S({
1579
1584
  __name: "TodoList",
1580
1585
  props: {
1581
1586
  initialTodos: { default: () => [] },
@@ -1583,59 +1588,59 @@ const Ws = /* @__PURE__ */ S({
1583
1588
  chatStatus: { default: "ready" }
1584
1589
  },
1585
1590
  setup(s) {
1586
- const t = s, e = M([]), a = M(0), i = z(() => e.value.filter((c) => c.status === "completed").length), r = z(() => e.value.filter((c) => c.status === "in_progress").length), m = z(() => e.value.filter((c) => c.status === "interrupted").length), l = z(() => e.value.filter((c) => c.status === "pending").length), v = M(!1), T = M(!1);
1591
+ const t = s, e = M([]), o = M(0), i = z(() => e.value.filter((d) => d.status === "completed").length), c = z(() => e.value.filter((d) => d.status === "in_progress").length), l = z(() => e.value.filter((d) => d.status === "interrupted").length), r = z(() => e.value.filter((d) => d.status === "pending").length), v = M(!1), T = M(!1);
1587
1592
  function w() {
1588
1593
  v.value = !v.value, T.value = !v.value;
1589
1594
  }
1590
- function A(c) {
1591
- if (c.length === 0) {
1595
+ function A(d) {
1596
+ if (d.length === 0) {
1592
1597
  v.value = !1, T.value = !1;
1593
1598
  return;
1594
1599
  }
1595
1600
  !T.value && t.chatStatus === "streaming" && (v.value = !0);
1596
1601
  }
1597
- function f(c) {
1598
- return (c || "") === "write_todos";
1602
+ function f(d) {
1603
+ return (d || "") === "write_todos";
1599
1604
  }
1600
- function B(c, g) {
1601
- const y = String(c || "").toLowerCase();
1605
+ function B(d, g) {
1606
+ const y = String(d || "").toLowerCase();
1602
1607
  return y === "completed" ? "completed" : y === "in_progress" ? "in_progress" : y === "pending" ? "pending" : y === "interrupted" ? "interrupted" : g;
1603
1608
  }
1604
- function q(c) {
1605
- const g = B(c, "pending");
1609
+ function q(d) {
1610
+ const g = B(d, "pending");
1606
1611
  return g === "in_progress" ? "interrupted" : g;
1607
1612
  }
1608
- function J(c) {
1609
- return c.state === "completed" ? "completed" : c.state === "interrupted" ? "interrupted" : c.phase === "tool_call_started" ? "pending" : "in_progress";
1613
+ function J(d) {
1614
+ return d.state === "completed" ? "completed" : d.state === "interrupted" ? "interrupted" : d.phase === "tool_call_started" ? "pending" : "in_progress";
1610
1615
  }
1611
- function re(c, g = "pending") {
1612
- return c.map((y, ne) => ({
1613
- id: y.id || `todo-${ne + 1}`,
1616
+ function re(d, g = "pending") {
1617
+ return d.map((y, ae) => ({
1618
+ id: y.id || `todo-${ae + 1}`,
1614
1619
  title: y.title || y.task || y.content || y.text || y.name || "",
1615
1620
  status: B(y.status || y.state, g)
1616
1621
  })).filter((y) => y.title);
1617
1622
  }
1618
- function U(c) {
1619
- return c.map((g, y) => ({
1623
+ function U(d) {
1624
+ return d.map((g, y) => ({
1620
1625
  id: g.id || `todo-${y + 1}`,
1621
1626
  title: g.title || g.task || g.content || g.text || g.name || "",
1622
1627
  status: q(g.status || g.state)
1623
1628
  })).filter((g) => g.title);
1624
1629
  }
1625
1630
  function X() {
1626
- const c = e.value.map((g) => g.status !== "in_progress" ? g : {
1631
+ const d = e.value.map((g) => g.status !== "in_progress" ? g : {
1627
1632
  ...g,
1628
1633
  status: "interrupted"
1629
1634
  });
1630
- e.value = c, A(c);
1635
+ e.value = d, A(d);
1631
1636
  }
1632
- function V(c) {
1633
- return "todo" in c || "todos" in c || "item" in c || "items" in c;
1637
+ function V(d) {
1638
+ return "todo" in d || "todos" in d || "item" in d || "items" in d;
1634
1639
  }
1635
- function Z(c) {
1636
- if (!c) return [];
1640
+ function Z(d) {
1641
+ if (!d) return [];
1637
1642
  try {
1638
- const g = JSON.parse(c);
1643
+ const g = JSON.parse(d);
1639
1644
  if (Array.isArray(g))
1640
1645
  return g;
1641
1646
  if (V(g)) {
@@ -1649,64 +1654,64 @@ const Ws = /* @__PURE__ */ S({
1649
1654
  return [];
1650
1655
  }
1651
1656
  }
1652
- function ee(c, g = "pending") {
1653
- const y = Z(c);
1657
+ function ee(d, g = "pending") {
1658
+ const y = Z(d);
1654
1659
  return re(y, g);
1655
1660
  }
1656
- function E(c, g = "pending") {
1657
- const y = ee(c, g);
1661
+ function E(d, g = "pending") {
1662
+ const y = ee(d, g);
1658
1663
  return y.length === 0 ? !1 : (e.value = y, A(y), !0);
1659
1664
  }
1660
- function te(c) {
1661
- const g = J(c);
1662
- f(c.name) && E(c.args, g);
1665
+ function te(d) {
1666
+ const g = J(d);
1667
+ f(d.name) && E(d.args, g);
1663
1668
  }
1664
1669
  return Te(
1665
1670
  () => t.initialTodos,
1666
- (c) => {
1667
- const g = U(c || []);
1671
+ (d) => {
1672
+ const g = U(d || []);
1668
1673
  e.value = g, A(g);
1669
1674
  },
1670
1675
  { deep: !0, immediate: !0 }
1671
1676
  ), Te(
1672
1677
  () => t.toolEvents,
1673
- (c) => {
1674
- if (!c.length) {
1675
- a.value = 0;
1678
+ (d) => {
1679
+ if (!d.length) {
1680
+ o.value = 0;
1676
1681
  return;
1677
1682
  }
1678
- c.length < a.value && (e.value = [], a.value = 0, A([])), c.slice(a.value).forEach((y) => {
1683
+ d.length < o.value && (e.value = [], o.value = 0, A([])), d.slice(o.value).forEach((y) => {
1679
1684
  te(y);
1680
- }), a.value = c.length;
1685
+ }), o.value = d.length;
1681
1686
  },
1682
1687
  { deep: !0, immediate: !0 }
1683
1688
  ), Te(
1684
1689
  () => t.chatStatus,
1685
- (c, g) => {
1686
- g === "streaming" && c === "ready" && X();
1690
+ (d, g) => {
1691
+ g === "streaming" && d === "ready" && X();
1687
1692
  }
1688
- ), (c, g) => e.value.length ? (o(), x("div", Wn, [
1689
- k("div", Fn, [
1693
+ ), (d, g) => e.value.length ? (n(), x("div", Wa, [
1694
+ k("div", Fa, [
1690
1695
  k("div", {
1691
1696
  class: G(["todo-divider", { collapsed: !v.value }]),
1692
1697
  onClick: w
1693
1698
  }, [
1694
- k("div", Vn, [
1695
- (o(), $(ge(v.value ? n(Kt) : n(Ht)), {
1699
+ k("div", Va, [
1700
+ (n(), $(ge(v.value ? a(Kt) : a(Ht)), {
1696
1701
  size: 13,
1697
1702
  class: "title-chevron"
1698
1703
  })),
1699
1704
  g[0] || (g[0] = k("span", { class: "title-label" }, "执行计划", -1)),
1700
- k("span", Nn, H(i.value) + "/" + H(e.value.length), 1),
1701
- k("span", Kn, H(r.value > 0 ? `进行中 ${r.value}` : m.value > 0 ? `中断 ${m.value}` : l.value > 0 ? `待处理 ${l.value}` : "已完成"), 1)
1705
+ k("span", Na, H(i.value) + "/" + H(e.value.length), 1),
1706
+ k("span", Ka, H(c.value > 0 ? `进行中 ${c.value}` : l.value > 0 ? `中断 ${l.value}` : r.value > 0 ? `待处理 ${r.value}` : "已完成"), 1)
1702
1707
  ])
1703
1708
  ], 2),
1704
- we(k("div", Hn, [
1705
- (o(!0), x(le, null, pe(e.value, (y, ne) => (o(), x("div", {
1709
+ we(k("div", Ha, [
1710
+ (n(!0), x(le, null, pe(e.value, (y, ae) => (n(), x("div", {
1706
1711
  key: y.id,
1707
1712
  class: "todo-item"
1708
1713
  }, [
1709
- k("div", Gn, [
1714
+ k("div", Ga, [
1710
1715
  k("div", {
1711
1716
  class: G(["todo-content", {
1712
1717
  completed: y.status === "completed",
@@ -1715,30 +1720,30 @@ const Ws = /* @__PURE__ */ S({
1715
1720
  "in-progress": y.status === "in_progress"
1716
1721
  }])
1717
1722
  }, [
1718
- k("span", qn, H(ne + 1) + ".", 1),
1719
- k("span", Jn, [
1720
- y.status === "pending" ? (o(), $(n(Gt), {
1723
+ k("span", qa, H(ae + 1) + ".", 1),
1724
+ k("span", Ja, [
1725
+ y.status === "pending" ? (n(), $(a(Gt), {
1721
1726
  key: 0,
1722
1727
  size: 13,
1723
1728
  class: "status-icon pending-icon"
1724
1729
  })) : F("", !0),
1725
- y.status === "in_progress" ? (o(), $(n(qt), {
1730
+ y.status === "in_progress" ? (n(), $(a(qt), {
1726
1731
  key: 1,
1727
1732
  size: 13,
1728
1733
  class: "status-icon in-progress-icon"
1729
1734
  })) : F("", !0),
1730
- y.status === "interrupted" ? (o(), $(n(Jt), {
1735
+ y.status === "interrupted" ? (n(), $(a(Jt), {
1731
1736
  key: 2,
1732
1737
  size: 13,
1733
1738
  class: "status-icon interrupted-icon"
1734
1739
  })) : F("", !0),
1735
- y.status === "completed" ? (o(), $(n(Xt), {
1740
+ y.status === "completed" ? (n(), $(a(Xt), {
1736
1741
  key: 3,
1737
1742
  size: 13,
1738
1743
  class: "status-icon completed-icon"
1739
1744
  })) : F("", !0)
1740
1745
  ]),
1741
- y.status === "in_progress" ? (o(), $(n(Un), {
1746
+ y.status === "in_progress" ? (n(), $(a(Ua), {
1742
1747
  key: 0,
1743
1748
  as: "div",
1744
1749
  class: "title-text-base title-text-shimmer"
@@ -1747,7 +1752,7 @@ const Ws = /* @__PURE__ */ S({
1747
1752
  Oe(H(y.title), 1)
1748
1753
  ]),
1749
1754
  _: 2
1750
- }, 1024)) : (o(), x("div", Xn, H(y.title), 1))
1755
+ }, 1024)) : (n(), x("div", Xa, H(y.title), 1))
1751
1756
  ], 2)
1752
1757
  ])
1753
1758
  ]))), 128))
@@ -1757,13 +1762,13 @@ const Ws = /* @__PURE__ */ S({
1757
1762
  ])
1758
1763
  ])) : F("", !0);
1759
1764
  }
1760
- }), Zn = /* @__PURE__ */ ce(Yn, [["__scopeId", "data-v-8ce364e8"]]), Qn = { class: "chat-bot" }, ea = {
1765
+ }), Za = /* @__PURE__ */ ue(Ya, [["__scopeId", "data-v-0f197674"]]), Qa = ["data-ai-theme"], en = {
1761
1766
  key: 0,
1762
1767
  class: "flex-1 overflow-y-hidden flex flex-col items-center justify-center"
1763
- }, ta = { class: "default-empty-state" }, sa = { class: "default-empty-title" }, na = {
1768
+ }, tn = { class: "default-empty-state" }, sn = { class: "default-empty-title" }, an = {
1764
1769
  key: 2,
1765
1770
  class: "loading-mask"
1766
- }, aa = /* @__PURE__ */ S({
1771
+ }, nn = /* @__PURE__ */ S({
1767
1772
  __name: "ChatBot",
1768
1773
  props: {
1769
1774
  assistantId: { default: "research" },
@@ -1774,16 +1779,17 @@ const Ws = /* @__PURE__ */ S({
1774
1779
  showHeaderActions: { type: Boolean, default: !0 },
1775
1780
  suggestions: { default: () => [] },
1776
1781
  apiUrl: { default: "http://localhost:2024" },
1777
- apiKey: { default: void 0 }
1782
+ apiKey: { default: void 0 },
1783
+ theme: { default: "light" }
1778
1784
  },
1779
1785
  emits: ["close", "update:isMaximized"],
1780
1786
  setup(s, { emit: t }) {
1781
- const e = s, a = new bt({
1787
+ const e = s, o = new bt({
1782
1788
  apiUrl: e.apiUrl,
1783
1789
  apiKey: e.apiKey || void 0
1784
- }), i = M(!1), r = M(null), m = M(null);
1785
- je(ut, { portalHost: m });
1786
- const l = M("ready"), v = M(""), T = M(!1), w = M(!1), A = M(!0), f = M([]), B = M([]), q = M([]), J = M([]);
1790
+ }), i = M(!1), c = M(null), l = M(null);
1791
+ je(ut, { portalHost: l });
1792
+ const r = M("ready"), v = M(""), T = M(!1), w = M(!1), A = M(!0), f = M([]), B = M([]), q = M([]), J = M([]);
1787
1793
  function re(b) {
1788
1794
  const O = b || "";
1789
1795
  return O.includes("todo") || O === "write_todos";
@@ -1806,9 +1812,9 @@ const Ws = /* @__PURE__ */ S({
1806
1812
  X.value = b, V.value = ps(b) || null;
1807
1813
  })(),
1808
1814
  e.threadId ? (async () => {
1809
- const b = await ms(a, e.threadId, e.userId);
1810
- r.value = b, f.value = await fs(
1811
- a,
1815
+ const b = await ms(o, e.threadId, e.userId);
1816
+ c.value = b, f.value = await fs(
1817
+ o,
1812
1818
  b,
1813
1819
  (O) => {
1814
1820
  B.value = O;
@@ -1825,21 +1831,21 @@ const Ws = /* @__PURE__ */ S({
1825
1831
  }
1826
1832
  async function ee(b, O = []) {
1827
1833
  var me, de, $e, ye, Ce;
1828
- if (l.value === "streaming") return;
1829
- l.value = "streaming";
1834
+ if (r.value === "streaming") return;
1835
+ r.value = "streaming";
1830
1836
  const W = [];
1831
1837
  b.trim() && W.push({ type: "text", text: b });
1832
1838
  for (const u of O) {
1833
- const p = u.mediaType || "application/octet-stream", _ = u.filename || u.id || "unknown", h = u.data || u.url || "", j = h.startsWith("data:"), K = j && h.split(",")[1] || "", ue = u.type || (j ? p.startsWith("image/") ? "image" : "file" : "file_url");
1834
- if ((ue === "file" || ue === "image") && K) {
1835
- ue === "image" ? W.push({
1839
+ const m = u.mediaType || "application/octet-stream", _ = u.filename || u.id || "unknown", h = u.data || u.url || "", j = h.startsWith("data:"), K = j && h.split(",")[1] || "", ce = u.type || (j ? m.startsWith("image/") ? "image" : "file" : "file_url");
1840
+ if ((ce === "file" || ce === "image") && K) {
1841
+ ce === "image" ? W.push({
1836
1842
  type: "image",
1837
- mimeType: p,
1843
+ mimeType: m,
1838
1844
  data: K,
1839
1845
  metadata: { name: _ }
1840
1846
  }) : W.push({
1841
1847
  type: "file",
1842
- mimeType: p,
1848
+ mimeType: m,
1843
1849
  data: K,
1844
1850
  metadata: { filename: _ }
1845
1851
  });
@@ -1848,7 +1854,7 @@ const Ws = /* @__PURE__ */ S({
1848
1854
  u.url && W.push({
1849
1855
  type: "file_url",
1850
1856
  url: u.url,
1851
- mimeType: p,
1857
+ mimeType: m,
1852
1858
  metadata: { filename: _ }
1853
1859
  });
1854
1860
  }
@@ -1877,21 +1883,21 @@ const Ws = /* @__PURE__ */ S({
1877
1883
  state: fe
1878
1884
  }]
1879
1885
  };
1880
- }, p = function(Y, se) {
1886
+ }, m = function(Y, se) {
1881
1887
  const P = f.value[Y];
1882
1888
  P && P.toolCalls && P.toolCalls.length > 0 && (se.args !== void 0 && (P.toolCalls[0].args = se.args), se.result !== void 0 && (P.toolCalls[0].result = se.result), se.state !== void 0 && (P.toolCalls[0].state = se.state));
1883
1889
  };
1884
- if (!r.value) {
1885
- const Y = await a.threads.create({
1890
+ if (!c.value) {
1891
+ const Y = await o.threads.create({
1886
1892
  metadata: {
1887
1893
  user_id: e.userId,
1888
1894
  name: b.slice(0, 50)
1889
1895
  }
1890
1896
  });
1891
- r.value = Y.thread_id;
1897
+ c.value = Y.thread_id;
1892
1898
  }
1893
- const _ = a.runs.stream(
1894
- r.value,
1899
+ const _ = o.runs.stream(
1900
+ c.value,
1895
1901
  e.assistantId,
1896
1902
  {
1897
1903
  input: {
@@ -1934,11 +1940,11 @@ const Ws = /* @__PURE__ */ S({
1934
1940
  ];
1935
1941
  let j = "";
1936
1942
  const K = /* @__PURE__ */ new Map();
1937
- let ue = !1;
1943
+ let ce = !1;
1938
1944
  for await (const Y of _) {
1939
1945
  const se = Y.event, P = Y.data;
1940
1946
  if (se === "metadata" && (P != null && P.run_id) && (v.value = P.run_id), se === "custom") {
1941
- if (ne(P), (P == null ? void 0 : P.type) === "suggested_questions")
1947
+ if (ae(P), (P == null ? void 0 : P.type) === "suggested_questions")
1942
1948
  continue;
1943
1949
  const fe = {
1944
1950
  type: (P == null ? void 0 : P.type) || "unknown",
@@ -1959,10 +1965,10 @@ const Ws = /* @__PURE__ */ S({
1959
1965
  const fe = Array.isArray(P) ? P : [P], L = fe[0], Ie = fe[1];
1960
1966
  if (Ie != null && Ie.run_id && (v.value = Ie.run_id), L) {
1961
1967
  if (L.type === "tool") {
1962
- const d = L.tool_call_id, ae = L.name || "未知工具", ie = typeof L.content == "string" ? L.content : JSON.stringify(L.content), N = L.status;
1968
+ const p = L.tool_call_id, ne = L.name || "未知工具", ie = typeof L.content == "string" ? L.content : JSON.stringify(L.content), N = L.status;
1963
1969
  let Q;
1964
1970
  for (const [Ae, Me] of K)
1965
- if (Me.id === d) {
1971
+ if (Me.id === p) {
1966
1972
  Q = Me, K.delete(Ae);
1967
1973
  break;
1968
1974
  }
@@ -1979,20 +1985,20 @@ const Ws = /* @__PURE__ */ S({
1979
1985
  }
1980
1986
  })(N);
1981
1987
  if (Q && Q.messageKey !== void 0)
1982
- p(Q.messageKey, {
1988
+ m(Q.messageKey, {
1983
1989
  args: Q.args,
1984
1990
  result: ie,
1985
1991
  state: De
1986
1992
  });
1987
1993
  else {
1988
1994
  const Me = {
1989
- key: `tool-${d}-${Date.now()}`,
1995
+ key: `tool-${p}-${Date.now()}`,
1990
1996
  type: "tool",
1991
1997
  content: ie,
1992
1998
  batchId: v.value,
1993
1999
  toolCalls: [{
1994
- id: d,
1995
- name: ae,
2000
+ id: p,
2001
+ name: ne,
1996
2002
  args: (Q == null ? void 0 : Q.args) || "",
1997
2003
  result: ie,
1998
2004
  state: De,
@@ -2003,128 +2009,128 @@ const Ws = /* @__PURE__ */ S({
2003
2009
  }
2004
2010
  U({
2005
2011
  phase: "tool_result",
2006
- id: d,
2007
- name: ae,
2012
+ id: p,
2013
+ name: ne,
2008
2014
  rawArgs: (Q == null ? void 0 : Q.args) || "",
2009
2015
  result: ie,
2010
2016
  state: De
2011
2017
  }), console.log("🔧 阶段4 - 工具结果返回:", {
2012
- name: ae,
2013
- id: d,
2018
+ name: ne,
2019
+ id: p,
2014
2020
  args: (Q == null ? void 0 : Q.args) || "",
2015
2021
  result: ie,
2016
2022
  status: N,
2017
2023
  messageCount: f.value.length
2018
- }), ue = !0;
2024
+ }), ce = !0;
2019
2025
  continue;
2020
2026
  }
2021
2027
  if (L.chunk_position === "last") {
2022
- for (const [, d] of K)
2023
- d.messageKey !== void 0 && p(d.messageKey, { state: "running" }), U({
2028
+ for (const [, p] of K)
2029
+ p.messageKey !== void 0 && m(p.messageKey, { state: "running" }), U({
2024
2030
  phase: "tool_call_finished",
2025
- id: d.id,
2026
- name: d.name,
2027
- rawArgs: d.args,
2031
+ id: p.id,
2032
+ name: p.name,
2033
+ rawArgs: p.args,
2028
2034
  state: "running"
2029
2035
  });
2030
2036
  console.log("🛑 阶段3 - 工具调用结束", {
2031
2037
  chunk_position: L.chunk_position,
2032
2038
  toolCallsCount: K.size,
2033
- allToolCalls: Array.from(K.values()).map((d) => ({ id: d.id, name: d.name, args: d.args }))
2039
+ allToolCalls: Array.from(K.values()).map((p) => ({ id: p.id, name: p.name, args: p.args }))
2034
2040
  });
2035
2041
  }
2036
2042
  const be = L.id, Fe = L.tool_calls && L.tool_calls.length > 0, Ve = L.tool_call_chunks && L.tool_call_chunks.length > 0;
2037
2043
  if (Fe || Ve) {
2038
2044
  if (Fe)
2039
- for (const d of L.tool_calls) {
2040
- const ae = L.tool_calls.indexOf(d), ie = `${be}_${ae}`, N = K.get(ie);
2045
+ for (const p of L.tool_calls) {
2046
+ const ne = L.tool_calls.indexOf(p), ie = `${be}_${ne}`, N = K.get(ie);
2041
2047
  if (N)
2042
- d.id && (N.id = d.id), d.name && (N.name = d.name), d.name && (N.name = d.name);
2048
+ p.id && (N.id = p.id), p.name && (N.name = p.name), p.name && (N.name = p.name);
2043
2049
  else {
2044
- const Q = u(d.id, d.name, "", "start");
2050
+ const Q = u(p.id, p.name, "", "start");
2045
2051
  f.value.push(Q);
2046
2052
  const ve = f.value.length - 1;
2047
2053
  K.set(ie, {
2048
- id: d.id,
2049
- name: d.name,
2054
+ id: p.id,
2055
+ name: p.name,
2050
2056
  args: "",
2051
2057
  messageKey: ve.toString()
2052
2058
  }), U({
2053
2059
  phase: "tool_call_started",
2054
- id: d.id,
2055
- name: d.name,
2056
- rawArgs: typeof d.args == "string" ? d.args : "",
2060
+ id: p.id,
2061
+ name: p.name,
2062
+ rawArgs: typeof p.args == "string" ? p.args : "",
2057
2063
  state: "start"
2058
2064
  }), console.log("📝 阶段1 - 工具调用开始:", {
2059
2065
  messageId: be,
2060
- index: ae,
2061
- toolCallId: d.id,
2062
- name: d.name,
2066
+ index: ne,
2067
+ toolCallId: p.id,
2068
+ name: p.name,
2063
2069
  msgIndex: ve
2064
2070
  });
2065
2071
  }
2066
2072
  }
2067
2073
  if (Ve)
2068
- for (const d of L.tool_call_chunks) {
2069
- const ae = d.index;
2070
- if (ae === void 0) continue;
2071
- const ie = `${be}_${ae}`;
2074
+ for (const p of L.tool_call_chunks) {
2075
+ const ne = p.index;
2076
+ if (ne === void 0) continue;
2077
+ const ie = `${be}_${ne}`;
2072
2078
  let N = K.get(ie);
2073
2079
  if (N)
2074
- d.args && d.args.trim() && (N.args = (N.args || "") + d.args, N.messageKey && p(N.messageKey, { args: N.args, state: "running" }), U({
2080
+ p.args && p.args.trim() && (N.args = (N.args || "") + p.args, N.messageKey && m(N.messageKey, { args: N.args, state: "running" }), U({
2075
2081
  phase: "tool_args_streaming",
2076
- id: N.id || d.id || "",
2077
- name: N.name || d.name || "",
2082
+ id: N.id || p.id || "",
2083
+ name: N.name || p.name || "",
2078
2084
  rawArgs: N.args,
2079
2085
  state: "running"
2080
- })), d.id && !N.id && (N.id = d.id), d.name && (N.name = d.name), console.log("📝 阶段2 - args 流式累加:", {
2086
+ })), p.id && !N.id && (N.id = p.id), p.name && (N.name = p.name), console.log("📝 阶段2 - args 流式累加:", {
2081
2087
  messageId: be,
2082
- index: ae,
2083
- newArgs: d.args,
2088
+ index: ne,
2089
+ newArgs: p.args,
2084
2090
  accumulatedArgs: N.args
2085
2091
  });
2086
2092
  else {
2087
- const Q = u(d.id || "", d.name || "", d.args || "", "running");
2093
+ const Q = u(p.id || "", p.name || "", p.args || "", "running");
2088
2094
  f.value.push(Q);
2089
2095
  const ve = f.value.length - 1;
2090
2096
  K.set(ie, {
2091
- id: d.id || "",
2092
- name: d.name || "",
2093
- args: d.args || "",
2097
+ id: p.id || "",
2098
+ name: p.name || "",
2099
+ args: p.args || "",
2094
2100
  messageKey: ve.toString()
2095
2101
  }), U({
2096
2102
  phase: "tool_args_streaming",
2097
- id: d.id || "",
2098
- name: d.name || "",
2099
- rawArgs: d.args || "",
2103
+ id: p.id || "",
2104
+ name: p.name || "",
2105
+ rawArgs: p.args || "",
2100
2106
  state: "running"
2101
2107
  }), console.log("📝 阶段1 - 工具调用开始:", {
2102
2108
  messageId: be,
2103
- index: ae,
2104
- toolCallId: d.id || "(暂无)",
2105
- name: d.name || "(暂无)",
2109
+ index: ne,
2110
+ toolCallId: p.id || "(暂无)",
2111
+ name: p.name || "(暂无)",
2106
2112
  msgIndex: ve
2107
2113
  });
2108
2114
  }
2109
2115
  }
2110
2116
  }
2111
2117
  let ze = "";
2112
- if (typeof L.content == "string" ? ze = L.content : Array.isArray(L.content) && (ze = L.content.filter((d) => d.type === "text").map((d) => d.text).join("")), ue) {
2113
- for (let ae = f.value.length - 1; ae >= 0 && f.value[ae].type !== "ai"; ae--)
2118
+ if (typeof L.content == "string" ? ze = L.content : Array.isArray(L.content) && (ze = L.content.filter((p) => p.type === "text").map((p) => p.text).join("")), ce) {
2119
+ for (let ne = f.value.length - 1; ne >= 0 && f.value[ne].type !== "ai"; ne--)
2114
2120
  ;
2115
- const d = `ai-${Date.now()}`;
2121
+ const p = `ai-${Date.now()}`;
2116
2122
  f.value.push({
2117
- key: d,
2123
+ key: p,
2118
2124
  type: "ai",
2119
2125
  content: "",
2120
2126
  batchId: v.value
2121
- }), j = "", ue = !1;
2127
+ }), j = "", ce = !1;
2122
2128
  }
2123
2129
  ze !== void 0 && (j += ze);
2124
2130
  let Se = -1;
2125
- for (let d = f.value.length - 1; d >= 0; d--)
2126
- if (f.value[d].type === "ai") {
2127
- Se = d;
2131
+ for (let p = f.value.length - 1; p >= 0; p--)
2132
+ if (f.value[p].type === "ai") {
2133
+ Se = p;
2128
2134
  break;
2129
2135
  }
2130
2136
  Se >= 0 && (f.value[Se].content = j, f.value[Se].batchId = v.value);
@@ -2132,13 +2138,13 @@ const Ws = /* @__PURE__ */ S({
2132
2138
  }
2133
2139
  }
2134
2140
  const _e = f.value.length - 1;
2135
- _e >= 0 && (f.value[_e].batchId = v.value), l.value = "ready";
2141
+ _e >= 0 && (f.value[_e].batchId = v.value), r.value = "ready";
2136
2142
  } catch (u) {
2137
2143
  console.error("Error sending message:", u);
2138
- let p = "抱歉,发生了一些错误,请稍后重试。";
2144
+ let m = "抱歉,发生了一些错误,请稍后重试。";
2139
2145
  if (u) {
2140
2146
  const h = u.message || ((ye = u.error) == null ? void 0 : ye.message) || String(u), j = ((Ce = u.error) == null ? void 0 : Ce.error) || u.name || "APIError";
2141
- h && h !== "[object Object]" && (j === "APIError" && h.includes("internal error") ? p = "服务内部错误,请稍后重试。" : h.includes("timeout") || h.includes("Timeout") ? p = "请求超时,请稍后重试。" : h.includes("network") || h.includes("Network") ? p = "网络连接失败,请检查网络后重试。" : h.includes("401") || h.includes("unauthorized") ? p = "认证失败,请重新登录。" : h.includes("403") || h.includes("forbidden") ? p = "没有权限执行此操作。" : h.includes("429") || h.includes("rate limit") ? p = "请求过于频繁,请稍后再试。" : p = `抱歉,发生错误: ${h}`);
2147
+ h && h !== "[object Object]" && (j === "APIError" && h.includes("internal error") ? m = "服务内部错误,请稍后重试。" : h.includes("timeout") || h.includes("Timeout") ? m = "请求超时,请稍后重试。" : h.includes("network") || h.includes("Network") ? m = "网络连接失败,请检查网络后重试。" : h.includes("401") || h.includes("unauthorized") ? m = "认证失败,请重新登录。" : h.includes("403") || h.includes("forbidden") ? m = "没有权限执行此操作。" : h.includes("429") || h.includes("rate limit") ? m = "请求过于频繁,请稍后再试。" : m = `抱歉,发生错误: ${h}`);
2142
2148
  }
2143
2149
  const _ = `error-${Date.now()}`;
2144
2150
  f.value = [
@@ -2146,10 +2152,10 @@ const Ws = /* @__PURE__ */ S({
2146
2152
  {
2147
2153
  key: _,
2148
2154
  type: "ai",
2149
- content: p,
2155
+ content: m,
2150
2156
  batchId: _
2151
2157
  }
2152
- ], l.value = "ready";
2158
+ ], r.value = "ready";
2153
2159
  }
2154
2160
  }
2155
2161
  function E(b) {
@@ -2161,33 +2167,36 @@ const Ws = /* @__PURE__ */ S({
2161
2167
  ee(he || "仅发送了附件", b.files || []);
2162
2168
  }
2163
2169
  async function te() {
2164
- if (console.log("🛑 点击停止按钮:", { threadId: r.value, runId: v.value }), r.value && v.value)
2170
+ if (console.log("🛑 点击停止按钮:", { threadId: c.value, runId: v.value }), c.value && v.value)
2165
2171
  try {
2166
- console.log("📡 发送 cancel 请求..."), await a.runs.cancel(r.value, v.value), console.log("✅ cancel 请求成功"), l.value = "ready";
2172
+ console.log("📡 发送 cancel 请求..."), await o.runs.cancel(c.value, v.value), console.log("✅ cancel 请求成功"), r.value = "ready";
2167
2173
  } catch (b) {
2168
- console.error("❌ cancel 请求失败:", b), l.value = "ready";
2174
+ console.error("❌ cancel 请求失败:", b), r.value = "ready";
2169
2175
  }
2170
2176
  else
2171
- console.log("⚠️ 缺少 threadId 或 runId,直接重置状态"), l.value = "ready";
2177
+ console.log("⚠️ 缺少 threadId 或 runId,直接重置状态"), r.value = "ready";
2172
2178
  }
2173
- function c(b) {
2179
+ function d(b) {
2174
2180
  ee(b);
2175
2181
  }
2176
2182
  const g = t;
2177
2183
  function y() {
2178
2184
  g("close");
2179
2185
  }
2180
- function ne(b) {
2186
+ function ae(b) {
2181
2187
  if ((b == null ? void 0 : b.type) === "suggested_questions" && Array.isArray(b == null ? void 0 : b.content)) {
2182
2188
  B.value = b.content, console.log("📝 更新建议问题:", b.content);
2183
2189
  return;
2184
2190
  }
2185
2191
  console.log("Custom event received:", b);
2186
2192
  }
2187
- return (b, O) => (o(), x("div", Qn, [
2193
+ return (b, O) => (n(), x("div", {
2194
+ class: "chat-bot",
2195
+ "data-ai-theme": e.theme
2196
+ }, [
2188
2197
  k("div", {
2189
2198
  ref_key: "portalHost",
2190
- ref: m,
2199
+ ref: l,
2191
2200
  class: "chat-bot-portal-host"
2192
2201
  }, null, 512),
2193
2202
  k("div", {
@@ -2200,41 +2209,42 @@ const Ws = /* @__PURE__ */ S({
2200
2209
  onClose: y,
2201
2210
  onToggleMaximize: Z
2202
2211
  }, null, 8, ["title", "is-maximized", "show-header-actions"]),
2203
- !A.value && f.value.length === 0 ? (o(), x("div", ea, [
2212
+ !A.value && f.value.length === 0 ? (n(), x("div", en, [
2204
2213
  D(b.$slots, "empty", { sendMessage: ee }, () => [
2205
- k("div", ta, [
2214
+ k("div", tn, [
2206
2215
  O[3] || (O[3] = k("div", { class: "default-empty-badge" }, "AI", -1)),
2207
- k("h2", sa, "欢迎使用 " + H(s.assistantName), 1),
2216
+ k("h2", sn, "欢迎使用 " + H(s.assistantName), 1),
2208
2217
  O[4] || (O[4] = k("p", { class: "default-empty-desc" }, "请输入你的问题,开始一段新的对话。", -1))
2209
2218
  ])
2210
2219
  ], !0)
2211
- ])) : (o(), $(Ds, {
2220
+ ])) : (n(), $(Ls, {
2212
2221
  key: 1,
2213
2222
  messages: f.value,
2214
- "is-streaming": l.value === "streaming"
2223
+ "is-streaming": r.value === "streaming",
2224
+ theme: e.theme
2215
2225
  }, {
2216
2226
  custom: C(({ customContent: W }) => [
2217
2227
  D(b.$slots, "custom", {
2218
2228
  customContent: W,
2219
- threadId: r.value
2229
+ threadId: c.value
2220
2230
  }, () => [
2221
- (W == null ? void 0 : W.type) === "generated_files" ? (o(), $(Rn, {
2231
+ (W == null ? void 0 : W.type) === "generated_files" ? (n(), $(Ra, {
2222
2232
  key: 0,
2223
2233
  "custom-content": W,
2224
2234
  "api-url": e.apiUrl,
2225
- "thread-id": r.value
2235
+ "thread-id": c.value
2226
2236
  }, null, 8, ["custom-content", "api-url", "thread-id"])) : F("", !0)
2227
2237
  ], !0)
2228
2238
  ]),
2229
2239
  _: 3
2230
- }, 8, ["messages", "is-streaming"])),
2231
- I(Zn, {
2240
+ }, 8, ["messages", "is-streaming", "theme"])),
2241
+ I(Za, {
2232
2242
  "initial-todos": q.value,
2233
2243
  "tool-events": J.value,
2234
- "chat-status": l.value
2244
+ "chat-status": r.value
2235
2245
  }, null, 8, ["initial-todos", "tool-events", "chat-status"]),
2236
- I(Bn, {
2237
- status: l.value,
2246
+ I(Ba, {
2247
+ status: r.value,
2238
2248
  "current-model": V.value,
2239
2249
  models: X.value,
2240
2250
  suggestions: B.value,
@@ -2243,7 +2253,7 @@ const Ws = /* @__PURE__ */ S({
2243
2253
  "onUpdate:modelSelectorOpen": O[0] || (O[0] = (W) => w.value = W),
2244
2254
  onSubmit: E,
2245
2255
  onStop: te,
2246
- onSelectSuggestion: c,
2256
+ onSelectSuggestion: d,
2247
2257
  "onUpdate:currentModel": O[1] || (O[1] = (W) => V.value = W),
2248
2258
  "onUpdate:useWebSearch": O[2] || (O[2] = (W) => T.value = W)
2249
2259
  }, {
@@ -2252,13 +2262,13 @@ const Ws = /* @__PURE__ */ S({
2252
2262
  ]),
2253
2263
  _: 3
2254
2264
  }, 8, ["status", "current-model", "models", "suggestions", "use-web-search", "modelSelectorOpen"]),
2255
- A.value ? (o(), x("div", na, [
2256
- I(n(jn), { size: 24 })
2265
+ A.value ? (n(), x("div", an, [
2266
+ I(a(ja), { size: 24 })
2257
2267
  ])) : F("", !0)
2258
2268
  ], 2)
2259
- ]));
2269
+ ], 8, Qa));
2260
2270
  }
2261
- }), oa = /* @__PURE__ */ ce(aa, [["__scopeId", "data-v-d496ce13"]]), ra = { class: "icon-wrapper" }, ia = /* @__PURE__ */ S({
2271
+ }), on = /* @__PURE__ */ ue(nn, [["__scopeId", "data-v-61debb72"]]), rn = { class: "icon-wrapper" }, ln = /* @__PURE__ */ S({
2262
2272
  __name: "FloatButton",
2263
2273
  props: {
2264
2274
  isExpanded: { type: Boolean }
@@ -2266,14 +2276,14 @@ const Ws = /* @__PURE__ */ S({
2266
2276
  emits: ["toggle"],
2267
2277
  setup(s, { emit: t }) {
2268
2278
  const e = t;
2269
- return (a, i) => (o(), x("button", {
2279
+ return (o, i) => (n(), x("button", {
2270
2280
  class: G(["float-button", { expanded: s.isExpanded }]),
2271
- onClick: i[0] || (i[0] = (r) => e("toggle")),
2281
+ onClick: i[0] || (i[0] = (c) => e("toggle")),
2272
2282
  type: "button"
2273
2283
  }, [
2274
- k("span", ra, [
2275
- I(n(Yt), { class: "icon-svg" }),
2276
- I(n(Zt), {
2284
+ k("span", rn, [
2285
+ I(a(Yt), { class: "icon-svg" }),
2286
+ I(a(Zt), {
2277
2287
  size: 16,
2278
2288
  "stroke-width": 2,
2279
2289
  absoluteStrokeWidth: "",
@@ -2282,7 +2292,7 @@ const Ws = /* @__PURE__ */ S({
2282
2292
  ])
2283
2293
  ], 2));
2284
2294
  }
2285
- }), la = /* @__PURE__ */ ce(ia, [["__scopeId", "data-v-4f20ed22"]]), ua = { class: "ask-ai-bot" }, ca = /* @__PURE__ */ S({
2295
+ }), un = /* @__PURE__ */ ue(ln, [["__scopeId", "data-v-4f20ed22"]]), cn = ["data-ai-theme"], dn = /* @__PURE__ */ S({
2286
2296
  __name: "AskAiBot",
2287
2297
  props: {
2288
2298
  assistantId: { default: "research" },
@@ -2295,38 +2305,42 @@ const Ws = /* @__PURE__ */ S({
2295
2305
  apiUrl: { default: "http://localhost:2024" },
2296
2306
  apiKey: { default: void 0 },
2297
2307
  width: { default: 400 },
2298
- height: { default: "calc(100vh - 90px)" }
2308
+ height: { default: "calc(100vh - 90px)" },
2309
+ theme: { default: "light" }
2299
2310
  },
2300
2311
  setup(s) {
2301
- const t = s, e = M(t.defaultExpanded), a = M(!1), i = M(typeof t.width == "number" ? t.width : 500), r = M(!1);
2302
- function m() {
2303
- e.value = !e.value, e.value || (a.value = !1);
2312
+ const t = s, e = M(t.defaultExpanded), o = M(!1), i = M(typeof t.width == "number" ? t.width : 500), c = M(!1);
2313
+ function l() {
2314
+ e.value = !e.value, e.value || (o.value = !1);
2304
2315
  }
2305
- function l(A) {
2306
- a.value = A;
2316
+ function r(A) {
2317
+ o.value = A;
2307
2318
  }
2308
2319
  function v(A) {
2309
- A.preventDefault(), r.value = !0, document.addEventListener("mousemove", T), document.addEventListener("mouseup", w);
2320
+ A.preventDefault(), c.value = !0, document.addEventListener("mousemove", T), document.addEventListener("mouseup", w);
2310
2321
  }
2311
2322
  function T(A) {
2312
- if (!r.value) return;
2323
+ if (!c.value) return;
2313
2324
  const f = window.innerWidth - A.clientX - 20;
2314
2325
  i.value = Math.max(300, Math.min(1400, f));
2315
2326
  }
2316
2327
  function w() {
2317
- r.value = !1, document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", w);
2328
+ c.value = !1, document.removeEventListener("mousemove", T), document.removeEventListener("mouseup", w);
2318
2329
  }
2319
- return (A, f) => (o(), x("div", ua, [
2330
+ return (A, f) => (n(), x("div", {
2331
+ class: "ask-ai-bot",
2332
+ "data-ai-theme": t.theme
2333
+ }, [
2320
2334
  I(et, { name: "slide-up" }, {
2321
2335
  default: C(() => [
2322
2336
  we(k("div", {
2323
- class: G(["chat-window-container", { maximized: a.value }]),
2324
- style: tt(a.value ? {} : {
2337
+ class: G(["chat-window-container", { maximized: o.value }]),
2338
+ style: tt(o.value ? {} : {
2325
2339
  width: typeof t.width == "number" ? `${i.value}px` : t.width,
2326
2340
  height: typeof t.height == "number" ? `${t.height}px` : t.height
2327
2341
  })
2328
2342
  }, [
2329
- I(oa, {
2343
+ I(on, {
2330
2344
  "api-url": s.apiUrl,
2331
2345
  "api-key": s.apiKey,
2332
2346
  "assistant-id": s.assistantId,
@@ -2335,8 +2349,9 @@ const Ws = /* @__PURE__ */ S({
2335
2349
  "thread-id": s.threadId,
2336
2350
  "user-id": s.userId,
2337
2351
  suggestions: s.suggestions,
2338
- onClose: m,
2339
- "onUpdate:isMaximized": l
2352
+ theme: t.theme,
2353
+ onClose: l,
2354
+ "onUpdate:isMaximized": r
2340
2355
  }, {
2341
2356
  empty: C((B) => [
2342
2357
  D(A.$slots, "empty", xe(ke(B)), void 0, !0)
@@ -2348,8 +2363,8 @@ const Ws = /* @__PURE__ */ S({
2348
2363
  D(A.$slots, "attachment-trigger", xe(ke(B)), void 0, !0)
2349
2364
  ]),
2350
2365
  _: 3
2351
- }, 8, ["api-url", "api-key", "assistant-id", "assistant-name", "system-prompt", "thread-id", "user-id", "suggestions"]),
2352
- a.value ? F("", !0) : (o(), x("div", {
2366
+ }, 8, ["api-url", "api-key", "assistant-id", "assistant-name", "system-prompt", "thread-id", "user-id", "suggestions", "theme"]),
2367
+ o.value ? F("", !0) : (n(), x("div", {
2353
2368
  key: 0,
2354
2369
  class: "resize-handle",
2355
2370
  onMousedown: v
@@ -2360,15 +2375,15 @@ const Ws = /* @__PURE__ */ S({
2360
2375
  ]),
2361
2376
  _: 3
2362
2377
  }),
2363
- I(la, {
2378
+ I(un, {
2364
2379
  "is-expanded": e.value,
2365
- onToggle: m
2380
+ onToggle: l
2366
2381
  }, null, 8, ["is-expanded"])
2367
- ]));
2382
+ ], 8, cn));
2368
2383
  }
2369
- }), $a = /* @__PURE__ */ ce(ca, [["__scopeId", "data-v-3d2a9c69"]]);
2384
+ }), Cn = /* @__PURE__ */ ue(dn, [["__scopeId", "data-v-3fd99db6"]]);
2370
2385
  export {
2371
- $a as AskAiBot,
2372
- oa as ChatBot
2386
+ Cn as AskAiBot,
2387
+ on as ChatBot
2373
2388
  };
2374
2389
  //# sourceMappingURL=index.js.map