agent-tool-chat 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Pe = Object.defineProperty;
2
2
  var Te = (t, e, s) => e in t ? Pe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
3
  var K = (t, e, s) => Te(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { ref as W, onUnmounted as ze, computed as te, onMounted as Be, watch as le, defineComponent as F, openBlock as u, createElementBlock as x, createElementVNode as y, resolveComponent as P, toDisplayString as L, createCommentVNode as R, createBlock as D, resolveDynamicComponent as He, Fragment as G, renderList as X, createVNode as p, unref as S, withCtx as v, createTextVNode as O, normalizeClass as ie, withKeys as Ne, withDirectives as Ee, Transition as De, vShow as Fe, nextTick as je } from "vue";
5
- import { ElTable as Oe, ElTableColumn as _e, ElMessageBox as Ue } from "element-plus";
4
+ import { ref as W, onUnmounted as ze, computed as te, onMounted as Be, watch as ie, defineComponent as F, openBlock as i, createElementBlock as x, createElementVNode as y, resolveComponent as P, toDisplayString as L, createCommentVNode as R, createBlock as D, resolveDynamicComponent as He, Fragment as G, renderList as X, createVNode as p, unref as S, withCtx as v, createTextVNode as O, normalizeClass as re, withKeys as Ne, withDirectives as Ee, Transition as De, vShow as Fe, nextTick as je } from "vue";
5
+ import { ElTable as Oe, ElTableColumn as ve, ElMessageBox as Ue } from "element-plus";
6
6
  class Re {
7
7
  constructor(e) {
8
8
  K(this, "messages", []);
@@ -36,8 +36,8 @@ class Re {
36
36
  const s = e.trim();
37
37
  if (!s || this._loading) return;
38
38
  this._loading = !0, this.abortController = new AbortController(), this.emit({ type: "status", loading: !0 });
39
- const i = { role: "user", content: s };
40
- this.messages.push(i), this.emit({ type: "message", message: i });
39
+ const r = { role: "user", content: s };
40
+ this.messages.push(r), this.emit({ type: "message", message: r });
41
41
  try {
42
42
  let l = 0;
43
43
  const _ = this.config.maxToolRounds;
@@ -45,7 +45,7 @@ class Re {
45
45
  l++;
46
46
  const b = { role: "assistant", content: "" };
47
47
  this.messages.push(b), this.emit({ type: "message", message: b });
48
- const a = this.buildApiMessages(), r = await this.config.provider.streamChat({
48
+ const a = this.buildApiMessages(), c = await this.config.provider.streamChat({
49
49
  config: this.config.providerConfig,
50
50
  messages: a,
51
51
  tools: this.config.tools.getDefinitions(),
@@ -57,9 +57,9 @@ class Re {
57
57
  this.emit({ type: "stream:delta", delta: { reasoning: h } });
58
58
  }
59
59
  });
60
- if (b.content = r.content, this.emit({ type: "stream:end", content: r.content, reasoning: r.reasoning }), r.tool_calls.length > 0) {
61
- b.tool_calls = r.tool_calls;
62
- for (const h of r.tool_calls) {
60
+ if (b.content = c.content, this.emit({ type: "stream:end", content: c.content, reasoning: c.reasoning }), c.tool_calls.length > 0) {
61
+ b.tool_calls = c.tool_calls;
62
+ for (const h of c.tool_calls) {
63
63
  this.emit({ type: "tool:start", call: h });
64
64
  const m = await this.config.tools.execute(h.function.name, h.function.arguments);
65
65
  this.emit({ type: "tool:end", call: h, output: m }), this.messages.push({
@@ -90,8 +90,8 @@ class Re {
90
90
  (e = this.abortController) == null || e.abort();
91
91
  }
92
92
  buildApiMessages() {
93
- const e = this.messages, i = e.length > 0 && e[e.length - 1].role === "assistant" && e[e.length - 1].content === "" && !e[e.length - 1].tool_calls ? e.slice(0, -1) : e;
94
- return this.config.systemPrompt ? [{ role: "system", content: this.config.systemPrompt }, ...i] : [...i];
93
+ const e = this.messages, r = e.length > 0 && e[e.length - 1].role === "assistant" && e[e.length - 1].content === "" && !e[e.length - 1].tool_calls ? e.slice(0, -1) : e;
94
+ return this.config.systemPrompt ? [{ role: "system", content: this.config.systemPrompt }, ...r] : [...r];
95
95
  }
96
96
  }
97
97
  class Ke {
@@ -110,11 +110,11 @@ class Ke {
110
110
  return [...this._definitions];
111
111
  }
112
112
  async execute(e, s) {
113
- const i = this._handlers.get(e);
114
- if (!i) return { success: !1, result: `未知工具:${e}` };
113
+ const r = this._handlers.get(e);
114
+ if (!r) return { success: !1, result: `未知工具:${e}` };
115
115
  try {
116
116
  const o = s ? JSON.parse(s) : {};
117
- return await i(o);
117
+ return await r(o);
118
118
  } catch (o) {
119
119
  return { success: !1, result: `工具执行异常:${(o == null ? void 0 : o.message) || String(o)}` };
120
120
  }
@@ -129,15 +129,15 @@ function Je() {
129
129
  async streamChat(t) {
130
130
  var g;
131
131
  const {
132
- config: { baseUrl: e, apiKey: s, model: i, temperature: o },
132
+ config: { baseUrl: e, apiKey: s, model: r, temperature: o },
133
133
  messages: l,
134
134
  tools: _,
135
135
  signal: b,
136
136
  onContent: a,
137
- onReasoning: r
137
+ onReasoning: c
138
138
  } = t;
139
139
  if (!s) throw new Error("未配置 API Key");
140
- const h = `${Le(e)}/chat/completions`, m = { model: i, messages: l, stream: !0 };
140
+ const h = `${Le(e)}/chat/completions`, m = { model: r, messages: l, stream: !0 };
141
141
  typeof o == "number" && (m.temperature = o), _ != null && _.length && (m.tools = _, m.tool_choice = "auto");
142
142
  const $ = await fetch(h, {
143
143
  method: "POST",
@@ -157,8 +157,8 @@ function Je() {
157
157
  }
158
158
  throw new Error(f);
159
159
  }
160
- const H = $.body.getReader(), I = new TextDecoder("utf-8");
161
- let A = "", w = "", T = "", z = "stop";
160
+ const H = $.body.getReader(), A = new TextDecoder("utf-8");
161
+ let I = "", k = "", T = "", z = "stop";
162
162
  const j = /* @__PURE__ */ new Map(), J = (f) => {
163
163
  if (!f) return;
164
164
  const d = f.index ?? 0;
@@ -170,17 +170,17 @@ function Je() {
170
170
  const d = (E = f == null ? void 0 : f.choices) == null ? void 0 : E[0];
171
171
  if (!d) return;
172
172
  const V = d.delta || {};
173
- typeof V.content == "string" && V.content && (w += V.content, a == null || a(V.content)), typeof V.reasoning_content == "string" && V.reasoning_content && (T += V.reasoning_content, r == null || r(V.reasoning_content)), Array.isArray(V.tool_calls) && V.tool_calls.forEach((Y) => J(Y)), d.finish_reason && (z = d.finish_reason);
173
+ typeof V.content == "string" && V.content && (k += V.content, a == null || a(V.content)), typeof V.reasoning_content == "string" && V.reasoning_content && (T += V.reasoning_content, c == null || c(V.reasoning_content)), Array.isArray(V.tool_calls) && V.tool_calls.forEach((Y) => J(Y)), d.finish_reason && (z = d.finish_reason);
174
174
  };
175
175
  for (; ; ) {
176
176
  const { done: f, value: d } = await H.read();
177
177
  if (f) break;
178
- A += I.decode(d, { stream: !0 });
178
+ I += A.decode(d, { stream: !0 });
179
179
  let V;
180
- for (; (V = A.indexOf(`
180
+ for (; (V = I.indexOf(`
181
181
  `)) !== -1; ) {
182
- const E = A.slice(0, V).replace(/\r$/, "").trim();
183
- if (A = A.slice(V + 1), !E || E.startsWith(":") || !E.startsWith("data:")) continue;
182
+ const E = I.slice(0, V).replace(/\r$/, "").trim();
183
+ if (I = I.slice(V + 1), !E || E.startsWith(":") || !E.startsWith("data:")) continue;
184
184
  const Y = E.slice(5).trim();
185
185
  if (Y === "[DONE]") return N();
186
186
  try {
@@ -192,7 +192,7 @@ function Je() {
192
192
  return N();
193
193
  function N() {
194
194
  const f = Array.from(j.values()).filter((d) => d.function.name);
195
- return { content: w, reasoning: T, tool_calls: f, finish_reason: z };
195
+ return { content: k, reasoning: T, tool_calls: f, finish_reason: z };
196
196
  }
197
197
  }
198
198
  };
@@ -202,15 +202,15 @@ function We() {
202
202
  async streamChat(t) {
203
203
  var N;
204
204
  const {
205
- config: { baseUrl: e, model: s, temperature: i },
205
+ config: { baseUrl: e, model: s, temperature: r },
206
206
  messages: o,
207
207
  tools: l,
208
208
  signal: _,
209
209
  onContent: b,
210
210
  onReasoning: a
211
- } = t, r = `${e.trim().replace(/\/+$/, "")}`, h = { model: s, messages: o, stream: !0 };
212
- typeof i == "number" && (h.temperature = i), l != null && l.length && (h.tools = l, h.tool_choice = "auto");
213
- const m = await fetch(r, {
211
+ } = t, c = `${e.trim().replace(/\/+$/, "")}`, h = { model: s, messages: o, stream: !0 };
212
+ typeof r == "number" && (h.temperature = r), l != null && l.length && (h.tools = l, h.tool_choice = "auto");
213
+ const m = await fetch(c, {
214
214
  method: "POST",
215
215
  headers: { "Content-Type": "application/json" },
216
216
  body: JSON.stringify(h),
@@ -226,7 +226,7 @@ function We() {
226
226
  throw new Error(g);
227
227
  }
228
228
  const $ = m.body.getReader(), H = new TextDecoder("utf-8");
229
- let I = "", A = "", w = "", T = "stop";
229
+ let A = "", I = "", k = "", T = "stop";
230
230
  const z = /* @__PURE__ */ new Map(), j = (g) => {
231
231
  if (!g) return;
232
232
  const f = g.index ?? 0;
@@ -238,17 +238,17 @@ function We() {
238
238
  const f = (V = g == null ? void 0 : g.choices) == null ? void 0 : V[0];
239
239
  if (!f) return;
240
240
  const d = f.delta || {};
241
- typeof d.content == "string" && d.content && (A += d.content, b == null || b(d.content)), typeof d.reasoning_content == "string" && d.reasoning_content && (w += d.reasoning_content, a == null || a(d.reasoning_content)), Array.isArray(d.tool_calls) && d.tool_calls.forEach((E) => j(E)), f.finish_reason && (T = f.finish_reason);
241
+ typeof d.content == "string" && d.content && (I += d.content, b == null || b(d.content)), typeof d.reasoning_content == "string" && d.reasoning_content && (k += d.reasoning_content, a == null || a(d.reasoning_content)), Array.isArray(d.tool_calls) && d.tool_calls.forEach((E) => j(E)), f.finish_reason && (T = f.finish_reason);
242
242
  };
243
243
  for (; ; ) {
244
244
  const { done: g, value: f } = await $.read();
245
245
  if (g) break;
246
- I += H.decode(f, { stream: !0 });
246
+ A += H.decode(f, { stream: !0 });
247
247
  let d;
248
- for (; (d = I.indexOf(`
248
+ for (; (d = A.indexOf(`
249
249
  `)) !== -1; ) {
250
- const V = I.slice(0, d).replace(/\r$/, "").trim();
251
- if (I = I.slice(d + 1), !V || V.startsWith(":") || !V.startsWith("data:")) continue;
250
+ const V = A.slice(0, d).replace(/\r$/, "").trim();
251
+ if (A = A.slice(d + 1), !V || V.startsWith(":") || !V.startsWith("data:")) continue;
252
252
  const E = V.slice(5).trim();
253
253
  if (E === "[DONE]") return U();
254
254
  try {
@@ -260,15 +260,15 @@ function We() {
260
260
  return U();
261
261
  function U() {
262
262
  const g = Array.from(z.values()).filter((f) => f.function.name);
263
- return { content: A, reasoning: w, tool_calls: g, finish_reason: T };
263
+ return { content: I, reasoning: k, tool_calls: g, finish_reason: T };
264
264
  }
265
265
  }
266
266
  };
267
267
  }
268
268
  function qe(t) {
269
- var s, i, o, l, _;
269
+ var s, r, o, l, _;
270
270
  const e = [];
271
- return (s = t.displayHints) != null && s.suggestComponent && e.push(`展示建议: 使用 ${t.displayHints.suggestComponent} 组件`), (i = t.displayHints) != null && i.resultFormat && e.push(`格式: ${t.displayHints.resultFormat}`), (l = (o = t.displayHints) == null ? void 0 : o.previewFields) != null && l.length && e.push(`预览字段: ${t.displayHints.previewFields.join(", ")}`), (_ = t.displayHints) != null && _.summaryTemplate && e.push(`概要模板: ${t.displayHints.summaryTemplate}`), e.length ? e.join(" | ") : "";
271
+ return (s = t.displayHints) != null && s.suggestComponent && e.push(`展示建议: 使用 ${t.displayHints.suggestComponent} 组件`), (r = t.displayHints) != null && r.resultFormat && e.push(`格式: ${t.displayHints.resultFormat}`), (l = (o = t.displayHints) == null ? void 0 : o.previewFields) != null && l.length && e.push(`预览字段: ${t.displayHints.previewFields.join(", ")}`), (_ = t.displayHints) != null && _.summaryTemplate && e.push(`概要模板: ${t.displayHints.summaryTemplate}`), e.length ? e.join(" | ") : "";
272
272
  }
273
273
  function Ge(t) {
274
274
  const e = [
@@ -279,9 +279,9 @@ function Ge(t) {
279
279
  ];
280
280
  for (const s of t) {
281
281
  e.push(`【${s.name}】${s.description}`);
282
- for (const i of s.tools) {
283
- const o = qe(i);
284
- e.push(` - ${i.name}: ${i.description}`), o && e.push(` ${o}`);
282
+ for (const r of s.tools) {
283
+ const o = qe(r);
284
+ e.push(` - ${r.name}: ${r.description}`), o && e.push(` ${o}`);
285
285
  }
286
286
  e.push("");
287
287
  }
@@ -290,13 +290,13 @@ function Ge(t) {
290
290
  }
291
291
  function zs(t, e, s) {
292
292
  var l;
293
- let i = null;
293
+ let r = null;
294
294
  if (t.type === "component" && t.componentName) {
295
295
  let _;
296
- t.packageId && (_ = e.find((b) => b.id === t.packageId)), !_ && s && (_ = e.find((b) => b.id === s)), (l = _ == null ? void 0 : _.components) != null && l[t.componentName] && (i = _.components[t.componentName]);
296
+ t.packageId && (_ = e.find((b) => b.id === t.packageId)), !_ && s && (_ = e.find((b) => b.id === s)), (l = _ == null ? void 0 : _.components) != null && l[t.componentName] && (r = _.components[t.componentName]);
297
297
  }
298
298
  const o = Ye(t);
299
- return { component: i, block: t, fallbackText: o };
299
+ return { component: r, block: t, fallbackText: o };
300
300
  }
301
301
  function Ye(t) {
302
302
  switch (t.type) {
@@ -310,41 +310,41 @@ function Ye(t) {
310
310
  return JSON.stringify(t.data, null, 2);
311
311
  }
312
312
  }
313
- function re(t) {
313
+ function ce(t) {
314
314
  return t == null ? null : Array.isArray(t) ? t : typeof t != "object" ? null : Array.isArray(t.data) ? t.data : Array.isArray(t.list) ? t.list : Array.isArray(t.items) ? t.items : [t];
315
315
  }
316
316
  function Xe(t) {
317
- const e = re(t.data);
317
+ const e = ce(t.data);
318
318
  if (!(e != null && e.length)) return "(无数据)";
319
319
  const s = t.title ? `**${t.title}**
320
320
 
321
- ` : "", i = Object.keys(e[0]), o = `| ${i.join(" | ")} |`, l = `| ${i.map(() => "---").join(" | ")} |`, _ = e.map((b) => `| ${i.map((a) => String(b[a] ?? "")).join(" | ")} |`).join(`
321
+ ` : "", r = Object.keys(e[0]), o = `| ${r.join(" | ")} |`, l = `| ${r.map(() => "---").join(" | ")} |`, _ = e.map((b) => `| ${r.map((a) => String(b[a] ?? "")).join(" | ")} |`).join(`
322
322
  `);
323
323
  return `${s}${o}
324
324
  ${l}
325
325
  ${_}`;
326
326
  }
327
327
  function Qe(t) {
328
- const e = re(t.data);
328
+ const e = ce(t.data);
329
329
  if (!(e != null && e.length)) return "(无数据)";
330
330
  const s = t.title ? `**${t.title}**
331
331
 
332
- ` : "", i = e.map((o) => Object.entries(o).map(([_, b]) => `- **${_}**: ${b}`).join(`
332
+ ` : "", r = e.map((o) => Object.entries(o).map(([_, b]) => `- **${_}**: ${b}`).join(`
333
333
  `)).join(`
334
334
 
335
335
  ---
336
336
 
337
337
  `);
338
- return `${s}${i}`;
338
+ return `${s}${r}`;
339
339
  }
340
340
  function Ze(t) {
341
- const e = re(t.data);
341
+ const e = ce(t.data);
342
342
  if (!(e != null && e.length)) return "(无数据)";
343
343
  const s = t.title ? `**${t.title}**
344
344
 
345
- ` : "", i = e.map((o) => `- ${typeof o == "string" ? o : Object.values(o).join(" - ")}`).join(`
345
+ ` : "", r = e.map((o) => `- ${typeof o == "string" ? o : Object.values(o).join(" - ")}`).join(`
346
346
  `);
347
- return `${s}${i}`;
347
+ return `${s}${r}`;
348
348
  }
349
349
  class et {
350
350
  constructor() {
@@ -359,9 +359,9 @@ class et {
359
359
  return typeof e == "string" ? (this.exactHandlers.has(e) || this.exactHandlers.set(e, /* @__PURE__ */ new Set()), this.exactHandlers.get(e).add(s), () => this.off(e, s)) : (this.regexHandlers.push({ pattern: e, handler: s }), () => this.off(e, s));
360
360
  }
361
361
  off(e, s) {
362
- var i;
362
+ var r;
363
363
  if (typeof e == "string") {
364
- (i = this.exactHandlers.get(e)) == null || i.delete(s);
364
+ (r = this.exactHandlers.get(e)) == null || r.delete(s);
365
365
  return;
366
366
  }
367
367
  this.regexHandlers = this.regexHandlers.filter(
@@ -369,9 +369,9 @@ class et {
369
369
  );
370
370
  }
371
371
  dispatch(e, s = !1) {
372
- var i;
372
+ var r;
373
373
  if (!(s && !this.isChatOpen())) {
374
- (i = this.exactHandlers.get(e.type)) == null || i.forEach((o) => o(e));
374
+ (r = this.exactHandlers.get(e.type)) == null || r.forEach((o) => o(e));
375
375
  for (const { pattern: o, handler: l } of this.regexHandlers)
376
376
  o.test(e.type) && l(e);
377
377
  }
@@ -393,12 +393,12 @@ class st {
393
393
  }
394
394
  start(e) {
395
395
  for (const s of this.rules) {
396
- const i = this.bus.on(s.event, (o) => {
396
+ const r = this.bus.on(s.event, (o) => {
397
397
  if (this.isOnCooldown(s) || (this.setCooldown(s), s.autoPopup && e.onAutoPopup(), s.action === "silent")) return;
398
398
  const l = this.buildPrompt(s, o);
399
399
  l && e.onRespond(l);
400
400
  });
401
- this.unsubscribers.push(i);
401
+ this.unsubscribers.push(r);
402
402
  }
403
403
  }
404
404
  stop() {
@@ -411,8 +411,8 @@ class st {
411
411
  }
412
412
  isOnCooldown(e) {
413
413
  if (!e.cooldown) return !1;
414
- const s = typeof e.event == "string" ? e.event : e.event.source, i = this.cooldowns.get(s);
415
- return i ? Date.now() < i : !1;
414
+ const s = typeof e.event == "string" ? e.event : e.event.source, r = this.cooldowns.get(s);
415
+ return r ? Date.now() < r : !1;
416
416
  }
417
417
  setCooldown(e) {
418
418
  if (!e.cooldown) return;
@@ -420,13 +420,13 @@ class st {
420
420
  this.cooldowns.set(s, Date.now() + e.cooldown);
421
421
  }
422
422
  buildPrompt(e, s) {
423
- return e.prompt ? e.prompt.replace(/\{\{payload\.([^}]+)\}\}/g, (i, o) => {
423
+ return e.prompt ? e.prompt.replace(/\{\{payload\.([^}]+)\}\}/g, (r, o) => {
424
424
  const l = s.payload[o];
425
425
  return l !== void 0 ? String(l) : `{{payload.${o}}}`;
426
426
  }) : "";
427
427
  }
428
428
  }
429
- const ve = {
429
+ const ye = {
430
430
  apiKey: "",
431
431
  baseUrl: "https://api.deepseek.com",
432
432
  model: "deepseek-chat",
@@ -444,43 +444,43 @@ function nt(t) {
444
444
  }
445
445
  };
446
446
  }
447
- function ue() {
447
+ function de() {
448
448
  return `m_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
449
449
  }
450
450
  function ot() {
451
451
  let t = [], e = "0123456789abcdef";
452
- for (let i = 0; i < 36; i++)
453
- t[i] = e.substr(Math.floor(Math.random() * 16), 1);
452
+ for (let r = 0; r < 36; r++)
453
+ t[r] = e.substr(Math.floor(Math.random() * 16), 1);
454
454
  return t[14] = "4", t[19] = e.substr(t[19] & 3 | 8, 1), t[8] = t[13] = t[18] = t[23] = "-", t.join("");
455
455
  }
456
- const ye = "agent_chat_device_id";
457
- function ae() {
458
- let t = localStorage.getItem(ye);
459
- return t || (t = ot(), localStorage.setItem(ye, t)), t;
456
+ const xe = "agent_chat_device_id";
457
+ function le() {
458
+ let t = localStorage.getItem(xe);
459
+ return t || (t = ot(), localStorage.setItem(xe, t)), t;
460
460
  }
461
- function de(t) {
461
+ function pe(t) {
462
462
  try {
463
463
  return new URL(t).origin;
464
464
  } catch {
465
465
  return "";
466
466
  }
467
467
  }
468
- function pe(t) {
468
+ function me(t) {
469
469
  const e = [];
470
470
  for (const s of t)
471
471
  if (s.role === "user")
472
472
  e.push({ role: "user", content: s.content });
473
473
  else if (s.role === "assistant" && (e.push({ role: "assistant", content: s.content, tool_calls: s.tool_calls }), s.toolResults))
474
- for (const i of s.toolResults)
475
- e.push({ role: "tool", tool_call_id: i.callId, content: i.result, name: i.name });
474
+ for (const r of s.toolResults)
475
+ e.push({ role: "tool", tool_call_id: r.callId, content: r.result, name: r.name });
476
476
  return e;
477
477
  }
478
478
  function Bs(t) {
479
- var fe, ge;
479
+ var ge, he;
480
480
  const {
481
481
  toolPackages: e,
482
482
  onToolCall: s,
483
- provider: i,
483
+ provider: r,
484
484
  providerConfig: o,
485
485
  systemPrompt: l,
486
486
  storagePrefix: _ = "agent_chat_",
@@ -488,29 +488,29 @@ function Bs(t) {
488
488
  } = t, a = {
489
489
  messages: `${_}messages`,
490
490
  settings: `${_}settings`
491
- }, r = W([]), h = W({ ...ve }), m = W(!1), $ = W(""), H = /* @__PURE__ */ new Map(), I = W(!1);
492
- let A = null;
493
- const w = ((fe = t.businessEvents) == null ? void 0 : fe.bus) || tt();
494
- w.setChatOpenGetter(() => I.value), (ge = t.businessEvents) != null && ge.rules.length && (A = new st(w, t.businessEvents.rules), A.start({
491
+ }, c = W([]), h = W({ ...ye }), m = W(!1), $ = W(""), H = /* @__PURE__ */ new Map(), A = W(!1);
492
+ let I = null;
493
+ const k = ((ge = t.businessEvents) == null ? void 0 : ge.bus) || tt();
494
+ k.setChatOpenGetter(() => A.value), (he = t.businessEvents) != null && he.rules.length && (I = new st(k, t.businessEvents.rules), I.start({
495
495
  onAutoPopup: () => {
496
- I.value = !0;
496
+ A.value = !0;
497
497
  },
498
498
  onRespond: (n) => {
499
- $.value = "", !(!h.value.apiKey && h.value.providerMode !== "proxy") && me(n);
499
+ $.value = "", !(!h.value.apiKey && h.value.providerMode !== "proxy") && fe(n);
500
500
  }
501
501
  })), ze(() => {
502
- A == null || A.stop(), Y();
502
+ I == null || I.stop(), Y();
503
503
  });
504
504
  const T = new Ke();
505
505
  for (const n of e)
506
506
  for (const C of n.tools) {
507
507
  const M = nt(C);
508
- T.register(M, async (c) => {
509
- const k = { packageId: n.id, toolName: C.name, args: c };
510
- return await d(k, n, C);
508
+ T.register(M, async (u) => {
509
+ const w = { packageId: n.id, toolName: C.name, args: u };
510
+ return await d(w, n, C);
511
511
  });
512
512
  }
513
- const z = Je(), j = We(), J = i || {
513
+ const z = Je(), j = We(), J = r || {
514
514
  streamChat(n) {
515
515
  return (h.value.providerMode === "proxy" ? j : z).streamChat(n);
516
516
  }
@@ -540,66 +540,66 @@ function Bs(t) {
540
540
  let g = null;
541
541
  const f = [];
542
542
  async function d(n, C, M) {
543
- const c = {
543
+ const u = {
544
544
  toolCallId: `${Date.now()}_${Math.random().toString(36).slice(2, 6)}`,
545
545
  packageId: n.packageId,
546
546
  toolName: n.toolName,
547
547
  args: n.args
548
548
  };
549
549
  try {
550
- const k = await s(c);
551
- return g = { pkg: C, toolDef: M, data: k, args: n.args }, { success: !0, result: typeof k == "string" ? k : JSON.stringify(k) };
552
- } catch (k) {
553
- return { success: !1, result: (k == null ? void 0 : k.message) || "工具执行失败" };
550
+ const w = await s(u);
551
+ return g = { pkg: C, toolDef: M, data: w, args: n.args }, { success: !0, result: typeof w == "string" ? w : JSON.stringify(w) };
552
+ } catch (w) {
553
+ return { success: !1, result: (w == null ? void 0 : w.message) || "工具执行失败" };
554
554
  }
555
555
  }
556
556
  function V() {
557
- var he;
557
+ var _e;
558
558
  if (!g) return;
559
- const { pkg: n, toolDef: C, data: M, args: c } = g, k = C.displayHints;
560
- if (!k) return;
561
- const B = r.value[r.value.length - 1];
559
+ const { pkg: n, toolDef: C, data: M, args: u } = g, w = C.displayHints;
560
+ if (!w) return;
561
+ const B = c.value[c.value.length - 1];
562
562
  if (!(!B || B.role !== "assistant")) {
563
- if (k.suggestComponent) {
563
+ if (w.suggestComponent) {
564
564
  let q = M;
565
- if ((he = M == null ? void 0 : M.data) != null && he.fileId) {
565
+ if ((_e = M == null ? void 0 : M.data) != null && _e.fileId) {
566
566
  const ne = H.get(M.data.fileId);
567
567
  ne && (q = ne.name.endsWith(".geojson") || ne.name.endsWith(".json") ? { data: { wkt: "", geojson: ne.data } } : { data: { wkt: ne.data, geojson: "" } });
568
568
  }
569
569
  B.renderBlocks = [{
570
570
  type: "component",
571
571
  packageId: n.id,
572
- componentName: k.suggestComponent,
572
+ componentName: w.suggestComponent,
573
573
  data: q
574
574
  }], console.log("resolvedData===", q);
575
- } else if (k.resultFormat === "table" || k.resultFormat === "card" || k.resultFormat === "list") {
576
- const q = re(M);
575
+ } else if (w.resultFormat === "table" || w.resultFormat === "card" || w.resultFormat === "list") {
576
+ const q = ce(M);
577
577
  q != null && q.length && (B.renderBlocks = [{
578
- type: k.resultFormat,
579
- title: ee(k.summaryTemplate, c),
578
+ type: w.resultFormat,
579
+ title: Z(w.summaryTemplate, u),
580
580
  data: q,
581
- fields: k.previewFields,
582
- labelField: k.labelField,
583
- selectable: k.selectable
581
+ fields: w.previewFields,
582
+ labelField: w.labelField,
583
+ selectable: w.selectable
584
584
  }]);
585
585
  }
586
- if (k.suggestedNext)
587
- if (k.suggestedNextEvent) {
588
- const q = k.suggestedNextEvent, ne = w.on(q, () => E(q));
589
- f.push({ event: q, text: k.suggestedNext, unsub: ne });
586
+ if (w.suggestedNext)
587
+ if (w.suggestedNextEvent) {
588
+ const q = w.suggestedNextEvent, ne = k.on(q, () => E(q));
589
+ f.push({ event: q, text: w.suggestedNext, unsub: ne });
590
590
  } else
591
- B.suggestedNext = k.suggestedNext;
591
+ B.suggestedNext = w.suggestedNext;
592
592
  }
593
593
  }
594
594
  function E(n) {
595
- const C = f.findIndex((c) => c.event === n);
595
+ const C = f.findIndex((u) => u.event === n);
596
596
  if (C === -1) return;
597
597
  const M = f[C];
598
598
  M.unsub(), f.splice(C, 1);
599
- for (let c = r.value.length - 1; c >= 0; c--) {
600
- const k = r.value[c];
601
- if (k.role === "assistant") {
602
- k.suggestedNext = M.text;
599
+ for (let u = c.value.length - 1; u >= 0; u--) {
600
+ const w = c.value[u];
601
+ if (w.role === "assistant") {
602
+ w.suggestedNext = M.text;
603
603
  break;
604
604
  }
605
605
  }
@@ -609,9 +609,9 @@ function Bs(t) {
609
609
  n.unsub();
610
610
  f.length = 0;
611
611
  }
612
- function ee(n, C) {
612
+ function Z(n, C) {
613
613
  if (n)
614
- return n.replace(/\{(\w+)\}/g, (M, c) => C[c] !== void 0 ? String(C[c]) : M);
614
+ return n.replace(/\{(\w+)\}/g, (M, u) => C[u] !== void 0 ? String(C[u]) : M);
615
615
  }
616
616
  const Q = /* @__PURE__ */ new Map();
617
617
  N.on((n) => {
@@ -619,8 +619,8 @@ function Bs(t) {
619
619
  switch (n.type) {
620
620
  case "message": {
621
621
  if (n.message.role === "tool") break;
622
- const c = {
623
- id: ue(),
622
+ const u = {
623
+ id: de(),
624
624
  role: n.message.role,
625
625
  content: n.message.content,
626
626
  reasoning: "",
@@ -628,32 +628,32 @@ function Bs(t) {
628
628
  timestamp: Date.now(),
629
629
  tool_calls: n.message.tool_calls
630
630
  };
631
- r.value.push(c);
631
+ c.value.push(u);
632
632
  break;
633
633
  }
634
634
  case "stream:delta": {
635
- const c = r.value[r.value.length - 1];
636
- (c == null ? void 0 : c.role) === "assistant" && c.status === "streaming" && (n.delta.content && (c.content += n.delta.content), n.delta.reasoning && (c.reasoning = (c.reasoning || "") + n.delta.reasoning));
635
+ const u = c.value[c.value.length - 1];
636
+ (u == null ? void 0 : u.role) === "assistant" && u.status === "streaming" && (n.delta.content && (u.content += n.delta.content), n.delta.reasoning && (u.reasoning = (u.reasoning || "") + n.delta.reasoning));
637
637
  break;
638
638
  }
639
639
  case "stream:end": {
640
- const c = r.value[r.value.length - 1];
641
- (c == null ? void 0 : c.role) === "assistant" && (c.content = n.content, n.reasoning && (c.reasoning = n.reasoning));
640
+ const u = c.value[c.value.length - 1];
641
+ (u == null ? void 0 : u.role) === "assistant" && (u.content = n.content, n.reasoning && (u.reasoning = n.reasoning));
642
642
  break;
643
643
  }
644
644
  case "tool:start": {
645
- const c = r.value[r.value.length - 1];
646
- if (!c || c.role !== "assistant") break;
647
- c.tool_calls || (c.tool_calls = []), c.toolResults || (c.toolResults = []);
648
- const k = c.toolResults.length;
649
- c.toolResults.push({
645
+ const u = c.value[c.value.length - 1];
646
+ if (!u || u.role !== "assistant") break;
647
+ u.tool_calls || (u.tool_calls = []), u.toolResults || (u.toolResults = []);
648
+ const w = u.toolResults.length;
649
+ u.toolResults.push({
650
650
  callId: n.call.id,
651
651
  name: n.call.function.name,
652
652
  arguments: n.call.function.arguments,
653
653
  result: "",
654
654
  success: !1,
655
655
  status: "running"
656
- }), Q.set(n.call.id, { msgIndex: r.value.length - 1, toolIndex: k }), c.tool_calls.find((B) => B.id === n.call.id) || c.tool_calls.push({
656
+ }), Q.set(n.call.id, { msgIndex: c.value.length - 1, toolIndex: w }), u.tool_calls.find((B) => B.id === n.call.id) || u.tool_calls.push({
657
657
  id: n.call.id,
658
658
  type: "function",
659
659
  function: {
@@ -664,49 +664,49 @@ function Bs(t) {
664
664
  break;
665
665
  }
666
666
  case "tool:end": {
667
- const c = Q.get(n.call.id);
668
- if (!c) break;
669
- const k = (M = (C = r.value[c.msgIndex]) == null ? void 0 : C.toolResults) == null ? void 0 : M[c.toolIndex];
670
- k && (k.result = n.output.result, k.success = n.output.success, k.status = n.output.success ? "success" : "error"), Q.delete(n.call.id);
667
+ const u = Q.get(n.call.id);
668
+ if (!u) break;
669
+ const w = (M = (C = c.value[u.msgIndex]) == null ? void 0 : C.toolResults) == null ? void 0 : M[u.toolIndex];
670
+ w && (w.result = n.output.result, w.success = n.output.success, w.status = n.output.success ? "success" : "error"), Q.delete(n.call.id);
671
671
  break;
672
672
  }
673
673
  case "error": {
674
674
  $.value = n.error;
675
- const c = r.value[r.value.length - 1];
676
- (c == null ? void 0 : c.role) === "assistant" && (c.status = "error", c.error = n.error);
675
+ const u = c.value[c.value.length - 1];
676
+ (u == null ? void 0 : u.role) === "assistant" && (u.status = "error", u.error = n.error);
677
677
  break;
678
678
  }
679
679
  case "status": {
680
680
  if (m.value = n.loading, !n.loading) {
681
- const c = r.value[r.value.length - 1];
682
- (c == null ? void 0 : c.role) === "assistant" && c.status === "streaming" && (c.status = "done", c.content || (c.content = "(已停止生成)")), V();
681
+ const u = c.value[c.value.length - 1];
682
+ (u == null ? void 0 : u.role) === "assistant" && u.status === "streaming" && (u.status = "done", u.content || (u.content = "(已停止生成)")), V();
683
683
  }
684
684
  break;
685
685
  }
686
686
  }
687
687
  });
688
- function ce() {
688
+ function ue() {
689
689
  try {
690
690
  const n = localStorage.getItem(a.settings);
691
- n && (h.value = { ...ve, ...JSON.parse(n) });
691
+ n && (h.value = { ...ye, ...JSON.parse(n) });
692
692
  } catch {
693
693
  }
694
694
  }
695
- function Z(n) {
695
+ function ae(n) {
696
696
  for (const C of n)
697
697
  if (C.files)
698
698
  for (const M of C.files)
699
699
  M.id && H.set(M.id, M);
700
700
  }
701
- async function we() {
701
+ async function ee() {
702
702
  if (h.value.providerMode === "proxy") {
703
703
  try {
704
- const n = de(h.value.proxyUrl);
704
+ const n = pe(h.value.proxyUrl);
705
705
  if (!n) return;
706
- const C = await fetch(`${n}/api/messages?device_id=${encodeURIComponent(ae())}`);
706
+ const C = await fetch(`${n}/api/messages?device_id=${encodeURIComponent(le())}`);
707
707
  if (!C.ok) return;
708
- const M = await C.json(), c = M == null ? void 0 : M.messages;
709
- Array.isArray(c) && (r.value = c, Z(c), N.initialize(pe(c)));
708
+ const M = await C.json(), u = M == null ? void 0 : M.messages;
709
+ Array.isArray(u) && (c.value = u, ae(u), N.initialize(me(u)));
710
710
  } catch {
711
711
  }
712
712
  return;
@@ -715,12 +715,12 @@ function Bs(t) {
715
715
  const n = localStorage.getItem(a.messages);
716
716
  if (n) {
717
717
  const C = JSON.parse(n);
718
- Array.isArray(C) && (r.value = C, Z(C), N.initialize(pe(C)));
718
+ Array.isArray(C) && (c.value = C, ae(C), N.initialize(me(C)));
719
719
  }
720
720
  } catch {
721
721
  }
722
722
  }
723
- function ke(n) {
723
+ function we(n) {
724
724
  h.value = { ...n }, localStorage.setItem(a.settings, JSON.stringify(n)), n.providerMode === "proxy" ? N.updateProviderConfig({
725
725
  baseUrl: n.proxyUrl,
726
726
  apiKey: "",
@@ -736,26 +736,26 @@ function Bs(t) {
736
736
  async function Ce() {
737
737
  if (h.value.providerMode === "proxy") {
738
738
  try {
739
- const n = de(h.value.proxyUrl);
739
+ const n = pe(h.value.proxyUrl);
740
740
  if (!n) return;
741
741
  await fetch(`${n}/api/messages`, {
742
742
  method: "POST",
743
743
  headers: { "Content-Type": "application/json" },
744
- body: JSON.stringify({ device_id: ae(), messages: r.value })
744
+ body: JSON.stringify({ device_id: le(), messages: c.value })
745
745
  });
746
746
  } catch {
747
747
  }
748
748
  return;
749
749
  }
750
750
  try {
751
- localStorage.setItem(a.messages, JSON.stringify(r.value));
751
+ localStorage.setItem(a.messages, JSON.stringify(c.value));
752
752
  } catch {
753
753
  }
754
754
  }
755
755
  function $e(n) {
756
756
  return n.startsWith("data:");
757
757
  }
758
- async function me(n, C) {
758
+ async function fe(n, C) {
759
759
  const M = n.trim();
760
760
  if (!M && (!C || C.length === 0)) return;
761
761
  if ($.value = "", h.value.providerMode === "direct" && !h.value.apiKey) {
@@ -764,19 +764,19 @@ function Bs(t) {
764
764
  }
765
765
  if (N.updateProviderConfig(U()), g = null, Q.clear(), C && C.length > 0) {
766
766
  for (const B of C)
767
- B.id = ue(), H.set(B.id, { ...B });
768
- const k = {
769
- id: ue(),
767
+ B.id = de(), H.set(B.id, { ...B });
768
+ const w = {
769
+ id: de(),
770
770
  role: "user",
771
771
  content: M,
772
772
  status: "done",
773
773
  timestamp: Date.now(),
774
774
  files: C
775
775
  };
776
- r.value.push(k), N.initialize(pe(r.value));
776
+ c.value.push(w), N.initialize(me(c.value));
777
777
  }
778
- let c = M;
779
- C && C.length > 0 && (b ? c = C.map((B) => $e(B.data) ? `[File: ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)]
778
+ let u = M;
779
+ C && C.length > 0 && (b ? u = C.map((B) => $e(B.data) ? `[File: ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)]
780
780
  ${B.data}` : `[File: ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)]
781
781
  \`\`\`
782
782
  ${B.data}
@@ -784,21 +784,21 @@ ${B.data}
784
784
 
785
785
  `) + (M ? `
786
786
 
787
- ${M}` : "") : c = C.map(
787
+ ${M}` : "") : u = C.map(
788
788
  (B) => `[Uploaded file: ${B.id}] ${B.name} (${B.type}, ${(B.size / 1024).toFixed(1)}KB)`
789
789
  ).join(`
790
790
  `) + (M ? `
791
791
 
792
- ${M}` : "")), await N.sendMessage(c);
792
+ ${M}` : "")), await N.sendMessage(u);
793
793
  }
794
794
  function Se() {
795
795
  N.stop();
796
796
  }
797
797
  async function Me() {
798
- if (Ve(), N.clear(), r.value = [], $.value = "", g = null, Y(), H.clear(), h.value.providerMode === "proxy")
798
+ if (Ve(), N.clear(), c.value = [], $.value = "", g = null, Y(), H.clear(), h.value.providerMode === "proxy")
799
799
  try {
800
- const n = de(h.value.proxyUrl);
801
- n && await fetch(`${n}/api/messages?device_id=${encodeURIComponent(ae())}`, { method: "DELETE" });
800
+ const n = pe(h.value.proxyUrl);
801
+ n && await fetch(`${n}/api/messages?device_id=${encodeURIComponent(le())}`, { method: "DELETE" });
802
802
  } catch {
803
803
  }
804
804
  else
@@ -806,7 +806,7 @@ ${M}` : "")), await N.sendMessage(c);
806
806
  }
807
807
  const Ie = te(() => h.value.providerMode === "proxy" || !!h.value.apiKey);
808
808
  Be(() => {
809
- ce(), we();
809
+ ue(), ee();
810
810
  });
811
811
  let se = null;
812
812
  function Ae() {
@@ -817,21 +817,21 @@ ${M}` : "")), await N.sendMessage(c);
817
817
  function Ve() {
818
818
  se && (clearTimeout(se), se = null);
819
819
  }
820
- return le(r, () => Ae(), { deep: !0 }), {
821
- messages: r,
820
+ return ie(c, () => Ae(), { deep: !0 }), {
821
+ messages: c,
822
822
  settings: h,
823
823
  loading: m,
824
824
  errorMsg: $,
825
825
  hasApiKey: Ie,
826
826
  toolPackages: e,
827
827
  fileStore: H,
828
- visible: I,
829
- eventBus: w,
830
- deviceId: ae(),
831
- sendMessage: me,
828
+ visible: A,
829
+ eventBus: k,
830
+ deviceId: le(),
831
+ sendMessage: fe,
832
832
  stopGeneration: Se,
833
833
  clearMessages: Me,
834
- saveSettings: ke
834
+ saveSettings: we
835
835
  };
836
836
  }
837
837
  /*! Element Plus Icons Vue v2.3.2 */
@@ -839,7 +839,7 @@ var at = /* @__PURE__ */ F({
839
839
  name: "ChatDotRound",
840
840
  __name: "chat-dot-round",
841
841
  setup(t) {
842
- return (e, s) => (u(), x("svg", {
842
+ return (e, s) => (i(), x("svg", {
843
843
  xmlns: "http://www.w3.org/2000/svg",
844
844
  viewBox: "0 0 1024 1024"
845
845
  }, [
@@ -857,7 +857,7 @@ var at = /* @__PURE__ */ F({
857
857
  name: "Close",
858
858
  __name: "close",
859
859
  setup(t) {
860
- return (e, s) => (u(), x("svg", {
860
+ return (e, s) => (i(), x("svg", {
861
861
  xmlns: "http://www.w3.org/2000/svg",
862
862
  viewBox: "0 0 1024 1024"
863
863
  }, [
@@ -871,7 +871,7 @@ var at = /* @__PURE__ */ F({
871
871
  name: "Delete",
872
872
  __name: "delete",
873
873
  setup(t) {
874
- return (e, s) => (u(), x("svg", {
874
+ return (e, s) => (i(), x("svg", {
875
875
  xmlns: "http://www.w3.org/2000/svg",
876
876
  viewBox: "0 0 1024 1024"
877
877
  }, [
@@ -885,7 +885,7 @@ var at = /* @__PURE__ */ F({
885
885
  name: "Document",
886
886
  __name: "document",
887
887
  setup(t) {
888
- return (e, s) => (u(), x("svg", {
888
+ return (e, s) => (i(), x("svg", {
889
889
  xmlns: "http://www.w3.org/2000/svg",
890
890
  viewBox: "0 0 1024 1024"
891
891
  }, [
@@ -895,11 +895,11 @@ var at = /* @__PURE__ */ F({
895
895
  })
896
896
  ]));
897
897
  }
898
- }), be = dt, pt = /* @__PURE__ */ F({
898
+ }), ke = dt, pt = /* @__PURE__ */ F({
899
899
  name: "FullScreen",
900
900
  __name: "full-screen",
901
901
  setup(t) {
902
- return (e, s) => (u(), x("svg", {
902
+ return (e, s) => (i(), x("svg", {
903
903
  xmlns: "http://www.w3.org/2000/svg",
904
904
  viewBox: "0 0 1024 1024"
905
905
  }, [
@@ -913,7 +913,7 @@ var at = /* @__PURE__ */ F({
913
913
  name: "InfoFilled",
914
914
  __name: "info-filled",
915
915
  setup(t) {
916
- return (e, s) => (u(), x("svg", {
916
+ return (e, s) => (i(), x("svg", {
917
917
  xmlns: "http://www.w3.org/2000/svg",
918
918
  viewBox: "0 0 1024 1024"
919
919
  }, [
@@ -927,7 +927,7 @@ var at = /* @__PURE__ */ F({
927
927
  name: "Paperclip",
928
928
  __name: "paperclip",
929
929
  setup(t) {
930
- return (e, s) => (u(), x("svg", {
930
+ return (e, s) => (i(), x("svg", {
931
931
  xmlns: "http://www.w3.org/2000/svg",
932
932
  viewBox: "0 0 1024 1024"
933
933
  }, [
@@ -941,7 +941,7 @@ var at = /* @__PURE__ */ F({
941
941
  name: "Picture",
942
942
  __name: "picture",
943
943
  setup(t) {
944
- return (e, s) => (u(), x("svg", {
944
+ return (e, s) => (i(), x("svg", {
945
945
  xmlns: "http://www.w3.org/2000/svg",
946
946
  viewBox: "0 0 1024 1024"
947
947
  }, [
@@ -959,7 +959,7 @@ var at = /* @__PURE__ */ F({
959
959
  name: "Promotion",
960
960
  __name: "promotion",
961
961
  setup(t) {
962
- return (e, s) => (u(), x("svg", {
962
+ return (e, s) => (i(), x("svg", {
963
963
  xmlns: "http://www.w3.org/2000/svg",
964
964
  viewBox: "0 0 1024 1024"
965
965
  }, [
@@ -969,11 +969,11 @@ var at = /* @__PURE__ */ F({
969
969
  })
970
970
  ]));
971
971
  }
972
- }), bt = xt, wt = /* @__PURE__ */ F({
972
+ }), bt = xt, kt = /* @__PURE__ */ F({
973
973
  name: "Setting",
974
974
  __name: "setting",
975
975
  setup(t) {
976
- return (e, s) => (u(), x("svg", {
976
+ return (e, s) => (i(), x("svg", {
977
977
  xmlns: "http://www.w3.org/2000/svg",
978
978
  viewBox: "0 0 1024 1024"
979
979
  }, [
@@ -983,11 +983,11 @@ var at = /* @__PURE__ */ F({
983
983
  })
984
984
  ]));
985
985
  }
986
- }), xe = wt, kt = /* @__PURE__ */ F({
986
+ }), be = kt, wt = /* @__PURE__ */ F({
987
987
  name: "UserFilled",
988
988
  __name: "user-filled",
989
989
  setup(t) {
990
- return (e, s) => (u(), x("svg", {
990
+ return (e, s) => (i(), x("svg", {
991
991
  xmlns: "http://www.w3.org/2000/svg",
992
992
  viewBox: "0 0 1024 1024"
993
993
  }, [
@@ -997,11 +997,11 @@ var at = /* @__PURE__ */ F({
997
997
  })
998
998
  ]));
999
999
  }
1000
- }), Ct = kt, $t = /* @__PURE__ */ F({
1000
+ }), Ct = wt, $t = /* @__PURE__ */ F({
1001
1001
  name: "VideoPause",
1002
1002
  __name: "video-pause",
1003
1003
  setup(t) {
1004
- return (e, s) => (u(), x("svg", {
1004
+ return (e, s) => (i(), x("svg", {
1005
1005
  xmlns: "http://www.w3.org/2000/svg",
1006
1006
  viewBox: "0 0 1024 1024"
1007
1007
  }, [
@@ -1035,7 +1035,7 @@ const Mt = { class: "render-block" }, It = {
1035
1035
  },
1036
1036
  emits: ["select"],
1037
1037
  setup(t, { emit: e }) {
1038
- const s = t, i = e, o = te(() => s.block.data || {}), l = te(
1038
+ const s = t, r = e, o = te(() => s.block.data || {}), l = te(
1039
1039
  () => s.block.selectable && _.value.length > 1
1040
1040
  ), _ = te(() => Array.isArray(o.value) ? o.value : o.value.list ? Array.isArray(o.value.list) ? o.value.list : [] : o.value.items ? Array.isArray(o.value.items) ? o.value.items : [] : [o.value]), b = te(() => {
1041
1041
  var m;
@@ -1044,33 +1044,33 @@ const Mt = { class: "render-block" }, It = {
1044
1044
  () => 100
1045
1045
  // headers.value.length ? Math.floor(100 / headers.value.length) + '%' : undefined,
1046
1046
  );
1047
- function r(m) {
1047
+ function c(m) {
1048
1048
  return typeof m == "string" ? m : Object.values(m).join(" - ");
1049
1049
  }
1050
1050
  function h(m) {
1051
1051
  var H;
1052
1052
  const $ = (s.block.labelField && (m == null ? void 0 : m[s.block.labelField]) != null ? m[s.block.labelField] : (H = s.block.fields) != null && H.length ? m == null ? void 0 : m[s.block.fields[0]] : (m == null ? void 0 : m.name) ?? (m == null ? void 0 : m.title) ?? (m == null ? void 0 : m.id) ?? Object.values(m ?? {})[0]) ?? "";
1053
- i("select", `我选择 ${$}`);
1053
+ r("select", `我选择 ${$}`);
1054
1054
  }
1055
1055
  return (m, $) => {
1056
1056
  const H = P("el-button");
1057
- return u(), x("div", Mt, [
1058
- t.block.title ? (u(), x("div", It, L(t.block.title), 1)) : R("", !0),
1059
- t.resolvedComponent ? (u(), D(He(t.resolvedComponent), {
1057
+ return i(), x("div", Mt, [
1058
+ t.block.title ? (i(), x("div", It, L(t.block.title), 1)) : R("", !0),
1059
+ t.resolvedComponent ? (i(), D(He(t.resolvedComponent), {
1060
1060
  key: 1,
1061
1061
  class: "render-block__component",
1062
1062
  data: t.block.data
1063
- }, null, 8, ["data"])) : t.block.type === "component" ? (u(), x("div", At, [
1063
+ }, null, 8, ["data"])) : t.block.type === "component" ? (i(), x("div", At, [
1064
1064
  y("div", Vt, [
1065
- (u(!0), x(G, null, X(_.value[0], (I, A) => (u(), x("div", {
1066
- key: A,
1065
+ (i(!0), x(G, null, X(_.value[0], (A, I) => (i(), x("div", {
1066
+ key: I,
1067
1067
  class: "card-field"
1068
1068
  }, [
1069
- y("span", Pt, L(A) + ":", 1),
1070
- y("span", Tt, L(I), 1)
1069
+ y("span", Pt, L(I) + ":", 1),
1070
+ y("span", Tt, L(A), 1)
1071
1071
  ]))), 128))
1072
1072
  ])
1073
- ])) : t.block.type === "table" ? (u(), x("div", zt, [
1073
+ ])) : t.block.type === "table" ? (i(), x("div", zt, [
1074
1074
  p(S(Oe), {
1075
1075
  data: _.value,
1076
1076
  "max-height": Dt,
@@ -1081,27 +1081,27 @@ const Mt = { class: "render-block" }, It = {
1081
1081
  style: { width: "100%" }
1082
1082
  }, {
1083
1083
  default: v(() => [
1084
- (u(!0), x(G, null, X(b.value, (I) => (u(), D(S(_e), {
1085
- key: I,
1086
- prop: I,
1087
- label: I,
1084
+ (i(!0), x(G, null, X(b.value, (A) => (i(), D(S(ve), {
1085
+ key: A,
1086
+ prop: A,
1087
+ label: A,
1088
1088
  width: a.value,
1089
1089
  align: "center",
1090
1090
  "show-overflow-tooltip": ""
1091
1091
  }, null, 8, ["prop", "label", "width"]))), 128)),
1092
- l.value ? (u(), D(S(_e), {
1092
+ l.value ? (i(), D(S(ve), {
1093
1093
  key: 0,
1094
1094
  label: "操作",
1095
1095
  width: 80,
1096
1096
  align: "center",
1097
1097
  fixed: "right"
1098
1098
  }, {
1099
- default: v(({ row: I }) => [
1099
+ default: v(({ row: A }) => [
1100
1100
  p(H, {
1101
1101
  size: "small",
1102
1102
  type: "primary",
1103
1103
  plain: "",
1104
- onClick: (A) => h(I)
1104
+ onClick: (I) => h(A)
1105
1105
  }, {
1106
1106
  default: v(() => [...$[0] || ($[0] = [
1107
1107
  O(" 选择 ", -1)
@@ -1114,32 +1114,32 @@ const Mt = { class: "render-block" }, It = {
1114
1114
  ]),
1115
1115
  _: 1
1116
1116
  }, 8, ["data"])
1117
- ])) : t.block.type === "card" ? (u(), x("div", Bt, [
1118
- (u(!0), x(G, null, X(_.value, (I, A) => (u(), x("div", {
1119
- key: A,
1117
+ ])) : t.block.type === "card" ? (i(), x("div", Bt, [
1118
+ (i(!0), x(G, null, X(_.value, (A, I) => (i(), x("div", {
1119
+ key: I,
1120
1120
  class: "card-item"
1121
1121
  }, [
1122
- (u(!0), x(G, null, X(I, (w, T) => (u(), x("div", {
1122
+ (i(!0), x(G, null, X(A, (k, T) => (i(), x("div", {
1123
1123
  key: T,
1124
1124
  class: "card-field"
1125
1125
  }, [
1126
1126
  y("span", Ht, L(T) + ":", 1),
1127
- y("span", Nt, L(w), 1)
1127
+ y("span", Nt, L(k), 1)
1128
1128
  ]))), 128))
1129
1129
  ]))), 128))
1130
- ])) : t.block.type === "list" ? (u(), x("div", Et, [
1131
- (u(!0), x(G, null, X(_.value, (I, A) => (u(), x("div", {
1132
- key: A,
1130
+ ])) : t.block.type === "list" ? (i(), x("div", Et, [
1131
+ (i(!0), x(G, null, X(_.value, (A, I) => (i(), x("div", {
1132
+ key: I,
1133
1133
  class: "list-item"
1134
- }, L(r(I)), 1))), 128))
1134
+ }, L(c(A)), 1))), 128))
1135
1135
  ])) : R("", !0)
1136
1136
  ]);
1137
1137
  };
1138
1138
  }
1139
1139
  }), oe = (t, e) => {
1140
1140
  const s = t.__vccOpts || t;
1141
- for (const [i, o] of e)
1142
- s[i] = o;
1141
+ for (const [r, o] of e)
1142
+ s[r] = o;
1143
1143
  return s;
1144
1144
  }, jt = /* @__PURE__ */ oe(Ft, [["__scopeId", "data-v-0cb2fd61"]]), Ot = {
1145
1145
  key: 0,
@@ -1151,13 +1151,13 @@ const Mt = { class: "render-block" }, It = {
1151
1151
  },
1152
1152
  emits: ["execute"],
1153
1153
  setup(t, { emit: e }) {
1154
- const s = t, i = e;
1154
+ const s = t, r = e;
1155
1155
  function o() {
1156
- i("execute", s.text);
1156
+ r("execute", s.text);
1157
1157
  }
1158
1158
  return (l, _) => {
1159
1159
  const b = P("el-button");
1160
- return t.text ? (u(), x("div", Ot, [
1160
+ return t.text ? (i(), x("div", Ot, [
1161
1161
  _[1] || (_[1] = y("span", { class: "suggested-next__icon" }, "💡", -1)),
1162
1162
  y("span", Ut, L(t.text), 1),
1163
1163
  p(b, {
@@ -1197,37 +1197,37 @@ const Mt = { class: "render-block" }, It = {
1197
1197
  },
1198
1198
  emits: ["execute"],
1199
1199
  setup(t, { emit: e }) {
1200
- const s = t, i = e;
1200
+ const s = t, r = e;
1201
1201
  function o(a) {
1202
1202
  if (!a) return "";
1203
- let r = a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1204
- return r = r.replace(/`([^`]+)`/g, "<code>$1</code>"), r = r.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), r = r.replace(/\*([^*]+)\*/g, "<em>$1</em>"), r = r.replace(/\n/g, "<br>"), r;
1203
+ let c = a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1204
+ return c = c.replace(/`([^`]+)`/g, "<code>$1</code>"), c = c.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), c = c.replace(/\*([^*]+)\*/g, "<em>$1</em>"), c = c.replace(/\n/g, "<br>"), c;
1205
1205
  }
1206
1206
  const l = te(() => o(s.message.content));
1207
1207
  function _(a) {
1208
1208
  var h;
1209
1209
  if (a.type !== "component" || !a.componentName) return null;
1210
- let r = a.packageId ? s.toolPackages.find((m) => m.id === a.packageId) : null;
1211
- return r || (r = s.toolPackages.find(
1210
+ let c = a.packageId ? s.toolPackages.find((m) => m.id === a.packageId) : null;
1211
+ return c || (c = s.toolPackages.find(
1212
1212
  (m) => m.components && a.componentName in m.components
1213
- )), r || (r = s.toolPackages[s.toolPackages.length - 1]), r && ((h = r.components) == null ? void 0 : h[a.componentName]) || null;
1213
+ )), c || (c = s.toolPackages[s.toolPackages.length - 1]), c && ((h = c.components) == null ? void 0 : h[a.componentName]) || null;
1214
1214
  }
1215
1215
  function b(a) {
1216
- i("execute", a);
1216
+ r("execute", a);
1217
1217
  }
1218
- return (a, r) => {
1218
+ return (a, c) => {
1219
1219
  var m;
1220
1220
  const h = P("el-icon");
1221
- return u(), x("div", {
1222
- class: ie(["chat-message", [`role-${t.message.role}`, { "is-streaming": t.message.status === "streaming" }]])
1221
+ return i(), x("div", {
1222
+ class: re(["chat-message", [`role-${t.message.role}`, { "is-streaming": t.message.status === "streaming" }]])
1223
1223
  }, [
1224
1224
  y("div", Lt, [
1225
- t.message.role === "user" ? (u(), D(h, { key: 0 }, {
1225
+ t.message.role === "user" ? (i(), D(h, { key: 0 }, {
1226
1226
  default: v(() => [
1227
1227
  p(S(Ct))
1228
1228
  ]),
1229
1229
  _: 1
1230
- })) : (u(), D(h, { key: 1 }, {
1230
+ })) : (i(), D(h, { key: 1 }, {
1231
1231
  default: v(() => [
1232
1232
  p(S(lt))
1233
1233
  ]),
@@ -1235,19 +1235,19 @@ const Mt = { class: "render-block" }, It = {
1235
1235
  }))
1236
1236
  ]),
1237
1237
  y("div", Jt, [
1238
- (m = t.message.files) != null && m.length ? (u(), x("div", Wt, [
1239
- (u(!0), x(G, null, X(t.message.files, ($, H) => (u(), x("div", {
1238
+ (m = t.message.files) != null && m.length ? (i(), x("div", Wt, [
1239
+ (i(!0), x(G, null, X(t.message.files, ($, H) => (i(), x("div", {
1240
1240
  key: H,
1241
- class: ie(["message-file", { "is-image": $.type.startsWith("image/") }])
1241
+ class: re(["message-file", { "is-image": $.type.startsWith("image/") }])
1242
1242
  }, [
1243
- $.type.startsWith("image/") ? (u(), x("img", {
1243
+ $.type.startsWith("image/") ? (i(), x("img", {
1244
1244
  key: 0,
1245
1245
  src: $.data,
1246
1246
  alt: $.name,
1247
1247
  class: "file-image"
1248
- }, null, 8, qt)) : (u(), D(h, { key: 1 }, {
1248
+ }, null, 8, qt)) : (i(), D(h, { key: 1 }, {
1249
1249
  default: v(() => [
1250
- p(S(be))
1250
+ p(S(ke))
1251
1251
  ]),
1252
1252
  _: 1
1253
1253
  })),
@@ -1257,11 +1257,11 @@ const Mt = { class: "render-block" }, It = {
1257
1257
  ])
1258
1258
  ], 2))), 128))
1259
1259
  ])) : R("", !0),
1260
- t.message.role === "user" ? (u(), x("div", Qt, L(t.message.content), 1)) : R("", !0),
1261
- t.message.role === "assistant" ? (u(), x(G, { key: 2 }, [
1262
- t.message.reasoning ? (u(), x("div", Zt, [
1260
+ t.message.role === "user" ? (i(), x("div", Qt, L(t.message.content), 1)) : R("", !0),
1261
+ t.message.role === "assistant" ? (i(), x(G, { key: 2 }, [
1262
+ t.message.reasoning ? (i(), x("div", Zt, [
1263
1263
  y("details", null, [
1264
- r[0] || (r[0] = y("summary", null, "推理过程", -1)),
1264
+ c[0] || (c[0] = y("summary", null, "推理过程", -1)),
1265
1265
  y("pre", null, L(t.message.reasoning), 1)
1266
1266
  ])
1267
1267
  ])) : R("", !0),
@@ -1269,20 +1269,20 @@ const Mt = { class: "render-block" }, It = {
1269
1269
  class: "message-content markdown-body",
1270
1270
  innerHTML: l.value
1271
1271
  }, null, 8, es),
1272
- (u(!0), x(G, null, X(t.message.renderBlocks, ($, H) => (u(), D(jt, {
1272
+ (i(!0), x(G, null, X(t.message.renderBlocks, ($, H) => (i(), D(jt, {
1273
1273
  key: H,
1274
1274
  block: $,
1275
1275
  "resolved-component": _($),
1276
1276
  onSelect: b
1277
1277
  }, null, 8, ["block", "resolved-component"]))), 128)),
1278
- t.message.suggestedNext ? (u(), D(Kt, {
1278
+ t.message.suggestedNext ? (i(), D(Kt, {
1279
1279
  key: 1,
1280
1280
  text: t.message.suggestedNext,
1281
1281
  onExecute: b
1282
1282
  }, null, 8, ["text"])) : R("", !0)
1283
1283
  ], 64)) : R("", !0),
1284
- t.message.status === "streaming" ? (u(), x("div", ts, "▍")) : R("", !0),
1285
- t.message.status === "error" ? (u(), x("div", ss, L(t.message.error), 1)) : R("", !0)
1284
+ t.message.status === "streaming" ? (i(), x("div", ts, "▍")) : R("", !0),
1285
+ t.message.status === "error" ? (i(), x("div", ss, L(t.message.error), 1)) : R("", !0)
1286
1286
  ])
1287
1287
  ], 2);
1288
1288
  };
@@ -1299,14 +1299,14 @@ const Mt = { class: "render-block" }, It = {
1299
1299
  },
1300
1300
  emits: ["send"],
1301
1301
  setup(t, { emit: e }) {
1302
- const s = t, i = e, o = W(""), l = W([]), _ = W(null), b = te(
1302
+ const s = t, r = e, o = W(""), l = W([]), _ = W(null), b = te(
1303
1303
  () => (o.value.trim().length > 0 || l.value.length > 0) && !s.disabled
1304
1304
  );
1305
1305
  function a() {
1306
- var w;
1307
- (w = _.value) == null || w.click();
1306
+ var k;
1307
+ (k = _.value) == null || k.click();
1308
1308
  }
1309
- const r = /* @__PURE__ */ new Set([
1309
+ const c = /* @__PURE__ */ new Set([
1310
1310
  "text/plain",
1311
1311
  "text/html",
1312
1312
  "text/css",
@@ -1322,11 +1322,11 @@ const Mt = { class: "render-block" }, It = {
1322
1322
  "application/yaml",
1323
1323
  "application/x-yaml"
1324
1324
  ]);
1325
- function h(w) {
1325
+ function h(k) {
1326
1326
  var T;
1327
- if (w.type.startsWith("text/") || r.has(w.type)) return !0;
1328
- if (w.type === "" || w.type.startsWith("application/")) {
1329
- const z = (T = w.name.split(".").pop()) == null ? void 0 : T.toLowerCase();
1327
+ if (k.type.startsWith("text/") || c.has(k.type)) return !0;
1328
+ if (k.type === "" || k.type.startsWith("application/")) {
1329
+ const z = (T = k.name.split(".").pop()) == null ? void 0 : T.toLowerCase();
1330
1330
  return (/* @__PURE__ */ new Set([
1331
1331
  "txt",
1332
1332
  "md",
@@ -1379,23 +1379,23 @@ const Mt = { class: "render-block" }, It = {
1379
1379
  }
1380
1380
  return !1;
1381
1381
  }
1382
- function m(w) {
1382
+ function m(k) {
1383
1383
  return new Promise((T) => {
1384
1384
  const z = new FileReader();
1385
1385
  z.onload = () => {
1386
1386
  T({
1387
1387
  id: "",
1388
- name: w.name,
1389
- size: w.size,
1390
- type: w.type,
1388
+ name: k.name,
1389
+ size: k.size,
1390
+ type: k.type,
1391
1391
  data: z.result
1392
1392
  });
1393
- }, h(w) ? z.readAsText(w) : z.readAsDataURL(w);
1393
+ }, h(k) ? z.readAsText(k) : z.readAsDataURL(k);
1394
1394
  });
1395
1395
  }
1396
- async function $(w) {
1396
+ async function $(k) {
1397
1397
  var z;
1398
- const T = w.target;
1398
+ const T = k.target;
1399
1399
  if ((z = T.files) != null && z.length) {
1400
1400
  for (const j of Array.from(T.files)) {
1401
1401
  const J = await m(j);
@@ -1404,22 +1404,22 @@ const Mt = { class: "render-block" }, It = {
1404
1404
  T.value = "";
1405
1405
  }
1406
1406
  }
1407
- function H(w) {
1408
- l.value.splice(w, 1);
1407
+ function H(k) {
1408
+ l.value.splice(k, 1);
1409
1409
  }
1410
- function I(w) {
1411
- w.shiftKey || (w.preventDefault(), A());
1410
+ function A(k) {
1411
+ k.shiftKey || (k.preventDefault(), I());
1412
1412
  }
1413
- function A() {
1413
+ function I() {
1414
1414
  if (!b.value || s.loading) return;
1415
- const w = o.value.trim();
1416
- i("send", w, l.value), o.value = "", l.value = [];
1415
+ const k = o.value.trim();
1416
+ r("send", k, l.value), o.value = "", l.value = [];
1417
1417
  }
1418
- return (w, T) => {
1418
+ return (k, T) => {
1419
1419
  const z = P("el-icon"), j = P("el-tag"), J = P("el-input"), U = P("el-button"), N = P("el-tooltip");
1420
- return u(), x("div", as, [
1421
- l.value.length ? (u(), x("div", ls, [
1422
- (u(!0), x(G, null, X(l.value, (g, f) => (u(), D(j, {
1420
+ return i(), x("div", as, [
1421
+ l.value.length ? (i(), x("div", ls, [
1422
+ (i(!0), x(G, null, X(l.value, (g, f) => (i(), D(j, {
1423
1423
  key: f,
1424
1424
  closable: "",
1425
1425
  size: "small",
@@ -1427,7 +1427,7 @@ const Mt = { class: "render-block" }, It = {
1427
1427
  onClose: (d) => H(f)
1428
1428
  }, {
1429
1429
  default: v(() => [
1430
- g.type.startsWith("image/") ? (u(), D(z, {
1430
+ g.type.startsWith("image/") ? (i(), D(z, {
1431
1431
  key: 0,
1432
1432
  style: { "margin-right": "4px" }
1433
1433
  }, {
@@ -1435,12 +1435,12 @@ const Mt = { class: "render-block" }, It = {
1435
1435
  p(S(yt))
1436
1436
  ]),
1437
1437
  _: 1
1438
- })) : (u(), D(z, {
1438
+ })) : (i(), D(z, {
1439
1439
  key: 1,
1440
1440
  style: { "margin-right": "4px" }
1441
1441
  }, {
1442
1442
  default: v(() => [
1443
- p(S(be))
1443
+ p(S(ke))
1444
1444
  ]),
1445
1445
  _: 1
1446
1446
  })),
@@ -1457,7 +1457,7 @@ const Mt = { class: "render-block" }, It = {
1457
1457
  autosize: { minRows: 1, maxRows: 6 },
1458
1458
  resize: "none",
1459
1459
  placeholder: t.placeholder,
1460
- onKeydown: Ne(I, ["enter"])
1460
+ onKeydown: Ne(A, ["enter"])
1461
1461
  }, null, 8, ["modelValue", "placeholder"]),
1462
1462
  y("div", rs, [
1463
1463
  p(N, {
@@ -1502,7 +1502,7 @@ const Mt = { class: "render-block" }, It = {
1502
1502
  loading: t.loading,
1503
1503
  disabled: !b.value,
1504
1504
  circle: "",
1505
- onClick: A
1505
+ onClick: I
1506
1506
  }, null, 8, ["icon", "loading", "disabled"])
1507
1507
  ]),
1508
1508
  _: 1
@@ -1524,20 +1524,20 @@ const Mt = { class: "render-block" }, It = {
1524
1524
  },
1525
1525
  emits: ["update:modelValue", "save"],
1526
1526
  setup(t, { emit: e }) {
1527
- const s = t, i = e, o = W(s.modelValue);
1528
- le(
1527
+ const s = t, r = e, o = W(s.modelValue);
1528
+ ie(
1529
1529
  () => s.modelValue,
1530
1530
  (b) => {
1531
1531
  o.value = b, b && (l.value = { ...s.settings });
1532
1532
  }
1533
- ), le(o, (b) => i("update:modelValue", b));
1533
+ ), ie(o, (b) => r("update:modelValue", b));
1534
1534
  const l = W({ ...s.settings });
1535
1535
  function _() {
1536
- i("save", { ...l.value }), o.value = !1;
1536
+ r("save", { ...l.value }), o.value = !1;
1537
1537
  }
1538
1538
  return (b, a) => {
1539
- const r = P("el-radio"), h = P("el-radio-group"), m = P("el-form-item"), $ = P("el-input"), H = P("el-link"), I = P("el-option"), A = P("el-select"), w = P("el-slider"), T = P("el-icon"), z = P("el-tooltip"), j = P("el-switch"), J = P("el-form"), U = P("el-button"), N = P("el-dialog");
1540
- return u(), D(N, {
1539
+ const c = P("el-radio"), h = P("el-radio-group"), m = P("el-form-item"), $ = P("el-input"), H = P("el-link"), A = P("el-option"), I = P("el-select"), k = P("el-slider"), T = P("el-icon"), z = P("el-tooltip"), j = P("el-switch"), J = P("el-form"), U = P("el-button"), N = P("el-dialog");
1540
+ return i(), D(N, {
1541
1541
  modelValue: o.value,
1542
1542
  "onUpdate:modelValue": a[8] || (a[8] = (g) => o.value = g),
1543
1543
  title: "AI 助手设置",
@@ -1577,13 +1577,13 @@ const Mt = { class: "render-block" }, It = {
1577
1577
  "onUpdate:modelValue": a[0] || (a[0] = (g) => l.value.providerMode = g)
1578
1578
  }, {
1579
1579
  default: v(() => [
1580
- p(r, { value: "direct" }, {
1580
+ p(c, { value: "direct" }, {
1581
1581
  default: v(() => [...a[9] || (a[9] = [
1582
1582
  O("前端直连", -1)
1583
1583
  ])]),
1584
1584
  _: 1
1585
1585
  }),
1586
- p(r, { value: "proxy" }, {
1586
+ p(c, { value: "proxy" }, {
1587
1587
  default: v(() => [...a[10] || (a[10] = [
1588
1588
  O("后端代理", -1)
1589
1589
  ])]),
@@ -1596,7 +1596,7 @@ const Mt = { class: "render-block" }, It = {
1596
1596
  ]),
1597
1597
  _: 1
1598
1598
  }),
1599
- l.value.providerMode === "direct" ? (u(), x(G, { key: 0 }, [
1599
+ l.value.providerMode === "direct" ? (i(), x(G, { key: 0 }, [
1600
1600
  p(m, { label: "API Key" }, {
1601
1601
  default: v(() => [
1602
1602
  p($, {
@@ -1635,7 +1635,7 @@ const Mt = { class: "render-block" }, It = {
1635
1635
  ]),
1636
1636
  _: 1
1637
1637
  })
1638
- ], 64)) : (u(), D(m, {
1638
+ ], 64)) : (i(), D(m, {
1639
1639
  key: 1,
1640
1640
  label: "代理地址"
1641
1641
  }, {
@@ -1652,13 +1652,13 @@ const Mt = { class: "render-block" }, It = {
1652
1652
  })),
1653
1653
  p(m, { label: "模型" }, {
1654
1654
  default: v(() => [
1655
- p(A, {
1655
+ p(I, {
1656
1656
  modelValue: l.value.model,
1657
1657
  "onUpdate:modelValue": a[4] || (a[4] = (g) => l.value.model = g),
1658
1658
  style: { width: "100%" }
1659
1659
  }, {
1660
1660
  default: v(() => [
1661
- (u(!0), x(G, null, X(S(ds), (g) => (u(), D(I, {
1661
+ (i(!0), x(G, null, X(S(ds), (g) => (i(), D(A, {
1662
1662
  key: g.value,
1663
1663
  label: g.label,
1664
1664
  value: g.value
@@ -1672,7 +1672,7 @@ const Mt = { class: "render-block" }, It = {
1672
1672
  p(m, { label: "温度" }, {
1673
1673
  default: v(() => [
1674
1674
  y("div", ms, [
1675
- p(w, {
1675
+ p(k, {
1676
1676
  modelValue: l.value.temperature,
1677
1677
  "onUpdate:modelValue": a[5] || (a[5] = (g) => l.value.temperature = g),
1678
1678
  min: 0,
@@ -1727,10 +1727,10 @@ const Mt = { class: "render-block" }, It = {
1727
1727
  }, 8, ["modelValue"]);
1728
1728
  };
1729
1729
  }
1730
- }), hs = /* @__PURE__ */ oe(gs, [["__scopeId", "data-v-9634bbdc"]]), _s = { class: "chat-panel-root" }, vs = { class: "ai-fab__label" }, ys = { class: "chat-panel__header" }, xs = { class: "chat-panel__title" }, bs = { class: "chat-panel__ops" }, ws = {
1730
+ }), hs = /* @__PURE__ */ oe(gs, [["__scopeId", "data-v-9634bbdc"]]), _s = { class: "chat-panel-root" }, vs = { class: "ai-fab__label" }, ys = { class: "chat-panel__header" }, xs = { class: "chat-panel__title" }, bs = { class: "chat-panel__ops" }, ks = {
1731
1731
  key: 0,
1732
1732
  class: "chat-empty"
1733
- }, ks = { class: "chat-empty__logo" }, Cs = {
1733
+ }, ws = { class: "chat-empty__logo" }, Cs = {
1734
1734
  key: 0,
1735
1735
  class: "chat-panel__error"
1736
1736
  }, $s = { class: "chat-panel__footer" }, Ss = {
@@ -1745,18 +1745,18 @@ const Mt = { class: "render-block" }, It = {
1745
1745
  setup(t) {
1746
1746
  const e = t, {
1747
1747
  messages: s,
1748
- settings: i,
1748
+ settings: r,
1749
1749
  loading: o,
1750
1750
  errorMsg: l,
1751
1751
  hasApiKey: _,
1752
1752
  visible: b,
1753
1753
  toolPackages: a,
1754
- sendMessage: r,
1754
+ sendMessage: c,
1755
1755
  stopGeneration: h,
1756
1756
  clearMessages: m,
1757
1757
  saveSettings: $,
1758
1758
  deviceId: H
1759
- } = e.chat, I = W(!1), A = W(!1), w = W(null);
1759
+ } = e.chat, A = W(!1), I = W(!1), k = W(null);
1760
1760
  function T() {
1761
1761
  b.value = !b.value;
1762
1762
  }
@@ -1764,16 +1764,16 @@ const Mt = { class: "render-block" }, It = {
1764
1764
  b.value = !1;
1765
1765
  }
1766
1766
  function j() {
1767
- A.value = !A.value;
1767
+ I.value = !I.value;
1768
1768
  }
1769
1769
  function J() {
1770
1770
  je(() => {
1771
- const f = w.value;
1771
+ const f = k.value;
1772
1772
  f && (f.scrollTop = f.scrollHeight);
1773
1773
  });
1774
1774
  }
1775
1775
  function U(f, d) {
1776
- r(f, d), J();
1776
+ c(f, d), J();
1777
1777
  }
1778
1778
  function N(f) {
1779
1779
  $(f);
@@ -1788,24 +1788,24 @@ const Mt = { class: "render-block" }, It = {
1788
1788
  }).catch(() => {
1789
1789
  });
1790
1790
  }
1791
- return le(
1791
+ return ie(
1792
1792
  () => s.value.map((f) => {
1793
1793
  var d;
1794
1794
  return f.content + f.status + (((d = f.renderBlocks) == null ? void 0 : d.length) || 0);
1795
1795
  }).join("|"),
1796
1796
  () => J()
1797
1797
  ), (f, d) => {
1798
- const V = P("ChatDotRound"), E = P("el-icon"), Y = P("el-tag"), ee = P("el-button"), Q = P("el-tooltip"), ce = P("el-alert");
1799
- return u(), x("div", _s, [
1800
- t.showFab ? (u(), x("div", {
1798
+ const V = P("ChatDotRound"), E = P("el-icon"), Y = P("el-tag"), Z = P("el-button"), Q = P("el-tooltip"), ue = P("SemiSelect"), ae = P("el-alert");
1799
+ return i(), x("div", _s, [
1800
+ t.showFab ? (i(), x("div", {
1801
1801
  key: 0,
1802
- class: ie(["ai-fab", { "ai-fab--active": S(b) }]),
1802
+ class: re(["ai-fab", { "ai-fab--active": S(b) }]),
1803
1803
  onClick: T
1804
1804
  }, [
1805
1805
  y("span", vs, L(S(b) ? "收起" : "AI 助手"), 1)
1806
1806
  ], 2)) : R("", !0),
1807
1807
  Ee(y("div", {
1808
- class: ie(["chat-panel", { "chat-panel--fullscreen": A.value }])
1808
+ class: re(["chat-panel", { "chat-panel--fullscreen": I.value }])
1809
1809
  }, [
1810
1810
  y("div", ys, [
1811
1811
  y("div", xs, [
@@ -1816,7 +1816,7 @@ const Mt = { class: "render-block" }, It = {
1816
1816
  _: 1
1817
1817
  }),
1818
1818
  d[5] || (d[5] = y("span", null, "AI 智能助手", -1)),
1819
- S(_) ? (u(), D(Y, {
1819
+ S(_) ? (i(), D(Y, {
1820
1820
  key: 0,
1821
1821
  size: "small",
1822
1822
  type: "success",
@@ -1826,7 +1826,7 @@ const Mt = { class: "render-block" }, It = {
1826
1826
  O("已配置", -1)
1827
1827
  ])]),
1828
1828
  _: 1
1829
- })) : (u(), D(Y, {
1829
+ })) : (i(), D(Y, {
1830
1830
  key: 1,
1831
1831
  size: "small",
1832
1832
  type: "warning",
@@ -1844,15 +1844,15 @@ const Mt = { class: "render-block" }, It = {
1844
1844
  placement: "bottom"
1845
1845
  }, {
1846
1846
  default: v(() => [
1847
- p(ee, {
1847
+ p(Z, {
1848
1848
  text: "",
1849
1849
  circle: "",
1850
- onClick: d[0] || (d[0] = (Z) => I.value = !0)
1850
+ onClick: d[0] || (d[0] = (ee) => A.value = !0)
1851
1851
  }, {
1852
1852
  default: v(() => [
1853
1853
  p(E, null, {
1854
1854
  default: v(() => [
1855
- p(S(xe))
1855
+ p(S(be))
1856
1856
  ]),
1857
1857
  _: 1
1858
1858
  })
@@ -1867,7 +1867,7 @@ const Mt = { class: "render-block" }, It = {
1867
1867
  placement: "bottom"
1868
1868
  }, {
1869
1869
  default: v(() => [
1870
- p(ee, {
1870
+ p(Z, {
1871
1871
  text: "",
1872
1872
  circle: "",
1873
1873
  disabled: !S(s).length,
@@ -1887,22 +1887,27 @@ const Mt = { class: "render-block" }, It = {
1887
1887
  _: 1
1888
1888
  }),
1889
1889
  p(Q, {
1890
- content: A.value ? "退出全屏" : "全屏",
1890
+ content: I.value ? "退出全屏" : "全屏",
1891
1891
  placement: "bottom"
1892
1892
  }, {
1893
1893
  default: v(() => [
1894
- p(ee, {
1894
+ p(Z, {
1895
1895
  text: "",
1896
1896
  circle: "",
1897
1897
  onClick: j
1898
1898
  }, {
1899
1899
  default: v(() => [
1900
- p(E, null, {
1900
+ I.value ? (i(), D(E, { key: 1 }, {
1901
+ default: v(() => [
1902
+ p(ue)
1903
+ ]),
1904
+ _: 1
1905
+ })) : (i(), D(E, { key: 0 }, {
1901
1906
  default: v(() => [
1902
1907
  p(S(mt))
1903
1908
  ]),
1904
1909
  _: 1
1905
- })
1910
+ }))
1906
1911
  ]),
1907
1912
  _: 1
1908
1913
  })
@@ -1914,7 +1919,7 @@ const Mt = { class: "render-block" }, It = {
1914
1919
  placement: "bottom"
1915
1920
  }, {
1916
1921
  default: v(() => [
1917
- p(ee, {
1922
+ p(Z, {
1918
1923
  text: "",
1919
1924
  circle: "",
1920
1925
  onClick: z
@@ -1936,16 +1941,16 @@ const Mt = { class: "render-block" }, It = {
1936
1941
  ]),
1937
1942
  y("div", {
1938
1943
  ref_key: "scrollRef",
1939
- ref: w,
1944
+ ref: k,
1940
1945
  class: "chat-panel__body"
1941
1946
  }, [
1942
- S(s).length ? (u(!0), x(G, { key: 1 }, X(S(s), (Z) => (u(), D(os, {
1943
- key: Z.id,
1944
- message: Z,
1947
+ S(s).length ? (i(!0), x(G, { key: 1 }, X(S(s), (ee) => (i(), D(os, {
1948
+ key: ee.id,
1949
+ message: ee,
1945
1950
  "tool-packages": S(a),
1946
1951
  onExecute: U
1947
- }, null, 8, ["message", "tool-packages"]))), 128)) : (u(), x("div", ws, [
1948
- y("div", ks, [
1952
+ }, null, 8, ["message", "tool-packages"]))), 128)) : (i(), x("div", ks, [
1953
+ y("div", ws, [
1949
1954
  p(E, null, {
1950
1955
  default: v(() => [
1951
1956
  p(V)
@@ -1961,11 +1966,11 @@ const Mt = { class: "render-block" }, It = {
1961
1966
  y("span", { class: "hl" }, "执行操作"),
1962
1967
  O("。试试输入指令: ")
1963
1968
  ], -1)),
1964
- S(_) ? R("", !0) : (u(), D(ee, {
1969
+ S(_) ? R("", !0) : (i(), D(Z, {
1965
1970
  key: 0,
1966
1971
  type: "primary",
1967
- icon: S(xe),
1968
- onClick: d[1] || (d[1] = (Z) => I.value = !0)
1972
+ icon: S(be),
1973
+ onClick: d[1] || (d[1] = (ee) => A.value = !0)
1969
1974
  }, {
1970
1975
  default: v(() => [...d[6] || (d[6] = [
1971
1976
  O(" 先配置 API Key ", -1)
@@ -1976,8 +1981,8 @@ const Mt = { class: "render-block" }, It = {
1976
1981
  ], 512),
1977
1982
  p(De, { name: "fade" }, {
1978
1983
  default: v(() => [
1979
- S(l) ? (u(), x("div", Cs, [
1980
- p(ce, {
1984
+ S(l) ? (i(), x("div", Cs, [
1985
+ p(ae, {
1981
1986
  title: S(l),
1982
1987
  type: "error",
1983
1988
  "show-icon": "",
@@ -1988,8 +1993,8 @@ const Mt = { class: "render-block" }, It = {
1988
1993
  _: 1
1989
1994
  }),
1990
1995
  y("div", $s, [
1991
- S(o) ? (u(), x("div", Ss, [
1992
- p(ee, {
1996
+ S(o) ? (i(), x("div", Ss, [
1997
+ p(Z, {
1993
1998
  size: "small",
1994
1999
  icon: S(St),
1995
2000
  onClick: S(h)
@@ -2007,9 +2012,9 @@ const Mt = { class: "render-block" }, It = {
2007
2012
  }, null, 8, ["loading", "placeholder"])
2008
2013
  ]),
2009
2014
  p(hs, {
2010
- modelValue: I.value,
2011
- "onUpdate:modelValue": d[2] || (d[2] = (Z) => I.value = Z),
2012
- settings: S(i),
2015
+ modelValue: A.value,
2016
+ "onUpdate:modelValue": d[2] || (d[2] = (ee) => A.value = ee),
2017
+ settings: S(r),
2013
2018
  "device-id": S(H),
2014
2019
  onSave: N
2015
2020
  }, null, 8, ["modelValue", "settings", "device-id"])
@@ -2019,7 +2024,7 @@ const Mt = { class: "render-block" }, It = {
2019
2024
  ]);
2020
2025
  };
2021
2026
  }
2022
- }), Hs = /* @__PURE__ */ oe(Ms, [["__scopeId", "data-v-57d202bb"]]);
2027
+ }), Hs = /* @__PURE__ */ oe(Ms, [["__scopeId", "data-v-d36abbf3"]]);
2023
2028
  function Is(t) {
2024
2029
  if (typeof t != "string")
2025
2030
  return t;
@@ -2040,7 +2045,7 @@ export {
2040
2045
  os as ChatMessageComp,
2041
2046
  Hs as ChatPanel,
2042
2047
  hs as ChatSettingsComp,
2043
- ve as DEFAULT_SETTINGS,
2048
+ ye as DEFAULT_SETTINGS,
2044
2049
  et as EventBus,
2045
2050
  Ns as ParseUtils,
2046
2051
  jt as RenderBlockComp,