@somecat/ai-assist-sdk 2.0.1 → 2.0.2

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.
Files changed (2) hide show
  1. package/dist/vue/index.mjs +962 -947
  2. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { defineComponent as $e, computed as S, openBlock as i, createElementBlock as h, createElementVNode as o, ref as _, watch as ge, nextTick as Se, onUnmounted as Be, normalizeClass as me, toDisplayString as te, createVNode as ke, Transition as Un, withCtx as es, unref as ie, createCommentVNode as z, Fragment as Ce, renderList as Ae, createTextVNode as fn, onMounted as Pe, onBeforeUnmount as Lt, reactive as He, createBlock as we, createStaticVNode as ts, withModifiers as Le, Teleport as mn, withDirectives as qe, withKeys as St, vModelText as gn, shallowRef as ns, normalizeStyle as kt, vShow as nt, createApp as ss } from "vue";
2
- import { a as pn, r as Et, p as At, g as Ve, i as yn, s as Tt, u as as, V as ot, c as os, b as en, d as is, o as ls, e as We, f as Rt, h as rs, j as tn, k as nn, l as Ct, m as xt, n as _t, q as us, t as cs, v as ds, w as lt, x as sn, y as vs, z as hs, A as fs, B as ms, C as gs, D as ps, E as an, F as Pt, G as ys, H as on, I as ws, J as ln, K as ks, L as _s, M as wn, N as Cs, O as bs, P as kn } from "../chunks/engine-Cu-2TgJb.mjs";
1
+ import { defineComponent as xe, computed as $, openBlock as i, createElementBlock as h, createElementVNode as o, ref as _, watch as pe, nextTick as De, onUnmounted as Fe, normalizeClass as ge, toDisplayString as U, createVNode as Ce, Transition as Un, withCtx as es, unref as ie, createCommentVNode as z, Fragment as be, renderList as He, createTextVNode as fn, onMounted as Ne, onBeforeUnmount as Lt, reactive as Oe, createBlock as _e, createStaticVNode as ts, withModifiers as Ve, Teleport as mn, withDirectives as qe, withKeys as $t, vModelText as gn, shallowRef as ns, normalizeStyle as kt, vShow as nt, createApp as ss } from "vue";
2
+ import { a as pn, r as Et, p as At, g as We, i as yn, s as xt, u as as, V as ot, c as os, b as en, d as is, o as ls, e as Be, f as Rt, h as rs, j as tn, k as nn, l as Ct, m as Tt, n as _t, q as us, t as cs, v as ds, w as lt, x as sn, y as vs, z as hs, A as fs, B as ms, C as gs, D as ps, E as an, F as Pt, G as ys, H as on, I as ws, J as ln, K as ks, L as _s, M as wn, N as Cs, O as bs, P as kn } from "../chunks/engine-Cu-2TgJb.mjs";
3
3
  import { Q as Ui, R as el, S as tl, T as nl, U as sl } from "../chunks/engine-Cu-2TgJb.mjs";
4
- import { t as Dt, r as Ms, f as $s, i as Ss, s as Ts, a as xs, S as Ds, b as Es, c as Fe, d as As, e as _n, g as Rs, h as Ps, m as Ls } from "../chunks/index-BIUOuQxJ.mjs";
4
+ import { t as Dt, r as Ss, f as Ms, i as $s, s as xs, a as Ts, S as Ds, b as Es, c as Ie, d as As, e as _n, g as Rs, h as Ps, m as Ls } from "../chunks/index-BIUOuQxJ.mjs";
5
5
  import { SearchOutlined as Cn, BulbOutlined as Hs, CheckOutlined as Ns, CopyOutlined as Vs, RedoOutlined as Os, CloseOutlined as Ws } from "@ant-design/icons-vue";
6
6
  import { p as Bs, e as rn } from "../chunks/index-DNWBsXlO.mjs";
7
7
  const un = {
@@ -70,13 +70,13 @@ const un = {
70
70
  width: 20,
71
71
  height: 20
72
72
  }
73
- }, Fs = ["viewBox"], Is = ["transform", "innerHTML"], Xs = /* @__PURE__ */ $e({
73
+ }, Fs = ["viewBox"], Is = ["transform", "innerHTML"], Xs = /* @__PURE__ */ xe({
74
74
  __name: "SdkIcon",
75
75
  props: {
76
76
  name: {}
77
77
  },
78
78
  setup(t) {
79
- const w = t, e = S(() => un[w.name] || un.close), v = S(() => {
79
+ const w = t, e = $(() => un[w.name] || un.close), v = $(() => {
80
80
  const { left: a = 0, top: f = 0 } = e.value;
81
81
  return a || f ? `translate(${a} ${f})` : void 0;
82
82
  });
@@ -100,7 +100,7 @@ const un = {
100
100
  for (const [v, a] of w)
101
101
  e[v] = a;
102
102
  return e;
103
- }, Te = /* @__PURE__ */ bn(Xs, [["__scopeId", "data-v-632dda9c"]]), zs = { class: "thinking-block__title" }, qs = ["innerHTML"], Gs = /* @__PURE__ */ $e({
103
+ }, Ee = /* @__PURE__ */ bn(Xs, [["__scopeId", "data-v-632dda9c"]]), zs = { class: "thinking-block__title" }, qs = ["innerHTML"], Gs = /* @__PURE__ */ xe({
104
104
  __name: "ThinkingBlock",
105
105
  props: {
106
106
  content: {},
@@ -110,10 +110,10 @@ const un = {
110
110
  setup(t) {
111
111
  const w = t, e = _(!!w.isStreaming || !!w.messageDone);
112
112
  let v = 0;
113
- function a(T = 600) {
113
+ function a(x = 600) {
114
114
  clearTimeout(v), v = window.setTimeout(() => {
115
115
  v = 0, e.value = !1;
116
- }, T);
116
+ }, x);
117
117
  }
118
118
  function f() {
119
119
  v && (clearTimeout(v), v = 0);
@@ -121,42 +121,42 @@ const un = {
121
121
  function g() {
122
122
  f(), e.value = !e.value;
123
123
  }
124
- ge(
124
+ pe(
125
125
  () => w.isStreaming,
126
- (T) => {
127
- T ? (f(), e.value = !0) : w.messageDone || a();
126
+ (x) => {
127
+ x ? (f(), e.value = !0) : w.messageDone || a();
128
128
  },
129
129
  { immediate: !0 }
130
- ), ge(
130
+ ), pe(
131
131
  () => w.messageDone,
132
- (T) => {
133
- T && (f(), e.value = !0);
132
+ (x) => {
133
+ x && (f(), e.value = !0);
134
134
  },
135
135
  { immediate: !0 }
136
136
  );
137
137
  const l = _(null);
138
138
  let r = !1;
139
- function M() {
140
- const T = l.value;
141
- if (!T) return;
142
- r = T.scrollHeight - T.scrollTop - T.clientHeight > 12;
139
+ function S() {
140
+ const x = l.value;
141
+ if (!x) return;
142
+ r = x.scrollHeight - x.scrollTop - x.clientHeight > 12;
143
143
  }
144
- function C() {
145
- const T = l.value;
146
- !T || !e.value || r || (T.scrollTop = T.scrollHeight);
144
+ function b() {
145
+ const x = l.value;
146
+ !x || !e.value || r || (x.scrollTop = x.scrollHeight);
147
147
  }
148
148
  function E() {
149
- w.isStreaming && C();
149
+ w.isStreaming && b();
150
150
  }
151
- return ge(
151
+ return pe(
152
152
  () => w.content,
153
153
  () => {
154
- w.isStreaming && Se(C);
154
+ w.isStreaming && De(b);
155
155
  }
156
- ), Be(() => {
156
+ ), Fe(() => {
157
157
  f();
158
- }), (T, I) => (i(), h("div", {
159
- class: me(["thinking-block", {
158
+ }), (x, I) => (i(), h("div", {
159
+ class: ge(["thinking-block", {
160
160
  "thinking-block--expanded": e.value,
161
161
  "thinking-block--active": t.isStreaming
162
162
  }])
@@ -166,9 +166,9 @@ const un = {
166
166
  onClick: g
167
167
  }, [
168
168
  I[1] || (I[1] = o("span", { class: "thinking-block__indicator" }, null, -1)),
169
- o("span", zs, te(t.isStreaming ? "深度思考中" : "深度思考"), 1),
169
+ o("span", zs, U(t.isStreaming ? "深度思考中" : "深度思考"), 1),
170
170
  (i(), h("svg", {
171
- class: me(["thinking-block__arrow", { "thinking-block__arrow--down": e.value }]),
171
+ class: ge(["thinking-block__arrow", { "thinking-block__arrow--down": e.value }]),
172
172
  viewBox: "0 0 24 24",
173
173
  width: "14",
174
174
  height: "14",
@@ -181,7 +181,7 @@ const un = {
181
181
  o("polyline", { points: "6 9 12 15 18 9" }, null, -1)
182
182
  ])], 2))
183
183
  ]),
184
- ke(Un, {
184
+ Ce(Un, {
185
185
  name: "thinking-expand",
186
186
  onAfterEnter: E
187
187
  }, {
@@ -191,7 +191,7 @@ const un = {
191
191
  ref_key: "contentRef",
192
192
  ref: l,
193
193
  class: "thinking-block__content",
194
- onScroll: M
194
+ onScroll: S
195
195
  }, [
196
196
  o("div", {
197
197
  class: "thinking-block__markdown",
@@ -241,31 +241,31 @@ const un = {
241
241
  }, oa = {
242
242
  key: 0,
243
243
  class: "step-item__content"
244
- }, ia = /* @__PURE__ */ $e({
244
+ }, ia = /* @__PURE__ */ xe({
245
245
  __name: "StepBlock",
246
246
  props: {
247
247
  steps: {}
248
248
  },
249
249
  setup(t) {
250
- const w = t, e = S(() => w.steps.some((f) => f.state !== "done")), v = S(
250
+ const w = t, e = $(() => w.steps.some((f) => f.state !== "done")), v = $(
251
251
  () => w.steps.reduce((f, g) => f + (g.duration ?? 0), 0)
252
252
  );
253
253
  function a(f) {
254
254
  return f == null || f <= 0 ? "" : f < 1 ? `${Math.round(f * 1e3)}ms` : f < 60 ? `${f.toFixed(1)}s` : `${Math.floor(f / 60)}m${Math.round(f % 60)}s`;
255
255
  }
256
256
  return (f, g) => (i(), h("div", {
257
- class: me(["step-block", { "step-block--active": e.value }])
257
+ class: ge(["step-block", { "step-block--active": e.value }])
258
258
  }, [
259
259
  t.steps.length > 1 ? (i(), h("div", Ks, [
260
260
  g[0] || (g[0] = o("span", { class: "step-block__indicator" }, null, -1)),
261
261
  g[1] || (g[1] = o("span", { class: "step-block__title" }, "执行步骤", -1)),
262
- e.value ? z("", !0) : (i(), h("span", Ys, te(t.steps.length) + " 步", 1)),
263
- !e.value && v.value > 0 ? (i(), h("span", Qs, te(a(v.value)), 1)) : z("", !0)
262
+ e.value ? z("", !0) : (i(), h("span", Ys, U(t.steps.length) + " 步", 1)),
263
+ !e.value && v.value > 0 ? (i(), h("span", Qs, U(a(v.value)), 1)) : z("", !0)
264
264
  ])) : z("", !0),
265
265
  o("ul", js, [
266
- (i(!0), h(Ce, null, Ae(t.steps, (l, r) => (i(), h("li", {
266
+ (i(!0), h(be, null, He(t.steps, (l, r) => (i(), h("li", {
267
267
  key: r,
268
- class: me(["step-item", `step-item--${l.state}`])
268
+ class: ge(["step-item", `step-item--${l.state}`])
269
269
  }, [
270
270
  o("span", Js, [
271
271
  l.state === "done" ? (i(), h("svg", Zs, [...g[2] || (g[2] = [
@@ -282,10 +282,10 @@ const un = {
282
282
  ]),
283
283
  o("div", ta, [
284
284
  o("div", na, [
285
- o("span", sa, te(l.title || "处理中"), 1),
286
- l.state === "done" && l.duration != null && l.duration > 0 ? (i(), h("span", aa, te(a(l.duration)), 1)) : z("", !0)
285
+ o("span", sa, U(l.title || "处理中"), 1),
286
+ l.state === "done" && l.duration != null && l.duration > 0 ? (i(), h("span", aa, U(a(l.duration)), 1)) : z("", !0)
287
287
  ]),
288
- l.content ? (i(), h("div", oa, te(l.content), 1)) : z("", !0)
288
+ l.content ? (i(), h("div", oa, U(l.content), 1)) : z("", !0)
289
289
  ])
290
290
  ], 2))), 128))
291
291
  ])
@@ -303,7 +303,7 @@ const un = {
303
303
  }, da = {
304
304
  key: 3,
305
305
  class: "agent-thought__duration"
306
- }, cn = /* @__PURE__ */ $e({
306
+ }, cn = /* @__PURE__ */ xe({
307
307
  __name: "AgentThoughtBlock",
308
308
  props: {
309
309
  isDone: { type: Boolean },
@@ -315,10 +315,10 @@ const un = {
315
315
  return e == null || e <= 0 ? "" : e < 1 ? `${Math.round(e * 1e3)}ms` : e < 60 ? `${e.toFixed(1)}s` : `${Math.floor(e / 60)}m${Math.round(e % 60)}s`;
316
316
  }
317
317
  return (e, v) => (i(), h("div", {
318
- class: me(["agent-thought", { "agent-thought--done": t.isDone }])
318
+ class: ge(["agent-thought", { "agent-thought--done": t.isDone }])
319
319
  }, [
320
320
  t.isDone ? (i(), h("span", la, [
321
- ke(ie(Cn))
321
+ Ce(ie(Cn))
322
322
  ])) : (i(), h("span", ra, [...v[0] || (v[0] = [
323
323
  o("svg", {
324
324
  viewBox: "0 0 24 24",
@@ -341,9 +341,9 @@ const un = {
341
341
  })
342
342
  ], -1)
343
343
  ])])),
344
- o("span", ua, te(t.isDone ? "工具调用" : "工具调用中"), 1),
345
- t.isDone && (t.count ?? 0) > 1 ? (i(), h("span", ca, "已调用 " + te(t.count) + " 次", 1)) : z("", !0),
346
- t.isDone && (t.duration ?? 0) > 0 ? (i(), h("span", da, te(w(t.duration)), 1)) : z("", !0)
344
+ o("span", ua, U(t.isDone ? "工具调用" : "工具调用中"), 1),
345
+ t.isDone && (t.count ?? 0) > 1 ? (i(), h("span", ca, "已调用 " + U(t.count) + " 次", 1)) : z("", !0),
346
+ t.isDone && (t.duration ?? 0) > 0 ? (i(), h("span", da, U(w(t.duration)), 1)) : z("", !0)
347
347
  ], 2));
348
348
  }
349
349
  }), va = { class: "ai-action-card__main" }, ha = { class: "ai-action-card__text" }, fa = { class: "ai-action-card__label" }, ma = {
@@ -355,7 +355,7 @@ const un = {
355
355
  }, ya = {
356
356
  key: 1,
357
357
  class: "ai-action-card__feedback ai-action-card__feedback--error"
358
- }, wa = /* @__PURE__ */ $e({
358
+ }, wa = /* @__PURE__ */ xe({
359
359
  __name: "AiActionCard",
360
360
  props: {
361
361
  action: {},
@@ -368,40 +368,40 @@ const un = {
368
368
  const e = t, v = w, a = {
369
369
  fillFilters: "应用筛选条件",
370
370
  export: "导出当前结果"
371
- }, f = S(() => e.action.label || a[e.action.type] || "执行操作"), g = S(() => {
372
- const C = e.action.payload || {};
371
+ }, f = $(() => e.action.label || a[e.action.type] || "执行操作"), g = $(() => {
372
+ const b = e.action.payload || {};
373
373
  if (e.action.type === "fillFilters") {
374
- const E = [C.platformName, C.companyName, C.year && C.period ? `${C.year}年${C.period}月` : ""].filter(Boolean);
374
+ const E = [b.platformName, b.companyName, b.year && b.period ? `${b.year}年${b.period}月` : ""].filter(Boolean);
375
375
  return E.length ? `将切换为:${E.join(" · ")}` : "";
376
376
  }
377
377
  return e.action.type === "export" ? "按当前查询条件导出" : "";
378
- }), l = S(() => e.state.status === "applied" ? "已应用" : e.state.status === "pending" ? "执行中" : e.state.status === "failed" ? "重试" : "执行"), r = S(() => e.disabled || e.state.status === "pending" || e.state.status === "applied"), M = () => {
378
+ }), l = $(() => e.state.status === "applied" ? "已应用" : e.state.status === "pending" ? "执行中" : e.state.status === "failed" ? "重试" : "执行"), r = $(() => e.disabled || e.state.status === "pending" || e.state.status === "applied"), S = () => {
379
379
  r.value || v("run", e.action);
380
380
  };
381
- return (C, E) => (i(), h("div", {
382
- class: me(["ai-action-card", `ai-action-card--${t.state.status}`])
381
+ return (b, E) => (i(), h("div", {
382
+ class: ge(["ai-action-card", `ai-action-card--${t.state.status}`])
383
383
  }, [
384
384
  o("div", va, [
385
385
  o("div", ha, [
386
- o("p", fa, te(f.value), 1),
387
- g.value ? (i(), h("p", ma, te(g.value), 1)) : z("", !0)
386
+ o("p", fa, U(f.value), 1),
387
+ g.value ? (i(), h("p", ma, U(g.value), 1)) : z("", !0)
388
388
  ]),
389
389
  o("button", {
390
390
  type: "button",
391
391
  class: "ai-action-card__btn",
392
392
  disabled: r.value,
393
393
  title: r.value && t.disabledReason || "",
394
- onClick: M
395
- }, te(l.value), 9, ga)
394
+ onClick: S
395
+ }, U(l.value), 9, ga)
396
396
  ]),
397
- t.state.status === "applied" && t.state.message ? (i(), h("p", pa, te(t.state.message), 1)) : z("", !0),
398
- t.state.status === "failed" && t.state.message ? (i(), h("p", ya, te(t.state.message), 1)) : z("", !0)
397
+ t.state.status === "applied" && t.state.message ? (i(), h("p", pa, U(t.state.message), 1)) : z("", !0),
398
+ t.state.status === "failed" && t.state.message ? (i(), h("p", ya, U(t.state.message), 1)) : z("", !0)
399
399
  ], 2));
400
400
  }
401
- }), ka = { class: "ai-file-card__icon" }, _a = { class: "ai-file-card__text" }, Ca = ["title"], ba = { class: "ai-file-card__meta" }, Ma = {
401
+ }), ka = { class: "ai-file-card__icon" }, _a = { class: "ai-file-card__text" }, Ca = ["title"], ba = { class: "ai-file-card__meta" }, Sa = {
402
402
  key: 0,
403
403
  class: "ai-file-card__error"
404
- }, $a = ["disabled"], Sa = /* @__PURE__ */ $e({
404
+ }, Ma = ["disabled"], $a = /* @__PURE__ */ xe({
405
405
  __name: "AiFileCard",
406
406
  props: {
407
407
  file: {},
@@ -424,64 +424,64 @@ const un = {
424
424
  jpg: "IMG",
425
425
  jpeg: "IMG",
426
426
  zip: "ZIP"
427
- }, f = S(() => {
428
- const M = (e.file.name.split(".").pop() || "").toLowerCase();
429
- return a[M] || "FILE";
430
- }), g = S(() => {
431
- const M = Number(e.file.size || 0);
432
- return M ? M < 1024 ? `${M} B` : M < 1024 * 1024 ? `${(M / 1024).toFixed(1)} KB` : `${(M / 1024 / 1024).toFixed(1)} MB` : "—";
433
- }), l = S(() => e.state.status === "pending" ? "下载中" : e.state.status === "applied" ? "已下载" : e.state.status === "failed" ? "重试" : "下载"), r = S(() => e.state.status === "pending" || e.state.status === "applied");
434
- return (M, C) => (i(), h("div", {
435
- class: me(["ai-file-card", `ai-file-card--${t.state.status}`])
427
+ }, f = $(() => {
428
+ const S = (e.file.name.split(".").pop() || "").toLowerCase();
429
+ return a[S] || "FILE";
430
+ }), g = $(() => {
431
+ const S = Number(e.file.size || 0);
432
+ return S ? S < 1024 ? `${S} B` : S < 1024 * 1024 ? `${(S / 1024).toFixed(1)} KB` : `${(S / 1024 / 1024).toFixed(1)} MB` : "—";
433
+ }), l = $(() => e.state.status === "pending" ? "下载中" : e.state.status === "applied" ? "已下载" : e.state.status === "failed" ? "重试" : "下载"), r = $(() => e.state.status === "pending" || e.state.status === "applied");
434
+ return (S, b) => (i(), h("div", {
435
+ class: ge(["ai-file-card", `ai-file-card--${t.state.status}`])
436
436
  }, [
437
- o("div", ka, te(f.value), 1),
437
+ o("div", ka, U(f.value), 1),
438
438
  o("div", _a, [
439
439
  o("p", {
440
440
  class: "ai-file-card__name",
441
441
  title: t.file.name
442
- }, te(t.file.name), 9, Ca),
442
+ }, U(t.file.name), 9, Ca),
443
443
  o("p", ba, [
444
- fn(te(g.value) + " ", 1),
445
- t.state.status === "failed" && t.state.message ? (i(), h("span", Ma, te(t.state.message), 1)) : z("", !0)
444
+ fn(U(g.value) + " ", 1),
445
+ t.state.status === "failed" && t.state.message ? (i(), h("span", Sa, U(t.state.message), 1)) : z("", !0)
446
446
  ])
447
447
  ]),
448
448
  o("button", {
449
449
  type: "button",
450
450
  class: "ai-file-card__btn",
451
451
  disabled: r.value,
452
- onClick: C[0] || (C[0] = (E) => v("download", t.file))
453
- }, te(l.value), 9, $a)
452
+ onClick: b[0] || (b[0] = (E) => v("download", t.file))
453
+ }, U(l.value), 9, Ma)
454
454
  ], 2));
455
455
  }
456
- }), Ta = {
456
+ }), xa = {
457
457
  class: "ai-tool-status__icon",
458
458
  "aria-hidden": "true"
459
- }, xa = {
459
+ }, Ta = {
460
460
  key: 0,
461
461
  class: "ai-tool-status__spinner"
462
- }, Da = { key: 1 }, Ea = { key: 2 }, Aa = { key: 3 }, Ra = { class: "ai-tool-status__text" }, Pa = /* @__PURE__ */ $e({
462
+ }, Da = { key: 1 }, Ea = { key: 2 }, Aa = { key: 3 }, Ra = { class: "ai-tool-status__text" }, Pa = /* @__PURE__ */ xe({
463
463
  __name: "AiToolStatus",
464
464
  props: {
465
465
  state: {}
466
466
  },
467
467
  setup(t) {
468
- const w = t, e = S(() => {
468
+ const w = t, e = $(() => {
469
469
  const v = w.state;
470
470
  return v.status === "running" ? v.message || "正在查询数据…" : v.status === "done" ? v.message || "已获取数据" : v.status === "failed" ? v.message || "取数失败" : v.message || "";
471
471
  });
472
472
  return (v, a) => (i(), h("div", {
473
- class: me(["ai-tool-status", `ai-tool-status--${t.state.status}`])
473
+ class: ge(["ai-tool-status", `ai-tool-status--${t.state.status}`])
474
474
  }, [
475
- o("span", Ta, [
476
- t.state.status === "running" ? (i(), h("span", xa)) : t.state.status === "done" ? (i(), h("span", Da, "✓")) : t.state.status === "failed" ? (i(), h("span", Ea, "!")) : (i(), h("span", Aa, "·"))
475
+ o("span", xa, [
476
+ t.state.status === "running" ? (i(), h("span", Ta)) : t.state.status === "done" ? (i(), h("span", Da, "✓")) : t.state.status === "failed" ? (i(), h("span", Ea, "!")) : (i(), h("span", Aa, "·"))
477
477
  ]),
478
- o("span", Ra, te(e.value), 1)
478
+ o("span", Ra, U(e.value), 1)
479
479
  ], 2));
480
480
  }
481
481
  }), La = { class: "ai-chart-card" }, Ha = {
482
482
  key: 1,
483
483
  class: "ai-chart-card__hint"
484
- }, Na = /* @__PURE__ */ $e({
484
+ }, Na = /* @__PURE__ */ xe({
485
485
  __name: "AiChartCard",
486
486
  props: {
487
487
  chart: {}
@@ -489,33 +489,33 @@ const un = {
489
489
  setup(t) {
490
490
  const w = t, e = _(null), v = _(!1);
491
491
  let a = !1;
492
- const f = S(() => {
492
+ const f = $(() => {
493
493
  var r;
494
- return !!((r = Ve()) != null && r.onChartDownload);
494
+ return !!((r = We()) != null && r.onChartDownload);
495
495
  });
496
496
  async function g() {
497
- var C;
497
+ var b;
498
498
  const r = e.value;
499
499
  if (!r || a) return;
500
- const M = (C = Ve()) == null ? void 0 : C.onChartRender;
501
- if (!M) {
500
+ const S = (b = We()) == null ? void 0 : b.onChartRender;
501
+ if (!S) {
502
502
  v.value = !0;
503
503
  return;
504
504
  }
505
505
  v.value = !1;
506
506
  try {
507
- await M(w.chart, r);
507
+ await S(w.chart, r);
508
508
  } catch (E) {
509
509
  console.warn("[ai-assist-sdk] onChartRender failed:", E), v.value = !0;
510
510
  }
511
511
  }
512
512
  function l() {
513
- var r, M;
514
- (M = (r = Ve()) == null ? void 0 : r.onChartDownload) == null || M.call(r, w.chart);
513
+ var r, S;
514
+ (S = (r = We()) == null ? void 0 : r.onChartDownload) == null || S.call(r, w.chart);
515
515
  }
516
- return ge(() => w.chart.chartId, () => Se(g)), ge(() => w.chart.option, () => Se(g), { deep: !0 }), Pe(() => Se(g)), Lt(() => {
516
+ return pe(() => w.chart.chartId, () => De(g)), pe(() => w.chart.option, () => De(g), { deep: !0 }), Ne(() => De(g)), Lt(() => {
517
517
  a = !0;
518
- }), (r, M) => (i(), h("figure", La, [
518
+ }), (r, S) => (i(), h("figure", La, [
519
519
  f.value ? (i(), h("button", {
520
520
  key: 0,
521
521
  type: "button",
@@ -532,73 +532,73 @@ const un = {
532
532
  }
533
533
  });
534
534
  function Va(t, w, e) {
535
- const v = S(() => t().segments), a = S(() => Dt(v.value)), f = S(() => !!t().streamed), g = S(() => {
535
+ const v = $(() => t().segments), a = $(() => Dt(v.value)), f = $(() => !!t().streamed), g = $(() => {
536
536
  const V = t().status;
537
537
  return V === "stop" || V === "error";
538
538
  }), l = Math.min(
539
539
  Math.max((e == null ? void 0 : e.initial) ?? 0, 0),
540
540
  Dt(t().segments)
541
541
  ), r = _(t().streamed ? l : Dt(t().segments));
542
- ge(r, (V) => {
542
+ pe(r, (V) => {
543
543
  var le;
544
544
  return (le = e == null ? void 0 : e.onProgress) == null ? void 0 : le.call(e, V);
545
545
  });
546
- const M = _(0);
547
- let C = 0, E = 0;
548
- function T(V) {
546
+ const S = _(0);
547
+ let b = 0, E = 0;
548
+ function x(V) {
549
549
  r.value !== V && (r.value = V);
550
550
  }
551
551
  function I() {
552
- if (C) return;
552
+ if (b) return;
553
553
  const V = (le) => {
554
554
  if (E === 0) {
555
- E = le, C = requestAnimationFrame(V);
555
+ E = le, b = requestAnimationFrame(V);
556
556
  return;
557
557
  }
558
558
  const s = Math.min(le - E, 100);
559
559
  E = le;
560
- const ae = a.value, re = Ts(v.value, r.value), de = xs(r.value, ae, M.value, s, re);
561
- if (M.value = de.frac, de.reveal !== r.value && (r.value = de.reveal, w == null || w()), r.value >= ae) {
562
- C = 0, E = 0;
560
+ const se = a.value, re = xs(v.value, r.value), de = Ts(r.value, se, S.value, s, re);
561
+ if (S.value = de.frac, de.reveal !== r.value && (r.value = de.reveal, w == null || w()), r.value >= se) {
562
+ b = 0, E = 0;
563
563
  return;
564
564
  }
565
- C = requestAnimationFrame(V);
565
+ b = requestAnimationFrame(V);
566
566
  };
567
- E = 0, C = requestAnimationFrame(V);
567
+ E = 0, b = requestAnimationFrame(V);
568
568
  }
569
- function R() {
570
- C && (cancelAnimationFrame(C), C = 0);
569
+ function P() {
570
+ b && (cancelAnimationFrame(b), b = 0);
571
571
  }
572
- ge(
572
+ pe(
573
573
  [f, a],
574
574
  () => {
575
575
  if (!f.value || g.value) {
576
- T(a.value);
576
+ x(a.value);
577
577
  return;
578
578
  }
579
579
  r.value < a.value && I();
580
580
  },
581
581
  { immediate: !0 }
582
- ), ge(g, (V) => {
583
- V && f.value && T(a.value);
584
- }), ge(
582
+ ), pe(g, (V) => {
583
+ V && f.value && x(a.value);
584
+ }), pe(
585
585
  () => t().status,
586
586
  (V, le) => {
587
- V === "rethinking" && le !== "rethinking" && (M.value = 0, T(0), a.value > 0 && I());
588
- }
589
- ), Be(R);
590
- const y = S(() => Ms(v.value, r.value)), N = S(
591
- () => f.value ? $s(v.value, r.value) : -1
592
- ), j = S(() => !f.value || r.value >= a.value);
593
- function A(V) {
594
- return Ss(v.value, V, r.value);
587
+ V === "rethinking" && le !== "rethinking" && (S.value = 0, x(0), a.value > 0 && I());
588
+ }
589
+ ), Fe(P);
590
+ const y = $(() => Ss(v.value, r.value)), N = $(
591
+ () => f.value ? Ms(v.value, r.value) : -1
592
+ ), J = $(() => !f.value || r.value >= a.value);
593
+ function R(V) {
594
+ return $s(v.value, V, r.value);
595
595
  }
596
- return { reveal: r, segmentContents: y, frontier: N, revealDone: j, isSegRevealed: A, stopLoop: R };
596
+ return { reveal: r, segmentContents: y, frontier: N, revealDone: J, isSegRevealed: R, stopLoop: P };
597
597
  }
598
598
  function Oa(t, w, e = Ds) {
599
599
  const v = _(!1);
600
600
  let a = 0;
601
- return ge(
601
+ return pe(
602
602
  [t, w],
603
603
  () => {
604
604
  a && (clearTimeout(a), a = 0), v.value = !1, t.value && (a = window.setTimeout(() => {
@@ -606,9 +606,9 @@ function Oa(t, w, e = Ds) {
606
606
  }, e));
607
607
  },
608
608
  { immediate: !0 }
609
- ), Be(() => {
609
+ ), Fe(() => {
610
610
  a && clearTimeout(a);
611
- }), S(() => t.value && v.value);
611
+ }), $(() => t.value && v.value);
612
612
  }
613
613
  const Wa = {
614
614
  key: 1,
@@ -643,7 +643,7 @@ const Wa = {
643
643
  }, no = {
644
644
  key: 1,
645
645
  class: "message-content"
646
- }, so = ["src"], ao = /* @__PURE__ */ $e({
646
+ }, so = ["src"], ao = /* @__PURE__ */ xe({
647
647
  __name: "MessageItem",
648
648
  props: {
649
649
  msg: {},
@@ -655,7 +655,7 @@ const Wa = {
655
655
  },
656
656
  emits: ["regenerate", "reveal-progress", "ask"],
657
657
  setup(t, { emit: w }) {
658
- const e = t, v = w, a = S(() => yn()), f = S(() => {
658
+ const e = t, v = w, a = $(() => yn()), f = $(() => {
659
659
  var u;
660
660
  return a.value && y.value && !!((u = e.msg.charts) != null && u.length);
661
661
  }), g = (u, p) => `${p}:${u.type}`, l = (u, p) => {
@@ -664,15 +664,15 @@ const Wa = {
664
664
  };
665
665
  async function r(u, p) {
666
666
  var B;
667
- const Y = g(u, p), oe = { ...e.msg.actionStates || {} };
668
- e.msg.actionStates = { ...oe, [Y]: { status: "pending" } };
669
- const J = (B = Ve()) == null ? void 0 : B.onAction;
670
- if (!J) {
667
+ const Y = g(u, p), ae = { ...e.msg.actionStates || {} };
668
+ e.msg.actionStates = { ...ae, [Y]: { status: "pending" } };
669
+ const Q = (B = We()) == null ? void 0 : B.onAction;
670
+ if (!Q) {
671
671
  e.msg.actionStates = { ...e.msg.actionStates, [Y]: { status: "failed", message: "当前页面未接入动作执行" } };
672
672
  return;
673
673
  }
674
674
  try {
675
- const W = await J(u);
675
+ const W = await Q(u);
676
676
  e.msg.actionStates = {
677
677
  ...e.msg.actionStates,
678
678
  [Y]: { status: W != null && W.ok ? "applied" : "failed", message: W == null ? void 0 : W.message }
@@ -684,15 +684,15 @@ const Wa = {
684
684
  };
685
685
  }
686
686
  }
687
- const M = (u) => {
687
+ const S = (u) => {
688
688
  var p;
689
689
  return ((p = e.msg.fileStates) == null ? void 0 : p[u.relPath]) || { status: "idle" };
690
690
  };
691
- async function C(u) {
692
- var oe;
691
+ async function b(u) {
692
+ var ae;
693
693
  const p = { ...e.msg.fileStates || {} };
694
694
  delete p[u.relPath], e.msg.fileStates = { ...p, [u.relPath]: { status: "pending" } };
695
- const Y = (oe = Ve()) == null ? void 0 : oe.onDownloadFile;
695
+ const Y = (ae = We()) == null ? void 0 : ae.onDownloadFile;
696
696
  if (!Y) {
697
697
  e.msg.fileStates = {
698
698
  ...e.msg.fileStates,
@@ -701,89 +701,89 @@ const Wa = {
701
701
  return;
702
702
  }
703
703
  try {
704
- const J = await Y(u);
704
+ const Q = await Y(u);
705
705
  e.msg.fileStates = {
706
706
  ...e.msg.fileStates,
707
- [u.relPath]: { status: J != null && J.ok ? "applied" : "failed", message: J == null ? void 0 : J.message }
707
+ [u.relPath]: { status: Q != null && Q.ok ? "applied" : "failed", message: Q == null ? void 0 : Q.message }
708
708
  };
709
- } catch (J) {
709
+ } catch (Q) {
710
710
  e.msg.fileStates = {
711
711
  ...e.msg.fileStates,
712
- [u.relPath]: { status: "failed", message: (J == null ? void 0 : J.message) || "下载失败,请重试" }
712
+ [u.relPath]: { status: "failed", message: (Q == null ? void 0 : Q.message) || "下载失败,请重试" }
713
713
  };
714
714
  }
715
715
  }
716
- const { reveal: E, segmentContents: T, frontier: I, revealDone: R } = Va(
716
+ const { reveal: E, segmentContents: x, frontier: I, revealDone: P } = Va(
717
717
  () => e.msg,
718
718
  () => e.scrollToBottom(),
719
719
  {
720
720
  initial: e.initialReveal,
721
721
  onProgress: (u) => v("reveal-progress", u)
722
722
  }
723
- ), y = S(
723
+ ), y = $(
724
724
  () => e.msg.status === e.STATUS.COMPLETED || e.msg.status === e.STATUS.STOP
725
- ), N = S(() => y.value && R.value), j = _(!1);
726
- ge(N, (u) => {
727
- u && (j.value = !1);
725
+ ), N = $(() => y.value && P.value), J = _(!1);
726
+ pe(N, (u) => {
727
+ u && (J.value = !1);
728
728
  });
729
- const A = S(() => Es(e.msg.segments, E.value)), V = S(() => A.value.length > 0), le = S(() => A.value.some((u) => u.kind === "thinking")), s = S(() => A.value.some((u) => u.kind === "tools")), ae = S(() => A.value.some((u) => u.kind === "steps")), re = S(
730
- () => A.value.some(
729
+ const R = $(() => Es(e.msg.segments, E.value)), V = $(() => R.value.length > 0), le = $(() => R.value.some((u) => u.kind === "thinking")), s = $(() => R.value.some((u) => u.kind === "tools")), se = $(() => R.value.some((u) => u.kind === "steps")), re = $(
730
+ () => R.value.some(
731
731
  (u) => u.kind === "thinking" && u.streaming || u.kind === "tools" && u.calling || u.kind === "steps" && u.items.some((p) => p.state !== "done")
732
732
  )
733
- ), de = S(
733
+ ), de = $(
734
734
  () => e.msg.status === e.STATUS.THINKING || e.msg.status === e.STATUS.RETHINKING || e.msg.status === e.STATUS.ANSWERING
735
- ), k = S(
736
- () => de.value && !!e.msg.streamed && R.value && !re.value && e.msg.lastChunkAt != null
737
- ), U = Oa(k, S(() => e.msg.lastChunkAt));
738
- ge(U, (u) => {
735
+ ), k = $(
736
+ () => de.value && !!e.msg.streamed && P.value && !re.value && e.msg.lastChunkAt != null
737
+ ), Z = Oa(k, $(() => e.msg.lastChunkAt));
738
+ pe(Z, (u) => {
739
739
  u && e.scrollToBottom();
740
740
  });
741
- const m = S(() => {
741
+ const m = $(() => {
742
742
  const u = [];
743
- return le.value && u.push("深度思考"), s.value && u.push("工具调用"), ae.value && u.push("执行步骤"), u.join(" · ") || "思考过程";
744
- }), O = S(() => !N.value || j.value), q = S(
743
+ return le.value && u.push("深度思考"), s.value && u.push("工具调用"), se.value && u.push("执行步骤"), u.join(" · ") || "思考过程";
744
+ }), O = $(() => !N.value || J.value), q = $(
745
745
  () => (e.msg.segments ?? []).reduce(
746
746
  (u, p) => p.type === "thinking" || p.type === "agent_thought" || p.type === "step" ? u + (p.duration ?? 0) : u,
747
747
  0
748
748
  )
749
- ), X = S(
749
+ ), X = $(
750
750
  () => (e.msg.segments ?? []).some(
751
- (u, p) => u.type === "answer" && (T.value[p] || "").length > 0
751
+ (u, p) => u.type === "answer" && (x.value[p] || "").length > 0
752
752
  )
753
- ), L = S(
754
- () => !N.value && !U.value && e.msg.status !== e.STATUS.ERROR && e.msg.status !== e.STATUS.PAUSED && A.value.length === 0 && !X.value && // 已有 content(page 模式流式输出)或正在取数时不显示 loading 点
753
+ ), L = $(
754
+ () => !N.value && !Z.value && e.msg.status !== e.STATUS.ERROR && e.msg.status !== e.STATUS.PAUSED && R.value.length === 0 && !X.value && // 已有 content(page 模式流式输出)或正在取数时不显示 loading 点
755
755
  !e.msg.content && !e.msg.toolState
756
756
  );
757
757
  function D(u) {
758
758
  return u == null || u <= 0 ? "" : u < 1 ? `${Math.round(u * 1e3)}ms` : u < 60 ? `${u.toFixed(1)}s` : `${Math.floor(u / 60)}m${Math.round(u % 60)}s`;
759
759
  }
760
- const c = He(/* @__PURE__ */ new Map()), b = _("");
761
- function x(u) {
760
+ const c = Oe(/* @__PURE__ */ new Map()), C = _("");
761
+ function T(u) {
762
762
  const p = u.target;
763
- p.tagName === "IMG" && (b.value = p.src);
763
+ p.tagName === "IMG" && (C.value = p.src);
764
764
  }
765
765
  function H() {
766
- b.value = "";
766
+ C.value = "";
767
767
  }
768
768
  function F(u, p) {
769
769
  var Y;
770
770
  try {
771
- let oe = u.content;
772
- if (!oe && ((Y = u.segments) != null && Y.length) && (oe = u.segments.filter((J) => J.type === "answer").map((J) => J.content).join(`
773
- `)), oe) {
774
- const { copy: J } = as();
775
- J(Tt(oe)), c.set(p, !0), setTimeout(() => c.set(p, !1), 2e3);
771
+ let ae = u.content;
772
+ if (!ae && ((Y = u.segments) != null && Y.length) && (ae = u.segments.filter((Q) => Q.type === "answer").map((Q) => Q.content).join(`
773
+ `)), ae) {
774
+ const { copy: Q } = as();
775
+ Q(xt(ae)), c.set(p, !0), setTimeout(() => c.set(p, !1), 2e3);
776
776
  }
777
777
  } catch {
778
778
  }
779
779
  }
780
780
  return (u, p) => {
781
- var Y, oe, J, B, W, ue;
781
+ var Y, ae, Q, B, W, ue;
782
782
  return i(), h("div", {
783
- class: me(["message", `${t.msg.type}-message`])
783
+ class: ge(["message", `${t.msg.type}-message`])
784
784
  }, [
785
- t.msg.type === "ai" ? (i(), h(Ce, { key: 0 }, [
786
- a.value && t.msg.toolState ? (i(), we(Pa, {
785
+ t.msg.type === "ai" ? (i(), h(be, { key: 0 }, [
786
+ a.value && t.msg.toolState ? (i(), _e(Pa, {
787
787
  key: 0,
788
788
  state: t.msg.toolState
789
789
  }, null, 8, ["state"])) : z("", !0),
@@ -793,26 +793,26 @@ const Wa = {
793
793
  t.msg.segments && t.msg.segments.length ? (i(), h("div", {
794
794
  key: 2,
795
795
  class: "message-content ba-markdown",
796
- ref: (Q) => t.setMessageRef(Q, t.index),
797
- onClick: x
796
+ ref: (j) => t.setMessageRef(j, t.index),
797
+ onClick: T
798
798
  }, [
799
799
  N.value && V.value ? (i(), h("div", {
800
800
  key: 0,
801
- class: me(["thought-collapse-bar", { "thought-collapse-bar--expanded": j.value }]),
802
- onClick: p[0] || (p[0] = Le((Q) => j.value = !j.value, ["stop"]))
801
+ class: ge(["thought-collapse-bar", { "thought-collapse-bar--expanded": J.value }]),
802
+ onClick: p[0] || (p[0] = Ve((j) => J.value = !J.value, ["stop"]))
803
803
  }, [
804
- le.value ? (i(), we(ie(Hs), {
804
+ le.value ? (i(), _e(ie(Hs), {
805
805
  key: 0,
806
806
  class: "thought-collapse-bar__icon"
807
- })) : (i(), we(ie(Cn), {
807
+ })) : (i(), _e(ie(Cn), {
808
808
  key: 1,
809
809
  class: "thought-collapse-bar__icon"
810
810
  })),
811
- o("span", Ba, te(m.value), 1),
812
- q.value > 0 ? (i(), h("span", Fa, te(D(q.value)), 1)) : z("", !0),
813
- o("span", Ia, te(j.value ? "收起" : "查看"), 1),
811
+ o("span", Ba, U(m.value), 1),
812
+ q.value > 0 ? (i(), h("span", Fa, U(D(q.value)), 1)) : z("", !0),
813
+ o("span", Ia, U(J.value ? "收起" : "查看"), 1),
814
814
  (i(), h("svg", {
815
- class: me(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": j.value }]),
815
+ class: ge(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": J.value }]),
816
816
  viewBox: "0 0 24 24",
817
817
  width: "12",
818
818
  height: "12",
@@ -825,33 +825,33 @@ const Wa = {
825
825
  o("polyline", { points: "6 9 12 15 18 9" }, null, -1)
826
826
  ])], 2))
827
827
  ], 2)) : z("", !0),
828
- O.value ? (i(), h(Ce, { key: 1 }, [
829
- (i(!0), h(Ce, null, Ae(A.value, (Q, ve) => (i(), h(Ce, { key: ve }, [
830
- Q.kind === "steps" ? (i(), we(ia, {
828
+ O.value ? (i(), h(be, { key: 1 }, [
829
+ (i(!0), h(be, null, He(R.value, (j, ve) => (i(), h(be, { key: ve }, [
830
+ j.kind === "steps" ? (i(), _e(ia, {
831
831
  key: 0,
832
- steps: Q.items
833
- }, null, 8, ["steps"])) : Q.kind === "thinking" ? (i(), we(Gs, {
832
+ steps: j.items
833
+ }, null, 8, ["steps"])) : j.kind === "thinking" ? (i(), _e(Gs, {
834
834
  key: 1,
835
- content: Q.content,
836
- "is-streaming": Q.streaming,
835
+ content: j.content,
836
+ "is-streaming": j.streaming,
837
837
  "message-done": N.value
838
- }, null, 8, ["content", "is-streaming", "message-done"])) : (i(), we(cn, {
838
+ }, null, 8, ["content", "is-streaming", "message-done"])) : (i(), _e(cn, {
839
839
  key: 2,
840
- "is-done": !Q.calling,
841
- count: Q.count,
842
- duration: Q.duration
840
+ "is-done": !j.calling,
841
+ count: j.count,
842
+ duration: j.duration
843
843
  }, null, 8, ["is-done", "count", "duration"]))
844
844
  ], 64))), 128)),
845
- ie(U) ? (i(), h("div", Xa, [
846
- ke(cn)
845
+ ie(Z) ? (i(), h("div", Xa, [
846
+ Ce(cn)
847
847
  ])) : z("", !0)
848
848
  ], 64)) : z("", !0),
849
- (i(!0), h(Ce, null, Ae(t.msg.segments, (Q, ve) => (i(), h(Ce, { key: ve }, [
850
- Q.type === "answer" ? (i(), h("div", za, [
849
+ (i(!0), h(be, null, He(t.msg.segments, (j, ve) => (i(), h(be, { key: ve }, [
850
+ j.type === "answer" ? (i(), h("div", za, [
851
851
  o("div", {
852
852
  innerHTML: ie(pn)(
853
- ie(Et)(ie(Tt)(ie(At)(ie(T)[ve] ?? ""))),
854
- !ie(R) && ie(I) === ve && t.msg.status !== t.STATUS.STOP
853
+ ie(Et)(ie(xt)(ie(At)(ie(x)[ve] ?? ""))),
854
+ !ie(P) && ie(I) === ve && t.msg.status !== t.STATUS.STOP
855
855
  )
856
856
  }, null, 8, qa)
857
857
  ])) : z("", !0)
@@ -860,87 +860,87 @@ const Wa = {
860
860
  !((Y = t.msg.segments) != null && Y.length) && (t.msg.content || f.value) ? (i(), h("div", {
861
861
  key: 3,
862
862
  class: "message-content ba-markdown",
863
- ref: (Q) => t.setMessageRef(Q, t.index),
864
- onClick: x
863
+ ref: (j) => t.setMessageRef(j, t.index),
864
+ onClick: T
865
865
  }, [
866
866
  t.msg.content ? (i(), h("div", {
867
867
  key: 0,
868
- innerHTML: ie(Et)(ie(Tt)(ie(At)(t.msg.content)))
868
+ innerHTML: ie(Et)(ie(xt)(ie(At)(t.msg.content)))
869
869
  }, null, 8, Ga)) : z("", !0),
870
870
  f.value ? (i(), h("div", Ka, [
871
- (i(!0), h(Ce, null, Ae(t.msg.charts, (Q) => (i(), we(Na, {
872
- key: Q.chartId,
873
- chart: Q
871
+ (i(!0), h(be, null, He(t.msg.charts, (j) => (i(), _e(Na, {
872
+ key: j.chartId,
873
+ chart: j
874
874
  }, null, 8, ["chart"]))), 128))
875
875
  ])) : z("", !0)
876
876
  ], 512)) : z("", !0),
877
- a.value && ((oe = t.msg.actions) != null && oe.length || (J = t.msg.suggestions) != null && J.length) ? (i(), h(Ce, { key: 4 }, [
877
+ a.value && ((ae = t.msg.actions) != null && ae.length || (Q = t.msg.suggestions) != null && Q.length) ? (i(), h(be, { key: 4 }, [
878
878
  (B = t.msg.actions) != null && B.length ? (i(), h("div", Ya, [
879
- (i(!0), h(Ce, null, Ae(t.msg.actions, (Q, ve) => (i(), we(wa, {
880
- key: `${ve}-${Q.type}`,
881
- action: Q,
882
- state: l(Q, ve),
883
- onRun: (fe) => r(Q, ve)
879
+ (i(!0), h(be, null, He(t.msg.actions, (j, ve) => (i(), _e(wa, {
880
+ key: `${ve}-${j.type}`,
881
+ action: j,
882
+ state: l(j, ve),
883
+ onRun: (me) => r(j, ve)
884
884
  }, null, 8, ["action", "state", "onRun"]))), 128))
885
885
  ])) : z("", !0),
886
886
  (W = t.msg.suggestions) != null && W.length ? (i(), h("div", Qa, [
887
- (i(!0), h(Ce, null, Ae(t.msg.suggestions, (Q, ve) => (i(), h("button", {
887
+ (i(!0), h(be, null, He(t.msg.suggestions, (j, ve) => (i(), h("button", {
888
888
  key: ve,
889
889
  type: "button",
890
890
  class: "ai-suggestion",
891
- onClick: (fe) => v("ask", Q)
892
- }, te(Q), 9, ja))), 128))
891
+ onClick: (me) => v("ask", j)
892
+ }, U(j), 9, ja))), 128))
893
893
  ])) : z("", !0)
894
894
  ], 64)) : z("", !0),
895
895
  a.value && ((ue = t.msg.files) != null && ue.length) ? (i(), h("div", Ja, [
896
- (i(!0), h(Ce, null, Ae(t.msg.files, (Q) => (i(), we(Sa, {
897
- key: Q.relPath,
898
- file: Q,
899
- state: M(Q),
900
- onDownload: C
896
+ (i(!0), h(be, null, He(t.msg.files, (j) => (i(), _e($a, {
897
+ key: j.relPath,
898
+ file: j,
899
+ state: S(j),
900
+ onDownload: b
901
901
  }, null, 8, ["file", "state"]))), 128))
902
902
  ])) : z("", !0),
903
903
  t.msg.errorMessage ? (i(), h("div", Za, [
904
904
  p[6] || (p[6] = o("span", { class: "message-error__icon" }, "⚠️", -1)),
905
- o("span", null, te(t.msg.errorMessage), 1)
905
+ o("span", null, U(t.msg.errorMessage), 1)
906
906
  ])) : z("", !0),
907
907
  N.value ? (i(), h("div", Ua, [
908
908
  o("div", {
909
909
  class: "tooltip-enhanced",
910
910
  "data-tooltip": c.get(t.index) ? "已复制" : "复制回答"
911
911
  }, [
912
- c.get(t.index) ? (i(), we(ie(Ns), {
912
+ c.get(t.index) ? (i(), _e(ie(Ns), {
913
913
  key: 0,
914
914
  class: "message-toolbar__check"
915
- })) : (i(), we(ie(Vs), {
915
+ })) : (i(), _e(ie(Vs), {
916
916
  key: 1,
917
- onClick: p[1] || (p[1] = (Q) => F(t.msg, t.index))
917
+ onClick: p[1] || (p[1] = (j) => F(t.msg, t.index))
918
918
  }))
919
919
  ], 8, eo),
920
920
  o("div", to, [
921
- ke(ie(Os), {
922
- onClick: p[2] || (p[2] = (Q) => u.$emit("regenerate"))
921
+ Ce(ie(Os), {
922
+ onClick: p[2] || (p[2] = (j) => u.$emit("regenerate"))
923
923
  })
924
924
  ])
925
925
  ])) : z("", !0)
926
- ], 64)) : (i(), h("div", no, te(t.msg.content), 1)),
927
- (i(), we(mn, { to: "#ai-assist-root" }, [
928
- b.value ? (i(), h("div", {
926
+ ], 64)) : (i(), h("div", no, U(t.msg.content), 1)),
927
+ (i(), _e(mn, { to: "#ai-assist-root" }, [
928
+ C.value ? (i(), h("div", {
929
929
  key: 0,
930
930
  class: "ai-image-preview-overlay",
931
931
  onClick: H
932
932
  }, [
933
933
  o("img", {
934
- src: b.value,
934
+ src: C.value,
935
935
  class: "ai-image-preview-overlay__img",
936
- onClick: p[3] || (p[3] = Le(() => {
936
+ onClick: p[3] || (p[3] = Ve(() => {
937
937
  }, ["stop"]))
938
938
  }, null, 8, so),
939
939
  o("button", {
940
940
  class: "ai-image-preview-overlay__close",
941
- onClick: Le(H, ["stop"])
941
+ onClick: Ve(H, ["stop"])
942
942
  }, [
943
- ke(ie(Ws))
943
+ Ce(ie(Ws))
944
944
  ])
945
945
  ])) : z("", !0)
946
946
  ]))
@@ -972,7 +972,7 @@ const Wa = {
972
972
  }, go = ["data-tooltip"], po = {
973
973
  key: 3,
974
974
  class: "moveTB"
975
- }, yo = 400, wo = 10, ko = /* @__PURE__ */ $e({
975
+ }, yo = 400, wo = 10, ko = /* @__PURE__ */ xe({
976
976
  __name: "ChatInput",
977
977
  props: {
978
978
  modelValue: {},
@@ -982,28 +982,28 @@ const Wa = {
982
982
  },
983
983
  emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
984
984
  setup(t, { emit: w }) {
985
- const e = t, v = w, a = _(!1), f = _(""), g = _(""), l = _("idle"), r = _(""), M = _(null), C = _(null), E = _(!1), T = _(!1);
986
- let I = !1, R = null, y = null, N = !1, j = !1, A = null;
987
- const V = S(() => l.value === "connecting"), le = S(
985
+ const e = t, v = w, a = _(!1), f = _(""), g = _(""), l = _("idle"), r = _(""), S = _(null), b = _(null), E = _(!1), x = _(!1);
986
+ let I = !1, P = null, y = null, N = !1, J = !1, R = null;
987
+ const V = $(() => l.value === "connecting"), le = $(
988
988
  () => l.value === "recording" || l.value === "stopping"
989
- ), s = S(
989
+ ), s = $(
990
990
  () => l.value === "connecting" || l.value === "recording" || l.value === "stopping"
991
- ), ae = S(() => a.value && !s.value), re = S(
992
- () => ae.value ? !!r.value.trim() : !!(f.value.trim() || g.value.trim())
993
- ), de = S(
991
+ ), se = $(() => a.value && !s.value), re = $(
992
+ () => se.value ? !!r.value.trim() : !!(f.value.trim() || g.value.trim())
993
+ ), de = $(
994
994
  () => ot.isSupported() && !e.modelValue.trim() && !e.isGenerating
995
995
  ), k = _(!1);
996
- function U(B) {
996
+ function Z(B) {
997
997
  B.pointerType === "mouse" && (k.value = !0);
998
998
  }
999
999
  function m(B) {
1000
1000
  B.pointerType === "mouse" && (k.value = !1);
1001
1001
  }
1002
- const O = S(() => T.value ? "正在请求麦克风权限…" : k.value && de.value ? "发消息...(按住可语音输入)" : "发消息..."), q = S(
1002
+ const O = $(() => x.value ? "正在请求麦克风权限…" : k.value && de.value ? "发消息...(按住可语音输入)" : "发消息..."), q = $(
1003
1003
  () => E.value ? "正在聆听…松手结束" : "正在聆听…点击结束"
1004
1004
  );
1005
1005
  function X() {
1006
- A = new ot({}, {
1006
+ R = new ot({}, {
1007
1007
  onStatusChange: (B) => {
1008
1008
  l.value = B;
1009
1009
  },
@@ -1018,136 +1018,136 @@ const Wa = {
1018
1018
  }
1019
1019
  });
1020
1020
  }
1021
- Pe(X), Lt(() => {
1022
- c(), A == null || A.destroy(), A = null;
1023
- }), ge([f, g], () => {
1024
- Se(() => {
1025
- M.value && (M.value.scrollTop = M.value.scrollHeight);
1021
+ Ne(X), Lt(() => {
1022
+ c(), R == null || R.destroy(), R = null;
1023
+ }), pe([f, g], () => {
1024
+ De(() => {
1025
+ S.value && (S.value.scrollTop = S.value.scrollHeight);
1026
1026
  });
1027
- }), ge(l, (B) => {
1028
- if (B === "recording" && j) {
1029
- j = !1, A == null || A.stop();
1027
+ }), pe(l, (B) => {
1028
+ if (B === "recording" && J) {
1029
+ J = !1, R == null || R.stop();
1030
1030
  return;
1031
1031
  }
1032
- B === "idle" && a.value && (r.value = (f.value + g.value).trim(), Se(() => {
1032
+ B === "idle" && a.value && (r.value = (f.value + g.value).trim(), De(() => {
1033
1033
  var W;
1034
- return (W = C.value) == null ? void 0 : W.focus();
1034
+ return (W = b.value) == null ? void 0 : W.focus();
1035
1035
  }));
1036
1036
  });
1037
1037
  function L() {
1038
- s.value && (A == null || A.stop());
1038
+ s.value && (R == null || R.stop());
1039
1039
  }
1040
1040
  function D() {
1041
1041
  window.removeEventListener("pointerup", F), window.removeEventListener("pointercancel", F), window.removeEventListener("pointermove", H), window.removeEventListener("blur", u);
1042
1042
  }
1043
1043
  function c() {
1044
- R !== null && (clearTimeout(R), R = null), y = null, D();
1044
+ P !== null && (clearTimeout(P), P = null), y = null, D();
1045
1045
  }
1046
- function b() {
1047
- l.value === "recording" ? A == null || A.stop() : (l.value === "connecting" || l.value === "stopping") && (j = !0);
1046
+ function C() {
1047
+ l.value === "recording" ? R == null || R.stop() : (l.value === "connecting" || l.value === "stopping") && (J = !0);
1048
1048
  }
1049
- function x() {
1049
+ function T() {
1050
1050
  const B = N;
1051
- N = !1, c(), B && b();
1051
+ N = !1, c(), B && C();
1052
1052
  }
1053
1053
  function H(B) {
1054
1054
  if (!y) return;
1055
1055
  if (N) {
1056
- B.buttons === 0 && x();
1056
+ B.buttons === 0 && T();
1057
1057
  return;
1058
1058
  }
1059
1059
  const W = B.clientX - y.x, ue = B.clientY - y.y;
1060
1060
  Math.hypot(W, ue) > wo && c();
1061
1061
  }
1062
1062
  function F() {
1063
- x();
1063
+ T();
1064
1064
  }
1065
1065
  function u() {
1066
- N && x();
1066
+ N && T();
1067
1067
  }
1068
1068
  function p(B) {
1069
- de.value && (B.pointerType === "mouse" && B.button !== 0 || (y = { x: B.clientX, y: B.clientY }, N = !1, j = !1, R !== null && clearTimeout(R), R = setTimeout(() => {
1070
- var ue, Q, ve;
1071
- R = null, N = !0;
1069
+ de.value && (B.pointerType === "mouse" && B.button !== 0 || (y = { x: B.clientX, y: B.clientY }, N = !1, J = !1, P !== null && clearTimeout(P), P = setTimeout(() => {
1070
+ var ue, j, ve;
1071
+ P = null, N = !0;
1072
1072
  const W = B.target;
1073
- W && typeof W.blur == "function" && W.blur(), (ve = (Q = (ue = window.getSelection) == null ? void 0 : ue.call(window)) == null ? void 0 : Q.removeAllRanges) == null || ve.call(Q), Y(!0);
1073
+ W && typeof W.blur == "function" && W.blur(), (ve = (j = (ue = window.getSelection) == null ? void 0 : ue.call(window)) == null ? void 0 : j.removeAllRanges) == null || ve.call(j), Y(!0);
1074
1074
  }, yo), window.addEventListener("pointerup", F), window.addEventListener("pointercancel", F), window.addEventListener("pointermove", H), window.addEventListener("blur", u)));
1075
1075
  }
1076
1076
  async function Y(B = !1) {
1077
- if (!A || I) return;
1078
- T.value = !0, I = !0;
1077
+ if (!R || I) return;
1078
+ x.value = !0, I = !0;
1079
1079
  const { granted: W, prompted: ue } = await ot.ensurePermission();
1080
- if (T.value = !1, I = !1, !W) {
1081
- Fe("麦克风不可用,请允许浏览器使用麦克风后重试");
1080
+ if (x.value = !1, I = !1, !W) {
1081
+ Ie("麦克风不可用,请允许浏览器使用麦克风后重试");
1082
1082
  return;
1083
1083
  }
1084
1084
  if (B && !N) {
1085
- ue && Fe("麦克风已开启,请重新按住输入框开始说话", "info");
1085
+ ue && Ie("麦克风已开启,请重新按住输入框开始说话", "info");
1086
1086
  return;
1087
1087
  }
1088
1088
  E.value = B, f.value = "", g.value = "", r.value = "", a.value = !0;
1089
1089
  try {
1090
- await A.start();
1090
+ await R.start();
1091
1091
  } catch {
1092
1092
  a.value = !1;
1093
1093
  }
1094
1094
  }
1095
- function oe() {
1096
- A == null || A.cancel(), a.value = !1, E.value = !1, j = !1, f.value = "", g.value = "", r.value = "";
1095
+ function ae() {
1096
+ R == null || R.cancel(), a.value = !1, E.value = !1, J = !1, f.value = "", g.value = "", r.value = "";
1097
1097
  }
1098
- function J() {
1099
- const B = (ae.value ? r.value : f.value + g.value).trim();
1100
- B && (A == null || A.stop(), a.value = !1, E.value = !1, j = !1, v("update:modelValue", B), setTimeout(() => v("send"), 0));
1098
+ function Q() {
1099
+ const B = (se.value ? r.value : f.value + g.value).trim();
1100
+ B && (R == null || R.stop(), a.value = !1, E.value = !1, J = !1, v("update:modelValue", B), setTimeout(() => v("send"), 0));
1101
1101
  }
1102
1102
  return (B, W) => a.value ? (i(), h("div", oo, [
1103
1103
  o("div", {
1104
- class: me(["voice-visual", { recording: le.value }])
1104
+ class: ge(["voice-visual", { recording: le.value }])
1105
1105
  }, null, 2),
1106
1106
  s.value ? (i(), h("div", {
1107
1107
  key: 0,
1108
1108
  class: "voice-text",
1109
1109
  ref_key: "voiceTextEl",
1110
- ref: M,
1110
+ ref: S,
1111
1111
  onClick: L
1112
1112
  }, [
1113
- f.value ? (i(), h("span", io, te(f.value), 1)) : z("", !0),
1114
- g.value ? (i(), h("span", lo, te(g.value), 1)) : z("", !0),
1115
- !f.value && !g.value ? (i(), h("span", ro, te(V.value ? "启动中…" : q.value), 1)) : z("", !0)
1113
+ f.value ? (i(), h("span", io, U(f.value), 1)) : z("", !0),
1114
+ g.value ? (i(), h("span", lo, U(g.value), 1)) : z("", !0),
1115
+ !f.value && !g.value ? (i(), h("span", ro, U(V.value ? "启动中…" : q.value), 1)) : z("", !0)
1116
1116
  ], 512)) : qe((i(), h("input", {
1117
1117
  key: 1,
1118
1118
  ref_key: "editorEl",
1119
- ref: C,
1119
+ ref: b,
1120
1120
  "onUpdate:modelValue": W[0] || (W[0] = (ue) => r.value = ue),
1121
1121
  type: "text",
1122
1122
  class: "voice-editor",
1123
1123
  placeholder: "识别结果,可点击直接修改…",
1124
- onKeydown: St(Le(oe, ["prevent"]), ["esc"]),
1125
- onKeyup: W[1] || (W[1] = St((ue) => re.value && J(), ["enter"]))
1124
+ onKeydown: $t(Ve(ae, ["prevent"]), ["esc"]),
1125
+ onKeyup: W[1] || (W[1] = $t((ue) => re.value && Q(), ["enter"]))
1126
1126
  }, null, 40, uo)), [
1127
1127
  [gn, r.value]
1128
1128
  ]),
1129
1129
  o("div", {
1130
1130
  class: "tooltip-enhanced voice-close",
1131
1131
  "data-tooltip": "关闭",
1132
- onClick: oe
1132
+ onClick: ae
1133
1133
  }, [
1134
- ke(Te, {
1134
+ Ce(Ee, {
1135
1135
  class: "op-icon",
1136
1136
  name: "voiceClose"
1137
1137
  })
1138
1138
  ]),
1139
1139
  o("div", {
1140
- class: me(["tooltip-enhanced voice-send", { disabled: !re.value }]),
1140
+ class: ge(["tooltip-enhanced voice-send", { disabled: !re.value }]),
1141
1141
  "data-tooltip": re.value ? "发送" : "未识别到文字",
1142
- onClick: W[2] || (W[2] = (ue) => re.value && J())
1142
+ onClick: W[2] || (W[2] = (ue) => re.value && Q())
1143
1143
  }, [
1144
- ke(Te, {
1144
+ Ce(Ee, {
1145
1145
  class: "op-icon",
1146
1146
  name: "send"
1147
1147
  })
1148
1148
  ], 10, co),
1149
1149
  t.hasScroll && !t.isAtBottom ? (i(), h("div", vo, [
1150
- ke(Te, {
1150
+ Ce(Ee, {
1151
1151
  class: "op-icon",
1152
1152
  name: "arrowDown",
1153
1153
  onClick: W[3] || (W[3] = (ue) => B.$emit("scroll-to-bottom"))
@@ -1159,14 +1159,14 @@ const Wa = {
1159
1159
  type: "text",
1160
1160
  placeholder: O.value,
1161
1161
  onInput: W[4] || (W[4] = (ue) => B.$emit("update:modelValue", ue.target.value)),
1162
- onKeyup: W[5] || (W[5] = St((ue) => t.modelValue.trim() && B.$emit("send"), ["enter"])),
1162
+ onKeyup: W[5] || (W[5] = $t((ue) => t.modelValue.trim() && B.$emit("send"), ["enter"])),
1163
1163
  disabled: t.isGenerating,
1164
1164
  onPointerdown: p,
1165
- onPointerenter: U,
1165
+ onPointerenter: Z,
1166
1166
  onPointerleave: m
1167
1167
  }, null, 40, fo),
1168
1168
  t.isGenerating ? (i(), h("div", mo, [
1169
- ke(Te, {
1169
+ Ce(Ee, {
1170
1170
  class: "op-icon stop-icon",
1171
1171
  name: "stop",
1172
1172
  onClick: W[6] || (W[6] = (ue) => B.$emit("stop"))
@@ -1177,23 +1177,23 @@ const Wa = {
1177
1177
  "data-tooltip": "语音输入(也可按住输入框说话)",
1178
1178
  onClick: W[7] || (W[7] = (ue) => Y())
1179
1179
  }, [
1180
- ke(Te, {
1180
+ Ce(Ee, {
1181
1181
  class: "op-icon",
1182
1182
  name: "voice"
1183
1183
  })
1184
1184
  ])) : (i(), h("div", {
1185
1185
  key: 2,
1186
- class: me(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
1186
+ class: ge(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
1187
1187
  "data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
1188
1188
  }, [
1189
- ke(Te, {
1189
+ Ce(Ee, {
1190
1190
  class: "op-icon",
1191
1191
  name: "send",
1192
1192
  onClick: W[8] || (W[8] = (ue) => t.modelValue.trim() && B.$emit("send"))
1193
1193
  })
1194
1194
  ], 10, go)),
1195
1195
  t.hasScroll && !t.isAtBottom ? (i(), h("div", po, [
1196
- ke(Te, {
1196
+ Ce(Ee, {
1197
1197
  class: "op-icon",
1198
1198
  name: "arrowDown",
1199
1199
  onClick: W[9] || (W[9] = (ue) => B.$emit("scroll-to-bottom"))
@@ -1205,16 +1205,16 @@ const Wa = {
1205
1205
  function _o(t) {
1206
1206
  const w = _(!0), e = _(!1);
1207
1207
  function v(g) {
1208
- const l = g.closest(".chat-wrap") || g, r = g.scrollHeight, M = g.clientHeight;
1209
- if (r <= M) {
1208
+ const l = g.closest(".chat-wrap") || g, r = g.scrollHeight, S = g.clientHeight;
1209
+ if (r <= S) {
1210
1210
  l.style.setProperty("--ai-thumb-height", "0px"), l.style.setProperty("--ai-thumb-top", "0px");
1211
1211
  return;
1212
1212
  }
1213
- const C = Math.max(M * M / r, 32), E = M - C, T = g.scrollTop / (r - M);
1214
- l.style.setProperty("--ai-thumb-height", `${C}px`), l.style.setProperty("--ai-thumb-top", `${T * E}px`);
1213
+ const b = Math.max(S * S / r, 32), E = S - b, x = g.scrollTop / (r - S);
1214
+ l.style.setProperty("--ai-thumb-height", `${b}px`), l.style.setProperty("--ai-thumb-top", `${x * E}px`);
1215
1215
  }
1216
1216
  function a() {
1217
- Se(() => {
1217
+ De(() => {
1218
1218
  t.value && (t.value.scrollTop = t.value.scrollHeight);
1219
1219
  });
1220
1220
  }
@@ -1260,7 +1260,7 @@ function bo(t) {
1260
1260
  }
1261
1261
  return { batchMessagesUpdate: v, flushMessagesBatch: a };
1262
1262
  }
1263
- function Mo({
1263
+ function So({
1264
1264
  messages: t,
1265
1265
  isGenerating: w,
1266
1266
  lastUserMessage: e,
@@ -1269,13 +1269,13 @@ function Mo({
1269
1269
  STATUS: f,
1270
1270
  cfg: g
1271
1271
  }) {
1272
- const l = _(/* @__PURE__ */ new Map()), r = _(/* @__PURE__ */ new Map()), M = _(/* @__PURE__ */ new Map()), C = _(/* @__PURE__ */ new Map()), E = _(!1), T = _(/* @__PURE__ */ new Map()), I = _(/* @__PURE__ */ new Map()), R = _(!1);
1272
+ const l = _(/* @__PURE__ */ new Map()), r = _(/* @__PURE__ */ new Map()), S = _(/* @__PURE__ */ new Map()), b = _(/* @__PURE__ */ new Map()), E = _(!1), x = _(/* @__PURE__ */ new Map()), I = _(/* @__PURE__ */ new Map()), P = _(!1);
1273
1273
  function y(V) {
1274
1274
  const le = l.value.get(V) || [];
1275
1275
  v((s) => {
1276
1276
  if (s[V]) {
1277
- const ae = [...s];
1278
- return ae[V] = { ...ae[V], segments: le.map((re) => ({ ...re })) }, ae;
1277
+ const se = [...s];
1278
+ return se[V] = { ...se[V], segments: le.map((re) => ({ ...re })) }, se;
1279
1279
  }
1280
1280
  return s;
1281
1281
  });
@@ -1283,35 +1283,35 @@ function Mo({
1283
1283
  function N(V) {
1284
1284
  const le = Date.now();
1285
1285
  v((s) => {
1286
- const ae = s[V];
1287
- if (!ae || ae.status === f.COMPLETED || ae.status === f.STOP || ae.status === f.ERROR)
1286
+ const se = s[V];
1287
+ if (!se || se.status === f.COMPLETED || se.status === f.STOP || se.status === f.ERROR)
1288
1288
  return s;
1289
1289
  const re = [...s];
1290
- return re[V] = { ...ae, lastChunkAt: le }, re;
1290
+ return re[V] = { ...se, lastChunkAt: le }, re;
1291
1291
  });
1292
1292
  }
1293
- function j(V) {
1294
- const le = l.value.get(V) || [], s = M.value.get(V), ae = I.value.get(V);
1293
+ function J(V) {
1294
+ const le = l.value.get(V) || [], s = S.value.get(V), se = I.value.get(V);
1295
1295
  let re = 0, de = !1;
1296
1296
  le.forEach((k) => {
1297
1297
  if ((k.type === "thinking" || k.type === "step") && k.duration == null) {
1298
- const m = (k.id != null ? ae == null ? void 0 : ae.get(k.id) : void 0) ?? s, O = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0;
1298
+ const m = (k.id != null ? se == null ? void 0 : se.get(k.id) : void 0) ?? s, O = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0;
1299
1299
  k.duration = O, k.type === "thinking" && (re += O), de = !0;
1300
1300
  }
1301
1301
  }), de && (l.value.set(V, le), v((k) => {
1302
1302
  if (k[V]) {
1303
- const U = [...k];
1304
- return U[V] = {
1305
- ...U[V],
1303
+ const Z = [...k];
1304
+ return Z[V] = {
1305
+ ...Z[V],
1306
1306
  segments: le.map((m) => ({ ...m })),
1307
- thinkingDuration: (U[V].thinkingDuration || 0) + re
1308
- }, U;
1307
+ thinkingDuration: (Z[V].thinkingDuration || 0) + re
1308
+ }, Z;
1309
1309
  }
1310
1310
  return k;
1311
1311
  }));
1312
1312
  }
1313
- async function A(V, le, s, ae, re = !1) {
1314
- R.value = !1, E.value = !1, l.value.set(s, []), T.value.set(s, /* @__PURE__ */ new Map()), I.value.set(s, /* @__PURE__ */ new Map()), w.value = !0;
1313
+ async function R(V, le, s, se, re = !1) {
1314
+ P.value = !1, E.value = !1, l.value.set(s, []), x.value.set(s, /* @__PURE__ */ new Map()), I.value.set(s, /* @__PURE__ */ new Map()), w.value = !0;
1315
1315
  try {
1316
1316
  const de = g.baseUrl.replace(/\/+$/, "") + "/" + V.replace(/^\/+/, "");
1317
1317
  await As(de, {
@@ -1321,13 +1321,13 @@ function Mo({
1321
1321
  Authorization: `Bearer ${g.token}`
1322
1322
  },
1323
1323
  body: JSON.stringify({ app: g.app ?? 1, data: le }),
1324
- signal: ae,
1324
+ signal: se,
1325
1325
  openWhenHidden: !0,
1326
1326
  async onopen(k) {
1327
1327
  k.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", k.status, k.statusText);
1328
1328
  },
1329
1329
  onmessage(k) {
1330
- var U, m, O, q, X;
1330
+ var Z, m, O, q, X;
1331
1331
  try {
1332
1332
  let L = k.data || "";
1333
1333
  for (; L.startsWith("data:"); )
@@ -1348,19 +1348,19 @@ function Mo({
1348
1348
  E.value = !0;
1349
1349
  break;
1350
1350
  case "think_message_output_start": {
1351
- M.value.set(s, Date.now()), r.value.set(s, "thinking");
1351
+ S.value.set(s, Date.now()), r.value.set(s, "thinking");
1352
1352
  const c = l.value.get(s) || [];
1353
1353
  l.value.set(s, [...c, { type: "thinking", content: "" }]), y(s);
1354
1354
  break;
1355
1355
  }
1356
1356
  case "agent_thought": {
1357
- const c = D.thought || D.thinking || "", b = l.value.get(s) || [], x = b[b.length - 1];
1358
- x && x.type === "agent_thought" && x.duration == null ? x.content += c : (r.value.set(s, "agent_thought"), b.push({ type: "agent_thought", content: c }), C.value.set(s, Date.now())), l.value.set(s, b), v((H) => {
1357
+ const c = D.thought || D.thinking || "", C = l.value.get(s) || [], T = C[C.length - 1];
1358
+ T && T.type === "agent_thought" && T.duration == null ? T.content += c : (r.value.set(s, "agent_thought"), C.push({ type: "agent_thought", content: c }), b.value.set(s, Date.now())), l.value.set(s, C), v((H) => {
1359
1359
  if (H[s]) {
1360
1360
  const F = [...H];
1361
1361
  return F[s] = {
1362
1362
  ...F[s],
1363
- segments: b.map((u) => ({ ...u })),
1363
+ segments: C.map((u) => ({ ...u })),
1364
1364
  thinkingContent: (F[s].thinkingContent || "") + c,
1365
1365
  status: f.THINKING
1366
1366
  }, F;
@@ -1370,13 +1370,13 @@ function Mo({
1370
1370
  break;
1371
1371
  }
1372
1372
  case "think_message": {
1373
- const c = D.thinking || D.answer || D.text || "", b = l.value.get(s) || [], x = b[b.length - 1];
1374
- x && x.type === "thinking" ? x.content += c : (b.push({ type: "thinking", content: c }), M.value.set(s, Date.now())), l.value.set(s, b), v((H) => {
1373
+ const c = D.thinking || D.answer || D.text || "", C = l.value.get(s) || [], T = C[C.length - 1];
1374
+ T && T.type === "thinking" ? T.content += c : (C.push({ type: "thinking", content: c }), S.value.set(s, Date.now())), l.value.set(s, C), v((H) => {
1375
1375
  if (H[s]) {
1376
1376
  const F = [...H];
1377
1377
  return F[s] = {
1378
1378
  ...F[s],
1379
- segments: b.map((u) => ({ ...u })),
1379
+ segments: C.map((u) => ({ ...u })),
1380
1380
  thinkingContent: (F[s].thinkingContent || "") + c,
1381
1381
  status: f.THINKING
1382
1382
  }, F;
@@ -1386,14 +1386,14 @@ function Mo({
1386
1386
  break;
1387
1387
  }
1388
1388
  case "agent_thought_end": {
1389
- const c = C.value.get(s), b = c ? Math.round((Date.now() - c) / 1e3 * 10) / 10 : 0, x = l.value.get(s) || [], H = x[x.length - 1];
1390
- H && H.type === "agent_thought" && (H.duration = b), l.value.set(s, x), v((F) => {
1389
+ const c = b.value.get(s), C = c ? Math.round((Date.now() - c) / 1e3 * 10) / 10 : 0, T = l.value.get(s) || [], H = T[T.length - 1];
1390
+ H && H.type === "agent_thought" && (H.duration = C), l.value.set(s, T), v((F) => {
1391
1391
  if (F[s]) {
1392
1392
  const u = [...F];
1393
1393
  return u[s] = {
1394
1394
  ...u[s],
1395
- segments: x.map((p) => ({ ...p })),
1396
- thinkingDuration: (u[s].thinkingDuration || 0) + b
1395
+ segments: T.map((p) => ({ ...p })),
1396
+ thinkingDuration: (u[s].thinkingDuration || 0) + C
1397
1397
  }, u;
1398
1398
  }
1399
1399
  return F;
@@ -1401,14 +1401,14 @@ function Mo({
1401
1401
  break;
1402
1402
  }
1403
1403
  case "think_message_output_end": {
1404
- const c = M.value.get(s), b = c ? Math.round((Date.now() - c) / 1e3 * 10) / 10 : 0, x = l.value.get(s) || [], H = x[x.length - 1];
1405
- H && H.type === "thinking" && (H.duration = b), l.value.set(s, x), v((F) => {
1404
+ const c = S.value.get(s), C = c ? Math.round((Date.now() - c) / 1e3 * 10) / 10 : 0, T = l.value.get(s) || [], H = T[T.length - 1];
1405
+ H && H.type === "thinking" && (H.duration = C), l.value.set(s, T), v((F) => {
1406
1406
  if (F[s]) {
1407
1407
  const u = [...F];
1408
1408
  return u[s] = {
1409
1409
  ...u[s],
1410
- segments: x.map((p) => ({ ...p })),
1411
- thinkingDuration: (u[s].thinkingDuration || 0) + b
1410
+ segments: T.map((p) => ({ ...p })),
1411
+ thinkingDuration: (u[s].thinkingDuration || 0) + C
1412
1412
  }, u;
1413
1413
  }
1414
1414
  return F;
@@ -1420,53 +1420,53 @@ function Mo({
1420
1420
  // 其余(執行準備/資料獲取/...)归入流程步骤。
1421
1421
  case "tool_message_output_start": {
1422
1422
  E.value = !0;
1423
- const c = ((U = D.message_config) == null ? void 0 : U.reasoning) === !0 || D.reasoning === !0, b = Date.now(), x = l.value.get(s) || [];
1424
- x.push({
1423
+ const c = ((Z = D.message_config) == null ? void 0 : Z.reasoning) === !0 || D.reasoning === !0, C = Date.now(), T = l.value.get(s) || [];
1424
+ T.push({
1425
1425
  type: c ? "thinking" : "step",
1426
1426
  title: D.message_title || "",
1427
1427
  id: D.id,
1428
1428
  content: "",
1429
1429
  reasoning: c
1430
1430
  });
1431
- const H = x.length - 1;
1432
- if (l.value.set(s, x), r.value.set(s, c ? "thinking" : "step"), D.id != null) {
1433
- const F = T.value.get(s) || /* @__PURE__ */ new Map();
1434
- F.set(String(D.id), H), T.value.set(s, F);
1431
+ const H = T.length - 1;
1432
+ if (l.value.set(s, T), r.value.set(s, c ? "thinking" : "step"), D.id != null) {
1433
+ const F = x.value.get(s) || /* @__PURE__ */ new Map();
1434
+ F.set(String(D.id), H), x.value.set(s, F);
1435
1435
  const u = I.value.get(s) || /* @__PURE__ */ new Map();
1436
- u.set(String(D.id), b), I.value.set(s, u);
1436
+ u.set(String(D.id), C), I.value.set(s, u);
1437
1437
  }
1438
- c && M.value.set(s, b), y(s);
1438
+ c && S.value.set(s, C), y(s);
1439
1439
  break;
1440
1440
  }
1441
1441
  case "tool_message": {
1442
1442
  const c = D.answer || D.text || D.content || "";
1443
1443
  if (!c) break;
1444
- const b = l.value.get(s) || [];
1444
+ const C = l.value.get(s) || [];
1445
1445
  if (E.value) {
1446
- const x = D.id != null ? String(D.id) : null, H = T.value.get(s);
1447
- let F = x != null ? H == null ? void 0 : H.get(x) : void 0;
1448
- if (F == null || !b[F]) {
1446
+ const T = D.id != null ? String(D.id) : null, H = x.value.get(s);
1447
+ let F = T != null ? H == null ? void 0 : H.get(T) : void 0;
1448
+ if (F == null || !C[F]) {
1449
1449
  const u = ((m = D.message_config) == null ? void 0 : m.reasoning) === !0 || D.reasoning === !0;
1450
- if (b.push({
1450
+ if (C.push({
1451
1451
  type: u ? "thinking" : "step",
1452
1452
  title: D.message_title || "",
1453
1453
  id: D.id,
1454
1454
  content: c,
1455
1455
  reasoning: u
1456
- }), F = b.length - 1, x != null) {
1456
+ }), F = C.length - 1, T != null) {
1457
1457
  const p = H || /* @__PURE__ */ new Map();
1458
- p.set(x, F), T.value.set(s, p), u && M.value.set(s, Date.now());
1458
+ p.set(T, F), x.value.set(s, p), u && S.value.set(s, Date.now());
1459
1459
  }
1460
1460
  } else {
1461
- const u = b[F];
1462
- b[F] = { ...u, content: u.content + c };
1461
+ const u = C[F];
1462
+ C[F] = { ...u, content: u.content + c };
1463
1463
  }
1464
- l.value.set(s, b), v((u) => {
1464
+ l.value.set(s, C), v((u) => {
1465
1465
  if (u[s]) {
1466
1466
  const p = [...u];
1467
1467
  return p[s] = {
1468
1468
  ...p[s],
1469
- segments: b.map((Y) => ({ ...Y })),
1469
+ segments: C.map((Y) => ({ ...Y })),
1470
1470
  status: f.THINKING
1471
1471
  }, p;
1472
1472
  }
@@ -1474,49 +1474,49 @@ function Mo({
1474
1474
  });
1475
1475
  break;
1476
1476
  }
1477
- b.push({ type: "answer", content: c }), l.value.set(s, b), y(s);
1477
+ C.push({ type: "answer", content: c }), l.value.set(s, C), y(s);
1478
1478
  break;
1479
1479
  }
1480
1480
  // ── 对话流型智能体:步骤/推理消息结束,记录该步骤耗时 ──
1481
1481
  case "tool_message_output_end": {
1482
- const c = l.value.get(s) || [], b = D.id != null ? String(D.id) : null;
1483
- let x = b != null ? (O = T.value.get(s)) == null ? void 0 : O.get(b) : c.length - 1;
1484
- (x == null || !c[x]) && (x = c.length - 1);
1485
- const H = (b != null ? (q = I.value.get(s)) == null ? void 0 : q.get(b) : void 0) ?? M.value.get(s), F = H ? Math.round((Date.now() - H) / 1e3 * 10) / 10 : 0;
1482
+ const c = l.value.get(s) || [], C = D.id != null ? String(D.id) : null;
1483
+ let T = C != null ? (O = x.value.get(s)) == null ? void 0 : O.get(C) : c.length - 1;
1484
+ (T == null || !c[T]) && (T = c.length - 1);
1485
+ const H = (C != null ? (q = I.value.get(s)) == null ? void 0 : q.get(C) : void 0) ?? S.value.get(s), F = H ? Math.round((Date.now() - H) / 1e3 * 10) / 10 : 0;
1486
1486
  let u = 0;
1487
- const p = c[x];
1488
- p && p.duration == null && (c[x] = { ...p, duration: F }, p.type === "thinking" && (u = F)), l.value.set(s, c), v((Y) => {
1487
+ const p = c[T];
1488
+ p && p.duration == null && (c[T] = { ...p, duration: F }, p.type === "thinking" && (u = F)), l.value.set(s, c), v((Y) => {
1489
1489
  if (Y[s]) {
1490
- const oe = [...Y];
1491
- return oe[s] = {
1492
- ...oe[s],
1493
- segments: c.map((J) => ({ ...J })),
1494
- ...u ? { thinkingDuration: (oe[s].thinkingDuration || 0) + u } : {}
1495
- }, oe;
1490
+ const ae = [...Y];
1491
+ return ae[s] = {
1492
+ ...ae[s],
1493
+ segments: c.map((Q) => ({ ...Q })),
1494
+ ...u ? { thinkingDuration: (ae[s].thinkingDuration || 0) + u } : {}
1495
+ }, ae;
1496
1496
  }
1497
1497
  return Y;
1498
1498
  });
1499
1499
  break;
1500
1500
  }
1501
1501
  case "message_output_start":
1502
- r.value.set(s, "answer"), j(s);
1502
+ r.value.set(s, "answer"), J(s);
1503
1503
  break;
1504
1504
  // 对话流型智能体:回答输出结束 / 流程结束(状态统一由 message_end 收尾)
1505
1505
  case "message_output_end":
1506
1506
  case "flow_end":
1507
1507
  break;
1508
1508
  case "message": {
1509
- const c = D.answer || "", b = r.value.get(s), x = l.value.get(s) || [], H = x[x.length - 1];
1510
- b === "answer" && H && H.type === "answer" ? H.content += c : (j(s), r.value.set(s, "answer"), x.push({ type: "answer", content: c })), l.value.set(s, x);
1511
- const F = x.filter((u) => u.type === "answer").map((u) => u.content).join("");
1509
+ const c = D.answer || "", C = r.value.get(s), T = l.value.get(s) || [], H = T[T.length - 1];
1510
+ C === "answer" && H && H.type === "answer" ? H.content += c : (J(s), r.value.set(s, "answer"), T.push({ type: "answer", content: c })), l.value.set(s, T);
1511
+ const F = T.filter((u) => u.type === "answer").map((u) => u.content).join("");
1512
1512
  v((u) => {
1513
1513
  if (u[s]) {
1514
1514
  const p = [...u];
1515
1515
  return p[s] = {
1516
1516
  ...p[s],
1517
- segments: x.map((Y) => ({ ...Y })),
1517
+ segments: T.map((Y) => ({ ...Y })),
1518
1518
  content: F,
1519
- status: R.value ? f.STOP : f.ANSWERING
1519
+ status: P.value ? f.STOP : f.ANSWERING
1520
1520
  }, p;
1521
1521
  }
1522
1522
  return u;
@@ -1526,7 +1526,7 @@ function Mo({
1526
1526
  case "message_end": {
1527
1527
  a();
1528
1528
  const c = [...t.value];
1529
- c[s] && (c[s] = { ...c[s], status: R.value ? f.STOP : f.COMPLETED }), t.value = c, w.value = !1;
1529
+ c[s] && (c[s] = { ...c[s], status: P.value ? f.STOP : f.COMPLETED }), t.value = c, w.value = !1;
1530
1530
  break;
1531
1531
  }
1532
1532
  case "agent_error":
@@ -1542,13 +1542,13 @@ function Mo({
1542
1542
  break;
1543
1543
  }
1544
1544
  case "message_replace": {
1545
- const c = D.answer || "", b = l.value.get(s) || [], x = (X = b.map((H, F) => ({ s: H, i: F })).reverse().find((H) => H.s.type === "answer")) == null ? void 0 : X.i;
1546
- x != null ? b[x] = { ...b[x], content: c } : b.push({ type: "answer", content: c }), l.value.set(s, b), v((H) => {
1545
+ const c = D.answer || "", C = l.value.get(s) || [], T = (X = C.map((H, F) => ({ s: H, i: F })).reverse().find((H) => H.s.type === "answer")) == null ? void 0 : X.i;
1546
+ T != null ? C[T] = { ...C[T], content: c } : C.push({ type: "answer", content: c }), l.value.set(s, C), v((H) => {
1547
1547
  if (H[s]) {
1548
1548
  const F = [...H];
1549
1549
  return F[s] = {
1550
1550
  ...F[s],
1551
- segments: b.map((u) => ({ ...u })),
1551
+ segments: C.map((u) => ({ ...u })),
1552
1552
  content: c
1553
1553
  }, F;
1554
1554
  }
@@ -1563,12 +1563,12 @@ function Mo({
1563
1563
  latency: D.latency || 0,
1564
1564
  latencyFirstResp: D.latency_first_resp
1565
1565
  };
1566
- v((b) => {
1567
- if (b[s]) {
1568
- const x = [...b];
1569
- return x[s] = { ...x[s], cost: c }, x;
1566
+ v((C) => {
1567
+ if (C[s]) {
1568
+ const T = [...C];
1569
+ return T[s] = { ...T[s], cost: c }, T;
1570
1570
  }
1571
- return b;
1571
+ return C;
1572
1572
  });
1573
1573
  break;
1574
1574
  }
@@ -1579,35 +1579,35 @@ function Mo({
1579
1579
  }
1580
1580
  },
1581
1581
  onclose() {
1582
- a(), j(s), a();
1583
- const U = (l.value.get(s) || []).filter((O) => O.type === "answer").map((O) => O.content).join(""), m = [...t.value];
1582
+ a(), J(s), a();
1583
+ const Z = (l.value.get(s) || []).filter((O) => O.type === "answer").map((O) => O.content).join(""), m = [...t.value];
1584
1584
  m[s] && m[s].status !== f.ERROR && (m[s] = {
1585
1585
  ...m[s],
1586
- content: R.value && !U ? "已停止回答" : U,
1587
- status: R.value ? f.STOP : f.COMPLETED
1586
+ content: P.value && !Z ? "已停止回答" : Z,
1587
+ status: P.value ? f.STOP : f.COMPLETED
1588
1588
  }), t.value = m, w.value = !1;
1589
1589
  },
1590
1590
  onerror(k) {
1591
1591
  console.error("[ai-assist-sdk] ❌ 连接错误:", k), a();
1592
- const U = [...t.value];
1593
- U[s] && (U[s] = { ...U[s], content: `
1594
- ⚠️ 请求异常,已终止`, status: f.ERROR }), t.value = U, w.value = !1;
1592
+ const Z = [...t.value];
1593
+ Z[s] && (Z[s] = { ...Z[s], content: `
1594
+ ⚠️ 请求异常,已终止`, status: f.ERROR }), t.value = Z, w.value = !1;
1595
1595
  }
1596
1596
  });
1597
1597
  } catch (de) {
1598
- if (console.error("[ai-assist-sdk] doStreamRequest error:", de), !R.value) {
1598
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", de), !P.value) {
1599
1599
  a();
1600
1600
  const k = [...t.value];
1601
1601
  k[s] && (k[s] = { ...k[s], content: "服务连接失败,请稍后重试", status: f.ERROR }), t.value = k, w.value = !1;
1602
1602
  }
1603
1603
  }
1604
1604
  }
1605
- return { doStreamRequest: A, issTop: R };
1605
+ return { doStreamRequest: R, issTop: P };
1606
1606
  }
1607
- function $o(t) {
1607
+ function Mo(t) {
1608
1608
  return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
1609
1609
  }
1610
- function So({
1610
+ function $o({
1611
1611
  messages: t,
1612
1612
  userInput: w,
1613
1613
  isGenerating: e,
@@ -1617,169 +1617,184 @@ function So({
1617
1617
  issTop: g,
1618
1618
  scrollToBottom: l,
1619
1619
  STATUS: r,
1620
- cfg: M,
1621
- onTitleGenerated: C
1620
+ cfg: S,
1621
+ onTitleGenerated: b
1622
1622
  }) {
1623
- const E = M.apis, T = He({
1623
+ const E = S.apis, x = Oe({
1624
1624
  first: new AbortController(),
1625
1625
  again: new AbortController()
1626
- }), I = _(!1), R = _("");
1626
+ }), I = _(!1), P = _("");
1627
1627
  let y = 0, N = null;
1628
- function j() {
1628
+ function J() {
1629
1629
  var m;
1630
- return Ct() === "page" && !!((m = Ve()) != null && m.api);
1630
+ return Ct() === "page" && !!((m = We()) != null && m.api);
1631
1631
  }
1632
- async function A(m, O) {
1633
- var G, ne;
1634
- const q = (G = Ve()) == null ? void 0 : G.api;
1632
+ async function R(m, O) {
1633
+ var te, fe;
1634
+ const q = (te = We()) == null ? void 0 : te.api;
1635
1635
  if (!q) return;
1636
- const X = We(), L = ++y;
1636
+ const X = Be(), L = ++y;
1637
1637
  N == null || N.abort();
1638
1638
  const D = new AbortController();
1639
1639
  N = D, e.value = !0;
1640
1640
  const c = () => {
1641
- var se;
1642
- const P = t.value;
1643
- if (((se = P[O]) == null ? void 0 : se.type) === "ai") return O;
1644
- for (let ee = P.length - 1; ee >= 0; ee -= 1)
1645
- if (P[ee].type === "ai") return ee;
1641
+ var ee;
1642
+ const A = t.value;
1643
+ if (((ee = A[O]) == null ? void 0 : ee.type) === "ai") return O;
1644
+ for (let ne = A.length - 1; ne >= 0; ne -= 1)
1645
+ if (A[ne].type === "ai") return ne;
1646
1646
  return -1;
1647
- }, b = (P, se = !1) => {
1647
+ }, C = (A, ee = !1) => {
1648
1648
  if (L !== y) return;
1649
- const ee = c();
1650
- if (ee < 0) return;
1651
- const Z = [...t.value];
1652
- Z[ee] = P(Z[ee]), t.value = Z, se && l();
1653
- }, x = (P, se) => b((ee) => ({ ...ee, content: P, status: se }), !0);
1649
+ const ne = c();
1650
+ if (ne < 0) return;
1651
+ const oe = [...t.value];
1652
+ oe[ne] = A(oe[ne]), t.value = oe, ee && l();
1653
+ }, T = (A, ee) => C((ne) => ({ ...ne, content: A, status: ee }), !0);
1654
1654
  let H = "", F = 0, u = null;
1655
1655
  const p = () => {
1656
1656
  u && (clearInterval(u), u = null);
1657
- }, Y = (P, se) => {
1658
- H = P, F = Date.now(), b((ee) => {
1659
- var Z;
1660
- return {
1661
- ...ee,
1662
- toolState: { name: se || ((Z = ee.toolState) == null ? void 0 : Z.name) || "status", status: "running", message: P }
1657
+ }, Y = (A, ee, ne = !1) => {
1658
+ let oe = !1;
1659
+ C((ye) => {
1660
+ var Te, Se;
1661
+ oe = !0;
1662
+ const $e = `${ne && ((Te = ye.toolState) == null ? void 0 : Te.status) === "done" && ye.toolState.message ? `${ye.toolState.message},` : ""}${A}`;
1663
+ return H = $e, F = Date.now(), {
1664
+ ...ye,
1665
+ toolState: { name: ee || ((Se = ye.toolState) == null ? void 0 : Se.name) || "status", status: "running", message: $e }
1663
1666
  };
1664
- }), p(), u = setInterval(() => {
1667
+ }), oe && (p(), u = setInterval(() => {
1665
1668
  if (L !== y || !H) return;
1666
- const ee = Math.round((Date.now() - F) / 1e3);
1667
- ee < 2 || b((Z) => {
1668
- var _e;
1669
+ const ye = Math.round((Date.now() - F) / 1e3);
1670
+ ye < 2 || C((Re) => {
1671
+ var $e;
1669
1672
  return {
1670
- ...Z,
1673
+ ...Re,
1671
1674
  toolState: {
1672
- name: ((_e = Z.toolState) == null ? void 0 : _e.name) || "status",
1675
+ name: (($e = Re.toolState) == null ? void 0 : $e.name) || "status",
1673
1676
  status: "running",
1674
- message: `${H}(已用 ${ee}s)`
1677
+ message: `${H}(已用 ${ye}s)`
1675
1678
  }
1676
1679
  };
1677
1680
  });
1678
- }, 1e3);
1681
+ }, 1e3));
1679
1682
  };
1680
- let oe = "", J = "", B = null;
1683
+ let ae = "", Q = "", B = null;
1681
1684
  const W = () => {
1682
1685
  B && (clearInterval(B), B = null);
1683
1686
  }, ue = () => {
1684
- const P = rn(oe);
1685
- if (P.length <= J.length) return;
1686
- const se = Math.max(2, Math.ceil((P.length - J.length) / 12));
1687
- J = P.slice(0, J.length + se), x(J, r.ANSWERING);
1688
- }, Q = () => {
1687
+ const A = rn(ae);
1688
+ if (A.length <= Q.length) return;
1689
+ const ee = Math.max(2, Math.ceil((A.length - Q.length) / 12));
1690
+ Q = A.slice(0, Q.length + ee), T(Q, r.ANSWERING);
1691
+ }, j = () => {
1689
1692
  B || (B = setInterval(ue, 24));
1690
1693
  }, ve = () => {
1691
1694
  W();
1692
- const P = rn(oe);
1693
- P !== J && (J = P, x(J, r.ANSWERING));
1694
- }, fe = (P) => {
1695
- if (P.type === "status")
1696
- Y(P.message || "正在处理…");
1697
- else if (P.type === "tool")
1698
- Y(P.message || "正在查询数据…", P.name);
1699
- else if (P.type === "tool_result")
1700
- p(), H = "", b((se) => {
1701
- var ee;
1695
+ const A = rn(ae);
1696
+ A !== Q && (Q = A, T(Q, r.ANSWERING));
1697
+ }, me = () => {
1698
+ p(), C((A) => {
1699
+ var ee;
1700
+ return ((ee = A.toolState) == null ? void 0 : ee.status) !== "running" ? A : {
1701
+ ...A,
1702
+ toolState: {
1703
+ ...A.toolState,
1704
+ status: "done",
1705
+ message: (A.toolState.message || "").replace(/(已用 \d+s)$/, "")
1706
+ }
1707
+ };
1708
+ });
1709
+ }, G = (A) => {
1710
+ if (A.type === "status")
1711
+ Y(A.message || "正在处理…", void 0, A.phase === "answering");
1712
+ else if (A.type === "tool")
1713
+ Y(A.message || "正在查询数据…", A.name);
1714
+ else if (A.type === "tool_result")
1715
+ p(), H = "", C((ee) => {
1716
+ var ne;
1702
1717
  return {
1703
- ...se,
1718
+ ...ee,
1704
1719
  toolState: {
1705
- name: ((ee = se.toolState) == null ? void 0 : ee.name) || "turnover_trend",
1706
- status: P.ok ? "done" : "failed",
1707
- message: P.summary
1720
+ name: ((ne = ee.toolState) == null ? void 0 : ne.name) || "turnover_trend",
1721
+ status: A.ok ? "done" : "failed",
1722
+ message: A.summary
1708
1723
  }
1709
1724
  };
1710
1725
  });
1711
- else if (P.type === "chart") {
1712
- const se = { chartId: P.chartId, option: P.option };
1713
- b((ee) => ({
1714
- ...ee,
1715
- charts: [...(ee.charts || []).filter((Z) => Z.chartId !== se.chartId), se]
1726
+ else if (A.type === "chart") {
1727
+ const ee = { chartId: A.chartId, option: A.option };
1728
+ C((ne) => ({
1729
+ ...ne,
1730
+ charts: [...(ne.charts || []).filter((oe) => oe.chartId !== ee.chartId), ee]
1716
1731
  }));
1717
1732
  }
1718
1733
  };
1719
1734
  try {
1720
- let P = Rt(X);
1721
- if (P || (P = await q.createThread({ module: X }), xt(P, X)), L !== y) return;
1722
- const se = await _t();
1735
+ let A = Rt(X);
1736
+ if (A || (A = await q.createThread({ module: X }), Tt(A, X)), L !== y) return;
1737
+ const ee = await _t();
1723
1738
  if (L !== y) return;
1724
- let ee = "";
1725
- const Z = q.chatStream ? await q.chatStream({
1739
+ let ne = "";
1740
+ const oe = q.chatStream ? await q.chatStream({
1726
1741
  module: X,
1727
- threadId: P,
1742
+ threadId: A,
1728
1743
  question: m,
1729
- pageContext: se,
1744
+ pageContext: ee,
1730
1745
  signal: D.signal,
1731
- onMeta: (Oe) => {
1732
- Oe != null && Oe.threadId && xt(Oe.threadId, X);
1746
+ onMeta: (Se) => {
1747
+ Se != null && Se.threadId && Tt(Se.threadId, X);
1733
1748
  },
1734
- onDelta: (Oe) => {
1735
- ee += Oe, oe = ee, Q();
1749
+ onDelta: (Se) => {
1750
+ ne += Se, ae = ne, Q || me(), j();
1736
1751
  },
1737
- onEvent: fe
1738
- }) : await q.chat({ module: X, threadId: P, question: m, pageContext: se });
1752
+ onEvent: G
1753
+ }) : await q.chat({ module: X, threadId: A, question: m, pageContext: ee });
1739
1754
  if (L !== y) return;
1740
- Z != null && Z.threadId && xt(Z.threadId, X), p(), ve();
1741
- const _e = Bs((Z == null ? void 0 : Z.content) || ee), Re = c();
1755
+ oe != null && oe.threadId && Tt(oe.threadId, X), p(), ve();
1756
+ const ye = Bs((oe == null ? void 0 : oe.content) || ne), Re = c();
1742
1757
  if (Re < 0) return;
1743
- const Ne = [...t.value], be = Ne[Re];
1744
- Ne[Re] = {
1758
+ const $e = [...t.value], Te = $e[Re];
1759
+ $e[Re] = {
1745
1760
  type: "ai",
1746
- content: _e.answer,
1761
+ content: ye.answer,
1747
1762
  status: r.COMPLETED,
1748
- actions: _e.actions,
1749
- suggestions: _e.suggestions,
1750
- files: (Z == null ? void 0 : Z.files) ?? [],
1763
+ actions: ye.actions,
1764
+ suggestions: ye.suggestions,
1765
+ files: (oe == null ? void 0 : oe.files) ?? [],
1751
1766
  // 图表始终并入当前回答消息,不新开气泡
1752
- charts: (ne = Z == null ? void 0 : Z.charts) != null && ne.length ? Z.charts : (be == null ? void 0 : be.charts) || [],
1767
+ charts: (fe = oe == null ? void 0 : oe.charts) != null && fe.length ? oe.charts : (Te == null ? void 0 : Te.charts) || [],
1753
1768
  // 结束时收掉「正在…(已用 Ns)」状态,避免 spinner 一直转
1754
- toolState: be != null && be.toolState ? {
1755
- ...be.toolState,
1756
- status: be.toolState.status === "running" ? "done" : be.toolState.status,
1757
- message: (be.toolState.message || "").replace(/(已用 \d+s)$/, "")
1769
+ toolState: Te != null && Te.toolState ? {
1770
+ ...Te.toolState,
1771
+ status: Te.toolState.status === "running" ? "done" : Te.toolState.status,
1772
+ message: (Te.toolState.message || "").replace(/(已用 \d+s)$/, "")
1758
1773
  } : void 0
1759
- }, t.value = Ne;
1760
- } catch (P) {
1774
+ }, t.value = $e;
1775
+ } catch (A) {
1761
1776
  if (L !== y) return;
1762
1777
  p(), W();
1763
- const se = c();
1764
- if (se < 0) return;
1765
- if ((P == null ? void 0 : P.name) === "AbortError" || (P == null ? void 0 : P.code) === "ABORT_ERR") {
1766
- const Z = [...t.value];
1767
- Z[se] = { ...Z[se], status: r.STOP }, t.value = Z;
1778
+ const ee = c();
1779
+ if (ee < 0) return;
1780
+ if ((A == null ? void 0 : A.name) === "AbortError" || (A == null ? void 0 : A.code) === "ABORT_ERR") {
1781
+ const oe = [...t.value];
1782
+ oe[ee] = { ...oe[ee], status: r.STOP }, t.value = oe;
1768
1783
  return;
1769
1784
  }
1770
- const ee = [...t.value];
1771
- ee[se] = {
1785
+ const ne = [...t.value];
1786
+ ne[ee] = {
1772
1787
  type: "ai",
1773
- content: (P == null ? void 0 : P.message) || "AI 服务连接失败,请稍后重试",
1788
+ content: (A == null ? void 0 : A.message) || "AI 服务连接失败,请稍后重试",
1774
1789
  status: r.ERROR
1775
- }, t.value = ee;
1790
+ }, t.value = ne;
1776
1791
  } finally {
1777
1792
  p(), W(), L === y && (e.value = !1, N = null);
1778
1793
  }
1779
1794
  }
1780
1795
  async function V(m, O) {
1781
1796
  var X;
1782
- if (j() || !M.titleGenerateApp || !E.updateConversationApi || I.value) return;
1797
+ if (J() || !S.titleGenerateApp || !E.updateConversationApi || I.value) return;
1783
1798
  let q = a.value;
1784
1799
  if (!q)
1785
1800
  try {
@@ -1791,14 +1806,14 @@ function So({
1791
1806
  }
1792
1807
  if (q)
1793
1808
  try {
1794
- const L = await us(E, M.titleGenerateApp);
1809
+ const L = await us(E, S.titleGenerateApp);
1795
1810
  if (!L) return;
1796
1811
  const D = O.length > 500 ? O.slice(0, 500) : O, c = `用户提问:${m}
1797
- AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1798
- app: M.titleGenerateApp,
1812
+ AI回答:${D}`, T = await tn().post(E.chatQueryApi, {
1813
+ app: S.titleGenerateApp,
1799
1814
  data: { Query: c, AppConversationID: L }
1800
- }), H = cs(nn(x.data));
1801
- H && (await ds(E, q, H), I.value = !0, C == null || C(H));
1815
+ }), H = cs(nn(T.data));
1816
+ H && (await ds(E, q, H), I.value = !0, b == null || b(H));
1802
1817
  } catch (L) {
1803
1818
  console.error("[ai-assist-sdk] 生成对话标题失败:", L);
1804
1819
  }
@@ -1807,14 +1822,14 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1807
1822
  var D;
1808
1823
  const m = w.value.trim();
1809
1824
  if (!m || e.value) return;
1810
- const O = j();
1825
+ const O = J();
1811
1826
  if (!O && !a.value && (await de(), !a.value)) {
1812
- Fe("创建会话失败,请重试");
1827
+ Ie("创建会话失败,请重试");
1813
1828
  return;
1814
1829
  }
1815
1830
  const q = t.value.length === 0;
1816
1831
  try {
1817
- (D = M.onMessageSend) == null || D.call(M, { text: m, isFirstMessage: q, conversationId: a.value });
1832
+ (D = S.onMessageSend) == null || D.call(S, { text: m, isFirstMessage: q, conversationId: a.value });
1818
1833
  } catch {
1819
1834
  }
1820
1835
  const X = [
@@ -1826,7 +1841,7 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1826
1841
  t.value = X, w.value = "", l();
1827
1842
  const L = X.length - 1;
1828
1843
  if (O) {
1829
- R.value = m, await A(m, L);
1844
+ P.value = m, await R(m, L);
1830
1845
  return;
1831
1846
  }
1832
1847
  if (E.chatQueryStreamApi) {
@@ -1834,7 +1849,7 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1834
1849
  Query: m,
1835
1850
  AppConversationID: a.value,
1836
1851
  ResponseMode: "streaming"
1837
- }, L, T.first.signal), q && !I.value) {
1852
+ }, L, x.first.signal), q && !I.value) {
1838
1853
  const c = t.value[L];
1839
1854
  c && c.status !== r.ERROR && V(m, c.content);
1840
1855
  }
@@ -1842,48 +1857,48 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1842
1857
  }
1843
1858
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
1844
1859
  try {
1845
- const b = await tn().post(E.chatQueryApi, {
1846
- app: M.app ?? 1,
1860
+ const C = await tn().post(E.chatQueryApi, {
1861
+ app: S.app ?? 1,
1847
1862
  data: { Query: m, AppConversationID: a.value }
1848
- }), x = nn(b.data);
1863
+ }), T = nn(C.data);
1849
1864
  t.value = [
1850
1865
  ...t.value.slice(0, -1),
1851
- { type: "ai", content: x || "未获取到回答内容,请稍后重试", status: r.COMPLETED }
1852
- ], q && !I.value && x && V(m, x);
1866
+ { type: "ai", content: T || "未获取到回答内容,请稍后重试", status: r.COMPLETED }
1867
+ ], q && !I.value && T && V(m, T);
1853
1868
  } catch (c) {
1854
1869
  t.value = [...t.value.slice(0, -1), { type: "ai", content: (c == null ? void 0 : c.message) || "服务连接失败,请稍后重试", status: r.ERROR }];
1855
1870
  }
1856
1871
  }
1857
1872
  async function s() {
1858
- if (j()) {
1859
- if (!R.value || e.value) return;
1873
+ if (J()) {
1874
+ if (!P.value || e.value) return;
1860
1875
  const X = [...t.value];
1861
- X.length > 0 && X[X.length - 1].type === "ai" && X.pop(), X.push({ type: "ai", content: "", status: r.RETHINKING, streamed: !0 }), t.value = X, l(), await A(R.value, t.value.length - 1);
1876
+ X.length > 0 && X[X.length - 1].type === "ai" && X.pop(), X.push({ type: "ai", content: "", status: r.RETHINKING, streamed: !0 }), t.value = X, l(), await R(P.value, t.value.length - 1);
1862
1877
  return;
1863
1878
  }
1864
1879
  if (!v.value || e.value) return;
1865
- T.again.abort(), T.again = new AbortController();
1880
+ x.again.abort(), x.again = new AbortController();
1866
1881
  const m = [...t.value];
1867
1882
  m.length > 0 && m[m.length - 1].type === "ai" && m.pop(), m.push({ type: "ai", content: "", status: r.RETHINKING, streamed: !0 }), t.value = m, l();
1868
- const O = t.value.length - 1, q = $o(E);
1883
+ const O = t.value.length - 1, q = Mo(E);
1869
1884
  await f(q, {
1870
1885
  MessageID: v.value,
1871
1886
  AppConversationID: a.value,
1872
1887
  ResponseMode: "streaming"
1873
- }, O, T.again.signal, !0);
1888
+ }, O, x.again.signal, !0);
1874
1889
  }
1875
- async function ae() {
1890
+ async function se() {
1876
1891
  var q;
1877
1892
  if (!e.value) return;
1878
1893
  const m = t.value.length - 1;
1879
- if (j()) {
1894
+ if (J()) {
1880
1895
  y++, N == null || N.abort(), N = null;
1881
- const X = (q = Ve()) == null ? void 0 : q.api, L = We(), D = Rt(L);
1896
+ const X = (q = We()) == null ? void 0 : q.api, L = Be(), D = Rt(L);
1882
1897
  if (X != null && X.stop && D)
1883
1898
  try {
1884
1899
  await X.stop({ module: L, threadId: D });
1885
- } catch (b) {
1886
- console.error("[ai-assist-sdk] page stop failed:", b);
1900
+ } catch (C) {
1901
+ console.error("[ai-assist-sdk] page stop failed:", C);
1887
1902
  }
1888
1903
  const c = [...t.value];
1889
1904
  c[m] && (c[m] = {
@@ -1902,7 +1917,7 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1902
1917
  return;
1903
1918
  }
1904
1919
  const O = [...t.value];
1905
- O[m] && (O[m] = { ...O[m], content: O[m].content || "已停止回答", status: r.STOP }), t.value = O, e.value = !1, T.first.abort(), T.first = new AbortController(), T.again.abort(), T.again = new AbortController(), g.value = !0;
1920
+ O[m] && (O[m] = { ...O[m], content: O[m].content || "已停止回答", status: r.STOP }), t.value = O, e.value = !1, x.first.abort(), x.first = new AbortController(), x.again.abort(), x.again = new AbortController(), g.value = !0;
1906
1921
  }
1907
1922
  async function re(m) {
1908
1923
  var O;
@@ -1913,7 +1928,7 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1913
1928
  D.query && X.push({ type: "user", content: D.query }), (O = D.answerInfo) != null && O.answer && X.push({ type: "ai", content: D.answerInfo.answer, status: r.COMPLETED });
1914
1929
  t.value = X, l();
1915
1930
  } catch (q) {
1916
- Fe((q == null ? void 0 : q.message) || "加载历史会话失败");
1931
+ Ie((q == null ? void 0 : q.message) || "加载历史会话失败");
1917
1932
  }
1918
1933
  }
1919
1934
  async function de() {
@@ -1923,27 +1938,27 @@ AI回答:${D}`, x = await tn().post(E.chatQueryApi, {
1923
1938
  const O = await en(E);
1924
1939
  (m = O == null ? void 0 : O.conversation) != null && m.appConversationID && (a.value = O.conversation.appConversationID);
1925
1940
  } catch (O) {
1926
- Fe((O == null ? void 0 : O.message) || "创建会话失败");
1941
+ Ie((O == null ? void 0 : O.message) || "创建会话失败");
1927
1942
  }
1928
1943
  }
1929
1944
  function k() {
1930
- a.value = "", I.value = !1, R.value = "", y++, N == null || N.abort(), N = null, os();
1945
+ a.value = "", I.value = !1, P.value = "", y++, N == null || N.abort(), N = null, os();
1931
1946
  }
1932
- function U() {
1933
- y++, N == null || N.abort(), N = null, e.value = !1, R.value = "", t.value = [], w.value = "", g.value = !0;
1947
+ function Z() {
1948
+ y++, N == null || N.abort(), N = null, e.value = !1, P.value = "", t.value = [], w.value = "", g.value = !0;
1934
1949
  }
1935
1950
  return {
1936
1951
  sendMessage: le,
1937
1952
  regenerateResponse: s,
1938
- toggleStop: ae,
1953
+ toggleStop: se,
1939
1954
  goHistoryMessage: re,
1940
1955
  initConversation: de,
1941
1956
  resetConversation: k,
1942
- clearMessagesKeepingThread: U,
1943
- controllers: T
1957
+ clearMessagesKeepingThread: Z,
1958
+ controllers: x
1944
1959
  };
1945
1960
  }
1946
- function To({
1961
+ function xo({
1947
1962
  cfg: t,
1948
1963
  STATUS: w,
1949
1964
  userInput: e,
@@ -1953,20 +1968,20 @@ function To({
1953
1968
  }) {
1954
1969
  const g = ns([]), l = _("");
1955
1970
  let r = 0;
1956
- const M = S(
1971
+ const S = $(
1957
1972
  () => g.value.find((k) => k.uid === l.value) ?? null
1958
- ), C = S(() => {
1973
+ ), b = $(() => {
1959
1974
  var k;
1960
- return ((k = M.value) == null ? void 0 : k.messages.value) ?? [];
1961
- }), E = S(() => {
1975
+ return ((k = S.value) == null ? void 0 : k.messages.value) ?? [];
1976
+ }), E = $(() => {
1962
1977
  var k;
1963
- return ((k = M.value) == null ? void 0 : k.isGenerating.value) ?? !1;
1964
- }), T = S(
1978
+ return ((k = S.value) == null ? void 0 : k.isGenerating.value) ?? !1;
1979
+ }), x = $(
1965
1980
  () => {
1966
1981
  var k;
1967
- return (((k = M.value) == null ? void 0 : k.messages.value.length) ?? 0) === 0;
1982
+ return (((k = S.value) == null ? void 0 : k.messages.value.length) ?? 0) === 0;
1968
1983
  }
1969
- ), I = S(
1984
+ ), I = $(
1970
1985
  () => g.value.filter((k) => !!k.conversationId.value).map((k) => ({
1971
1986
  conversationId: k.conversationId.value,
1972
1987
  title: k.title.value,
@@ -1974,41 +1989,41 @@ function To({
1974
1989
  updatedAt: k.updatedAt.value
1975
1990
  }))
1976
1991
  );
1977
- function R(k = "") {
1978
- const U = k || `draft-${++r}`, m = _([]), O = _(!1), q = _(""), X = _(k), L = _(""), D = _(Date.now()), c = /* @__PURE__ */ new Map(), { batchMessagesUpdate: b, flushMessagesBatch: x } = bo(m), { doStreamRequest: H, issTop: F } = Mo({
1992
+ function P(k = "") {
1993
+ const Z = k || `draft-${++r}`, m = _([]), O = _(!1), q = _(""), X = _(k), L = _(""), D = _(Date.now()), c = /* @__PURE__ */ new Map(), { batchMessagesUpdate: C, flushMessagesBatch: T } = bo(m), { doStreamRequest: H, issTop: F } = So({
1979
1994
  messages: m,
1980
1995
  isGenerating: O,
1981
1996
  lastUserMessage: q,
1982
- batchMessagesUpdate: b,
1983
- flushMessagesBatch: x,
1997
+ batchMessagesUpdate: C,
1998
+ flushMessagesBatch: T,
1984
1999
  STATUS: w,
1985
2000
  cfg: t
1986
- }), Y = So({
2001
+ }), Y = $o({
1987
2002
  messages: m,
1988
2003
  userInput: e,
1989
2004
  isGenerating: O,
1990
2005
  lastUserMessage: q,
1991
2006
  conversationId: X,
1992
- doStreamRequest: async (oe, J, B, W, ue) => {
2007
+ doStreamRequest: async (ae, Q, B, W, ue) => {
1993
2008
  D.value = Date.now();
1994
2009
  try {
1995
- return await H(oe, J, B, W, ue);
2010
+ return await H(ae, Q, B, W, ue);
1996
2011
  } finally {
1997
2012
  D.value = Date.now();
1998
2013
  }
1999
2014
  },
2000
2015
  issTop: F,
2001
2016
  scrollToBottom: () => {
2002
- v(U) && a();
2017
+ v(Z) && a();
2003
2018
  },
2004
2019
  STATUS: w,
2005
2020
  cfg: t,
2006
- onTitleGenerated: (oe) => {
2007
- L.value = oe, D.value = Date.now(), f == null || f(U, oe);
2021
+ onTitleGenerated: (ae) => {
2022
+ L.value = ae, D.value = Date.now(), f == null || f(Z, ae);
2008
2023
  }
2009
2024
  });
2010
2025
  return {
2011
- uid: U,
2026
+ uid: Z,
2012
2027
  conversationId: X,
2013
2028
  messages: m,
2014
2029
  isGenerating: O,
@@ -2029,51 +2044,51 @@ function To({
2029
2044
  }
2030
2045
  function N() {
2031
2046
  let k = g.value.find(
2032
- (U) => !U.conversationId.value && !U.isGenerating.value && U.messages.value.length === 0
2047
+ (Z) => !Z.conversationId.value && !Z.isGenerating.value && Z.messages.value.length === 0
2033
2048
  );
2034
- k || (k = R(""), g.value = [...g.value, k]), k.resetConversation(), y(k.uid);
2049
+ k || (k = P(""), g.value = [...g.value, k]), k.resetConversation(), y(k.uid);
2035
2050
  }
2036
- function j(k) {
2037
- const U = g.value.find((O) => O.conversationId.value === k);
2038
- if (U) {
2039
- y(U.uid);
2051
+ function J(k) {
2052
+ const Z = g.value.find((O) => O.conversationId.value === k);
2053
+ if (Z) {
2054
+ y(Z.uid);
2040
2055
  return;
2041
2056
  }
2042
- const m = R(k);
2057
+ const m = P(k);
2043
2058
  g.value = [...g.value, m], y(m.uid), m.loadHistory(k);
2044
2059
  }
2045
- function A() {
2046
- return M.value;
2060
+ function R() {
2061
+ return S.value;
2047
2062
  }
2048
2063
  async function V() {
2049
2064
  var k;
2050
- await ((k = A()) == null ? void 0 : k.sendMessage());
2065
+ await ((k = R()) == null ? void 0 : k.sendMessage());
2051
2066
  }
2052
2067
  async function le() {
2053
2068
  var k;
2054
- await ((k = A()) == null ? void 0 : k.toggleStop());
2069
+ await ((k = R()) == null ? void 0 : k.toggleStop());
2055
2070
  }
2056
2071
  async function s() {
2057
2072
  var k;
2058
- await ((k = A()) == null ? void 0 : k.regenerateResponse());
2073
+ await ((k = R()) == null ? void 0 : k.regenerateResponse());
2059
2074
  }
2060
- function ae() {
2075
+ function se() {
2061
2076
  var k;
2062
- (k = A()) == null || k.clearMessages();
2077
+ (k = R()) == null || k.clearMessages();
2063
2078
  }
2064
2079
  async function re(k) {
2065
2080
  var X;
2066
2081
  if (Ct() !== "page") return;
2067
- const U = k ?? M.value;
2068
- if (!U || U.messages.value.length) return;
2069
- const m = (X = Ve()) == null ? void 0 : X.api;
2082
+ const Z = k ?? S.value;
2083
+ if (!Z || Z.messages.value.length) return;
2084
+ const m = (X = We()) == null ? void 0 : X.api;
2070
2085
  if (!(m != null && m.state)) return;
2071
- const O = We(), q = Rt(O);
2086
+ const O = Be(), q = Rt(O);
2072
2087
  if (q)
2073
2088
  try {
2074
2089
  const L = await m.state({ module: O, threadId: q }), D = ((L == null ? void 0 : L.messages) || []).filter((c) => {
2075
- var b;
2076
- return !(c.role === "assistant" && !c.content && !((b = c.charts) != null && b.length));
2090
+ var C;
2091
+ return !(c.role === "assistant" && !c.content && !((C = c.charts) != null && C.length));
2077
2092
  }).map((c) => ({
2078
2093
  type: c.role === "user" ? "user" : "ai",
2079
2094
  content: c.content,
@@ -2082,34 +2097,34 @@ function To({
2082
2097
  charts: c.role === "assistant" ? c.charts ?? [] : void 0
2083
2098
  }));
2084
2099
  if (!D.length) return;
2085
- U.conversationId.value = L.threadId || q, U.messages.value = D, v(U.uid) && a();
2100
+ Z.conversationId.value = L.threadId || q, Z.messages.value = D, v(Z.uid) && a();
2086
2101
  } catch (L) {
2087
2102
  console.warn("[ai-assist-sdk] 恢复页面会话失败:", L);
2088
2103
  }
2089
2104
  }
2090
- const de = R("");
2105
+ const de = P("");
2091
2106
  return g.value = [de], l.value = de.uid, re(de), {
2092
2107
  sessions: g,
2093
2108
  activeUid: l,
2094
- activeSession: M,
2095
- messages: C,
2109
+ activeSession: S,
2110
+ messages: b,
2096
2111
  isGenerating: E,
2097
- isEmptyConversation: T,
2112
+ isEmptyConversation: x,
2098
2113
  sessionMetas: I,
2099
2114
  sendMessage: V,
2100
2115
  toggleStop: le,
2101
2116
  regenerateResponse: s,
2102
- goHistoryMessage: j,
2117
+ goHistoryMessage: J,
2103
2118
  createNewConversation: N,
2104
- clearActiveMessages: ae,
2119
+ clearActiveMessages: se,
2105
2120
  /** page 模式:打开侧栏时按 threadId 恢复历史(幂等,已有消息直接返回) */
2106
2121
  restorePageHistory: re
2107
2122
  };
2108
2123
  }
2109
- const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "message ai-message greet-message" }, Ao = { class: "ai-greet" }, Ro = ["src"], Po = {
2124
+ const To = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "message ai-message greet-message" }, Ao = { class: "ai-greet" }, Ro = ["src"], Po = {
2110
2125
  key: 0,
2111
2126
  class: "message ai-message recommend-message"
2112
- }, Lo = { class: "ai-recommend" }, Ho = { class: "recommend-header" }, No = ["onClick"], Vo = /* @__PURE__ */ $e({
2127
+ }, Lo = { class: "ai-recommend" }, Ho = { class: "recommend-header" }, No = ["onClick"], Vo = /* @__PURE__ */ xe({
2113
2128
  __name: "Answer",
2114
2129
  props: {
2115
2130
  defaultSayhello: {},
@@ -2125,17 +2140,17 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2125
2140
  COMPLETED: "completed",
2126
2141
  STOP: "stop",
2127
2142
  ERROR: "error"
2128
- }, a = t, f = e, g = lt(), l = _(""), r = _(null), M = He({ text1: "", text2: "" }), C = _([]), E = _(0), T = S(
2129
- () => C.value[E.value % (C.value.length || 1)]
2143
+ }, a = t, f = e, g = lt(), l = _(""), r = _(null), S = Oe({ text1: "", text2: "" }), b = _([]), E = _(0), x = $(
2144
+ () => b.value[E.value % (b.value.length || 1)]
2130
2145
  );
2131
2146
  function I() {
2132
2147
  E.value++;
2133
2148
  }
2134
- const R = S(() => yn());
2135
- ge(
2149
+ const P = $(() => yn());
2150
+ pe(
2136
2151
  () => a.defaultRecommend,
2137
2152
  (G) => {
2138
- C.value = sn(G || []), E.value = 0;
2153
+ b.value = sn(G || []), E.value = 0;
2139
2154
  },
2140
2155
  { deep: !0 }
2141
2156
  );
@@ -2145,13 +2160,13 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2145
2160
  function N(G) {
2146
2161
  G && (l.value = G, O());
2147
2162
  }
2148
- const { isAtBottom: j, hasScroll: A, scrollToBottom: V, checkScrollStatus: le } = _o(r), { enhanceCodeBlocks: s } = Co();
2149
- let ae = (G) => !1;
2163
+ const { isAtBottom: J, hasScroll: R, scrollToBottom: V, checkScrollStatus: le } = _o(r), { enhanceCodeBlocks: s } = Co();
2164
+ let se = (G) => !1;
2150
2165
  const {
2151
2166
  activeSession: re,
2152
2167
  messages: de,
2153
2168
  isGenerating: k,
2154
- isEmptyConversation: U,
2169
+ isEmptyConversation: Z,
2155
2170
  sessionMetas: m,
2156
2171
  sendMessage: O,
2157
2172
  regenerateResponse: q,
@@ -2159,87 +2174,87 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2159
2174
  goHistoryMessage: L,
2160
2175
  createNewConversation: D,
2161
2176
  clearActiveMessages: c,
2162
- restorePageHistory: b
2163
- } = To({
2177
+ restorePageHistory: C
2178
+ } = xo({
2164
2179
  cfg: g,
2165
2180
  STATUS: v,
2166
2181
  userInput: l,
2167
- isActive: (G) => ae(G),
2182
+ isActive: (G) => se(G),
2168
2183
  scrollToBottom: V,
2169
- onSessionTitle: (G, ne) => {
2170
- ae(G) && f("title-generated", ne);
2184
+ onSessionTitle: (G, te) => {
2185
+ se(G) && f("title-generated", te);
2171
2186
  }
2172
2187
  });
2173
- ae = (G) => {
2174
- var ne;
2175
- return ((ne = re.value) == null ? void 0 : ne.uid) === G;
2176
- }, ge(re, (G) => {
2188
+ se = (G) => {
2189
+ var te;
2190
+ return ((te = re.value) == null ? void 0 : te.uid) === G;
2191
+ }, pe(re, (G) => {
2177
2192
  f("title-generated", (G == null ? void 0 : G.title.value) ?? "");
2178
- }), ge(m, (G) => f("sessions-change", G), { immediate: !0 });
2179
- function x(G, ne) {
2180
- var P;
2181
- (P = re.value) == null || P.reveal.set(G, ne);
2193
+ }), pe(m, (G) => f("sessions-change", G), { immediate: !0 });
2194
+ function T(G, te) {
2195
+ var fe;
2196
+ (fe = re.value) == null || fe.reveal.set(G, te);
2182
2197
  }
2183
2198
  w({
2184
2199
  goHistoryMessage: L,
2185
2200
  createNewConversation: D,
2186
2201
  clearActiveMessages: c,
2187
- isEmptyConversation: U,
2188
- restorePageHistory: b
2202
+ isEmptyConversation: Z,
2203
+ restorePageHistory: C
2189
2204
  });
2190
2205
  const H = _(/* @__PURE__ */ new Map());
2191
- function F(G, ne) {
2192
- G ? H.value.set(ne, G) : H.value.delete(ne);
2206
+ function F(G, te) {
2207
+ G ? H.value.set(te, G) : H.value.delete(te);
2193
2208
  }
2194
- ge(de, () => {
2195
- Se(() => {
2209
+ pe(de, () => {
2210
+ De(() => {
2196
2211
  H.value.forEach((G) => {
2197
2212
  s(G);
2198
2213
  }), le();
2199
2214
  });
2200
2215
  }, { deep: !0 });
2201
2216
  let u = null;
2202
- Pe(() => {
2203
- a.defaultSayhello && (M.text1 = a.defaultSayhello.text1, M.text2 = a.defaultSayhello.text2), a.defaultRecommend && (C.value = sn(a.defaultRecommend));
2204
- }), Pe(() => {
2217
+ Ne(() => {
2218
+ a.defaultSayhello && (S.text1 = a.defaultSayhello.text1, S.text2 = a.defaultSayhello.text2), a.defaultRecommend && (b.value = sn(a.defaultRecommend));
2219
+ }), Ne(() => {
2205
2220
  r.value && (u = () => le(), r.value.addEventListener("scroll", u), le());
2206
2221
  });
2207
2222
  const p = _(null);
2208
- let Y = !1, oe = 0, J = 0;
2223
+ let Y = !1, ae = 0, Q = 0;
2209
2224
  function B(G) {
2210
- var P;
2211
- const ne = (P = r.value) == null ? void 0 : P.closest(".chat-wrap");
2212
- return parseFloat((ne == null ? void 0 : ne.style.getPropertyValue(G)) ?? "") || 0;
2225
+ var fe;
2226
+ const te = (fe = r.value) == null ? void 0 : fe.closest(".chat-wrap");
2227
+ return parseFloat((te == null ? void 0 : te.style.getPropertyValue(G)) ?? "") || 0;
2213
2228
  }
2214
2229
  function W(G) {
2215
2230
  return "touches" in G ? G.touches[0].clientY : G.clientY;
2216
2231
  }
2217
2232
  function ue(G) {
2218
- const ne = r.value;
2219
- ne && (G.preventDefault(), Y = !0, oe = W(G), ne.scrollTop, J = B("--ai-thumb-top"), window.addEventListener("mousemove", Q), window.addEventListener("mouseup", ve), window.addEventListener("touchmove", Q, { passive: !1 }), window.addEventListener("touchend", ve));
2233
+ const te = r.value;
2234
+ te && (G.preventDefault(), Y = !0, ae = W(G), te.scrollTop, Q = B("--ai-thumb-top"), window.addEventListener("mousemove", j), window.addEventListener("mouseup", ve), window.addEventListener("touchmove", j, { passive: !1 }), window.addEventListener("touchend", ve));
2220
2235
  }
2221
- function Q(G) {
2222
- const ne = r.value;
2223
- if (!Y || !ne) return;
2236
+ function j(G) {
2237
+ const te = r.value;
2238
+ if (!Y || !te) return;
2224
2239
  G.preventDefault();
2225
- const P = W(G) - oe, se = ne.clientHeight, ee = ne.scrollHeight, Z = B("--ai-thumb-height"), _e = se - Z, Re = Math.min(Math.max(J + P, 0), _e);
2226
- ne.scrollTop = Re / _e * (ee - se);
2240
+ const fe = W(G) - ae, A = te.clientHeight, ee = te.scrollHeight, ne = B("--ai-thumb-height"), oe = A - ne, ye = Math.min(Math.max(Q + fe, 0), oe);
2241
+ te.scrollTop = ye / oe * (ee - A);
2227
2242
  }
2228
2243
  function ve() {
2229
- Y = !1, window.removeEventListener("mousemove", Q), window.removeEventListener("mouseup", ve), window.removeEventListener("touchmove", Q), window.removeEventListener("touchend", ve);
2244
+ Y = !1, window.removeEventListener("mousemove", j), window.removeEventListener("mouseup", ve), window.removeEventListener("touchmove", j), window.removeEventListener("touchend", ve);
2230
2245
  }
2231
- function fe(G) {
2232
- const ne = r.value, P = p.value;
2233
- if (!ne || !P) return;
2246
+ function me(G) {
2247
+ const te = r.value, fe = p.value;
2248
+ if (!te || !fe) return;
2234
2249
  G.preventDefault();
2235
- const se = P.getBoundingClientRect(), Z = (W(G) - se.top) / se.height;
2236
- ne.scrollTop = Z * (ne.scrollHeight - ne.clientHeight);
2250
+ const A = fe.getBoundingClientRect(), ne = (W(G) - A.top) / A.height;
2251
+ te.scrollTop = ne * (te.scrollHeight - te.clientHeight);
2237
2252
  }
2238
- return Be(() => {
2253
+ return Fe(() => {
2239
2254
  r.value && u && r.value.removeEventListener("scroll", u), ve();
2240
- }), (G, ne) => {
2241
- var P;
2242
- return i(), h("div", xo, [
2255
+ }), (G, te) => {
2256
+ var fe;
2257
+ return i(), h("div", To, [
2243
2258
  o("div", Do, [
2244
2259
  o("div", {
2245
2260
  class: "chat-box scrollWrap",
@@ -2249,46 +2264,46 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2249
2264
  o("div", Eo, [
2250
2265
  o("div", Ao, [
2251
2266
  o("img", { src: ie(_n) }, null, 8, Ro),
2252
- o("h1", null, te(M.text1), 1),
2253
- o("p", null, te(M.text2), 1)
2267
+ o("h1", null, U(S.text1), 1),
2268
+ o("p", null, U(S.text2), 1)
2254
2269
  ])
2255
2270
  ]),
2256
- (P = T.value) != null && P.length && (!R.value || ie(de).length === 0) ? (i(), h("div", Po, [
2271
+ (fe = x.value) != null && fe.length && (!P.value || ie(de).length === 0) ? (i(), h("div", Po, [
2257
2272
  o("div", Lo, [
2258
2273
  o("div", Ho, [
2259
- ne[2] || (ne[2] = o("span", null, "你可以尝试这样问我:", -1)),
2274
+ te[2] || (te[2] = o("span", null, "你可以尝试这样问我:", -1)),
2260
2275
  o("p", {
2261
2276
  class: "refresh-btn",
2262
2277
  onClick: I
2263
2278
  }, [
2264
- ke(Te, {
2279
+ Ce(Ee, {
2265
2280
  name: "refresh",
2266
2281
  class: "refresh-icon"
2267
2282
  }),
2268
- ne[1] || (ne[1] = o("span", null, "换一换", -1))
2283
+ te[1] || (te[1] = o("span", null, "换一换", -1))
2269
2284
  ])
2270
2285
  ]),
2271
2286
  o("ul", null, [
2272
- (i(!0), h(Ce, null, Ae(T.value, (se, ee) => (i(), h("li", {
2287
+ (i(!0), h(be, null, He(x.value, (A, ee) => (i(), h("li", {
2273
2288
  key: ee,
2274
- onClick: (Z) => y(se)
2275
- }, te(se), 9, No))), 128))
2289
+ onClick: (ne) => y(A)
2290
+ }, U(A), 9, No))), 128))
2276
2291
  ])
2277
2292
  ])
2278
2293
  ])) : z("", !0),
2279
- (i(!0), h(Ce, null, Ae(ie(de), (se, ee) => {
2280
- var Z, _e;
2281
- return i(), we(ao, {
2282
- key: `${((Z = ie(re)) == null ? void 0 : Z.uid) ?? ""}-${ee}`,
2283
- msg: se,
2294
+ (i(!0), h(be, null, He(ie(de), (A, ee) => {
2295
+ var ne, oe;
2296
+ return i(), _e(ao, {
2297
+ key: `${((ne = ie(re)) == null ? void 0 : ne.uid) ?? ""}-${ee}`,
2298
+ msg: A,
2284
2299
  index: ee,
2285
2300
  STATUS: v,
2286
2301
  setMessageRef: F,
2287
2302
  scrollToBottom: ie(V),
2288
- initialReveal: (_e = ie(re)) == null ? void 0 : _e.reveal.get(ee),
2303
+ initialReveal: (oe = ie(re)) == null ? void 0 : oe.reveal.get(ee),
2289
2304
  onRegenerate: ie(q),
2290
2305
  onAsk: N,
2291
- onRevealProgress: (Re) => x(ee, Re)
2306
+ onRevealProgress: (ye) => T(ee, ye)
2292
2307
  }, null, 8, ["msg", "index", "scrollToBottom", "initialReveal", "onRegenerate", "onRevealProgress"]);
2293
2308
  }), 128))
2294
2309
  ], 512),
@@ -2296,28 +2311,28 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2296
2311
  ref_key: "scrollbarRef",
2297
2312
  ref: p,
2298
2313
  class: "chat-box__scrollbar",
2299
- onMousedown: Le(fe, ["prevent"]),
2300
- onTouchstart: Le(fe, ["prevent"])
2314
+ onMousedown: Ve(me, ["prevent"]),
2315
+ onTouchstart: Ve(me, ["prevent"])
2301
2316
  }, [
2302
2317
  o("div", {
2303
2318
  class: "chat-box__scrollbar-thumb",
2304
- onMousedown: Le(ue, ["stop", "prevent"]),
2305
- onTouchstart: Le(ue, ["stop", "prevent"])
2319
+ onMousedown: Ve(ue, ["stop", "prevent"]),
2320
+ onTouchstart: Ve(ue, ["stop", "prevent"])
2306
2321
  }, null, 32)
2307
2322
  ], 544)
2308
2323
  ]),
2309
- ke(ko, {
2324
+ Ce(ko, {
2310
2325
  modelValue: l.value,
2311
- "onUpdate:modelValue": ne[0] || (ne[0] = (se) => l.value = se),
2326
+ "onUpdate:modelValue": te[0] || (te[0] = (A) => l.value = A),
2312
2327
  isGenerating: ie(k),
2313
- hasScroll: ie(A),
2314
- isAtBottom: ie(j),
2328
+ hasScroll: ie(R),
2329
+ isAtBottom: ie(J),
2315
2330
  onSend: ie(O),
2316
2331
  onRegenerate: ie(q),
2317
2332
  onStop: ie(X),
2318
2333
  onScrollToBottom: ie(V)
2319
2334
  }, null, 8, ["modelValue", "isGenerating", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
2320
- ne[3] || (ne[3] = o("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
2335
+ te[3] || (te[3] = o("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
2321
2336
  ]);
2322
2337
  };
2323
2338
  }
@@ -2330,108 +2345,108 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2330
2345
  }, qo = ["onClick"], Go = {
2331
2346
  key: 2,
2332
2347
  class: "ai-history-empty"
2333
- }, Ko = ["src"], Yo = { class: "ai-modal" }, Qo = { class: "ai-modal-footer" }, jo = /* @__PURE__ */ $e({
2348
+ }, Ko = ["src"], Yo = { class: "ai-modal" }, Qo = { class: "ai-modal-footer" }, jo = /* @__PURE__ */ xe({
2334
2349
  __name: "History",
2335
2350
  props: {
2336
2351
  localSessions: {}
2337
2352
  },
2338
2353
  emits: ["history-detail", "new-conversation"],
2339
2354
  setup(t, { emit: w }) {
2340
- const e = t, a = lt().apis, f = _([]), g = _(!0), l = _(!1), r = _(""), M = S(() => {
2341
- const R = f.value.map((y) => ({ ...y }));
2355
+ const e = t, a = lt().apis, f = _([]), g = _(!0), l = _(!1), r = _(""), S = $(() => {
2356
+ const P = f.value.map((y) => ({ ...y }));
2342
2357
  for (const y of e.localSessions ?? []) {
2343
2358
  if (!y.conversationId) continue;
2344
- const N = R.findIndex((A) => A.appConversationID === y.conversationId);
2359
+ const N = P.findIndex((R) => R.appConversationID === y.conversationId);
2345
2360
  if (N >= 0) {
2346
- R[N] = {
2347
- ...R[N],
2361
+ P[N] = {
2362
+ ...P[N],
2348
2363
  // 本地标题(标题生成完成)优先于服务端默认名
2349
- conversationName: y.title || R[N].conversationName,
2364
+ conversationName: y.title || P[N].conversationName,
2350
2365
  generating: y.generating
2351
2366
  };
2352
2367
  continue;
2353
2368
  }
2354
- const j = Math.floor(y.updatedAt / 1e3);
2355
- R.push({
2369
+ const J = Math.floor(y.updatedAt / 1e3);
2370
+ P.push({
2356
2371
  appConversationID: y.conversationId,
2357
2372
  conversationID: y.conversationId,
2358
2373
  conversationName: y.title || "新对话",
2359
2374
  createTime: "",
2360
- createTimestamp: j,
2375
+ createTimestamp: J,
2361
2376
  lastChatTime: "",
2362
- lastChatTimestamp: j,
2377
+ lastChatTimestamp: J,
2363
2378
  emptyConversation: !1,
2364
2379
  isPinned: !1,
2365
2380
  selected: !1,
2366
2381
  generating: y.generating
2367
2382
  });
2368
2383
  }
2369
- return R.map((y) => ({
2384
+ return P.map((y) => ({
2370
2385
  ...y,
2371
2386
  conversationName: vs(y.conversationName) ? "新的对话" : y.conversationName
2372
2387
  }));
2373
- }), C = S(() => hs(M.value));
2388
+ }), b = $(() => hs(S.value));
2374
2389
  async function E() {
2375
2390
  try {
2376
- const R = await fs(a);
2377
- R != null && R.conversationList && (f.value = R.conversationList.filter((y) => y !== null).map((y) => ({ ...y, selected: !1 })));
2378
- } catch (R) {
2379
- Fe((R == null ? void 0 : R.message) || "获取历史记录失败");
2391
+ const P = await fs(a);
2392
+ P != null && P.conversationList && (f.value = P.conversationList.filter((y) => y !== null).map((y) => ({ ...y, selected: !1 })));
2393
+ } catch (P) {
2394
+ Ie((P == null ? void 0 : P.message) || "获取历史记录失败");
2380
2395
  } finally {
2381
2396
  g.value = !1;
2382
2397
  }
2383
2398
  }
2384
- function T(R) {
2385
- r.value = R, l.value = !0;
2399
+ function x(P) {
2400
+ r.value = P, l.value = !0;
2386
2401
  }
2387
2402
  async function I() {
2388
2403
  l.value = !1;
2389
2404
  try {
2390
2405
  await ms(a, r.value), await E();
2391
- } catch (R) {
2392
- Fe((R == null ? void 0 : R.message) || "删除失败"), await E();
2406
+ } catch (P) {
2407
+ Ie((P == null ? void 0 : P.message) || "删除失败"), await E();
2393
2408
  }
2394
2409
  }
2395
- return Pe(() => {
2410
+ return Ne(() => {
2396
2411
  E();
2397
- }), (R, y) => (i(), h("div", Oo, [
2412
+ }), (P, y) => (i(), h("div", Oo, [
2398
2413
  o("div", Wo, [
2399
2414
  g.value ? (i(), h("div", Bo, [...y[3] || (y[3] = [
2400
2415
  o("div", { class: "ai-history-spinner" }, null, -1)
2401
- ])])) : C.value.length > 0 ? (i(!0), h(Ce, { key: 1 }, Ae(C.value, (N) => (i(), h("div", {
2416
+ ])])) : b.value.length > 0 ? (i(!0), h(be, { key: 1 }, He(b.value, (N) => (i(), h("div", {
2402
2417
  key: N.label,
2403
2418
  class: "ai-history-group"
2404
2419
  }, [
2405
- o("div", Fo, te(N.label), 1),
2406
- (i(!0), h(Ce, null, Ae(N.items, (j, A) => (i(), h("div", {
2407
- key: j.appConversationID,
2420
+ o("div", Fo, U(N.label), 1),
2421
+ (i(!0), h(be, null, He(N.items, (J, R) => (i(), h("div", {
2422
+ key: J.appConversationID,
2408
2423
  class: "ai-history-item",
2409
- style: kt({ "--i": A }),
2410
- onClick: (V) => R.$emit("history-detail", j.appConversationID)
2424
+ style: kt({ "--i": R }),
2425
+ onClick: (V) => P.$emit("history-detail", J.appConversationID)
2411
2426
  }, [
2412
2427
  o("div", Xo, [
2413
- fn(te(j.conversationName) + " ", 1),
2414
- j.generating ? (i(), h("span", zo, "生成中")) : z("", !0)
2428
+ fn(U(J.conversationName) + " ", 1),
2429
+ J.generating ? (i(), h("span", zo, "生成中")) : z("", !0)
2415
2430
  ]),
2416
2431
  o("div", {
2417
2432
  class: "ai-history-item-delete",
2418
- onClick: Le((V) => T(j.appConversationID), ["stop"])
2433
+ onClick: Ve((V) => x(J.appConversationID), ["stop"])
2419
2434
  }, "删除", 8, qo)
2420
2435
  ], 12, Io))), 128))
2421
2436
  ]))), 128)) : (i(), h("div", Go, "暂无历史记录"))
2422
2437
  ]),
2423
2438
  o("div", {
2424
2439
  class: "ai-add",
2425
- onClick: y[0] || (y[0] = (N) => R.$emit("new-conversation"))
2440
+ onClick: y[0] || (y[0] = (N) => P.$emit("new-conversation"))
2426
2441
  }, [
2427
2442
  o("img", { src: ie(Rs) }, null, 8, Ko),
2428
2443
  y[4] || (y[4] = o("span", null, "新建AI对话", -1))
2429
2444
  ]),
2430
- (i(), we(mn, { to: "#ai-assist-root" }, [
2445
+ (i(), _e(mn, { to: "#ai-assist-root" }, [
2431
2446
  l.value ? (i(), h("div", {
2432
2447
  key: 0,
2433
2448
  class: "ai-modal-overlay",
2434
- onClick: y[2] || (y[2] = Le((N) => l.value = !1, ["self"]))
2449
+ onClick: y[2] || (y[2] = Ve((N) => l.value = !1, ["self"]))
2435
2450
  }, [
2436
2451
  o("div", Yo, [
2437
2452
  y[5] || (y[5] = o("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
@@ -2451,18 +2466,18 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2451
2466
  ]))
2452
2467
  ]));
2453
2468
  }
2454
- }), Jo = { class: "container info" }, Zo = { class: "info-item" }, Uo = { class: "basic-content" }, ei = { class: "basic-content-text" }, ti = { class: "basic-content" }, ni = { class: "basic-content-text" }, si = { class: "info-item" }, ai = { class: "permission-content" }, oi = { class: "info-item" }, ii = { class: "basic-content" }, li = { class: "basic-content-text" }, ri = { class: "basic-content" }, ui = { class: "basic-content-text" }, ci = /* @__PURE__ */ $e({
2469
+ }), Jo = { class: "container info" }, Zo = { class: "info-item" }, Uo = { class: "basic-content" }, ei = { class: "basic-content-text" }, ti = { class: "basic-content" }, ni = { class: "basic-content-text" }, si = { class: "info-item" }, ai = { class: "permission-content" }, oi = { class: "info-item" }, ii = { class: "basic-content" }, li = { class: "basic-content-text" }, ri = { class: "basic-content" }, ui = { class: "basic-content-text" }, ci = /* @__PURE__ */ xe({
2455
2470
  __name: "Info",
2456
2471
  setup(t) {
2457
2472
  const w = lt(), e = _(null);
2458
- return Pe(async () => {
2473
+ return Ne(async () => {
2459
2474
  try {
2460
2475
  e.value = await gs(w.apis);
2461
2476
  } catch (v) {
2462
- Fe((v == null ? void 0 : v.message) || "获取个人信息失败");
2477
+ Ie((v == null ? void 0 : v.message) || "获取个人信息失败");
2463
2478
  }
2464
2479
  }), (v, a) => {
2465
- var f, g, l, r, M;
2480
+ var f, g, l, r, S;
2466
2481
  return i(), h("div", Jo, [
2467
2482
  o("div", Zo, [
2468
2483
  a[2] || (a[2] = o("div", { class: "heading" }, [
@@ -2471,11 +2486,11 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2471
2486
  ], -1)),
2472
2487
  o("div", Uo, [
2473
2488
  a[0] || (a[0] = o("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
2474
- o("div", ei, te(((f = e.value) == null ? void 0 : f.name) || ""), 1)
2489
+ o("div", ei, U(((f = e.value) == null ? void 0 : f.name) || ""), 1)
2475
2490
  ]),
2476
2491
  o("div", ti, [
2477
2492
  a[1] || (a[1] = o("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
2478
- o("div", ni, te(((g = e.value) == null ? void 0 : g.userName) || ""), 1)
2493
+ o("div", ni, U(((g = e.value) == null ? void 0 : g.userName) || ""), 1)
2479
2494
  ])
2480
2495
  ]),
2481
2496
  o("div", si, [
@@ -2484,10 +2499,10 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2484
2499
  o("div", { class: "heading-title" }, "数据权限")
2485
2500
  ], -1)),
2486
2501
  o("div", ai, [
2487
- (i(!0), h(Ce, null, Ae((l = e.value) == null ? void 0 : l.ptnameList, (C, E) => (i(), h("div", {
2502
+ (i(!0), h(be, null, He((l = e.value) == null ? void 0 : l.ptnameList, (b, E) => (i(), h("div", {
2488
2503
  key: E,
2489
2504
  class: "permission-content-text"
2490
- }, te(C), 1))), 128))
2505
+ }, U(b), 1))), 128))
2491
2506
  ])
2492
2507
  ]),
2493
2508
  o("div", oi, [
@@ -2497,11 +2512,11 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2497
2512
  ], -1)),
2498
2513
  o("div", ii, [
2499
2514
  a[4] || (a[4] = o("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
2500
- o("div", li, te(((r = e.value) == null ? void 0 : r.dept) || ""), 1)
2515
+ o("div", li, U(((r = e.value) == null ? void 0 : r.dept) || ""), 1)
2501
2516
  ]),
2502
2517
  o("div", ri, [
2503
2518
  a[5] || (a[5] = o("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
2504
- o("div", ui, te(((M = e.value) == null ? void 0 : M.email) || ""), 1)
2519
+ o("div", ui, U(((S = e.value) == null ? void 0 : S.email) || ""), 1)
2505
2520
  ])
2506
2521
  ])
2507
2522
  ]);
@@ -2510,81 +2525,81 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2510
2525
  }), di = {
2511
2526
  key: 0,
2512
2527
  class: "ai-context-chips"
2513
- }, vi = ["title"], hi = /* @__PURE__ */ $e({
2528
+ }, vi = ["title"], hi = /* @__PURE__ */ xe({
2514
2529
  __name: "AiContextChips",
2515
2530
  props: {
2516
2531
  context: {}
2517
2532
  },
2518
2533
  setup(t) {
2519
- const w = t, e = S(() => {
2534
+ const w = t, e = $(() => {
2520
2535
  const v = w.context || {}, a = v.filters || {}, f = v.status || {}, g = v.summary || {}, l = [];
2521
2536
  return a.platform && l.push(String(a.platform)), a.year && a.period ? l.push(`${a.year}年${a.period}月`) : a.year && l.push(`${a.year}年`), a.company && l.push(String(a.company)), v.module === "turnover_detail" && l.push(f.isCompanyView ? "公司维度" : "平台维度"), f.isLocked && l.push("已锁定"), typeof g.rowCount == "number" && l.push(`${g.rowCount} 条`), g.totalAmount && l.push(`当年完成 ${g.totalAmount}${g.unit || ""}`), l;
2522
2537
  });
2523
2538
  return (v, a) => e.value.length ? (i(), h("div", di, [
2524
- (i(!0), h(Ce, null, Ae(e.value, (f, g) => (i(), h("span", {
2539
+ (i(!0), h(be, null, He(e.value, (f, g) => (i(), h("span", {
2525
2540
  key: g,
2526
2541
  class: "ai-context-chip",
2527
2542
  title: f
2528
- }, te(f), 9, vi))), 128))
2543
+ }, U(f), 9, vi))), 128))
2529
2544
  ])) : z("", !0);
2530
2545
  }
2531
- }), fi = { key: 1 }, mi = ["src"], gi = { class: "header-title" }, pi = ["title"], yi = { class: "ai-history-drawer-panel" }, wi = { class: "ai-history-drawer-header" }, ki = { class: "setTitle" }, _i = { class: "content" }, Ci = { class: "main" }, bi = { class: "btn" }, Mi = ["src"], $i = 78, st = 78, Ee = 8, at = 26, ze = 490, dn = "aiPanelPosition", vn = "aiPanelDocked", Si = "aiDockWidth", Ti = 60, xi = 150, hn = 400, Di = 320, Ei = "aiDockWidth:page", Mn = /* @__PURE__ */ $e({
2546
+ }), fi = { key: 1 }, mi = ["src"], gi = { class: "header-title" }, pi = ["title"], yi = { class: "ai-history-drawer-panel" }, wi = { class: "ai-history-drawer-header" }, ki = { class: "setTitle" }, _i = { class: "content" }, Ci = { class: "main" }, bi = { class: "btn" }, Si = ["src"], Mi = 78, st = 78, Le = 8, at = 26, ze = 490, dn = "aiPanelPosition", vn = "aiPanelDocked", $i = "aiDockWidth", xi = 60, Ti = 150, hn = 400, Di = 320, Ei = "aiDockWidth:page", Sn = /* @__PURE__ */ xe({
2532
2547
  __name: "AiAssist",
2533
2548
  setup(t) {
2534
2549
  var Zt, Ut;
2535
- const w = $i / 2, e = lt(), v = _(Ct()), a = S(() => v.value === "page"), f = _({}), g = S(() => {
2536
- var $, K, ce;
2550
+ const w = Mi / 2, e = lt(), v = _(Ct()), a = $(() => v.value === "page"), f = _({}), g = $(() => {
2551
+ var M, K, ce;
2537
2552
  const n = e.name || "AI 助手";
2538
- return a.value ? ((K = ($ = e.pageMode) == null ? void 0 : $.titles) == null ? void 0 : K[We()]) || ((ce = e.pageMode) == null ? void 0 : ce.title) || n || "AI 助手" : n;
2539
- }), l = S(() => {
2540
- var d, $;
2553
+ return a.value ? ((K = (M = e.pageMode) == null ? void 0 : M.titles) == null ? void 0 : K[Be()]) || ((ce = e.pageMode) == null ? void 0 : ce.title) || n || "AI 助手" : n;
2554
+ }), l = $(() => {
2555
+ var d, M;
2541
2556
  if (!a.value) return e.defaultRecommend;
2542
- const n = ($ = (d = e.pageMode) == null ? void 0 : d.recommend) == null ? void 0 : $[We()];
2557
+ const n = (M = (d = e.pageMode) == null ? void 0 : d.recommend) == null ? void 0 : M[Be()];
2543
2558
  return n != null && n.length ? n : e.defaultRecommend;
2544
2559
  });
2545
- let r = "", M = We();
2546
- const C = _(!1);
2560
+ let r = "", S = Be();
2561
+ const b = _(!1);
2547
2562
  let E = null;
2548
- const T = _(!1), I = _("idle"), R = _(!1), y = He({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), N = _(!1), j = _(window.innerWidth < 768), A = _(window.innerWidth < 768), V = _("answer"), le = _(!1), s = _(""), ae = _(""), re = _(""), de = _(!1), k = _(!1), U = _([]), m = He({
2563
+ const x = _(!1), I = _("idle"), P = _(!1), y = Oe({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), N = _(!1), J = _(window.innerWidth < 768), R = _(window.innerWidth < 768), V = _("answer"), le = _(!1), s = _(""), se = _(""), re = _(""), de = _(!1), k = _(!1), Z = _([]), m = Oe({
2549
2564
  x: window.innerWidth - w,
2550
2565
  y: window.innerHeight / 2 - st / 2
2551
- }), O = _(!1), q = _(!1), X = _("right"), L = _("left"), D = _(null), c = He({ x: 0, y: 0 }), b = _(!1), x = _(!1), H = He({ x: 0, y: 0 }), F = _(!1), u = He({ x: 0, y: 0 }), p = _(!1), Y = _(!1), oe = _(!1), J = He({ x: 0, width: 0 }), B = _(!1);
2566
+ }), O = _(!1), q = _(!1), X = _("right"), L = _("left"), D = _(null), c = Oe({ x: 0, y: 0 }), C = _(!1), T = _(!1), H = Oe({ x: 0, y: 0 }), F = _(!1), u = Oe({ x: 0, y: 0 }), p = _(!1), Y = _(!1), ae = _(!1), Q = Oe({ x: 0, width: 0 }), B = _(!1);
2552
2567
  let W = 0;
2553
- const ue = _("idle"), Q = _(!1), ve = _("none"), fe = He({ x: 0, y: 0, w: ze, h: 0, radius: "14px" });
2554
- let G = null, ne = !1, P = !1;
2555
- const se = He({ x: 0, y: 0 }), ee = _(!1), Z = _(null);
2556
- let _e = null, Re = null, Ne = null;
2557
- const be = S(() => {
2568
+ const ue = _("idle"), j = _(!1), ve = _("none"), me = Oe({ x: 0, y: 0, w: ze, h: 0, radius: "14px" });
2569
+ let G = null, te = !1, fe = !1;
2570
+ const A = Oe({ x: 0, y: 0 }), ee = _(!1), ne = _(null);
2571
+ let oe = null, ye = null, Re = null;
2572
+ const $e = $(() => {
2558
2573
  const n = window.innerWidth / 2;
2559
2574
  return m.x + w < n ? 5 : -5;
2560
- }), Oe = S(() => A.value || p.value || a.value || ue.value !== "idle" ? "" : `panel-${X.value}`), Ie = S(() => {
2575
+ }), Te = $(() => R.value || p.value || a.value || ue.value !== "idle" ? "" : `panel-${X.value}`), Se = $(() => {
2561
2576
  var n;
2562
- return !!((n = e.dock) != null && n.containerId) && !j.value;
2563
- }), pe = _(
2577
+ return !!((n = e.dock) != null && n.containerId) && !J.value;
2578
+ }), we = _(
2564
2579
  a.value ? ((Zt = e.pageMode) == null ? void 0 : Zt.width) || 440 : ((Ut = e.dock) == null ? void 0 : Ut.width) || ze
2565
- ), Ht = () => a.value ? Ei : Si, Nt = S(() => e.panelDraggable !== !1), $n = S(() => {
2580
+ ), Ht = () => a.value ? Ei : $i, Nt = $(() => e.panelDraggable !== !1), Mn = $(() => {
2566
2581
  var n;
2567
- return !((n = Z.value) != null && n.isEmptyConversation);
2568
- }), Sn = S(() => ({
2582
+ return !((n = ne.value) != null && n.isEmptyConversation);
2583
+ }), $n = $(() => ({
2569
2584
  left: `${m.x}px`,
2570
2585
  top: `${m.y}px`,
2571
2586
  transition: O.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
2572
- "--direction": String(be.value)
2573
- })), Tn = S(() => e.characterImage || Ps), xn = S(() => I.value === "idle" ? {} : {
2587
+ "--direction": String($e.value)
2588
+ })), xn = $(() => e.characterImage || Ps), Tn = $(() => I.value === "idle" ? {} : {
2574
2589
  left: `${y.x}px`,
2575
2590
  top: `${y.y}px`,
2576
2591
  width: `${y.w}px`,
2577
2592
  height: `${y.h}px`,
2578
2593
  borderRadius: y.radius
2579
- }), Dn = S(() => {
2594
+ }), Dn = $(() => {
2580
2595
  const n = {};
2581
- return b.value && !A.value && !j.value && !p.value && (n["--ai-panel-x"] = `${c.x}px`, n["--ai-panel-y"] = `${c.y}px`), (p.value || a.value) && (n["--ai-dock-width"] = `${pe.value}px`), n;
2582
- }), En = S(() => ue.value === "idle" ? {} : {
2583
- left: `${fe.x}px`,
2584
- top: `${fe.y}px`,
2585
- width: `${fe.w}px`,
2586
- height: `${fe.h}px`,
2587
- borderRadius: fe.radius
2596
+ return C.value && !R.value && !J.value && !p.value && (n["--ai-panel-x"] = `${c.x}px`, n["--ai-panel-y"] = `${c.y}px`), (p.value || a.value) && (n["--ai-dock-width"] = `${we.value}px`), n;
2597
+ }), En = $(() => ue.value === "idle" ? {} : {
2598
+ left: `${me.x}px`,
2599
+ top: `${me.y}px`,
2600
+ width: `${me.w}px`,
2601
+ height: `${me.h}px`,
2602
+ borderRadius: me.radius
2588
2603
  });
2589
2604
  function Ye() {
2590
2605
  const n = window.innerWidth / 2;
@@ -2614,68 +2629,68 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2614
2629
  m.x = K.x, m.y = Math.min(Math.max(K.y, 0), window.innerHeight - st);
2615
2630
  } else
2616
2631
  m.x = window.innerWidth - w, m.y = window.innerHeight / 2 - st / 2;
2617
- const d = localStorage.getItem("panelPosition"), $ = localStorage.getItem("backPosition");
2618
- d && (X.value = d), $ && (L.value = $);
2632
+ const d = localStorage.getItem("panelPosition"), M = localStorage.getItem("backPosition");
2633
+ d && (X.value = d), M && (L.value = M);
2619
2634
  }
2620
2635
  function rt(n) {
2621
2636
  if (!O.value) return;
2622
- const d = "touches" in n ? n.touches[0].clientX : n.clientX, $ = "touches" in n ? n.touches[0].clientY : n.clientY, K = d - se.x, ce = Math.max(0, Math.min($ - se.y, window.innerHeight - st)), he = Math.abs(K - m.x), ye = Math.abs(ce - m.y);
2623
- he + ye > 5 && (ee.value = !0), m.x = K, m.y = ce;
2637
+ const d = "touches" in n ? n.touches[0].clientX : n.clientX, M = "touches" in n ? n.touches[0].clientY : n.clientY, K = d - A.x, ce = Math.max(0, Math.min(M - A.y, window.innerHeight - st)), he = Math.abs(K - m.x), ke = Math.abs(ce - m.y);
2638
+ he + ke > 5 && (ee.value = !0), m.x = K, m.y = ce;
2624
2639
  }
2625
2640
  function ut() {
2626
2641
  O.value && (O.value = !1, ee.value && (Vt(), ee.value = !1));
2627
2642
  }
2628
2643
  function Ot(n) {
2629
2644
  q.value = !1, O.value = !0, ee.value = !1;
2630
- const d = "touches" in n ? n.touches[0].clientX : n.clientX, $ = "touches" in n ? n.touches[0].clientY : n.clientY;
2631
- se.x = d - m.x, se.y = $ - m.y;
2645
+ const d = "touches" in n ? n.touches[0].clientX : n.clientX, M = "touches" in n ? n.touches[0].clientY : n.clientY;
2646
+ A.x = d - m.x, A.y = M - m.y;
2632
2647
  }
2633
2648
  function Ln() {
2634
- const n = D.value, d = (n == null ? void 0 : n.offsetWidth) || ze, $ = (n == null ? void 0 : n.offsetHeight) || window.innerHeight - 78;
2649
+ const n = D.value, d = (n == null ? void 0 : n.offsetWidth) || ze, M = (n == null ? void 0 : n.offsetHeight) || window.innerHeight - 78;
2635
2650
  return {
2636
- maxX: Math.max(Ee, window.innerWidth - d - Ee),
2637
- maxY: Math.max(at, window.innerHeight - $ - Ee)
2651
+ maxX: Math.max(Le, window.innerWidth - d - Le),
2652
+ maxY: Math.max(at, window.innerHeight - M - Le)
2638
2653
  };
2639
2654
  }
2640
2655
  function ct(n, d) {
2641
- const $ = D.value, K = n ?? ($ == null ? void 0 : $.offsetWidth) ?? ze, ce = d ?? ($ == null ? void 0 : $.offsetHeight) ?? window.innerHeight - 78, he = Math.max(Ee, window.innerWidth - K - Ee), ye = Math.max(at, window.innerHeight - ce - Ee);
2642
- c.x = Math.min(Math.max(c.x, Ee), he), c.y = Math.min(Math.max(c.y, at), ye);
2656
+ const M = D.value, K = n ?? (M == null ? void 0 : M.offsetWidth) ?? ze, ce = d ?? (M == null ? void 0 : M.offsetHeight) ?? window.innerHeight - 78, he = Math.max(Le, window.innerWidth - K - Le), ke = Math.max(at, window.innerHeight - ce - Le);
2657
+ c.x = Math.min(Math.max(c.x, Le), he), c.y = Math.min(Math.max(c.y, at), ke);
2643
2658
  }
2644
2659
  function Wt(n) {
2645
- if (!Nt.value || A.value || j.value || p.value || I.value !== "idle") return;
2646
- if (P = !1, x.value = !0, F.value = !1, !b.value) {
2660
+ if (!Nt.value || R.value || J.value || p.value || I.value !== "idle") return;
2661
+ if (fe = !1, T.value = !0, F.value = !1, !C.value) {
2647
2662
  const K = D.value;
2648
2663
  if (K) {
2649
2664
  const ce = K.getBoundingClientRect();
2650
- c.x = ce.left, c.y = ce.top, b.value = !0;
2665
+ c.x = ce.left, c.y = ce.top, C.value = !0;
2651
2666
  }
2652
2667
  }
2653
- const d = "touches" in n ? n.touches[0].clientX : n.clientX, $ = "touches" in n ? n.touches[0].clientY : n.clientY;
2654
- u.x = d, u.y = $, H.x = d - c.x, H.y = $ - c.y;
2668
+ const d = "touches" in n ? n.touches[0].clientX : n.clientX, M = "touches" in n ? n.touches[0].clientY : n.clientY;
2669
+ u.x = d, u.y = M, H.x = d - c.x, H.y = M - c.y;
2655
2670
  }
2656
2671
  function dt(n) {
2657
2672
  var Me, Xe;
2658
- if (!x.value) return;
2659
- const d = "touches" in n ? n.touches[0].clientX : n.clientX, $ = "touches" in n ? n.touches[0].clientY : n.clientY;
2673
+ if (!T.value) return;
2674
+ const d = "touches" in n ? n.touches[0].clientX : n.clientX, M = "touches" in n ? n.touches[0].clientY : n.clientY;
2660
2675
  if (!F.value) {
2661
- const Ke = Math.abs(d - u.x), wt = Math.abs($ - u.y);
2676
+ const Ke = Math.abs(d - u.x), wt = Math.abs(M - u.y);
2662
2677
  if (Ke + wt <= 5) return;
2663
2678
  F.value = !0;
2664
2679
  }
2665
- const { maxX: K, maxY: ce } = Ln(), he = Ie.value ? K + xi : K, ye = Math.min(Math.max(d - H.x, Ee), he), xe = Math.min(Math.max($ - H.y, at), ce), De = Ie.value && ye > K + Ti;
2666
- De !== P && (P = De, (Xe = (Me = e.dock) == null ? void 0 : Me.onDockChange) == null || Xe.call(Me, De)), Y.value = De, c.x = ye, c.y = xe;
2680
+ const { maxX: K, maxY: ce } = Ln(), he = Se.value ? K + Ti : K, ke = Math.min(Math.max(d - H.x, Le), he), Ae = Math.min(Math.max(M - H.y, at), ce), Pe = Se.value && ke > K + xi;
2681
+ Pe !== fe && (fe = Pe, (Xe = (Me = e.dock) == null ? void 0 : Me.onDockChange) == null || Xe.call(Me, Pe)), Y.value = Pe, c.x = ke, c.y = Ae;
2667
2682
  }
2668
2683
  function vt() {
2669
- var d, $;
2670
- if (!x.value) return;
2671
- x.value = !1;
2684
+ var d, M;
2685
+ if (!T.value) return;
2686
+ T.value = !1;
2672
2687
  let n = !1;
2673
- F.value && (F.value = !1, ne = !0, setTimeout(() => {
2674
- ne = !1;
2675
- }, 0), Y.value && Ie.value ? (zt(), n = !0) : (ct(), Hn())), P && !n && (P = !1, ($ = (d = e.dock) == null ? void 0 : d.onDockChange) == null || $.call(d, !1)), Y.value = !1;
2688
+ F.value && (F.value = !1, te = !0, setTimeout(() => {
2689
+ te = !1;
2690
+ }, 0), Y.value && Se.value ? (zt(), n = !0) : (ct(), Hn())), fe && !n && (fe = !1, (M = (d = e.dock) == null ? void 0 : d.onDockChange) == null || M.call(d, !1)), Y.value = !1;
2676
2691
  }
2677
2692
  function Bt(n) {
2678
- ne && (n.preventDefault(), n.stopPropagation(), ne = !1);
2693
+ te && (n.preventDefault(), n.stopPropagation(), te = !1);
2679
2694
  }
2680
2695
  function Hn() {
2681
2696
  try {
@@ -2688,7 +2703,7 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2688
2703
  const n = localStorage.getItem(dn);
2689
2704
  if (n) {
2690
2705
  const d = JSON.parse(n);
2691
- typeof d.x == "number" && typeof d.y == "number" && (c.x = d.x, c.y = d.y, b.value = !0);
2706
+ typeof d.x == "number" && typeof d.y == "number" && (c.x = d.x, c.y = d.y, C.value = !0);
2692
2707
  }
2693
2708
  } catch {
2694
2709
  }
@@ -2703,25 +2718,25 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2703
2718
  var n;
2704
2719
  if (!a.value)
2705
2720
  try {
2706
- if (localStorage.getItem(vn) === "1" && Ie.value) {
2707
- const $ = (n = e.dock) == null ? void 0 : n.containerId;
2708
- $ && document.getElementById($) && (p.value = !0);
2721
+ if (localStorage.getItem(vn) === "1" && Se.value) {
2722
+ const M = (n = e.dock) == null ? void 0 : n.containerId;
2723
+ M && document.getElementById(M) && (p.value = !0);
2709
2724
  }
2710
2725
  } catch {
2711
2726
  }
2712
2727
  }
2713
2728
  function ht() {
2714
2729
  return {
2715
- x: window.innerWidth - pe.value,
2730
+ x: window.innerWidth - we.value,
2716
2731
  y: 0,
2717
- w: pe.value,
2732
+ w: we.value,
2718
2733
  h: window.innerHeight,
2719
2734
  radius: "0px"
2720
2735
  };
2721
2736
  }
2722
2737
  function Vn() {
2723
2738
  return {
2724
- x: Math.max(0, Math.min(window.innerWidth - 53, m.x + be.value * 3)),
2739
+ x: Math.max(0, Math.min(window.innerWidth - 53, m.x + $e.value * 3)),
2725
2740
  y: m.y,
2726
2741
  w: 53,
2727
2742
  h: 53,
@@ -2739,34 +2754,34 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2739
2754
  };
2740
2755
  }
2741
2756
  function On() {
2742
- A.value ? (Ge(Xt(), Kt()), A.value = !1) : (Ge(je(), Xt()), A.value = !0);
2757
+ R.value ? (Ge(Xt(), Kt()), R.value = !1) : (Ge(je(), Xt()), R.value = !0);
2743
2758
  }
2744
- function Ge(n, d, $, K = "none") {
2745
- G && clearTimeout(G), ue.value = "switching", Q.value = !0, ve.value = K, fe.x = n.x, fe.y = n.y, fe.w = n.w, fe.h = n.h, fe.radius = n.radius, Se(() => {
2759
+ function Ge(n, d, M, K = "none") {
2760
+ G && clearTimeout(G), ue.value = "switching", j.value = !0, ve.value = K, me.x = n.x, me.y = n.y, me.w = n.w, me.h = n.h, me.radius = n.radius, De(() => {
2746
2761
  requestAnimationFrame(() => {
2747
- Q.value = !1, fe.x = d.x, fe.y = d.y, fe.w = d.w, fe.h = d.h, fe.radius = d.radius;
2762
+ j.value = !1, me.x = d.x, me.y = d.y, me.w = d.w, me.h = d.h, me.radius = d.radius;
2748
2763
  });
2749
2764
  }), G = setTimeout(() => {
2750
- ue.value = "idle", ve.value = "none", G = null, $ == null || $();
2765
+ ue.value = "idle", ve.value = "none", G = null, M == null || M();
2751
2766
  }, 400);
2752
2767
  }
2753
2768
  function zt() {
2754
- var ce, he, ye, xe, De;
2755
- if (!Ie.value || p.value) return;
2756
- A.value && (A.value = !1);
2769
+ var ce, he, ke, Ae, Pe;
2770
+ if (!Se.value || p.value) return;
2771
+ R.value && (R.value = !1);
2757
2772
  const n = (ce = e.dock) == null ? void 0 : ce.containerId;
2758
2773
  if (n && !document.getElementById(n)) {
2759
2774
  console.warn(`[ai-assist-sdk] dock container "#${n}" not found, dock feature disabled`);
2760
2775
  return;
2761
2776
  }
2762
2777
  const d = D.value;
2763
- let $ = je();
2778
+ let M = je();
2764
2779
  if (d) {
2765
2780
  const Me = d.getBoundingClientRect();
2766
- $ = { x: Me.left, y: Me.top, w: Me.width, h: Me.height, radius: getComputedStyle(d).borderRadius };
2781
+ M = { x: Me.left, y: Me.top, w: Me.width, h: Me.height, radius: getComputedStyle(d).borderRadius };
2767
2782
  }
2768
2783
  const K = ht();
2769
- Ge($, K), p.value = !0, I.value = "idle", Y.value = !1, Ft(), (ye = (he = e.dock) == null ? void 0 : he.onDockChange) == null || ye.call(he, !0), (De = (xe = e.dock) == null ? void 0 : xe.onDockWidthChange) == null || De.call(xe, pe.value);
2784
+ Ge(M, K), p.value = !0, I.value = "idle", Y.value = !1, Ft(), (ke = (he = e.dock) == null ? void 0 : he.onDockChange) == null || ke.call(he, !0), (Pe = (Ae = e.dock) == null ? void 0 : Ae.onDockWidthChange) == null || Pe.call(Ae, we.value);
2770
2785
  }
2771
2786
  function Wn() {
2772
2787
  return Math.max(hn, window.innerWidth - Di);
@@ -2780,7 +2795,7 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2780
2795
  }
2781
2796
  function Bn() {
2782
2797
  try {
2783
- localStorage.setItem(Ht(), String(pe.value));
2798
+ localStorage.setItem(Ht(), String(we.value));
2784
2799
  } catch {
2785
2800
  }
2786
2801
  }
@@ -2789,43 +2804,43 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2789
2804
  const n = localStorage.getItem(Ht());
2790
2805
  if (n) {
2791
2806
  const d = parseFloat(n);
2792
- Number.isFinite(d) && (pe.value = Qe(d));
2807
+ Number.isFinite(d) && (we.value = Qe(d));
2793
2808
  }
2794
2809
  } catch {
2795
2810
  }
2796
2811
  }
2797
2812
  function qt(n) {
2798
2813
  if (!p.value && !a.value) return;
2799
- oe.value = !0, B.value = !1;
2814
+ ae.value = !0, B.value = !1;
2800
2815
  const d = "touches" in n ? n.touches[0].clientX : n.clientX;
2801
- J.x = d, J.width = pe.value, document.body.style.userSelect = "none";
2816
+ Q.x = d, Q.width = we.value, document.body.style.userSelect = "none";
2802
2817
  }
2803
2818
  function ft(n) {
2804
- if (!oe.value) return;
2805
- const d = "touches" in n ? n.touches[0].clientX : n.clientX, $ = Qe(J.width + (J.x - d));
2806
- Math.abs($ - J.width) > 3 && (B.value = !0), pe.value = $, W || (W = requestAnimationFrame(() => {
2819
+ if (!ae.value) return;
2820
+ const d = "touches" in n ? n.touches[0].clientX : n.clientX, M = Qe(Q.width + (Q.x - d));
2821
+ Math.abs(M - Q.width) > 3 && (B.value = !0), we.value = M, W || (W = requestAnimationFrame(() => {
2807
2822
  var K, ce;
2808
- W = 0, (ce = (K = e.dock) == null ? void 0 : K.onDockWidthChange) == null || ce.call(K, pe.value);
2823
+ W = 0, (ce = (K = e.dock) == null ? void 0 : K.onDockWidthChange) == null || ce.call(K, we.value);
2809
2824
  }));
2810
2825
  }
2811
2826
  function mt() {
2812
2827
  var n, d;
2813
- oe.value && (oe.value = !1, document.body.style.userSelect = "", B.value && (B.value = !1, Bn(), (d = (n = e.dock) == null ? void 0 : n.onDockWidthChange) == null || d.call(n, pe.value)));
2828
+ ae.value && (ae.value = !1, document.body.style.userSelect = "", B.value && (B.value = !1, Bn(), (d = (n = e.dock) == null ? void 0 : n.onDockWidthChange) == null || d.call(n, we.value)));
2814
2829
  }
2815
2830
  function Gt() {
2816
2831
  var n, d;
2817
- p.value && (b.value ? ct(ze, window.innerHeight - 78) : Ye(), Ge(ht(), je()), p.value = !1, Ft(), (d = (n = e.dock) == null ? void 0 : n.onDockChange) == null || d.call(n, !1));
2832
+ p.value && (C.value ? ct(ze, window.innerHeight - 78) : Ye(), Ge(ht(), je()), p.value = !1, Ft(), (d = (n = e.dock) == null ? void 0 : n.onDockChange) == null || d.call(n, !1));
2818
2833
  }
2819
2834
  function Fn() {
2820
- var d, $, K, ce, he, ye, xe, De;
2821
- if (T.value) return;
2822
- if (E && (clearTimeout(E), E = null), C.value = !1, a.value) {
2823
- T.value = !0, I.value = "idle", pe.value = Qe(pe.value), ($ = (d = e.dock) == null ? void 0 : d.onDockChange) == null || $.call(d, !0), (ce = (K = e.dock) == null ? void 0 : K.onDockWidthChange) == null || ce.call(K, pe.value), _t();
2824
- const Me = We();
2835
+ var d, M, K, ce, he, ke, Ae, Pe;
2836
+ if (x.value) return;
2837
+ if (E && (clearTimeout(E), E = null), b.value = !1, a.value) {
2838
+ x.value = !0, I.value = "idle", we.value = Qe(we.value), (M = (d = e.dock) == null ? void 0 : d.onDockChange) == null || M.call(d, !0), (ce = (K = e.dock) == null ? void 0 : K.onDockWidthChange) == null || ce.call(K, we.value), _t();
2839
+ const Me = Be();
2825
2840
  if (r !== Me) {
2826
2841
  r = Me;
2827
2842
  try {
2828
- (ye = (he = Z.value) == null ? void 0 : he.restorePageHistory) == null || ye.call(he);
2843
+ (ke = (he = ne.value) == null ? void 0 : he.restorePageHistory) == null || ke.call(he);
2829
2844
  } catch (Xe) {
2830
2845
  console.warn("[ai-assist-sdk] 页面会话恢复失败:", Xe);
2831
2846
  }
@@ -2834,18 +2849,18 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2834
2849
  }
2835
2850
  if (p.value) {
2836
2851
  Ge(
2837
- { x: window.innerWidth, y: 0, w: pe.value, h: window.innerHeight, radius: "0px" },
2852
+ { x: window.innerWidth, y: 0, w: we.value, h: window.innerHeight, radius: "0px" },
2838
2853
  ht(),
2839
2854
  void 0,
2840
2855
  "in"
2841
- ), T.value = !0, I.value = "idle", (De = (xe = e.dock) == null ? void 0 : xe.onDockChange) == null || De.call(xe, !0);
2856
+ ), x.value = !0, I.value = "idle", (Pe = (Ae = e.dock) == null ? void 0 : Ae.onDockChange) == null || Pe.call(Ae, !0);
2842
2857
  return;
2843
2858
  }
2844
2859
  Ye();
2845
2860
  const n = je();
2846
- y.x = Math.max(0, Math.min(window.innerWidth - 53, m.x + be.value * 3)), y.y = m.y - be.value * 2, y.w = 53, y.h = 53, y.radius = "50%", R.value = !0, I.value = "expanding", T.value = !0, Se(() => {
2861
+ y.x = Math.max(0, Math.min(window.innerWidth - 53, m.x + $e.value * 3)), y.y = m.y - $e.value * 2, y.w = 53, y.h = 53, y.radius = "50%", P.value = !0, I.value = "expanding", x.value = !0, De(() => {
2847
2862
  requestAnimationFrame(() => {
2848
- R.value = !1, y.x = n.x, y.y = n.y, y.w = n.w, y.h = n.h, y.radius = n.radius;
2863
+ P.value = !1, y.x = n.x, y.y = n.y, y.w = n.w, y.h = n.h, y.radius = n.radius;
2849
2864
  });
2850
2865
  }), setTimeout(() => {
2851
2866
  I.value = "idle";
@@ -2863,7 +2878,7 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2863
2878
  }
2864
2879
  function je() {
2865
2880
  if (window.innerWidth < 768)
2866
- return A.value ? {
2881
+ return R.value ? {
2867
2882
  x: 0,
2868
2883
  y: 0,
2869
2884
  w: window.innerWidth,
@@ -2877,12 +2892,12 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2877
2892
  radius: "14px"
2878
2893
  };
2879
2894
  const d = window.innerHeight - 78;
2880
- let $ = 54;
2881
- if (A.value) {
2895
+ let M = 54;
2896
+ if (R.value) {
2882
2897
  const K = window.innerWidth * 0.8;
2883
2898
  return {
2884
2899
  x: (window.innerWidth - K) / 2,
2885
- y: $,
2900
+ y: M,
2886
2901
  w: K,
2887
2902
  h: d,
2888
2903
  radius: "14px"
@@ -2892,55 +2907,55 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2892
2907
  }
2893
2908
  function Kt() {
2894
2909
  const n = ze, d = window.innerHeight - 78;
2895
- let $ = 54, K;
2896
- return b.value ? (K = Math.min(Math.max(c.x, Ee), Math.max(Ee, window.innerWidth - n - Ee)), $ = Math.min(Math.max(c.y, at), Math.max(Ee, d - Ee))) : K = X.value === "left" ? 24 : window.innerWidth - n - 24, { x: K, y: $, w: n, h: d, radius: "14px" };
2910
+ let M = 54, K;
2911
+ return C.value ? (K = Math.min(Math.max(c.x, Le), Math.max(Le, window.innerWidth - n - Le)), M = Math.min(Math.max(c.y, at), Math.max(Le, d - Le))) : K = X.value === "left" ? 24 : window.innerWidth - n - 24, { x: K, y: M, w: n, h: d, radius: "14px" };
2897
2912
  }
2898
2913
  function zn() {
2899
- var d, $, K, ce, he, ye;
2914
+ var d, M, K, ce, he, ke;
2900
2915
  if (a.value) {
2901
- if (C.value) return;
2902
- C.value = !0, ($ = (d = e.dock) == null ? void 0 : d.onDockChange) == null || $.call(d, !1), (ce = (K = e.pageMode) == null ? void 0 : K.onVisibleChange) == null || ce.call(K, !1), E && clearTimeout(E), E = setTimeout(() => {
2903
- E = null, C.value = !1, T.value = !1, I.value = "idle", ks("default");
2916
+ if (b.value) return;
2917
+ b.value = !0, (M = (d = e.dock) == null ? void 0 : d.onDockChange) == null || M.call(d, !1), (ce = (K = e.pageMode) == null ? void 0 : K.onVisibleChange) == null || ce.call(K, !1), E && clearTimeout(E), E = setTimeout(() => {
2918
+ E = null, b.value = !1, x.value = !1, I.value = "idle", ks("default");
2904
2919
  }, 300);
2905
2920
  return;
2906
2921
  }
2907
2922
  if (ue.value !== "idle") return;
2908
2923
  if (p.value) {
2909
2924
  Ge(ht(), Vn(), () => {
2910
- T.value = !1, I.value = "idle", N.value = !0, setTimeout(() => {
2925
+ x.value = !1, I.value = "idle", N.value = !0, setTimeout(() => {
2911
2926
  N.value = !1;
2912
2927
  }, 1400);
2913
- }, "out"), (ye = (he = e.dock) == null ? void 0 : he.onDockChange) == null || ye.call(he, !1);
2928
+ }, "out"), (ke = (he = e.dock) == null ? void 0 : he.onDockChange) == null || ke.call(he, !1);
2914
2929
  return;
2915
2930
  }
2916
2931
  if (I.value !== "idle") return;
2917
2932
  const n = je();
2918
- y.x = n.x, y.y = n.y, y.w = n.w, y.h = n.h, y.radius = n.radius, R.value = !0, I.value = "collapsing", Se(() => {
2933
+ y.x = n.x, y.y = n.y, y.w = n.w, y.h = n.h, y.radius = n.radius, P.value = !0, I.value = "collapsing", De(() => {
2919
2934
  requestAnimationFrame(() => {
2920
- R.value = !1, y.x = Math.max(0, Math.min(window.innerWidth - 53, m.x + be.value * 3)), y.y = m.y + Math.abs(be.value) * 2, y.w = 53, y.h = 53, y.radius = "50%";
2935
+ P.value = !1, y.x = Math.max(0, Math.min(window.innerWidth - 53, m.x + $e.value * 3)), y.y = m.y + Math.abs($e.value) * 2, y.w = 53, y.h = 53, y.radius = "50%";
2921
2936
  });
2922
2937
  }), setTimeout(() => {
2923
- T.value = !1, I.value = "idle", N.value = !0;
2938
+ x.value = !1, I.value = "idle", N.value = !0;
2924
2939
  }, 400), setTimeout(() => {
2925
2940
  N.value = !1;
2926
2941
  }, 1400);
2927
2942
  }
2928
2943
  function qn(n) {
2929
- Je(), V.value = "answer", Se(() => {
2944
+ Je(), V.value = "answer", De(() => {
2930
2945
  var d;
2931
- (d = Z.value) == null || d.goHistoryMessage(n);
2946
+ (d = ne.value) == null || d.goHistoryMessage(n);
2932
2947
  });
2933
2948
  }
2934
2949
  function Gn() {
2935
- re.value = "", V.value = "answer", Se(() => {
2950
+ re.value = "", V.value = "answer", De(() => {
2936
2951
  var n;
2937
- (n = Z.value) == null || n.createNewConversation();
2952
+ (n = ne.value) == null || n.createNewConversation();
2938
2953
  });
2939
2954
  }
2940
2955
  function Kn() {
2941
- Je(), re.value = "", Se(() => {
2956
+ Je(), re.value = "", De(() => {
2942
2957
  var n;
2943
- (n = Z.value) == null || n.createNewConversation();
2958
+ (n = ne.value) == null || n.createNewConversation();
2944
2959
  });
2945
2960
  }
2946
2961
  function Yn() {
@@ -2952,44 +2967,44 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
2952
2967
  }, 300);
2953
2968
  }
2954
2969
  function Qn() {
2955
- ae.value = s.value, le.value = !1;
2970
+ se.value = s.value, le.value = !1;
2956
2971
  }
2957
- ge(A, (n) => {
2972
+ pe(R, (n) => {
2958
2973
  n ? X.value = "center" : Ye();
2959
- }), ge(T, (n) => {
2960
- n && b.value && Se(() => ct());
2974
+ }), pe(x, (n) => {
2975
+ n && C.value && De(() => ct());
2961
2976
  });
2962
2977
  function jn(n) {
2963
- var d, $, K, ce, he, ye, xe, De, Me, Xe, Ke, wt;
2978
+ var d, M, K, ce, he, ke, Ae, Pe, Me, Xe, Ke, wt;
2964
2979
  if (n !== v.value) {
2965
- v.value = n, b.value = !1, Y.value = !1, x.value = !1, oe.value = !1, I.value = "idle", P = !1, re.value = "", r = "";
2980
+ v.value = n, C.value = !1, Y.value = !1, T.value = !1, ae.value = !1, I.value = "idle", fe = !1, re.value = "", r = "";
2966
2981
  try {
2967
- ($ = (d = Z.value) == null ? void 0 : d.clearActiveMessages) == null || $.call(d);
2982
+ (M = (d = ne.value) == null ? void 0 : d.clearActiveMessages) == null || M.call(d);
2968
2983
  } catch (Zn) {
2969
2984
  console.warn("[ai-assist-sdk] 切换形态清空会话失败:", Zn);
2970
2985
  }
2971
2986
  if (n === "page") {
2972
- A.value = !1, p.value = !1, pe.value = Qe(((K = e.pageMode) == null ? void 0 : K.width) || 440), bt(), T.value && ((he = (ce = e.dock) == null ? void 0 : ce.onDockChange) == null || he.call(ce, !0), (xe = (ye = e.dock) == null ? void 0 : ye.onDockWidthChange) == null || xe.call(ye, pe.value), _t());
2987
+ R.value = !1, p.value = !1, we.value = Qe(((K = e.pageMode) == null ? void 0 : K.width) || 440), bt(), x.value && ((he = (ce = e.dock) == null ? void 0 : ce.onDockChange) == null || he.call(ce, !0), (Ae = (ke = e.dock) == null ? void 0 : ke.onDockWidthChange) == null || Ae.call(ke, we.value), _t());
2973
2988
  return;
2974
2989
  }
2975
- A.value = window.innerWidth < 768, pe.value = ((De = e.dock) == null ? void 0 : De.width) || ze, It(), bt(), Ye(), T.value && ((Xe = (Me = e.dock) == null ? void 0 : Me.onDockChange) == null || Xe.call(Me, p.value), (wt = (Ke = e.dock) == null ? void 0 : Ke.onDockWidthChange) == null || wt.call(Ke, pe.value));
2990
+ R.value = window.innerWidth < 768, we.value = ((Pe = e.dock) == null ? void 0 : Pe.width) || ze, It(), bt(), Ye(), x.value && ((Xe = (Me = e.dock) == null ? void 0 : Me.onDockChange) == null || Xe.call(Me, p.value), (wt = (Ke = e.dock) == null ? void 0 : Ke.onDockWidthChange) == null || wt.call(Ke, we.value));
2976
2991
  }
2977
2992
  }
2978
- function Mt(n = 0) {
2979
- var $, K, ce, he;
2993
+ function St(n = 0) {
2994
+ var M, K, ce, he;
2980
2995
  const d = ln();
2981
- d !== T.value && (d ? Fn() : ws() ? (E && (clearTimeout(E), E = null), C.value = !1, T.value = !1, I.value = "idle", (K = ($ = e.dock) == null ? void 0 : $.onDockChange) == null || K.call($, !1), (he = (ce = e.pageMode) == null ? void 0 : ce.onVisibleChange) == null || he.call(ce, !1)) : zn(), n < 3 && ln() !== T.value && setTimeout(() => Mt(n + 1), 450));
2996
+ d !== x.value && (d ? Fn() : ws() ? (E && (clearTimeout(E), E = null), b.value = !1, x.value = !1, I.value = "idle", (K = (M = e.dock) == null ? void 0 : M.onDockChange) == null || K.call(M, !1), (he = (ce = e.pageMode) == null ? void 0 : ce.onVisibleChange) == null || he.call(ce, !1)) : zn(), n < 3 && ln() !== x.value && setTimeout(() => St(n + 1), 450));
2982
2997
  }
2983
2998
  let Ze = null;
2984
- Pe(() => {
2999
+ Ne(() => {
2985
3000
  Ze = ps(() => {
2986
- var d, $;
2987
- jn(Ct()), f.value = an(), Mt();
2988
- const n = We();
2989
- n !== M && (M = n, r = "", f.value = {}, ($ = (d = Z.value) == null ? void 0 : d.clearActiveMessages) == null || $.call(d), _t());
2990
- }), f.value = an(), Mt();
2991
- }), Be(() => {
2992
- Ze == null || Ze(), Ze = null, E && (clearTimeout(E), E = null), C.value = !1;
3001
+ var d, M;
3002
+ jn(Ct()), f.value = an(), St();
3003
+ const n = Be();
3004
+ n !== S && (S = n, r = "", f.value = {}, (M = (d = ne.value) == null ? void 0 : d.clearActiveMessages) == null || M.call(d), _t());
3005
+ }), f.value = an(), St();
3006
+ }), Fe(() => {
3007
+ Ze == null || Ze(), Ze = null, E && (clearTimeout(E), E = null), b.value = !1;
2993
3008
  });
2994
3009
  const Jn = Math.max(1e3, Number(e.activityInterval) || 3e4);
2995
3010
  let gt = null, Ue = 0, pt = 0, yt = 0;
@@ -3001,8 +3016,8 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3001
3016
  return;
3002
3017
  }
3003
3018
  if (document.visibilityState !== "hidden") {
3004
- const $ = Date.now();
3005
- pt += Math.max(0, $ - Ue), Ue = $;
3019
+ const M = Date.now();
3020
+ pt += Math.max(0, M - Ue), Ue = M;
3006
3021
  }
3007
3022
  const d = Math.round(pt);
3008
3023
  if (d <= 0 && n !== "close") return;
@@ -3010,79 +3025,79 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3010
3025
  } catch {
3011
3026
  }
3012
3027
  }
3013
- function $t() {
3028
+ function Mt() {
3014
3029
  tt(), gt = window.setInterval(() => {
3015
- !T.value || document.visibilityState === "hidden" || et("heartbeat");
3030
+ !x.value || document.visibilityState === "hidden" || et("heartbeat");
3016
3031
  }, Jn);
3017
3032
  }
3018
3033
  function tt() {
3019
3034
  gt !== null && (clearInterval(gt), gt = null);
3020
3035
  }
3021
3036
  function Yt() {
3022
- T.value && (document.visibilityState === "hidden" ? (tt(), et("hidden")) : (Ue = Date.now(), $t()));
3037
+ x.value && (document.visibilityState === "hidden" ? (tt(), et("hidden")) : (Ue = Date.now(), Mt()));
3023
3038
  }
3024
3039
  function Qt() {
3025
- T.value && (tt(), et("hidden"));
3040
+ x.value && (tt(), et("hidden"));
3026
3041
  }
3027
3042
  function jt() {
3028
- !T.value || document.visibilityState === "hidden" || (Ue = Date.now(), $t());
3043
+ !x.value || document.visibilityState === "hidden" || (Ue = Date.now(), Mt());
3029
3044
  }
3030
- ge(T, (n) => {
3031
- n ? (et("open"), document.visibilityState !== "hidden" && $t()) : (tt(), et("close"));
3032
- }), Pe(() => {
3045
+ pe(x, (n) => {
3046
+ n ? (et("open"), document.visibilityState !== "hidden" && Mt()) : (tt(), et("close"));
3047
+ }), Ne(() => {
3033
3048
  document.addEventListener("visibilitychange", Yt), window.addEventListener("pagehide", Qt), window.addEventListener("pageshow", jt);
3034
- }), Be(() => {
3049
+ }), Fe(() => {
3035
3050
  tt(), document.removeEventListener("visibilitychange", Yt), window.removeEventListener("pagehide", Qt), window.removeEventListener("pageshow", jt);
3036
- }), Pe(() => {
3051
+ }), Ne(() => {
3037
3052
  Pn(), Nn(), It(), bt();
3038
3053
  const n = e.theme || "light";
3039
- Pt(n), n === "auto" && (Re = ys(() => Pt("auto"))), Ne = Ls(() => D.value);
3054
+ Pt(n), n === "auto" && (ye = ys(() => Pt("auto"))), Re = Ls(() => D.value);
3040
3055
  });
3041
3056
  function Jt() {
3042
- _e && clearTimeout(_e), _e = setTimeout(() => {
3057
+ oe && clearTimeout(oe), oe = setTimeout(() => {
3043
3058
  const n = window.innerWidth < 768;
3044
- j.value = n, n && (A.value = !0, p.value && Gt()), Vt(), b.value && ct(), p.value && (pe.value = Qe(pe.value));
3059
+ J.value = n, n && (R.value = !0, p.value && Gt()), Vt(), C.value && ct(), p.value && (we.value = Qe(we.value));
3045
3060
  }, 100);
3046
3061
  }
3047
- return Pe(() => {
3062
+ return Ne(() => {
3048
3063
  window.addEventListener("resize", Jt);
3049
- }), Be(() => {
3050
- window.removeEventListener("resize", Jt), _e && clearTimeout(_e), Re == null || Re(), Ne == null || Ne(), Ne = null;
3051
- }), Pe(() => {
3064
+ }), Fe(() => {
3065
+ window.removeEventListener("resize", Jt), oe && clearTimeout(oe), ye == null || ye(), Re == null || Re(), Re = null;
3066
+ }), Ne(() => {
3052
3067
  document.addEventListener("mousemove", rt), document.addEventListener("touchmove", rt, { passive: !0 }), document.addEventListener("mouseup", ut), document.addEventListener("touchend", ut), document.addEventListener("mousemove", dt), document.addEventListener("touchmove", dt, { passive: !0 }), document.addEventListener("mouseup", vt), document.addEventListener("touchend", vt), document.addEventListener("click", Bt, !0), document.addEventListener("mousemove", ft), document.addEventListener("touchmove", ft, { passive: !0 }), document.addEventListener("mouseup", mt), document.addEventListener("touchend", mt);
3053
- }), Be(() => {
3068
+ }), Fe(() => {
3054
3069
  document.removeEventListener("mousemove", rt), document.removeEventListener("touchmove", rt), document.removeEventListener("mouseup", ut), document.removeEventListener("touchend", ut), document.removeEventListener("mousemove", dt), document.removeEventListener("touchmove", dt), document.removeEventListener("mouseup", vt), document.removeEventListener("touchend", vt), document.removeEventListener("click", Bt, !0), document.removeEventListener("mousemove", ft), document.removeEventListener("touchmove", ft), document.removeEventListener("mouseup", mt), document.removeEventListener("touchend", mt), G && clearTimeout(G), W && cancelAnimationFrame(W);
3055
3070
  }), (n, d) => (i(), h("div", null, [
3056
3071
  qe(o("div", {
3057
3072
  ref_key: "panelRef",
3058
3073
  ref: D,
3059
- class: me([
3074
+ class: ge([
3060
3075
  "ai-panel",
3061
- a.value ? "page-mode" : A.value ? "maxWrap" : "minWrap",
3062
- a.value ? "" : Oe.value,
3076
+ a.value ? "page-mode" : R.value ? "maxWrap" : "minWrap",
3077
+ a.value ? "" : Te.value,
3063
3078
  {
3064
- "panel-custom": b.value && !A.value && !j.value && !p.value && !a.value && ue.value === "idle",
3065
- "page-closing": C.value,
3066
- dragging: x.value,
3079
+ "panel-custom": C.value && !R.value && !J.value && !p.value && !a.value && ue.value === "idle",
3080
+ "page-closing": b.value,
3081
+ dragging: T.value,
3067
3082
  "dock-preview": Y.value,
3068
3083
  docked: p.value,
3069
- "dock-resizing": oe.value,
3084
+ "dock-resizing": ae.value,
3070
3085
  "dock-switching": ue.value !== "idle",
3071
- "dock-switch-instant": Q.value,
3086
+ "dock-switch-instant": j.value,
3072
3087
  "dock-switch-fade-in": ve.value === "in",
3073
3088
  "dock-switch-fade-out": ve.value === "out",
3074
3089
  "no-drag": !Nt.value || a.value
3075
3090
  },
3076
3091
  I.value !== "idle" ? I.value : "",
3077
- { morphing: I.value !== "idle", "morph-instant": R.value }
3092
+ { morphing: I.value !== "idle", "morph-instant": P.value }
3078
3093
  ]),
3079
- style: kt([Dn.value, xn.value, En.value])
3094
+ style: kt([Dn.value, Tn.value, En.value])
3080
3095
  }, [
3081
3096
  p.value || a.value ? (i(), h("div", {
3082
3097
  key: 0,
3083
3098
  class: "ai-dock-resizer",
3084
- onMousedown: Le(qt, ["stop"]),
3085
- onTouchstart: Le(qt, ["stop"])
3099
+ onMousedown: Ve(qt, ["stop"]),
3100
+ onTouchstart: Ve(qt, ["stop"])
3086
3101
  }, null, 32)) : z("", !0),
3087
3102
  o("div", {
3088
3103
  class: "header",
@@ -3091,8 +3106,8 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3091
3106
  }, [
3092
3107
  V.value === "info" ? (i(), h("span", {
3093
3108
  key: 0,
3094
- class: me(["back", L.value]),
3095
- onClick: d[0] || (d[0] = ($) => V.value = "answer")
3109
+ class: ge(["back", L.value]),
3110
+ onClick: d[0] || (d[0] = (M) => V.value = "answer")
3096
3111
  }, [...d[6] || (d[6] = [
3097
3112
  o("span", { style: { "font-size": "14px" } }, "←", -1)
3098
3113
  ])], 2)) : (i(), h("p", fi, [
@@ -3104,62 +3119,62 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3104
3119
  o("div", gi, [
3105
3120
  o("span", {
3106
3121
  title: V.value === "info" ? "个人信息" : re.value || g.value
3107
- }, te(V.value === "info" ? "个人信息" : re.value || g.value), 9, pi)
3122
+ }, U(V.value === "info" ? "个人信息" : re.value || g.value), 9, pi)
3108
3123
  ]),
3109
3124
  o("p", null, [
3110
- qe(ke(Te, {
3125
+ qe(Ce(Ee, {
3111
3126
  class: "op-icon",
3112
3127
  name: "add",
3113
3128
  onClick: Gn
3114
3129
  }, null, 512), [
3115
- [nt, $n.value]
3130
+ [nt, Mn.value]
3116
3131
  ]),
3117
- a.value ? z("", !0) : (i(), we(Te, {
3132
+ a.value ? z("", !0) : (i(), _e(Ee, {
3118
3133
  key: 0,
3119
- class: me(["mute", { active: de.value }]),
3134
+ class: ge(["mute", { active: de.value }]),
3120
3135
  name: "history",
3121
- onClick: d[1] || (d[1] = ($) => de.value ? Je() : Yn())
3136
+ onClick: d[1] || (d[1] = (M) => de.value ? Je() : Yn())
3122
3137
  }, null, 8, ["class"])),
3123
- !a.value && !j.value && !p.value ? (i(), we(Te, {
3138
+ !a.value && !J.value && !p.value ? (i(), _e(Ee, {
3124
3139
  key: 1,
3125
3140
  onClick: On,
3126
- name: A.value ? "fullscreenExit" : "fullscreen"
3141
+ name: R.value ? "fullscreenExit" : "fullscreen"
3127
3142
  }, null, 8, ["name"])) : z("", !0),
3128
- p.value && !a.value ? (i(), we(Te, {
3143
+ p.value && !a.value ? (i(), _e(Ee, {
3129
3144
  key: 2,
3130
3145
  name: "dockOut",
3131
3146
  onClick: Gt
3132
3147
  })) : z("", !0),
3133
- Ie.value && !p.value && !a.value ? (i(), we(Te, {
3148
+ Se.value && !p.value && !a.value ? (i(), _e(Ee, {
3134
3149
  key: 3,
3135
3150
  name: "dockIn",
3136
3151
  onClick: zt,
3137
3152
  class: "__minimize"
3138
3153
  })) : z("", !0),
3139
- ke(Te, {
3154
+ Ce(Ee, {
3140
3155
  onClick: Xn,
3141
3156
  name: "close"
3142
3157
  })
3143
3158
  ])
3144
3159
  ], 32),
3145
- a.value ? (i(), we(hi, {
3160
+ a.value ? (i(), _e(hi, {
3146
3161
  key: 1,
3147
3162
  context: f.value
3148
3163
  }, null, 8, ["context"])) : z("", !0),
3149
- qe(ke(Vo, {
3164
+ qe(Ce(Vo, {
3150
3165
  ref_key: "answerRef",
3151
- ref: Z,
3166
+ ref: ne,
3152
3167
  defaultSayhello: ie(e).defaultSayhello,
3153
3168
  defaultRecommend: l.value,
3154
- onTitleGenerated: d[2] || (d[2] = ($) => re.value = $),
3155
- onSessionsChange: d[3] || (d[3] = ($) => U.value = $)
3169
+ onTitleGenerated: d[2] || (d[2] = (M) => re.value = M),
3170
+ onSessionsChange: d[3] || (d[3] = (M) => Z.value = M)
3156
3171
  }, null, 8, ["defaultSayhello", "defaultRecommend"]), [
3157
3172
  [nt, V.value === "answer"]
3158
3173
  ]),
3159
- V.value === "info" ? (i(), we(ci, { key: 2 })) : z("", !0),
3174
+ V.value === "info" ? (i(), _e(ci, { key: 2 })) : z("", !0),
3160
3175
  de.value ? (i(), h("div", {
3161
3176
  key: 3,
3162
- class: me(["ai-history-drawer", { closing: k.value }])
3177
+ class: ge(["ai-history-drawer", { closing: k.value }])
3163
3178
  }, [
3164
3179
  o("div", {
3165
3180
  class: "ai-history-backdrop",
@@ -3168,14 +3183,14 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3168
3183
  o("div", yi, [
3169
3184
  o("div", wi, [
3170
3185
  d[7] || (d[7] = o("span", null, "对话记录", -1)),
3171
- ke(Te, {
3186
+ Ce(Ee, {
3172
3187
  name: "close",
3173
3188
  class: "ai-history-drawer-close",
3174
3189
  onClick: Je
3175
3190
  })
3176
3191
  ]),
3177
- ke(jo, {
3178
- localSessions: U.value,
3192
+ Ce(jo, {
3193
+ localSessions: Z.value,
3179
3194
  onHistoryDetail: qn,
3180
3195
  onNewConversation: Kn
3181
3196
  }, null, 8, ["localSessions"])
@@ -3186,14 +3201,14 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3186
3201
  o("div", Ci, [
3187
3202
  d[8] || (d[8] = o("p", { class: "title" }, "修改标题", -1)),
3188
3203
  qe(o("textarea", {
3189
- "onUpdate:modelValue": d[4] || (d[4] = ($) => s.value = $),
3204
+ "onUpdate:modelValue": d[4] || (d[4] = (M) => s.value = M),
3190
3205
  placeholder: "请输入新标题"
3191
3206
  }, null, 512), [
3192
3207
  [gn, s.value]
3193
3208
  ]),
3194
3209
  o("p", bi, [
3195
3210
  o("span", {
3196
- onClick: d[5] || (d[5] = ($) => le.value = !1)
3211
+ onClick: d[5] || (d[5] = (M) => le.value = !1)
3197
3212
  }, "取消"),
3198
3213
  o("span", { onClick: Qn }, "确定")
3199
3214
  ])
@@ -3203,25 +3218,25 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3203
3218
  [nt, le.value]
3204
3219
  ])
3205
3220
  ], 6), [
3206
- [nt, T.value || I.value !== "idle"]
3221
+ [nt, x.value || I.value !== "idle"]
3207
3222
  ]),
3208
- Y.value && Ie.value ? (i(), h("div", {
3223
+ Y.value && Se.value ? (i(), h("div", {
3209
3224
  key: 0,
3210
3225
  class: "ai-dock-preview",
3211
- style: kt({ width: pe.value + "px" })
3226
+ style: kt({ width: we.value + "px" })
3212
3227
  }, [...d[9] || (d[9] = [
3213
3228
  o("span", { class: "ai-dock-preview__text" }, "松开以停靠到右侧", -1)
3214
3229
  ])], 4)) : z("", !0),
3215
3230
  qe(o("div", {
3216
- class: me(["character", { dragging: O.value, recycling: q.value, "hover-preview": N.value }]),
3217
- style: kt(Sn.value),
3231
+ class: ge(["character", { dragging: O.value, recycling: q.value, "hover-preview": N.value }]),
3232
+ style: kt($n.value),
3218
3233
  onMousedown: Ot,
3219
3234
  onTouchstart: Ot,
3220
3235
  onClick: In
3221
3236
  }, [
3222
- o("img", { src: Tn.value }, null, 8, Mi)
3237
+ o("img", { src: xn.value }, null, 8, Si)
3223
3238
  ], 38), [
3224
- [nt, !T.value && !a.value]
3239
+ [nt, !x.value && !a.value]
3225
3240
  ])
3226
3241
  ]));
3227
3242
  }
@@ -3250,7 +3265,7 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3250
3265
  fill: "currentColor",
3251
3266
  width: "16",
3252
3267
  height: "16"
3253
- }, Bi = /* @__PURE__ */ $e({
3268
+ }, Bi = /* @__PURE__ */ xe({
3254
3269
  __name: "VoiceInput",
3255
3270
  props: {
3256
3271
  lang: {},
@@ -3272,93 +3287,93 @@ const xo = { class: "container" }, Do = { class: "chat-wrap" }, Eo = { class: "m
3272
3287
  recording: "停止录音",
3273
3288
  stopping: "识别中…",
3274
3289
  error: "重试"
3275
- }, g = _(""), l = _(""), r = _("idle"), M = ot.isSupported();
3276
- let C = null;
3277
- const E = S(() => _s(v.theme)), T = () => ({
3290
+ }, g = _(""), l = _(""), r = _("idle"), S = ot.isSupported();
3291
+ let b = null;
3292
+ const E = $(() => _s(v.theme)), x = () => ({
3278
3293
  lang: v.lang,
3279
3294
  continuous: v.continuous,
3280
3295
  interimResults: v.interimResults
3281
3296
  }), I = () => {
3282
- M && (C = new ot(T(), {
3297
+ S && (b = new ot(x(), {
3283
3298
  onStatusChange: (s) => {
3284
3299
  r.value = s, a("statusChange", s), s === "idle" && a("complete", g.value);
3285
3300
  },
3286
3301
  onInterim: (s) => {
3287
3302
  l.value = s;
3288
3303
  },
3289
- onFinal: (s, ae) => {
3290
- g.value += s, l.value = "", a("final", s, ae);
3304
+ onFinal: (s, se) => {
3305
+ g.value += s, l.value = "", a("final", s, se);
3291
3306
  },
3292
3307
  onResult: (s) => a("result", s),
3293
3308
  onError: (s) => a("error", s)
3294
3309
  }));
3295
3310
  };
3296
- Pe(I), Lt(() => {
3297
- C == null || C.destroy(), C = null;
3298
- }), ge(
3311
+ Ne(I), Lt(() => {
3312
+ b == null || b.destroy(), b = null;
3313
+ }), pe(
3299
3314
  () => [v.lang, v.continuous, v.interimResults],
3300
3315
  () => {
3301
- C == null || C.destroy(), I();
3316
+ b == null || b.destroy(), I();
3302
3317
  }
3303
3318
  );
3304
- const R = async () => {
3305
- if (C)
3319
+ const P = async () => {
3320
+ if (b)
3306
3321
  if (r.value === "idle" || r.value === "error")
3307
3322
  try {
3308
- await C.start();
3323
+ await b.start();
3309
3324
  } catch {
3310
3325
  }
3311
- else r.value === "recording" && C.stop();
3326
+ else r.value === "recording" && b.stop();
3312
3327
  }, y = () => {
3313
3328
  g.value = "", l.value = "";
3314
- }, N = S(() => !g.value && !l.value), j = S(
3315
- () => M ? v.placeholder || "点击按钮开始语音输入…" : "当前浏览器不支持语音识别"
3316
- ), A = S(() => M ? r.value === "connecting" ? v.connectingText || f.connecting : r.value === "recording" ? v.stopText || f.recording : r.value === "stopping" ? v.stoppingText || f.stopping : r.value === "error" ? f.error : v.startText || f.idle : "不支持"), V = S(() => {
3329
+ }, N = $(() => !g.value && !l.value), J = $(
3330
+ () => S ? v.placeholder || "点击按钮开始语音输入…" : "当前浏览器不支持语音识别"
3331
+ ), R = $(() => S ? r.value === "connecting" ? v.connectingText || f.connecting : r.value === "recording" ? v.stopText || f.recording : r.value === "stopping" ? v.stoppingText || f.stopping : r.value === "error" ? f.error : v.startText || f.idle : "不支持"), V = $(() => {
3317
3332
  const s = ["ai-voice-input-btn"];
3318
3333
  return r.value === "recording" && s.push("is-recording"), r.value === "connecting" && s.push("is-connecting"), r.value === "stopping" && s.push("is-stopping"), s.join(" ");
3319
- }), le = S(
3320
- () => !M || r.value === "connecting" || r.value === "stopping"
3334
+ }), le = $(
3335
+ () => !S || r.value === "connecting" || r.value === "stopping"
3321
3336
  );
3322
3337
  return w({
3323
3338
  start: async () => {
3324
- await (C == null ? void 0 : C.start());
3339
+ await (b == null ? void 0 : b.start());
3325
3340
  },
3326
- stop: () => C == null ? void 0 : C.stop(),
3327
- cancel: () => C == null ? void 0 : C.cancel(),
3341
+ stop: () => b == null ? void 0 : b.stop(),
3342
+ cancel: () => b == null ? void 0 : b.cancel(),
3328
3343
  getText: () => g.value + l.value,
3329
3344
  clear: () => {
3330
3345
  g.value = "", l.value = "";
3331
3346
  },
3332
- getStatus: () => (C == null ? void 0 : C.getStatus()) ?? "idle"
3333
- }), (s, ae) => (i(), h("div", {
3334
- class: me(["ai-voice-input", t.className]),
3347
+ getStatus: () => (b == null ? void 0 : b.getStatus()) ?? "idle"
3348
+ }), (s, se) => (i(), h("div", {
3349
+ class: ge(["ai-voice-input", t.className]),
3335
3350
  "data-theme": E.value
3336
3351
  }, [
3337
3352
  o("div", {
3338
- class: me(["ai-voice-input-display", { "is-empty": N.value }])
3353
+ class: ge(["ai-voice-input-display", { "is-empty": N.value }])
3339
3354
  }, [
3340
- g.value ? (i(), h("span", Ri, te(g.value), 1)) : z("", !0),
3341
- l.value ? (i(), h("span", Pi, te(l.value), 1)) : z("", !0),
3355
+ g.value ? (i(), h("span", Ri, U(g.value), 1)) : z("", !0),
3356
+ l.value ? (i(), h("span", Pi, U(l.value), 1)) : z("", !0),
3342
3357
  r.value === "recording" && !l.value ? (i(), h("span", Li)) : z("", !0),
3343
- N.value ? (i(), h("span", Hi, te(j.value), 1)) : z("", !0)
3358
+ N.value ? (i(), h("span", Hi, U(J.value), 1)) : z("", !0)
3344
3359
  ], 2),
3345
3360
  o("button", {
3346
3361
  type: "button",
3347
- class: me(V.value),
3362
+ class: ge(V.value),
3348
3363
  disabled: le.value,
3349
- onClick: R
3364
+ onClick: P
3350
3365
  }, [
3351
- r.value === "recording" ? (i(), h("span", Vi)) : r.value === "connecting" || r.value === "stopping" ? (i(), h("span", Oi, [...ae[0] || (ae[0] = [
3366
+ r.value === "recording" ? (i(), h("span", Vi)) : r.value === "connecting" || r.value === "stopping" ? (i(), h("span", Oi, [...se[0] || (se[0] = [
3352
3367
  o("span", null, null, -1),
3353
3368
  o("span", null, null, -1),
3354
3369
  o("span", null, null, -1),
3355
3370
  o("span", null, null, -1),
3356
3371
  o("span", null, null, -1)
3357
- ])])) : (i(), h("svg", Wi, [...ae[1] || (ae[1] = [
3372
+ ])])) : (i(), h("svg", Wi, [...se[1] || (se[1] = [
3358
3373
  o("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
3359
3374
  o("path", { d: "M19 11a7 7 0 0 1-14 0H3a9 9 0 0 0 8 8.94V23h2v-3.06A9 9 0 0 0 21 11h-2z" }, null, -1)
3360
3375
  ])])),
3361
- o("span", null, te(A.value), 1)
3376
+ o("span", null, U(R.value), 1)
3362
3377
  ], 10, Ni),
3363
3378
  N.value ? z("", !0) : (i(), h("button", {
3364
3379
  key: 0,
@@ -3377,18 +3392,18 @@ const Ki = (t) => {
3377
3392
  const w = t || document.body, e = document.createElement("div");
3378
3393
  e.id = "ai-assist-root";
3379
3394
  const v = lt();
3380
- Pt(v.theme), Cs(), w.appendChild(e), it = ss(Mn), it.mount(e);
3395
+ Pt(v.theme), Cs(), w.appendChild(e), it = ss(Sn), it.mount(e);
3381
3396
  }, Qi = () => {
3382
3397
  it && (it.unmount(), it = null);
3383
3398
  const t = document.getElementById("ai-assist-root");
3384
3399
  t && t.remove(), bs();
3385
3400
  }, ji = {
3386
3401
  install(t, w) {
3387
- kn(w), wn(w), t.component("AiAssist", Mn), t.component("VoiceInput", Fi);
3402
+ kn(w), wn(w), t.component("AiAssist", Sn), t.component("VoiceInput", Fi);
3388
3403
  }
3389
3404
  };
3390
3405
  export {
3391
- Mn as AiAssist,
3406
+ Sn as AiAssist,
3392
3407
  Fi as VoiceInput,
3393
3408
  os as clearPageThreadId,
3394
3409
  Ui as closeAiAssist,
@@ -3396,7 +3411,7 @@ export {
3396
3411
  ji as default,
3397
3412
  Ct as getAiAssistMode,
3398
3413
  an as getPageContextSnapshot,
3399
- We as getPageModule,
3414
+ Be as getPageModule,
3400
3415
  Rt as getPageThreadId,
3401
3416
  Ki as initAiAssist,
3402
3417
  yn as isAiAssistPageMode,
@@ -3407,7 +3422,7 @@ export {
3407
3422
  ks as setAiAssistMode,
3408
3423
  on as setAiAssistVisible,
3409
3424
  nl as setPageModule,
3410
- xt as setPageThreadId,
3425
+ Tt as setPageThreadId,
3411
3426
  ps as subscribeAiAssistState,
3412
3427
  sl as toggleAiAssist,
3413
3428
  Qi as unmountAiAssist