@szjy/ai-coms 0.1.7 → 0.1.8
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/README.md +116 -13
- package/dist/index.mjs +268 -266
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { computed as q, openBlock as P, createElementBlock as L, normalizeStyle as K, createElementVNode as x, normalizeClass as W, getCurrentInstance as re, ref as
|
|
2
|
-
const ve = "/images/ai-round.png",
|
|
1
|
+
import { computed as q, openBlock as P, createElementBlock as L, normalizeStyle as K, createElementVNode as x, normalizeClass as W, getCurrentInstance as re, ref as C, watch as ue, onUnmounted as de, createBlock as J, Transition as oe, withCtx as M, createVNode as E, createCommentVNode as B, nextTick as ae, resolveComponent as X, toDisplayString as D, createTextVNode as fe, Fragment as Y, renderList as Z, withKeys as pe, defineComponent as me, withModifiers as he } from "vue";
|
|
2
|
+
const ve = "/images/ai-round.png", ye = "/images/ai-sqrt.png", ge = "/images/bars-loading.svg";
|
|
3
3
|
function se(t) {
|
|
4
4
|
return t.startsWith("http://") || t.startsWith("https://") ? t : `${location.protocol}//${location.host}${t}`;
|
|
5
5
|
}
|
|
6
|
-
async function be(t, n, s, l = "",
|
|
7
|
-
const { projectId: e } =
|
|
6
|
+
async function be(t, n, s, l = "", r = {}) {
|
|
7
|
+
const { projectId: e } = r, o = se(l), u = new URL(`${o}/v1/chat/completions`), d = (r == null ? void 0 : r.authToken) || "app-oLZVFFdYyJX2QK3rdOLWsC2u";
|
|
8
|
+
r != null && r.authToken || console.error("缺少 authToken!现在默认使用内网的 authToken");
|
|
9
|
+
const y = new Request(u, {
|
|
8
10
|
method: "post",
|
|
9
11
|
headers: {
|
|
10
12
|
"Content-Type": "application/json",
|
|
11
|
-
Authorization:
|
|
13
|
+
Authorization: `Bearer ${d}`
|
|
12
14
|
},
|
|
13
15
|
body: JSON.stringify({
|
|
14
16
|
model: "dify",
|
|
@@ -30,12 +32,12 @@ async function be(t, n, s, l = "", o = {}) {
|
|
|
30
32
|
]
|
|
31
33
|
})
|
|
32
34
|
});
|
|
33
|
-
return fetch(
|
|
35
|
+
return fetch(y);
|
|
34
36
|
}
|
|
35
|
-
async function we(t, n, s, l = "",
|
|
36
|
-
const e = new URL("http://localhost:11434/api/chat"),
|
|
37
|
-
Object.keys(
|
|
38
|
-
e.searchParams.append(d,
|
|
37
|
+
async function we(t, n, s, l = "", r = {}) {
|
|
38
|
+
const e = new URL("http://localhost:11434/api/chat"), o = {};
|
|
39
|
+
Object.keys(o).forEach((d) => {
|
|
40
|
+
e.searchParams.append(d, o[d]);
|
|
39
41
|
});
|
|
40
42
|
const u = new Request(e, {
|
|
41
43
|
mode: "cors",
|
|
@@ -60,10 +62,10 @@ async function we(t, n, s, l = "", o = {}) {
|
|
|
60
62
|
});
|
|
61
63
|
return fetch(u);
|
|
62
64
|
}
|
|
63
|
-
async function xe(t, n, s, l = "",
|
|
64
|
-
const e = new URL(`${location.origin}/spark/v1/chat/completions`),
|
|
65
|
-
Object.keys(
|
|
66
|
-
e.searchParams.append(d,
|
|
65
|
+
async function xe(t, n, s, l = "", r = {}) {
|
|
66
|
+
const e = new URL(`${location.origin}/spark/v1/chat/completions`), o = {};
|
|
67
|
+
Object.keys(o).forEach((d) => {
|
|
68
|
+
e.searchParams.append(d, o[d]);
|
|
67
69
|
});
|
|
68
70
|
const u = new Request(e, {
|
|
69
71
|
method: "post",
|
|
@@ -84,10 +86,10 @@ async function xe(t, n, s, l = "", o = {}) {
|
|
|
84
86
|
});
|
|
85
87
|
return fetch(u);
|
|
86
88
|
}
|
|
87
|
-
async function
|
|
88
|
-
const e = new URL(`${location.origin}/siliconflow/v1/chat/completions`),
|
|
89
|
-
Object.keys(
|
|
90
|
-
e.searchParams.append(d,
|
|
89
|
+
async function ke(t, n, s, l = "", r = {}) {
|
|
90
|
+
const e = new URL(`${location.origin}/siliconflow/v1/chat/completions`), o = {};
|
|
91
|
+
Object.keys(o).forEach((d) => {
|
|
92
|
+
e.searchParams.append(d, o[d]);
|
|
91
93
|
});
|
|
92
94
|
const u = new Request(e, {
|
|
93
95
|
method: "post",
|
|
@@ -109,10 +111,10 @@ async function Se(t, n, s, l = "", o = {}) {
|
|
|
109
111
|
});
|
|
110
112
|
return fetch(u);
|
|
111
113
|
}
|
|
112
|
-
async function
|
|
113
|
-
const e = new URL(`${location.origin}/moonshot/v1/chat/completions`),
|
|
114
|
-
Object.keys(
|
|
115
|
-
e.searchParams.append(d,
|
|
114
|
+
async function Se(t, n, s, l = "", r = {}) {
|
|
115
|
+
const e = new URL(`${location.origin}/moonshot/v1/chat/completions`), o = {};
|
|
116
|
+
Object.keys(o).forEach((d) => {
|
|
117
|
+
e.searchParams.append(d, o[d]);
|
|
116
118
|
});
|
|
117
119
|
const u = new Request(e, {
|
|
118
120
|
method: "post",
|
|
@@ -137,10 +139,10 @@ async function ke(t, n, s, l = "", o = {}) {
|
|
|
137
139
|
});
|
|
138
140
|
return fetch(u);
|
|
139
141
|
}
|
|
140
|
-
async function
|
|
141
|
-
const e = new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`),
|
|
142
|
-
Object.keys(
|
|
143
|
-
e.searchParams.append(d,
|
|
142
|
+
async function _e(t, n, s, l = "", r = {}) {
|
|
143
|
+
const e = new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`), o = {};
|
|
144
|
+
Object.keys(o).forEach((d) => {
|
|
145
|
+
e.searchParams.append(d, o[d]);
|
|
144
146
|
});
|
|
145
147
|
const u = new Request(e, {
|
|
146
148
|
method: "post",
|
|
@@ -165,12 +167,12 @@ async function Ce(t, n, s, l = "", o = {}) {
|
|
|
165
167
|
});
|
|
166
168
|
return fetch(u);
|
|
167
169
|
}
|
|
168
|
-
async function
|
|
169
|
-
const e = se(l),
|
|
170
|
-
Object.keys(u).forEach((
|
|
171
|
-
|
|
170
|
+
async function Ce(t, n, s, l = "", r = {}) {
|
|
171
|
+
const e = se(l), o = new URL(`${e}/support/${s}/a`), u = {};
|
|
172
|
+
Object.keys(u).forEach((y) => {
|
|
173
|
+
o.searchParams.append(y, u[y]);
|
|
172
174
|
});
|
|
173
|
-
const d = new Request(
|
|
175
|
+
const d = new Request(o, {
|
|
174
176
|
method: "post",
|
|
175
177
|
headers: {
|
|
176
178
|
"Content-Type": "application/json",
|
|
@@ -182,7 +184,7 @@ async function _e(t, n, s, l = "", o = {}) {
|
|
|
182
184
|
});
|
|
183
185
|
return fetch(d);
|
|
184
186
|
}
|
|
185
|
-
const
|
|
187
|
+
const Te = (t) => {
|
|
186
188
|
if (t.startsWith("data:")) {
|
|
187
189
|
const n = t.substring(5).trim();
|
|
188
190
|
if (n === "[DONE]")
|
|
@@ -215,22 +217,22 @@ const Re = (t) => {
|
|
|
215
217
|
{
|
|
216
218
|
label: "SiliconFlow 硅基流动大模型",
|
|
217
219
|
modelName: "siliconflow",
|
|
218
|
-
api:
|
|
220
|
+
api: ke
|
|
219
221
|
},
|
|
220
222
|
{
|
|
221
223
|
label: "Kimi Moonshot 月之暗面大模型",
|
|
222
224
|
modelName: "moonshot",
|
|
223
|
-
api:
|
|
225
|
+
api: Se
|
|
224
226
|
},
|
|
225
227
|
{
|
|
226
228
|
label: "通义千问大模型",
|
|
227
229
|
modelName: "dashscope",
|
|
228
|
-
api:
|
|
230
|
+
api: _e
|
|
229
231
|
},
|
|
230
232
|
{
|
|
231
233
|
label: "数智建管大模型",
|
|
232
234
|
modelName: "szjy",
|
|
233
|
-
api:
|
|
235
|
+
api: Ce
|
|
234
236
|
},
|
|
235
237
|
{
|
|
236
238
|
label: "Dify (OpenAI 兼容)",
|
|
@@ -247,7 +249,7 @@ const Re = (t) => {
|
|
|
247
249
|
};
|
|
248
250
|
},
|
|
249
251
|
spark(t) {
|
|
250
|
-
const n =
|
|
252
|
+
const n = Te(t);
|
|
251
253
|
return n.done ? {
|
|
252
254
|
done: !0
|
|
253
255
|
} : {
|
|
@@ -276,10 +278,10 @@ const Re = (t) => {
|
|
|
276
278
|
}
|
|
277
279
|
}, te = (t, n, s) => {
|
|
278
280
|
const l = t.split(s);
|
|
279
|
-
return l.slice(0, -1).forEach((
|
|
280
|
-
|
|
281
|
+
return l.slice(0, -1).forEach((r) => {
|
|
282
|
+
r.trim() !== "" && n.enqueue(r);
|
|
281
283
|
}), l[l.length - 1];
|
|
282
|
-
},
|
|
284
|
+
}, Re = (t) => {
|
|
283
285
|
let n = "";
|
|
284
286
|
return new TransformStream({
|
|
285
287
|
transform(s, l) {
|
|
@@ -300,9 +302,9 @@ const Re = (t) => {
|
|
|
300
302
|
async function Pe(t, n) {
|
|
301
303
|
const s = t.api;
|
|
302
304
|
return s ? new Promise((l) => {
|
|
303
|
-
s(n.text, n.token, n.identifier, n.baseUrl, n.extraConfig).then((
|
|
304
|
-
if (
|
|
305
|
-
const e =
|
|
305
|
+
s(n.text, n.token, n.identifier, n.baseUrl, n.extraConfig).then((r) => {
|
|
306
|
+
if (r.body) {
|
|
307
|
+
const e = r.body.pipeThrough(new TextDecoderStream()).pipeThrough(Re(`
|
|
306
308
|
`)).getReader();
|
|
307
309
|
console.log("reader from response:", e), l({
|
|
308
310
|
error: 0,
|
|
@@ -313,7 +315,7 @@ async function Pe(t, n) {
|
|
|
313
315
|
error: 1,
|
|
314
316
|
reader: null
|
|
315
317
|
});
|
|
316
|
-
}).catch((
|
|
318
|
+
}).catch((r) => {
|
|
317
319
|
l({
|
|
318
320
|
error: 1,
|
|
319
321
|
reader: null
|
|
@@ -334,8 +336,8 @@ function Ne() {
|
|
|
334
336
|
}
|
|
335
337
|
const le = (t, n) => {
|
|
336
338
|
const s = t.__vccOpts || t;
|
|
337
|
-
for (const [l,
|
|
338
|
-
s[l] =
|
|
339
|
+
for (const [l, r] of n)
|
|
340
|
+
s[l] = r;
|
|
339
341
|
return s;
|
|
340
342
|
}, Oe = ["src", "alt"], Le = {
|
|
341
343
|
__name: "SvgIcon",
|
|
@@ -381,14 +383,14 @@ const le = (t, n) => {
|
|
|
381
383
|
justifyContent: "center",
|
|
382
384
|
alignItems: "center"
|
|
383
385
|
};
|
|
384
|
-
}),
|
|
386
|
+
}), r = q(() => {
|
|
385
387
|
const e = {
|
|
386
388
|
width: "100%",
|
|
387
389
|
height: "100%"
|
|
388
390
|
};
|
|
389
391
|
return n.color && (e.filter = `drop-shadow(0 0 0 ${n.color})`), e;
|
|
390
392
|
});
|
|
391
|
-
return (e,
|
|
393
|
+
return (e, o) => (P(), L("div", {
|
|
392
394
|
class: "svg-icon-wrapper",
|
|
393
395
|
style: K(l.value)
|
|
394
396
|
}, [
|
|
@@ -396,7 +398,7 @@ const le = (t, n) => {
|
|
|
396
398
|
src: s.value,
|
|
397
399
|
alt: t.name,
|
|
398
400
|
class: W(["svg-icon", t.className]),
|
|
399
|
-
style: K(
|
|
401
|
+
style: K(r.value)
|
|
400
402
|
}, null, 14, Oe)
|
|
401
403
|
], 4));
|
|
402
404
|
}
|
|
@@ -425,18 +427,18 @@ const le = (t, n) => {
|
|
|
425
427
|
"updating"
|
|
426
428
|
],
|
|
427
429
|
setup(t, { expose: n, emit: s }) {
|
|
428
|
-
const { appContext: l } = re(), { $message:
|
|
429
|
-
let
|
|
430
|
-
const A = q(() => F ? F.render(
|
|
431
|
-
e.reader && e.reader.cancel(),
|
|
432
|
-
}, j = q(() => `${A.value}`), m =
|
|
430
|
+
const { appContext: l } = re(), { $message: r } = l.config.globalProperties, e = t, o = C(e.displayText || ""), u = C(""), d = C(!0), y = C(!1), _ = C(!!e.displayText), U = s, N = C(null);
|
|
431
|
+
let T = null;
|
|
432
|
+
const A = q(() => F ? F.render(o.value) : o.value), I = () => {
|
|
433
|
+
e.reader && e.reader.cancel(), y.value = !0, c.value = !1, p(), _.value = !0, U("completed", o.value), d.value = !1, T && (cancelAnimationFrame(T), T = null);
|
|
434
|
+
}, j = q(() => `${A.value}`), m = C(!1), f = () => {
|
|
433
435
|
m.value = !0;
|
|
434
436
|
}, p = () => {
|
|
435
437
|
m.value = !1;
|
|
436
|
-
}, c =
|
|
438
|
+
}, c = C(!1), i = async () => {
|
|
437
439
|
if (!e.reader) return;
|
|
438
|
-
const
|
|
439
|
-
for (d.value = !0; !
|
|
440
|
+
const b = new TextDecoder("utf-8");
|
|
441
|
+
for (d.value = !0; !y.value; )
|
|
440
442
|
try {
|
|
441
443
|
if (!e.reader) {
|
|
442
444
|
c.value = !0;
|
|
@@ -451,15 +453,15 @@ const le = (t, n) => {
|
|
|
451
453
|
c.value = !0;
|
|
452
454
|
break;
|
|
453
455
|
}
|
|
454
|
-
const
|
|
455
|
-
if (!
|
|
456
|
+
const S = ee[e.model];
|
|
457
|
+
if (!S)
|
|
456
458
|
break;
|
|
457
|
-
const O =
|
|
459
|
+
const O = S.call(ee, a, b);
|
|
458
460
|
if (O.done) {
|
|
459
461
|
c.value = !0;
|
|
460
462
|
break;
|
|
461
463
|
}
|
|
462
|
-
u.value += O.content,
|
|
464
|
+
u.value += O.content, T === null && k();
|
|
463
465
|
} catch (a) {
|
|
464
466
|
c.value = !0, console.log(3333, a), U("failed", a), I();
|
|
465
467
|
break;
|
|
@@ -468,34 +470,34 @@ const le = (t, n) => {
|
|
|
468
470
|
}
|
|
469
471
|
}, h = async () => {
|
|
470
472
|
e.scrollToBottomFn && e.scrollToBottomFn();
|
|
471
|
-
}, v = (
|
|
473
|
+
}, v = (b = () => {
|
|
472
474
|
}, a = () => {
|
|
473
475
|
}) => {
|
|
474
476
|
if (u.value.length > 0) {
|
|
475
477
|
const g = u.value.substring(0, 10);
|
|
476
|
-
|
|
478
|
+
o.value += g, u.value = u.value.substring(10), b();
|
|
477
479
|
} else
|
|
478
480
|
a();
|
|
479
|
-
},
|
|
480
|
-
if (
|
|
481
|
-
cancelAnimationFrame(
|
|
481
|
+
}, k = () => {
|
|
482
|
+
if (y.value && T) {
|
|
483
|
+
cancelAnimationFrame(T), T = null, d.value = !1;
|
|
482
484
|
return;
|
|
483
485
|
}
|
|
484
486
|
c.value ? v(
|
|
485
487
|
() => {
|
|
486
|
-
|
|
488
|
+
T = requestAnimationFrame(k), U("updating", null);
|
|
487
489
|
},
|
|
488
490
|
() => {
|
|
489
|
-
U("completed",
|
|
491
|
+
U("completed", o.value), d.value = !1, _.value = !0, ae(() => {
|
|
490
492
|
if (c.value = !1, e.messagePostRender && N.value)
|
|
491
493
|
try {
|
|
492
|
-
e.messagePostRender(N.value,
|
|
493
|
-
} catch (
|
|
494
|
-
console.error("messagePostRender 执行失败:",
|
|
494
|
+
e.messagePostRender(N.value, o.value);
|
|
495
|
+
} catch (b) {
|
|
496
|
+
console.error("messagePostRender 执行失败:", b);
|
|
495
497
|
}
|
|
496
|
-
}),
|
|
498
|
+
}), T = null;
|
|
497
499
|
}
|
|
498
|
-
) : (v(),
|
|
500
|
+
) : (v(), T = requestAnimationFrame(k)), h();
|
|
499
501
|
};
|
|
500
502
|
ue(
|
|
501
503
|
() => e.reader,
|
|
@@ -512,16 +514,16 @@ const le = (t, n) => {
|
|
|
512
514
|
abortReader: I,
|
|
513
515
|
initializeStart: f,
|
|
514
516
|
initializeEnd: p
|
|
515
|
-
}), q(() => m.value ? !0 : (!e.reader || !d ||
|
|
517
|
+
}), q(() => m.value ? !0 : (!e.reader || !d || o.value, !1));
|
|
516
518
|
const w = async () => {
|
|
517
519
|
try {
|
|
518
|
-
const
|
|
519
|
-
await je(
|
|
520
|
-
} catch (
|
|
521
|
-
console.error("复制失败:",
|
|
520
|
+
const b = o.value;
|
|
521
|
+
await je(b), r.success("复制成功");
|
|
522
|
+
} catch (b) {
|
|
523
|
+
console.error("复制失败:", b), r.error("复制失败");
|
|
522
524
|
}
|
|
523
525
|
};
|
|
524
|
-
return (
|
|
526
|
+
return (b, a) => (P(), J(oe, { name: "fade" }, {
|
|
525
527
|
default: M(() => [
|
|
526
528
|
j.value ? (P(), L("div", {
|
|
527
529
|
key: 0,
|
|
@@ -535,12 +537,12 @@ const le = (t, n) => {
|
|
|
535
537
|
class: "markdown-wrapper",
|
|
536
538
|
innerHTML: j.value
|
|
537
539
|
}, null, 8, ze),
|
|
538
|
-
|
|
540
|
+
_.value ? (P(), L("div", {
|
|
539
541
|
key: 0,
|
|
540
542
|
class: "ai-copy-btn-wrapper",
|
|
541
543
|
onClick: w
|
|
542
544
|
}, [
|
|
543
|
-
|
|
545
|
+
E(V, {
|
|
544
546
|
name: "/images/svg/copy.svg",
|
|
545
547
|
color: "#666666"
|
|
546
548
|
}),
|
|
@@ -551,7 +553,7 @@ const le = (t, n) => {
|
|
|
551
553
|
_: 1
|
|
552
554
|
}));
|
|
553
555
|
}
|
|
554
|
-
}, Ie = { class: "panel-header" },
|
|
556
|
+
}, Ie = { class: "panel-header" }, $e = { class: "header-actions" }, Ee = { class: "header-title" }, Ae = { class: "action-icons" }, qe = { class: "body-content" }, Me = {
|
|
555
557
|
key: 0,
|
|
556
558
|
class: "welcome-content"
|
|
557
559
|
}, Fe = { class: "subtitle" }, Be = { class: "highlight" }, De = { class: "quick-questions" }, Ve = ["onClick"], We = {
|
|
@@ -559,7 +561,7 @@ const le = (t, n) => {
|
|
|
559
561
|
class: "message-content user-content"
|
|
560
562
|
}, Je = { class: "panel-footer" }, He = {
|
|
561
563
|
key: 0,
|
|
562
|
-
src:
|
|
564
|
+
src: ge,
|
|
563
565
|
alt: "加载中",
|
|
564
566
|
class: "loading-icon"
|
|
565
567
|
}, Qe = { class: "input-box" }, Ke = ["src"], Xe = {
|
|
@@ -608,79 +610,79 @@ const le = (t, n) => {
|
|
|
608
610
|
},
|
|
609
611
|
emits: ["update:modelValue", "submit"],
|
|
610
612
|
setup(t, { emit: n }) {
|
|
611
|
-
const { appContext: s } = re(), { $message: l } = s.config.globalProperties,
|
|
613
|
+
const { appContext: s } = re(), { $message: l } = s.config.globalProperties, r = t, e = q(() => G.find((a) => a.modelName === r.llmName) ?? G.find((a) => a.modelName === "szjy")), o = n, u = C(""), d = C(null), y = C(!1), _ = C([]), U = C([
|
|
612
614
|
"什么是AI助理,能做什么?",
|
|
613
615
|
"当前项目的基本情况?",
|
|
614
616
|
"当前项目的进度情况?",
|
|
615
617
|
"当前项目的参建方有哪些?",
|
|
616
618
|
"数智建管平台有哪些功能?能做什么?"
|
|
617
|
-
]), N =
|
|
619
|
+
]), N = C([]), T = C(!1), A = C(null), I = () => {
|
|
618
620
|
ae(() => {
|
|
619
621
|
if (A.value) {
|
|
620
|
-
const a = A.value, g = a.scrollHeight,
|
|
621
|
-
g -
|
|
622
|
+
const a = A.value, g = a.scrollHeight, S = a.scrollTop, O = a.clientHeight;
|
|
623
|
+
g - S - O < 100 ? a.scrollTop = g : a.scrollTo({
|
|
622
624
|
top: g
|
|
623
625
|
});
|
|
624
626
|
}
|
|
625
627
|
});
|
|
626
|
-
}, j =
|
|
627
|
-
console.log("onFailedReader", a, g),
|
|
628
|
-
const
|
|
629
|
-
|
|
628
|
+
}, j = C(!1), m = q(() => j.value ? "/images/ai-stop.png" : "/images/ai-send.png"), f = (a, g) => {
|
|
629
|
+
console.log("onFailedReader", a, g), T.value = !1;
|
|
630
|
+
const S = w();
|
|
631
|
+
S && S.initializeEnd(), l.error("转换失败,请重试"), j.value = !1, setTimeout(() => {
|
|
630
632
|
d.value && d.value.focus();
|
|
631
633
|
});
|
|
632
634
|
}, p = (a, g) => {
|
|
633
|
-
|
|
635
|
+
T.value = !1, j.value = !1, I(), g && _.value[a] && (_.value[a].displayText = g), setTimeout(() => {
|
|
634
636
|
d.value && d.value.focus();
|
|
635
637
|
});
|
|
636
638
|
}, c = (a) => {
|
|
637
639
|
j.value = !0;
|
|
638
640
|
}, i = () => {
|
|
639
|
-
j.value = !1,
|
|
640
|
-
}, h =
|
|
641
|
+
j.value = !1, o("update:modelValue", !1), y.value = !1, _.value = [];
|
|
642
|
+
}, h = C(!1), v = () => {
|
|
641
643
|
h.value = !h.value;
|
|
642
|
-
},
|
|
643
|
-
u.value = a,
|
|
644
|
+
}, k = (a) => {
|
|
645
|
+
u.value = a, b();
|
|
644
646
|
}, w = () => {
|
|
645
647
|
for (let a = N.value.length - 1; a >= 0; a--)
|
|
646
648
|
if (N.value[a])
|
|
647
649
|
return N.value[a];
|
|
648
650
|
return null;
|
|
649
|
-
},
|
|
650
|
-
if (console.log("stylizingLoading:",
|
|
651
|
-
const
|
|
652
|
-
console.log("lastPreviewer:",
|
|
651
|
+
}, b = async () => {
|
|
652
|
+
if (console.log("stylizingLoading:", T.value), T.value) {
|
|
653
|
+
const R = w();
|
|
654
|
+
console.log("lastPreviewer:", R), R && (console.log("abortReader"), R.abortReader());
|
|
653
655
|
return;
|
|
654
656
|
}
|
|
655
657
|
if (!u.value.trim()) {
|
|
656
658
|
console.log("no input, return"), d.value.focus();
|
|
657
659
|
return;
|
|
658
660
|
}
|
|
659
|
-
|
|
661
|
+
_.value.push({
|
|
660
662
|
type: "user",
|
|
661
663
|
content: u.value
|
|
662
|
-
}), j.value = !0,
|
|
664
|
+
}), j.value = !0, y.value = !0, o("submit", u.value), I();
|
|
663
665
|
const a = u.value;
|
|
664
666
|
u.value = "";
|
|
665
|
-
const g =
|
|
666
|
-
N.value[g] && N.value[g].initializeStart(),
|
|
667
|
+
const g = _.value.length;
|
|
668
|
+
N.value[g] && N.value[g].initializeStart(), T.value = !0, _.value.push({
|
|
667
669
|
type: "ai"
|
|
668
670
|
});
|
|
669
|
-
const { error:
|
|
671
|
+
const { error: S, reader: O } = await Pe(e.value, {
|
|
670
672
|
text: a,
|
|
671
|
-
token:
|
|
672
|
-
identifier:
|
|
673
|
-
baseUrl:
|
|
674
|
-
extraConfig:
|
|
673
|
+
token: r.token,
|
|
674
|
+
identifier: r.identifier,
|
|
675
|
+
baseUrl: r.baseUrl,
|
|
676
|
+
extraConfig: r.extraConfig
|
|
675
677
|
});
|
|
676
|
-
if (
|
|
677
|
-
console.log(45455,
|
|
678
|
+
if (S) {
|
|
679
|
+
console.log(45455, S), f(g, S);
|
|
678
680
|
return;
|
|
679
681
|
}
|
|
680
|
-
O && (
|
|
682
|
+
O && (_.value[g].reader = O);
|
|
681
683
|
};
|
|
682
684
|
return (a, g) => {
|
|
683
|
-
const
|
|
685
|
+
const S = X("el-icon"), O = X("el-input");
|
|
684
686
|
return P(), J(oe, { name: "slide" }, {
|
|
685
687
|
default: M(() => [
|
|
686
688
|
t.modelValue ? (P(), L("div", {
|
|
@@ -688,27 +690,27 @@ const le = (t, n) => {
|
|
|
688
690
|
class: W(["ai-panel", { "drawer-mode": h.value }])
|
|
689
691
|
}, [
|
|
690
692
|
x("div", Ie, [
|
|
691
|
-
x("div",
|
|
692
|
-
x("div",
|
|
693
|
+
x("div", $e, [
|
|
694
|
+
x("div", Ee, D(t.title), 1),
|
|
693
695
|
x("div", Ae, [
|
|
694
|
-
|
|
696
|
+
E(S, {
|
|
695
697
|
class: "action-icon",
|
|
696
698
|
onClick: v
|
|
697
699
|
}, {
|
|
698
700
|
default: M(() => [
|
|
699
|
-
|
|
701
|
+
E(V, {
|
|
700
702
|
name: "/images/svg/drawer-layout.svg",
|
|
701
703
|
color: "#999999"
|
|
702
704
|
})
|
|
703
705
|
]),
|
|
704
706
|
_: 1
|
|
705
707
|
}),
|
|
706
|
-
|
|
708
|
+
E(S, {
|
|
707
709
|
class: "action-icon",
|
|
708
710
|
onClick: i
|
|
709
711
|
}, {
|
|
710
712
|
default: M(() => [
|
|
711
|
-
|
|
713
|
+
E(V, {
|
|
712
714
|
name: "/images/svg/close.svg",
|
|
713
715
|
color: "#999999"
|
|
714
716
|
})
|
|
@@ -719,35 +721,35 @@ const le = (t, n) => {
|
|
|
719
721
|
])
|
|
720
722
|
]),
|
|
721
723
|
x("div", qe, [
|
|
722
|
-
|
|
724
|
+
y.value ? (P(), L("div", {
|
|
723
725
|
key: 1,
|
|
724
726
|
class: "chat-messages",
|
|
725
727
|
ref_key: "messageContainerRef",
|
|
726
728
|
ref: A
|
|
727
729
|
}, [
|
|
728
|
-
(P(!0), L(Y, null, Z(
|
|
729
|
-
key:
|
|
730
|
-
class: W(["message-item",
|
|
730
|
+
(P(!0), L(Y, null, Z(_.value, (R, $) => (P(), L("div", {
|
|
731
|
+
key: $,
|
|
732
|
+
class: W(["message-item", R.type === "user" ? "user-message" : "ai-message"])
|
|
731
733
|
}, [
|
|
732
|
-
|
|
734
|
+
R.type === "ai" ? (P(), J(Ue, {
|
|
733
735
|
key: 0,
|
|
734
736
|
ref_for: !0,
|
|
735
|
-
ref: (z) => N.value[
|
|
736
|
-
reader:
|
|
737
|
-
"onUpdate:reader": (z) =>
|
|
738
|
-
model:
|
|
739
|
-
displayText:
|
|
737
|
+
ref: (z) => N.value[$] = z,
|
|
738
|
+
reader: R.reader,
|
|
739
|
+
"onUpdate:reader": (z) => R.reader = z,
|
|
740
|
+
model: r.llmName,
|
|
741
|
+
displayText: R.displayText,
|
|
740
742
|
scrollToBottomFn: I,
|
|
741
743
|
messagePostRender: t.messagePostRender,
|
|
742
|
-
onFailed: (z) => f(
|
|
743
|
-
onCompleted: (z) => p(
|
|
744
|
+
onFailed: (z) => f($, z),
|
|
745
|
+
onCompleted: (z) => p($, z),
|
|
744
746
|
onUpdating: () => c()
|
|
745
|
-
}, null, 8, ["reader", "onUpdate:reader", "model", "displayText", "messagePostRender", "onFailed", "onCompleted", "onUpdating"])) : (P(), L("div", We, D(
|
|
747
|
+
}, null, 8, ["reader", "onUpdate:reader", "model", "displayText", "messagePostRender", "onFailed", "onCompleted", "onUpdating"])) : (P(), L("div", We, D(R.content), 1))
|
|
746
748
|
], 2))), 128))
|
|
747
749
|
], 512)) : (P(), L("div", Me, [
|
|
748
750
|
g[2] || (g[2] = x("div", { class: "title" }, [
|
|
749
751
|
x("img", {
|
|
750
|
-
src:
|
|
752
|
+
src: ye,
|
|
751
753
|
alt: "AI助手",
|
|
752
754
|
class: "panel-icon"
|
|
753
755
|
}),
|
|
@@ -758,15 +760,15 @@ const le = (t, n) => {
|
|
|
758
760
|
x("span", Be, D(t.title), 1)
|
|
759
761
|
]),
|
|
760
762
|
x("div", De, [
|
|
761
|
-
(P(!0), L(Y, null, Z(U.value, (
|
|
762
|
-
key:
|
|
763
|
+
(P(!0), L(Y, null, Z(U.value, (R, $) => (P(), L("div", {
|
|
764
|
+
key: $,
|
|
763
765
|
class: "question-item",
|
|
764
|
-
onClick: (z) =>
|
|
766
|
+
onClick: (z) => k(R)
|
|
765
767
|
}, [
|
|
766
|
-
x("span", null, D(
|
|
767
|
-
|
|
768
|
+
x("span", null, D(R), 1),
|
|
769
|
+
E(S, null, {
|
|
768
770
|
default: M(() => [
|
|
769
|
-
|
|
771
|
+
E(V, {
|
|
770
772
|
name: "/images/svg/arrow-right.svg",
|
|
771
773
|
color: "#999999"
|
|
772
774
|
})
|
|
@@ -780,19 +782,19 @@ const le = (t, n) => {
|
|
|
780
782
|
x("div", Je, [
|
|
781
783
|
j.value ? (P(), L("img", He)) : B("", !0),
|
|
782
784
|
x("div", Qe, [
|
|
783
|
-
|
|
785
|
+
E(O, {
|
|
784
786
|
modelValue: u.value,
|
|
785
|
-
"onUpdate:modelValue": g[0] || (g[0] = (
|
|
787
|
+
"onUpdate:modelValue": g[0] || (g[0] = (R) => u.value = R),
|
|
786
788
|
ref_key: "refInputTextString",
|
|
787
789
|
ref: d,
|
|
788
790
|
placeholder: "请输入您的问题",
|
|
789
791
|
autofocus: "",
|
|
790
|
-
onKeyup: pe(
|
|
792
|
+
onKeyup: pe(b, ["enter"])
|
|
791
793
|
}, {
|
|
792
794
|
append: M(() => [
|
|
793
795
|
x("div", {
|
|
794
796
|
class: "send-icon-box",
|
|
795
|
-
onClick:
|
|
797
|
+
onClick: b
|
|
796
798
|
}, [
|
|
797
799
|
x("img", {
|
|
798
800
|
src: m.value,
|
|
@@ -819,37 +821,37 @@ var ie = { exports: {} };
|
|
|
819
821
|
})(window, function() {
|
|
820
822
|
return function(s) {
|
|
821
823
|
var l = {};
|
|
822
|
-
function
|
|
824
|
+
function r(e) {
|
|
823
825
|
if (l[e]) return l[e].exports;
|
|
824
|
-
var
|
|
825
|
-
return s[e].call(
|
|
826
|
+
var o = l[e] = { i: e, l: !1, exports: {} };
|
|
827
|
+
return s[e].call(o.exports, o, o.exports, r), o.l = !0, o.exports;
|
|
826
828
|
}
|
|
827
|
-
return
|
|
828
|
-
|
|
829
|
-
},
|
|
829
|
+
return r.m = s, r.c = l, r.d = function(e, o, u) {
|
|
830
|
+
r.o(e, o) || Object.defineProperty(e, o, { enumerable: !0, get: u });
|
|
831
|
+
}, r.r = function(e) {
|
|
830
832
|
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
|
|
831
|
-
},
|
|
832
|
-
if (1 &
|
|
833
|
+
}, r.t = function(e, o) {
|
|
834
|
+
if (1 & o && (e = r(e)), 8 & o || 4 & o && typeof e == "object" && e && e.__esModule) return e;
|
|
833
835
|
var u = /* @__PURE__ */ Object.create(null);
|
|
834
|
-
if (
|
|
835
|
-
return e[
|
|
836
|
+
if (r.r(u), Object.defineProperty(u, "default", { enumerable: !0, value: e }), 2 & o && typeof e != "string") for (var d in e) r.d(u, d, (function(y) {
|
|
837
|
+
return e[y];
|
|
836
838
|
}).bind(null, d));
|
|
837
839
|
return u;
|
|
838
|
-
},
|
|
839
|
-
var
|
|
840
|
+
}, r.n = function(e) {
|
|
841
|
+
var o = e && e.__esModule ? function() {
|
|
840
842
|
return e.default;
|
|
841
843
|
} : function() {
|
|
842
844
|
return e;
|
|
843
845
|
};
|
|
844
|
-
return
|
|
845
|
-
},
|
|
846
|
-
return Object.prototype.hasOwnProperty.call(e,
|
|
847
|
-
},
|
|
848
|
-
}([function(s, l,
|
|
846
|
+
return r.d(o, "a", o), o;
|
|
847
|
+
}, r.o = function(e, o) {
|
|
848
|
+
return Object.prototype.hasOwnProperty.call(e, o);
|
|
849
|
+
}, r.p = "", r(r.s = 0);
|
|
850
|
+
}([function(s, l, r) {
|
|
849
851
|
function e(m, f, p, c) {
|
|
850
852
|
p.push(m), c.push([].concat(f[m] || []));
|
|
851
853
|
}
|
|
852
|
-
function
|
|
854
|
+
function o(m, f) {
|
|
853
855
|
if (!m) throw new Error("[getMaxDepsChain] dep 参数不能为空");
|
|
854
856
|
var p = [], c = [], i = [];
|
|
855
857
|
for (e(m, f, c, i); c.length; ) {
|
|
@@ -860,8 +862,8 @@ var ie = { exports: {} };
|
|
|
860
862
|
e(v, f, c, i);
|
|
861
863
|
} else p.push([].concat(c)), c.pop();
|
|
862
864
|
}
|
|
863
|
-
return p.reduce(function(
|
|
864
|
-
return w.length >
|
|
865
|
+
return p.reduce(function(k, w) {
|
|
866
|
+
return w.length > k.length ? w : k;
|
|
865
867
|
}, []);
|
|
866
868
|
}
|
|
867
869
|
function u(m) {
|
|
@@ -872,23 +874,23 @@ var ie = { exports: {} };
|
|
|
872
874
|
});
|
|
873
875
|
var p = [];
|
|
874
876
|
return m.forEach(function(c) {
|
|
875
|
-
var i =
|
|
877
|
+
var i = o(c.name, f).length - 1;
|
|
876
878
|
c.priority = i, p[i] = (p[i] || []).concat(c);
|
|
877
879
|
}), p;
|
|
878
880
|
}
|
|
879
|
-
|
|
881
|
+
r.r(l), r.d(l, "loadScript", function() {
|
|
880
882
|
return N;
|
|
881
|
-
}),
|
|
882
|
-
return
|
|
883
|
-
}),
|
|
883
|
+
}), r.d(l, "loadScripts", function() {
|
|
884
|
+
return T;
|
|
885
|
+
}), r.d(l, "dynamicLoadScripts", function() {
|
|
884
886
|
return A;
|
|
885
|
-
}),
|
|
887
|
+
}), r.d(l, "createScriptsLoadIterator", function() {
|
|
886
888
|
return I;
|
|
887
|
-
}),
|
|
889
|
+
}), r.d(l, "loadScriptsQueue", function() {
|
|
888
890
|
return j;
|
|
889
|
-
}),
|
|
890
|
-
return
|
|
891
|
-
}),
|
|
891
|
+
}), r.d(l, "getMaxDepsChain", function() {
|
|
892
|
+
return o;
|
|
893
|
+
}), r.d(l, "depsParser", function() {
|
|
892
894
|
return u;
|
|
893
895
|
});
|
|
894
896
|
var d = function() {
|
|
@@ -896,40 +898,40 @@ var ie = { exports: {} };
|
|
|
896
898
|
for (var f, p = 1, c = arguments.length; p < c; p++) for (var i in f = arguments[p]) Object.prototype.hasOwnProperty.call(f, i) && (m[i] = f[i]);
|
|
897
899
|
return m;
|
|
898
900
|
}).apply(this, arguments);
|
|
899
|
-
},
|
|
901
|
+
}, y = function(m, f, p, c) {
|
|
900
902
|
return new (p || (p = Promise))(function(i, h) {
|
|
901
|
-
function v(
|
|
903
|
+
function v(b) {
|
|
902
904
|
try {
|
|
903
|
-
w(c.next(
|
|
905
|
+
w(c.next(b));
|
|
904
906
|
} catch (a) {
|
|
905
907
|
h(a);
|
|
906
908
|
}
|
|
907
909
|
}
|
|
908
|
-
function
|
|
910
|
+
function k(b) {
|
|
909
911
|
try {
|
|
910
|
-
w(c.throw(
|
|
912
|
+
w(c.throw(b));
|
|
911
913
|
} catch (a) {
|
|
912
914
|
h(a);
|
|
913
915
|
}
|
|
914
916
|
}
|
|
915
|
-
function w(
|
|
917
|
+
function w(b) {
|
|
916
918
|
var a;
|
|
917
|
-
|
|
919
|
+
b.done ? i(b.value) : (a = b.value, a instanceof p ? a : new p(function(g) {
|
|
918
920
|
g(a);
|
|
919
|
-
})).then(v,
|
|
921
|
+
})).then(v, k);
|
|
920
922
|
}
|
|
921
923
|
w((c = c.apply(m, [])).next());
|
|
922
924
|
});
|
|
923
|
-
},
|
|
925
|
+
}, _ = function(m, f) {
|
|
924
926
|
var p, c, i, h, v = { label: 0, sent: function() {
|
|
925
927
|
if (1 & i[0]) throw i[1];
|
|
926
928
|
return i[1];
|
|
927
929
|
}, trys: [], ops: [] };
|
|
928
|
-
return h = { next:
|
|
930
|
+
return h = { next: k(0), throw: k(1), return: k(2) }, typeof Symbol == "function" && (h[Symbol.iterator] = function() {
|
|
929
931
|
return this;
|
|
930
932
|
}), h;
|
|
931
|
-
function
|
|
932
|
-
return function(
|
|
933
|
+
function k(w) {
|
|
934
|
+
return function(b) {
|
|
933
935
|
return function(a) {
|
|
934
936
|
if (p) throw new TypeError("Generator is already executing.");
|
|
935
937
|
for (; v; ) try {
|
|
@@ -975,7 +977,7 @@ var ie = { exports: {} };
|
|
|
975
977
|
}
|
|
976
978
|
if (5 & a[0]) throw a[1];
|
|
977
979
|
return { value: a[0] ? a[1] : void 0, done: !0 };
|
|
978
|
-
}([w,
|
|
980
|
+
}([w, b]);
|
|
979
981
|
};
|
|
980
982
|
}
|
|
981
983
|
}, U = function(m) {
|
|
@@ -986,12 +988,12 @@ var ie = { exports: {} };
|
|
|
986
988
|
}, f);
|
|
987
989
|
function c(i) {
|
|
988
990
|
f[i] = m[i] && function(h) {
|
|
989
|
-
return new Promise(function(v,
|
|
990
|
-
(function(w,
|
|
991
|
-
Promise.resolve(g).then(function(
|
|
992
|
-
w({ value:
|
|
993
|
-
},
|
|
994
|
-
})(v,
|
|
991
|
+
return new Promise(function(v, k) {
|
|
992
|
+
(function(w, b, a, g) {
|
|
993
|
+
Promise.resolve(g).then(function(S) {
|
|
994
|
+
w({ value: S, done: a });
|
|
995
|
+
}, b);
|
|
996
|
+
})(v, k, (h = m[i](h)).done, h.value);
|
|
995
997
|
});
|
|
996
998
|
};
|
|
997
999
|
}
|
|
@@ -1002,24 +1004,24 @@ var ie = { exports: {} };
|
|
|
1002
1004
|
h.type = "text/javascript", h.src = m, h.crossOrigin = "anonymous", h.onreadystatechange = p, h.onload = p, h.onerror = c, i.appendChild(h);
|
|
1003
1005
|
});
|
|
1004
1006
|
}
|
|
1005
|
-
var
|
|
1006
|
-
return f === void 0 && (f = {}),
|
|
1007
|
+
var T = function(m, f) {
|
|
1008
|
+
return f === void 0 && (f = {}), y(void 0, void 0, void 0, function() {
|
|
1007
1009
|
var p, c, i, h, v;
|
|
1008
|
-
return
|
|
1009
|
-
switch (
|
|
1010
|
+
return _(this, function(k) {
|
|
1011
|
+
switch (k.label) {
|
|
1010
1012
|
case 0:
|
|
1011
1013
|
return p = f.baseUrl, c = p === void 0 ? "" : p, i = f.lastLoadResult, h = f.inHead, v = h !== void 0 && h, [4, Promise.all(m.map(function(w) {
|
|
1012
|
-
return
|
|
1013
|
-
var
|
|
1014
|
-
return
|
|
1014
|
+
return y(void 0, void 0, void 0, function() {
|
|
1015
|
+
var b, a, g, S, O, R, $, z;
|
|
1016
|
+
return _(this, function(Q) {
|
|
1015
1017
|
switch (Q.label) {
|
|
1016
1018
|
case 0:
|
|
1017
|
-
return
|
|
1019
|
+
return b = w.name, a = w.path, g = w.deps, ($ = {})[b] = !0, S = $, (z = {})[b] = !1, O = z, window[b] ? [2, S] : [3, 1];
|
|
1018
1020
|
case 1:
|
|
1019
|
-
return
|
|
1020
|
-
i[ce] !== !1 && (
|
|
1021
|
-
}),
|
|
1022
|
-
return
|
|
1021
|
+
return R = !0, g && i && [].concat(g).forEach(function(ce) {
|
|
1022
|
+
i[ce] !== !1 && (R = !0);
|
|
1023
|
+
}), R ? [4, N(a.indexOf("http") === 0 || a.indexOf("//:") === 0 ? a : c + a, v).then(function() {
|
|
1024
|
+
return S;
|
|
1023
1025
|
}).catch(function() {
|
|
1024
1026
|
return O;
|
|
1025
1027
|
})] : [3, 3];
|
|
@@ -1032,7 +1034,7 @@ var ie = { exports: {} };
|
|
|
1032
1034
|
});
|
|
1033
1035
|
}))];
|
|
1034
1036
|
case 1:
|
|
1035
|
-
return [2,
|
|
1037
|
+
return [2, k.sent()];
|
|
1036
1038
|
}
|
|
1037
1039
|
});
|
|
1038
1040
|
});
|
|
@@ -1042,7 +1044,7 @@ var ie = { exports: {} };
|
|
|
1042
1044
|
return { next: function() {
|
|
1043
1045
|
if (p.length) {
|
|
1044
1046
|
var c = p.shift();
|
|
1045
|
-
return
|
|
1047
|
+
return T(c, f).then(function(i) {
|
|
1046
1048
|
return { value: i, done: !1 };
|
|
1047
1049
|
});
|
|
1048
1050
|
}
|
|
@@ -1053,9 +1055,9 @@ var ie = { exports: {} };
|
|
|
1053
1055
|
var p;
|
|
1054
1056
|
return f === void 0 && (f = {}), (p = {})[Symbol.asyncIterator] = A(m, f), p;
|
|
1055
1057
|
}, j = function(m, f) {
|
|
1056
|
-
return f === void 0 && (f = {}),
|
|
1057
|
-
var p, c, i, h, v,
|
|
1058
|
-
return
|
|
1058
|
+
return f === void 0 && (f = {}), y(void 0, void 0, void 0, function() {
|
|
1059
|
+
var p, c, i, h, v, k;
|
|
1060
|
+
return _(this, function(w) {
|
|
1059
1061
|
switch (w.label) {
|
|
1060
1062
|
case 0:
|
|
1061
1063
|
w.trys.push([0, 5, 6, 11]), p = U(I(m, f)), w.label = 1;
|
|
@@ -1063,8 +1065,8 @@ var ie = { exports: {} };
|
|
|
1063
1065
|
return [4, p.next()];
|
|
1064
1066
|
case 2:
|
|
1065
1067
|
if ((c = w.sent()).done) return [3, 4];
|
|
1066
|
-
i = c.value, f.lastLoadResult = f.lastLoadResult || {}, console.log("current load: ", i), i.forEach(function(
|
|
1067
|
-
f.lastLoadResult = d(d({}, f.lastLoadResult),
|
|
1068
|
+
i = c.value, f.lastLoadResult = f.lastLoadResult || {}, console.log("current load: ", i), i.forEach(function(b) {
|
|
1069
|
+
f.lastLoadResult = d(d({}, f.lastLoadResult), b);
|
|
1068
1070
|
}), w.label = 3;
|
|
1069
1071
|
case 3:
|
|
1070
1072
|
return [3, 1];
|
|
@@ -1073,7 +1075,7 @@ var ie = { exports: {} };
|
|
|
1073
1075
|
case 5:
|
|
1074
1076
|
return h = w.sent(), v = { error: h }, [3, 11];
|
|
1075
1077
|
case 6:
|
|
1076
|
-
return w.trys.push([6, , 9, 10]), c && !c.done && (
|
|
1078
|
+
return w.trys.push([6, , 9, 10]), c && !c.done && (k = p.return) ? [4, k.call(p)] : [3, 8];
|
|
1077
1079
|
case 7:
|
|
1078
1080
|
w.sent(), w.label = 8;
|
|
1079
1081
|
case 8:
|
|
@@ -1147,13 +1149,13 @@ const Ze = {
|
|
|
1147
1149
|
}
|
|
1148
1150
|
},
|
|
1149
1151
|
setup(t) {
|
|
1150
|
-
const n =
|
|
1152
|
+
const n = C(!1), s = C(!1), l = () => {
|
|
1151
1153
|
n.value = !n.value;
|
|
1152
|
-
},
|
|
1154
|
+
}, r = () => {
|
|
1153
1155
|
s.value = !0, n.value = !1;
|
|
1154
1156
|
}, e = (d) => {
|
|
1155
1157
|
console.log("用户输入:", d);
|
|
1156
|
-
},
|
|
1158
|
+
}, o = [
|
|
1157
1159
|
{
|
|
1158
1160
|
name: "markdownit",
|
|
1159
1161
|
path: "markdown-it.min.js"
|
|
@@ -1164,19 +1166,19 @@ const Ze = {
|
|
|
1164
1166
|
}
|
|
1165
1167
|
];
|
|
1166
1168
|
let u = {};
|
|
1167
|
-
return Ye.loadScriptsQueue(
|
|
1169
|
+
return Ye.loadScriptsQueue(o, {
|
|
1168
1170
|
baseUrl: "/scripts/ai/",
|
|
1169
1171
|
lastLoadResult: u,
|
|
1170
1172
|
inHead: !1
|
|
1171
1173
|
}).then((d) => {
|
|
1172
1174
|
if (console.log("load ai deps: ", d), window.markdownit) {
|
|
1173
|
-
const
|
|
1174
|
-
console.log("markdownit: ",
|
|
1175
|
+
const y = window.markdownit();
|
|
1176
|
+
console.log("markdownit: ", y), Ne();
|
|
1175
1177
|
}
|
|
1176
|
-
}), (d,
|
|
1177
|
-
|
|
1178
|
+
}), (d, y) => s.value ? B("", !0) : (P(), L("div", Ze, [
|
|
1179
|
+
E(Xe, {
|
|
1178
1180
|
modelValue: n.value,
|
|
1179
|
-
"onUpdate:modelValue":
|
|
1181
|
+
"onUpdate:modelValue": y[0] || (y[0] = (_) => n.value = _),
|
|
1180
1182
|
onSubmit: e,
|
|
1181
1183
|
token: t.token,
|
|
1182
1184
|
identifier: t.identifier,
|
|
@@ -1192,8 +1194,8 @@ const Ze = {
|
|
|
1192
1194
|
}, [
|
|
1193
1195
|
x("div", {
|
|
1194
1196
|
class: "close-icon",
|
|
1195
|
-
onClick: he(
|
|
1196
|
-
}, [...
|
|
1197
|
+
onClick: he(r, ["stop"])
|
|
1198
|
+
}, [...y[1] || (y[1] = [
|
|
1197
1199
|
x("svg", {
|
|
1198
1200
|
viewBox: "0 0 1024 1024",
|
|
1199
1201
|
width: "8",
|
|
@@ -1205,11 +1207,11 @@ const Ze = {
|
|
|
1205
1207
|
})
|
|
1206
1208
|
], -1)
|
|
1207
1209
|
])]),
|
|
1208
|
-
|
|
1210
|
+
y[2] || (y[2] = x("img", {
|
|
1209
1211
|
src: ve,
|
|
1210
1212
|
alt: "AI助手"
|
|
1211
1213
|
}, null, -1)),
|
|
1212
|
-
|
|
1214
|
+
y[3] || (y[3] = x("span", { class: "ai-icon-text" }, "AI助手", -1))
|
|
1213
1215
|
])
|
|
1214
1216
|
]));
|
|
1215
1217
|
}
|
|
@@ -1231,10 +1233,10 @@ const Ze = {
|
|
|
1231
1233
|
const n = t.indexOf("?");
|
|
1232
1234
|
if (n === -1)
|
|
1233
1235
|
return { routeName: t };
|
|
1234
|
-
const s = t.substring(0, n), l = t.substring(n + 1),
|
|
1235
|
-
return new URLSearchParams(l).forEach((
|
|
1236
|
-
|
|
1237
|
-
}), { routeName: s, queryParams: Object.keys(
|
|
1236
|
+
const s = t.substring(0, n), l = t.substring(n + 1), r = {};
|
|
1237
|
+
return new URLSearchParams(l).forEach((o, u) => {
|
|
1238
|
+
r[u] = o;
|
|
1239
|
+
}), { routeName: s, queryParams: Object.keys(r).length > 0 ? r : void 0 };
|
|
1238
1240
|
}, ot = {
|
|
1239
1241
|
color: "#536fec",
|
|
1240
1242
|
fontWeight: "bold",
|
|
@@ -1243,77 +1245,77 @@ const Ze = {
|
|
|
1243
1245
|
padding: "0 3px"
|
|
1244
1246
|
}, at = (t) => {
|
|
1245
1247
|
const n = /#router:([^#]+)#/g, s = [];
|
|
1246
|
-
let l = 0,
|
|
1247
|
-
for (; (
|
|
1248
|
-
|
|
1249
|
-
const e =
|
|
1250
|
-
s.push({ text:
|
|
1248
|
+
let l = 0, r;
|
|
1249
|
+
for (; (r = n.exec(t)) !== null; ) {
|
|
1250
|
+
r.index > l && s.push({ text: t.substring(l, r.index) });
|
|
1251
|
+
const e = r[1], { routeName: o, queryParams: u } = rt(e);
|
|
1252
|
+
s.push({ text: o, routeName: o, queryParams: u }), l = n.lastIndex;
|
|
1251
1253
|
}
|
|
1252
1254
|
return l < t.length && s.push({ text: t.substring(l) }), s;
|
|
1253
1255
|
}, st = (t, n, s = {}, l) => {
|
|
1254
|
-
const { onRouteClick:
|
|
1255
|
-
|
|
1256
|
+
const { onRouteClick: r = nt, linkStyle: e = {} } = s, o = document.createElement("a");
|
|
1257
|
+
o.href = "#", o.textContent = t;
|
|
1256
1258
|
const u = { ...ot, ...e };
|
|
1257
|
-
return Object.assign(
|
|
1258
|
-
d.preventDefault(),
|
|
1259
|
-
}),
|
|
1259
|
+
return Object.assign(o.style, u), o.addEventListener("click", (d) => {
|
|
1260
|
+
d.preventDefault(), r(n, l);
|
|
1261
|
+
}), o;
|
|
1260
1262
|
}, lt = (t) => {
|
|
1261
1263
|
const n = /#router:([^#]+)#/g, s = [], l = document.createTreeWalker(
|
|
1262
1264
|
t,
|
|
1263
1265
|
NodeFilter.SHOW_TEXT,
|
|
1264
1266
|
null
|
|
1265
1267
|
);
|
|
1266
|
-
let
|
|
1267
|
-
for (;
|
|
1268
|
-
const e =
|
|
1269
|
-
if (n.test(
|
|
1268
|
+
let r = l.nextNode();
|
|
1269
|
+
for (; r; ) {
|
|
1270
|
+
const e = r, o = e.textContent || "";
|
|
1271
|
+
if (n.test(o)) {
|
|
1270
1272
|
n.lastIndex = 0;
|
|
1271
|
-
const u = at(
|
|
1273
|
+
const u = at(o);
|
|
1272
1274
|
u.length > 0 && s.push({ node: e, replacements: u });
|
|
1273
1275
|
}
|
|
1274
|
-
|
|
1276
|
+
r = l.nextNode();
|
|
1275
1277
|
}
|
|
1276
1278
|
return s;
|
|
1277
1279
|
}, dt = (t, n, s = {}) => {
|
|
1278
1280
|
const l = lt(t);
|
|
1279
|
-
l.forEach(({ node:
|
|
1281
|
+
l.forEach(({ node: r, replacements: e }) => {
|
|
1280
1282
|
var u;
|
|
1281
|
-
const
|
|
1282
|
-
e.forEach(({ text: d, routeName:
|
|
1283
|
-
if (
|
|
1284
|
-
const U = st(d,
|
|
1285
|
-
|
|
1283
|
+
const o = document.createDocumentFragment();
|
|
1284
|
+
e.forEach(({ text: d, routeName: y, queryParams: _ }) => {
|
|
1285
|
+
if (y) {
|
|
1286
|
+
const U = st(d, y, s, _);
|
|
1287
|
+
o.appendChild(U);
|
|
1286
1288
|
} else
|
|
1287
|
-
|
|
1288
|
-
}), (u =
|
|
1289
|
-
}), s != null && s.nodeCallback && l.forEach(({ node:
|
|
1290
|
-
var
|
|
1291
|
-
(
|
|
1289
|
+
o.appendChild(document.createTextNode(d));
|
|
1290
|
+
}), (u = r.parentNode) == null || u.replaceChild(o, r);
|
|
1291
|
+
}), s != null && s.nodeCallback && l.forEach(({ node: r, replacements: e }) => {
|
|
1292
|
+
var o;
|
|
1293
|
+
(o = s.nodeCallback) == null || o.call(s, r, e);
|
|
1292
1294
|
});
|
|
1293
|
-
}, it = "0.1.
|
|
1295
|
+
}, it = "0.1.8", ct = "Sz";
|
|
1294
1296
|
function ft({
|
|
1295
1297
|
componentPrefix: t = ct,
|
|
1296
1298
|
components: n = []
|
|
1297
1299
|
} = {}) {
|
|
1298
1300
|
const s = [];
|
|
1299
|
-
function l(e,
|
|
1300
|
-
e.component(t +
|
|
1301
|
-
t +
|
|
1301
|
+
function l(e, o, u) {
|
|
1302
|
+
e.component(t + o) || e.component(
|
|
1303
|
+
t + o,
|
|
1302
1304
|
u
|
|
1303
1305
|
);
|
|
1304
1306
|
}
|
|
1305
|
-
function
|
|
1306
|
-
s.includes(e) || (s.push(e), n.forEach((
|
|
1307
|
-
const { name: u, alias: d } =
|
|
1308
|
-
l(e, u,
|
|
1309
|
-
l(e,
|
|
1307
|
+
function r(e) {
|
|
1308
|
+
s.includes(e) || (s.push(e), n.forEach((o) => {
|
|
1309
|
+
const { name: u, alias: d } = o;
|
|
1310
|
+
l(e, u, o), d && d.forEach((y) => {
|
|
1311
|
+
l(e, y, o);
|
|
1310
1312
|
});
|
|
1311
1313
|
}));
|
|
1312
1314
|
}
|
|
1313
1315
|
return {
|
|
1314
1316
|
version: it,
|
|
1315
1317
|
componentPrefix: t,
|
|
1316
|
-
install:
|
|
1318
|
+
install: r
|
|
1317
1319
|
};
|
|
1318
1320
|
}
|
|
1319
1321
|
const pt = {
|