langgraph-vue3-chatbot 0.1.21 → 0.1.23

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