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