@somecat/ai-assist-sdk 1.1.10 → 1.1.12

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,33 +1,33 @@
1
- import { defineComponent as st, reactive as K, openBlock as p, createElementBlock as k, normalizeClass as J, Fragment as U, createStaticVNode as Dt, createCommentVNode as _, renderList as nt, createElementVNode as n, createVNode as V, unref as H, toDisplayString as W, Transition as Ot, withCtx as Ht, createBlock as rt, withKeys as $t, ref as E, nextTick as it, computed as x, watch as Et, onMounted as z, onUnmounted as yt, normalizeStyle as Rt, withModifiers as kt, Teleport as Pt, withDirectives as ut, vShow as pt, vModelText as Bt, createApp as Lt } from "vue";
2
- import { r as wt, p as Ct, u as Nt, c as At, g as Yt, s as Qt, a as bt, e as Xt, b as Wt, d as vt, f as _t, h as Gt, i as Vt, j as Jt, k as Ft, l as Mt } from "../chunks/index-DwhpwWON.mjs";
3
- import { SearchOutlined as jt, CheckOutlined as Ut, CopyOutlined as qt, RedoOutlined as xt } from "@ant-design/icons-vue";
4
- import { Icon as j } from "@iconify/vue";
5
- import { f as zt, s as et, a as Kt, b as Zt, c as It } from "../chunks/index-CgnkZbtP.mjs";
6
- const te = "data:image/png;base64,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", ee = {
1
+ import { defineComponent as rt, reactive as z, openBlock as y, createElementBlock as S, normalizeClass as F, Fragment as K, createStaticVNode as Nt, createCommentVNode as _, renderList as lt, createElementVNode as n, createVNode as G, unref as $, toDisplayString as X, Transition as Yt, withCtx as Wt, createBlock as gt, withKeys as xt, ref as E, nextTick as tt, computed as j, watch as Ot, onMounted as et, onUnmounted as bt, normalizeStyle as St, withModifiers as Et, Teleport as Qt, withDirectives as pt, vShow as At, vModelText as Xt, createApp as _t } from "vue";
2
+ import { r as Rt, p as Tt, u as Gt, c as Mt, g as Vt, s as Ft, a as Dt, e as Jt, b as qt, d as yt, f as jt, h as Ut, i as zt, j as Kt, k as Zt, l as $t } from "../chunks/index-DwhpwWON.mjs";
3
+ import { SearchOutlined as It, CheckOutlined as te, CopyOutlined as ee, RedoOutlined as ne } from "@ant-design/icons-vue";
4
+ import { Icon as U } from "@iconify/vue";
5
+ import { f as se, s as it, a as oe, b as ae, c as ie } from "../chunks/index-CgnkZbtP.mjs";
6
+ const le = "data:image/png;base64,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", re = {
7
7
  key: 0,
8
8
  class: "message-content ba-markdown"
9
- }, ne = { class: "agent-thought__spinner" }, se = { class: "agent-thought__text" }, oe = ["onClick"], ae = { class: "thinking-block__title" }, ie = {
9
+ }, ce = { class: "agent-thought__spinner" }, ue = { class: "agent-thought__text" }, ve = ["onClick"], de = { class: "thinking-block__title" }, ge = {
10
10
  key: 0,
11
11
  class: "thinking-block__content"
12
- }, le = { key: 2 }, re = ["innerHTML"], ce = {
12
+ }, he = { key: 2 }, me = ["innerHTML"], fe = {
13
13
  key: 0,
14
14
  class: "streaming-cursor"
15
- }, ue = ["innerHTML"], ve = {
15
+ }, pe = ["innerHTML"], ye = {
16
16
  key: 0,
17
17
  class: "streaming-cursor"
18
- }, de = {
18
+ }, we = {
19
19
  key: 3,
20
20
  class: "message-error"
21
- }, ge = {
21
+ }, ke = {
22
22
  key: 4,
23
23
  class: "message-toolbar"
24
- }, me = ["data-tooltip"], fe = {
24
+ }, Ce = ["data-tooltip"], Ae = {
25
25
  class: "tooltip-enhanced",
26
26
  "data-tooltip": "重新回答"
27
- }, he = {
27
+ }, be = {
28
28
  key: 1,
29
29
  class: "message-content"
30
- }, pe = /* @__PURE__ */ st({
30
+ }, Se = /* @__PURE__ */ rt({
31
31
  __name: "MessageItem",
32
32
  props: {
33
33
  msg: {},
@@ -38,62 +38,62 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
38
38
  setMessageRef: { type: Function }
39
39
  },
40
40
  emits: ["regenerate"],
41
- setup(t, { emit: u }) {
42
- const r = K(/* @__PURE__ */ new Map());
43
- function c(g) {
44
- r.set(g, r.get(g) !== !0);
41
+ setup(t, { emit: d }) {
42
+ const r = z(/* @__PURE__ */ new Map());
43
+ function c(i) {
44
+ r.set(i, r.get(i) !== !0);
45
45
  }
46
- const a = K(/* @__PURE__ */ new Map());
47
- function v(g, o) {
48
- var w;
46
+ const s = z(/* @__PURE__ */ new Map());
47
+ function m(i, o) {
48
+ var p;
49
49
  try {
50
- let f = g.content;
51
- if (!f && ((w = g.segments) != null && w.length) && (f = g.segments.filter((M) => M.type !== "thinking" && M.type !== "agent_thought").map((M) => M.content).join(`
52
- `)), f) {
53
- const { copy: M } = Nt();
54
- M(f), a.set(o, !0), setTimeout(() => a.set(o, !1), 2e3);
50
+ let g = i.content;
51
+ if (!g && ((p = i.segments) != null && p.length) && (g = i.segments.filter((T) => T.type !== "thinking" && T.type !== "agent_thought").map((T) => T.content).join(`
52
+ `)), g) {
53
+ const { copy: T } = Gt();
54
+ T(g), s.set(o, !0), setTimeout(() => s.set(o, !1), 2e3);
55
55
  }
56
56
  } catch {
57
57
  }
58
58
  }
59
- return (g, o) => {
60
- var w;
61
- return p(), k("div", {
62
- class: J(["message", `${t.msg.type}-message`])
59
+ return (i, o) => {
60
+ var p;
61
+ return y(), S("div", {
62
+ class: F(["message", `${t.msg.type}-message`])
63
63
  }, [
64
- t.msg.type === "ai" ? (p(), k(U, { key: 0 }, [
65
- (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (p(), k("div", ee, [...o[2] || (o[2] = [
66
- Dt('<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)
64
+ t.msg.type === "ai" ? (y(), S(K, { key: 0 }, [
65
+ (t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (y(), S("div", re, [...o[2] || (o[2] = [
66
+ Nt('<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)
67
67
  ])])) : _("", !0),
68
- t.msg.segments && t.msg.segments.length ? (p(), k("div", {
68
+ t.msg.segments && t.msg.segments.length ? (y(), S("div", {
69
69
  key: 1,
70
70
  class: "message-content ba-markdown",
71
- ref: (f) => t.setMessageRef(f, t.index)
71
+ ref: (g) => t.setMessageRef(g, t.index)
72
72
  }, [
73
- (p(!0), k(U, null, nt(t.msg.segments, (f, M) => (p(), k(U, { key: M }, [
74
- f.type === "agent_thought" ? (p(), k("div", {
73
+ (y(!0), S(K, null, lt(t.msg.segments, (g, T) => (y(), S(K, { key: T }, [
74
+ g.type === "agent_thought" ? (y(), S("div", {
75
75
  key: 0,
76
- class: J(["agent-thought", { "agent-thought--done": f.duration != null }])
76
+ class: F(["agent-thought", { "agent-thought--done": g.duration != null }])
77
77
  }, [
78
- n("span", ne, [
79
- V(H(jt))
78
+ n("span", ce, [
79
+ G($(It))
80
80
  ]),
81
- n("span", se, W(f.duration != null ? "工具调用" : "工具调用中..."), 1)
82
- ], 2)) : f.type === "thinking" ? (p(), k("div", {
81
+ n("span", ue, X(g.duration != null ? "工具调用" : "工具调用中..."), 1)
82
+ ], 2)) : g.type === "thinking" ? (y(), S("div", {
83
83
  key: 1,
84
- class: J(["thinking-block", {
85
- "thinking-block--expanded": r.get(M) === !0,
86
- "thinking-block--active": f.duration == null
84
+ class: F(["thinking-block", {
85
+ "thinking-block--expanded": r.get(T) === !0,
86
+ "thinking-block--active": g.duration == null
87
87
  }])
88
88
  }, [
89
89
  n("div", {
90
90
  class: "thinking-block__header",
91
- onClick: (T) => c(M)
91
+ onClick: (M) => c(T)
92
92
  }, [
93
93
  o[4] || (o[4] = n("span", { class: "thinking-block__indicator" }, null, -1)),
94
- n("span", ae, W(f.duration != null ? "深度思考" : "深度思考中"), 1),
95
- (p(), k("svg", {
96
- class: J(["thinking-block__arrow", { "thinking-block__arrow--down": r.get(M) === !0 }]),
94
+ n("span", de, X(g.duration != null ? "深度思考" : "深度思考中"), 1),
95
+ (y(), S("svg", {
96
+ class: F(["thinking-block__arrow", { "thinking-block__arrow--down": r.get(T) === !0 }]),
97
97
  viewBox: "0 0 24 24",
98
98
  width: "14",
99
99
  height: "14",
@@ -105,66 +105,66 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
105
105
  }, [...o[3] || (o[3] = [
106
106
  n("polyline", { points: "6 9 12 15 18 9" }, null, -1)
107
107
  ])], 2))
108
- ], 8, oe),
109
- V(Ot, { name: "thinking-expand" }, {
110
- default: Ht(() => [
111
- r.get(M) === !0 ? (p(), k("div", ie, W(f.content), 1)) : _("", !0)
108
+ ], 8, ve),
109
+ G(Yt, { name: "thinking-expand" }, {
110
+ default: Wt(() => [
111
+ r.get(T) === !0 ? (y(), S("div", ge, X(g.content), 1)) : _("", !0)
112
112
  ]),
113
113
  _: 2
114
114
  }, 1024)
115
- ], 2)) : (p(), k("div", le, [
115
+ ], 2)) : (y(), S("div", he, [
116
116
  n("div", {
117
- innerHTML: H(wt)(H(Ct)(t.getSegmentDisplayContent(t.index, M, f, t.msg)))
118
- }, null, 8, re)
117
+ innerHTML: $(Rt)($(Tt)(t.getSegmentDisplayContent(t.index, T, g, t.msg)))
118
+ }, null, 8, me)
119
119
  ]))
120
120
  ], 64))), 128)),
121
- t.msg.status === t.STATUS.ANSWERING ? (p(), k("span", ce)) : _("", !0)
121
+ t.msg.status === t.STATUS.ANSWERING ? (y(), S("span", fe)) : _("", !0)
122
122
  ], 512)) : _("", !0),
123
- !((w = t.msg.segments) != null && w.length) && t.msg.content ? (p(), k("div", {
123
+ !((p = t.msg.segments) != null && p.length) && t.msg.content ? (y(), S("div", {
124
124
  key: 2,
125
125
  class: "message-content ba-markdown",
126
- ref: (f) => t.setMessageRef(f, t.index)
126
+ ref: (g) => t.setMessageRef(g, t.index)
127
127
  }, [
128
128
  n("div", {
129
- innerHTML: H(wt)(H(Ct)(t.displayedContent.get(t.index) ?? t.msg.content))
130
- }, null, 8, ue),
131
- t.msg.status === t.STATUS.ANSWERING ? (p(), k("span", ve)) : _("", !0)
129
+ innerHTML: $(Rt)($(Tt)(t.displayedContent.get(t.index) ?? t.msg.content))
130
+ }, null, 8, pe),
131
+ t.msg.status === t.STATUS.ANSWERING ? (y(), S("span", ye)) : _("", !0)
132
132
  ], 512)) : _("", !0),
133
- t.msg.errorMessage ? (p(), k("div", de, [
133
+ t.msg.errorMessage ? (y(), S("div", we, [
134
134
  o[5] || (o[5] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
135
- n("span", null, W(t.msg.errorMessage), 1)
135
+ n("span", null, X(t.msg.errorMessage), 1)
136
136
  ])) : _("", !0),
137
- t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (p(), k("div", ge, [
137
+ t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (y(), S("div", ke, [
138
138
  n("div", {
139
139
  class: "tooltip-enhanced",
140
- "data-tooltip": a.get(t.index) ? "已复制" : "复制回答"
140
+ "data-tooltip": s.get(t.index) ? "已复制" : "复制回答"
141
141
  }, [
142
- a.get(t.index) ? (p(), rt(H(Ut), {
142
+ s.get(t.index) ? (y(), gt($(te), {
143
143
  key: 0,
144
144
  class: "message-toolbar__check"
145
- })) : (p(), rt(H(qt), {
145
+ })) : (y(), gt($(ee), {
146
146
  key: 1,
147
- onClick: o[0] || (o[0] = (f) => v(t.msg, t.index))
147
+ onClick: o[0] || (o[0] = (g) => m(t.msg, t.index))
148
148
  }))
149
- ], 8, me),
150
- n("div", fe, [
151
- V(H(xt), {
152
- onClick: o[1] || (o[1] = (f) => g.$emit("regenerate"))
149
+ ], 8, Ce),
150
+ n("div", Ae, [
151
+ G($(ne), {
152
+ onClick: o[1] || (o[1] = (g) => i.$emit("regenerate"))
153
153
  })
154
154
  ])
155
155
  ])) : _("", !0)
156
- ], 64)) : (p(), k("div", he, W(t.msg.content), 1))
156
+ ], 64)) : (y(), S("div", be, X(t.msg.content), 1))
157
157
  ], 2);
158
158
  };
159
159
  }
160
- }), ye = { class: "input-container" }, ke = ["value", "disabled"], we = {
160
+ }), Ee = { class: "input-container" }, Re = ["value", "disabled"], Te = {
161
161
  key: 0,
162
162
  class: "tooltip-enhanced stop",
163
163
  "data-tooltip": "停止生成"
164
- }, Ce = ["data-tooltip"], Ae = {
164
+ }, Me = ["data-tooltip"], De = {
165
165
  key: 2,
166
166
  class: "moveTB"
167
- }, be = /* @__PURE__ */ st({
167
+ }, He = /* @__PURE__ */ rt({
168
168
  __name: "ChatInput",
169
169
  props: {
170
170
  modelValue: {},
@@ -175,70 +175,70 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
175
175
  },
176
176
  emits: ["update:modelValue", "send", "stop", "scroll-to-bottom"],
177
177
  setup(t) {
178
- return (u, r) => (p(), k("div", ye, [
178
+ return (d, r) => (y(), S("div", Ee, [
179
179
  n("input", {
180
180
  value: t.modelValue,
181
181
  type: "text",
182
182
  placeholder: "给AI助手发送消息...",
183
- onInput: r[0] || (r[0] = (c) => u.$emit("update:modelValue", c.target.value)),
184
- onKeyup: r[1] || (r[1] = $t((c) => t.modelValue.trim() && u.$emit("send"), ["enter"])),
183
+ onInput: r[0] || (r[0] = (c) => d.$emit("update:modelValue", c.target.value)),
184
+ onKeyup: r[1] || (r[1] = xt((c) => t.modelValue.trim() && d.$emit("send"), ["enter"])),
185
185
  disabled: t.isGenerating
186
- }, null, 40, ke),
187
- t.isGenerating && t.lastUserMessage ? (p(), k("div", we, [
188
- V(H(j), {
186
+ }, null, 40, Re),
187
+ t.isGenerating && t.lastUserMessage ? (y(), S("div", Te, [
188
+ G($(U), {
189
189
  class: "op-icon stop-icon",
190
190
  icon: "heroicons-solid:stop",
191
- onClick: r[2] || (r[2] = (c) => u.$emit("stop"))
191
+ onClick: r[2] || (r[2] = (c) => d.$emit("stop"))
192
192
  })
193
- ])) : (p(), k("div", {
193
+ ])) : (y(), S("div", {
194
194
  key: 1,
195
- class: J(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
195
+ class: F(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
196
196
  "data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
197
197
  }, [
198
- V(H(j), {
198
+ G($(U), {
199
199
  class: "op-icon",
200
200
  icon: "fluent-color:send-16",
201
- onClick: r[3] || (r[3] = (c) => t.modelValue.trim() && u.$emit("send"))
201
+ onClick: r[3] || (r[3] = (c) => t.modelValue.trim() && d.$emit("send"))
202
202
  })
203
- ], 10, Ce)),
204
- t.hasScroll && !t.isAtBottom ? (p(), k("div", Ae, [
205
- V(H(j), {
203
+ ], 10, Me)),
204
+ t.hasScroll && !t.isAtBottom ? (y(), S("div", De, [
205
+ G($(U), {
206
206
  class: "op-icon",
207
207
  icon: "ep:bottom",
208
- onClick: r[4] || (r[4] = (c) => u.$emit("scroll-to-bottom"))
208
+ onClick: r[4] || (r[4] = (c) => d.$emit("scroll-to-bottom"))
209
209
  })
210
210
  ])) : _("", !0)
211
211
  ]));
212
212
  }
213
213
  });
214
- function Se(t) {
215
- const u = E(!0), r = E(!1);
214
+ function Oe(t) {
215
+ const d = E(!0), r = E(!1);
216
216
  function c() {
217
- it(() => {
217
+ tt(() => {
218
218
  t.value && (t.value.scrollTop = t.value.scrollHeight);
219
219
  });
220
220
  }
221
- function a() {
221
+ function s() {
222
222
  if (!t.value) return;
223
- const v = t.value, g = v.scrollTop + v.clientHeight >= v.scrollHeight - 1, o = v.scrollHeight > v.clientHeight;
224
- u.value = g, r.value = o;
223
+ const m = t.value, i = m.scrollTop + m.clientHeight >= m.scrollHeight - 1, o = m.scrollHeight > m.clientHeight;
224
+ d.value = i, r.value = o;
225
225
  }
226
- return { isAtBottom: u, hasScroll: r, scrollToBottom: c, checkScrollStatus: a };
226
+ return { isAtBottom: d, hasScroll: r, scrollToBottom: c, checkScrollStatus: s };
227
227
  }
228
- function Ee() {
229
- function t(u) {
230
- u.querySelectorAll("pre").forEach((c) => {
228
+ function $e() {
229
+ function t(d) {
230
+ d.querySelectorAll("pre").forEach((c) => {
231
231
  if (c.querySelector(".copy-button")) return;
232
- const a = c.querySelector("code");
233
- if (!a) return;
234
- const g = (Array.from(a.classList).find((w) => w.startsWith("language-")) || "").replace("language-", "");
235
- if (g) {
236
- const w = document.createElement("span");
237
- w.className = "code-lang", w.textContent = g, c.appendChild(w);
232
+ const s = c.querySelector("code");
233
+ if (!s) return;
234
+ const i = (Array.from(s.classList).find((p) => p.startsWith("language-")) || "").replace("language-", "");
235
+ if (i) {
236
+ const p = document.createElement("span");
237
+ p.className = "code-lang", p.textContent = i, c.appendChild(p);
238
238
  }
239
239
  const o = document.createElement("button");
240
240
  o.className = "copy-button", o.textContent = "复制", o.onclick = () => {
241
- navigator.clipboard.writeText(a.textContent || "").then(() => {
241
+ navigator.clipboard.writeText(s.textContent || "").then(() => {
242
242
  o.textContent = "已复制", setTimeout(() => {
243
243
  o.textContent = "复制";
244
244
  }, 2e3);
@@ -248,287 +248,287 @@ function Ee() {
248
248
  }
249
249
  return { enhanceCodeBlocks: t };
250
250
  }
251
- function Re(t) {
252
- let u = null, r = 0;
253
- function c(v) {
254
- u = v(u || [...t.value]), r || (r = requestAnimationFrame(() => {
255
- r = 0, u && (t.value = u, u = null);
251
+ function Pe(t) {
252
+ let d = null, r = 0;
253
+ function c(m) {
254
+ d = m(d || [...t.value]), r || (r = requestAnimationFrame(() => {
255
+ r = 0, d && (t.value = d, d = null);
256
256
  }));
257
257
  }
258
- function a() {
259
- r && (cancelAnimationFrame(r), r = 0), u && (t.value = u, u = null);
258
+ function s() {
259
+ r && (cancelAnimationFrame(r), r = 0), d && (t.value = d, d = null);
260
260
  }
261
- return { batchMessagesUpdate: c, flushMessagesBatch: a };
261
+ return { batchMessagesUpdate: c, flushMessagesBatch: s };
262
262
  }
263
- function Me(t, u, r) {
264
- const c = K(/* @__PURE__ */ new Map()), a = E(/* @__PURE__ */ new Map()), v = E(/* @__PURE__ */ new Map());
265
- let g = 0, o = 0;
266
- function w() {
267
- if (g) return;
268
- const l = 80, d = 200, O = (R) => {
263
+ function Le(t, d, r) {
264
+ const c = z(/* @__PURE__ */ new Map()), s = E(/* @__PURE__ */ new Map()), m = E(/* @__PURE__ */ new Map());
265
+ let i = 0, o = 0;
266
+ function p() {
267
+ if (i) return;
268
+ const w = 50, h = 100, O = (R) => {
269
269
  if (o === 0) {
270
- o = R, g = requestAnimationFrame(O);
270
+ o = R, i = requestAnimationFrame(O);
271
271
  return;
272
272
  }
273
- const Y = Math.min(R - o, 100);
273
+ const k = Math.min(R - o, 100);
274
274
  o = R;
275
275
  let e = !1;
276
- if (t.value.forEach((N, P) => {
277
- if (N.type !== "ai" || N.status !== r) return;
278
- const i = N.content, m = a.value.get(P) ?? 0, b = i.length - m;
276
+ if (t.value.forEach((L, B) => {
277
+ if (L.type !== "ai" || L.status !== r) return;
278
+ const l = L.content, v = s.value.get(B) ?? 0, b = l.length - v;
279
279
  if (b > 0) {
280
280
  e = !0;
281
- const A = Math.min(l + b, d), s = (v.value.get(P) ?? 0) + A * Y / 1e3, h = Math.floor(s);
282
- if (h > 0) {
283
- v.value.set(P, s - h);
284
- const y = Math.min(m + h, i.length);
285
- a.value.set(P, y), c.set(P, i.slice(0, y));
281
+ const C = Math.min(w + b, h), a = (m.value.get(B) ?? 0) + C * k / 1e3, f = Math.floor(a);
282
+ if (f > 0) {
283
+ m.value.set(B, a - f);
284
+ const A = Math.min(v + f, l.length);
285
+ s.value.set(B, A), c.set(B, l.slice(0, A));
286
286
  } else
287
- v.value.set(P, s);
287
+ m.value.set(B, a);
288
288
  } else
289
- v.value.set(P, 0);
290
- }), e && u(), !t.value.some((N) => N.type === "ai" && N.status === r)) {
291
- g = 0;
289
+ m.value.set(B, 0);
290
+ }), e && d(), !t.value.some((L) => L.type === "ai" && L.status === r)) {
291
+ i = 0;
292
292
  return;
293
293
  }
294
- g = requestAnimationFrame(O);
294
+ i = requestAnimationFrame(O);
295
295
  };
296
- o = 0, g = requestAnimationFrame(O);
296
+ o = 0, i = requestAnimationFrame(O);
297
297
  }
298
- function f() {
299
- g && (cancelAnimationFrame(g), g = 0), t.value.forEach((l, d) => {
300
- l.type === "ai" && (c.set(d, l.content), a.value.set(d, l.content.length), v.value.set(d, 0));
298
+ function g() {
299
+ i && (cancelAnimationFrame(i), i = 0), t.value.forEach((w, h) => {
300
+ w.type === "ai" && (c.set(h, w.content), s.value.set(h, w.content.length), m.value.set(h, 0));
301
301
  });
302
302
  }
303
- function M() {
304
- g && (cancelAnimationFrame(g), g = 0);
303
+ function T() {
304
+ i && (cancelAnimationFrame(i), i = 0);
305
305
  }
306
- function T(l, d, O, R) {
306
+ function M(w, h, O, R) {
307
307
  if (O.type !== "answer" || R.status !== r) return O.content;
308
- const Y = R.segments || [];
309
- if (Y.slice(d + 1).some((i) => i.type === "answer")) return O.content;
310
- const Q = a.value.get(l);
311
- if (Q == null) return O.content;
312
- let N = 0;
313
- for (let i = 0; i < d; i++)
314
- Y[i].type === "answer" && (N += Y[i].content.length);
315
- const P = N + O.content.length;
316
- return Q >= P ? O.content : Q <= N ? "" : O.content.slice(0, Q - N);
308
+ const k = R.segments || [];
309
+ if (k.slice(h + 1).some((l) => l.type === "answer")) return O.content;
310
+ const Y = s.value.get(w);
311
+ if (Y == null) return O.content;
312
+ let L = 0;
313
+ for (let l = 0; l < h; l++)
314
+ k[l].type === "answer" && (L += k[l].content.length);
315
+ const B = L + O.content.length;
316
+ return Y >= B ? O.content : Y <= L ? "" : O.content.slice(0, Y - L);
317
317
  }
318
- return { displayedContent: c, streamingIndexRef: a, startTypewriter: w, flushTypewriter: f, getSegmentDisplayContent: T, stopTypewriter: M };
318
+ return { displayedContent: c, streamingIndexRef: s, startTypewriter: p, flushTypewriter: g, getSegmentDisplayContent: M, stopTypewriter: T };
319
319
  }
320
- function Te({
320
+ function Be({
321
321
  messages: t,
322
- isGenerating: u,
322
+ isGenerating: d,
323
323
  lastUserMessage: r,
324
324
  batchMessagesUpdate: c,
325
- flushMessagesBatch: a,
326
- STATUS: v,
327
- cfg: g
325
+ flushMessagesBatch: s,
326
+ STATUS: m,
327
+ cfg: i
328
328
  }) {
329
- const o = E(/* @__PURE__ */ new Map()), w = E(/* @__PURE__ */ new Map()), f = E(/* @__PURE__ */ new Map()), M = E(/* @__PURE__ */ new Map()), T = E(!1);
330
- function l(R) {
331
- const Y = o.value.get(R) || [];
329
+ const o = E(/* @__PURE__ */ new Map()), p = E(/* @__PURE__ */ new Map()), g = E(/* @__PURE__ */ new Map()), T = E(/* @__PURE__ */ new Map()), M = E(!1);
330
+ function w(R) {
331
+ const k = o.value.get(R) || [];
332
332
  c((e) => {
333
333
  if (e[R]) {
334
- const Q = [...e];
335
- return Q[R] = { ...Q[R], segments: Y.map((N) => ({ ...N })) }, Q;
334
+ const Y = [...e];
335
+ return Y[R] = { ...Y[R], segments: k.map((L) => ({ ...L })) }, Y;
336
336
  }
337
337
  return e;
338
338
  });
339
339
  }
340
- function d(R) {
341
- const Y = o.value.get(R) || [], e = f.value.get(R);
342
- let Q = 0, N = !1;
343
- Y.forEach((P) => {
344
- if (P.type === "thinking" && P.duration == null) {
345
- const i = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
346
- P.duration = i, Q += i, N = !0;
340
+ function h(R) {
341
+ const k = o.value.get(R) || [], e = g.value.get(R);
342
+ let Y = 0, L = !1;
343
+ k.forEach((B) => {
344
+ if (B.type === "thinking" && B.duration == null) {
345
+ const l = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
346
+ B.duration = l, Y += l, L = !0;
347
347
  }
348
- }), N && (o.value.set(R, Y), c((P) => {
349
- if (P[R]) {
350
- const i = [...P];
351
- return i[R] = {
352
- ...i[R],
353
- segments: Y.map((m) => ({ ...m })),
354
- thinkingDuration: (i[R].thinkingDuration || 0) + Q
355
- }, i;
348
+ }), L && (o.value.set(R, k), c((B) => {
349
+ if (B[R]) {
350
+ const l = [...B];
351
+ return l[R] = {
352
+ ...l[R],
353
+ segments: k.map((v) => ({ ...v })),
354
+ thinkingDuration: (l[R].thinkingDuration || 0) + Y
355
+ }, l;
356
356
  }
357
- return P;
357
+ return B;
358
358
  }));
359
359
  }
360
- async function O(R, Y, e, Q, N = !1) {
361
- T.value = !1, o.value.set(e, []), u.value = !0;
360
+ async function O(R, k, e, Y, L = !1) {
361
+ M.value = !1, o.value.set(e, []), d.value = !0;
362
362
  try {
363
- const P = g.baseUrl.replace(/\/+$/, "") + "/" + R.replace(/^\/+/, "");
364
- await zt(P, {
363
+ const B = i.baseUrl.replace(/\/+$/, "") + "/" + R.replace(/^\/+/, "");
364
+ await se(B, {
365
365
  method: "POST",
366
366
  headers: { "Content-Type": "application/json" },
367
- body: JSON.stringify({ app: g.app ?? 1, data: Y }),
368
- signal: Q,
367
+ body: JSON.stringify({ app: i.app ?? 1, data: k }),
368
+ signal: Y,
369
369
  openWhenHidden: !0,
370
- async onopen(i) {
371
- i.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", i.status, i.statusText);
370
+ async onopen(l) {
371
+ l.ok || console.error("[ai-assist-sdk] ❌ SSE 连接失败:", l.status, l.statusText);
372
372
  },
373
- onmessage(i) {
374
- var m;
373
+ onmessage(l) {
374
+ var v;
375
375
  try {
376
- let b = i.data || "";
376
+ let b = l.data || "";
377
377
  for (; b.startsWith("data:"); )
378
378
  b = b.replace(/^data:\s*/, "");
379
379
  if (!b) return;
380
- let A;
380
+ let C;
381
381
  try {
382
- A = JSON.parse(b);
382
+ C = JSON.parse(b);
383
383
  } catch {
384
384
  return;
385
385
  }
386
- switch (A.event) {
386
+ switch (C.event) {
387
387
  case "message_start":
388
- N || (r.value = A.id), w.value.set(e, "answer");
388
+ L || (r.value = C.id), p.value.set(e, "answer");
389
389
  break;
390
390
  case "think_message_output_start": {
391
- f.value.set(e, Date.now()), w.value.set(e, "thinking");
392
- const s = o.value.get(e) || [];
393
- o.value.set(e, [...s, { type: "thinking", content: "" }]), l(e);
391
+ g.value.set(e, Date.now()), p.value.set(e, "thinking");
392
+ const a = o.value.get(e) || [];
393
+ o.value.set(e, [...a, { type: "thinking", content: "" }]), w(e);
394
394
  break;
395
395
  }
396
396
  case "agent_thought": {
397
- const s = A.thought || A.thinking || "", h = o.value.get(e) || [], y = h[h.length - 1];
398
- y && y.type === "agent_thought" ? y.content += s : (w.value.set(e, "agent_thought"), h.push({ type: "agent_thought", content: s }), M.value.set(e, Date.now())), o.value.set(e, h), c(($) => {
399
- if ($[e]) {
400
- const B = [...$];
401
- return B[e] = {
402
- ...B[e],
403
- segments: h.map((D) => ({ ...D })),
404
- thinkingContent: (B[e].thinkingContent || "") + s,
405
- status: v.THINKING
406
- }, B;
397
+ const a = C.thought || C.thinking || "", f = o.value.get(e) || [], A = f[f.length - 1];
398
+ A && A.type === "agent_thought" ? A.content += a : (p.value.set(e, "agent_thought"), f.push({ type: "agent_thought", content: a }), T.value.set(e, Date.now())), o.value.set(e, f), c((P) => {
399
+ if (P[e]) {
400
+ const N = [...P];
401
+ return N[e] = {
402
+ ...N[e],
403
+ segments: f.map((H) => ({ ...H })),
404
+ thinkingContent: (N[e].thinkingContent || "") + a,
405
+ status: m.THINKING
406
+ }, N;
407
407
  }
408
- return $;
408
+ return P;
409
409
  });
410
410
  break;
411
411
  }
412
412
  case "think_message": {
413
- const s = A.thinking || A.answer || A.text || "", h = o.value.get(e) || [], y = h[h.length - 1];
414
- y && y.type === "thinking" ? y.content += s : (h.push({ type: "thinking", content: s }), f.value.set(e, Date.now())), o.value.set(e, h), c(($) => {
415
- if ($[e]) {
416
- const B = [...$];
417
- return B[e] = {
418
- ...B[e],
419
- segments: h.map((D) => ({ ...D })),
420
- thinkingContent: (B[e].thinkingContent || "") + s,
421
- status: v.THINKING
422
- }, B;
413
+ const a = C.thinking || C.answer || C.text || "", f = o.value.get(e) || [], A = f[f.length - 1];
414
+ A && A.type === "thinking" ? A.content += a : (f.push({ type: "thinking", content: a }), g.value.set(e, Date.now())), o.value.set(e, f), c((P) => {
415
+ if (P[e]) {
416
+ const N = [...P];
417
+ return N[e] = {
418
+ ...N[e],
419
+ segments: f.map((H) => ({ ...H })),
420
+ thinkingContent: (N[e].thinkingContent || "") + a,
421
+ status: m.THINKING
422
+ }, N;
423
423
  }
424
- return $;
424
+ return P;
425
425
  });
426
426
  break;
427
427
  }
428
428
  case "agent_thought_end": {
429
- const s = M.value.get(e), h = s ? Math.round((Date.now() - s) / 1e3 * 10) / 10 : 0, y = o.value.get(e) || [], $ = y[y.length - 1];
430
- $ && $.type === "agent_thought" && ($.duration = h), o.value.set(e, y), c((B) => {
431
- if (B[e]) {
432
- const D = [...B];
433
- return D[e] = {
434
- ...D[e],
435
- segments: y.map((G) => ({ ...G })),
436
- thinkingDuration: (D[e].thinkingDuration || 0) + h
437
- }, D;
429
+ const a = T.value.get(e), f = a ? Math.round((Date.now() - a) / 1e3 * 10) / 10 : 0, A = o.value.get(e) || [], P = A[A.length - 1];
430
+ P && P.type === "agent_thought" && (P.duration = f), o.value.set(e, A), c((N) => {
431
+ if (N[e]) {
432
+ const H = [...N];
433
+ return H[e] = {
434
+ ...H[e],
435
+ segments: A.map((V) => ({ ...V })),
436
+ thinkingDuration: (H[e].thinkingDuration || 0) + f
437
+ }, H;
438
438
  }
439
- return B;
439
+ return N;
440
440
  });
441
441
  break;
442
442
  }
443
443
  case "think_message_output_end": {
444
- const s = f.value.get(e), h = s ? Math.round((Date.now() - s) / 1e3 * 10) / 10 : 0, y = o.value.get(e) || [], $ = y[y.length - 1];
445
- $ && $.type === "thinking" && ($.duration = h), o.value.set(e, y), c((B) => {
446
- if (B[e]) {
447
- const D = [...B];
448
- return D[e] = {
449
- ...D[e],
450
- segments: y.map((G) => ({ ...G })),
451
- thinkingDuration: (D[e].thinkingDuration || 0) + h
452
- }, D;
444
+ const a = g.value.get(e), f = a ? Math.round((Date.now() - a) / 1e3 * 10) / 10 : 0, A = o.value.get(e) || [], P = A[A.length - 1];
445
+ P && P.type === "thinking" && (P.duration = f), o.value.set(e, A), c((N) => {
446
+ if (N[e]) {
447
+ const H = [...N];
448
+ return H[e] = {
449
+ ...H[e],
450
+ segments: A.map((V) => ({ ...V })),
451
+ thinkingDuration: (H[e].thinkingDuration || 0) + f
452
+ }, H;
453
453
  }
454
- return B;
454
+ return N;
455
455
  });
456
456
  break;
457
457
  }
458
458
  case "tool_message": {
459
- const s = A.answer || A.text || A.content || "";
460
- if (!s) break;
461
- const h = o.value.get(e) || [];
462
- h.push({ type: "answer", content: s }), o.value.set(e, h), l(e);
459
+ const a = C.answer || C.text || C.content || "";
460
+ if (!a) break;
461
+ const f = o.value.get(e) || [];
462
+ f.push({ type: "answer", content: a }), o.value.set(e, f), w(e);
463
463
  break;
464
464
  }
465
465
  case "message_output_start":
466
- w.value.set(e, "answer"), d(e);
466
+ p.value.set(e, "answer"), h(e);
467
467
  break;
468
468
  case "message": {
469
- const s = A.answer || "", h = w.value.get(e), y = o.value.get(e) || [], $ = y[y.length - 1];
470
- h === "answer" && $ && $.type === "answer" ? $.content += s : (d(e), w.value.set(e, "answer"), y.push({ type: "answer", content: s })), o.value.set(e, y);
471
- const B = y.filter((D) => D.type === "answer").map((D) => D.content).join("");
472
- c((D) => {
473
- if (D[e]) {
474
- const G = [...D];
475
- return G[e] = {
476
- ...G[e],
477
- segments: y.map((Z) => ({ ...Z })),
478
- content: B,
479
- status: T.value ? v.STOP : v.ANSWERING
480
- }, G;
469
+ const a = C.answer || "", f = p.value.get(e), A = o.value.get(e) || [], P = A[A.length - 1];
470
+ f === "answer" && P && P.type === "answer" ? P.content += a : (h(e), p.value.set(e, "answer"), A.push({ type: "answer", content: a })), o.value.set(e, A);
471
+ const N = A.filter((H) => H.type === "answer").map((H) => H.content).join("");
472
+ c((H) => {
473
+ if (H[e]) {
474
+ const V = [...H];
475
+ return V[e] = {
476
+ ...V[e],
477
+ segments: A.map((nt) => ({ ...nt })),
478
+ content: N,
479
+ status: M.value ? m.STOP : m.ANSWERING
480
+ }, V;
481
481
  }
482
- return D;
482
+ return H;
483
483
  });
484
484
  break;
485
485
  }
486
486
  case "message_end": {
487
- a();
488
- const s = [...t.value];
489
- s[e] && (s[e] = { ...s[e], status: T.value ? v.STOP : v.COMPLETED }), t.value = s, u.value = !1;
487
+ s();
488
+ const a = [...t.value];
489
+ a[e] && (a[e] = { ...a[e], status: M.value ? m.STOP : m.COMPLETED }), t.value = a, d.value = !1;
490
490
  break;
491
491
  }
492
492
  case "agent_error":
493
493
  case "message_failed": {
494
- a();
495
- const s = [...t.value];
496
- s[e] && (s[e] = {
497
- ...s[e],
498
- status: v.ERROR,
499
- content: A.error_msg || A.message || "请求失败",
500
- errorMessage: A.error_msg || A.message || "请求失败"
501
- }, t.value = s), u.value = !1;
494
+ s();
495
+ const a = [...t.value];
496
+ a[e] && (a[e] = {
497
+ ...a[e],
498
+ status: m.ERROR,
499
+ content: C.error_msg || C.message || "请求失败",
500
+ errorMessage: C.error_msg || C.message || "请求失败"
501
+ }, t.value = a), d.value = !1;
502
502
  break;
503
503
  }
504
504
  case "message_replace": {
505
- const s = A.answer || "", h = o.value.get(e) || [], y = (m = h.map(($, B) => ({ s: $, i: B })).reverse().find(($) => $.s.type === "answer")) == null ? void 0 : m.i;
506
- y != null ? h[y] = { ...h[y], content: s } : h.push({ type: "answer", content: s }), o.value.set(e, h), c(($) => {
507
- if ($[e]) {
508
- const B = [...$];
509
- return B[e] = {
510
- ...B[e],
511
- segments: h.map((D) => ({ ...D })),
512
- content: s
513
- }, B;
505
+ const a = C.answer || "", f = o.value.get(e) || [], A = (v = f.map((P, N) => ({ s: P, i: N })).reverse().find((P) => P.s.type === "answer")) == null ? void 0 : v.i;
506
+ A != null ? f[A] = { ...f[A], content: a } : f.push({ type: "answer", content: a }), o.value.set(e, f), c((P) => {
507
+ if (P[e]) {
508
+ const N = [...P];
509
+ return N[e] = {
510
+ ...N[e],
511
+ segments: f.map((H) => ({ ...H })),
512
+ content: a
513
+ }, N;
514
514
  }
515
- return $;
515
+ return P;
516
516
  });
517
517
  break;
518
518
  }
519
519
  case "message_cost": {
520
- const s = {
521
- inputTokens: A.input_tokens || 0,
522
- outputTokens: A.output_tokens || 0,
523
- latency: A.latency || 0,
524
- latencyFirstResp: A.latency_first_resp
520
+ const a = {
521
+ inputTokens: C.input_tokens || 0,
522
+ outputTokens: C.output_tokens || 0,
523
+ latency: C.latency || 0,
524
+ latencyFirstResp: C.latency_first_resp
525
525
  };
526
- c((h) => {
527
- if (h[e]) {
528
- const y = [...h];
529
- return y[e] = { ...y[e], cost: s }, y;
526
+ c((f) => {
527
+ if (f[e]) {
528
+ const A = [...f];
529
+ return A[e] = { ...A[e], cost: a }, A;
530
530
  }
531
- return h;
531
+ return f;
532
532
  });
533
533
  break;
534
534
  }
@@ -539,192 +539,192 @@ function Te({
539
539
  }
540
540
  },
541
541
  onclose() {
542
- a(), d(e), a();
543
- const m = (o.value.get(e) || []).filter((A) => A.type === "answer").map((A) => A.content).join(""), b = [...t.value];
544
- b[e] && b[e].status !== v.ERROR && (b[e] = {
542
+ s(), h(e), s();
543
+ const v = (o.value.get(e) || []).filter((C) => C.type === "answer").map((C) => C.content).join(""), b = [...t.value];
544
+ b[e] && b[e].status !== m.ERROR && (b[e] = {
545
545
  ...b[e],
546
- content: T.value && !m ? "已停止回答" : m,
547
- status: T.value ? v.STOP : v.COMPLETED
548
- }), t.value = b, u.value = !1;
546
+ content: M.value && !v ? "已停止回答" : v,
547
+ status: M.value ? m.STOP : m.COMPLETED
548
+ }), t.value = b, d.value = !1;
549
549
  },
550
- onerror(i) {
551
- console.error("[ai-assist-sdk] ❌ 连接错误:", i), a();
552
- const m = [...t.value];
553
- m[e] && (m[e] = { ...m[e], content: `
554
- ⚠️ 请求异常,已终止`, status: v.ERROR }), t.value = m, u.value = !1;
550
+ onerror(l) {
551
+ console.error("[ai-assist-sdk] ❌ 连接错误:", l), s();
552
+ const v = [...t.value];
553
+ v[e] && (v[e] = { ...v[e], content: `
554
+ ⚠️ 请求异常,已终止`, status: m.ERROR }), t.value = v, d.value = !1;
555
555
  }
556
556
  });
557
- } catch (P) {
558
- if (console.error("[ai-assist-sdk] doStreamRequest error:", P), !T.value) {
559
- a();
560
- const i = [...t.value];
561
- i[e] && (i[e] = { ...i[e], content: "服务连接失败,请稍后重试", status: v.ERROR }), t.value = i, u.value = !1;
557
+ } catch (B) {
558
+ if (console.error("[ai-assist-sdk] doStreamRequest error:", B), !M.value) {
559
+ s();
560
+ const l = [...t.value];
561
+ l[e] && (l[e] = { ...l[e], content: "服务连接失败,请稍后重试", status: m.ERROR }), t.value = l, d.value = !1;
562
562
  }
563
563
  }
564
564
  }
565
- return { doStreamRequest: O, issTop: T };
565
+ return { doStreamRequest: O, issTop: M };
566
566
  }
567
- function St(t) {
568
- var u;
567
+ function Ht(t) {
568
+ var d;
569
569
  if (t && typeof t == "object" && typeof t.data == "string" && (t = t.data), typeof t == "string") {
570
570
  const r = t.split(`
571
571
  `);
572
572
  let c = "";
573
- for (const a of r) {
574
- const v = a.startsWith("data:") ? a.slice(5).trim() : "";
575
- if (v)
573
+ for (const s of r) {
574
+ const m = s.startsWith("data:") ? s.slice(5).trim() : "";
575
+ if (m)
576
576
  try {
577
- const g = JSON.parse(v);
578
- g.event === "message" && g.answer !== void 0 && (c += g.answer);
577
+ const i = JSON.parse(m);
578
+ i.event === "message" && i.answer !== void 0 && (c += i.answer);
579
579
  } catch {
580
580
  }
581
581
  }
582
582
  return c || t;
583
583
  }
584
- return (t == null ? void 0 : t.answer) || ((u = t == null ? void 0 : t.data) == null ? void 0 : u.answer) || String(t || "");
584
+ return (t == null ? void 0 : t.answer) || ((d = t == null ? void 0 : t.data) == null ? void 0 : d.answer) || String(t || "");
585
585
  }
586
- function De(t) {
586
+ function Ne(t) {
587
587
  return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
588
588
  }
589
- function Oe({
589
+ function Ye({
590
590
  messages: t,
591
- userInput: u,
591
+ userInput: d,
592
592
  isGenerating: r,
593
593
  lastUserMessage: c,
594
- conversationId: a,
595
- doStreamRequest: v,
596
- issTop: g,
594
+ conversationId: s,
595
+ doStreamRequest: m,
596
+ issTop: i,
597
597
  scrollToBottom: o,
598
- STATUS: w,
599
- cfg: f,
600
- onTitleGenerated: M
598
+ STATUS: p,
599
+ cfg: g,
600
+ onTitleGenerated: T
601
601
  }) {
602
- const T = f.apis, l = K({
602
+ const M = g.apis, w = z({
603
603
  first: new AbortController(),
604
604
  again: new AbortController()
605
- }), d = E(!1);
606
- async function O(i, m) {
607
- var A;
608
- if (!f.titleGenerateApp || !T.updateConversationApi || d.value) return;
609
- let b = a.value;
605
+ }), h = E(!1);
606
+ async function O(l, v) {
607
+ var C;
608
+ if (!g.titleGenerateApp || !M.updateConversationApi || h.value) return;
609
+ let b = s.value;
610
610
  if (!b)
611
611
  try {
612
- const s = await At(T);
613
- (A = s == null ? void 0 : s.conversation) != null && A.appConversationID && (b = s.conversation.appConversationID, a.value = b);
614
- } catch (s) {
615
- console.error("[ai-assist-sdk] 创建会话失败:", s);
612
+ const a = await Mt(M);
613
+ (C = a == null ? void 0 : a.conversation) != null && C.appConversationID && (b = a.conversation.appConversationID, s.value = b);
614
+ } catch (a) {
615
+ console.error("[ai-assist-sdk] 创建会话失败:", a);
616
616
  return;
617
617
  }
618
618
  if (b)
619
619
  try {
620
- const s = await Xt(T, f.titleGenerateApp);
621
- if (!s) return;
622
- const h = m.length > 500 ? m.slice(0, 500) : m, y = `用户提问:${i}
623
- AI回答:${h}`, B = await bt().post(T.chatQueryApi, {
624
- app: f.titleGenerateApp,
625
- data: { Query: y, AppConversationID: s }
626
- }), D = St(B.data.data);
627
- console.log("看看", D), D && (await Wt(T, b, D), d.value = !0, M == null || M(D));
628
- } catch (s) {
629
- console.error("[ai-assist-sdk] 生成对话标题失败:", s);
620
+ const a = await Jt(M, g.titleGenerateApp);
621
+ if (!a) return;
622
+ const f = v.length > 500 ? v.slice(0, 500) : v, A = `用户提问:${l}
623
+ AI回答:${f}`, N = await Dt().post(M.chatQueryApi, {
624
+ app: g.titleGenerateApp,
625
+ data: { Query: A, AppConversationID: a }
626
+ }), H = Ht(N.data.data);
627
+ console.log("看看", H), H && (await qt(M, b, H), h.value = !0, T == null || T(H));
628
+ } catch (a) {
629
+ console.error("[ai-assist-sdk] 生成对话标题失败:", a);
630
630
  }
631
631
  }
632
632
  async function R() {
633
- const i = u.value.trim();
634
- if (!i || r.value) return;
635
- if (!a.value && (await N(), !a.value)) {
636
- et("创建会话失败,请重试");
633
+ const l = d.value.trim();
634
+ if (!l || r.value) return;
635
+ if (!s.value && (await L(), !s.value)) {
636
+ it("创建会话失败,请重试");
637
637
  return;
638
638
  }
639
- const m = t.value.length === 0, b = [
639
+ const v = t.value.length === 0, b = [
640
640
  ...t.value,
641
- { type: "user", content: i },
642
- { type: "ai", content: "", status: w.THINKING }
641
+ { type: "user", content: l },
642
+ { type: "ai", content: "", status: p.THINKING }
643
643
  ];
644
- t.value = b, u.value = "", o();
645
- const A = b.length - 1;
646
- if (T.chatQueryStreamApi) {
647
- if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", T.chatQueryStreamApi), await v(T.chatQueryStreamApi, {
648
- Query: i,
649
- AppConversationID: a.value,
644
+ t.value = b, d.value = "", o();
645
+ const C = b.length - 1;
646
+ if (M.chatQueryStreamApi) {
647
+ if (console.log("[ai-assist-sdk] ✅ 使用流式 SSE:", M.chatQueryStreamApi), await m(M.chatQueryStreamApi, {
648
+ Query: l,
649
+ AppConversationID: s.value,
650
650
  ResponseMode: "streaming"
651
- }, A, l.first.signal), m && !d.value) {
652
- const s = t.value[A];
653
- s && s.status !== w.ERROR && O(i, s.content);
651
+ }, C, w.first.signal), v && !h.value) {
652
+ const a = t.value[C];
653
+ a && a.status !== p.ERROR && O(l, a.content);
654
654
  }
655
655
  return;
656
656
  }
657
657
  console.warn("[ai-assist-sdk] ⚠️ 未配置 chatQueryStreamApi,降级为非流式请求");
658
658
  try {
659
- const h = await bt().post(T.chatQueryApi, {
660
- app: f.app ?? 1,
661
- data: { Query: i, AppConversationID: a.value }
662
- }), y = St(h.data);
663
- t.value = [...t.value.slice(0, -1), { type: "ai", content: y, status: w.COMPLETED }], m && !d.value && O(i, y);
664
- } catch (s) {
665
- t.value = [...t.value.slice(0, -1), { type: "ai", content: (s == null ? void 0 : s.message) || "服务连接失败,请稍后重试", status: w.ERROR }];
659
+ const f = await Dt().post(M.chatQueryApi, {
660
+ app: g.app ?? 1,
661
+ data: { Query: l, AppConversationID: s.value }
662
+ }), A = Ht(f.data);
663
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: A, status: p.COMPLETED }], v && !h.value && O(l, A);
664
+ } catch (a) {
665
+ t.value = [...t.value.slice(0, -1), { type: "ai", content: (a == null ? void 0 : a.message) || "服务连接失败,请稍后重试", status: p.ERROR }];
666
666
  }
667
667
  }
668
- async function Y() {
668
+ async function k() {
669
669
  if (!c.value || r.value) return;
670
- l.again.abort(), l.again = new AbortController();
671
- const i = [...t.value];
672
- i.length > 0 && i[i.length - 1].type === "ai" && i.pop(), i.push({ type: "ai", content: "", status: w.RETHINKING }), t.value = i, o();
673
- const m = t.value.length - 1, b = De(T);
674
- await v(b, {
670
+ w.again.abort(), w.again = new AbortController();
671
+ const l = [...t.value];
672
+ l.length > 0 && l[l.length - 1].type === "ai" && l.pop(), l.push({ type: "ai", content: "", status: p.RETHINKING }), t.value = l, o();
673
+ const v = t.value.length - 1, b = Ne(M);
674
+ await m(b, {
675
675
  MessageID: c.value,
676
- AppConversationID: a.value,
676
+ AppConversationID: s.value,
677
677
  ResponseMode: "streaming"
678
- }, m, l.again.signal, !0);
678
+ }, v, w.again.signal, !0);
679
679
  }
680
680
  async function e() {
681
- if (!T.stopMessageApi || !r.value) return;
682
- const i = t.value.length - 1 - 1;
681
+ if (!M.stopMessageApi || !r.value) return;
682
+ const l = t.value.length - 1 - 1;
683
683
  try {
684
- await Qt(T, c.value);
685
- const m = [...t.value];
686
- m[i] && (m[i] = { ...m[i], content: m[i].content || "已停止回答", status: w.STOP }), t.value = m, r.value = !1, l.first.abort(), l.first = new AbortController(), l.again.abort(), l.again = new AbortController(), g.value = !0;
687
- } catch (m) {
684
+ await Ft(M, c.value);
685
+ const v = [...t.value];
686
+ v[l] && (v[l] = { ...v[l], content: v[l].content || "已停止回答", status: p.STOP }), t.value = v, r.value = !1, w.first.abort(), w.first = new AbortController(), w.again.abort(), w.again = new AbortController(), i.value = !0;
687
+ } catch (v) {
688
688
  const b = [...t.value];
689
- b[i] && (b[i] = { ...b[i], content: (m == null ? void 0 : m.message) || "系统繁忙,请稍后再试", status: w.ERROR }), t.value = b;
689
+ b[l] && (b[l] = { ...b[l], content: (v == null ? void 0 : v.message) || "系统繁忙,请稍后再试", status: p.ERROR }), t.value = b;
690
690
  }
691
691
  }
692
- async function Q(i) {
693
- var m, b, A;
694
- a.value = i, d.value = !0;
692
+ async function Y(l) {
693
+ var v, b, C;
694
+ s.value = l, h.value = !0;
695
695
  try {
696
- const s = await Yt(T, i), h = (A = (b = (m = s == null ? void 0 : s.messages) == null ? void 0 : m[0]) == null ? void 0 : b.answerInfo) == null ? void 0 : A.answer;
697
- h && (t.value = [...t.value, { type: "ai", content: h, status: w.COMPLETED }]);
698
- } catch (s) {
699
- et((s == null ? void 0 : s.message) || "加载历史会话失败");
696
+ const a = await Vt(M, l), f = (C = (b = (v = a == null ? void 0 : a.messages) == null ? void 0 : v[0]) == null ? void 0 : b.answerInfo) == null ? void 0 : C.answer;
697
+ f && (t.value = [...t.value, { type: "ai", content: f, status: p.COMPLETED }]);
698
+ } catch (a) {
699
+ it((a == null ? void 0 : a.message) || "加载历史会话失败");
700
700
  }
701
701
  }
702
- async function N() {
703
- var i;
704
- d.value = !1;
702
+ async function L() {
703
+ var l;
704
+ h.value = !1;
705
705
  try {
706
- const m = await At(T);
707
- (i = m == null ? void 0 : m.conversation) != null && i.appConversationID && (a.value = m.conversation.appConversationID);
708
- } catch (m) {
709
- et((m == null ? void 0 : m.message) || "创建会话失败");
706
+ const v = await Mt(M);
707
+ (l = v == null ? void 0 : v.conversation) != null && l.appConversationID && (s.value = v.conversation.appConversationID);
708
+ } catch (v) {
709
+ it((v == null ? void 0 : v.message) || "创建会话失败");
710
710
  }
711
711
  }
712
- function P() {
713
- a.value = "", d.value = !1;
712
+ function B() {
713
+ s.value = "", h.value = !1;
714
714
  }
715
- return { sendMessage: R, regenerateResponse: Y, toggleStop: e, goHistoryMessage: Q, initConversation: N, resetConversation: P, controllers: l };
715
+ return { sendMessage: R, regenerateResponse: k, toggleStop: e, goHistoryMessage: Y, initConversation: L, resetConversation: B, controllers: w };
716
716
  }
717
- const He = { class: "container" }, $e = { class: "message ai-message greet-message" }, Pe = { class: "ai-greet" }, Be = {
717
+ const We = { class: "container" }, xe = { class: "message ai-message greet-message" }, Qe = { class: "ai-greet" }, Xe = {
718
718
  key: 0,
719
719
  class: "message ai-message recommend-message"
720
- }, Le = { class: "ai-recommend" }, Ne = { class: "recommend-header" }, Ye = ["src"], Qe = ["onClick"], Xe = /* @__PURE__ */ st({
720
+ }, _e = { class: "ai-recommend" }, Ge = { class: "recommend-header" }, Ve = ["src"], Fe = ["onClick"], Je = /* @__PURE__ */ rt({
721
721
  __name: "Answer",
722
722
  props: {
723
723
  defaultSayhello: {},
724
724
  defaultRecommend: {}
725
725
  },
726
726
  emits: ["title-generated"],
727
- setup(t, { expose: u, emit: r }) {
727
+ setup(t, { expose: d, emit: r }) {
728
728
  const c = {
729
729
  THINKING: "thinking",
730
730
  RETHINKING: "rethinking",
@@ -733,207 +733,207 @@ const He = { class: "container" }, $e = { class: "message ai-message greet-messa
733
733
  COMPLETED: "completed",
734
734
  STOP: "stop",
735
735
  ERROR: "error"
736
- }, a = t, v = r, g = vt(), o = E([]), w = E(""), f = E(!1), M = E(""), T = E(""), l = E(null), d = K({ text1: "", text2: "" }), O = E([]), R = E(0), Y = x(
736
+ }, s = t, m = r, i = yt(), o = E([]), p = E(""), g = E(!1), T = E(""), M = E(""), w = E(null), h = z({ text1: "", text2: "" }), O = E([]), R = E(0), k = j(
737
737
  () => O.value[R.value % (O.value.length || 1)]
738
738
  );
739
739
  function e() {
740
740
  R.value++;
741
741
  }
742
- function Q(L) {
743
- w.value = L;
742
+ function Y(x) {
743
+ p.value = x;
744
744
  }
745
- const { isAtBottom: N, hasScroll: P, scrollToBottom: i, checkScrollStatus: m } = Se(l), { enhanceCodeBlocks: b } = Ee(), { batchMessagesUpdate: A, flushMessagesBatch: s } = Re(o), { displayedContent: h, streamingIndexRef: y, startTypewriter: $, stopTypewriter: B, getSegmentDisplayContent: D } = Me(
745
+ const { isAtBottom: L, hasScroll: B, scrollToBottom: l, checkScrollStatus: v } = Oe(w), { enhanceCodeBlocks: b } = $e(), { batchMessagesUpdate: C, flushMessagesBatch: a } = Pe(o), { displayedContent: f, streamingIndexRef: A, startTypewriter: P, stopTypewriter: N, getSegmentDisplayContent: H } = Le(
746
746
  o,
747
- i,
747
+ l,
748
748
  c.ANSWERING
749
- ), { doStreamRequest: G, issTop: Z } = Te({
749
+ ), { doStreamRequest: V, issTop: nt } = Be({
750
750
  messages: o,
751
- isGenerating: f,
752
- lastUserMessage: M,
753
- batchMessagesUpdate: A,
754
- flushMessagesBatch: s,
751
+ isGenerating: g,
752
+ lastUserMessage: T,
753
+ batchMessagesUpdate: C,
754
+ flushMessagesBatch: a,
755
755
  STATUS: c,
756
- cfg: g
757
- }), { sendMessage: dt, regenerateResponse: ct, toggleStop: gt, goHistoryMessage: mt, resetConversation: ft } = Oe({
756
+ cfg: i
757
+ }), { sendMessage: wt, regenerateResponse: ht, toggleStop: st, goHistoryMessage: ot, resetConversation: mt } = Ye({
758
758
  messages: o,
759
- userInput: w,
760
- isGenerating: f,
761
- lastUserMessage: M,
762
- conversationId: T,
763
- doStreamRequest: G,
764
- issTop: Z,
765
- scrollToBottom: i,
759
+ userInput: p,
760
+ isGenerating: g,
761
+ lastUserMessage: T,
762
+ conversationId: M,
763
+ doStreamRequest: V,
764
+ issTop: nt,
765
+ scrollToBottom: l,
766
766
  STATUS: c,
767
- cfg: g,
768
- onTitleGenerated: (L) => v("title-generated", L)
767
+ cfg: i,
768
+ onTitleGenerated: (x) => m("title-generated", x)
769
769
  });
770
- function q() {
771
- o.value = [], M.value = "", ft();
770
+ function kt() {
771
+ o.value = [], T.value = "", mt();
772
772
  }
773
- const ht = x(() => o.value.length === 0);
774
- u({ goHistoryMessage: mt, createNewConversation: q, isEmptyConversation: ht });
775
- const I = E(/* @__PURE__ */ new Map());
776
- function C(L, X) {
777
- L ? I.value.set(X, L) : I.value.delete(X);
773
+ const ft = j(() => o.value.length === 0);
774
+ d({ goHistoryMessage: ot, createNewConversation: kt, isEmptyConversation: ft });
775
+ const ct = E(/* @__PURE__ */ new Map());
776
+ function Ct(x, Q) {
777
+ x ? ct.value.set(Q, x) : ct.value.delete(Q);
778
778
  }
779
- Et(o, () => {
780
- it(() => {
781
- o.value.forEach((L, X) => {
782
- L.type === "ai" && L.status !== c.ANSWERING && (h.set(X, L.content), y.value.set(X, L.content.length));
783
- }), $(), I.value.forEach((L) => {
784
- b(L);
779
+ Ot(o, () => {
780
+ tt(() => {
781
+ o.value.forEach((x, Q) => {
782
+ x.type === "ai" && x.status !== c.ANSWERING && (f.set(Q, x.content), A.value.set(Q, x.content.length));
783
+ }), P(), ct.value.forEach((x) => {
784
+ b(x);
785
785
  });
786
786
  });
787
787
  }, { deep: !0 });
788
- let S = null;
789
- return z(() => {
790
- a.defaultSayhello && (d.text1 = a.defaultSayhello.text1, d.text2 = a.defaultSayhello.text2), a.defaultRecommend && (O.value = _t(a.defaultRecommend));
791
- }), z(() => {
792
- l.value && (S = () => m(), l.value.addEventListener("scroll", S));
793
- }), yt(() => {
794
- B(), l.value && S && l.value.removeEventListener("scroll", S);
795
- }), (L, X) => {
796
- var ot;
797
- return p(), k("div", He, [
788
+ let at = null;
789
+ return et(() => {
790
+ s.defaultSayhello && (h.text1 = s.defaultSayhello.text1, h.text2 = s.defaultSayhello.text2), s.defaultRecommend && (O.value = jt(s.defaultRecommend));
791
+ }), et(() => {
792
+ w.value && (at = () => v(), w.value.addEventListener("scroll", at));
793
+ }), bt(() => {
794
+ N(), w.value && at && w.value.removeEventListener("scroll", at);
795
+ }), (x, Q) => {
796
+ var J;
797
+ return y(), S("div", We, [
798
798
  n("div", {
799
799
  class: "chat-box scrollWrap",
800
800
  ref_key: "chatBoxRef",
801
- ref: l
801
+ ref: w
802
802
  }, [
803
- n("div", $e, [
804
- n("div", Pe, [
805
- n("h1", null, W(d.text1), 1),
806
- n("p", null, W(d.text2), 1)
803
+ n("div", xe, [
804
+ n("div", Qe, [
805
+ n("h1", null, X(h.text1), 1),
806
+ n("p", null, X(h.text2), 1)
807
807
  ])
808
808
  ]),
809
- (ot = Y.value) != null && ot.length ? (p(), k("div", Be, [
810
- n("div", Le, [
811
- n("div", Ne, [
812
- X[2] || (X[2] = n("span", null, "你可以尝试这样问我:", -1)),
809
+ (J = k.value) != null && J.length ? (y(), S("div", Xe, [
810
+ n("div", _e, [
811
+ n("div", Ge, [
812
+ Q[2] || (Q[2] = n("span", null, "你可以尝试这样问我:", -1)),
813
813
  n("p", {
814
814
  class: "refresh-btn",
815
815
  onClick: e
816
816
  }, [
817
- n("img", { src: H(te) }, null, 8, Ye),
818
- X[1] || (X[1] = n("span", null, "换一换", -1))
817
+ n("img", { src: $(le) }, null, 8, Ve),
818
+ Q[1] || (Q[1] = n("span", null, "换一换", -1))
819
819
  ])
820
820
  ]),
821
821
  n("ul", null, [
822
- (p(!0), k(U, null, nt(Y.value, (F, tt) => (p(), k("li", {
823
- key: tt,
824
- onClick: (Tn) => Q(F)
825
- }, W(F), 9, Qe))), 128))
822
+ (y(!0), S(K, null, lt(k.value, (q, Z) => (y(), S("li", {
823
+ key: Z,
824
+ onClick: (u) => Y(q)
825
+ }, X(q), 9, Fe))), 128))
826
826
  ])
827
827
  ])
828
828
  ])) : _("", !0),
829
- (p(!0), k(U, null, nt(o.value, (F, tt) => (p(), rt(pe, {
830
- key: tt,
831
- msg: F,
832
- index: tt,
829
+ (y(!0), S(K, null, lt(o.value, (q, Z) => (y(), gt(Se, {
830
+ key: Z,
831
+ msg: q,
832
+ index: Z,
833
833
  STATUS: c,
834
- displayedContent: H(h),
835
- getSegmentDisplayContent: H(D),
836
- setMessageRef: C,
837
- onRegenerate: H(ct)
834
+ displayedContent: $(f),
835
+ getSegmentDisplayContent: $(H),
836
+ setMessageRef: Ct,
837
+ onRegenerate: $(ht)
838
838
  }, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
839
839
  ], 512),
840
- V(be, {
841
- modelValue: w.value,
842
- "onUpdate:modelValue": X[0] || (X[0] = (F) => w.value = F),
843
- isGenerating: f.value,
844
- lastUserMessage: M.value,
845
- hasScroll: H(P),
846
- isAtBottom: H(N),
847
- onSend: H(dt),
848
- onRegenerate: H(ct),
849
- onStop: H(gt),
850
- onScrollToBottom: H(i)
840
+ G(He, {
841
+ modelValue: p.value,
842
+ "onUpdate:modelValue": Q[0] || (Q[0] = (q) => p.value = q),
843
+ isGenerating: g.value,
844
+ lastUserMessage: T.value,
845
+ hasScroll: $(B),
846
+ isAtBottom: $(L),
847
+ onSend: $(wt),
848
+ onRegenerate: $(ht),
849
+ onStop: $(st),
850
+ onScrollToBottom: $(l)
851
851
  }, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"]),
852
- X[3] || (X[3] = n("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
852
+ Q[3] || (Q[3] = n("div", { class: "ai-mistake-tip" }, "AI也会犯错,请核实重要信息", -1))
853
853
  ]);
854
854
  };
855
855
  }
856
- }), We = { class: "ai-history" }, _e = { class: "content" }, Ge = {
856
+ }), qe = { class: "ai-history" }, je = { class: "content" }, Ue = {
857
857
  key: 0,
858
858
  class: "ai-history-loading"
859
- }, Ve = { class: "ai-history-group-title" }, Je = ["onClick"], Fe = { class: "ai-history-item-title" }, je = ["onClick"], Ue = {
859
+ }, ze = { class: "ai-history-group-title" }, Ke = ["onClick"], Ze = { class: "ai-history-item-title" }, Ie = ["onClick"], tn = {
860
860
  key: 2,
861
861
  class: "ai-history-empty"
862
- }, qe = ["src"], xe = { class: "ai-modal" }, ze = { class: "ai-modal-footer" }, Ke = /* @__PURE__ */ st({
862
+ }, en = ["src"], nn = { class: "ai-modal" }, sn = { class: "ai-modal-footer" }, on = /* @__PURE__ */ rt({
863
863
  __name: "History",
864
864
  emits: ["history-detail", "new-conversation"],
865
- setup(t, { emit: u }) {
866
- const c = vt().apis, a = E([]), v = E(!0), g = E(!1), o = E(""), w = x(() => Gt(a.value));
867
- async function f() {
865
+ setup(t, { emit: d }) {
866
+ const c = yt().apis, s = E([]), m = E(!0), i = E(!1), o = E(""), p = j(() => Ut(s.value));
867
+ async function g() {
868
868
  try {
869
- const l = await Vt(c);
870
- l != null && l.conversationList && (a.value = l.conversationList.filter((d) => d !== null).map((d) => ({ ...d, selected: !1 })));
871
- } catch (l) {
872
- et((l == null ? void 0 : l.message) || "获取历史记录失败");
869
+ const w = await zt(c);
870
+ w != null && w.conversationList && (s.value = w.conversationList.filter((h) => h !== null).map((h) => ({ ...h, selected: !1 })));
871
+ } catch (w) {
872
+ it((w == null ? void 0 : w.message) || "获取历史记录失败");
873
873
  } finally {
874
- v.value = !1;
874
+ m.value = !1;
875
875
  }
876
876
  }
877
- function M(l) {
878
- o.value = l, g.value = !0;
877
+ function T(w) {
878
+ o.value = w, i.value = !0;
879
879
  }
880
- async function T() {
881
- g.value = !1;
880
+ async function M() {
881
+ i.value = !1;
882
882
  try {
883
- await Jt(c, o.value), await f();
884
- } catch (l) {
885
- et((l == null ? void 0 : l.message) || "删除失败"), await f();
883
+ await Kt(c, o.value), await g();
884
+ } catch (w) {
885
+ it((w == null ? void 0 : w.message) || "删除失败"), await g();
886
886
  }
887
887
  }
888
- return z(() => {
889
- f();
890
- }), (l, d) => (p(), k("div", We, [
891
- n("div", _e, [
892
- v.value ? (p(), k("div", Ge, [...d[3] || (d[3] = [
888
+ return et(() => {
889
+ g();
890
+ }), (w, h) => (y(), S("div", qe, [
891
+ n("div", je, [
892
+ m.value ? (y(), S("div", Ue, [...h[3] || (h[3] = [
893
893
  n("div", { class: "ai-history-spinner" }, null, -1)
894
- ])])) : w.value.length > 0 ? (p(!0), k(U, { key: 1 }, nt(w.value, (O) => (p(), k("div", {
894
+ ])])) : p.value.length > 0 ? (y(!0), S(K, { key: 1 }, lt(p.value, (O) => (y(), S("div", {
895
895
  key: O.label,
896
896
  class: "ai-history-group"
897
897
  }, [
898
- n("div", Ve, W(O.label), 1),
899
- (p(!0), k(U, null, nt(O.items, (R, Y) => (p(), k("div", {
898
+ n("div", ze, X(O.label), 1),
899
+ (y(!0), S(K, null, lt(O.items, (R, k) => (y(), S("div", {
900
900
  key: R.appConversationID,
901
901
  class: "ai-history-item",
902
- style: Rt({ "--i": Y }),
903
- onClick: (e) => l.$emit("history-detail", R.appConversationID)
902
+ style: St({ "--i": k }),
903
+ onClick: (e) => w.$emit("history-detail", R.appConversationID)
904
904
  }, [
905
- n("div", Fe, W(R.conversationName), 1),
905
+ n("div", Ze, X(R.conversationName), 1),
906
906
  n("div", {
907
907
  class: "ai-history-item-delete",
908
- onClick: kt((e) => M(R.appConversationID), ["stop"])
909
- }, "删除", 8, je)
910
- ], 12, Je))), 128))
911
- ]))), 128)) : (p(), k("div", Ue, "暂无历史记录"))
908
+ onClick: Et((e) => T(R.appConversationID), ["stop"])
909
+ }, "删除", 8, Ie)
910
+ ], 12, Ke))), 128))
911
+ ]))), 128)) : (y(), S("div", tn, "暂无历史记录"))
912
912
  ]),
913
913
  n("div", {
914
914
  class: "ai-add",
915
- onClick: d[0] || (d[0] = (O) => l.$emit("new-conversation"))
915
+ onClick: h[0] || (h[0] = (O) => w.$emit("new-conversation"))
916
916
  }, [
917
- n("img", { src: H(Kt) }, null, 8, qe),
918
- d[4] || (d[4] = n("span", null, "新建AI对话", -1))
917
+ n("img", { src: $(oe) }, null, 8, en),
918
+ h[4] || (h[4] = n("span", null, "新建AI对话", -1))
919
919
  ]),
920
- (p(), rt(Pt, { to: "body" }, [
921
- g.value ? (p(), k("div", {
920
+ (y(), gt(Qt, { to: "body" }, [
921
+ i.value ? (y(), S("div", {
922
922
  key: 0,
923
923
  class: "ai-modal-overlay",
924
- onClick: d[2] || (d[2] = kt((O) => g.value = !1, ["self"]))
924
+ onClick: h[2] || (h[2] = Et((O) => i.value = !1, ["self"]))
925
925
  }, [
926
- n("div", xe, [
927
- d[5] || (d[5] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
928
- d[6] || (d[6] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
929
- n("div", ze, [
926
+ n("div", nn, [
927
+ h[5] || (h[5] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
928
+ h[6] || (h[6] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
929
+ n("div", sn, [
930
930
  n("button", {
931
931
  class: "ai-modal-btn cancel",
932
- onClick: d[1] || (d[1] = (O) => g.value = !1)
932
+ onClick: h[1] || (h[1] = (O) => i.value = !1)
933
933
  }, "取消"),
934
934
  n("button", {
935
935
  class: "ai-modal-btn confirm",
936
- onClick: T
936
+ onClick: M
937
937
  }, "确定")
938
938
  ])
939
939
  ])
@@ -941,309 +941,355 @@ const He = { class: "container" }, $e = { class: "message ai-message greet-messa
941
941
  ]))
942
942
  ]));
943
943
  }
944
- }), Ze = (t, u) => {
944
+ }), an = (t, d) => {
945
945
  const r = t.__vccOpts || t;
946
- for (const [c, a] of u)
947
- r[c] = a;
946
+ for (const [c, s] of d)
947
+ r[c] = s;
948
948
  return r;
949
- }, Ie = /* @__PURE__ */ Ze(Ke, [["__scopeId", "data-v-0d2cc243"]]), tn = { class: "container info" }, en = { class: "info-item" }, nn = { class: "basic-content" }, sn = { class: "basic-content-text" }, on = { class: "basic-content" }, an = { class: "basic-content-text" }, ln = { class: "info-item" }, rn = { class: "permission-content" }, cn = { class: "info-item" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = { class: "basic-content" }, gn = { class: "basic-content-text" }, mn = /* @__PURE__ */ st({
949
+ }, ln = /* @__PURE__ */ an(on, [["__scopeId", "data-v-0d2cc243"]]), rn = { class: "container info" }, cn = { class: "info-item" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = { class: "basic-content" }, gn = { class: "basic-content-text" }, hn = { class: "info-item" }, mn = { class: "permission-content" }, fn = { class: "info-item" }, pn = { class: "basic-content" }, yn = { class: "basic-content-text" }, wn = { class: "basic-content" }, kn = { class: "basic-content-text" }, Cn = /* @__PURE__ */ rt({
950
950
  __name: "Info",
951
951
  setup(t) {
952
- const u = vt(), r = E(null);
953
- return z(async () => {
952
+ const d = yt(), r = E(null);
953
+ return et(async () => {
954
954
  try {
955
- r.value = await Ft(u.apis);
955
+ r.value = await Zt(d.apis);
956
956
  } catch (c) {
957
- et((c == null ? void 0 : c.message) || "获取个人信息失败");
957
+ it((c == null ? void 0 : c.message) || "获取个人信息失败");
958
958
  }
959
- }), (c, a) => {
960
- var v, g, o, w, f;
961
- return p(), k("div", tn, [
962
- n("div", en, [
963
- a[2] || (a[2] = n("div", { class: "heading" }, [
959
+ }), (c, s) => {
960
+ var m, i, o, p, g;
961
+ return y(), S("div", rn, [
962
+ n("div", cn, [
963
+ s[2] || (s[2] = n("div", { class: "heading" }, [
964
964
  n("div", { class: "heading-column" }),
965
965
  n("div", { class: "heading-title" }, "基本信息")
966
966
  ], -1)),
967
- n("div", nn, [
968
- a[0] || (a[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
969
- n("div", sn, W(((v = r.value) == null ? void 0 : v.name) || ""), 1)
967
+ n("div", un, [
968
+ s[0] || (s[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
969
+ n("div", vn, X(((m = r.value) == null ? void 0 : m.name) || ""), 1)
970
970
  ]),
971
- n("div", on, [
972
- a[1] || (a[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
973
- n("div", an, W(((g = r.value) == null ? void 0 : g.userName) || ""), 1)
971
+ n("div", dn, [
972
+ s[1] || (s[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
973
+ n("div", gn, X(((i = r.value) == null ? void 0 : i.userName) || ""), 1)
974
974
  ])
975
975
  ]),
976
- n("div", ln, [
977
- a[3] || (a[3] = n("div", { class: "heading" }, [
976
+ n("div", hn, [
977
+ s[3] || (s[3] = n("div", { class: "heading" }, [
978
978
  n("div", { class: "heading-column" }),
979
979
  n("div", { class: "heading-title" }, "数据权限")
980
980
  ], -1)),
981
- n("div", rn, [
982
- (p(!0), k(U, null, nt((o = r.value) == null ? void 0 : o.ptnameList, (M, T) => (p(), k("div", {
983
- key: T,
981
+ n("div", mn, [
982
+ (y(!0), S(K, null, lt((o = r.value) == null ? void 0 : o.ptnameList, (T, M) => (y(), S("div", {
983
+ key: M,
984
984
  class: "permission-content-text"
985
- }, W(M), 1))), 128))
985
+ }, X(T), 1))), 128))
986
986
  ])
987
987
  ]),
988
- n("div", cn, [
989
- a[6] || (a[6] = n("div", { class: "heading" }, [
988
+ n("div", fn, [
989
+ s[6] || (s[6] = n("div", { class: "heading" }, [
990
990
  n("div", { class: "heading-column" }),
991
991
  n("div", { class: "heading-title" }, "帮助信息")
992
992
  ], -1)),
993
- n("div", un, [
994
- a[4] || (a[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
995
- n("div", vn, W(((w = r.value) == null ? void 0 : w.dept) || ""), 1)
993
+ n("div", pn, [
994
+ s[4] || (s[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
995
+ n("div", yn, X(((p = r.value) == null ? void 0 : p.dept) || ""), 1)
996
996
  ]),
997
- n("div", dn, [
998
- a[5] || (a[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
999
- n("div", gn, W(((f = r.value) == null ? void 0 : f.email) || ""), 1)
997
+ n("div", wn, [
998
+ s[5] || (s[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
999
+ n("div", kn, X(((g = r.value) == null ? void 0 : g.email) || ""), 1)
1000
1000
  ])
1001
1001
  ])
1002
1002
  ]);
1003
1003
  };
1004
1004
  }
1005
- }), fn = { class: "header" }, hn = { key: 1 }, pn = ["src"], yn = { class: "header-title" }, kn = ["title"], wn = { class: "ai-history-drawer-panel" }, Cn = { class: "ai-history-drawer-header" }, An = { class: "setTitle" }, bn = { class: "content" }, Sn = { class: "main" }, En = { class: "btn" }, Rn = ["src"], Mn = 117, at = 118, Tt = /* @__PURE__ */ st({
1005
+ }), An = { class: "header" }, bn = { key: 1 }, Sn = ["src"], En = { class: "header-title" }, Rn = ["title"], Tn = { class: "ai-history-drawer-panel" }, Mn = { class: "ai-history-drawer-header" }, Dn = { class: "setTitle" }, Hn = { class: "content" }, On = { class: "main" }, $n = { class: "btn" }, Pn = ["src"], Ln = 78, vt = 78, Pt = /* @__PURE__ */ rt({
1006
1006
  __name: "AiAssist",
1007
1007
  setup(t) {
1008
- const u = Mn / 2, r = vt(), c = E(!1), a = E(!1), v = E("answer"), g = E(!1), o = E(""), w = E(""), f = E(""), M = E(!1), T = E(!1), l = K({
1009
- x: window.innerWidth - u,
1010
- y: window.innerHeight / 2 - at / 2
1011
- }), d = E(!1), O = E(!1), R = E("right"), Y = E("left"), e = K({ x: 0, y: 0 }), Q = E(!1), N = E(null);
1012
- let P = null;
1013
- const i = x(() => {
1014
- const C = window.innerWidth / 2;
1015
- return l.x + u < C ? 5 : -5;
1016
- }), m = x(() => a.value ? "" : `panel-${R.value}`), b = x(() => {
1017
- var C;
1018
- return !((C = N.value) != null && C.isEmptyConversation);
1019
- }), A = x(() => ({
1020
- left: `${l.x}px`,
1021
- top: `${l.y}px`,
1022
- transition: d.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1023
- "--direction": String(i.value)
1024
- }));
1025
- function s() {
1026
- const C = window.innerWidth / 2;
1027
- l.x + u < C ? (R.value = "left", Y.value = "right") : (R.value = "right", Y.value = "left");
1008
+ const d = Ln / 2, r = yt(), c = E(!1), s = E("idle"), m = E(!1), i = z({ x: 0, y: 0, w: 78, h: 78, radius: "14px" }), o = E(!1), p = E(!1), g = E("answer"), T = E(!1), M = E(""), w = E(""), h = E(""), O = E(!1), R = E(!1), k = z({
1009
+ x: window.innerWidth - d,
1010
+ y: window.innerHeight / 2 - vt / 2
1011
+ }), e = E(!1), Y = E(!1), L = E("right"), B = E("left"), l = z({ x: 0, y: 0 }), v = E(!1), b = E(null);
1012
+ let C = null;
1013
+ const a = j(() => {
1014
+ const u = window.innerWidth / 2;
1015
+ return k.x + d < u ? 5 : -5;
1016
+ }), f = j(() => p.value ? "" : `panel-${L.value}`), A = j(() => {
1017
+ var u;
1018
+ return !((u = b.value) != null && u.isEmptyConversation);
1019
+ }), P = j(() => ({
1020
+ left: `${k.x}px`,
1021
+ top: `${k.y}px`,
1022
+ transition: e.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
1023
+ "--direction": String(a.value)
1024
+ })), N = j(() => s.value === "idle" ? {} : {
1025
+ left: `${i.x}px`,
1026
+ top: `${i.y}px`,
1027
+ width: `${i.w}px`,
1028
+ height: `${i.h}px`,
1029
+ borderRadius: i.radius
1030
+ });
1031
+ function H() {
1032
+ const u = window.innerWidth / 2;
1033
+ k.x + d < u ? (L.value = "left", B.value = "right") : (L.value = "right", B.value = "left");
1028
1034
  }
1029
- function h() {
1030
- const C = window.innerWidth, S = Math.max(0, Math.min(l.y, window.innerHeight - at));
1031
- return { x: l.x + u >= C / 2 ? C - u : -u, y: S };
1035
+ function V() {
1036
+ const u = window.innerWidth, D = Math.max(0, Math.min(k.y, window.innerHeight - vt));
1037
+ return { x: k.x + d >= u / 2 ? u - d : -d, y: D };
1032
1038
  }
1033
- function y() {
1034
- O.value = !0;
1035
- const C = h();
1036
- l.x = C.x, l.y = C.y, setTimeout(() => {
1037
- O.value = !1, s(), $();
1039
+ function nt() {
1040
+ Y.value = !0;
1041
+ const u = V();
1042
+ k.x = u.x, k.y = u.y, setTimeout(() => {
1043
+ Y.value = !1, H(), wt();
1038
1044
  }, 400);
1039
1045
  }
1040
- function $() {
1046
+ function wt() {
1041
1047
  try {
1042
- localStorage.setItem("characterPosition", JSON.stringify({ x: l.x, y: l.y })), localStorage.setItem("panelPosition", R.value), localStorage.setItem("backPosition", Y.value);
1048
+ localStorage.setItem("characterPosition", JSON.stringify({ x: k.x, y: k.y })), localStorage.setItem("panelPosition", L.value), localStorage.setItem("backPosition", B.value);
1043
1049
  } catch {
1044
1050
  }
1045
1051
  }
1046
- function B() {
1047
- const C = localStorage.getItem("characterPosition");
1048
- if (C) {
1049
- const X = JSON.parse(C);
1050
- l.x = X.x, l.y = Math.min(Math.max(X.y, 0), window.innerHeight - at);
1052
+ function ht() {
1053
+ const u = localStorage.getItem("characterPosition");
1054
+ if (u) {
1055
+ const I = JSON.parse(u);
1056
+ k.x = I.x, k.y = Math.min(Math.max(I.y, 0), window.innerHeight - vt);
1051
1057
  } else
1052
- l.x = window.innerWidth - u, l.y = window.innerHeight / 2 - at / 2;
1053
- const S = localStorage.getItem("panelPosition"), L = localStorage.getItem("backPosition");
1054
- S && (R.value = S), L && (Y.value = L);
1058
+ k.x = window.innerWidth - d, k.y = window.innerHeight / 2 - vt / 2;
1059
+ const D = localStorage.getItem("panelPosition"), W = localStorage.getItem("backPosition");
1060
+ D && (L.value = D), W && (B.value = W);
1061
+ }
1062
+ function st(u) {
1063
+ if (!e.value) return;
1064
+ const D = "touches" in u ? u.touches[0].clientX : u.clientX, W = "touches" in u ? u.touches[0].clientY : u.clientY, I = D - l.x, ut = Math.max(0, Math.min(W - l.y, window.innerHeight - vt)), Lt = Math.abs(I - k.x), Bt = Math.abs(ut - k.y);
1065
+ Lt + Bt > 5 && (v.value = !0), k.x = I, k.y = ut;
1055
1066
  }
1056
- function D(C) {
1057
- if (!d.value) return;
1058
- const S = "touches" in C ? C.touches[0].clientX : C.clientX, L = "touches" in C ? C.touches[0].clientY : C.clientY, X = S - e.x, ot = Math.max(0, Math.min(L - e.y, window.innerHeight - at)), F = Math.abs(X - l.x), tt = Math.abs(ot - l.y);
1059
- F + tt > 5 && (Q.value = !0), l.x = X, l.y = ot;
1067
+ function ot() {
1068
+ e.value && (e.value = !1, v.value && (nt(), v.value = !1));
1060
1069
  }
1061
- function G() {
1062
- d.value && (d.value = !1, Q.value && (y(), Q.value = !1));
1070
+ function mt(u) {
1071
+ Y.value = !1, e.value = !0, v.value = !1;
1072
+ const D = "touches" in u ? u.touches[0].clientX : u.clientX, W = "touches" in u ? u.touches[0].clientY : u.clientY;
1073
+ l.x = D - k.x, l.y = W - k.y;
1063
1074
  }
1064
- function Z(C) {
1065
- O.value = !1, d.value = !0, Q.value = !1;
1066
- const S = "touches" in C ? C.touches[0].clientX : C.clientX, L = "touches" in C ? C.touches[0].clientY : C.clientY;
1067
- e.x = S - l.x, e.y = L - l.y;
1075
+ function kt() {
1076
+ if (!v.value && !Y.value) {
1077
+ H();
1078
+ const u = ft();
1079
+ i.x = k.x, i.y = k.y, i.w = 78, i.h = 78, i.radius = "50%", m.value = !0, s.value = "expanding", c.value = !0, tt(() => {
1080
+ requestAnimationFrame(() => {
1081
+ m.value = !1, i.x = u.x, i.y = u.y, i.w = u.w, i.h = u.h, i.radius = u.radius;
1082
+ });
1083
+ }), setTimeout(() => {
1084
+ s.value = "idle";
1085
+ }, 400);
1086
+ } else
1087
+ v.value = !1;
1088
+ }
1089
+ function ft() {
1090
+ const u = window.innerHeight - 78, D = 54;
1091
+ if (p.value) {
1092
+ const ut = window.innerWidth * 0.8;
1093
+ return {
1094
+ x: (window.innerWidth - ut) / 2,
1095
+ y: D,
1096
+ w: ut,
1097
+ h: u,
1098
+ radius: "14px"
1099
+ };
1100
+ }
1101
+ const W = 490;
1102
+ return { x: L.value === "left" ? 24 : window.innerWidth - W - 24, y: D, w: W, h: u, radius: "14px" };
1068
1103
  }
1069
- function dt() {
1070
- !Q.value && !O.value ? (s(), c.value = !0) : Q.value = !1;
1104
+ function ct() {
1105
+ if (s.value !== "idle") return;
1106
+ const u = ft();
1107
+ i.x = u.x, i.y = u.y, i.w = u.w, i.h = u.h, i.radius = u.radius, m.value = !0, s.value = "collapsing", tt(() => {
1108
+ requestAnimationFrame(() => {
1109
+ m.value = !1, i.x = k.x + a.value * 6, i.y = k.y, i.w = 78, i.h = 78, i.radius = "50%";
1110
+ });
1111
+ }), setTimeout(() => {
1112
+ c.value = !1, s.value = "idle", o.value = !0;
1113
+ }, 400), setTimeout(() => {
1114
+ o.value = !1;
1115
+ }, 1400);
1071
1116
  }
1072
- function ct(C) {
1073
- q(), v.value = "answer", it(() => {
1074
- var S;
1075
- (S = N.value) == null || S.goHistoryMessage(C);
1117
+ function Ct(u) {
1118
+ J(), g.value = "answer", tt(() => {
1119
+ var D;
1120
+ (D = b.value) == null || D.goHistoryMessage(u);
1076
1121
  });
1077
1122
  }
1078
- function gt() {
1079
- f.value = "", v.value = "answer", it(() => {
1080
- var C;
1081
- (C = N.value) == null || C.createNewConversation();
1123
+ function at() {
1124
+ h.value = "", g.value = "answer", tt(() => {
1125
+ var u;
1126
+ (u = b.value) == null || u.createNewConversation();
1082
1127
  });
1083
1128
  }
1084
- function mt() {
1085
- q(), f.value = "", it(() => {
1086
- var C;
1087
- (C = N.value) == null || C.createNewConversation();
1129
+ function x() {
1130
+ J(), h.value = "", tt(() => {
1131
+ var u;
1132
+ (u = b.value) == null || u.createNewConversation();
1088
1133
  });
1089
1134
  }
1090
- function ft() {
1091
- T.value = !1, M.value = !0;
1135
+ function Q() {
1136
+ R.value = !1, O.value = !0;
1092
1137
  }
1093
- function q() {
1094
- T.value = !0, setTimeout(() => {
1095
- M.value = !1, T.value = !1;
1138
+ function J() {
1139
+ R.value = !0, setTimeout(() => {
1140
+ O.value = !1, R.value = !1;
1096
1141
  }, 300);
1097
1142
  }
1098
- function ht() {
1099
- w.value = o.value, g.value = !1;
1143
+ function q() {
1144
+ w.value = M.value, T.value = !1;
1100
1145
  }
1101
- Et(a, (C) => {
1102
- C ? R.value = "center" : s();
1103
- }), z(() => {
1104
- B();
1146
+ Ot(p, (u) => {
1147
+ u ? L.value = "center" : H();
1148
+ }), et(() => {
1149
+ ht();
1105
1150
  });
1106
- function I() {
1107
- P && clearTimeout(P), P = setTimeout(() => y(), 100);
1151
+ function Z() {
1152
+ C && clearTimeout(C), C = setTimeout(() => nt(), 100);
1108
1153
  }
1109
- return z(() => {
1110
- window.addEventListener("resize", I);
1111
- }), yt(() => {
1112
- window.removeEventListener("resize", I), P && clearTimeout(P);
1113
- }), z(() => {
1114
- document.addEventListener("mousemove", D), document.addEventListener("touchmove", D, { passive: !0 }), document.addEventListener("mouseup", G), document.addEventListener("touchend", G);
1115
- }), yt(() => {
1116
- document.removeEventListener("mousemove", D), document.removeEventListener("touchmove", D), document.removeEventListener("mouseup", G), document.removeEventListener("touchend", G);
1117
- }), (C, S) => (p(), k("div", null, [
1118
- c.value ? (p(), k("div", {
1154
+ return et(() => {
1155
+ window.addEventListener("resize", Z);
1156
+ }), bt(() => {
1157
+ window.removeEventListener("resize", Z), C && clearTimeout(C);
1158
+ }), et(() => {
1159
+ document.addEventListener("mousemove", st), document.addEventListener("touchmove", st, { passive: !0 }), document.addEventListener("mouseup", ot), document.addEventListener("touchend", ot);
1160
+ }), bt(() => {
1161
+ document.removeEventListener("mousemove", st), document.removeEventListener("touchmove", st), document.removeEventListener("mouseup", ot), document.removeEventListener("touchend", ot);
1162
+ }), (u, D) => (y(), S("div", null, [
1163
+ c.value ? (y(), S("div", {
1119
1164
  key: 0,
1120
- class: J(["ai-panel", a.value ? "maxWrap" : "minWrap", m.value])
1165
+ class: F(["ai-panel", p.value ? "maxWrap" : "minWrap", f.value, s.value !== "idle" ? s.value : "", { morphing: s.value !== "idle", "morph-instant": m.value }]),
1166
+ style: St(N.value)
1121
1167
  }, [
1122
- n("div", fn, [
1123
- v.value === "info" ? (p(), k("span", {
1168
+ n("div", An, [
1169
+ g.value === "info" ? (y(), S("span", {
1124
1170
  key: 0,
1125
- class: J(["back", Y.value]),
1126
- onClick: S[0] || (S[0] = (L) => v.value = "answer")
1127
- }, [...S[7] || (S[7] = [
1171
+ class: F(["back", B.value]),
1172
+ onClick: D[0] || (D[0] = (W) => g.value = "answer")
1173
+ }, [...D[6] || (D[6] = [
1128
1174
  n("span", { style: { "font-size": "14px" } }, "←", -1)
1129
- ])], 2)) : (p(), k("p", hn, [
1130
- n("img", { src: H(Zt) }, null, 8, pn)
1175
+ ])], 2)) : (y(), S("p", bn, [
1176
+ n("img", { src: $(ae) }, null, 8, Sn)
1131
1177
  ])),
1132
- n("div", yn, [
1178
+ n("div", En, [
1133
1179
  n("span", {
1134
- title: v.value === "info" ? "个人信息" : f.value || H(r).name
1135
- }, W(v.value === "info" ? "个人信息" : f.value || H(r).name), 9, kn)
1180
+ title: g.value === "info" ? "个人信息" : h.value || $(r).name
1181
+ }, X(g.value === "info" ? "个人信息" : h.value || $(r).name), 9, Rn)
1136
1182
  ]),
1137
1183
  n("p", null, [
1138
- ut(V(H(j), {
1184
+ pt(G($(U), {
1139
1185
  class: "op-icon",
1140
1186
  icon: "ic:round-add",
1141
- onClick: gt
1187
+ onClick: at
1142
1188
  }, null, 512), [
1143
- [pt, b.value]
1189
+ [At, A.value]
1144
1190
  ]),
1145
- V(H(j), {
1146
- class: J(["mute", { active: M.value }]),
1191
+ G($(U), {
1192
+ class: F(["mute", { active: O.value }]),
1147
1193
  icon: "ic:round-history",
1148
- onClick: S[1] || (S[1] = (L) => M.value ? q() : ft())
1194
+ onClick: D[1] || (D[1] = (W) => O.value ? J() : Q())
1149
1195
  }, null, 8, ["class"]),
1150
- V(H(j), {
1151
- onClick: S[2] || (S[2] = (L) => a.value = !a.value),
1152
- icon: a.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1196
+ G($(U), {
1197
+ onClick: D[2] || (D[2] = (W) => p.value = !p.value),
1198
+ icon: p.value ? "ic:round-fullscreen-exit" : "ic:round-fullscreen"
1153
1199
  }, null, 8, ["icon"]),
1154
- V(H(j), {
1155
- onClick: S[3] || (S[3] = (L) => c.value = !1),
1200
+ G($(U), {
1201
+ onClick: ct,
1156
1202
  icon: "ic:round-close"
1157
1203
  })
1158
1204
  ])
1159
1205
  ]),
1160
- ut(V(Xe, {
1206
+ pt(G(Je, {
1161
1207
  ref_key: "answerRef",
1162
- ref: N,
1163
- defaultSayhello: H(r).defaultSayhello,
1164
- defaultRecommend: H(r).defaultRecommend,
1165
- onTitleGenerated: S[4] || (S[4] = (L) => f.value = L)
1208
+ ref: b,
1209
+ defaultSayhello: $(r).defaultSayhello,
1210
+ defaultRecommend: $(r).defaultRecommend,
1211
+ onTitleGenerated: D[3] || (D[3] = (W) => h.value = W)
1166
1212
  }, null, 8, ["defaultSayhello", "defaultRecommend"]), [
1167
- [pt, v.value === "answer"]
1213
+ [At, g.value === "answer"]
1168
1214
  ]),
1169
- v.value === "info" ? (p(), rt(mn, { key: 0 })) : _("", !0),
1170
- M.value ? (p(), k("div", {
1215
+ g.value === "info" ? (y(), gt(Cn, { key: 0 })) : _("", !0),
1216
+ O.value ? (y(), S("div", {
1171
1217
  key: 1,
1172
- class: J(["ai-history-drawer", { closing: T.value }])
1218
+ class: F(["ai-history-drawer", { closing: R.value }])
1173
1219
  }, [
1174
1220
  n("div", {
1175
1221
  class: "ai-history-backdrop",
1176
- onClick: q
1222
+ onClick: J
1177
1223
  }),
1178
- n("div", wn, [
1179
- n("div", Cn, [
1180
- S[8] || (S[8] = n("span", null, "对话记录", -1)),
1181
- V(H(j), {
1224
+ n("div", Tn, [
1225
+ n("div", Mn, [
1226
+ D[7] || (D[7] = n("span", null, "对话记录", -1)),
1227
+ G($(U), {
1182
1228
  icon: "ic:round-close",
1183
1229
  class: "ai-history-drawer-close",
1184
- onClick: q
1230
+ onClick: J
1185
1231
  })
1186
1232
  ]),
1187
- V(Ie, {
1188
- onHistoryDetail: ct,
1189
- onNewConversation: mt
1233
+ G(ln, {
1234
+ onHistoryDetail: Ct,
1235
+ onNewConversation: x
1190
1236
  })
1191
1237
  ])
1192
1238
  ], 2)) : _("", !0),
1193
- ut(n("div", An, [
1194
- n("div", bn, [
1195
- n("div", Sn, [
1196
- S[9] || (S[9] = n("p", { class: "title" }, "修改标题", -1)),
1197
- ut(n("textarea", {
1198
- "onUpdate:modelValue": S[5] || (S[5] = (L) => o.value = L),
1239
+ pt(n("div", Dn, [
1240
+ n("div", Hn, [
1241
+ n("div", On, [
1242
+ D[8] || (D[8] = n("p", { class: "title" }, "修改标题", -1)),
1243
+ pt(n("textarea", {
1244
+ "onUpdate:modelValue": D[4] || (D[4] = (W) => M.value = W),
1199
1245
  placeholder: "请输入新标题"
1200
1246
  }, null, 512), [
1201
- [Bt, o.value]
1247
+ [Xt, M.value]
1202
1248
  ]),
1203
- n("p", En, [
1249
+ n("p", $n, [
1204
1250
  n("span", {
1205
- onClick: S[6] || (S[6] = (L) => g.value = !1)
1251
+ onClick: D[5] || (D[5] = (W) => T.value = !1)
1206
1252
  }, "取消"),
1207
- n("span", { onClick: ht }, "确定")
1253
+ n("span", { onClick: q }, "确定")
1208
1254
  ])
1209
1255
  ])
1210
1256
  ])
1211
1257
  ], 512), [
1212
- [pt, g.value]
1258
+ [At, T.value]
1213
1259
  ])
1214
- ], 2)) : _("", !0),
1215
- c.value ? _("", !0) : (p(), k("div", {
1260
+ ], 6)) : _("", !0),
1261
+ c.value ? _("", !0) : (y(), S("div", {
1216
1262
  key: 1,
1217
- class: J(["character", { dragging: d.value, recycling: O.value }]),
1218
- style: Rt(A.value),
1219
- onMousedown: Z,
1220
- onTouchstart: Z,
1221
- onClick: dt
1263
+ class: F(["character", { dragging: e.value, recycling: Y.value, "hover-preview": o.value }]),
1264
+ style: St(P.value),
1265
+ onMousedown: mt,
1266
+ onTouchstart: mt,
1267
+ onClick: kt
1222
1268
  }, [
1223
- n("img", { src: H(It) }, null, 8, Rn)
1269
+ n("img", { src: $(ie) }, null, 8, Pn)
1224
1270
  ], 38))
1225
1271
  ]));
1226
1272
  }
1227
1273
  });
1228
- let lt = null;
1229
- const Bn = (t) => {
1230
- Mt(t);
1231
- }, Ln = (t) => {
1232
- const u = t || document.body, r = document.createElement("div");
1233
- r.id = "ai-assist-root", u.appendChild(r), lt = Lt(Tt), lt.mount(r);
1234
- }, Nn = () => {
1235
- lt && (lt.unmount(), lt = null);
1274
+ let dt = null;
1275
+ const Qn = (t) => {
1276
+ $t(t);
1277
+ }, Xn = (t) => {
1278
+ const d = t || document.body, r = document.createElement("div");
1279
+ r.id = "ai-assist-root", d.appendChild(r), dt = _t(Pt), dt.mount(r);
1280
+ }, _n = () => {
1281
+ dt && (dt.unmount(), dt = null);
1236
1282
  const t = document.getElementById("ai-assist-root");
1237
1283
  t && t.remove();
1238
- }, Yn = {
1239
- install(t, u) {
1240
- Mt(u), t.component("AiAssist", Tt);
1284
+ }, Gn = {
1285
+ install(t, d) {
1286
+ $t(d), t.component("AiAssist", Pt);
1241
1287
  }
1242
1288
  };
1243
1289
  export {
1244
- Tt as AiAssist,
1245
- Yn as default,
1246
- Bn as initAiAssist,
1247
- Ln as mountAiAssist,
1248
- Nn as unmountAiAssist
1290
+ Pt as AiAssist,
1291
+ Gn as default,
1292
+ Qn as initAiAssist,
1293
+ Xn as mountAiAssist,
1294
+ _n as unmountAiAssist
1249
1295
  };