@somecat/ai-assist-sdk 1.1.2 → 1.1.4
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.
- package/dist/ai-assist-sdk.css +1 -1
- package/dist/chunks/index-CgnkZbtP.mjs +149 -0
- package/dist/react/components/Answer.d.ts +1 -2
- package/dist/react/components/answer/components/AgentThoughtBlock.d.ts +5 -0
- package/dist/react/components/answer/components/ChatInput.d.ts +13 -0
- package/dist/react/components/answer/components/MessageItem.d.ts +9 -0
- package/dist/react/components/answer/components/StreamingMarkdown.d.ts +12 -0
- package/dist/react/components/answer/components/ThinkingBlock.d.ts +6 -0
- package/dist/react/components/answer/hooks/useChatActions.d.ts +30 -0
- package/dist/react/components/answer/hooks/useMessagesBatch.d.ts +11 -0
- package/dist/react/components/answer/hooks/useSSEStream.d.ts +26 -0
- package/dist/react/components/answer/hooks/useScrollManager.d.ts +12 -0
- package/dist/react/components/answer/status.d.ts +10 -0
- package/dist/react/index.mjs +9537 -9351
- package/dist/vue/index.mjs +348 -344
- package/package.json +3 -1
- package/dist/chunks/index-Co5SARS3.mjs +0 -152
package/dist/vue/index.mjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { r as yt, p as kt, u as Ht, c as Pt, g as $t, s as Lt, a as Bt, b as Nt, d as Yt, e as
|
|
3
|
-
import { SearchOutlined as Gt, CheckOutlined as Vt, CopyOutlined as Jt, RedoOutlined as Ft
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { f as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as nt, reactive as K, openBlock as g, createElementBlock as y, normalizeClass as U, Fragment as z, createStaticVNode as bt, createCommentVNode as Y, renderList as at, createElementVNode as n, createVNode as F, unref as M, toDisplayString as X, Transition as St, withCtx as Et, createBlock as j, withKeys as Rt, ref as T, nextTick as ut, computed as et, watch as wt, onMounted as q, onUnmounted as mt, withModifiers as ft, Teleport as Tt, withDirectives as gt, vShow as pt, vModelText as Dt, normalizeStyle as Mt, createApp as Ot } from "vue";
|
|
2
|
+
import { r as yt, p as kt, u as Ht, c as Pt, g as $t, s as Lt, a as Bt, b as Nt, d as Yt, e as vt, f as Qt, h as _t, i as Xt, j as Wt, k as Ct } from "../chunks/index-DctVgLU4.mjs";
|
|
3
|
+
import { SearchOutlined as Gt, CheckOutlined as Vt, CopyOutlined as Jt, RedoOutlined as Ft } from "@ant-design/icons-vue";
|
|
4
|
+
import { Icon as x } from "@iconify/vue";
|
|
5
|
+
import { f as Ut, s as it, a as jt, b as qt, c as xt } from "../chunks/index-CgnkZbtP.mjs";
|
|
6
|
+
const zt = "data:image/png;base64,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", Kt = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "message-content ba-markdown"
|
|
9
|
-
},
|
|
9
|
+
}, Zt = { class: "agent-thought__spinner" }, It = { class: "agent-thought__text" }, te = ["onClick"], ee = { class: "thinking-block__title" }, ne = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "thinking-block__content"
|
|
12
|
-
},
|
|
12
|
+
}, se = { key: 2 }, oe = ["innerHTML"], ae = {
|
|
13
13
|
key: 0,
|
|
14
14
|
class: "streaming-cursor"
|
|
15
|
-
},
|
|
15
|
+
}, ie = ["innerHTML"], le = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "streaming-cursor"
|
|
18
|
-
},
|
|
18
|
+
}, ce = {
|
|
19
19
|
key: 3,
|
|
20
20
|
class: "message-error"
|
|
21
|
-
},
|
|
21
|
+
}, re = {
|
|
22
22
|
key: 4,
|
|
23
23
|
class: "message-toolbar"
|
|
24
|
-
},
|
|
24
|
+
}, ue = ["data-tooltip"], ve = {
|
|
25
25
|
class: "tooltip-enhanced",
|
|
26
26
|
"data-tooltip": "重新回答"
|
|
27
|
-
},
|
|
27
|
+
}, de = {
|
|
28
28
|
key: 1,
|
|
29
29
|
class: "message-content"
|
|
30
|
-
},
|
|
30
|
+
}, ge = /* @__PURE__ */ nt({
|
|
31
31
|
__name: "MessageItem",
|
|
32
32
|
props: {
|
|
33
33
|
msg: {},
|
|
@@ -39,11 +39,11 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
39
39
|
},
|
|
40
40
|
emits: ["regenerate"],
|
|
41
41
|
setup(t, { emit: v }) {
|
|
42
|
-
const a =
|
|
42
|
+
const a = K(/* @__PURE__ */ new Map());
|
|
43
43
|
function u(C) {
|
|
44
44
|
a.set(C, a.get(C) !== !0);
|
|
45
45
|
}
|
|
46
|
-
const i =
|
|
46
|
+
const i = K(/* @__PURE__ */ new Map());
|
|
47
47
|
function s(C, o) {
|
|
48
48
|
var h;
|
|
49
49
|
try {
|
|
@@ -59,29 +59,29 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
59
59
|
return (C, o) => {
|
|
60
60
|
var h;
|
|
61
61
|
return g(), y("div", {
|
|
62
|
-
class:
|
|
62
|
+
class: U(["message", `${t.msg.type}-message`])
|
|
63
63
|
}, [
|
|
64
|
-
t.msg.type === "ai" ? (g(), y(
|
|
65
|
-
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), y("div",
|
|
66
|
-
|
|
67
|
-
])])) :
|
|
64
|
+
t.msg.type === "ai" ? (g(), y(z, { key: 0 }, [
|
|
65
|
+
(t.msg.status === t.STATUS.THINKING || t.msg.status === t.STATUS.RETHINKING) && !t.msg.thinkingContent && !t.msg.content ? (g(), y("div", Kt, [...o[2] || (o[2] = [
|
|
66
|
+
bt('<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
|
+
])])) : Y("", !0),
|
|
68
68
|
t.msg.segments && t.msg.segments.length ? (g(), y("div", {
|
|
69
69
|
key: 1,
|
|
70
70
|
class: "message-content ba-markdown",
|
|
71
71
|
ref: (c) => t.setMessageRef(c, t.index)
|
|
72
72
|
}, [
|
|
73
|
-
(g(!0), y(
|
|
73
|
+
(g(!0), y(z, null, at(t.msg.segments, (c, l) => (g(), y(z, { key: l }, [
|
|
74
74
|
c.type === "agent_thought" ? (g(), y("div", {
|
|
75
75
|
key: 0,
|
|
76
|
-
class:
|
|
76
|
+
class: U(["agent-thought", { "agent-thought--done": c.duration != null }])
|
|
77
77
|
}, [
|
|
78
|
-
n("span",
|
|
79
|
-
|
|
78
|
+
n("span", Zt, [
|
|
79
|
+
F(M(Gt))
|
|
80
80
|
]),
|
|
81
|
-
n("span",
|
|
81
|
+
n("span", It, X(c.duration != null ? "工具调用" : "工具调用中..."), 1)
|
|
82
82
|
], 2)) : c.type === "thinking" ? (g(), y("div", {
|
|
83
83
|
key: 1,
|
|
84
|
-
class:
|
|
84
|
+
class: U(["thinking-block", {
|
|
85
85
|
"thinking-block--expanded": a.get(l) === !0,
|
|
86
86
|
"thinking-block--active": c.duration == null
|
|
87
87
|
}])
|
|
@@ -91,9 +91,9 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
91
91
|
onClick: (r) => u(l)
|
|
92
92
|
}, [
|
|
93
93
|
o[4] || (o[4] = n("span", { class: "thinking-block__indicator" }, null, -1)),
|
|
94
|
-
n("span",
|
|
94
|
+
n("span", ee, X(c.duration != null ? "深度思考" : "深度思考中"), 1),
|
|
95
95
|
(g(), y("svg", {
|
|
96
|
-
class:
|
|
96
|
+
class: U(["thinking-block__arrow", { "thinking-block__arrow--down": a.get(l) === !0 }]),
|
|
97
97
|
viewBox: "0 0 24 24",
|
|
98
98
|
width: "14",
|
|
99
99
|
height: "14",
|
|
@@ -105,21 +105,21 @@ 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,
|
|
109
|
-
|
|
108
|
+
], 8, te),
|
|
109
|
+
F(St, { name: "thinking-expand" }, {
|
|
110
110
|
default: Et(() => [
|
|
111
|
-
a.get(l) === !0 ? (g(), y("div",
|
|
111
|
+
a.get(l) === !0 ? (g(), y("div", ne, X(c.content), 1)) : Y("", !0)
|
|
112
112
|
]),
|
|
113
113
|
_: 2
|
|
114
114
|
}, 1024)
|
|
115
|
-
], 2)) : (g(), y("div",
|
|
115
|
+
], 2)) : (g(), y("div", se, [
|
|
116
116
|
n("div", {
|
|
117
117
|
innerHTML: M(yt)(M(kt)(t.getSegmentDisplayContent(t.index, l, c, t.msg)))
|
|
118
|
-
}, null, 8,
|
|
118
|
+
}, null, 8, oe)
|
|
119
119
|
]))
|
|
120
120
|
], 64))), 128)),
|
|
121
|
-
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span",
|
|
122
|
-
], 512)) :
|
|
121
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span", ae)) : Y("", !0)
|
|
122
|
+
], 512)) : Y("", !0),
|
|
123
123
|
!((h = t.msg.segments) != null && h.length) && t.msg.content ? (g(), y("div", {
|
|
124
124
|
key: 2,
|
|
125
125
|
class: "message-content ba-markdown",
|
|
@@ -127,44 +127,44 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
127
127
|
}, [
|
|
128
128
|
n("div", {
|
|
129
129
|
innerHTML: M(yt)(M(kt)(t.displayedContent.get(t.index) ?? t.msg.content))
|
|
130
|
-
}, null, 8,
|
|
131
|
-
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span",
|
|
132
|
-
], 512)) :
|
|
133
|
-
t.msg.errorMessage ? (g(), y("div",
|
|
130
|
+
}, null, 8, ie),
|
|
131
|
+
t.msg.status === t.STATUS.ANSWERING ? (g(), y("span", le)) : Y("", !0)
|
|
132
|
+
], 512)) : Y("", !0),
|
|
133
|
+
t.msg.errorMessage ? (g(), y("div", ce, [
|
|
134
134
|
o[5] || (o[5] = n("span", { class: "message-error__icon" }, "⚠️", -1)),
|
|
135
|
-
n("span", null,
|
|
136
|
-
])) :
|
|
137
|
-
t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (g(), y("div",
|
|
135
|
+
n("span", null, X(t.msg.errorMessage), 1)
|
|
136
|
+
])) : Y("", !0),
|
|
137
|
+
t.msg.status === t.STATUS.COMPLETED || t.msg.status === t.STATUS.STOP ? (g(), y("div", re, [
|
|
138
138
|
n("div", {
|
|
139
139
|
class: "tooltip-enhanced",
|
|
140
140
|
"data-tooltip": i.get(t.index) ? "已复制" : "复制回答"
|
|
141
141
|
}, [
|
|
142
|
-
i.get(t.index) ? (g(),
|
|
142
|
+
i.get(t.index) ? (g(), j(M(Vt), {
|
|
143
143
|
key: 0,
|
|
144
144
|
class: "message-toolbar__check"
|
|
145
|
-
})) : (g(),
|
|
145
|
+
})) : (g(), j(M(Jt), {
|
|
146
146
|
key: 1,
|
|
147
147
|
onClick: o[0] || (o[0] = (c) => s(t.msg, t.index))
|
|
148
148
|
}))
|
|
149
|
-
], 8,
|
|
150
|
-
n("div",
|
|
151
|
-
|
|
149
|
+
], 8, ue),
|
|
150
|
+
n("div", ve, [
|
|
151
|
+
F(M(Ft), {
|
|
152
152
|
onClick: o[1] || (o[1] = (c) => C.$emit("regenerate"))
|
|
153
153
|
})
|
|
154
154
|
])
|
|
155
|
-
])) :
|
|
156
|
-
], 64)) : (g(), y("div",
|
|
155
|
+
])) : Y("", !0)
|
|
156
|
+
], 64)) : (g(), y("div", de, X(t.msg.content), 1))
|
|
157
157
|
], 2);
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
}),
|
|
160
|
+
}), me = { class: "input-container" }, he = ["value", "disabled"], fe = {
|
|
161
161
|
key: 0,
|
|
162
162
|
class: "tooltip-enhanced stop",
|
|
163
163
|
"data-tooltip": "停止生成"
|
|
164
|
-
},
|
|
164
|
+
}, pe = ["data-tooltip"], ye = {
|
|
165
165
|
key: 2,
|
|
166
166
|
class: "moveTB"
|
|
167
|
-
},
|
|
167
|
+
}, ke = /* @__PURE__ */ nt({
|
|
168
168
|
__name: "ChatInput",
|
|
169
169
|
props: {
|
|
170
170
|
modelValue: {},
|
|
@@ -175,7 +175,7 @@ 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 (v, a) => (g(), y("div",
|
|
178
|
+
return (v, a) => (g(), y("div", me, [
|
|
179
179
|
n("input", {
|
|
180
180
|
value: t.modelValue,
|
|
181
181
|
type: "text",
|
|
@@ -183,38 +183,38 @@ const te = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAA
|
|
|
183
183
|
onInput: a[0] || (a[0] = (u) => v.$emit("update:modelValue", u.target.value)),
|
|
184
184
|
onKeyup: a[1] || (a[1] = Rt((u) => t.modelValue.trim() && v.$emit("send"), ["enter"])),
|
|
185
185
|
disabled: t.isGenerating
|
|
186
|
-
}, null, 40,
|
|
187
|
-
t.isGenerating && t.lastUserMessage ? (g(), y("div",
|
|
188
|
-
|
|
186
|
+
}, null, 40, he),
|
|
187
|
+
t.isGenerating && t.lastUserMessage ? (g(), y("div", fe, [
|
|
188
|
+
F(M(x), {
|
|
189
189
|
class: "op-icon stop-icon",
|
|
190
190
|
icon: "heroicons-solid:stop",
|
|
191
191
|
onClick: a[2] || (a[2] = (u) => v.$emit("stop"))
|
|
192
192
|
})
|
|
193
193
|
])) : (g(), y("div", {
|
|
194
194
|
key: 1,
|
|
195
|
-
class:
|
|
195
|
+
class: U(["tooltip-enhanced send", { disabled: !t.modelValue.trim() }]),
|
|
196
196
|
"data-tooltip": t.modelValue.trim() ? "开始回答" : "请输入你的问题"
|
|
197
197
|
}, [
|
|
198
|
-
|
|
198
|
+
F(M(x), {
|
|
199
199
|
class: "op-icon",
|
|
200
200
|
icon: "fluent-color:send-16",
|
|
201
201
|
onClick: a[3] || (a[3] = (u) => t.modelValue.trim() && v.$emit("send"))
|
|
202
202
|
})
|
|
203
|
-
], 10,
|
|
204
|
-
t.hasScroll && !t.isAtBottom ? (g(), y("div",
|
|
205
|
-
|
|
203
|
+
], 10, pe)),
|
|
204
|
+
t.hasScroll && !t.isAtBottom ? (g(), y("div", ye, [
|
|
205
|
+
F(M(x), {
|
|
206
206
|
class: "op-icon",
|
|
207
207
|
icon: "ep:bottom",
|
|
208
208
|
onClick: a[4] || (a[4] = (u) => v.$emit("scroll-to-bottom"))
|
|
209
209
|
})
|
|
210
|
-
])) :
|
|
210
|
+
])) : Y("", !0)
|
|
211
211
|
]));
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
|
-
function
|
|
215
|
-
const v =
|
|
214
|
+
function we(t) {
|
|
215
|
+
const v = T(!0), a = T(!1);
|
|
216
216
|
function u() {
|
|
217
|
-
|
|
217
|
+
ut(() => {
|
|
218
218
|
t.value && (t.value.scrollTop = t.value.scrollHeight);
|
|
219
219
|
});
|
|
220
220
|
}
|
|
@@ -225,7 +225,7 @@ function be(t) {
|
|
|
225
225
|
}
|
|
226
226
|
return { isAtBottom: v, hasScroll: a, scrollToBottom: u, checkScrollStatus: i };
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Ce() {
|
|
229
229
|
function t(v) {
|
|
230
230
|
v.querySelectorAll("pre").forEach((u) => {
|
|
231
231
|
if (u.querySelector(".copy-button")) return;
|
|
@@ -248,7 +248,7 @@ function Ee() {
|
|
|
248
248
|
}
|
|
249
249
|
return { enhanceCodeBlocks: t };
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function Ae(t) {
|
|
252
252
|
let v = null, a = 0;
|
|
253
253
|
function u(s) {
|
|
254
254
|
v = s(v || [...t.value]), a || (a = requestAnimationFrame(() => {
|
|
@@ -260,55 +260,55 @@ function Re(t) {
|
|
|
260
260
|
}
|
|
261
261
|
return { batchMessagesUpdate: u, flushMessagesBatch: i };
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
const u =
|
|
263
|
+
function be(t, v, a) {
|
|
264
|
+
const u = K(/* @__PURE__ */ new Map()), i = T(/* @__PURE__ */ new Map());
|
|
265
265
|
let s = 0, C = 0;
|
|
266
266
|
function o() {
|
|
267
267
|
if (s) return;
|
|
268
|
-
const r = 16,
|
|
269
|
-
if (
|
|
270
|
-
C =
|
|
268
|
+
const r = 16, R = 1, L = 40, Q = (D) => {
|
|
269
|
+
if (D - C >= r) {
|
|
270
|
+
C = D;
|
|
271
271
|
let B = !1;
|
|
272
272
|
if (t.value.forEach((d, O) => {
|
|
273
273
|
if (d.type !== "ai" || d.status !== a) return;
|
|
274
274
|
const A = d.content, k = i.value.get(O) ?? 0, P = A.length - k;
|
|
275
275
|
if (P > 0) {
|
|
276
276
|
B = !0;
|
|
277
|
-
const N = P > 15 ? Math.min(Math.ceil(P * 0.3), L) :
|
|
278
|
-
i.value.set(O,
|
|
277
|
+
const N = P > 15 ? Math.min(Math.ceil(P * 0.3), L) : R, b = Math.min(k + N, A.length);
|
|
278
|
+
i.value.set(O, b), u.set(O, A.slice(0, b));
|
|
279
279
|
}
|
|
280
280
|
}), B && v(), !t.value.some((d) => d.type === "ai" && d.status === a)) {
|
|
281
281
|
s = 0;
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
s = requestAnimationFrame(
|
|
285
|
+
s = requestAnimationFrame(Q);
|
|
286
286
|
};
|
|
287
|
-
s = requestAnimationFrame(
|
|
287
|
+
s = requestAnimationFrame(Q);
|
|
288
288
|
}
|
|
289
289
|
function h() {
|
|
290
|
-
s && (cancelAnimationFrame(s), s = 0), t.value.forEach((r,
|
|
291
|
-
r.type === "ai" && (u.set(
|
|
290
|
+
s && (cancelAnimationFrame(s), s = 0), t.value.forEach((r, R) => {
|
|
291
|
+
r.type === "ai" && (u.set(R, r.content), i.value.set(R, r.content.length));
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
function c() {
|
|
295
295
|
s && (cancelAnimationFrame(s), s = 0);
|
|
296
296
|
}
|
|
297
|
-
function l(r,
|
|
298
|
-
if (L.type !== "answer" ||
|
|
299
|
-
const
|
|
300
|
-
if (
|
|
297
|
+
function l(r, R, L, Q) {
|
|
298
|
+
if (L.type !== "answer" || Q.status !== a) return L.content;
|
|
299
|
+
const D = Q.segments || [];
|
|
300
|
+
if (D.slice(R + 1).some((A) => A.type === "answer")) return L.content;
|
|
301
301
|
const e = i.value.get(r);
|
|
302
302
|
if (e == null) return L.content;
|
|
303
303
|
let d = 0;
|
|
304
|
-
for (let A = 0; A <
|
|
305
|
-
|
|
304
|
+
for (let A = 0; A < R; A++)
|
|
305
|
+
D[A].type === "answer" && (d += D[A].content.length);
|
|
306
306
|
const O = d + L.content.length;
|
|
307
307
|
return e >= O ? L.content : e <= d ? "" : L.content.slice(0, e - d);
|
|
308
308
|
}
|
|
309
309
|
return { displayedContent: u, streamingIndexRef: i, startTypewriter: o, flushTypewriter: h, getSegmentDisplayContent: l, stopTypewriter: c };
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function Se({
|
|
312
312
|
messages: t,
|
|
313
313
|
isGenerating: v,
|
|
314
314
|
lastUserMessage: a,
|
|
@@ -317,42 +317,42 @@ function De({
|
|
|
317
317
|
STATUS: s,
|
|
318
318
|
cfg: C
|
|
319
319
|
}) {
|
|
320
|
-
const o =
|
|
321
|
-
function
|
|
322
|
-
const B = o.value.get(
|
|
320
|
+
const o = T(/* @__PURE__ */ new Map()), h = T(/* @__PURE__ */ new Map()), c = T(/* @__PURE__ */ new Map()), l = T(/* @__PURE__ */ new Map()), r = T(!1);
|
|
321
|
+
function R(D) {
|
|
322
|
+
const B = o.value.get(D) || [];
|
|
323
323
|
u((e) => {
|
|
324
|
-
if (e[
|
|
324
|
+
if (e[D]) {
|
|
325
325
|
const d = [...e];
|
|
326
|
-
return d[
|
|
326
|
+
return d[D] = { ...d[D], segments: B.map((O) => ({ ...O })) }, d;
|
|
327
327
|
}
|
|
328
328
|
return e;
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
function L(
|
|
332
|
-
const B = o.value.get(
|
|
331
|
+
function L(D) {
|
|
332
|
+
const B = o.value.get(D) || [], e = c.value.get(D);
|
|
333
333
|
let d = 0, O = !1;
|
|
334
334
|
B.forEach((A) => {
|
|
335
335
|
if (A.type === "thinking" && A.duration == null) {
|
|
336
336
|
const k = e ? Math.round((Date.now() - e) / 1e3 * 10) / 10 : 0;
|
|
337
337
|
A.duration = k, d += k, O = !0;
|
|
338
338
|
}
|
|
339
|
-
}), O && (o.value.set(
|
|
340
|
-
if (A[
|
|
339
|
+
}), O && (o.value.set(D, B), u((A) => {
|
|
340
|
+
if (A[D]) {
|
|
341
341
|
const k = [...A];
|
|
342
|
-
return k[
|
|
343
|
-
...k[
|
|
342
|
+
return k[D] = {
|
|
343
|
+
...k[D],
|
|
344
344
|
segments: B.map((P) => ({ ...P })),
|
|
345
|
-
thinkingDuration: (k[
|
|
345
|
+
thinkingDuration: (k[D].thinkingDuration || 0) + d
|
|
346
346
|
}, k;
|
|
347
347
|
}
|
|
348
348
|
return A;
|
|
349
349
|
}));
|
|
350
350
|
}
|
|
351
|
-
async function
|
|
351
|
+
async function Q(D, B, e, d, O = !1) {
|
|
352
352
|
r.value = !1, o.value.set(e, []), v.value = !0;
|
|
353
353
|
try {
|
|
354
|
-
const A = C.baseUrl.replace(/\/+$/, "") + "/" +
|
|
355
|
-
await
|
|
354
|
+
const A = C.baseUrl.replace(/\/+$/, "") + "/" + D.replace(/^\/+/, "");
|
|
355
|
+
await Ut(A, {
|
|
356
356
|
method: "POST",
|
|
357
357
|
headers: { "Content-Type": "application/json" },
|
|
358
358
|
body: JSON.stringify({ app: C.app ?? 1, data: B }),
|
|
@@ -368,27 +368,27 @@ function De({
|
|
|
368
368
|
for (; N.startsWith("data:"); )
|
|
369
369
|
N = N.replace(/^data:\s*/, "");
|
|
370
370
|
if (!N) return;
|
|
371
|
-
let
|
|
371
|
+
let b;
|
|
372
372
|
try {
|
|
373
|
-
|
|
373
|
+
b = JSON.parse(N);
|
|
374
374
|
} catch {
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
|
-
switch (
|
|
377
|
+
switch (b.event) {
|
|
378
378
|
case "message_start":
|
|
379
|
-
O || (a.value =
|
|
379
|
+
O || (a.value = b.id), h.value.set(e, "answer");
|
|
380
380
|
break;
|
|
381
381
|
case "think_message_output_start": {
|
|
382
382
|
c.value.set(e, Date.now()), h.value.set(e, "thinking");
|
|
383
383
|
const m = o.value.get(e) || [];
|
|
384
|
-
o.value.set(e, [...m, { type: "thinking", content: "" }]),
|
|
384
|
+
o.value.set(e, [...m, { type: "thinking", content: "" }]), R(e);
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
387
387
|
case "agent_thought": {
|
|
388
|
-
const m =
|
|
389
|
-
p && p.type === "agent_thought" ? p.content += m : (h.value.set(e, "agent_thought"), w.push({ type: "agent_thought", content: m }), l.value.set(e, Date.now())), o.value.set(e, w), u((
|
|
390
|
-
if (
|
|
391
|
-
const H = [...
|
|
388
|
+
const m = b.thought || b.thinking || "", w = o.value.get(e) || [], p = w[w.length - 1];
|
|
389
|
+
p && p.type === "agent_thought" ? p.content += m : (h.value.set(e, "agent_thought"), w.push({ type: "agent_thought", content: m }), l.value.set(e, Date.now())), o.value.set(e, w), u((S) => {
|
|
390
|
+
if (S[e]) {
|
|
391
|
+
const H = [...S];
|
|
392
392
|
return H[e] = {
|
|
393
393
|
...H[e],
|
|
394
394
|
segments: w.map(($) => ({ ...$ })),
|
|
@@ -396,15 +396,15 @@ function De({
|
|
|
396
396
|
status: s.THINKING
|
|
397
397
|
}, H;
|
|
398
398
|
}
|
|
399
|
-
return
|
|
399
|
+
return S;
|
|
400
400
|
});
|
|
401
401
|
break;
|
|
402
402
|
}
|
|
403
403
|
case "think_message": {
|
|
404
|
-
const m =
|
|
405
|
-
p && p.type === "thinking" ? p.content += m : (w.push({ type: "thinking", content: m }), c.value.set(e, Date.now())), o.value.set(e, w), u((
|
|
406
|
-
if (
|
|
407
|
-
const H = [...
|
|
404
|
+
const m = b.thinking || b.answer || b.text || "", w = o.value.get(e) || [], p = w[w.length - 1];
|
|
405
|
+
p && p.type === "thinking" ? p.content += m : (w.push({ type: "thinking", content: m }), c.value.set(e, Date.now())), o.value.set(e, w), u((S) => {
|
|
406
|
+
if (S[e]) {
|
|
407
|
+
const H = [...S];
|
|
408
408
|
return H[e] = {
|
|
409
409
|
...H[e],
|
|
410
410
|
segments: w.map(($) => ({ ...$ })),
|
|
@@ -412,13 +412,13 @@ function De({
|
|
|
412
412
|
status: s.THINKING
|
|
413
413
|
}, H;
|
|
414
414
|
}
|
|
415
|
-
return
|
|
415
|
+
return S;
|
|
416
416
|
});
|
|
417
417
|
break;
|
|
418
418
|
}
|
|
419
419
|
case "agent_thought_end": {
|
|
420
|
-
const m = l.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [],
|
|
421
|
-
|
|
420
|
+
const m = l.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [], S = p[p.length - 1];
|
|
421
|
+
S && S.type === "agent_thought" && (S.duration = w), o.value.set(e, p), u((H) => {
|
|
422
422
|
if (H[e]) {
|
|
423
423
|
const $ = [...H];
|
|
424
424
|
return $[e] = {
|
|
@@ -432,8 +432,8 @@ function De({
|
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
434
|
case "think_message_output_end": {
|
|
435
|
-
const m = c.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [],
|
|
436
|
-
|
|
435
|
+
const m = c.value.get(e), w = m ? Math.round((Date.now() - m) / 1e3 * 10) / 10 : 0, p = o.value.get(e) || [], S = p[p.length - 1];
|
|
436
|
+
S && S.type === "thinking" && (S.duration = w), o.value.set(e, p), u((H) => {
|
|
437
437
|
if (H[e]) {
|
|
438
438
|
const $ = [...H];
|
|
439
439
|
return $[e] = {
|
|
@@ -447,25 +447,25 @@ function De({
|
|
|
447
447
|
break;
|
|
448
448
|
}
|
|
449
449
|
case "tool_message": {
|
|
450
|
-
const m =
|
|
450
|
+
const m = b.answer || b.text || b.content || "";
|
|
451
451
|
if (!m) break;
|
|
452
452
|
const w = o.value.get(e) || [];
|
|
453
|
-
w.push({ type: "answer", content: m }), o.value.set(e, w),
|
|
453
|
+
w.push({ type: "answer", content: m }), o.value.set(e, w), R(e);
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
456
456
|
case "message_output_start":
|
|
457
457
|
h.value.set(e, "answer"), L(e);
|
|
458
458
|
break;
|
|
459
459
|
case "message": {
|
|
460
|
-
const m =
|
|
461
|
-
w === "answer" &&
|
|
460
|
+
const m = b.answer || "", w = h.value.get(e), p = o.value.get(e) || [], S = p[p.length - 1];
|
|
461
|
+
w === "answer" && S && S.type === "answer" ? S.content += m : (L(e), h.value.set(e, "answer"), p.push({ type: "answer", content: m })), o.value.set(e, p);
|
|
462
462
|
const H = p.filter(($) => $.type === "answer").map(($) => $.content).join("");
|
|
463
463
|
u(($) => {
|
|
464
464
|
if ($[e]) {
|
|
465
465
|
const V = [...$];
|
|
466
466
|
return V[e] = {
|
|
467
467
|
...V[e],
|
|
468
|
-
segments: p.map((
|
|
468
|
+
segments: p.map((Z) => ({ ...Z })),
|
|
469
469
|
content: H,
|
|
470
470
|
status: r.value ? s.STOP : s.ANSWERING
|
|
471
471
|
}, V;
|
|
@@ -487,32 +487,32 @@ function De({
|
|
|
487
487
|
m[e] && (m[e] = {
|
|
488
488
|
...m[e],
|
|
489
489
|
status: s.ERROR,
|
|
490
|
-
content:
|
|
491
|
-
errorMessage:
|
|
490
|
+
content: b.error_msg || b.message || "请求失败",
|
|
491
|
+
errorMessage: b.error_msg || b.message || "请求失败"
|
|
492
492
|
}, t.value = m), v.value = !1;
|
|
493
493
|
break;
|
|
494
494
|
}
|
|
495
495
|
case "message_replace": {
|
|
496
|
-
const m =
|
|
497
|
-
p != null ? w[p] = { ...w[p], content: m } : w.push({ type: "answer", content: m }), o.value.set(e, w), u((
|
|
498
|
-
if (
|
|
499
|
-
const H = [...
|
|
496
|
+
const m = b.answer || "", w = o.value.get(e) || [], p = (P = w.map((S, H) => ({ s: S, i: H })).reverse().find((S) => S.s.type === "answer")) == null ? void 0 : P.i;
|
|
497
|
+
p != null ? w[p] = { ...w[p], content: m } : w.push({ type: "answer", content: m }), o.value.set(e, w), u((S) => {
|
|
498
|
+
if (S[e]) {
|
|
499
|
+
const H = [...S];
|
|
500
500
|
return H[e] = {
|
|
501
501
|
...H[e],
|
|
502
502
|
segments: w.map(($) => ({ ...$ })),
|
|
503
503
|
content: m
|
|
504
504
|
}, H;
|
|
505
505
|
}
|
|
506
|
-
return
|
|
506
|
+
return S;
|
|
507
507
|
});
|
|
508
508
|
break;
|
|
509
509
|
}
|
|
510
510
|
case "message_cost": {
|
|
511
511
|
const m = {
|
|
512
|
-
inputTokens:
|
|
513
|
-
outputTokens:
|
|
514
|
-
latency:
|
|
515
|
-
latencyFirstResp:
|
|
512
|
+
inputTokens: b.input_tokens || 0,
|
|
513
|
+
outputTokens: b.output_tokens || 0,
|
|
514
|
+
latency: b.latency || 0,
|
|
515
|
+
latencyFirstResp: b.latency_first_resp
|
|
516
516
|
};
|
|
517
517
|
u((w) => {
|
|
518
518
|
if (w[e]) {
|
|
@@ -531,7 +531,7 @@ function De({
|
|
|
531
531
|
},
|
|
532
532
|
onclose() {
|
|
533
533
|
i(), L(e), i();
|
|
534
|
-
const P = (o.value.get(e) || []).filter((
|
|
534
|
+
const P = (o.value.get(e) || []).filter((b) => b.type === "answer").map((b) => b.content).join(""), N = [...t.value];
|
|
535
535
|
N[e] && N[e].status !== s.ERROR && (N[e] = {
|
|
536
536
|
...N[e],
|
|
537
537
|
content: r.value && !P ? "已停止回答" : P,
|
|
@@ -553,9 +553,9 @@ function De({
|
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
return { doStreamRequest:
|
|
556
|
+
return { doStreamRequest: Q, issTop: r };
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function Ee(t) {
|
|
559
559
|
var v;
|
|
560
560
|
if (typeof t == "string") {
|
|
561
561
|
const a = Nt(t);
|
|
@@ -563,10 +563,10 @@ function Me(t) {
|
|
|
563
563
|
}
|
|
564
564
|
return (t == null ? void 0 : t.answer) || ((v = t == null ? void 0 : t.data) == null ? void 0 : v.answer) || String(t || "");
|
|
565
565
|
}
|
|
566
|
-
function
|
|
566
|
+
function Re(t) {
|
|
567
567
|
return t.queryAgainStreamApi || t.queryAgainApi || t.chatQueryStreamApi || t.chatQueryApi;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function Te({
|
|
570
570
|
messages: t,
|
|
571
571
|
userInput: v,
|
|
572
572
|
isGenerating: a,
|
|
@@ -578,11 +578,11 @@ function He({
|
|
|
578
578
|
STATUS: h,
|
|
579
579
|
cfg: c
|
|
580
580
|
}) {
|
|
581
|
-
const l = c.apis, r =
|
|
581
|
+
const l = c.apis, r = K({
|
|
582
582
|
first: new AbortController(),
|
|
583
583
|
again: new AbortController()
|
|
584
584
|
});
|
|
585
|
-
async function
|
|
585
|
+
async function R() {
|
|
586
586
|
const e = v.value.trim();
|
|
587
587
|
if (!e || a.value) return;
|
|
588
588
|
const d = [
|
|
@@ -605,7 +605,7 @@ function He({
|
|
|
605
605
|
const k = await Bt().post(l.chatQueryApi, {
|
|
606
606
|
app: c.app ?? 1,
|
|
607
607
|
data: { Query: e, AppConversationID: i.value }
|
|
608
|
-
}), P =
|
|
608
|
+
}), P = Ee(k.data);
|
|
609
609
|
t.value = [...t.value.slice(0, -1), { type: "ai", content: P, status: h.COMPLETED }];
|
|
610
610
|
} catch (A) {
|
|
611
611
|
t.value = [...t.value.slice(0, -1), { type: "ai", content: (A == null ? void 0 : A.message) || "服务连接失败,请稍后重试", status: h.ERROR }];
|
|
@@ -616,14 +616,14 @@ function He({
|
|
|
616
616
|
r.again.abort(), r.again = new AbortController();
|
|
617
617
|
const e = [...t.value];
|
|
618
618
|
e.length > 0 && e[e.length - 1].type === "ai" && e.pop(), e.push({ type: "ai", content: "", status: h.RETHINKING }), t.value = e, o();
|
|
619
|
-
const d = t.value.length - 1, O =
|
|
619
|
+
const d = t.value.length - 1, O = Re(l);
|
|
620
620
|
await s(O, {
|
|
621
621
|
MessageID: u.value,
|
|
622
622
|
AppConversationID: i.value,
|
|
623
623
|
ResponseMode: "streaming"
|
|
624
624
|
}, d, r.again.signal, !0);
|
|
625
625
|
}
|
|
626
|
-
async function
|
|
626
|
+
async function Q() {
|
|
627
627
|
if (!l.stopMessageApi || !a.value) return;
|
|
628
628
|
const e = t.value.length - 1 - 1;
|
|
629
629
|
try {
|
|
@@ -635,14 +635,14 @@ function He({
|
|
|
635
635
|
O[e] && (O[e] = { ...O[e], content: (d == null ? void 0 : d.message) || "系统繁忙,请稍后再试", status: h.ERROR }), t.value = O;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
|
-
async function
|
|
638
|
+
async function D(e) {
|
|
639
639
|
var d, O, A;
|
|
640
640
|
i.value = e;
|
|
641
641
|
try {
|
|
642
642
|
const k = await $t(l, e), P = (A = (O = (d = k == null ? void 0 : k.messages) == null ? void 0 : d[0]) == null ? void 0 : O.answerInfo) == null ? void 0 : A.answer;
|
|
643
643
|
P && (t.value = [...t.value, { type: "ai", content: P, status: h.COMPLETED }]);
|
|
644
644
|
} catch (k) {
|
|
645
|
-
|
|
645
|
+
it((k == null ? void 0 : k.message) || "加载历史会话失败");
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
async function B() {
|
|
@@ -651,15 +651,15 @@ function He({
|
|
|
651
651
|
const d = await Pt(l);
|
|
652
652
|
(e = d == null ? void 0 : d.conversation) != null && e.appConversationID && (i.value = d.conversation.appConversationID);
|
|
653
653
|
} catch (d) {
|
|
654
|
-
|
|
654
|
+
it((d == null ? void 0 : d.message) || "创建会话失败");
|
|
655
655
|
}
|
|
656
656
|
}
|
|
657
|
-
return { sendMessage:
|
|
657
|
+
return { sendMessage: R, regenerateResponse: L, toggleStop: Q, goHistoryMessage: D, initConversation: B, controllers: r };
|
|
658
658
|
}
|
|
659
|
-
const
|
|
659
|
+
const De = { class: "container" }, Me = { class: "message ai-message greet-message" }, Oe = { class: "ai-greet" }, He = {
|
|
660
660
|
key: 0,
|
|
661
661
|
class: "message ai-message recommend-message"
|
|
662
|
-
},
|
|
662
|
+
}, Pe = { class: "ai-recommend" }, $e = { class: "recommend-header" }, Le = ["src"], Be = ["onClick"], Ne = /* @__PURE__ */ nt({
|
|
663
663
|
__name: "Answer",
|
|
664
664
|
props: {
|
|
665
665
|
defaultSayhello: {},
|
|
@@ -674,20 +674,20 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
674
674
|
COMPLETED: "completed",
|
|
675
675
|
STOP: "stop",
|
|
676
676
|
ERROR: "error"
|
|
677
|
-
}, u = t, i =
|
|
678
|
-
() =>
|
|
677
|
+
}, u = t, i = vt(), s = T([]), C = T(""), o = T(!1), h = T(""), c = T(""), l = T(null), r = K({ text1: "", text2: "" }), R = T([]), L = T(0), Q = et(
|
|
678
|
+
() => R.value[L.value % (R.value.length || 1)]
|
|
679
679
|
);
|
|
680
|
-
function
|
|
680
|
+
function D() {
|
|
681
681
|
L.value++;
|
|
682
682
|
}
|
|
683
683
|
function B(W) {
|
|
684
684
|
C.value = W;
|
|
685
685
|
}
|
|
686
|
-
const { isAtBottom: e, hasScroll: d, scrollToBottom: O, checkScrollStatus: A } =
|
|
686
|
+
const { isAtBottom: e, hasScroll: d, scrollToBottom: O, checkScrollStatus: A } = we(l), { enhanceCodeBlocks: k } = Ce(), { batchMessagesUpdate: P, flushMessagesBatch: N } = Ae(s), { displayedContent: b, streamingIndexRef: m, startTypewriter: w, stopTypewriter: p, getSegmentDisplayContent: S } = be(
|
|
687
687
|
s,
|
|
688
688
|
O,
|
|
689
689
|
a.ANSWERING
|
|
690
|
-
), { doStreamRequest: H, issTop: $ } =
|
|
690
|
+
), { doStreamRequest: H, issTop: $ } = Se({
|
|
691
691
|
messages: s,
|
|
692
692
|
isGenerating: o,
|
|
693
693
|
lastUserMessage: h,
|
|
@@ -695,7 +695,7 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
695
695
|
flushMessagesBatch: N,
|
|
696
696
|
STATUS: a,
|
|
697
697
|
cfg: i
|
|
698
|
-
}), { sendMessage: V, regenerateResponse:
|
|
698
|
+
}), { sendMessage: V, regenerateResponse: Z, toggleStop: dt, goHistoryMessage: lt, initConversation: f } = Te({
|
|
699
699
|
messages: s,
|
|
700
700
|
userInput: C,
|
|
701
701
|
isGenerating: o,
|
|
@@ -707,104 +707,104 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
707
707
|
STATUS: a,
|
|
708
708
|
cfg: i
|
|
709
709
|
});
|
|
710
|
-
function
|
|
710
|
+
function E() {
|
|
711
711
|
s.value = [], h.value = "", f();
|
|
712
712
|
}
|
|
713
|
-
const
|
|
714
|
-
v({ goHistoryMessage:
|
|
715
|
-
const J =
|
|
716
|
-
function
|
|
713
|
+
const _ = et(() => !!c.value && s.value.length === 0);
|
|
714
|
+
v({ goHistoryMessage: lt, createNewConversation: E, isEmptyConversation: _ });
|
|
715
|
+
const J = T(/* @__PURE__ */ new Map());
|
|
716
|
+
function ct(W, G) {
|
|
717
717
|
W ? J.value.set(G, W) : J.value.delete(G);
|
|
718
718
|
}
|
|
719
719
|
wt(s, () => {
|
|
720
|
-
|
|
720
|
+
ut(() => {
|
|
721
721
|
s.value.forEach((W, G) => {
|
|
722
|
-
W.type === "ai" && W.status !== a.ANSWERING && (
|
|
722
|
+
W.type === "ai" && W.status !== a.ANSWERING && (b.set(G, W.content), m.value.set(G, W.content.length));
|
|
723
723
|
}), w(), J.value.forEach((W) => {
|
|
724
724
|
k(W);
|
|
725
725
|
});
|
|
726
726
|
});
|
|
727
727
|
}, { deep: !0 });
|
|
728
|
-
let
|
|
729
|
-
return
|
|
730
|
-
u.defaultSayhello && (r.text1 = u.defaultSayhello.text1, r.text2 = u.defaultSayhello.text2), u.defaultRecommend && (
|
|
731
|
-
}),
|
|
728
|
+
let I = null;
|
|
729
|
+
return q(() => {
|
|
730
|
+
u.defaultSayhello && (r.text1 = u.defaultSayhello.text1, r.text2 = u.defaultSayhello.text2), u.defaultRecommend && (R.value = Qt(u.defaultRecommend));
|
|
731
|
+
}), q(() => {
|
|
732
732
|
f();
|
|
733
|
-
}),
|
|
734
|
-
l.value && (
|
|
733
|
+
}), q(() => {
|
|
734
|
+
l.value && (I = () => A(), l.value.addEventListener("scroll", I));
|
|
735
735
|
}), mt(() => {
|
|
736
|
-
p(), l.value &&
|
|
736
|
+
p(), l.value && I && l.value.removeEventListener("scroll", I);
|
|
737
737
|
}), (W, G) => {
|
|
738
738
|
var ht;
|
|
739
|
-
return g(), y("div",
|
|
739
|
+
return g(), y("div", De, [
|
|
740
740
|
n("div", {
|
|
741
741
|
class: "chat-box scrollWrap",
|
|
742
742
|
ref_key: "chatBoxRef",
|
|
743
743
|
ref: l
|
|
744
744
|
}, [
|
|
745
|
-
n("div",
|
|
746
|
-
n("div",
|
|
747
|
-
n("h1", null,
|
|
748
|
-
n("p", null,
|
|
745
|
+
n("div", Me, [
|
|
746
|
+
n("div", Oe, [
|
|
747
|
+
n("h1", null, X(r.text1), 1),
|
|
748
|
+
n("p", null, X(r.text2), 1)
|
|
749
749
|
])
|
|
750
750
|
]),
|
|
751
|
-
(ht =
|
|
752
|
-
n("div",
|
|
753
|
-
n("div",
|
|
751
|
+
(ht = Q.value) != null && ht.length ? (g(), y("div", He, [
|
|
752
|
+
n("div", Pe, [
|
|
753
|
+
n("div", $e, [
|
|
754
754
|
G[2] || (G[2] = n("span", null, "你可以尝试这样问我:", -1)),
|
|
755
755
|
n("p", {
|
|
756
756
|
class: "refresh-btn",
|
|
757
|
-
onClick:
|
|
757
|
+
onClick: D
|
|
758
758
|
}, [
|
|
759
|
-
n("img", { src: M(
|
|
759
|
+
n("img", { src: M(zt) }, null, 8, Le),
|
|
760
760
|
G[1] || (G[1] = n("span", null, "换一换", -1))
|
|
761
761
|
])
|
|
762
762
|
]),
|
|
763
763
|
n("ul", null, [
|
|
764
|
-
(g(!0), y(
|
|
765
|
-
key:
|
|
766
|
-
onClick: (
|
|
767
|
-
},
|
|
764
|
+
(g(!0), y(z, null, at(Q.value, (tt, rt) => (g(), y("li", {
|
|
765
|
+
key: rt,
|
|
766
|
+
onClick: (bn) => B(tt)
|
|
767
|
+
}, X(tt), 9, Be))), 128))
|
|
768
768
|
])
|
|
769
769
|
])
|
|
770
|
-
])) :
|
|
771
|
-
(g(!0), y(
|
|
772
|
-
key:
|
|
773
|
-
msg:
|
|
774
|
-
index:
|
|
770
|
+
])) : Y("", !0),
|
|
771
|
+
(g(!0), y(z, null, at(s.value, (tt, rt) => (g(), j(ge, {
|
|
772
|
+
key: rt,
|
|
773
|
+
msg: tt,
|
|
774
|
+
index: rt,
|
|
775
775
|
STATUS: a,
|
|
776
|
-
displayedContent: M(
|
|
777
|
-
getSegmentDisplayContent: M(
|
|
778
|
-
setMessageRef:
|
|
779
|
-
onRegenerate: M(
|
|
776
|
+
displayedContent: M(b),
|
|
777
|
+
getSegmentDisplayContent: M(S),
|
|
778
|
+
setMessageRef: ct,
|
|
779
|
+
onRegenerate: M(Z)
|
|
780
780
|
}, null, 8, ["msg", "index", "displayedContent", "getSegmentDisplayContent", "onRegenerate"]))), 128))
|
|
781
781
|
], 512),
|
|
782
|
-
|
|
782
|
+
F(ke, {
|
|
783
783
|
modelValue: C.value,
|
|
784
|
-
"onUpdate:modelValue": G[0] || (G[0] = (
|
|
784
|
+
"onUpdate:modelValue": G[0] || (G[0] = (tt) => C.value = tt),
|
|
785
785
|
isGenerating: o.value,
|
|
786
786
|
lastUserMessage: h.value,
|
|
787
787
|
hasScroll: M(d),
|
|
788
788
|
isAtBottom: M(e),
|
|
789
789
|
onSend: M(V),
|
|
790
|
-
onRegenerate: M(
|
|
791
|
-
onStop: M(
|
|
790
|
+
onRegenerate: M(Z),
|
|
791
|
+
onStop: M(dt),
|
|
792
792
|
onScrollToBottom: M(O)
|
|
793
793
|
}, null, 8, ["modelValue", "isGenerating", "lastUserMessage", "hasScroll", "isAtBottom", "onSend", "onRegenerate", "onStop", "onScrollToBottom"])
|
|
794
794
|
]);
|
|
795
795
|
};
|
|
796
796
|
}
|
|
797
|
-
}),
|
|
797
|
+
}), Ye = { class: "ai-history" }, Qe = { class: "content" }, _e = { key: 0 }, Xe = ["onClick"], We = { class: "info-pic" }, Ge = { class: "info-content" }, Ve = { class: "info-content-title" }, Je = { class: "info-content-time" }, Fe = ["onClick"], Ue = ["src"], je = { class: "ai-modal" }, qe = { class: "ai-modal-footer" }, xe = /* @__PURE__ */ nt({
|
|
798
798
|
__name: "History",
|
|
799
799
|
emits: ["history-detail", "new-answer"],
|
|
800
800
|
setup(t, { emit: v }) {
|
|
801
|
-
const u =
|
|
801
|
+
const u = vt().apis, i = T([]), s = T(!1), C = T("");
|
|
802
802
|
async function o() {
|
|
803
803
|
try {
|
|
804
|
-
const l = await
|
|
804
|
+
const l = await _t(u);
|
|
805
805
|
l != null && l.conversationList && (i.value = l.conversationList.filter((r) => r !== null).map((r) => ({ ...r, selected: !1 })));
|
|
806
806
|
} catch (l) {
|
|
807
|
-
|
|
807
|
+
it((l == null ? void 0 : l.message) || "获取历史记录失败");
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
function h(l) {
|
|
@@ -815,51 +815,51 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
815
815
|
try {
|
|
816
816
|
await Xt(u, C.value), await o();
|
|
817
817
|
} catch (l) {
|
|
818
|
-
|
|
818
|
+
it((l == null ? void 0 : l.message) || "删除失败"), await o();
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
return
|
|
821
|
+
return q(() => {
|
|
822
822
|
o();
|
|
823
|
-
}), (l, r) => (g(), y("div",
|
|
824
|
-
n("div",
|
|
825
|
-
i.value.length > 0 ? (g(), y("div",
|
|
826
|
-
(g(!0), y(
|
|
827
|
-
key:
|
|
823
|
+
}), (l, r) => (g(), y("div", Ye, [
|
|
824
|
+
n("div", Qe, [
|
|
825
|
+
i.value.length > 0 ? (g(), y("div", _e, [
|
|
826
|
+
(g(!0), y(z, null, at(i.value, (R) => (g(), y("div", {
|
|
827
|
+
key: R.appConversationID,
|
|
828
828
|
class: "info",
|
|
829
|
-
onClick: (L) => l.$emit("history-detail",
|
|
829
|
+
onClick: (L) => l.$emit("history-detail", R.appConversationID)
|
|
830
830
|
}, [
|
|
831
|
-
n("div",
|
|
832
|
-
n("div",
|
|
833
|
-
n("div",
|
|
834
|
-
n("div",
|
|
831
|
+
n("div", We, X(R.conversationName.slice(0, 1)), 1),
|
|
832
|
+
n("div", Ge, [
|
|
833
|
+
n("div", Ve, X(R.conversationName), 1),
|
|
834
|
+
n("div", Je, X(R.createTime), 1)
|
|
835
835
|
]),
|
|
836
836
|
n("div", {
|
|
837
837
|
class: "clear-history",
|
|
838
|
-
onClick: ft((L) => h(
|
|
839
|
-
}, "删除", 8,
|
|
840
|
-
], 8,
|
|
841
|
-
])) :
|
|
838
|
+
onClick: ft((L) => h(R.appConversationID), ["stop"])
|
|
839
|
+
}, "删除", 8, Fe)
|
|
840
|
+
], 8, Xe))), 128))
|
|
841
|
+
])) : Y("", !0)
|
|
842
842
|
]),
|
|
843
843
|
n("div", {
|
|
844
844
|
class: "ai-add",
|
|
845
|
-
onClick: r[0] || (r[0] = (
|
|
845
|
+
onClick: r[0] || (r[0] = (R) => l.$emit("new-answer"))
|
|
846
846
|
}, [
|
|
847
|
-
n("img", { src: M(
|
|
847
|
+
n("img", { src: M(jt) }, null, 8, Ue),
|
|
848
848
|
r[3] || (r[3] = n("span", { style: { color: "#333333" } }, "新建AI对话", -1))
|
|
849
849
|
]),
|
|
850
|
-
(g(),
|
|
850
|
+
(g(), j(Tt, { to: "body" }, [
|
|
851
851
|
s.value ? (g(), y("div", {
|
|
852
852
|
key: 0,
|
|
853
853
|
class: "ai-modal-overlay",
|
|
854
|
-
onClick: r[2] || (r[2] = ft((
|
|
854
|
+
onClick: r[2] || (r[2] = ft((R) => s.value = !1, ["self"]))
|
|
855
855
|
}, [
|
|
856
|
-
n("div",
|
|
856
|
+
n("div", je, [
|
|
857
857
|
r[4] || (r[4] = n("div", { class: "ai-modal-header" }, "确定要删除该历史记录吗?", -1)),
|
|
858
858
|
r[5] || (r[5] = n("div", { class: "ai-modal-body" }, "一旦删除,数据将无法恢复。", -1)),
|
|
859
|
-
n("div",
|
|
859
|
+
n("div", qe, [
|
|
860
860
|
n("button", {
|
|
861
861
|
class: "ai-modal-btn cancel",
|
|
862
|
-
onClick: r[1] || (r[1] = (
|
|
862
|
+
onClick: r[1] || (r[1] = (R) => s.value = !1)
|
|
863
863
|
}, "取消"),
|
|
864
864
|
n("button", {
|
|
865
865
|
class: "ai-modal-btn confirm",
|
|
@@ -867,86 +867,86 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
867
867
|
}, "确定")
|
|
868
868
|
])
|
|
869
869
|
])
|
|
870
|
-
])) :
|
|
870
|
+
])) : Y("", !0)
|
|
871
871
|
]))
|
|
872
872
|
]));
|
|
873
873
|
}
|
|
874
|
-
}),
|
|
874
|
+
}), ze = (t, v) => {
|
|
875
875
|
const a = t.__vccOpts || t;
|
|
876
876
|
for (const [u, i] of v)
|
|
877
877
|
a[u] = i;
|
|
878
878
|
return a;
|
|
879
|
-
},
|
|
879
|
+
}, Ke = /* @__PURE__ */ ze(xe, [["__scopeId", "data-v-9267d81a"]]), Ze = { class: "container info" }, Ie = { class: "info-item" }, tn = { class: "basic-content" }, en = { class: "basic-content-text" }, nn = { class: "basic-content" }, sn = { class: "basic-content-text" }, on = { class: "info-item" }, an = { class: "permission-content" }, ln = { class: "info-item" }, cn = { class: "basic-content" }, rn = { class: "basic-content-text" }, un = { class: "basic-content" }, vn = { class: "basic-content-text" }, dn = /* @__PURE__ */ nt({
|
|
880
880
|
__name: "Info",
|
|
881
881
|
setup(t) {
|
|
882
|
-
const v =
|
|
883
|
-
return
|
|
882
|
+
const v = vt(), a = T(null);
|
|
883
|
+
return q(async () => {
|
|
884
884
|
try {
|
|
885
885
|
a.value = await Wt(v.apis);
|
|
886
886
|
} catch (u) {
|
|
887
|
-
|
|
887
|
+
it((u == null ? void 0 : u.message) || "获取个人信息失败");
|
|
888
888
|
}
|
|
889
889
|
}), (u, i) => {
|
|
890
890
|
var s, C, o, h, c;
|
|
891
|
-
return g(), y("div",
|
|
892
|
-
n("div",
|
|
891
|
+
return g(), y("div", Ze, [
|
|
892
|
+
n("div", Ie, [
|
|
893
893
|
i[2] || (i[2] = n("div", { class: "heading" }, [
|
|
894
894
|
n("div", { class: "heading-column" }),
|
|
895
895
|
n("div", { class: "heading-title" }, "基本信息")
|
|
896
896
|
], -1)),
|
|
897
|
-
n("div",
|
|
897
|
+
n("div", tn, [
|
|
898
898
|
i[0] || (i[0] = n("div", { class: "basic-content-text basic-content-key" }, "姓名", -1)),
|
|
899
|
-
n("div",
|
|
899
|
+
n("div", en, X(((s = a.value) == null ? void 0 : s.name) || ""), 1)
|
|
900
900
|
]),
|
|
901
|
-
n("div",
|
|
901
|
+
n("div", nn, [
|
|
902
902
|
i[1] || (i[1] = n("div", { class: "basic-content-text basic-content-key" }, "用户名", -1)),
|
|
903
|
-
n("div",
|
|
903
|
+
n("div", sn, X(((C = a.value) == null ? void 0 : C.userName) || ""), 1)
|
|
904
904
|
])
|
|
905
905
|
]),
|
|
906
|
-
n("div",
|
|
906
|
+
n("div", on, [
|
|
907
907
|
i[3] || (i[3] = n("div", { class: "heading" }, [
|
|
908
908
|
n("div", { class: "heading-column" }),
|
|
909
909
|
n("div", { class: "heading-title" }, "数据权限")
|
|
910
910
|
], -1)),
|
|
911
|
-
n("div",
|
|
912
|
-
(g(!0), y(
|
|
911
|
+
n("div", an, [
|
|
912
|
+
(g(!0), y(z, null, at((o = a.value) == null ? void 0 : o.ptnameList, (l, r) => (g(), y("div", {
|
|
913
913
|
key: r,
|
|
914
914
|
class: "permission-content-text"
|
|
915
|
-
},
|
|
915
|
+
}, X(l), 1))), 128))
|
|
916
916
|
])
|
|
917
917
|
]),
|
|
918
|
-
n("div",
|
|
918
|
+
n("div", ln, [
|
|
919
919
|
i[6] || (i[6] = n("div", { class: "heading" }, [
|
|
920
920
|
n("div", { class: "heading-column" }),
|
|
921
921
|
n("div", { class: "heading-title" }, "帮助信息")
|
|
922
922
|
], -1)),
|
|
923
|
-
n("div",
|
|
923
|
+
n("div", cn, [
|
|
924
924
|
i[4] || (i[4] = n("div", { class: "basic-content-text basic-content-key" }, "部门", -1)),
|
|
925
|
-
n("div",
|
|
925
|
+
n("div", rn, X(((h = a.value) == null ? void 0 : h.dept) || ""), 1)
|
|
926
926
|
]),
|
|
927
|
-
n("div",
|
|
927
|
+
n("div", un, [
|
|
928
928
|
i[5] || (i[5] = n("div", { class: "basic-content-text basic-content-key" }, "邮箱", -1)),
|
|
929
|
-
n("div",
|
|
929
|
+
n("div", vn, X(((c = a.value) == null ? void 0 : c.email) || ""), 1)
|
|
930
930
|
])
|
|
931
931
|
])
|
|
932
932
|
]);
|
|
933
933
|
};
|
|
934
934
|
}
|
|
935
|
-
}),
|
|
935
|
+
}), gn = { class: "header" }, mn = { key: 1 }, hn = ["src"], fn = { class: "header-title" }, pn = { class: "setTitle" }, yn = { class: "content" }, kn = { class: "main" }, wn = { class: "btn" }, Cn = ["src"], An = 117, st = 118, At = /* @__PURE__ */ nt({
|
|
936
936
|
__name: "AiAssist",
|
|
937
937
|
setup(t) {
|
|
938
|
-
const v =
|
|
938
|
+
const v = An / 2, a = vt(), u = T(!1), i = T(!1), s = T("answer"), C = T(!1), o = T(""), h = T(""), c = K({
|
|
939
939
|
x: window.innerWidth - v,
|
|
940
|
-
y: window.innerHeight / 2 -
|
|
941
|
-
}), l =
|
|
940
|
+
y: window.innerHeight / 2 - st / 2
|
|
941
|
+
}), l = T(!1), r = T(!1), R = T("right"), L = T("left"), Q = K({ x: 0, y: 0 }), D = T(!1), B = T(null);
|
|
942
942
|
let e = null;
|
|
943
|
-
const d =
|
|
943
|
+
const d = et(() => {
|
|
944
944
|
const f = window.innerWidth / 2;
|
|
945
945
|
return c.x + v < f ? 5 : -5;
|
|
946
|
-
}), O =
|
|
946
|
+
}), O = et(() => i.value ? "" : `panel-${R.value}`), A = et(() => {
|
|
947
947
|
var f;
|
|
948
948
|
return !((f = B.value) != null && f.isEmptyConversation);
|
|
949
|
-
}), k =
|
|
949
|
+
}), k = et(() => ({
|
|
950
950
|
left: `${c.x}px`,
|
|
951
951
|
top: `${c.y}px`,
|
|
952
952
|
transition: l.value ? "none" : "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
@@ -954,13 +954,13 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
954
954
|
}));
|
|
955
955
|
function P() {
|
|
956
956
|
const f = window.innerWidth / 2;
|
|
957
|
-
c.x + v < f ? (
|
|
957
|
+
c.x + v < f ? (R.value = "left", L.value = "right") : (R.value = "right", L.value = "left");
|
|
958
958
|
}
|
|
959
959
|
function N() {
|
|
960
|
-
const f = window.innerWidth,
|
|
961
|
-
return { x: c.x + v >= f / 2 ? f - v : -v, y:
|
|
960
|
+
const f = window.innerWidth, E = Math.max(0, Math.min(c.y, window.innerHeight - st));
|
|
961
|
+
return { x: c.x + v >= f / 2 ? f - v : -v, y: E };
|
|
962
962
|
}
|
|
963
|
-
function
|
|
963
|
+
function b() {
|
|
964
964
|
r.value = !0;
|
|
965
965
|
const f = N();
|
|
966
966
|
c.x = f.x, c.y = f.y, setTimeout(() => {
|
|
@@ -969,7 +969,7 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
969
969
|
}
|
|
970
970
|
function m() {
|
|
971
971
|
try {
|
|
972
|
-
localStorage.setItem("characterPosition", JSON.stringify({ x: c.x, y: c.y })), localStorage.setItem("panelPosition",
|
|
972
|
+
localStorage.setItem("characterPosition", JSON.stringify({ x: c.x, y: c.y })), localStorage.setItem("panelPosition", R.value), localStorage.setItem("backPosition", L.value);
|
|
973
973
|
} catch {
|
|
974
974
|
}
|
|
975
975
|
}
|
|
@@ -977,164 +977,168 @@ const Pe = { class: "container" }, $e = { class: "message ai-message greet-messa
|
|
|
977
977
|
const f = localStorage.getItem("characterPosition");
|
|
978
978
|
if (f) {
|
|
979
979
|
const J = JSON.parse(f);
|
|
980
|
-
c.x = J.x, c.y = Math.min(Math.max(J.y, 0), window.innerHeight -
|
|
980
|
+
c.x = J.x, c.y = Math.min(Math.max(J.y, 0), window.innerHeight - st);
|
|
981
981
|
} else
|
|
982
|
-
c.x = window.innerWidth - v, c.y = window.innerHeight / 2 -
|
|
983
|
-
const
|
|
984
|
-
|
|
982
|
+
c.x = window.innerWidth - v, c.y = window.innerHeight / 2 - st / 2;
|
|
983
|
+
const E = localStorage.getItem("panelPosition"), _ = localStorage.getItem("backPosition");
|
|
984
|
+
E && (R.value = E), _ && (L.value = _);
|
|
985
985
|
}
|
|
986
986
|
function p(f) {
|
|
987
987
|
if (!l.value) return;
|
|
988
|
-
const
|
|
989
|
-
|
|
988
|
+
const E = "touches" in f ? f.touches[0].clientX : f.clientX, _ = "touches" in f ? f.touches[0].clientY : f.clientY, J = E - Q.x, ct = Math.max(0, Math.min(_ - Q.y, window.innerHeight - st)), I = Math.abs(J - c.x), W = Math.abs(ct - c.y);
|
|
989
|
+
I + W > 5 && (D.value = !0), c.x = J, c.y = ct;
|
|
990
990
|
}
|
|
991
|
-
function
|
|
992
|
-
l.value && (l.value = !1,
|
|
991
|
+
function S() {
|
|
992
|
+
l.value && (l.value = !1, D.value && (b(), D.value = !1));
|
|
993
993
|
}
|
|
994
994
|
function H(f) {
|
|
995
|
-
r.value = !1, l.value = !0,
|
|
996
|
-
const
|
|
997
|
-
|
|
995
|
+
r.value = !1, l.value = !0, D.value = !1;
|
|
996
|
+
const E = "touches" in f ? f.touches[0].clientX : f.clientX, _ = "touches" in f ? f.touches[0].clientY : f.clientY;
|
|
997
|
+
Q.x = E - c.x, Q.y = _ - c.y;
|
|
998
998
|
}
|
|
999
999
|
function $() {
|
|
1000
|
-
!
|
|
1000
|
+
!D.value && !r.value ? (P(), u.value = !0) : D.value = !1;
|
|
1001
1001
|
}
|
|
1002
1002
|
function V(f) {
|
|
1003
|
-
s.value = "answer",
|
|
1004
|
-
var
|
|
1005
|
-
(
|
|
1003
|
+
s.value = "answer", ut(() => {
|
|
1004
|
+
var E;
|
|
1005
|
+
(E = B.value) == null || E.goHistoryMessage(f);
|
|
1006
1006
|
});
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1009
|
-
s.value = "answer",
|
|
1008
|
+
function Z() {
|
|
1009
|
+
s.value = "answer", ut(() => {
|
|
1010
1010
|
var f;
|
|
1011
1011
|
(f = B.value) == null || f.createNewConversation();
|
|
1012
1012
|
});
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function dt() {
|
|
1015
1015
|
h.value = o.value, C.value = !1;
|
|
1016
1016
|
}
|
|
1017
1017
|
wt(i, (f) => {
|
|
1018
|
-
f ?
|
|
1019
|
-
}),
|
|
1018
|
+
f ? R.value = "center" : P();
|
|
1019
|
+
}), q(() => {
|
|
1020
1020
|
w();
|
|
1021
1021
|
});
|
|
1022
|
-
function
|
|
1023
|
-
e && clearTimeout(e), e = setTimeout(() =>
|
|
1022
|
+
function lt() {
|
|
1023
|
+
e && clearTimeout(e), e = setTimeout(() => b(), 100);
|
|
1024
1024
|
}
|
|
1025
|
-
return
|
|
1026
|
-
window.addEventListener("resize",
|
|
1025
|
+
return q(() => {
|
|
1026
|
+
window.addEventListener("resize", lt);
|
|
1027
1027
|
}), mt(() => {
|
|
1028
|
-
window.removeEventListener("resize",
|
|
1029
|
-
}),
|
|
1030
|
-
document.addEventListener("mousemove", p), document.addEventListener("touchmove", p, { passive: !0 }), document.addEventListener("mouseup",
|
|
1028
|
+
window.removeEventListener("resize", lt), e && clearTimeout(e);
|
|
1029
|
+
}), q(() => {
|
|
1030
|
+
document.addEventListener("mousemove", p), document.addEventListener("touchmove", p, { passive: !0 }), document.addEventListener("mouseup", S), document.addEventListener("touchend", S);
|
|
1031
1031
|
}), mt(() => {
|
|
1032
|
-
document.removeEventListener("mousemove", p), document.removeEventListener("touchmove", p), document.removeEventListener("mouseup",
|
|
1033
|
-
}), (f,
|
|
1032
|
+
document.removeEventListener("mousemove", p), document.removeEventListener("touchmove", p), document.removeEventListener("mouseup", S), document.removeEventListener("touchend", S);
|
|
1033
|
+
}), (f, E) => (g(), y("div", null, [
|
|
1034
1034
|
u.value ? (g(), y("div", {
|
|
1035
1035
|
key: 0,
|
|
1036
|
-
class:
|
|
1036
|
+
class: U(["ai-panel", i.value ? "maxWrap" : "minWrap", O.value])
|
|
1037
1037
|
}, [
|
|
1038
|
-
n("div",
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
]),
|
|
1051
|
-
n("div", kn, [
|
|
1052
|
-
n("span", null, Q(s.value === "info" ? "个人信息" : s.value === "history" ? "历史信息" : M(a).name), 1)
|
|
1038
|
+
n("div", gn, [
|
|
1039
|
+
s.value === "info" || s.value === "history" ? (g(), y("span", {
|
|
1040
|
+
key: 0,
|
|
1041
|
+
class: U(["back", L.value]),
|
|
1042
|
+
onClick: E[0] || (E[0] = (_) => s.value = "answer")
|
|
1043
|
+
}, [...E[7] || (E[7] = [
|
|
1044
|
+
n("span", { style: { "font-size": "14px" } }, "←", -1)
|
|
1045
|
+
])], 2)) : (g(), y("p", mn, [
|
|
1046
|
+
n("img", { src: M(qt) }, null, 8, hn)
|
|
1047
|
+
])),
|
|
1048
|
+
n("div", fn, [
|
|
1049
|
+
n("span", null, X(s.value === "info" ? "个人信息" : s.value === "history" ? "历史信息" : M(a).name), 1)
|
|
1053
1050
|
]),
|
|
1054
1051
|
n("p", null, [
|
|
1055
|
-
|
|
1052
|
+
gt(F(M(x), {
|
|
1056
1053
|
class: "op-icon",
|
|
1057
|
-
|
|
1054
|
+
icon: "humbleicons:plus",
|
|
1055
|
+
onClick: Z
|
|
1058
1056
|
}, null, 512), [
|
|
1059
1057
|
[pt, A.value]
|
|
1060
1058
|
]),
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1059
|
+
s.value !== "history" ? (g(), j(M(x), {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
class: "mute",
|
|
1062
|
+
icon: "humbleicons:history",
|
|
1063
|
+
onClick: E[1] || (E[1] = (_) => s.value = "history")
|
|
1064
|
+
})) : Y("", !0),
|
|
1065
|
+
F(M(x), {
|
|
1066
|
+
onClick: E[2] || (E[2] = (_) => i.value = !i.value),
|
|
1067
|
+
icon: i.value ? "humbleicons:align-objects-right" : "humbleicons:arrows-horizontal"
|
|
1068
|
+
}, null, 8, ["icon"]),
|
|
1069
|
+
F(M(x), {
|
|
1070
|
+
onClick: E[3] || (E[3] = (_) => u.value = !1),
|
|
1071
|
+
icon: "humbleicons:times"
|
|
1072
|
+
})
|
|
1069
1073
|
])
|
|
1070
1074
|
]),
|
|
1071
|
-
s.value === "answer" ? (g(),
|
|
1075
|
+
s.value === "answer" ? (g(), j(Ne, {
|
|
1072
1076
|
key: 0,
|
|
1073
1077
|
ref_key: "answerRef",
|
|
1074
1078
|
ref: B,
|
|
1075
1079
|
defaultSayhello: M(a).defaultSayhello,
|
|
1076
1080
|
defaultRecommend: M(a).defaultRecommend
|
|
1077
|
-
}, null, 8, ["defaultSayhello", "defaultRecommend"])) :
|
|
1078
|
-
s.value === "history" ? (g(),
|
|
1081
|
+
}, null, 8, ["defaultSayhello", "defaultRecommend"])) : Y("", !0),
|
|
1082
|
+
s.value === "history" ? (g(), j(Ke, {
|
|
1079
1083
|
key: 1,
|
|
1080
1084
|
onHistoryDetail: V,
|
|
1081
|
-
onNewAnswer:
|
|
1082
|
-
})) :
|
|
1083
|
-
s.value === "info" ? (g(),
|
|
1084
|
-
|
|
1085
|
-
n("div",
|
|
1086
|
-
n("div",
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
"onUpdate:modelValue":
|
|
1085
|
+
onNewAnswer: E[4] || (E[4] = (_) => s.value = "answer")
|
|
1086
|
+
})) : Y("", !0),
|
|
1087
|
+
s.value === "info" ? (g(), j(dn, { key: 2 })) : Y("", !0),
|
|
1088
|
+
gt(n("div", pn, [
|
|
1089
|
+
n("div", yn, [
|
|
1090
|
+
n("div", kn, [
|
|
1091
|
+
E[8] || (E[8] = n("p", { class: "title" }, "修改标题", -1)),
|
|
1092
|
+
gt(n("textarea", {
|
|
1093
|
+
"onUpdate:modelValue": E[5] || (E[5] = (_) => o.value = _),
|
|
1090
1094
|
placeholder: "请输入新标题"
|
|
1091
1095
|
}, null, 512), [
|
|
1092
1096
|
[Dt, o.value]
|
|
1093
1097
|
]),
|
|
1094
|
-
n("p",
|
|
1098
|
+
n("p", wn, [
|
|
1095
1099
|
n("span", {
|
|
1096
|
-
onClick:
|
|
1100
|
+
onClick: E[6] || (E[6] = (_) => C.value = !1)
|
|
1097
1101
|
}, "取消"),
|
|
1098
|
-
n("span", { onClick:
|
|
1102
|
+
n("span", { onClick: dt }, "确定")
|
|
1099
1103
|
])
|
|
1100
1104
|
])
|
|
1101
1105
|
])
|
|
1102
1106
|
], 512), [
|
|
1103
1107
|
[pt, C.value]
|
|
1104
1108
|
])
|
|
1105
|
-
], 2)) :
|
|
1106
|
-
u.value ?
|
|
1109
|
+
], 2)) : Y("", !0),
|
|
1110
|
+
u.value ? Y("", !0) : (g(), y("div", {
|
|
1107
1111
|
key: 1,
|
|
1108
|
-
class:
|
|
1112
|
+
class: U(["character", { dragging: l.value, recycling: r.value }]),
|
|
1109
1113
|
style: Mt(k.value),
|
|
1110
1114
|
onMousedown: H,
|
|
1111
1115
|
onTouchstart: H,
|
|
1112
1116
|
onClick: $
|
|
1113
1117
|
}, [
|
|
1114
|
-
n("img", { src: M(
|
|
1118
|
+
n("img", { src: M(xt) }, null, 8, Cn)
|
|
1115
1119
|
], 38))
|
|
1116
1120
|
]));
|
|
1117
1121
|
}
|
|
1118
1122
|
});
|
|
1119
|
-
let
|
|
1120
|
-
const
|
|
1123
|
+
let ot = null;
|
|
1124
|
+
const Mn = (t) => {
|
|
1121
1125
|
Ct(t);
|
|
1122
|
-
},
|
|
1126
|
+
}, On = (t) => {
|
|
1123
1127
|
const v = t || document.body, a = document.createElement("div");
|
|
1124
|
-
a.id = "ai-assist-root", v.appendChild(a),
|
|
1125
|
-
},
|
|
1126
|
-
|
|
1128
|
+
a.id = "ai-assist-root", v.appendChild(a), ot = Ot(At), ot.mount(a);
|
|
1129
|
+
}, Hn = () => {
|
|
1130
|
+
ot && (ot.unmount(), ot = null);
|
|
1127
1131
|
const t = document.getElementById("ai-assist-root");
|
|
1128
1132
|
t && t.remove();
|
|
1129
|
-
},
|
|
1133
|
+
}, Pn = {
|
|
1130
1134
|
install(t, v) {
|
|
1131
1135
|
Ct(v), t.component("AiAssist", At);
|
|
1132
1136
|
}
|
|
1133
1137
|
};
|
|
1134
1138
|
export {
|
|
1135
1139
|
At as AiAssist,
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
+
Pn as default,
|
|
1141
|
+
Mn as initAiAssist,
|
|
1142
|
+
On as mountAiAssist,
|
|
1143
|
+
Hn as unmountAiAssist
|
|
1140
1144
|
};
|