@somecat/ai-assist-sdk 1.2.1 → 1.2.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.
@@ -1,79 +1,79 @@
1
- import { defineComponent as le, ref as k, watch as se, onUnmounted as Te, openBlock as m, createElementBlock as A, normalizeClass as J, createElementVNode as n, toDisplayString as V, createVNode as X, Transition as ut, withCtx as vt, createTextVNode as dt, createCommentVNode as N, computed as Y, reactive as K, Fragment as ie, createStaticVNode as ht, withModifiers as Ce, createBlock as Z, unref as H, renderList as me, Teleport as je, onMounted as ne, onBeforeUnmount as ze, nextTick as te, normalizeStyle as xe, withKeys as mt, withDirectives as de, vShow as we, vModelText as gt, createApp as pt } from "vue";
2
- import { u as Xe, E as Fe, C as ft, l as ge, a as Ke, f as Qe, n as yt, z as wt, e as Ge, h as kt, B as Ct, j as At, F as bt, m as St, g as Mt, p as Tt, c as _e, D as xt, w as Et, G as Rt, x as Ze } from "../chunks/engine-DxdqzC3A.mjs";
3
- import { f as $t, s as he, b as Ie, a as Pt, c as Dt } from "../chunks/index-CgnkZbtP.mjs";
4
- import { BulbOutlined as Ht, SearchOutlined as Je, CheckOutlined as _t, CopyOutlined as Ot, RedoOutlined as Lt, CloseOutlined as Bt } from "@ant-design/icons-vue";
1
+ import { defineComponent as pe, ref as y, watch as re, onUnmounted as qe, openBlock as g, createElementBlock as A, normalizeClass as J, createElementVNode as s, toDisplayString as V, createVNode as G, Transition as tn, withCtx as nn, createTextVNode as sn, createCommentVNode as B, computed as X, reactive as Z, Fragment as fe, createStaticVNode as an, withModifiers as Ce, createBlock as ee, unref as O, renderList as De, Teleport as At, onMounted as ue, onBeforeUnmount as bt, nextTick as ae, normalizeStyle as We, withKeys as on, withDirectives as Me, vShow as He, vModelText as ln, createApp as cn } from "vue";
2
+ import { u as dt, E as ht, C as un, l as Re, a as St, f as mt, n as rn, z as vn, e as gt, h as dn, B as hn, j as mn, F as gn, m as fn, g as pn, p as yn, c as Ue, D as wn, w as kn, G as Cn, x as xt } from "../chunks/engine-DxdqzC3A.mjs";
3
+ import { f as An, s as Te, b as Mt, a as bn, c as Sn } from "../chunks/index-CgnkZbtP.mjs";
4
+ import { BulbOutlined as xn, SearchOutlined as ft, CheckOutlined as Mn, CopyOutlined as En, RedoOutlined as Tn, CloseOutlined as Dn } from "@ant-design/icons-vue";
5
5
  import { Icon as j } from "@iconify/vue";
6
- const Nt = "data:image/png;base64,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", Wt = { class: "thinking-block__title" }, Yt = {
6
+ const Rn = "data:image/png;base64,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", $n = { class: "thinking-block__title" }, Pn = {
7
7
  key: 0,
8
8
  class: "thinking-block__content"
9
- }, Vt = {
9
+ }, _n = {
10
10
  key: 0,
11
11
  class: "streaming-cursor"
12
- }, Xt = /* @__PURE__ */ le({
12
+ }, Hn = /* @__PURE__ */ pe({
13
13
  __name: "ThinkingBlock",
14
14
  props: {
15
15
  content: {},
16
16
  isStreaming: { type: Boolean }
17
17
  },
18
18
  setup(t) {
19
- const C = t, f = k(!1);
20
- function h() {
21
- f.value = !f.value;
19
+ const b = t, u = y(!1);
20
+ function m() {
21
+ u.value = !u.value;
22
22
  }
23
- const o = k(C.content), r = k(C.content.length), l = k(0);
24
- let i = 0, u = 0;
25
- function g() {
23
+ const o = y(b.content), d = y(b.content.length), c = y(0);
24
+ let i = 0, r = 0;
25
+ function p() {
26
26
  if (i) return;
27
- const c = 80, y = (P) => {
28
- if (u === 0) {
29
- u = P, i = requestAnimationFrame(y);
27
+ const v = 80, k = (_) => {
28
+ if (r === 0) {
29
+ r = _, i = requestAnimationFrame(k);
30
30
  return;
31
31
  }
32
- const x = Math.min(P - u, 100);
33
- u = P;
34
- const _ = C.content, e = _.length - r.value;
32
+ const D = Math.min(_ - r, 100);
33
+ r = _;
34
+ const W = b.content, e = W.length - d.value;
35
35
  if (e > 0) {
36
- const v = c + e;
37
- l.value += v * x / 1e3;
38
- const E = Math.floor(l.value);
39
- E > 0 && (l.value -= E, r.value = Math.min(r.value + E, _.length), o.value = _.slice(0, r.value));
36
+ const h = v + e;
37
+ c.value += h * D / 1e3;
38
+ const R = Math.floor(c.value);
39
+ R > 0 && (c.value -= R, d.value = Math.min(d.value + R, W.length), o.value = W.slice(0, d.value));
40
40
  } else
41
- l.value = 0;
42
- i = requestAnimationFrame(y);
41
+ c.value = 0;
42
+ i = requestAnimationFrame(k);
43
43
  };
44
- u = 0, i = requestAnimationFrame(y);
44
+ r = 0, i = requestAnimationFrame(k);
45
45
  }
46
- function D() {
46
+ function H() {
47
47
  i && (cancelAnimationFrame(i), i = 0);
48
48
  }
49
- function $() {
50
- D(), o.value = C.content, r.value = C.content.length, l.value = 0;
49
+ function P() {
50
+ H(), o.value = b.content, d.value = b.content.length, c.value = 0;
51
51
  }
52
- return se(
53
- () => C.content,
52
+ return re(
53
+ () => b.content,
54
54
  () => {
55
- C.isStreaming || $();
55
+ b.isStreaming || P();
56
56
  }
57
- ), se(
58
- () => C.isStreaming,
59
- (c) => {
60
- c ? g() : $();
57
+ ), re(
58
+ () => b.isStreaming,
59
+ (v) => {
60
+ v ? p() : P();
61
61
  },
62
62
  { immediate: !0 }
63
- ), Te(D), (c, y) => (m(), A("div", {
63
+ ), qe(H), (v, k) => (g(), A("div", {
64
64
  class: J(["thinking-block", {
65
- "thinking-block--expanded": f.value,
65
+ "thinking-block--expanded": u.value,
66
66
  "thinking-block--active": t.isStreaming
67
67
  }])
68
68
  }, [
69
- n("div", {
69
+ s("div", {
70
70
  class: "thinking-block__header",
71
- onClick: h
71
+ onClick: m
72
72
  }, [
73
- y[1] || (y[1] = n("span", { class: "thinking-block__indicator" }, null, -1)),
74
- n("span", Wt, V(t.isStreaming ? "深度思考中" : "深度思考"), 1),
75
- (m(), A("svg", {
76
- class: J(["thinking-block__arrow", { "thinking-block__arrow--down": f.value }]),
73
+ k[1] || (k[1] = s("span", { class: "thinking-block__indicator" }, null, -1)),
74
+ s("span", $n, V(t.isStreaming ? "深度思考中" : "深度思考"), 1),
75
+ (g(), A("svg", {
76
+ class: J(["thinking-block__arrow", { "thinking-block__arrow--down": u.value }]),
77
77
  viewBox: "0 0 24 24",
78
78
  width: "14",
79
79
  height: "14",
@@ -82,46 +82,46 @@ const Nt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
82
82
  "stroke-width": "2.5",
83
83
  "stroke-linecap": "round",
84
84
  "stroke-linejoin": "round"
85
- }, [...y[0] || (y[0] = [
86
- n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
85
+ }, [...k[0] || (k[0] = [
86
+ s("polyline", { points: "6 9 12 15 18 9" }, null, -1)
87
87
  ])], 2))
88
88
  ]),
89
- X(ut, { name: "thinking-expand" }, {
90
- default: vt(() => [
91
- f.value ? (m(), A("div", Yt, [
92
- dt(V(o.value), 1),
93
- t.isStreaming ? (m(), A("span", Vt)) : N("", !0)
94
- ])) : N("", !0)
89
+ G(tn, { name: "thinking-expand" }, {
90
+ default: nn(() => [
91
+ u.value ? (g(), A("div", Pn, [
92
+ sn(V(o.value), 1),
93
+ t.isStreaming ? (g(), A("span", _n)) : B("", !0)
94
+ ])) : B("", !0)
95
95
  ]),
96
96
  _: 1
97
97
  })
98
98
  ], 2));
99
99
  }
100
- }), Ft = {
100
+ }), On = {
101
101
  key: 0,
102
102
  class: "message-content ba-markdown"
103
- }, Qt = { class: "thought-collapse-bar__text" }, Gt = {
103
+ }, Ln = { class: "thought-collapse-bar__text" }, Wn = {
104
104
  key: 2,
105
105
  class: "thought-collapse-bar__duration"
106
- }, Jt = { class: "thought-collapse-bar__action" }, Ut = { class: "agent-thought__spinner" }, qt = { class: "agent-thought__text" }, jt = { key: 2 }, zt = ["innerHTML"], Kt = {
106
+ }, Nn = { class: "thought-collapse-bar__action" }, Bn = { class: "agent-thought__spinner" }, Yn = { class: "agent-thought__text" }, Xn = { key: 2 }, Vn = ["innerHTML"], Fn = {
107
107
  key: 1,
108
108
  class: "streaming-cursor"
109
- }, Zt = ["innerHTML"], It = {
109
+ }, Qn = ["innerHTML"], Gn = {
110
110
  key: 0,
111
111
  class: "streaming-cursor"
112
- }, en = {
112
+ }, zn = {
113
113
  key: 3,
114
114
  class: "message-error"
115
- }, tn = {
115
+ }, Jn = {
116
116
  key: 4,
117
117
  class: "message-toolbar"
118
- }, nn = ["data-tooltip"], sn = {
118
+ }, qn = ["data-tooltip"], Kn = {
119
119
  class: "tooltip-enhanced",
120
120
  "data-tooltip": "重新回答"
121
- }, an = {
121
+ }, Un = {
122
122
  key: 1,
123
123
  class: "message-content"
124
- }, on = ["src"], ln = /* @__PURE__ */ le({
124
+ }, jn = ["src"], In = /* @__PURE__ */ pe({
125
125
  __name: "MessageItem",
126
126
  props: {
127
127
  msg: {},
@@ -132,78 +132,78 @@ const Nt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
132
132
  setMessageRef: { type: Function }
133
133
  },
134
134
  emits: ["regenerate"],
135
- setup(t, { emit: C }) {
136
- const f = t, h = Y(
137
- () => f.msg.status === f.STATUS.COMPLETED || f.msg.status === f.STATUS.STOP
138
- ), o = k(!1);
139
- se(h, (e) => {
135
+ setup(t, { emit: b }) {
136
+ const u = t, m = X(
137
+ () => u.msg.status === u.STATUS.COMPLETED || u.msg.status === u.STATUS.STOP
138
+ ), o = y(!1);
139
+ re(m, (e) => {
140
140
  e && (o.value = !1);
141
141
  });
142
- const r = Y(
142
+ const d = X(
143
143
  () => {
144
144
  var e;
145
- return ((e = f.msg.segments) == null ? void 0 : e.filter((v) => v.type === "thinking" || v.type === "agent_thought")) ?? [];
145
+ return ((e = u.msg.segments) == null ? void 0 : e.filter((h) => h.type === "thinking" || h.type === "agent_thought")) ?? [];
146
146
  }
147
- ), l = Y(() => r.value.length > 0), i = Y(() => r.value.some((e) => e.type === "thinking")), u = Y(() => {
147
+ ), c = X(() => d.value.length > 0), i = X(() => d.value.some((e) => e.type === "thinking")), r = X(() => {
148
148
  const e = [];
149
- return i.value && e.push("深度思考"), r.value.some((v) => v.type === "agent_thought") && e.push("工具调用"), e.join(" · ") || "思考过程";
150
- }), g = Y(() => !h.value || o.value), D = Y(
151
- () => r.value.reduce((e, v) => e + (v.duration ?? 0), 0)
149
+ return i.value && e.push("深度思考"), d.value.some((h) => h.type === "agent_thought") && e.push("工具调用"), e.join(" · ") || "思考过程";
150
+ }), p = X(() => !m.value || o.value), H = X(
151
+ () => d.value.reduce((e, h) => e + (h.duration ?? 0), 0)
152
152
  );
153
- function $(e) {
153
+ function P(e) {
154
154
  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`;
155
155
  }
156
- const c = K(/* @__PURE__ */ new Map()), y = k("");
157
- function P(e) {
158
- const v = e.target;
159
- v.tagName === "IMG" && (y.value = v.src);
156
+ const v = Z(/* @__PURE__ */ new Map()), k = y("");
157
+ function _(e) {
158
+ const h = e.target;
159
+ h.tagName === "IMG" && (k.value = h.src);
160
160
  }
161
- function x() {
162
- y.value = "";
161
+ function D() {
162
+ k.value = "";
163
163
  }
164
- function _(e, v) {
165
- var E;
164
+ function W(e, h) {
165
+ var R;
166
166
  try {
167
- let b = e.content;
168
- if (!b && ((E = e.segments) != null && E.length) && (b = e.segments.filter((s) => s.type !== "thinking" && s.type !== "agent_thought").map((s) => s.content).join(`
169
- `)), b) {
170
- const { copy: s } = ft();
171
- s(b), c.set(v, !0), setTimeout(() => c.set(v, !1), 2e3);
167
+ let x = e.content;
168
+ if (!x && ((R = e.segments) != null && R.length) && (x = e.segments.filter((a) => a.type !== "thinking" && a.type !== "agent_thought").map((a) => a.content).join(`
169
+ `)), x) {
170
+ const { copy: a } = un();
171
+ a(x), v.set(h, !0), setTimeout(() => v.set(h, !1), 2e3);
172
172
  }
173
173
  } catch {
174
174
  }
175
175
  }
176
- return (e, v) => {
177
- var E;
178
- return m(), A("div", {
176
+ return (e, h) => {
177
+ var R;
178
+ return g(), A("div", {
179
179
  class: J(["message", `${t.msg.type}-message`])
180
180
  }, [
181
- t.msg.type === "ai" ? (m(), A(ie, { key: 0 }, [
182
- (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (m(), A("div", Ft, [...v[4] || (v[4] = [
183
- ht('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
184
- ])])) : N("", !0),
185
- t.msg.segments && t.msg.segments.length ? (m(), A("div", {
181
+ t.msg.type === "ai" ? (g(), A(fe, { key: 0 }, [
182
+ (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), A("div", On, [...h[4] || (h[4] = [
183
+ an('<div class="scale-animation-container"><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span><span class="scale-dot"></span></div>', 1)
184
+ ])])) : B("", !0),
185
+ t.msg.segments && t.msg.segments.length ? (g(), A("div", {
186
186
  key: 1,
187
187
  class: "message-content ba-markdown",
188
- ref: (b) => t.setMessageRef(b, t.index),
189
- onClick: P
188
+ ref: (x) => t.setMessageRef(x, t.index),
189
+ onClick: _
190
190
  }, [
191
- h.value && l.value ? (m(), A("div", {
191
+ m.value && c.value ? (g(), A("div", {
192
192
  key: 0,
193
193
  class: J(["thought-collapse-bar", { "thought-collapse-bar--expanded": o.value }]),
194
- onClick: v[0] || (v[0] = Ce((b) => o.value = !o.value, ["stop"]))
194
+ onClick: h[0] || (h[0] = Ce((x) => o.value = !o.value, ["stop"]))
195
195
  }, [
196
- i.value ? (m(), Z(H(Ht), {
196
+ i.value ? (g(), ee(O(xn), {
197
197
  key: 0,
198
198
  class: "thought-collapse-bar__icon"
199
- })) : (m(), Z(H(Je), {
199
+ })) : (g(), ee(O(ft), {
200
200
  key: 1,
201
201
  class: "thought-collapse-bar__icon"
202
202
  })),
203
- n("span", Qt, V(u.value), 1),
204
- D.value > 0 ? (m(), A("span", Gt, V($(D.value)), 1)) : N("", !0),
205
- n("span", Jt, V(o.value ? "收起" : "查看"), 1),
206
- (m(), A("svg", {
203
+ s("span", Ln, V(r.value), 1),
204
+ H.value > 0 ? (g(), A("span", Wn, V(P(H.value)), 1)) : B("", !0),
205
+ s("span", Nn, V(o.value ? "收起" : "查看"), 1),
206
+ (g(), A("svg", {
207
207
  class: J(["thought-collapse-bar__arrow", { "thought-collapse-bar__arrow--down": o.value }]),
208
208
  viewBox: "0 0 24 24",
209
209
  width: "12",
@@ -213,115 +213,115 @@ const Nt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
213
213
  "stroke-width": "2.5",
214
214
  "stroke-linecap": "round",
215
215
  "stroke-linejoin": "round"
216
- }, [...v[5] || (v[5] = [
217
- n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
216
+ }, [...h[5] || (h[5] = [
217
+ s("polyline", { points: "6 9 12 15 18 9" }, null, -1)
218
218
  ])], 2))
219
- ], 2)) : N("", !0),
220
- (m(!0), A(ie, null, me(t.msg.segments, (b, s) => (m(), A(ie, { key: s }, [
221
- b.type === "agent_thought" && g.value ? (m(), A("div", {
219
+ ], 2)) : B("", !0),
220
+ (g(!0), A(fe, null, De(t.msg.segments, (x, a) => (g(), A(fe, { key: a }, [
221
+ x.type === "agent_thought" && p.value ? (g(), A("div", {
222
222
  key: 0,
223
- class: J(["agent-thought", { "agent-thought--done": b.duration != null }])
223
+ class: J(["agent-thought", { "agent-thought--done": x.duration != null }])
224
224
  }, [
225
- n("span", Ut, [
226
- X(H(Je))
225
+ s("span", Bn, [
226
+ G(O(ft))
227
227
  ]),
228
- n("span", qt, V(b.duration != null ? "工具调用" : "工具调用中..."), 1)
229
- ], 2)) : b.type === "thinking" && g.value ? (m(), Z(Xt, {
228
+ s("span", Yn, V(x.duration != null ? "工具调用" : "工具调用中..."), 1)
229
+ ], 2)) : x.type === "thinking" && p.value ? (g(), ee(Hn, {
230
230
  key: 1,
231
- content: b.content,
232
- "is-streaming": b.duration == null && (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING)
233
- }, null, 8, ["content", "is-streaming"])) : b.type === "answer" ? (m(), A("div", jt, [
234
- n("div", {
235
- innerHTML: H(Xe)(H(Fe)(t.getSegmentDisplayContent(t.index, s, b, t.msg)))
236
- }, null, 8, zt)
237
- ])) : N("", !0)
231
+ content: x.content,
232
+ "is-streaming": x.duration == null && (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING)
233
+ }, null, 8, ["content", "is-streaming"])) : x.type === "answer" ? (g(), A("div", Xn, [
234
+ s("div", {
235
+ innerHTML: O(dt)(O(ht)(t.getSegmentDisplayContent(t.index, a, x, t.msg)))
236
+ }, null, 8, Vn)
237
+ ])) : B("", !0)
238
238
  ], 64))), 128)),
239
- t.msg.status === t.STATUS.ANSWERING ? (m(), A("span", Kt)) : N("", !0)
240
- ], 512)) : N("", !0),
241
- !((E = t.msg.segments) != null && E.length) && t.msg.content ? (m(), A("div", {
239
+ t.msg.status === t.STATUS.ANSWERING ? (g(), A("span", Fn)) : B("", !0)
240
+ ], 512)) : B("", !0),
241
+ !((R = t.msg.segments) != null && R.length) && t.msg.content ? (g(), A("div", {
242
242
  key: 2,
243
243
  class: "message-content ba-markdown",
244
- ref: (b) => t.setMessageRef(b, t.index),
245
- onClick: P
244
+ ref: (x) => t.setMessageRef(x, t.index),
245
+ onClick: _
246
246
  }, [
247
- n("div", {
248
- innerHTML: H(Xe)(H(Fe)(t.displayedContent.get(t.index) ?? t.msg.content))
249
- }, null, 8, Zt),
250
- t.msg.status === t.STATUS.ANSWERING ? (m(), A("span", It)) : N("", !0)
251
- ], 512)) : N("", !0),
252
- t.msg.errorMessage ? (m(), A("div", en, [
253
- v[6] || (v[6] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
254
- n("span", null, V(t.msg.errorMessage), 1)
255
- ])) : N("", !0),
256
- t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (m(), A("div", tn, [
257
- n("div", {
247
+ s("div", {
248
+ innerHTML: O(dt)(O(ht)(t.displayedContent.get(t.index) ?? t.msg.content))
249
+ }, null, 8, Qn),
250
+ t.msg.status === t.STATUS.ANSWERING ? (g(), A("span", Gn)) : B("", !0)
251
+ ], 512)) : B("", !0),
252
+ t.msg.errorMessage ? (g(), A("div", zn, [
253
+ h[6] || (h[6] = s("span", { class: "message-error__icon" }, "⚠️", -1)),
254
+ s("span", null, V(t.msg.errorMessage), 1)
255
+ ])) : B("", !0),
256
+ t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (g(), A("div", Jn, [
257
+ s("div", {
258
258
  class: "tooltip-enhanced",
259
- "data-tooltip": c.get(t.index) ? "已复制" : "复制回答"
259
+ "data-tooltip": v.get(t.index) ? "已复制" : "复制回答"
260
260
  }, [
261
- c.get(t.index) ? (m(), Z(H(_t), {
261
+ v.get(t.index) ? (g(), ee(O(Mn), {
262
262
  key: 0,
263
263
  class: "message-toolbar__check"
264
- })) : (m(), Z(H(Ot), {
264
+ })) : (g(), ee(O(En), {
265
265
  key: 1,
266
- onClick: v[1] || (v[1] = (b) => _(t.msg, t.index))
266
+ onClick: h[1] || (h[1] = (x) => W(t.msg, t.index))
267
267
  }))
268
- ], 8, nn),
269
- n("div", sn, [
270
- X(H(Lt), {
271
- onClick: v[2] || (v[2] = (b) => e.$emit("regenerate"))
268
+ ], 8, qn),
269
+ s("div", Kn, [
270
+ G(O(Tn), {
271
+ onClick: h[2] || (h[2] = (x) => e.$emit("regenerate"))
272
272
  })
273
273
  ])
274
- ])) : N("", !0)
275
- ], 64)) : (m(), A("div", an, V(t.msg.content), 1)),
276
- (m(), Z(je, { to: "#ai-assist-root" }, [
277
- y.value ? (m(), A("div", {
274
+ ])) : B("", !0)
275
+ ], 64)) : (g(), A("div", Un, V(t.msg.content), 1)),
276
+ (g(), ee(At, { to: "#ai-assist-root" }, [
277
+ k.value ? (g(), A("div", {
278
278
  key: 0,
279
279
  class: "ai-image-preview-overlay",
280
- onClick: x
280
+ onClick: D
281
281
  }, [
282
- n("img", {
283
- src: y.value,
282
+ s("img", {
283
+ src: k.value,
284
284
  class: "ai-image-preview-overlay__img",
285
- onClick: v[3] || (v[3] = Ce(() => {
285
+ onClick: h[3] || (h[3] = Ce(() => {
286
286
  }, ["stop"]))
287
- }, null, 8, on),
288
- n("button", {
287
+ }, null, 8, jn),
288
+ s("button", {
289
289
  class: "ai-image-preview-overlay__close",
290
- onClick: Ce(x, ["stop"])
290
+ onClick: Ce(D, ["stop"])
291
291
  }, [
292
- X(H(Bt))
292
+ G(O(Dn))
293
293
  ])
294
- ])) : N("", !0)
294
+ ])) : B("", !0)
295
295
  ]))
296
296
  ], 2);
297
297
  };
298
298
  }
299
- }), cn = {
299
+ }), Zn = {
300
300
  key: 0,
301
301
  class: "input-container voice-mode"
302
- }, rn = {
302
+ }, es = {
303
303
  key: 0,
304
304
  class: "final"
305
- }, un = {
305
+ }, ts = {
306
306
  key: 1,
307
307
  class: "interim"
308
- }, vn = {
308
+ }, ns = {
309
309
  key: 2,
310
310
  class: "placeholder"
311
- }, dn = ["data-tooltip"], hn = {
311
+ }, ss = ["data-tooltip"], as = {
312
312
  key: 0,
313
313
  class: "moveTB"
314
- }, mn = {
314
+ }, os = {
315
315
  key: 1,
316
316
  class: "input-container"
317
- }, gn = ["value", "disabled"], pn = {
317
+ }, is = ["value", "disabled"], ls = {
318
318
  key: 0,
319
319
  class: "tooltip-enhanced stop",
320
320
  "data-tooltip": "停止生成"
321
- }, fn = ["data-tooltip"], yn = {
321
+ }, cs = ["data-tooltip"], us = {
322
322
  key: 3,
323
323
  class: "moveTB"
324
- }, wn = /* @__PURE__ */ le({
324
+ }, rs = /* @__PURE__ */ pe({
325
325
  __name: "ChatInput",
326
326
  props: {
327
327
  modelValue: {},
@@ -331,179 +331,179 @@ const Nt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
331
331
  isAtBottom: { type: Boolean }
332
332
  },
333
333
  emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
334
- setup(t, { emit: C }) {
335
- const f = t, h = C, r = ge().voice, l = k(!1), i = k(""), u = k(""), g = k("idle"), D = k(0), $ = k(null);
336
- let c = null;
337
- const y = Y(() => g.value === "connecting"), P = Y(
338
- () => g.value === "recording" || g.value === "stopping"
339
- ), x = Y(
340
- () => !!(i.value.trim() || u.value.trim())
341
- ), _ = Y(
342
- () => !!r && !f.modelValue.trim() && !f.isGenerating
334
+ setup(t, { emit: b }) {
335
+ const u = t, m = b, d = Re().voice, c = y(!1), i = y(""), r = y(""), p = y("idle"), H = y(0), P = y(null);
336
+ let v = null;
337
+ const k = X(() => p.value === "connecting"), _ = X(
338
+ () => p.value === "recording" || p.value === "stopping"
339
+ ), D = X(
340
+ () => !!(i.value.trim() || r.value.trim())
341
+ ), W = X(
342
+ () => !!d && !u.modelValue.trim() && !u.isGenerating
343
343
  );
344
344
  function e() {
345
- r && (c = new Ke(r, {
346
- onStatusChange: (s) => {
347
- g.value = s;
345
+ d && (v = new St(d, {
346
+ onStatusChange: (a) => {
347
+ p.value = a;
348
348
  },
349
- onInterim: (s) => {
350
- u.value = s;
349
+ onInterim: (a) => {
350
+ r.value = a;
351
351
  },
352
- onFinal: (s) => {
353
- i.value += s, u.value = "";
352
+ onFinal: (a) => {
353
+ i.value += a, r.value = "";
354
354
  },
355
- onLevel: (s) => {
356
- D.value = s;
355
+ onLevel: (a) => {
356
+ H.value = a;
357
357
  },
358
358
  onError: () => {
359
- l.value = !1;
359
+ c.value = !1;
360
360
  }
361
361
  }));
362
362
  }
363
- ne(e), ze(() => {
364
- c == null || c.destroy(), c = null;
365
- }), se(
366
- () => [r == null ? void 0 : r.appId, r == null ? void 0 : r.appKey, r == null ? void 0 : r.devPid],
363
+ ue(e), bt(() => {
364
+ v == null || v.destroy(), v = null;
365
+ }), re(
366
+ () => [d == null ? void 0 : d.appId, d == null ? void 0 : d.appKey, d == null ? void 0 : d.devPid],
367
367
  () => {
368
- c == null || c.destroy(), e();
368
+ v == null || v.destroy(), e();
369
369
  }
370
- ), se([i, u], () => {
371
- te(() => {
372
- $.value && ($.value.scrollTop = $.value.scrollHeight);
370
+ ), re([i, r], () => {
371
+ ae(() => {
372
+ P.value && (P.value.scrollTop = P.value.scrollHeight);
373
373
  });
374
374
  });
375
- async function v() {
376
- if (c) {
377
- i.value = "", u.value = "", D.value = 0, l.value = !0;
375
+ async function h() {
376
+ if (v) {
377
+ i.value = "", r.value = "", H.value = 0, c.value = !0;
378
378
  try {
379
- await c.start();
379
+ await v.start();
380
380
  } catch {
381
- l.value = !1;
381
+ c.value = !1;
382
382
  }
383
383
  }
384
384
  }
385
- function E() {
386
- c == null || c.cancel(), l.value = !1, i.value = "", u.value = "", D.value = 0;
385
+ function R() {
386
+ v == null || v.cancel(), c.value = !1, i.value = "", r.value = "", H.value = 0;
387
387
  }
388
- function b() {
389
- const s = (i.value + u.value).trim();
390
- s && (c == null || c.stop(), l.value = !1, h("update:modelValue", s), setTimeout(() => h("send"), 0));
388
+ function x() {
389
+ const a = (i.value + r.value).trim();
390
+ a && (v == null || v.stop(), c.value = !1, m("update:modelValue", a), setTimeout(() => m("send"), 0));
391
391
  }
392
- return (s, p) => l.value ? (m(), A("div", cn, [
393
- n("div", {
392
+ return (a, w) => c.value ? (g(), A("div", Zn, [
393
+ s("div", {
394
394
  class: "voice-visual",
395
- style: xe({
396
- transform: `scale(${1 + D.value * 1.2})`,
397
- opacity: 0.35 + D.value * 0.65,
398
- background: P.value ? `rgb(${74 + D.value * 181}, ${172 - D.value * 128}, ${178 - D.value * 128})` : "var(--ai-accent)"
395
+ style: We({
396
+ transform: `scale(${1 + H.value * 1.2})`,
397
+ opacity: 0.35 + H.value * 0.65,
398
+ background: _.value ? `rgb(${74 + H.value * 181}, ${172 - H.value * 128}, ${178 - H.value * 128})` : "var(--ai-accent)"
399
399
  })
400
400
  }, null, 4),
401
- n("div", {
401
+ s("div", {
402
402
  class: "voice-text",
403
403
  ref_key: "voiceTextEl",
404
- ref: $
404
+ ref: P
405
405
  }, [
406
- i.value ? (m(), A("span", rn, V(i.value), 1)) : N("", !0),
407
- u.value ? (m(), A("span", un, V(u.value), 1)) : N("", !0),
408
- !i.value && !u.value ? (m(), A("span", vn, V(y.value ? "连接中…" : "正在聆听…"), 1)) : N("", !0)
406
+ i.value ? (g(), A("span", es, V(i.value), 1)) : B("", !0),
407
+ r.value ? (g(), A("span", ts, V(r.value), 1)) : B("", !0),
408
+ !i.value && !r.value ? (g(), A("span", ns, V(k.value ? "连接中…" : "正在聆听…"), 1)) : B("", !0)
409
409
  ], 512),
410
- n("div", {
410
+ s("div", {
411
411
  class: "tooltip-enhanced voice-close",
412
412
  "data-tooltip": "关闭",
413
- onClick: E
413
+ onClick: R
414
414
  }, [
415
- X(H(j), {
415
+ G(O(j), {
416
416
  class: "op-icon",
417
417
  icon: "heroicons-solid:x-mark"
418
418
  })
419
419
  ]),
420
- n("div", {
421
- class: J(["tooltip-enhanced voice-send", { disabled: !x.value }]),
422
- "data-tooltip": x.value ? "发送" : "未识别到文字",
423
- onClick: p[0] || (p[0] = (w) => x.value && b())
420
+ s("div", {
421
+ class: J(["tooltip-enhanced voice-send", { disabled: !D.value }]),
422
+ "data-tooltip": D.value ? "发送" : "未识别到文字",
423
+ onClick: w[0] || (w[0] = (C) => D.value && x())
424
424
  }, [
425
- X(H(j), {
425
+ G(O(j), {
426
426
  class: "op-icon",
427
427
  icon: "fluent-color:send-16"
428
428
  })
429
- ], 10, dn),
430
- t.hasScroll && !t.isAtBottom ? (m(), A("div", hn, [
431
- X(H(j), {
429
+ ], 10, ss),
430
+ t.hasScroll && !t.isAtBottom ? (g(), A("div", as, [
431
+ G(O(j), {
432
432
  class: "op-icon",
433
433
  icon: "ep:bottom",
434
- onClick: p[1] || (p[1] = (w) => s.$emit("scroll-to-bottom"))
434
+ onClick: w[1] || (w[1] = (C) => a.$emit("scroll-to-bottom"))
435
435
  })
436
- ])) : N("", !0)
437
- ])) : (m(), A("div", mn, [
438
- n("input", {
436
+ ])) : B("", !0)
437
+ ])) : (g(), A("div", os, [
438
+ s("input", {
439
439
  value: t.modelValue,
440
440
  type: "text",
441
441
  placeholder: "给AI助手发送消息...",
442
- onInput: p[2] || (p[2] = (w) => s.$emit("update:modelValue", w.target.value)),
443
- onKeyup: p[3] || (p[3] = mt((w) => t.modelValue.trim() && s.$emit("send"), ["enter"])),
442
+ onInput: w[2] || (w[2] = (C) => a.$emit("update:modelValue", C.target.value)),
443
+ onKeyup: w[3] || (w[3] = on((C) => t.modelValue.trim() && a.$emit("send"), ["enter"])),
444
444
  disabled: t.isGenerating
445
- }, null, 40, gn),
446
- t.isGenerating && t.lastUserMessage ? (m(), A("div", pn, [
447
- X(H(j), {
445
+ }, null, 40, is),
446
+ t.isGenerating && t.lastUserMessage ? (g(), A("div", ls, [
447
+ G(O(j), {
448
448
  class: "op-icon stop-icon",
449
449
  icon: "heroicons-solid:stop",
450
- onClick: p[4] || (p[4] = (w) => s.$emit("stop"))
450
+ onClick: w[4] || (w[4] = (C) => a.$emit("stop"))
451
451
  })
452
- ])) : _.value ? (m(), A("div", {
452
+ ])) : W.value ? (g(), A("div", {
453
453
  key: 1,
454
454
  class: "tooltip-enhanced send voice",
455
455
  "data-tooltip": "语音输入",
456
- onClick: v
456
+ onClick: h
457
457
  }, [
458
- X(H(j), {
458
+ G(O(j), {
459
459
  class: "op-icon",
460
460
  icon: "mingcute:voice-line"
461
461
  })
462
- ])) : (m(), A("div", {
462
+ ])) : (g(), A("div", {
463
463
  key: 2,
464
464
  class: J(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
465
465
  "data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
466
466
  }, [
467
- X(H(j), {
467
+ G(O(j), {
468
468
  class: "op-icon",
469
469
  icon: "fluent-color:send-16",
470
- onClick: p[5] || (p[5] = (w) => t.modelValue.trim() && s.$emit("send"))
470
+ onClick: w[5] || (w[5] = (C) => t.modelValue.trim() && a.$emit("send"))
471
471
  })
472
- ], 10, fn)),
473
- t.hasScroll && !t.isAtBottom ? (m(), A("div", yn, [
474
- X(H(j), {
472
+ ], 10, cs)),
473
+ t.hasScroll && !t.isAtBottom ? (g(), A("div", us, [
474
+ G(O(j), {
475
475
  class: "op-icon",
476
476
  icon: "ep:bottom",
477
- onClick: p[6] || (p[6] = (w) => s.$emit("scroll-to-bottom"))
477
+ onClick: w[6] || (w[6] = (C) => a.$emit("scroll-to-bottom"))
478
478
  })
479
- ])) : N("", !0)
479
+ ])) : B("", !0)
480
480
  ]));
481
481
  }
482
482
  });
483
- function kn(t) {
484
- const C = k(!0), f = k(!1);
485
- function h() {
486
- te(() => {
483
+ function vs(t) {
484
+ const b = y(!0), u = y(!1);
485
+ function m() {
486
+ ae(() => {
487
487
  t.value && (t.value.scrollTop = t.value.scrollHeight);
488
488
  });
489
489
  }
490
490
  function o() {
491
491
  if (!t.value) return;
492
- const r = t.value, l = r.scrollTop + r.clientHeight >= r.scrollHeight - 1, i = r.scrollHeight > r.clientHeight;
493
- C.value = l, f.value = i;
492
+ const d = t.value, c = d.scrollTop + d.clientHeight >= d.scrollHeight - 1, i = d.scrollHeight > d.clientHeight;
493
+ b.value = c, u.value = i;
494
494
  }
495
- return { isAtBottom: C, hasScroll: f, scrollToBottom: h, checkScrollStatus: o };
495
+ return { isAtBottom: b, hasScroll: u, scrollToBottom: m, checkScrollStatus: o };
496
496
  }
497
- function Cn() {
498
- function t(C) {
499
- C.querySelectorAll("pre").forEach((h) => {
500
- if (h.querySelector(".copy-button")) return;
501
- const o = h.querySelector("code");
497
+ function ds() {
498
+ function t(b) {
499
+ b.querySelectorAll("pre").forEach((m) => {
500
+ if (m.querySelector(".copy-button")) return;
501
+ const o = m.querySelector("code");
502
502
  if (!o) return;
503
- const l = (Array.from(o.classList).find((u) => u.startsWith("language-")) || "").replace("language-", "");
504
- if (l) {
505
- const u = document.createElement("span");
506
- u.className = "code-lang", u.textContent = l, h.appendChild(u);
503
+ const c = (Array.from(o.classList).find((r) => r.startsWith("language-")) || "").replace("language-", "");
504
+ if (c) {
505
+ const r = document.createElement("span");
506
+ r.className = "code-lang", r.textContent = c, m.appendChild(r);
507
507
  }
508
508
  const i = document.createElement("button");
509
509
  i.className = "copy-button", i.textContent = "复制", i.onclick = () => {
@@ -512,495 +512,495 @@ function Cn() {
512
512
  i.textContent = "复制";
513
513
  }, 2e3);
514
514
  });
515
- }, h.appendChild(i);
515
+ }, m.appendChild(i);
516
516
  });
517
517
  }
518
518
  return { enhanceCodeBlocks: t };
519
519
  }
520
- function An(t) {
521
- let C = null, f = 0;
522
- function h(r) {
523
- C = r(C || [...t.value]), f || (f = requestAnimationFrame(() => {
524
- f = 0, C && (t.value = C, C = null);
520
+ function hs(t) {
521
+ let b = null, u = 0;
522
+ function m(d) {
523
+ b = d(b || [...t.value]), u || (u = requestAnimationFrame(() => {
524
+ u = 0, b && (t.value = b, b = null);
525
525
  }));
526
526
  }
527
527
  function o() {
528
- f && (cancelAnimationFrame(f), f = 0), C && (t.value = C, C = null);
528
+ u && (cancelAnimationFrame(u), u = 0), b && (t.value = b, b = null);
529
529
  }
530
- return { batchMessagesUpdate: h, flushMessagesBatch: o };
530
+ return { batchMessagesUpdate: m, flushMessagesBatch: o };
531
531
  }
532
- function bn(t, C, f) {
533
- const h = K(/* @__PURE__ */ new Map()), o = k(/* @__PURE__ */ new Map()), r = k(/* @__PURE__ */ new Map());
534
- let l = 0, i = 0;
535
- function u() {
536
- if (l) return;
537
- const c = 50, y = 100, P = (x) => {
532
+ function ms(t, b, u) {
533
+ const m = Z(/* @__PURE__ */ new Map()), o = y(/* @__PURE__ */ new Map()), d = y(/* @__PURE__ */ new Map());
534
+ let c = 0, i = 0;
535
+ function r() {
536
+ if (c) return;
537
+ const v = 50, k = 100, _ = (D) => {
538
538
  if (i === 0) {
539
- i = x, l = requestAnimationFrame(P);
539
+ i = D, c = requestAnimationFrame(_);
540
540
  return;
541
541
  }
542
- const _ = Math.min(x - i, 100);
543
- i = x;
542
+ const W = Math.min(D - i, 100);
543
+ i = D;
544
544
  let e = !1;
545
- if (t.value.forEach((E, b) => {
546
- if (E.type !== "ai" || E.status !== f) return;
547
- const s = E.content, p = o.value.get(b) ?? 0, w = s.length - p;
548
- if (w > 0) {
545
+ if (t.value.forEach((R, x) => {
546
+ if (R.type !== "ai" || R.status !== u) return;
547
+ const a = R.content, w = o.value.get(x) ?? 0, C = a.length - w;
548
+ if (C > 0) {
549
549
  e = !0;
550
- const M = Math.min(c + w, y), d = (r.value.get(b) ?? 0) + M * _ / 1e3, S = Math.floor(d);
551
- if (S > 0) {
552
- r.value.set(b, d - S);
553
- const R = Math.min(p + S, s.length);
554
- o.value.set(b, R), h.set(b, s.slice(0, R));
550
+ const M = Math.min(v + C, k), f = (d.value.get(x) ?? 0) + M * W / 1e3, E = Math.floor(f);
551
+ if (E > 0) {
552
+ d.value.set(x, f - E);
553
+ const $ = Math.min(w + E, a.length);
554
+ o.value.set(x, $), m.set(x, a.slice(0, $));
555
555
  } else
556
- r.value.set(b, d);
556
+ d.value.set(x, f);
557
557
  } else
558
- r.value.set(b, 0);
559
- }), e && C(), !t.value.some((E) => E.type === "ai" && E.status === f)) {
560
- l = 0;
558
+ d.value.set(x, 0);
559
+ }), e && b(), !t.value.some((R) => R.type === "ai" && R.status === u)) {
560
+ c = 0;
561
561
  return;
562
562
  }
563
- l = requestAnimationFrame(P);
563
+ c = requestAnimationFrame(_);
564
564
  };
565
- i = 0, l = requestAnimationFrame(P);
565
+ i = 0, c = requestAnimationFrame(_);
566
566
  }
567
- function g() {
568
- l && (cancelAnimationFrame(l), l = 0), t.value.forEach((c, y) => {
569
- c.type === "ai" && (h.set(y, c.content), o.value.set(y, c.content.length), r.value.set(y, 0));
567
+ function p() {
568
+ c && (cancelAnimationFrame(c), c = 0), t.value.forEach((v, k) => {
569
+ v.type === "ai" && (m.set(k, v.content), o.value.set(k, v.content.length), d.value.set(k, 0));
570
570
  });
571
571
  }
572
- function D() {
573
- l && (cancelAnimationFrame(l), l = 0);
572
+ function H() {
573
+ c && (cancelAnimationFrame(c), c = 0);
574
574
  }
575
- function $(c, y, P, x) {
576
- if (P.type !== "answer" || x.status !== f) return P.content;
577
- const _ = x.segments || [];
578
- if (_.slice(y + 1).some((s) => s.type === "answer")) return P.content;
579
- const v = o.value.get(c);
580
- if (v == null) return P.content;
581
- let E = 0;
582
- for (let s = 0; s < y; s++)
583
- _[s].type === "answer" && (E += _[s].content.length);
584
- const b = E + P.content.length;
585
- return v >= b ? P.content : v <= E ? "" : P.content.slice(0, v - E);
575
+ function P(v, k, _, D) {
576
+ if (_.type !== "answer" || D.status !== u) return _.content;
577
+ const W = D.segments || [];
578
+ if (W.slice(k + 1).some((a) => a.type === "answer")) return _.content;
579
+ const h = o.value.get(v);
580
+ if (h == null) return _.content;
581
+ let R = 0;
582
+ for (let a = 0; a < k; a++)
583
+ W[a].type === "answer" && (R += W[a].content.length);
584
+ const x = R + _.content.length;
585
+ return h >= x ? _.content : h <= R ? "" : _.content.slice(0, h - R);
586
586
  }
587
- return { displayedContent: h, streamingIndexRef: o, startTypewriter: u, flushTypewriter: g, getSegmentDisplayContent: $, stopTypewriter: D };
587
+ return { displayedContent: m, streamingIndexRef: o, startTypewriter: r, flushTypewriter: p, getSegmentDisplayContent: P, stopTypewriter: H };
588
588
  }
589
- function Sn({
589
+ function gs({
590
590
  messages: t,
591
- isGenerating: C,
592
- lastUserMessage: f,
593
- batchMessagesUpdate: h,
591
+ isGenerating: b,
592
+ lastUserMessage: u,
593
+ batchMessagesUpdate: m,
594
594
  flushMessagesBatch: o,
595
- STATUS: r,
596
- cfg: l
595
+ STATUS: d,
596
+ cfg: c
597
597
  }) {
598
- const i = k(/* @__PURE__ */ new Map()), u = k(/* @__PURE__ */ new Map()), g = k(/* @__PURE__ */ new Map()), D = k(/* @__PURE__ */ new Map()), $ = k(!1);
599
- function c(x) {
600
- const _ = i.value.get(x) || [];
601
- h((e) => {
602
- if (e[x]) {
603
- const v = [...e];
604
- return v[x] = { ...v[x], segments: _.map((E) => ({ ...E })) }, v;
598
+ const i = y(/* @__PURE__ */ new Map()), r = y(/* @__PURE__ */ new Map()), p = y(/* @__PURE__ */ new Map()), H = y(/* @__PURE__ */ new Map()), P = y(!1);
599
+ function v(D) {
600
+ const W = i.value.get(D) || [];
601
+ m((e) => {
602
+ if (e[D]) {
603
+ const h = [...e];
604
+ return h[D] = { ...h[D], segments: W.map((R) => ({ ...R })) }, h;
605
605
  }
606
606
  return e;
607
607
  });
608
608
  }
609
- function y(x) {
610
- const _ = i.value.get(x) || [], e = g.value.get(x);
611
- let v = 0, E = !1;
612
- _.forEach((b) => {
613
- if (b.type === "thinking" && b.duration == null) {
614
- const s = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
615
- b.duration = s, v += s, E = !0;
609
+ function k(D) {
610
+ const W = i.value.get(D) || [], e = p.value.get(D);
611
+ let h = 0, R = !1;
612
+ W.forEach((x) => {
613
+ if (x.type === "thinking" && x.duration == null) {
614
+ const a = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
615
+ x.duration = a, h += a, R = !0;
616
616
  }
617
- }), E && (i.value.set(x, _), h((b) => {
618
- if (b[x]) {
619
- const s = [...b];
620
- return s[x] = {
621
- ...s[x],
622
- segments: _.map((p) => ({ ...p })),
623
- thinkingDuration: (s[x].thinkingDuration || 0) + v
624
- }, s;
617
+ }), R && (i.value.set(D, W), m((x) => {
618
+ if (x[D]) {
619
+ const a = [...x];
620
+ return a[D] = {
621
+ ...a[D],
622
+ segments: W.map((w) => ({ ...w })),
623
+ thinkingDuration: (a[D].thinkingDuration || 0) + h
624
+ }, a;
625
625
  }
626
- return b;
626
+ return x;
627
627
  }));
628
628
  }
629
- async function P(x, _, e, v, E = !1) {
630
- $.value = !1, i.value.set(e, []), C.value = !0;
629
+ async function _(D, W, e, h, R = !1) {
630
+ P.value = !1, i.value.set(e, []), b.value = !0;
631
631
  try {
632
- const b = l.baseUrl.replace(/\/+$/, "") + "/" + x.replace(/^\/+/, "");
633
- await $t(b, {
632
+ const x = c.baseUrl.replace(/\/+$/, "") + "/" + D.replace(/^\/+/, "");
633
+ await An(x, {
634
634
  method: "POST",
635
635
  headers: {
636
636
  "Content-Type": "application/json",
637
- Authorization: `Bearer ${l.token}`
637
+ Authorization: `Bearer ${c.token}`
638
638
  },
639
- body: JSON.stringify({ app: l.app ?? 1, data: _ }),
640
- signal: v,
639
+ body: JSON.stringify({ app: c.app ?? 1, data: W }),
640
+ signal: h,
641
641
  openWhenHidden: !0,
642
- async onopen(s) {
643
- s.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", s.status, s.statusText);
642
+ async onopen(a) {
643
+ a.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", a.status, a.statusText);
644
644
  },
645
- onmessage(s) {
646
- var p;
645
+ onmessage(a) {
646
+ var w;
647
647
  try {
648
- let w = s.data || "";
649
- for (; w.startsWith("data:"); )
650
- w = w.replace(/^data:\s*/, "");
651
- if (!w) return;
648
+ let C = a.data || "";
649
+ for (; C.startsWith("data:"); )
650
+ C = C.replace(/^data:\s*/, "");
651
+ if (!C) return;
652
652
  let M;
653
653
  try {
654
- M = JSON.parse(w);
654
+ M = JSON.parse(C);
655
655
  } catch {
656
656
  return;
657
657
  }
658
658
  switch (M.event) {
659
659
  case "message_start":
660
- E || (f.value = M.id), u.value.set(e, "answer");
660
+ R || (u.value = M.id), r.value.set(e, "answer");
661
661
  break;
662
662
  case "think_message_output_start": {
663
- g.value.set(e, Date.now()), u.value.set(e, "thinking");
664
- const d = i.value.get(e) || [];
665
- i.value.set(e, [...d, { type: "thinking", content: "" }]), c(e);
663
+ p.value.set(e, Date.now()), r.value.set(e, "thinking");
664
+ const f = i.value.get(e) || [];
665
+ i.value.set(e, [...f, { type: "thinking", content: "" }]), v(e);
666
666
  break;
667
667
  }
668
668
  case "agent_thought": {
669
- const d = M.thought || M.thinking || "", S = i.value.get(e) || [], R = S[S.length - 1];
670
- R && R.type === "agent_thought" ? R.content += d : (u.value.set(e, "agent_thought"), S.push({ type: "agent_thought", content: d }), D.value.set(e, Date.now())), i.value.set(e, S), h((O) => {
671
- if (O[e]) {
672
- const L = [...O];
673
- return L[e] = {
674
- ...L[e],
675
- segments: S.map((B) => ({ ...B })),
676
- thinkingContent: (L[e].thinkingContent || "") + d,
677
- status: r.THINKING
678
- }, L;
669
+ const f = M.thought || M.thinking || "", E = i.value.get(e) || [], $ = E[E.length - 1];
670
+ $ && $.type === "agent_thought" ? $.content += f : (r.value.set(e, "agent_thought"), E.push({ type: "agent_thought", content: f }), H.value.set(e, Date.now())), i.value.set(e, E), m((N) => {
671
+ if (N[e]) {
672
+ const T = [...N];
673
+ return T[e] = {
674
+ ...T[e],
675
+ segments: E.map((L) => ({ ...L })),
676
+ thinkingContent: (T[e].thinkingContent || "") + f,
677
+ status: d.THINKING
678
+ }, T;
679
679
  }
680
- return O;
680
+ return N;
681
681
  });
682
682
  break;
683
683
  }
684
684
  case "think_message": {
685
- const d = M.thinking || M.answer || M.text || "", S = i.value.get(e) || [], R = S[S.length - 1];
686
- R && R.type === "thinking" ? R.content += d : (S.push({ type: "thinking", content: d }), g.value.set(e, Date.now())), i.value.set(e, S), h((O) => {
687
- if (O[e]) {
688
- const L = [...O];
689
- return L[e] = {
690
- ...L[e],
691
- segments: S.map((B) => ({ ...B })),
692
- thinkingContent: (L[e].thinkingContent || "") + d,
693
- status: r.THINKING
694
- }, L;
685
+ const f = M.thinking || M.answer || M.text || "", E = i.value.get(e) || [], $ = E[E.length - 1];
686
+ $ && $.type === "thinking" ? $.content += f : (E.push({ type: "thinking", content: f }), p.value.set(e, Date.now())), i.value.set(e, E), m((N) => {
687
+ if (N[e]) {
688
+ const T = [...N];
689
+ return T[e] = {
690
+ ...T[e],
691
+ segments: E.map((L) => ({ ...L })),
692
+ thinkingContent: (T[e].thinkingContent || "") + f,
693
+ status: d.THINKING
694
+ }, T;
695
695
  }
696
- return O;
696
+ return N;
697
697
  });
698
698
  break;
699
699
  }
700
700
  case "agent_thought_end": {
701
- const d = D.value.get(e), S = d ? Math.round((Date.now() - d) / 1e3 * 10) / 10 : 0, R = i.value.get(e) || [], O = R[R.length - 1];
702
- O && O.type === "agent_thought" && (O.duration = S), i.value.set(e, R), h((L) => {
703
- if (L[e]) {
704
- const B = [...L];
705
- return B[e] = {
706
- ...B[e],
707
- segments: R.map((Q) => ({ ...Q })),
708
- thinkingDuration: (B[e].thinkingDuration || 0) + S
709
- }, B;
701
+ const f = H.value.get(e), E = f ? Math.round((Date.now() - f) / 1e3 * 10) / 10 : 0, $ = i.value.get(e) || [], N = $[$.length - 1];
702
+ N && N.type === "agent_thought" && (N.duration = E), i.value.set(e, $), m((T) => {
703
+ if (T[e]) {
704
+ const L = [...T];
705
+ return L[e] = {
706
+ ...L[e],
707
+ segments: $.map((q) => ({ ...q })),
708
+ thinkingDuration: (L[e].thinkingDuration || 0) + E
709
+ }, L;
710
710
  }
711
- return L;
711
+ return T;
712
712
  });
713
713
  break;
714
714
  }
715
715
  case "think_message_output_end": {
716
- const d = g.value.get(e), S = d ? Math.round((Date.now() - d) / 1e3 * 10) / 10 : 0, R = i.value.get(e) || [], O = R[R.length - 1];
717
- O && O.type === "thinking" && (O.duration = S), i.value.set(e, R), h((L) => {
718
- if (L[e]) {
719
- const B = [...L];
720
- return B[e] = {
721
- ...B[e],
722
- segments: R.map((Q) => ({ ...Q })),
723
- thinkingDuration: (B[e].thinkingDuration || 0) + S
724
- }, B;
716
+ const f = p.value.get(e), E = f ? Math.round((Date.now() - f) / 1e3 * 10) / 10 : 0, $ = i.value.get(e) || [], N = $[$.length - 1];
717
+ N && N.type === "thinking" && (N.duration = E), i.value.set(e, $), m((T) => {
718
+ if (T[e]) {
719
+ const L = [...T];
720
+ return L[e] = {
721
+ ...L[e],
722
+ segments: $.map((q) => ({ ...q })),
723
+ thinkingDuration: (L[e].thinkingDuration || 0) + E
724
+ }, L;
725
725
  }
726
- return L;
726
+ return T;
727
727
  });
728
728
  break;
729
729
  }
730
730
  case "tool_message": {
731
- const d = M.answer || M.text || M.content || "";
732
- if (!d) break;
733
- const S = i.value.get(e) || [];
734
- S.push({ type: "answer", content: d }), i.value.set(e, S), c(e);
731
+ const f = M.answer || M.text || M.content || "";
732
+ if (!f) break;
733
+ const E = i.value.get(e) || [];
734
+ E.push({ type: "answer", content: f }), i.value.set(e, E), v(e);
735
735
  break;
736
736
  }
737
737
  case "message_output_start":
738
- u.value.set(e, "answer"), y(e);
738
+ r.value.set(e, "answer"), k(e);
739
739
  break;
740
740
  case "message": {
741
- const d = M.answer || "", S = u.value.get(e), R = i.value.get(e) || [], O = R[R.length - 1];
742
- S === "answer" && O && O.type === "answer" ? O.content += d : (y(e), u.value.set(e, "answer"), R.push({ type: "answer", content: d })), i.value.set(e, R);
743
- const L = R.filter((B) => B.type === "answer").map((B) => B.content).join("");
744
- h((B) => {
745
- if (B[e]) {
746
- const Q = [...B];
747
- return Q[e] = {
748
- ...Q[e],
749
- segments: R.map((I) => ({ ...I })),
750
- content: L,
751
- status: $.value ? r.STOP : r.ANSWERING
752
- }, Q;
741
+ const f = M.answer || "", E = r.value.get(e), $ = i.value.get(e) || [], N = $[$.length - 1];
742
+ E === "answer" && N && N.type === "answer" ? N.content += f : (k(e), r.value.set(e, "answer"), $.push({ type: "answer", content: f })), i.value.set(e, $);
743
+ const T = $.filter((L) => L.type === "answer").map((L) => L.content).join("");
744
+ m((L) => {
745
+ if (L[e]) {
746
+ const q = [...L];
747
+ return q[e] = {
748
+ ...q[e],
749
+ segments: $.map((oe) => ({ ...oe })),
750
+ content: T,
751
+ status: P.value ? d.STOP : d.ANSWERING
752
+ }, q;
753
753
  }
754
- return B;
754
+ return L;
755
755
  });
756
756
  break;
757
757
  }
758
758
  case "message_end": {
759
759
  o();
760
- const d = [...t.value];
761
- d[e] && (d[e] = { ...d[e], status: $.value ? r.STOP : r.COMPLETED }), t.value = d, C.value = !1;
760
+ const f = [...t.value];
761
+ f[e] && (f[e] = { ...f[e], status: P.value ? d.STOP : d.COMPLETED }), t.value = f, b.value = !1;
762
762
  break;
763
763
  }
764
764
  case "agent_error":
765
765
  case "message_failed": {
766
766
  o();
767
- const d = [...t.value];
768
- d[e] && (d[e] = {
769
- ...d[e],
770
- status: r.ERROR,
767
+ const f = [...t.value];
768
+ f[e] && (f[e] = {
769
+ ...f[e],
770
+ status: d.ERROR,
771
771
  content: M.error_msg || M.message || "请求失败",
772
772
  errorMessage: M.error_msg || M.message || "请求失败"
773
- }, t.value = d), C.value = !1;
773
+ }, t.value = f), b.value = !1;
774
774
  break;
775
775
  }
776
776
  case "message_replace": {
777
- const d = M.answer || "", S = i.value.get(e) || [], R = (p = S.map((O, L) => ({ s: O, i: L })).reverse().find((O) => O.s.type === "answer")) == null ? void 0 : p.i;
778
- R != null ? S[R] = { ...S[R], content: d } : S.push({ type: "answer", content: d }), i.value.set(e, S), h((O) => {
779
- if (O[e]) {
780
- const L = [...O];
781
- return L[e] = {
782
- ...L[e],
783
- segments: S.map((B) => ({ ...B })),
784
- content: d
785
- }, L;
777
+ const f = M.answer || "", E = i.value.get(e) || [], $ = (w = E.map((N, T) => ({ s: N, i: T })).reverse().find((N) => N.s.type === "answer")) == null ? void 0 : w.i;
778
+ $ != null ? E[$] = { ...E[$], content: f } : E.push({ type: "answer", content: f }), i.value.set(e, E), m((N) => {
779
+ if (N[e]) {
780
+ const T = [...N];
781
+ return T[e] = {
782
+ ...T[e],
783
+ segments: E.map((L) => ({ ...L })),
784
+ content: f
785
+ }, T;
786
786
  }
787
- return O;
787
+ return N;
788
788
  });
789
789
  break;
790
790
  }
791
791
  case "message_cost": {
792
- const d = {
792
+ const f = {
793
793
  inputTokens: M.input_tokens || 0,
794
794
  outputTokens: M.output_tokens || 0,
795
795
  latency: M.latency || 0,
796
796
  latencyFirstResp: M.latency_first_resp
797
797
  };
798
- h((S) => {
799
- if (S[e]) {
800
- const R = [...S];
801
- return R[e] = { ...R[e], cost: d }, R;
798
+ m((E) => {
799
+ if (E[e]) {
800
+ const $ = [...E];
801
+ return $[e] = { ...$[e], cost: f }, $;
802
802
  }
803
- return S;
803
+ return E;
804
804
  });
805
805
  break;
806
806
  }
807
807
  default:
808
808
  }
809
- } catch (w) {
810
- console.error("[ai-assist-sdk] onmessage 解析失败:", w);
809
+ } catch (C) {
810
+ console.error("[ai-assist-sdk] onmessage 解析失败:", C);
811
811
  }
812
812
  },
813
813
  onclose() {
814
- o(), y(e), o();
815
- const p = (i.value.get(e) || []).filter((M) => M.type === "answer").map((M) => M.content).join(""), w = [...t.value];
816
- w[e] && w[e].status !== r.ERROR && (w[e] = {
817
- ...w[e],
818
- content: $.value && !p ? "已停止回答" : p,
819
- status: $.value ? r.STOP : r.COMPLETED
820
- }), t.value = w, C.value = !1;
814
+ o(), k(e), o();
815
+ const w = (i.value.get(e) || []).filter((M) => M.type === "answer").map((M) => M.content).join(""), C = [...t.value];
816
+ C[e] && C[e].status !== d.ERROR && (C[e] = {
817
+ ...C[e],
818
+ content: P.value && !w ? "已停止回答" : w,
819
+ status: P.value ? d.STOP : d.COMPLETED
820
+ }), t.value = C, b.value = !1;
821
821
  },
822
- onerror(s) {
823
- console.error("[ai-assist-sdk] ❌ 连接错误:", s), o();
824
- const p = [...t.value];
825
- p[e] && (p[e] = { ...p[e], content: `
826
- ⚠️ 请求异常,已终止`, status: r.ERROR }), t.value = p, C.value = !1;
822
+ onerror(a) {
823
+ console.error("[ai-assist-sdk] ❌ 连接错误:", a), o();
824
+ const w = [...t.value];
825
+ w[e] && (w[e] = { ...w[e], content: `
826
+ ⚠️ 请求异常,已终止`, status: d.ERROR }), t.value = w, b.value = !1;
827
827
  }
828
828
  });
829
- } catch (b) {
830
- if (console.error("[ai-assist-sdk] doStreamRequest error:", b), !$.value) {
829
+ } catch (x) {
830
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", x), !P.value) {
831
831
  o();
832
- const s = [...t.value];
833
- s[e] && (s[e] = { ...s[e], content: "服务连接失败,请稍后重试", status: r.ERROR }), t.value = s, C.value = !1;
832
+ const a = [...t.value];
833
+ a[e] && (a[e] = { ...a[e], content: "服务连接失败,请稍后重试", status: d.ERROR }), t.value = a, b.value = !1;
834
834
  }
835
835
  }
836
836
  }
837
- return { doStreamRequest: P, issTop: $ };
837
+ return { doStreamRequest: _, issTop: P };
838
838
  }
839
- function Ue(t) {
840
- var C;
839
+ function pt(t) {
840
+ var b;
841
841
  if (t && typeof t == "object" && typeof t.data == "string" && (t = t.data), typeof t == "string") {
842
- const f = t.split(`
842
+ const u = t.split(`
843
843
  `);
844
- let h = "";
845
- for (const o of f) {
846
- const r = o.startsWith("data:") ? o.slice(5).trim() : "";
847
- if (r)
844
+ let m = "";
845
+ for (const o of u) {
846
+ const d = o.startsWith("data:") ? o.slice(5).trim() : "";
847
+ if (d)
848
848
  try {
849
- const l = JSON.parse(r);
850
- l.event === "message" && l.answer !== void 0 && (h += l.answer);
849
+ const c = JSON.parse(d);
850
+ c.event === "message" && c.answer !== void 0 && (m += c.answer);
851
851
  } catch {
852
852
  }
853
853
  }
854
- return h || t;
854
+ return m || t;
855
855
  }
856
- return (t == null ? void 0 : t.answer) || ((C = t == null ? void 0 : t.data) == null ? void 0 : C.answer) || String(t || "");
856
+ return (t == null ? void 0 : t.answer) || ((b = t == null ? void 0 : t.data) == null ? void 0 : b.answer) || String(t || "");
857
857
  }
858
- function Mn(t) {
858
+ function fs(t) {
859
859
  return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
860
860
  }
861
- function Tn({
861
+ function ps({
862
862
  messages: t,
863
- userInput: C,
864
- isGenerating: f,
865
- lastUserMessage: h,
863
+ userInput: b,
864
+ isGenerating: u,
865
+ lastUserMessage: m,
866
866
  conversationId: o,
867
- doStreamRequest: r,
868
- issTop: l,
867
+ doStreamRequest: d,
868
+ issTop: c,
869
869
  scrollToBottom: i,
870
- STATUS: u,
871
- cfg: g,
872
- onTitleGenerated: D
870
+ STATUS: r,
871
+ cfg: p,
872
+ onTitleGenerated: H
873
873
  }) {
874
- const $ = g.apis, c = K({
874
+ const P = p.apis, v = Z({
875
875
  first: new AbortController(),
876
876
  again: new AbortController()
877
- }), y = k(!1);
878
- async function P(s, p) {
877
+ }), k = y(!1);
878
+ async function _(a, w) {
879
879
  var M;
880
- if (!g.titleGenerateApp || !$.updateConversationApi || y.value) return;
881
- let w = o.value;
882
- if (!w)
880
+ if (!p.titleGenerateApp || !P.updateConversationApi || k.value) return;
881
+ let C = o.value;
882
+ if (!C)
883
883
  try {
884
- const d = await Qe($);
885
- (M = d == null ? void 0 : d.conversation) != null && M.appConversationID && (w = d.conversation.appConversationID, o.value = w);
886
- } catch (d) {
887
- console.error("[ai-assist-sdk] 创建会话失败:", d);
884
+ const f = await mt(P);
885
+ (M = f == null ? void 0 : f.conversation) != null && M.appConversationID && (C = f.conversation.appConversationID, o.value = C);
886
+ } catch (f) {
887
+ console.error("[ai-assist-sdk] 创建会话失败:", f);
888
888
  return;
889
889
  }
890
- if (w)
890
+ if (C)
891
891
  try {
892
- const d = await kt($, g.titleGenerateApp);
893
- if (!d) return;
894
- const S = p.length > 500 ? p.slice(0, 500) : p, R = `用户提问:${s}
895
- AI回答:${S}`, L = await Ge().post($.chatQueryApi, {
896
- app: g.titleGenerateApp,
897
- data: { Query: R, AppConversationID: d }
898
- }), B = Ue(L.data.data);
899
- B && (await Ct($, w, B), y.value = !0, D == null || D(B));
900
- } catch (d) {
901
- console.error("[ai-assist-sdk] 生成对话标题失败:", d);
892
+ const f = await dn(P, p.titleGenerateApp);
893
+ if (!f) return;
894
+ const E = w.length > 500 ? w.slice(0, 500) : w, $ = `用户提问:${a}
895
+ AI回答:${E}`, T = await gt().post(P.chatQueryApi, {
896
+ app: p.titleGenerateApp,
897
+ data: { Query: $, AppConversationID: f }
898
+ }), L = pt(T.data.data);
899
+ L && (await hn(P, C, L), k.value = !0, H == null || H(L));
900
+ } catch (f) {
901
+ console.error("[ai-assist-sdk] 生成对话标题失败:", f);
902
902
  }
903
903
  }
904
- async function x() {
905
- const s = C.value.trim();
906
- if (!s || f.value) return;
907
- if (!o.value && (await E(), !o.value)) {
908
- he("创建会话失败,请重试");
904
+ async function D() {
905
+ const a = b.value.trim();
906
+ if (!a || u.value) return;
907
+ if (!o.value && (await R(), !o.value)) {
908
+ Te("创建会话失败,请重试");
909
909
  return;
910
910
  }
911
- const p = t.value.length === 0, w = [
911
+ const w = t.value.length === 0, C = [
912
912
  ...t.value,
913
- { type: "user", content: s },
914
- { type: "ai", content: "", status: u.THINKING }
913
+ { type: "user", content: a },
914
+ { type: "ai", content: "", status: r.THINKING }
915
915
  ];
916
- t.value = w, C.value = "", i();
917
- const M = w.length - 1;
918
- if ($.chatQueryStreamApi) {
919
- if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", $.chatQueryStreamApi), await r($.chatQueryStreamApi, {
920
- Query: s,
916
+ t.value = C, b.value = "", i();
917
+ const M = C.length - 1;
918
+ if (P.chatQueryStreamApi) {
919
+ if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", P.chatQueryStreamApi), await d(P.chatQueryStreamApi, {
920
+ Query: a,
921
921
  AppConversationID: o.value,
922
922
  ResponseMode: "streaming"
923
- }, M, c.first.signal), p && !y.value) {
924
- const d = t.value[M];
925
- d && d.status !== u.ERROR && P(s, d.content);
923
+ }, M, v.first.signal), w && !k.value) {
924
+ const f = t.value[M];
925
+ f && f.status !== r.ERROR && _(a, f.content);
926
926
  }
927
927
  return;
928
928
  }
929
929
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
930
930
  try {
931
- const S = await Ge().post($.chatQueryApi, {
932
- app: g.app ?? 1,
933
- data: { Query: s, AppConversationID: o.value }
934
- }), R = Ue(S.data);
935
- t.value = [...t.value.slice(0, -1), { type: "ai", content: R, status: u.COMPLETED }], p && !y.value && P(s, R);
936
- } catch (d) {
937
- t.value = [...t.value.slice(0, -1), { type: "ai", content: (d == null ? void 0 : d.message) || "服务连接失败,请稍后重试", status: u.ERROR }];
931
+ const E = await gt().post(P.chatQueryApi, {
932
+ app: p.app ?? 1,
933
+ data: { Query: a, AppConversationID: o.value }
934
+ }), $ = pt(E.data);
935
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: $, status: r.COMPLETED }], w && !k.value && _(a, $);
936
+ } catch (f) {
937
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: (f == null ? void 0 : f.message) || "服务连接失败,请稍后重试", status: r.ERROR }];
938
938
  }
939
939
  }
940
- async function _() {
941
- if (!h.value || f.value) return;
942
- c.again.abort(), c.again = new AbortController();
943
- const s = [...t.value];
944
- s.length > 0 && s[s.length - 1].type === "ai" && s.pop(), s.push({ type: "ai", content: "", status: u.RETHINKING }), t.value = s, i();
945
- const p = t.value.length - 1, w = Mn($);
946
- await r(w, {
947
- MessageID: h.value,
940
+ async function W() {
941
+ if (!m.value || u.value) return;
942
+ v.again.abort(), v.again = new AbortController();
943
+ const a = [...t.value];
944
+ a.length > 0 && a[a.length - 1].type === "ai" && a.pop(), a.push({ type: "ai", content: "", status: r.RETHINKING }), t.value = a, i();
945
+ const w = t.value.length - 1, C = fs(P);
946
+ await d(C, {
947
+ MessageID: m.value,
948
948
  AppConversationID: o.value,
949
949
  ResponseMode: "streaming"
950
- }, p, c.again.signal, !0);
950
+ }, w, v.again.signal, !0);
951
951
  }
952
952
  async function e() {
953
- if (!$.stopMessageApi || !f.value) return;
954
- const s = t.value.length - 1 - 1;
953
+ if (!P.stopMessageApi || !u.value) return;
954
+ const a = t.value.length - 1 - 1;
955
955
  try {
956
- await wt($, h.value);
957
- const p = [...t.value];
958
- p[s] && (p[s] = { ...p[s], content: p[s].content || "已停止回答", status: u.STOP }), t.value = p, f.value = !1, c.first.abort(), c.first = new AbortController(), c.again.abort(), c.again = new AbortController(), l.value = !0;
959
- } catch (p) {
956
+ await vn(P, m.value);
960
957
  const w = [...t.value];
961
- w[s] && (w[s] = { ...w[s], content: (p == null ? void 0 : p.message) || "系统繁忙,请稍后再试", status: u.ERROR }), t.value = w;
958
+ w[a] && (w[a] = { ...w[a], content: w[a].content || "已停止回答", status: r.STOP }), t.value = w, u.value = !1, v.first.abort(), v.first = new AbortController(), v.again.abort(), v.again = new AbortController(), c.value = !0;
959
+ } catch (w) {
960
+ const C = [...t.value];
961
+ C[a] && (C[a] = { ...C[a], content: (w == null ? void 0 : w.message) || "系统繁忙,请稍后再试", status: r.ERROR }), t.value = C;
962
962
  }
963
963
  }
964
- async function v(s) {
965
- var p, w;
966
- o.value = s, y.value = !0;
964
+ async function h(a) {
965
+ var w, C;
966
+ o.value = a, k.value = !0;
967
967
  try {
968
- const M = await yt($, s), d = [];
969
- if ((p = M == null ? void 0 : M.messages) != null && p.length)
970
- for (const S of M.messages)
971
- S.query && d.push({ type: "user", content: S.query }), (w = S.answerInfo) != null && w.answer && d.push({ type: "ai", content: S.answerInfo.answer, status: u.COMPLETED });
972
- t.value = d, i();
968
+ const M = await rn(P, a), f = [];
969
+ if ((w = M == null ? void 0 : M.messages) != null && w.length)
970
+ for (const E of M.messages)
971
+ E.query && f.push({ type: "user", content: E.query }), (C = E.answerInfo) != null && C.answer && f.push({ type: "ai", content: E.answerInfo.answer, status: r.COMPLETED });
972
+ t.value = f, i();
973
973
  } catch (M) {
974
- he((M == null ? void 0 : M.message) || "加载历史会话失败");
974
+ Te((M == null ? void 0 : M.message) || "加载历史会话失败");
975
975
  }
976
976
  }
977
- async function E() {
978
- var s;
979
- y.value = !1;
977
+ async function R() {
978
+ var a;
979
+ k.value = !1;
980
980
  try {
981
- const p = await Qe($);
982
- (s = p == null ? void 0 : p.conversation) != null && s.appConversationID && (o.value = p.conversation.appConversationID);
983
- } catch (p) {
984
- he((p == null ? void 0 : p.message) || "创建会话失败");
981
+ const w = await mt(P);
982
+ (a = w == null ? void 0 : w.conversation) != null && a.appConversationID && (o.value = w.conversation.appConversationID);
983
+ } catch (w) {
984
+ Te((w == null ? void 0 : w.message) || "创建会话失败");
985
985
  }
986
986
  }
987
- function b() {
988
- o.value = "", y.value = !1;
987
+ function x() {
988
+ o.value = "", k.value = !1;
989
989
  }
990
- return { sendMessage: x, regenerateResponse: _, toggleStop: e, goHistoryMessage: v, initConversation: E, resetConversation: b, controllers: c };
990
+ return { sendMessage: D, regenerateResponse: W, toggleStop: e, goHistoryMessage: h, initConversation: R, resetConversation: x, controllers: v };
991
991
  }
992
- const xn = { class: "container" }, En = { class: "message ai-message greet-message" }, Rn = { class: "ai-greet" }, $n = ["src"], Pn = {
992
+ const ys = { class: "container" }, ws = { class: "message ai-message greet-message" }, ks = { class: "ai-greet" }, Cs = ["src"], As = {
993
993
  key: 0,
994
994
  class: "message ai-message recommend-message"
995
- }, Dn = { class: "ai-recommend" }, Hn = { class: "recommend-header" }, _n = ["src"], On = ["onClick"], Ln = /* @__PURE__ */ le({
995
+ }, bs = { class: "ai-recommend" }, Ss = { class: "recommend-header" }, xs = ["src"], Ms = ["onClick"], Es = /* @__PURE__ */ pe({
996
996
  __name: "Answer",
997
997
  props: {
998
998
  defaultSayhello: {},
999
999
  defaultRecommend: {}
1000
1000
  },
1001
1001
  emits: ["title-generated"],
1002
- setup(t, { expose: C, emit: f }) {
1003
- const h = {
1002
+ setup(t, { expose: b, emit: u }) {
1003
+ const m = {
1004
1004
  THINKING: "thinking",
1005
1005
  RETHINKING: "rethinking",
1006
1006
  ANSWERING: "answering",
@@ -1008,421 +1008,566 @@ const xn = { class: "container" }, En = { class: "message ai-message greet-messa
1008
1008
  COMPLETED: "completed",
1009
1009
  STOP: "stop",
1010
1010
  ERROR: "error"
1011
- }, o = t, r = f, l = ge(), i = k([]), u = k(""), g = k(!1), D = k(""), $ = k(""), c = k(null), y = K({ text1: "", text2: "" }), P = k([]), x = k(0), _ = Y(
1012
- () => P.value[x.value % (P.value.length || 1)]
1011
+ }, o = t, d = u, c = Re(), i = y([]), r = y(""), p = y(!1), H = y(""), P = y(""), v = y(null), k = Z({ text1: "", text2: "" }), _ = y([]), D = y(0), W = X(
1012
+ () => _.value[D.value % (_.value.length || 1)]
1013
1013
  );
1014
1014
  function e() {
1015
- x.value++;
1015
+ D.value++;
1016
1016
  }
1017
- function v(G) {
1018
- u.value = G;
1017
+ function h(F) {
1018
+ r.value = F;
1019
1019
  }
1020
- const { isAtBottom: E, hasScroll: b, scrollToBottom: s, checkScrollStatus: p } = kn(c), { enhanceCodeBlocks: w } = Cn(), { batchMessagesUpdate: M, flushMessagesBatch: d } = An(i), { displayedContent: S, streamingIndexRef: R, startTypewriter: O, stopTypewriter: L, getSegmentDisplayContent: B } = bn(
1020
+ const { isAtBottom: R, hasScroll: x, scrollToBottom: a, checkScrollStatus: w } = vs(v), { enhanceCodeBlocks: C } = ds(), { batchMessagesUpdate: M, flushMessagesBatch: f } = hs(i), { displayedContent: E, streamingIndexRef: $, startTypewriter: N, stopTypewriter: T, getSegmentDisplayContent: L } = ms(
1021
1021
  i,
1022
- s,
1023
- h.ANSWERING
1024
- ), { doStreamRequest: Q, issTop: I } = Sn({
1022
+ a,
1023
+ m.ANSWERING
1024
+ ), { doStreamRequest: q, issTop: oe } = gs({
1025
1025
  messages: i,
1026
- isGenerating: g,
1027
- lastUserMessage: D,
1026
+ isGenerating: p,
1027
+ lastUserMessage: H,
1028
1028
  batchMessagesUpdate: M,
1029
- flushMessagesBatch: d,
1030
- STATUS: h,
1031
- cfg: l
1032
- }), { sendMessage: ce, regenerateResponse: re, toggleStop: ue, goHistoryMessage: Ee, resetConversation: Re } = Tn({
1029
+ flushMessagesBatch: f,
1030
+ STATUS: m,
1031
+ cfg: c
1032
+ }), { sendMessage: Ae, regenerateResponse: ve, toggleStop: de, goHistoryMessage: $e, resetConversation: be } = ps({
1033
1033
  messages: i,
1034
- userInput: u,
1035
- isGenerating: g,
1036
- lastUserMessage: D,
1037
- conversationId: $,
1038
- doStreamRequest: Q,
1039
- issTop: I,
1040
- scrollToBottom: s,
1041
- STATUS: h,
1042
- cfg: l,
1043
- onTitleGenerated: (G) => r("title-generated", G)
1034
+ userInput: r,
1035
+ isGenerating: p,
1036
+ lastUserMessage: H,
1037
+ conversationId: P,
1038
+ doStreamRequest: q,
1039
+ issTop: oe,
1040
+ scrollToBottom: a,
1041
+ STATUS: m,
1042
+ cfg: c,
1043
+ onTitleGenerated: (F) => d("title-generated", F)
1044
1044
  });
1045
- function $e() {
1046
- i.value = [], D.value = "", Re();
1047
- }
1048
- const Pe = Y(() => i.value.length === 0);
1049
- C({ goHistoryMessage: Ee, createNewConversation: $e, isEmptyConversation: Pe });
1050
- const pe = k(/* @__PURE__ */ new Map());
1051
- function De(G, F) {
1052
- G ? pe.value.set(F, G) : pe.value.delete(F);
1053
- }
1054
- se(i, () => {
1055
- te(() => {
1056
- i.value.forEach((G, F) => {
1057
- G.type === "ai" && G.status !== h.ANSWERING && (S.set(F, G.content), R.value.set(F, G.content.length));
1058
- }), O(), pe.value.forEach((G) => {
1059
- w(G);
1045
+ function z() {
1046
+ i.value = [], H.value = "", be();
1047
+ }
1048
+ const he = X(() => i.value.length === 0);
1049
+ b({ goHistoryMessage: $e, createNewConversation: z, isEmptyConversation: he });
1050
+ const me = y(/* @__PURE__ */ new Map());
1051
+ function ye(F, Q) {
1052
+ F ? me.value.set(Q, F) : me.value.delete(Q);
1053
+ }
1054
+ re(i, () => {
1055
+ ae(() => {
1056
+ i.value.forEach((F, Q) => {
1057
+ F.type === "ai" && F.status !== m.ANSWERING && (E.set(Q, F.content), $.value.set(Q, F.content.length));
1058
+ }), N(), me.value.forEach((F) => {
1059
+ C(F);
1060
1060
  });
1061
1061
  });
1062
1062
  }, { deep: !0 });
1063
- let ae = null;
1064
- return ne(() => {
1065
- o.defaultSayhello && (y.text1 = o.defaultSayhello.text1, y.text2 = o.defaultSayhello.text2), o.defaultRecommend && (P.value = At(o.defaultRecommend));
1066
- }), ne(() => {
1067
- c.value && (ae = () => p(), c.value.addEventListener("scroll", ae));
1068
- }), Te(() => {
1069
- L(), c.value && ae && c.value.removeEventListener("scroll", ae);
1070
- }), (G, F) => {
1071
- var be;
1072
- return m(), A("div", xn, [
1073
- n("div", {
1063
+ let ie = null;
1064
+ return ue(() => {
1065
+ o.defaultSayhello && (k.text1 = o.defaultSayhello.text1, k.text2 = o.defaultSayhello.text2), o.defaultRecommend && (_.value = mn(o.defaultRecommend));
1066
+ }), ue(() => {
1067
+ v.value && (ie = () => w(), v.value.addEventListener("scroll", ie));
1068
+ }), qe(() => {
1069
+ T(), v.value && ie && v.value.removeEventListener("scroll", ie);
1070
+ }), (F, Q) => {
1071
+ var ge;
1072
+ return g(), A("div", ys, [
1073
+ s("div", {
1074
1074
  class: "chat-box scrollWrap",
1075
1075
  ref_key: "chatBoxRef",
1076
- ref: c
1076
+ ref: v
1077
1077
  }, [
1078
- n("div", En, [
1079
- n("div", Rn, [
1080
- n("img", { src: H(Ie) }, null, 8, $n),
1081
- n("h1", null, V(y.text1), 1),
1082
- n("p", null, V(y.text2), 1)
1078
+ s("div", ws, [
1079
+ s("div", ks, [
1080
+ s("img", { src: O(Mt) }, null, 8, Cs),
1081
+ s("h1", null, V(k.text1), 1),
1082
+ s("p", null, V(k.text2), 1)
1083
1083
  ])
1084
1084
  ]),
1085
- (be = _.value) != null && be.length ? (m(), A("div", Pn, [
1086
- n("div", Dn, [
1087
- n("div", Hn, [
1088
- F[2] || (F[2] = n("span", null, "你可以尝试这样问我:", -1)),
1089
- n("p", {
1085
+ (ge = W.value) != null && ge.length ? (g(), A("div", As, [
1086
+ s("div", bs, [
1087
+ s("div", Ss, [
1088
+ Q[2] || (Q[2] = s("span", null, "你可以尝试这样问我:", -1)),
1089
+ s("p", {
1090
1090
  class: "refresh-btn",
1091
1091
  onClick: e
1092
1092
  }, [
1093
- n("img", { src: H(Nt) }, null, 8, _n),
1094
- F[1] || (F[1] = n("span", null, "换一换", -1))
1093
+ s("img", { src: O(Rn) }, null, 8, xs),
1094
+ Q[1] || (Q[1] = s("span", null, "换一换", -1))
1095
1095
  ])
1096
1096
  ]),
1097
- n("ul", null, [
1098
- (m(!0), A(ie, null, me(_.value, (oe, ee) => (m(), A("li", {
1099
- key: ee,
1100
- onClick: (fe) => v(oe)
1101
- }, V(oe), 9, On))), 128))
1097
+ s("ul", null, [
1098
+ (g(!0), A(fe, null, De(W.value, (te, ne) => (g(), A("li", {
1099
+ key: ne,
1100
+ onClick: (je) => h(te)
1101
+ }, V(te), 9, Ms))), 128))
1102
1102
  ])
1103
1103
  ])
1104
- ])) : N("", !0),
1105
- (m(!0), A(ie, null, me(i.value, (oe, ee) => (m(), Z(ln, {
1106
- key: ee,
1107
- msg: oe,
1108
- index: ee,
1109
- STATUS: h,
1110
- displayedContent: H(S),
1111
- getSegmentDisplayContent: H(B),
1112
- setMessageRef: De,
1113
- onRegenerate: H(re)
1104
+ ])) : B("", !0),
1105
+ (g(!0), A(fe, null, De(i.value, (te, ne) => (g(), ee(In, {
1106
+ key: ne,
1107
+ msg: te,
1108
+ index: ne,
1109
+ STATUS: m,
1110
+ displayedContent: O(E),
1111
+ getSegmentDisplayContent: O(L),
1112
+ setMessageRef: ye,
1113
+ onRegenerate: O(ve)
1114
1114
  }, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
1115
1115
  ], 512),
1116
- X(wn, {
1117
- modelValue: u.value,
1118
- "onUpdate:modelValue": F[0] || (F[0] = (oe) => u.value = oe),
1119
- isGenerating: g.value,
1120
- lastUserMessage: D.value,
1121
- hasScroll: H(b),
1122
- isAtBottom: H(E),
1123
- onSend: H(ce),
1124
- onRegenerate: H(re),
1125
- onStop: H(ue),
1126
- onScrollToBottom: H(s)
1116
+ G(rs, {
1117
+ modelValue: r.value,
1118
+ "onUpdate:modelValue": Q[0] || (Q[0] = (te) => r.value = te),
1119
+ isGenerating: p.value,
1120
+ lastUserMessage: H.value,
1121
+ hasScroll: O(x),
1122
+ isAtBottom: O(R),
1123
+ onSend: O(Ae),
1124
+ onRegenerate: O(ve),
1125
+ onStop: O(de),
1126
+ onScrollToBottom: O(a)
1127
1127
  }, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
1128
- F[3] || (F[3] = n("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
1128
+ Q[3] || (Q[3] = s("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
1129
1129
  ]);
1130
1130
  };
1131
1131
  }
1132
- }), Bn = { class: "ai-history" }, Nn = { class: "content" }, Wn = {
1132
+ }), Ts = { class: "ai-history" }, Ds = { class: "content" }, Rs = {
1133
1133
  key: 0,
1134
1134
  class: "ai-history-loading"
1135
- }, Yn = { class: "ai-history-group-title" }, Vn = ["onClick"], Xn = { class: "ai-history-item-title" }, Fn = ["onClick"], Qn = {
1135
+ }, $s = { class: "ai-history-group-title" }, Ps = ["onClick"], _s = { class: "ai-history-item-title" }, Hs = ["onClick"], Os = {
1136
1136
  key: 2,
1137
1137
  class: "ai-history-empty"
1138
- }, Gn = ["src"], Jn = { class: "ai-modal" }, Un = { class: "ai-modal-footer" }, qn = /* @__PURE__ */ le({
1138
+ }, Ls = ["src"], Ws = { class: "ai-modal" }, Ns = { class: "ai-modal-footer" }, Bs = /* @__PURE__ */ pe({
1139
1139
  __name: "History",
1140
1140
  emits: ["history-detail", "new-conversation"],
1141
- setup(t, { emit: C }) {
1142
- const h = ge().apis, o = k([]), r = k(!0), l = k(!1), i = k(""), u = Y(() => bt(o.value));
1143
- async function g() {
1141
+ setup(t, { emit: b }) {
1142
+ const m = Re().apis, o = y([]), d = y(!0), c = y(!1), i = y(""), r = X(() => gn(o.value));
1143
+ async function p() {
1144
1144
  try {
1145
- const c = await St(h);
1146
- c != null && c.conversationList && (o.value = c.conversationList.filter((y) => y !== null).map((y) => ({ ...y, selected: !1 })));
1147
- } catch (c) {
1148
- he((c == null ? void 0 : c.message) || "获取历史记录失败");
1145
+ const v = await fn(m);
1146
+ v != null && v.conversationList && (o.value = v.conversationList.filter((k) => k !== null).map((k) => ({ ...k, selected: !1 })));
1147
+ } catch (v) {
1148
+ Te((v == null ? void 0 : v.message) || "获取历史记录失败");
1149
1149
  } finally {
1150
- r.value = !1;
1150
+ d.value = !1;
1151
1151
  }
1152
1152
  }
1153
- function D(c) {
1154
- i.value = c, l.value = !0;
1153
+ function H(v) {
1154
+ i.value = v, c.value = !0;
1155
1155
  }
1156
- async function $() {
1157
- l.value = !1;
1156
+ async function P() {
1157
+ c.value = !1;
1158
1158
  try {
1159
- await Mt(h, i.value), await g();
1160
- } catch (c) {
1161
- he((c == null ? void 0 : c.message) || "删除失败"), await g();
1159
+ await pn(m, i.value), await p();
1160
+ } catch (v) {
1161
+ Te((v == null ? void 0 : v.message) || "删除失败"), await p();
1162
1162
  }
1163
1163
  }
1164
- return ne(() => {
1165
- g();
1166
- }), (c, y) => (m(), A("div", Bn, [
1167
- n("div", Nn, [
1168
- r.value ? (m(), A("div", Wn, [...y[3] || (y[3] = [
1169
- n("div", { class: "ai-history-spinner" }, null, -1)
1170
- ])])) : u.value.length > 0 ? (m(!0), A(ie, { key: 1 }, me(u.value, (P) => (m(), A("div", {
1171
- key: P.label,
1164
+ return ue(() => {
1165
+ p();
1166
+ }), (v, k) => (g(), A("div", Ts, [
1167
+ s("div", Ds, [
1168
+ d.value ? (g(), A("div", Rs, [...k[3] || (k[3] = [
1169
+ s("div", { class: "ai-history-spinner" }, null, -1)
1170
+ ])])) : r.value.length > 0 ? (g(!0), A(fe, { key: 1 }, De(r.value, (_) => (g(), A("div", {
1171
+ key: _.label,
1172
1172
  class: "ai-history-group"
1173
1173
  }, [
1174
- n("div", Yn, V(P.label), 1),
1175
- (m(!0), A(ie, null, me(P.items, (x, _) => (m(), A("div", {
1176
- key: x.appConversationID,
1174
+ s("div", $s, V(_.label), 1),
1175
+ (g(!0), A(fe, null, De(_.items, (D, W) => (g(), A("div", {
1176
+ key: D.appConversationID,
1177
1177
  class: "ai-history-item",
1178
- style: xe({ "--i": _ }),
1179
- onClick: (e) => c.$emit("history-detail", x.appConversationID)
1178
+ style: We({ "--i": W }),
1179
+ onClick: (e) => v.$emit("history-detail", D.appConversationID)
1180
1180
  }, [
1181
- n("div", Xn, V(x.conversationName), 1),
1182
- n("div", {
1181
+ s("div", _s, V(D.conversationName), 1),
1182
+ s("div", {
1183
1183
  class: "ai-history-item-delete",
1184
- onClick: Ce((e) => D(x.appConversationID), ["stop"])
1185
- }, "删除", 8, Fn)
1186
- ], 12, Vn))), 128))
1187
- ]))), 128)) : (m(), A("div", Qn, "暂无历史记录"))
1184
+ onClick: Ce((e) => H(D.appConversationID), ["stop"])
1185
+ }, "删除", 8, Hs)
1186
+ ], 12, Ps))), 128))
1187
+ ]))), 128)) : (g(), A("div", Os, "暂无历史记录"))
1188
1188
  ]),
1189
- n("div", {
1189
+ s("div", {
1190
1190
  class: "ai-add",
1191
- onClick: y[0] || (y[0] = (P) => c.$emit("new-conversation"))
1191
+ onClick: k[0] || (k[0] = (_) => v.$emit("new-conversation"))
1192
1192
  }, [
1193
- n("img", { src: H(Pt) }, null, 8, Gn),
1194
- y[4] || (y[4] = n("span", null, "新建AI对话", -1))
1193
+ s("img", { src: O(bn) }, null, 8, Ls),
1194
+ k[4] || (k[4] = s("span", null, "新建AI对话", -1))
1195
1195
  ]),
1196
- (m(), Z(je, { to: "#ai-assist-root" }, [
1197
- l.value ? (m(), A("div", {
1196
+ (g(), ee(At, { to: "#ai-assist-root" }, [
1197
+ c.value ? (g(), A("div", {
1198
1198
  key: 0,
1199
1199
  class: "ai-modal-overlay",
1200
- onClick: y[2] || (y[2] = Ce((P) => l.value = !1, ["self"]))
1200
+ onClick: k[2] || (k[2] = Ce((_) => c.value = !1, ["self"]))
1201
1201
  }, [
1202
- n("div", Jn, [
1203
- y[5] || (y[5] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1204
- y[6] || (y[6] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1205
- n("div", Un, [
1206
- n("button", {
1202
+ s("div", Ws, [
1203
+ k[5] || (k[5] = s("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
1204
+ k[6] || (k[6] = s("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
1205
+ s("div", Ns, [
1206
+ s("button", {
1207
1207
  class: "ai-modal-btn cancel",
1208
- onClick: y[1] || (y[1] = (P) => l.value = !1)
1208
+ onClick: k[1] || (k[1] = (_) => c.value = !1)
1209
1209
  }, "取消"),
1210
- n("button", {
1210
+ s("button", {
1211
1211
  class: "ai-modal-btn confirm",
1212
- onClick: $
1212
+ onClick: P
1213
1213
  }, "确定")
1214
1214
  ])
1215
1215
  ])
1216
- ])) : N("", !0)
1216
+ ])) : B("", !0)
1217
1217
  ]))
1218
1218
  ]));
1219
1219
  }
1220
- }), jn = { class: "container info" }, zn = { class: "info-item" }, Kn = { class: "basic-content" }, Zn = { class: "basic-content-text" }, In = { class: "basic-content" }, es = { class: "basic-content-text" }, ts = { class: "info-item" }, ns = { class: "permission-content" }, ss = { class: "info-item" }, as = { class: "basic-content" }, os = { class: "basic-content-text" }, is = { class: "basic-content" }, ls = { class: "basic-content-text" }, cs = /* @__PURE__ */ le({
1220
+ }), Ys = { class: "container info" }, Xs = { class: "info-item" }, Vs = { class: "basic-content" }, Fs = { class: "basic-content-text" }, Qs = { class: "basic-content" }, Gs = { class: "basic-content-text" }, zs = { class: "info-item" }, Js = { class: "permission-content" }, qs = { class: "info-item" }, Ks = { class: "basic-content" }, Us = { class: "basic-content-text" }, js = { class: "basic-content" }, Is = { class: "basic-content-text" }, Zs = /* @__PURE__ */ pe({
1221
1221
  __name: "Info",
1222
1222
  setup(t) {
1223
- const C = ge(), f = k(null);
1224
- return ne(async () => {
1223
+ const b = Re(), u = y(null);
1224
+ return ue(async () => {
1225
1225
  try {
1226
- f.value = await Tt(C.apis);
1227
- } catch (h) {
1228
- he((h == null ? void 0 : h.message) || "获取个人信息失败");
1226
+ u.value = await yn(b.apis);
1227
+ } catch (m) {
1228
+ Te((m == null ? void 0 : m.message) || "获取个人信息失败");
1229
1229
  }
1230
- }), (h, o) => {
1231
- var r, l, i, u, g;
1232
- return m(), A("div", jn, [
1233
- n("div", zn, [
1234
- o[2] || (o[2] = n("div", { class: "heading" }, [
1235
- n("div", { class: "heading-column" }),
1236
- n("div", { class: "heading-title" }, "基本信息")
1230
+ }), (m, o) => {
1231
+ var d, c, i, r, p;
1232
+ return g(), A("div", Ys, [
1233
+ s("div", Xs, [
1234
+ o[2] || (o[2] = s("div", { class: "heading" }, [
1235
+ s("div", { class: "heading-column" }),
1236
+ s("div", { class: "heading-title" }, "基本信息")
1237
1237
  ], -1)),
1238
- n("div", Kn, [
1239
- o[0] || (o[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
1240
- n("div", Zn, V(((r = f.value) == null ? void 0 : r.name) || ""), 1)
1238
+ s("div", Vs, [
1239
+ o[0] || (o[0] = s("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
1240
+ s("div", Fs, V(((d = u.value) == null ? void 0 : d.name) || ""), 1)
1241
1241
  ]),
1242
- n("div", In, [
1243
- o[1] || (o[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
1244
- n("div", es, V(((l = f.value) == null ? void 0 : l.userName) || ""), 1)
1242
+ s("div", Qs, [
1243
+ o[1] || (o[1] = s("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
1244
+ s("div", Gs, V(((c = u.value) == null ? void 0 : c.userName) || ""), 1)
1245
1245
  ])
1246
1246
  ]),
1247
- n("div", ts, [
1248
- o[3] || (o[3] = n("div", { class: "heading" }, [
1249
- n("div", { class: "heading-column" }),
1250
- n("div", { class: "heading-title" }, "数据权限")
1247
+ s("div", zs, [
1248
+ o[3] || (o[3] = s("div", { class: "heading" }, [
1249
+ s("div", { class: "heading-column" }),
1250
+ s("div", { class: "heading-title" }, "数据权限")
1251
1251
  ], -1)),
1252
- n("div", ns, [
1253
- (m(!0), A(ie, null, me((i = f.value) == null ? void 0 : i.ptnameList, (D, $) => (m(), A("div", {
1254
- key: $,
1252
+ s("div", Js, [
1253
+ (g(!0), A(fe, null, De((i = u.value) == null ? void 0 : i.ptnameList, (H, P) => (g(), A("div", {
1254
+ key: P,
1255
1255
  class: "permission-content-text"
1256
- }, V(D), 1))), 128))
1256
+ }, V(H), 1))), 128))
1257
1257
  ])
1258
1258
  ]),
1259
- n("div", ss, [
1260
- o[6] || (o[6] = n("div", { class: "heading" }, [
1261
- n("div", { class: "heading-column" }),
1262
- n("div", { class: "heading-title" }, "帮助信息")
1259
+ s("div", qs, [
1260
+ o[6] || (o[6] = s("div", { class: "heading" }, [
1261
+ s("div", { class: "heading-column" }),
1262
+ s("div", { class: "heading-title" }, "帮助信息")
1263
1263
  ], -1)),
1264
- n("div", as, [
1265
- o[4] || (o[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1266
- n("div", os, V(((u = f.value) == null ? void 0 : u.dept) || ""), 1)
1264
+ s("div", Ks, [
1265
+ o[4] || (o[4] = s("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
1266
+ s("div", Us, V(((r = u.value) == null ? void 0 : r.dept) || ""), 1)
1267
1267
  ]),
1268
- n("div", is, [
1269
- o[5] || (o[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1270
- n("div", ls, V(((g = f.value) == null ? void 0 : g.email) || ""), 1)
1268
+ s("div", js, [
1269
+ o[5] || (o[5] = s("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
1270
+ s("div", Is, V(((p = u.value) == null ? void 0 : p.email) || ""), 1)
1271
1271
  ])
1272
1272
  ])
1273
1273
  ]);
1274
1274
  };
1275
1275
  }
1276
- }), rs = { key: 1 }, us = ["src"], vs = { class: "header-title" }, ds = ["title"], hs = { class: "ai-history-drawer-panel" }, ms = { class: "ai-history-drawer-header" }, gs = { class: "setTitle" }, ps = { class: "content" }, fs = { class: "main" }, ys = { class: "btn" }, ws = ["src"], ks = 78, ke = 78, q = 8, Cs = 490, qe = "aiPanelPosition", et = /* @__PURE__ */ le({
1276
+ }), ea = { key: 1 }, ta = ["src"], na = { class: "header-title" }, sa = ["title"], aa = { class: "ai-history-drawer-panel" }, oa = { class: "ai-history-drawer-header" }, ia = { class: "setTitle" }, la = { class: "content" }, ca = { class: "main" }, ua = { class: "btn" }, ra = ["src"], va = 78, Oe = 78, I = 8, Le = 26, Ee = 490, yt = "aiPanelPosition", wt = "aiPanelDocked", kt = "aiDockWidth", da = 60, ha = 150, Ct = 400, ma = 320, Et = /* @__PURE__ */ pe({
1277
1277
  __name: "AiAssist",
1278
1278
  setup(t) {
1279
- const C = ks / 2, f = ge(), h = k(!1), o = k("idle"), r = k(!1), l = K({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), i = k(!1), u = k(window.innerWidth < 768), g = k(window.innerWidth < 768), D = k("answer"), $ = k(!1), c = k(""), y = k(""), P = k(""), x = k(!1), _ = k(!1), e = K({
1280
- x: window.innerWidth - C,
1281
- y: window.innerHeight / 2 - ke / 2
1282
- }), v = k(!1), E = k(!1), b = k("right"), s = k("left"), p = k(null), w = K({ x: 0, y: 0 }), M = k(!1), d = k(!1), S = K({ x: 0, y: 0 }), R = k(!1), O = K({ x: 0, y: 0 });
1283
- let L = !1;
1284
- const B = K({ x: 0, y: 0 }), Q = k(!1), I = k(null);
1285
- let ce = null, re = null;
1286
- const ue = Y(() => {
1287
- const a = window.innerWidth / 2;
1288
- return e.x + C < a ? 5 : -5;
1289
- }), Ee = Y(() => g.value ? "" : `panel-${b.value}`), Re = Y(() => {
1290
- var a;
1291
- return !((a = I.value) != null && a.isEmptyConversation);
1292
- }), $e = Y(() => ({
1279
+ var rt;
1280
+ const b = va / 2, u = Re(), m = y(!1), o = y("idle"), d = y(!1), c = Z({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), i = y(!1), r = y(window.innerWidth < 768), p = y(window.innerWidth < 768), H = y("answer"), P = y(!1), v = y(""), k = y(""), _ = y(""), D = y(!1), W = y(!1), e = Z({
1281
+ x: window.innerWidth - b,
1282
+ y: window.innerHeight / 2 - Oe / 2
1283
+ }), h = y(!1), R = y(!1), x = y("right"), a = y("left"), w = y(null), C = Z({ x: 0, y: 0 }), M = y(!1), f = y(!1), E = Z({ x: 0, y: 0 }), $ = y(!1), N = Z({ x: 0, y: 0 }), T = y(!1), L = y(!1), q = y(!1), oe = Z({ x: 0, width: 0 }), Ae = y(!1);
1284
+ let ve = 0;
1285
+ const de = y("idle"), $e = y(!1), be = y("none"), z = Z({ x: 0, y: 0, w: Ee, h: 0, radius: "14px" });
1286
+ let he = null, me = !1, ye = !1;
1287
+ const ie = Z({ x: 0, y: 0 }), F = y(!1), Q = y(null);
1288
+ let ge = null, te = null;
1289
+ const ne = X(() => {
1290
+ const n = window.innerWidth / 2;
1291
+ return e.x + b < n ? 5 : -5;
1292
+ }), je = X(() => p.value || T.value || de.value !== "idle" ? "" : `panel-${x.value}`), we = X(() => {
1293
+ var n;
1294
+ return !!((n = u.dock) != null && n.containerId) && !r.value;
1295
+ }), U = y(((rt = u.dock) == null ? void 0 : rt.width) || Ee), Ie = X(() => u.panelDraggable !== !1), Tt = X(() => {
1296
+ var n;
1297
+ return !((n = Q.value) != null && n.isEmptyConversation);
1298
+ }), Dt = X(() => ({
1293
1299
  left: `${e.x}px`,
1294
1300
  top: `${e.y}px`,
1295
- transition: v.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1296
- "--direction": String(ue.value)
1297
- })), Pe = Y(() => f.characterImage || Dt), pe = Y(() => o.value === "idle" ? {} : {
1298
- left: `${l.x}px`,
1299
- top: `${l.y}px`,
1300
- width: `${l.w}px`,
1301
- height: `${l.h}px`,
1302
- borderRadius: l.radius
1303
- }), De = Y(() => {
1304
- const a = {};
1305
- return M.value && !g.value && !u.value && (a["--ai-panel-x"] = `${w.x}px`, a["--ai-panel-y"] = `${w.y}px`), a;
1301
+ transition: h.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1302
+ "--direction": String(ne.value)
1303
+ })), Rt = X(() => u.characterImage || Sn), $t = X(() => o.value === "idle" ? {} : {
1304
+ left: `${c.x}px`,
1305
+ top: `${c.y}px`,
1306
+ width: `${c.w}px`,
1307
+ height: `${c.h}px`,
1308
+ borderRadius: c.radius
1309
+ }), Pt = X(() => {
1310
+ const n = {};
1311
+ return M.value && !p.value && !r.value && !T.value && (n["--ai-panel-x"] = `${C.x}px`, n["--ai-panel-y"] = `${C.y}px`), T.value && (n["--ai-dock-width"] = `${U.value}px`), n;
1312
+ }), _t = X(() => de.value === "idle" ? {} : {
1313
+ left: `${z.x}px`,
1314
+ top: `${z.y}px`,
1315
+ width: `${z.w}px`,
1316
+ height: `${z.h}px`,
1317
+ borderRadius: z.radius
1306
1318
  });
1307
- function ae() {
1308
- const a = window.innerWidth / 2;
1309
- e.x + C < a ? (b.value = "left", s.value = "right") : (b.value = "right", s.value = "left");
1310
- }
1311
- function G() {
1312
- const a = window.innerWidth, T = Math.max(0, Math.min(e.y, window.innerHeight - ke));
1313
- return { x: e.x + C >= a / 2 ? a - C : -C, y: T };
1314
- }
1315
- function F() {
1316
- E.value = !0;
1317
- const a = G();
1318
- e.x = a.x, e.y = a.y, setTimeout(() => {
1319
- E.value = !1, ae(), be();
1319
+ function Be() {
1320
+ const n = window.innerWidth / 2;
1321
+ e.x + b < n ? (x.value = "left", a.value = "right") : (x.value = "right", a.value = "left");
1322
+ }
1323
+ function Ht() {
1324
+ const n = window.innerWidth, l = Math.max(0, Math.min(e.y, window.innerHeight - Oe));
1325
+ return { x: e.x + b >= n / 2 ? n - b : -b, y: l };
1326
+ }
1327
+ function Ze() {
1328
+ R.value = !0;
1329
+ const n = Ht();
1330
+ e.x = n.x, e.y = n.y, setTimeout(() => {
1331
+ R.value = !1, Be(), Ot();
1320
1332
  }, 400);
1321
1333
  }
1322
- function be() {
1334
+ function Ot() {
1323
1335
  try {
1324
- localStorage.setItem("characterPosition", JSON.stringify({ x: e.x, y: e.y })), localStorage.setItem("panelPosition", b.value), localStorage.setItem("backPosition", s.value);
1336
+ localStorage.setItem("characterPosition", JSON.stringify({ x: e.x, y: e.y })), localStorage.setItem("panelPosition", x.value), localStorage.setItem("backPosition", a.value);
1325
1337
  } catch {
1326
1338
  }
1327
1339
  }
1328
- function oe() {
1329
- const a = localStorage.getItem("characterPosition");
1330
- if (a) {
1331
- const U = JSON.parse(a);
1332
- e.x = U.x, e.y = Math.min(Math.max(U.y, 0), window.innerHeight - ke);
1340
+ function Lt() {
1341
+ const n = localStorage.getItem("characterPosition");
1342
+ if (n) {
1343
+ const Y = JSON.parse(n);
1344
+ e.x = Y.x, e.y = Math.min(Math.max(Y.y, 0), window.innerHeight - Oe);
1333
1345
  } else
1334
- e.x = window.innerWidth - C, e.y = window.innerHeight / 2 - ke / 2;
1335
- const T = localStorage.getItem("panelPosition"), W = localStorage.getItem("backPosition");
1336
- T && (b.value = T), W && (s.value = W);
1346
+ e.x = window.innerWidth - b, e.y = window.innerHeight / 2 - Oe / 2;
1347
+ const l = localStorage.getItem("panelPosition"), S = localStorage.getItem("backPosition");
1348
+ l && (x.value = l), S && (a.value = S);
1337
1349
  }
1338
- function ee(a) {
1339
- if (!v.value) return;
1340
- const T = "touches" in a ? a.touches[0].clientX : a.clientX, W = "touches" in a ? a.touches[0].clientY : a.clientY, U = T - B.x, z = Math.max(0, Math.min(W - B.y, window.innerHeight - ke)), ve = Math.abs(U - e.x), He = Math.abs(z - e.y);
1341
- ve + He > 5 && (Q.value = !0), e.x = U, e.y = z;
1350
+ function Ye(n) {
1351
+ if (!h.value) return;
1352
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX, S = "touches" in n ? n.touches[0].clientY : n.clientY, Y = l - ie.x, K = Math.max(0, Math.min(S - ie.y, window.innerHeight - Oe)), se = Math.abs(Y - e.x), le = Math.abs(K - e.y);
1353
+ se + le > 5 && (F.value = !0), e.x = Y, e.y = K;
1342
1354
  }
1343
- function fe() {
1344
- v.value && (v.value = !1, Q.value && (F(), Q.value = !1));
1355
+ function Xe() {
1356
+ h.value && (h.value = !1, F.value && (Ze(), F.value = !1));
1345
1357
  }
1346
- function Oe(a) {
1347
- E.value = !1, v.value = !0, Q.value = !1;
1348
- const T = "touches" in a ? a.touches[0].clientX : a.clientX, W = "touches" in a ? a.touches[0].clientY : a.clientY;
1349
- B.x = T - e.x, B.y = W - e.y;
1358
+ function et(n) {
1359
+ R.value = !1, h.value = !0, F.value = !1;
1360
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX, S = "touches" in n ? n.touches[0].clientY : n.clientY;
1361
+ ie.x = l - e.x, ie.y = S - e.y;
1350
1362
  }
1351
- function Le() {
1352
- const a = p.value, T = (a == null ? void 0 : a.offsetWidth) || Cs, W = (a == null ? void 0 : a.offsetHeight) || window.innerHeight - 78;
1363
+ function Wt() {
1364
+ const n = w.value, l = (n == null ? void 0 : n.offsetWidth) || Ee, S = (n == null ? void 0 : n.offsetHeight) || window.innerHeight - 78;
1353
1365
  return {
1354
- maxX: Math.max(q, window.innerWidth - T - q),
1355
- maxY: Math.max(q, window.innerHeight - W - q)
1366
+ maxX: Math.max(I, window.innerWidth - l - I),
1367
+ maxY: Math.max(Le, window.innerHeight - S - I)
1356
1368
  };
1357
1369
  }
1358
- function Be() {
1359
- const { maxX: a, maxY: T } = Le();
1360
- w.x = Math.min(Math.max(w.x, q), a), w.y = Math.min(Math.max(w.y, q), T);
1361
- }
1362
- function Ne(a) {
1363
- if (g.value || u.value || o.value !== "idle") return;
1364
- if (d.value = !0, R.value = !1, !M.value) {
1365
- const U = p.value;
1366
- if (U) {
1367
- const z = U.getBoundingClientRect();
1368
- w.x = z.left, w.y = z.top, M.value = !0;
1370
+ function Ve(n, l) {
1371
+ const S = w.value, Y = n ?? (S == null ? void 0 : S.offsetWidth) ?? Ee, K = l ?? (S == null ? void 0 : S.offsetHeight) ?? window.innerHeight - 78, se = Math.max(I, window.innerWidth - Y - I), le = Math.max(Le, window.innerHeight - K - I);
1372
+ C.x = Math.min(Math.max(C.x, I), se), C.y = Math.min(Math.max(C.y, Le), le);
1373
+ }
1374
+ function tt(n) {
1375
+ if (!Ie.value || p.value || r.value || T.value || o.value !== "idle") return;
1376
+ if (ye = !1, f.value = !0, $.value = !1, !M.value) {
1377
+ const Y = w.value;
1378
+ if (Y) {
1379
+ const K = Y.getBoundingClientRect();
1380
+ C.x = K.left, C.y = K.top, M.value = !0;
1369
1381
  }
1370
1382
  }
1371
- const T = "touches" in a ? a.touches[0].clientX : a.clientX, W = "touches" in a ? a.touches[0].clientY : a.clientY;
1372
- O.x = T, O.y = W, S.x = T - w.x, S.y = W - w.y;
1373
- }
1374
- function Se(a) {
1375
- if (!d.value) return;
1376
- const T = "touches" in a ? a.touches[0].clientX : a.clientX, W = "touches" in a ? a.touches[0].clientY : a.clientY;
1377
- if (!R.value) {
1378
- const ve = Math.abs(T - O.x), He = Math.abs(W - O.y);
1379
- if (ve + He <= 5) return;
1380
- R.value = !0;
1383
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX, S = "touches" in n ? n.touches[0].clientY : n.clientY;
1384
+ N.x = l, N.y = S, E.x = l - C.x, E.y = S - C.y;
1385
+ }
1386
+ function Fe(n) {
1387
+ var ce, vt;
1388
+ if (!f.value) return;
1389
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX, S = "touches" in n ? n.touches[0].clientY : n.clientY;
1390
+ if (!$.value) {
1391
+ const Zt = Math.abs(l - N.x), en = Math.abs(S - N.y);
1392
+ if (Zt + en <= 5) return;
1393
+ $.value = !0;
1381
1394
  }
1382
- const { maxX: U, maxY: z } = Le();
1383
- w.x = Math.min(Math.max(T - S.x, q), U), w.y = Math.min(Math.max(W - S.y, q), z);
1395
+ const { maxX: Y, maxY: K } = Wt(), se = we.value ? Y + ha : Y, le = Math.min(Math.max(l - E.x, I), se), xe = Math.min(Math.max(S - E.y, Le), K), ke = we.value && le > Y + da;
1396
+ ke !== ye && (ye = ke, (vt = (ce = u.dock) == null ? void 0 : ce.onDockChange) == null || vt.call(ce, ke)), L.value = ke, C.x = le, C.y = xe;
1384
1397
  }
1385
- function Me() {
1386
- d.value && (d.value = !1, R.value && (R.value = !1, L = !0, setTimeout(() => {
1387
- L = !1;
1388
- }, 0), tt()));
1398
+ function Qe() {
1399
+ var l, S;
1400
+ if (!f.value) return;
1401
+ f.value = !1;
1402
+ let n = !1;
1403
+ $.value && ($.value = !1, me = !0, setTimeout(() => {
1404
+ me = !1;
1405
+ }, 0), L.value && we.value ? (ot(), n = !0) : (Ve(), Nt())), ye && !n && (ye = !1, (S = (l = u.dock) == null ? void 0 : l.onDockChange) == null || S.call(l, !1)), L.value = !1;
1389
1406
  }
1390
- function We(a) {
1391
- L && (a.preventDefault(), a.stopPropagation(), L = !1);
1407
+ function nt(n) {
1408
+ me && (n.preventDefault(), n.stopPropagation(), me = !1);
1392
1409
  }
1393
- function tt() {
1410
+ function Nt() {
1394
1411
  try {
1395
- localStorage.setItem(qe, JSON.stringify({ x: w.x, y: w.y }));
1412
+ localStorage.setItem(yt, JSON.stringify({ x: C.x, y: C.y }));
1396
1413
  } catch {
1397
1414
  }
1398
1415
  }
1399
- function nt() {
1416
+ function Bt() {
1400
1417
  try {
1401
- const a = localStorage.getItem(qe);
1402
- if (a) {
1403
- const T = JSON.parse(a);
1404
- typeof T.x == "number" && typeof T.y == "number" && (w.x = T.x, w.y = T.y, M.value = !0);
1418
+ const n = localStorage.getItem(yt);
1419
+ if (n) {
1420
+ const l = JSON.parse(n);
1421
+ typeof l.x == "number" && typeof l.y == "number" && (C.x = l.x, C.y = l.y, M.value = !0);
1405
1422
  }
1406
1423
  } catch {
1407
1424
  }
1408
1425
  }
1409
1426
  function st() {
1410
- if (!Q.value && !E.value) {
1411
- ae();
1412
- const a = Ye();
1413
- l.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + ue.value * 3)), l.y = e.y - ue.value * 2, l.w = 53, l.h = 53, l.radius = "50%", r.value = !0, o.value = "expanding", h.value = !0, te(() => {
1427
+ try {
1428
+ localStorage.setItem(wt, T.value ? "1" : "0");
1429
+ } catch {
1430
+ }
1431
+ }
1432
+ function Yt() {
1433
+ var n;
1434
+ try {
1435
+ if (localStorage.getItem(wt) === "1" && we.value) {
1436
+ const S = (n = u.dock) == null ? void 0 : n.containerId;
1437
+ S && document.getElementById(S) && (T.value = !0);
1438
+ }
1439
+ } catch {
1440
+ }
1441
+ }
1442
+ function Ge() {
1443
+ return {
1444
+ x: window.innerWidth - U.value,
1445
+ y: 0,
1446
+ w: U.value,
1447
+ h: window.innerHeight,
1448
+ radius: "0px"
1449
+ };
1450
+ }
1451
+ function Xt() {
1452
+ return {
1453
+ x: Math.max(0, Math.min(window.innerWidth - 53, e.x + ne.value * 3)),
1454
+ y: e.y,
1455
+ w: 53,
1456
+ h: 53,
1457
+ radius: "50%"
1458
+ };
1459
+ }
1460
+ function at() {
1461
+ const n = window.innerWidth * 0.8;
1462
+ return {
1463
+ x: (window.innerWidth - n) / 2,
1464
+ y: 54,
1465
+ w: n,
1466
+ h: window.innerHeight - 78,
1467
+ radius: "14px"
1468
+ };
1469
+ }
1470
+ function Vt() {
1471
+ p.value ? (Se(at(), ct()), p.value = !1) : (Se(Pe(), at()), p.value = !0);
1472
+ }
1473
+ function Se(n, l, S, Y = "none") {
1474
+ he && clearTimeout(he), de.value = "switching", $e.value = !0, be.value = Y, z.x = n.x, z.y = n.y, z.w = n.w, z.h = n.h, z.radius = n.radius, ae(() => {
1475
+ requestAnimationFrame(() => {
1476
+ $e.value = !1, z.x = l.x, z.y = l.y, z.w = l.w, z.h = l.h, z.radius = l.radius;
1477
+ });
1478
+ }), he = setTimeout(() => {
1479
+ de.value = "idle", be.value = "none", he = null, S == null || S();
1480
+ }, 400);
1481
+ }
1482
+ function ot() {
1483
+ var K, se, le, xe, ke;
1484
+ if (!we.value || T.value) return;
1485
+ p.value && (p.value = !1);
1486
+ const n = (K = u.dock) == null ? void 0 : K.containerId;
1487
+ if (n && !document.getElementById(n)) {
1488
+ console.warn(`[ai-assist-sdk] dock container "#${n}" not found, dock feature disabled`);
1489
+ return;
1490
+ }
1491
+ const l = w.value;
1492
+ let S = Pe();
1493
+ if (l) {
1494
+ const ce = l.getBoundingClientRect();
1495
+ S = { x: ce.left, y: ce.top, w: ce.width, h: ce.height, radius: getComputedStyle(l).borderRadius };
1496
+ }
1497
+ const Y = Ge();
1498
+ Se(S, Y), T.value = !0, o.value = "idle", L.value = !1, st(), (le = (se = u.dock) == null ? void 0 : se.onDockChange) == null || le.call(se, !0), (ke = (xe = u.dock) == null ? void 0 : xe.onDockWidthChange) == null || ke.call(xe, U.value);
1499
+ }
1500
+ function Ft() {
1501
+ return Math.max(Ct, window.innerWidth - ma);
1502
+ }
1503
+ function Ke(n) {
1504
+ return Math.min(Math.max(n, Ct), Ft());
1505
+ }
1506
+ function Qt() {
1507
+ try {
1508
+ localStorage.setItem(kt, String(U.value));
1509
+ } catch {
1510
+ }
1511
+ }
1512
+ function Gt() {
1513
+ try {
1514
+ const n = localStorage.getItem(kt);
1515
+ if (n) {
1516
+ const l = parseFloat(n);
1517
+ Number.isFinite(l) && (U.value = Ke(l));
1518
+ }
1519
+ } catch {
1520
+ }
1521
+ }
1522
+ function it(n) {
1523
+ if (!T.value) return;
1524
+ q.value = !0, Ae.value = !1;
1525
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX;
1526
+ oe.x = l, oe.width = U.value;
1527
+ }
1528
+ function ze(n) {
1529
+ if (!q.value) return;
1530
+ const l = "touches" in n ? n.touches[0].clientX : n.clientX, S = Ke(oe.width + (oe.x - l));
1531
+ Math.abs(S - oe.width) > 3 && (Ae.value = !0), U.value = S, ve || (ve = requestAnimationFrame(() => {
1532
+ var Y, K;
1533
+ ve = 0, (K = (Y = u.dock) == null ? void 0 : Y.onDockWidthChange) == null || K.call(Y, U.value);
1534
+ }));
1535
+ }
1536
+ function Je() {
1537
+ var n, l;
1538
+ q.value && (q.value = !1, Ae.value && (Ae.value = !1, Qt(), (l = (n = u.dock) == null ? void 0 : n.onDockWidthChange) == null || l.call(n, U.value)));
1539
+ }
1540
+ function lt() {
1541
+ var n, l;
1542
+ T.value && (M.value ? Ve(Ee, window.innerHeight - 78) : Be(), Se(Ge(), Pe()), T.value = !1, st(), (l = (n = u.dock) == null ? void 0 : n.onDockChange) == null || l.call(n, !1));
1543
+ }
1544
+ function zt() {
1545
+ var n, l;
1546
+ if (!F.value && !R.value) {
1547
+ if (T.value) {
1548
+ Se(
1549
+ { x: window.innerWidth, y: 0, w: U.value, h: window.innerHeight, radius: "0px" },
1550
+ Ge(),
1551
+ void 0,
1552
+ "in"
1553
+ ), m.value = !0, o.value = "idle", (l = (n = u.dock) == null ? void 0 : n.onDockChange) == null || l.call(n, !0);
1554
+ return;
1555
+ }
1556
+ Be();
1557
+ const S = Pe();
1558
+ c.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + ne.value * 3)), c.y = e.y - ne.value * 2, c.w = 53, c.h = 53, c.radius = "50%", d.value = !0, o.value = "expanding", m.value = !0, ae(() => {
1414
1559
  requestAnimationFrame(() => {
1415
- r.value = !1, l.x = a.x, l.y = a.y, l.w = a.w, l.h = a.h, l.radius = a.radius;
1560
+ d.value = !1, c.x = S.x, c.y = S.y, c.w = S.w, c.h = S.h, c.radius = S.radius;
1416
1561
  });
1417
1562
  }), setTimeout(() => {
1418
1563
  o.value = "idle";
1419
1564
  }, 400);
1420
1565
  } else
1421
- Q.value = !1;
1566
+ F.value = !1;
1422
1567
  }
1423
- function Ye() {
1568
+ function Pe() {
1424
1569
  if (window.innerWidth < 768)
1425
- return g.value ? {
1570
+ return p.value ? {
1426
1571
  x: 0,
1427
1572
  y: 0,
1428
1573
  w: window.innerWidth,
@@ -1435,243 +1580,290 @@ const xn = { class: "container" }, En = { class: "message ai-message greet-messa
1435
1580
  h: window.innerHeight - 16,
1436
1581
  radius: "14px"
1437
1582
  };
1438
- const T = window.innerHeight - 78;
1439
- let W = 54;
1440
- if (g.value) {
1441
- const ve = window.innerWidth * 0.8;
1583
+ const l = window.innerHeight - 78;
1584
+ let S = 54;
1585
+ if (p.value) {
1586
+ const Y = window.innerWidth * 0.8;
1442
1587
  return {
1443
- x: (window.innerWidth - ve) / 2,
1444
- y: W,
1445
- w: ve,
1446
- h: T,
1588
+ x: (window.innerWidth - Y) / 2,
1589
+ y: S,
1590
+ w: Y,
1591
+ h: l,
1447
1592
  radius: "14px"
1448
1593
  };
1449
1594
  }
1450
- const U = 490;
1451
- let z;
1452
- return M.value ? (z = Math.min(Math.max(w.x, q), Math.max(q, window.innerWidth - U - q)), W = Math.min(Math.max(w.y, q), Math.max(q, T - q))) : z = b.value === "left" ? 24 : window.innerWidth - U - 24, { x: z, y: W, w: U, h: T, radius: "14px" };
1595
+ return ct();
1453
1596
  }
1454
- function at() {
1597
+ function ct() {
1598
+ const n = Ee, l = window.innerHeight - 78;
1599
+ let S = 54, Y;
1600
+ return M.value ? (Y = Math.min(Math.max(C.x, I), Math.max(I, window.innerWidth - n - I)), S = Math.min(Math.max(C.y, Le), Math.max(I, l - I))) : Y = x.value === "left" ? 24 : window.innerWidth - n - 24, { x: Y, y: S, w: n, h: l, radius: "14px" };
1601
+ }
1602
+ function Jt() {
1603
+ var l, S;
1604
+ if (T.value) {
1605
+ Se(Ge(), Xt(), () => {
1606
+ m.value = !1, o.value = "idle", i.value = !0, setTimeout(() => {
1607
+ i.value = !1;
1608
+ }, 1400);
1609
+ }, "out"), (S = (l = u.dock) == null ? void 0 : l.onDockChange) == null || S.call(l, !1);
1610
+ return;
1611
+ }
1455
1612
  if (o.value !== "idle") return;
1456
- const a = Ye();
1457
- l.x = a.x, l.y = a.y, l.w = a.w, l.h = a.h, l.radius = a.radius, r.value = !0, o.value = "collapsing", te(() => {
1613
+ const n = Pe();
1614
+ c.x = n.x, c.y = n.y, c.w = n.w, c.h = n.h, c.radius = n.radius, d.value = !0, o.value = "collapsing", ae(() => {
1458
1615
  requestAnimationFrame(() => {
1459
- r.value = !1, l.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + ue.value * 3)), l.y = e.y + Math.abs(ue.value) * 2, l.w = 53, l.h = 53, l.radius = "50%";
1616
+ d.value = !1, c.x = Math.max(0, Math.min(window.innerWidth - 53, e.x + ne.value * 3)), c.y = e.y + Math.abs(ne.value) * 2, c.w = 53, c.h = 53, c.radius = "50%";
1460
1617
  });
1461
1618
  }), setTimeout(() => {
1462
- h.value = !1, o.value = "idle", i.value = !0;
1619
+ m.value = !1, o.value = "idle", i.value = !0;
1463
1620
  }, 400), setTimeout(() => {
1464
1621
  i.value = !1;
1465
1622
  }, 1400);
1466
1623
  }
1467
- function ot(a) {
1468
- ye(), D.value = "answer", te(() => {
1469
- var T;
1470
- (T = I.value) == null || T.goHistoryMessage(a);
1624
+ function qt(n) {
1625
+ _e(), H.value = "answer", ae(() => {
1626
+ var l;
1627
+ (l = Q.value) == null || l.goHistoryMessage(n);
1471
1628
  });
1472
1629
  }
1473
- function it() {
1474
- P.value = "", D.value = "answer", te(() => {
1475
- var a;
1476
- (a = I.value) == null || a.createNewConversation();
1630
+ function Kt() {
1631
+ _.value = "", H.value = "answer", ae(() => {
1632
+ var n;
1633
+ (n = Q.value) == null || n.createNewConversation();
1477
1634
  });
1478
1635
  }
1479
- function lt() {
1480
- ye(), P.value = "", te(() => {
1481
- var a;
1482
- (a = I.value) == null || a.createNewConversation();
1636
+ function Ut() {
1637
+ _e(), _.value = "", ae(() => {
1638
+ var n;
1639
+ (n = Q.value) == null || n.createNewConversation();
1483
1640
  });
1484
1641
  }
1485
- function ct() {
1486
- _.value = !1, x.value = !0;
1642
+ function jt() {
1643
+ W.value = !1, D.value = !0;
1487
1644
  }
1488
- function ye() {
1489
- _.value = !0, setTimeout(() => {
1490
- x.value = !1, _.value = !1;
1645
+ function _e() {
1646
+ W.value = !0, setTimeout(() => {
1647
+ D.value = !1, W.value = !1;
1491
1648
  }, 300);
1492
1649
  }
1493
- function rt() {
1494
- y.value = c.value, $.value = !1;
1495
- }
1496
- se(g, (a) => {
1497
- a ? b.value = "center" : ae();
1498
- }), se(h, (a) => {
1499
- a && M.value && te(() => Be());
1500
- }), ne(() => {
1501
- oe(), nt();
1502
- const a = f.theme || "light";
1503
- _e(a), a === "auto" && (re = xt(() => _e("auto")));
1650
+ function It() {
1651
+ k.value = v.value, P.value = !1;
1652
+ }
1653
+ re(p, (n) => {
1654
+ n ? x.value = "center" : Be();
1655
+ }), re(m, (n) => {
1656
+ n && M.value && ae(() => Ve());
1657
+ }), ue(() => {
1658
+ Lt(), Bt(), Yt(), Gt();
1659
+ const n = u.theme || "light";
1660
+ Ue(n), n === "auto" && (te = wn(() => Ue("auto")));
1504
1661
  });
1505
- function Ve() {
1506
- ce && clearTimeout(ce), ce = setTimeout(() => {
1507
- const a = window.innerWidth < 768;
1508
- u.value = a, a && (g.value = !0), F(), M.value && Be();
1662
+ function ut() {
1663
+ ge && clearTimeout(ge), ge = setTimeout(() => {
1664
+ const n = window.innerWidth < 768;
1665
+ r.value = n, n && (p.value = !0, T.value && lt()), Ze(), M.value && Ve(), T.value && (U.value = Ke(U.value));
1509
1666
  }, 100);
1510
1667
  }
1511
- return ne(() => {
1512
- window.addEventListener("resize", Ve);
1513
- }), Te(() => {
1514
- window.removeEventListener("resize", Ve), ce && clearTimeout(ce), re == null || re();
1515
- }), ne(() => {
1516
- document.addEventListener("mousemove", ee), document.addEventListener("touchmove", ee, { passive: !0 }), document.addEventListener("mouseup", fe), document.addEventListener("touchend", fe), document.addEventListener("mousemove", Se), document.addEventListener("touchmove", Se, { passive: !0 }), document.addEventListener("mouseup", Me), document.addEventListener("touchend", Me), document.addEventListener("click", We, !0);
1517
- }), Te(() => {
1518
- document.removeEventListener("mousemove", ee), document.removeEventListener("touchmove", ee), document.removeEventListener("mouseup", fe), document.removeEventListener("touchend", fe), document.removeEventListener("mousemove", Se), document.removeEventListener("touchmove", Se), document.removeEventListener("mouseup", Me), document.removeEventListener("touchend", Me), document.removeEventListener("click", We, !0);
1519
- }), (a, T) => (m(), A("div", null, [
1520
- de(n("div", {
1668
+ return ue(() => {
1669
+ window.addEventListener("resize", ut);
1670
+ }), qe(() => {
1671
+ window.removeEventListener("resize", ut), ge && clearTimeout(ge), te == null || te();
1672
+ }), ue(() => {
1673
+ document.addEventListener("mousemove", Ye), document.addEventListener("touchmove", Ye, { passive: !0 }), document.addEventListener("mouseup", Xe), document.addEventListener("touchend", Xe), document.addEventListener("mousemove", Fe), document.addEventListener("touchmove", Fe, { passive: !0 }), document.addEventListener("mouseup", Qe), document.addEventListener("touchend", Qe), document.addEventListener("click", nt, !0), document.addEventListener("mousemove", ze), document.addEventListener("touchmove", ze, { passive: !0 }), document.addEventListener("mouseup", Je), document.addEventListener("touchend", Je);
1674
+ }), qe(() => {
1675
+ document.removeEventListener("mousemove", Ye), document.removeEventListener("touchmove", Ye), document.removeEventListener("mouseup", Xe), document.removeEventListener("touchend", Xe), document.removeEventListener("mousemove", Fe), document.removeEventListener("touchmove", Fe), document.removeEventListener("mouseup", Qe), document.removeEventListener("touchend", Qe), document.removeEventListener("click", nt, !0), document.removeEventListener("mousemove", ze), document.removeEventListener("touchmove", ze), document.removeEventListener("mouseup", Je), document.removeEventListener("touchend", Je), he && clearTimeout(he), ve && cancelAnimationFrame(ve);
1676
+ }), (n, l) => (g(), A("div", null, [
1677
+ Me(s("div", {
1521
1678
  ref_key: "panelRef",
1522
- ref: p,
1679
+ ref: w,
1523
1680
  class: J([
1524
1681
  "ai-panel",
1525
- g.value ? "maxWrap" : "minWrap",
1526
- Ee.value,
1527
- { "panel-custom": M.value && !g.value && !u.value, dragging: d.value },
1682
+ p.value ? "maxWrap" : "minWrap",
1683
+ je.value,
1684
+ {
1685
+ "panel-custom": M.value && !p.value && !r.value && !T.value && de.value === "idle",
1686
+ dragging: f.value,
1687
+ "dock-preview": L.value,
1688
+ docked: T.value,
1689
+ "dock-resizing": q.value,
1690
+ "dock-switching": de.value !== "idle",
1691
+ "dock-switch-instant": $e.value,
1692
+ "dock-switch-fade-in": be.value === "in",
1693
+ "dock-switch-fade-out": be.value === "out",
1694
+ "no-drag": !Ie.value
1695
+ },
1528
1696
  o.value !== "idle" ? o.value : "",
1529
- { morphing: o.value !== "idle", "morph-instant": r.value }
1697
+ { morphing: o.value !== "idle", "morph-instant": d.value }
1530
1698
  ]),
1531
- style: xe([De.value, pe.value])
1699
+ style: We([Pt.value, $t.value, _t.value])
1532
1700
  }, [
1533
- n("div", {
1701
+ T.value ? (g(), A("div", {
1702
+ key: 0,
1703
+ class: "ai-dock-resizer",
1704
+ onMousedown: Ce(it, ["stop"]),
1705
+ onTouchstart: Ce(it, ["stop"])
1706
+ }, null, 32)) : B("", !0),
1707
+ s("div", {
1534
1708
  class: "header",
1535
- onMousedown: Ne,
1536
- onTouchstart: Ne
1709
+ onMousedown: tt,
1710
+ onTouchstart: tt
1537
1711
  }, [
1538
- D.value === "info" ? (m(), A("span", {
1712
+ H.value === "info" ? (g(), A("span", {
1539
1713
  key: 0,
1540
- class: J(["back", s.value]),
1541
- onClick: T[0] || (T[0] = (W) => D.value = "answer")
1542
- }, [...T[6] || (T[6] = [
1543
- n("span", { style: { "font-size": "14px" } }, "←", -1)
1544
- ])], 2)) : (m(), A("p", rs, [
1545
- n("img", {
1546
- src: H(Ie),
1714
+ class: J(["back", a.value]),
1715
+ onClick: l[0] || (l[0] = (S) => H.value = "answer")
1716
+ }, [...l[5] || (l[5] = [
1717
+ s("span", { style: { "font-size": "14px" } }, "←", -1)
1718
+ ])], 2)) : (g(), A("p", ea, [
1719
+ s("img", {
1720
+ src: O(Mt),
1547
1721
  draggable: "false"
1548
- }, null, 8, us)
1722
+ }, null, 8, ta)
1549
1723
  ])),
1550
- n("div", vs, [
1551
- n("span", {
1552
- title: D.value === "info" ? "个人信息" : P.value || H(f).name
1553
- }, V(D.value === "info" ? "个人信息" : P.value || H(f).name), 9, ds)
1724
+ s("div", na, [
1725
+ s("span", {
1726
+ title: H.value === "info" ? "个人信息" : _.value || O(u).name
1727
+ }, V(H.value === "info" ? "个人信息" : _.value || O(u).name), 9, sa)
1554
1728
  ]),
1555
- n("p", null, [
1556
- de(X(H(j), {
1729
+ s("p", null, [
1730
+ Me(G(O(j), {
1557
1731
  class: "op-icon",
1558
1732
  icon: "ic:round-add",
1559
- onClick: it
1733
+ onClick: Kt
1560
1734
  }, null, 512), [
1561
- [we, Re.value]
1735
+ [He, Tt.value]
1562
1736
  ]),
1563
- X(H(j), {
1564
- class: J(["mute", { active: x.value }]),
1737
+ G(O(j), {
1738
+ class: J(["mute", { active: D.value }]),
1565
1739
  icon: "ic:round-history",
1566
- onClick: T[1] || (T[1] = (W) => x.value ? ye() : ct())
1740
+ onClick: l[1] || (l[1] = (S) => D.value ? _e() : jt())
1567
1741
  }, null, 8, ["class"]),
1568
- u.value ? N("", !0) : (m(), Z(H(j), {
1742
+ !r.value && !T.value ? (g(), ee(O(j), {
1569
1743
  key: 0,
1570
- onClick: T[2] || (T[2] = (W) => g.value = !g.value),
1571
- icon: g.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1572
- }, null, 8, ["icon"])),
1573
- X(H(j), {
1574
- onClick: at,
1744
+ onClick: Vt,
1745
+ icon: p.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1746
+ }, null, 8, ["icon"])) : B("", !0),
1747
+ T.value ? (g(), ee(O(j), {
1748
+ key: 1,
1749
+ icon: "material-symbols:float-landscape-2-outline-rounded",
1750
+ onClick: lt
1751
+ })) : B("", !0),
1752
+ we.value && !T.value ? (g(), ee(O(j), {
1753
+ key: 2,
1754
+ icon: "boxicons:arrow-in-up-right-stroke-square",
1755
+ onClick: ot,
1756
+ class: "__minimize"
1757
+ })) : B("", !0),
1758
+ G(O(j), {
1759
+ onClick: Jt,
1575
1760
  icon: "ic:round-close"
1576
1761
  })
1577
1762
  ])
1578
1763
  ], 32),
1579
- de(X(Ln, {
1764
+ Me(G(Es, {
1580
1765
  ref_key: "answerRef",
1581
- ref: I,
1582
- defaultSayhello: H(f).defaultSayhello,
1583
- defaultRecommend: H(f).defaultRecommend,
1584
- onTitleGenerated: T[3] || (T[3] = (W) => P.value = W)
1766
+ ref: Q,
1767
+ defaultSayhello: O(u).defaultSayhello,
1768
+ defaultRecommend: O(u).defaultRecommend,
1769
+ onTitleGenerated: l[2] || (l[2] = (S) => _.value = S)
1585
1770
  }, null, 8, ["defaultSayhello", "defaultRecommend"]), [
1586
- [we, D.value === "answer"]
1771
+ [He, H.value === "answer"]
1587
1772
  ]),
1588
- D.value === "info" ? (m(), Z(cs, { key: 0 })) : N("", !0),
1589
- x.value ? (m(), A("div", {
1590
- key: 1,
1591
- class: J(["ai-history-drawer", { closing: _.value }])
1773
+ H.value === "info" ? (g(), ee(Zs, { key: 1 })) : B("", !0),
1774
+ D.value ? (g(), A("div", {
1775
+ key: 2,
1776
+ class: J(["ai-history-drawer", { closing: W.value }])
1592
1777
  }, [
1593
- n("div", {
1778
+ s("div", {
1594
1779
  class: "ai-history-backdrop",
1595
- onClick: ye
1780
+ onClick: _e
1596
1781
  }),
1597
- n("div", hs, [
1598
- n("div", ms, [
1599
- T[7] || (T[7] = n("span", null, "对话记录", -1)),
1600
- X(H(j), {
1782
+ s("div", aa, [
1783
+ s("div", oa, [
1784
+ l[6] || (l[6] = s("span", null, "对话记录", -1)),
1785
+ G(O(j), {
1601
1786
  icon: "ic:round-close",
1602
1787
  class: "ai-history-drawer-close",
1603
- onClick: ye
1788
+ onClick: _e
1604
1789
  })
1605
1790
  ]),
1606
- X(qn, {
1607
- onHistoryDetail: ot,
1608
- onNewConversation: lt
1791
+ G(Bs, {
1792
+ onHistoryDetail: qt,
1793
+ onNewConversation: Ut
1609
1794
  })
1610
1795
  ])
1611
- ], 2)) : N("", !0),
1612
- de(n("div", gs, [
1613
- n("div", ps, [
1614
- n("div", fs, [
1615
- T[8] || (T[8] = n("p", { class: "title" }, "修改标题", -1)),
1616
- de(n("textarea", {
1617
- "onUpdate:modelValue": T[4] || (T[4] = (W) => c.value = W),
1796
+ ], 2)) : B("", !0),
1797
+ Me(s("div", ia, [
1798
+ s("div", la, [
1799
+ s("div", ca, [
1800
+ l[7] || (l[7] = s("p", { class: "title" }, "修改标题", -1)),
1801
+ Me(s("textarea", {
1802
+ "onUpdate:modelValue": l[3] || (l[3] = (S) => v.value = S),
1618
1803
  placeholder: "请输入新标题"
1619
1804
  }, null, 512), [
1620
- [gt, c.value]
1805
+ [ln, v.value]
1621
1806
  ]),
1622
- n("p", ys, [
1623
- n("span", {
1624
- onClick: T[5] || (T[5] = (W) => $.value = !1)
1807
+ s("p", ua, [
1808
+ s("span", {
1809
+ onClick: l[4] || (l[4] = (S) => P.value = !1)
1625
1810
  }, "取消"),
1626
- n("span", { onClick: rt }, "确定")
1811
+ s("span", { onClick: It }, "确定")
1627
1812
  ])
1628
1813
  ])
1629
1814
  ])
1630
1815
  ], 512), [
1631
- [we, $.value]
1816
+ [He, P.value]
1632
1817
  ])
1633
1818
  ], 6), [
1634
- [we, h.value || o.value !== "idle"]
1819
+ [He, m.value || o.value !== "idle"]
1635
1820
  ]),
1636
- de(n("div", {
1637
- class: J(["character", { dragging: v.value, recycling: E.value, "hover-preview": i.value }]),
1638
- style: xe($e.value),
1639
- onMousedown: Oe,
1640
- onTouchstart: Oe,
1641
- onClick: st
1821
+ L.value && we.value ? (g(), A("div", {
1822
+ key: 0,
1823
+ class: "ai-dock-preview",
1824
+ style: We({ width: U.value + "px" })
1825
+ }, [...l[8] || (l[8] = [
1826
+ s("span", { class: "ai-dock-preview__text" }, "松开以停靠到右侧", -1)
1827
+ ])], 4)) : B("", !0),
1828
+ Me(s("div", {
1829
+ class: J(["character", { dragging: h.value, recycling: R.value, "hover-preview": i.value }]),
1830
+ style: We(Dt.value),
1831
+ onMousedown: et,
1832
+ onTouchstart: et,
1833
+ onClick: zt
1642
1834
  }, [
1643
- n("img", { src: Pe.value }, null, 8, ws)
1835
+ s("img", { src: Rt.value }, null, 8, ra)
1644
1836
  ], 38), [
1645
- [we, !h.value]
1837
+ [He, !m.value]
1646
1838
  ])
1647
1839
  ]));
1648
1840
  }
1649
- }), As = ["data-theme"], bs = {
1841
+ }), ga = ["data-theme"], fa = {
1650
1842
  key: 0,
1651
1843
  class: "ai-voice-input-final"
1652
- }, Ss = {
1844
+ }, pa = {
1653
1845
  key: 1,
1654
1846
  class: "ai-voice-input-interim"
1655
- }, Ms = {
1847
+ }, ya = {
1656
1848
  key: 2,
1657
1849
  class: "ai-voice-input-cursor"
1658
- }, Ts = {
1850
+ }, wa = {
1659
1851
  key: 3,
1660
1852
  class: "ai-voice-input-placeholder"
1661
- }, xs = ["disabled"], Es = {
1853
+ }, ka = ["disabled"], Ca = {
1662
1854
  key: 0,
1663
1855
  class: "ai-voice-input-pulse"
1664
- }, Rs = {
1856
+ }, Aa = {
1665
1857
  key: 1,
1666
1858
  class: "ai-voice-input-wave"
1667
- }, $s = {
1859
+ }, ba = {
1668
1860
  key: 2,
1669
1861
  class: "ai-voice-input-btn-icon",
1670
1862
  viewBox: "0 0 24 24",
1671
1863
  fill: "currentColor",
1672
1864
  width: "16",
1673
1865
  height: "16"
1674
- }, Ps = /* @__PURE__ */ le({
1866
+ }, Sa = /* @__PURE__ */ pe({
1675
1867
  __name: "VoiceInput",
1676
1868
  props: {
1677
1869
  config: {},
@@ -1683,130 +1875,130 @@ const xn = { class: "container" }, En = { class: "message ai-message greet-messa
1683
1875
  className: {}
1684
1876
  },
1685
1877
  emits: ["result", "final", "error", "statusChange", "complete"],
1686
- setup(t, { expose: C, emit: f }) {
1687
- const h = t, o = f, r = {
1878
+ setup(t, { expose: b, emit: u }) {
1879
+ const m = t, o = u, d = {
1688
1880
  idle: "开始录音",
1689
1881
  connecting: "连接中…",
1690
1882
  recording: "停止录音",
1691
1883
  stopping: "识别中…",
1692
1884
  error: "重试"
1693
- }, l = k(""), i = k(""), u = k("idle");
1694
- let g = null;
1695
- const D = Y(() => Et(h.config.theme ?? "light")), $ = () => {
1696
- g = new Ke(h.config, {
1697
- onStatusChange: (v) => {
1698
- u.value = v, o("statusChange", v), v === "idle" && o("complete", l.value);
1885
+ }, c = y(""), i = y(""), r = y("idle");
1886
+ let p = null;
1887
+ const H = X(() => kn(m.config.theme ?? "light")), P = () => {
1888
+ p = new St(m.config, {
1889
+ onStatusChange: (h) => {
1890
+ r.value = h, o("statusChange", h), h === "idle" && o("complete", c.value);
1699
1891
  },
1700
- onInterim: (v) => {
1701
- i.value = v;
1892
+ onInterim: (h) => {
1893
+ i.value = h;
1702
1894
  },
1703
- onFinal: (v, E) => {
1704
- l.value += v, i.value = "", o("final", v, E);
1895
+ onFinal: (h, R) => {
1896
+ c.value += h, i.value = "", o("final", h, R);
1705
1897
  },
1706
- onResult: (v) => o("result", v),
1707
- onError: (v) => o("error", v)
1898
+ onResult: (h) => o("result", h),
1899
+ onError: (h) => o("error", h)
1708
1900
  });
1709
1901
  };
1710
- ne($), ze(() => {
1711
- g == null || g.destroy(), g = null;
1712
- }), se(
1713
- () => [h.config.appId, h.config.appKey, h.config.devPid, h.config.url],
1902
+ ue(P), bt(() => {
1903
+ p == null || p.destroy(), p = null;
1904
+ }), re(
1905
+ () => [m.config.appId, m.config.appKey, m.config.devPid, m.config.url],
1714
1906
  () => {
1715
- g == null || g.destroy(), $();
1907
+ p == null || p.destroy(), P();
1716
1908
  }
1717
1909
  );
1718
- const c = async () => {
1719
- if (g)
1720
- if (u.value === "idle" || u.value === "error")
1910
+ const v = async () => {
1911
+ if (p)
1912
+ if (r.value === "idle" || r.value === "error")
1721
1913
  try {
1722
- await g.start();
1914
+ await p.start();
1723
1915
  } catch {
1724
1916
  }
1725
- else u.value === "recording" && g.stop();
1726
- }, y = () => {
1727
- l.value = "", i.value = "";
1728
- }, P = Y(() => !l.value && !i.value), x = Y(() => u.value === "connecting" ? h.connectingText || r.connecting : u.value === "recording" ? h.stopText || r.recording : u.value === "stopping" ? h.stoppingText || r.stopping : u.value === "error" ? r.error : h.startText || r.idle), _ = Y(() => {
1729
- const v = ["ai-voice-input-btn"];
1730
- return u.value === "recording" && v.push("is-recording"), u.value === "connecting" && v.push("is-connecting"), u.value === "stopping" && v.push("is-stopping"), v.join(" ");
1731
- }), e = Y(() => u.value === "connecting" || u.value === "stopping");
1732
- return C({
1917
+ else r.value === "recording" && p.stop();
1918
+ }, k = () => {
1919
+ c.value = "", i.value = "";
1920
+ }, _ = X(() => !c.value && !i.value), D = X(() => r.value === "connecting" ? m.connectingText || d.connecting : r.value === "recording" ? m.stopText || d.recording : r.value === "stopping" ? m.stoppingText || d.stopping : r.value === "error" ? d.error : m.startText || d.idle), W = X(() => {
1921
+ const h = ["ai-voice-input-btn"];
1922
+ return r.value === "recording" && h.push("is-recording"), r.value === "connecting" && h.push("is-connecting"), r.value === "stopping" && h.push("is-stopping"), h.join(" ");
1923
+ }), e = X(() => r.value === "connecting" || r.value === "stopping");
1924
+ return b({
1733
1925
  start: async () => {
1734
- await (g == null ? void 0 : g.start());
1926
+ await (p == null ? void 0 : p.start());
1735
1927
  },
1736
- stop: () => g == null ? void 0 : g.stop(),
1737
- cancel: () => g == null ? void 0 : g.cancel(),
1738
- getText: () => l.value + i.value,
1928
+ stop: () => p == null ? void 0 : p.stop(),
1929
+ cancel: () => p == null ? void 0 : p.cancel(),
1930
+ getText: () => c.value + i.value,
1739
1931
  clear: () => {
1740
- l.value = "", i.value = "";
1932
+ c.value = "", i.value = "";
1741
1933
  },
1742
- getStatus: () => (g == null ? void 0 : g.getStatus()) ?? "idle"
1743
- }), (v, E) => (m(), A("div", {
1934
+ getStatus: () => (p == null ? void 0 : p.getStatus()) ?? "idle"
1935
+ }), (h, R) => (g(), A("div", {
1744
1936
  class: J(["ai-voice-input", t.className]),
1745
- "data-theme": D.value
1937
+ "data-theme": H.value
1746
1938
  }, [
1747
- n("div", {
1748
- class: J(["ai-voice-input-display", { "is-empty": P.value }])
1939
+ s("div", {
1940
+ class: J(["ai-voice-input-display", { "is-empty": _.value }])
1749
1941
  }, [
1750
- l.value ? (m(), A("span", bs, V(l.value), 1)) : N("", !0),
1751
- i.value ? (m(), A("span", Ss, V(i.value), 1)) : N("", !0),
1752
- u.value === "recording" && !i.value ? (m(), A("span", Ms)) : N("", !0),
1753
- P.value ? (m(), A("span", Ts, V(t.placeholder), 1)) : N("", !0)
1942
+ c.value ? (g(), A("span", fa, V(c.value), 1)) : B("", !0),
1943
+ i.value ? (g(), A("span", pa, V(i.value), 1)) : B("", !0),
1944
+ r.value === "recording" && !i.value ? (g(), A("span", ya)) : B("", !0),
1945
+ _.value ? (g(), A("span", wa, V(t.placeholder), 1)) : B("", !0)
1754
1946
  ], 2),
1755
- n("button", {
1947
+ s("button", {
1756
1948
  type: "button",
1757
- class: J(_.value),
1949
+ class: J(W.value),
1758
1950
  disabled: e.value,
1759
- onClick: c
1951
+ onClick: v
1760
1952
  }, [
1761
- u.value === "recording" ? (m(), A("span", Es)) : u.value === "connecting" || u.value === "stopping" ? (m(), A("span", Rs, [...E[0] || (E[0] = [
1762
- n("span", null, null, -1),
1763
- n("span", null, null, -1),
1764
- n("span", null, null, -1),
1765
- n("span", null, null, -1),
1766
- n("span", null, null, -1)
1767
- ])])) : (m(), A("svg", $s, [...E[1] || (E[1] = [
1768
- n("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
1769
- n("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)
1953
+ r.value === "recording" ? (g(), A("span", Ca)) : r.value === "connecting" || r.value === "stopping" ? (g(), A("span", Aa, [...R[0] || (R[0] = [
1954
+ s("span", null, null, -1),
1955
+ s("span", null, null, -1),
1956
+ s("span", null, null, -1),
1957
+ s("span", null, null, -1),
1958
+ s("span", null, null, -1)
1959
+ ])])) : (g(), A("svg", ba, [...R[1] || (R[1] = [
1960
+ s("path", { d: "M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z" }, null, -1),
1961
+ s("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)
1770
1962
  ])])),
1771
- n("span", null, V(x.value), 1)
1772
- ], 10, xs),
1773
- P.value ? N("", !0) : (m(), A("button", {
1963
+ s("span", null, V(D.value), 1)
1964
+ ], 10, ka),
1965
+ _.value ? B("", !0) : (g(), A("button", {
1774
1966
  key: 0,
1775
1967
  type: "button",
1776
1968
  class: "ai-voice-input-btn ai-voice-input-clear-btn",
1777
1969
  title: "清空",
1778
- onClick: y
1970
+ onClick: k
1779
1971
  }, " 清空 "))
1780
- ], 10, As));
1972
+ ], 10, ga));
1781
1973
  }
1782
- }), Ds = (t, C) => {
1783
- const f = t.__vccOpts || t;
1784
- for (const [h, o] of C)
1785
- f[h] = o;
1786
- return f;
1787
- }, Hs = /* @__PURE__ */ Ds(Ps, [["__scopeId", "data-v-5b959b70"]]);
1788
- let Ae = null;
1789
- const Ws = (t) => {
1790
- Ze(t);
1791
- }, Ys = (t) => {
1792
- const C = t || document.body, f = document.createElement("div");
1793
- f.id = "ai-assist-root";
1794
- const h = ge();
1795
- _e(h.theme), Rt(), C.appendChild(f), Ae = pt(et), Ae.mount(f);
1796
- }, Vs = () => {
1797
- Ae && (Ae.unmount(), Ae = null);
1974
+ }), xa = (t, b) => {
1975
+ const u = t.__vccOpts || t;
1976
+ for (const [m, o] of b)
1977
+ u[m] = o;
1978
+ return u;
1979
+ }, Ma = /* @__PURE__ */ xa(Sa, [["__scopeId", "data-v-5b959b70"]]);
1980
+ let Ne = null;
1981
+ const Pa = (t) => {
1982
+ xt(t);
1983
+ }, _a = (t) => {
1984
+ const b = t || document.body, u = document.createElement("div");
1985
+ u.id = "ai-assist-root";
1986
+ const m = Re();
1987
+ Ue(m.theme), Cn(), b.appendChild(u), Ne = cn(Et), Ne.mount(u);
1988
+ }, Ha = () => {
1989
+ Ne && (Ne.unmount(), Ne = null);
1798
1990
  const t = document.getElementById("ai-assist-root");
1799
1991
  t && t.remove();
1800
- }, Xs = {
1801
- install(t, C) {
1802
- Ze(C), t.component("AiAssist", et), t.component("VoiceInput", Hs);
1992
+ }, Oa = {
1993
+ install(t, b) {
1994
+ xt(b), t.component("AiAssist", Et), t.component("VoiceInput", Ma);
1803
1995
  }
1804
1996
  };
1805
1997
  export {
1806
- et as AiAssist,
1807
- Hs as VoiceInput,
1808
- Xs as default,
1809
- Ws as initAiAssist,
1810
- Ys as mountAiAssist,
1811
- Vs as unmountAiAssist
1998
+ Et as AiAssist,
1999
+ Ma as VoiceInput,
2000
+ Oa as default,
2001
+ Pa as initAiAssist,
2002
+ _a as mountAiAssist,
2003
+ Ha as unmountAiAssist
1812
2004
  };