@somecat/ai-assist-sdk 1.2.2 → 1.2.3

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