@szjy/ai-coms 0.1.4 → 0.1.5
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/index.mjs
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
|
-
import { computed as q,
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return new URLSearchParams(new URL(n).search).get(t);
|
|
5
|
-
}
|
|
6
|
-
function be(t) {
|
|
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
|
+
function se(t) {
|
|
7
4
|
return t.startsWith("http://") || t.startsWith("https://") ? t : `${location.protocol}//${location.host}${t}`;
|
|
8
5
|
}
|
|
6
|
+
async function be(t, n, a, s = "") {
|
|
7
|
+
const r = se(s), e = new URL(`${r}/v1/chat/completions`), i = new Request(e, {
|
|
8
|
+
method: "post",
|
|
9
|
+
headers: {
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
Authorization: "Bearer app-oLZVFFdYyJX2QK3rdOLWsC2u"
|
|
12
|
+
},
|
|
13
|
+
body: JSON.stringify({
|
|
14
|
+
model: "dify",
|
|
15
|
+
stream: !0,
|
|
16
|
+
inputs: {
|
|
17
|
+
token: n
|
|
18
|
+
},
|
|
19
|
+
messages: [
|
|
20
|
+
{
|
|
21
|
+
role: "system",
|
|
22
|
+
content: "你是一个专业的AI助手,请用中文回答问题。"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
role: "user",
|
|
26
|
+
content: t
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
return fetch(i);
|
|
32
|
+
}
|
|
9
33
|
async function we(t) {
|
|
10
|
-
const n = new URL("http://localhost:11434/api/chat"),
|
|
11
|
-
Object.keys(
|
|
12
|
-
n.searchParams.append(r,
|
|
34
|
+
const n = new URL("http://localhost:11434/api/chat"), a = {};
|
|
35
|
+
Object.keys(a).forEach((r) => {
|
|
36
|
+
n.searchParams.append(r, a[r]);
|
|
13
37
|
});
|
|
14
|
-
const
|
|
38
|
+
const s = new Request(n, {
|
|
15
39
|
mode: "cors",
|
|
16
40
|
method: "post",
|
|
17
41
|
headers: {
|
|
@@ -32,14 +56,14 @@ async function we(t) {
|
|
|
32
56
|
]
|
|
33
57
|
})
|
|
34
58
|
});
|
|
35
|
-
return fetch(
|
|
59
|
+
return fetch(s);
|
|
36
60
|
}
|
|
37
61
|
async function xe(t, n) {
|
|
38
|
-
const
|
|
39
|
-
Object.keys(
|
|
40
|
-
|
|
62
|
+
const a = new URL(`${location.origin}/spark/v1/chat/completions`), s = {};
|
|
63
|
+
Object.keys(s).forEach((e) => {
|
|
64
|
+
a.searchParams.append(e, s[e]);
|
|
41
65
|
});
|
|
42
|
-
const r = new Request(
|
|
66
|
+
const r = new Request(a, {
|
|
43
67
|
method: "post",
|
|
44
68
|
headers: {
|
|
45
69
|
"Content-Type": "application/json",
|
|
@@ -59,11 +83,11 @@ async function xe(t, n) {
|
|
|
59
83
|
return fetch(r);
|
|
60
84
|
}
|
|
61
85
|
async function ke(t, n) {
|
|
62
|
-
const
|
|
63
|
-
Object.keys(
|
|
64
|
-
|
|
86
|
+
const a = new URL(`${location.origin}/siliconflow/v1/chat/completions`), s = {};
|
|
87
|
+
Object.keys(s).forEach((e) => {
|
|
88
|
+
a.searchParams.append(e, s[e]);
|
|
65
89
|
});
|
|
66
|
-
const r = new Request(
|
|
90
|
+
const r = new Request(a, {
|
|
67
91
|
method: "post",
|
|
68
92
|
headers: {
|
|
69
93
|
"Content-Type": "application/json",
|
|
@@ -84,11 +108,11 @@ async function ke(t, n) {
|
|
|
84
108
|
return fetch(r);
|
|
85
109
|
}
|
|
86
110
|
async function Se(t, n) {
|
|
87
|
-
const
|
|
88
|
-
Object.keys(
|
|
89
|
-
|
|
111
|
+
const a = new URL(`${location.origin}/moonshot/v1/chat/completions`), s = {};
|
|
112
|
+
Object.keys(s).forEach((e) => {
|
|
113
|
+
a.searchParams.append(e, s[e]);
|
|
90
114
|
});
|
|
91
|
-
const r = new Request(
|
|
115
|
+
const r = new Request(a, {
|
|
92
116
|
method: "post",
|
|
93
117
|
headers: {
|
|
94
118
|
"Content-Type": "application/json",
|
|
@@ -112,11 +136,11 @@ async function Se(t, n) {
|
|
|
112
136
|
return fetch(r);
|
|
113
137
|
}
|
|
114
138
|
async function _e(t, n) {
|
|
115
|
-
const
|
|
116
|
-
Object.keys(
|
|
117
|
-
|
|
139
|
+
const a = new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`), s = {};
|
|
140
|
+
Object.keys(s).forEach((e) => {
|
|
141
|
+
a.searchParams.append(e, s[e]);
|
|
118
142
|
});
|
|
119
|
-
const r = new Request(
|
|
143
|
+
const r = new Request(a, {
|
|
120
144
|
method: "post",
|
|
121
145
|
headers: {
|
|
122
146
|
"Content-Type": "application/json",
|
|
@@ -139,12 +163,12 @@ async function _e(t, n) {
|
|
|
139
163
|
});
|
|
140
164
|
return fetch(r);
|
|
141
165
|
}
|
|
142
|
-
async function Ce(t, n,
|
|
143
|
-
const r =
|
|
144
|
-
Object.keys(i).forEach((
|
|
145
|
-
e.searchParams.append(
|
|
166
|
+
async function Ce(t, n, a, s = "") {
|
|
167
|
+
const r = se(s), e = new URL(`${r}/support/${a}/a`), i = {};
|
|
168
|
+
Object.keys(i).forEach((v) => {
|
|
169
|
+
e.searchParams.append(v, i[v]);
|
|
146
170
|
});
|
|
147
|
-
const
|
|
171
|
+
const f = new Request(e, {
|
|
148
172
|
method: "post",
|
|
149
173
|
headers: {
|
|
150
174
|
"Content-Type": "application/json",
|
|
@@ -154,7 +178,7 @@ async function Ce(t, n, o, a = "") {
|
|
|
154
178
|
content: t
|
|
155
179
|
})
|
|
156
180
|
});
|
|
157
|
-
return fetch(
|
|
181
|
+
return fetch(f);
|
|
158
182
|
}
|
|
159
183
|
const Te = (t) => {
|
|
160
184
|
if (t.startsWith("data:")) {
|
|
@@ -165,12 +189,12 @@ const Te = (t) => {
|
|
|
165
189
|
};
|
|
166
190
|
try {
|
|
167
191
|
return JSON.parse(n);
|
|
168
|
-
} catch (
|
|
169
|
-
console.error("JSON parsing error:",
|
|
192
|
+
} catch (a) {
|
|
193
|
+
console.error("JSON parsing error:", a);
|
|
170
194
|
}
|
|
171
195
|
}
|
|
172
196
|
return null;
|
|
173
|
-
},
|
|
197
|
+
}, G = [
|
|
174
198
|
{
|
|
175
199
|
label: "模拟数据模型",
|
|
176
200
|
modelName: "standard",
|
|
@@ -205,14 +229,19 @@ const Te = (t) => {
|
|
|
205
229
|
label: "数智建管大模型",
|
|
206
230
|
modelName: "szjy",
|
|
207
231
|
api: Ce
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
label: "Dify (OpenAI 兼容)",
|
|
235
|
+
modelName: "dify-openai",
|
|
236
|
+
api: be
|
|
208
237
|
}
|
|
209
|
-
],
|
|
238
|
+
], ee = {
|
|
210
239
|
standard(t, n) {
|
|
211
|
-
let
|
|
212
|
-
return t instanceof Uint8Array ?
|
|
240
|
+
let a = "";
|
|
241
|
+
return t instanceof Uint8Array ? a = n.decode(t, {
|
|
213
242
|
stream: !0
|
|
214
|
-
}) :
|
|
215
|
-
content:
|
|
243
|
+
}) : a = t, {
|
|
244
|
+
content: a
|
|
216
245
|
};
|
|
217
246
|
},
|
|
218
247
|
spark(t) {
|
|
@@ -235,52 +264,55 @@ const Te = (t) => {
|
|
|
235
264
|
szjy(t) {
|
|
236
265
|
return this.spark(t);
|
|
237
266
|
},
|
|
267
|
+
"dify-openai"(t) {
|
|
268
|
+
return this.spark(t);
|
|
269
|
+
},
|
|
238
270
|
ollama3(t) {
|
|
239
271
|
return {
|
|
240
272
|
content: JSON.parse(t).message.content
|
|
241
273
|
};
|
|
242
274
|
}
|
|
243
|
-
},
|
|
244
|
-
const
|
|
245
|
-
return
|
|
275
|
+
}, te = (t, n, a) => {
|
|
276
|
+
const s = t.split(a);
|
|
277
|
+
return s.slice(0, -1).forEach((r) => {
|
|
246
278
|
r.trim() !== "" && n.enqueue(r);
|
|
247
|
-
}),
|
|
248
|
-
},
|
|
279
|
+
}), s[s.length - 1];
|
|
280
|
+
}, Re = (t) => {
|
|
249
281
|
let n = "";
|
|
250
282
|
return new TransformStream({
|
|
251
|
-
transform(
|
|
252
|
-
if (n +=
|
|
253
|
-
n =
|
|
283
|
+
transform(a, s) {
|
|
284
|
+
if (n += a, n.trim().startsWith("data:"))
|
|
285
|
+
n = te(n, s, t);
|
|
254
286
|
else
|
|
255
287
|
try {
|
|
256
|
-
JSON.parse(n), n =
|
|
288
|
+
JSON.parse(n), n = te(n, s, t);
|
|
257
289
|
} catch {
|
|
258
|
-
|
|
290
|
+
s.enqueue(a), n = "";
|
|
259
291
|
}
|
|
260
292
|
},
|
|
261
|
-
flush(
|
|
262
|
-
n.trim() !== "" &&
|
|
293
|
+
flush(a) {
|
|
294
|
+
n.trim() !== "" && a.enqueue(n);
|
|
263
295
|
}
|
|
264
296
|
});
|
|
265
297
|
};
|
|
266
|
-
async function
|
|
267
|
-
const
|
|
268
|
-
return
|
|
269
|
-
|
|
298
|
+
async function Pe(t, n) {
|
|
299
|
+
const a = t.api;
|
|
300
|
+
return a ? new Promise((s) => {
|
|
301
|
+
a(n.text, n.token, n.identifier, n.baseUrl).then((r) => {
|
|
270
302
|
if (r.body) {
|
|
271
|
-
const e = r.body.pipeThrough(new TextDecoderStream()).pipeThrough(
|
|
303
|
+
const e = r.body.pipeThrough(new TextDecoderStream()).pipeThrough(Re(`
|
|
272
304
|
`)).getReader();
|
|
273
|
-
console.log("reader from response:", e),
|
|
305
|
+
console.log("reader from response:", e), s({
|
|
274
306
|
error: 0,
|
|
275
307
|
reader: e
|
|
276
308
|
});
|
|
277
309
|
} else
|
|
278
|
-
|
|
310
|
+
s({
|
|
279
311
|
error: 1,
|
|
280
312
|
reader: null
|
|
281
313
|
});
|
|
282
314
|
}).catch((r) => {
|
|
283
|
-
|
|
315
|
+
s({
|
|
284
316
|
error: 1,
|
|
285
317
|
reader: null
|
|
286
318
|
});
|
|
@@ -290,20 +322,20 @@ async function Le(t, n) {
|
|
|
290
322
|
reader: null
|
|
291
323
|
};
|
|
292
324
|
}
|
|
293
|
-
let
|
|
325
|
+
let F = null;
|
|
294
326
|
function Ne() {
|
|
295
|
-
return
|
|
327
|
+
return F || (window.markdownit ? F = new window.markdownit({
|
|
296
328
|
html: !0,
|
|
297
329
|
linkify: !0,
|
|
298
330
|
typographer: !0
|
|
299
|
-
}) : console.log("markdownit is not loaded"),
|
|
331
|
+
}) : console.log("markdownit is not loaded"), F);
|
|
300
332
|
}
|
|
301
|
-
const
|
|
302
|
-
const
|
|
303
|
-
for (const [
|
|
304
|
-
|
|
305
|
-
return
|
|
306
|
-
}, Oe = ["src", "alt"],
|
|
333
|
+
const le = (t, n) => {
|
|
334
|
+
const a = t.__vccOpts || t;
|
|
335
|
+
for (const [s, r] of n)
|
|
336
|
+
a[s] = r;
|
|
337
|
+
return a;
|
|
338
|
+
}, Oe = ["src", "alt"], Le = {
|
|
307
339
|
__name: "SvgIcon",
|
|
308
340
|
props: {
|
|
309
341
|
// 图标名称或完整URL
|
|
@@ -333,12 +365,12 @@ const ae = (t, n) => {
|
|
|
333
365
|
}
|
|
334
366
|
},
|
|
335
367
|
setup(t) {
|
|
336
|
-
const n = t,
|
|
368
|
+
const n = t, a = q(() => {
|
|
337
369
|
if (n.name.startsWith("http://") || n.name.startsWith("https://") || n.name.startsWith("/"))
|
|
338
370
|
return n.name;
|
|
339
371
|
const e = n.name.endsWith(".svg") ? n.name : `${n.name}.svg`;
|
|
340
372
|
return `${n.basePath}${e}`;
|
|
341
|
-
}),
|
|
373
|
+
}), s = q(() => {
|
|
342
374
|
const e = typeof n.size == "number" ? `${n.size}px` : n.size;
|
|
343
375
|
return {
|
|
344
376
|
width: e,
|
|
@@ -354,19 +386,19 @@ const ae = (t, n) => {
|
|
|
354
386
|
};
|
|
355
387
|
return n.color && (e.filter = `drop-shadow(0 0 0 ${n.color})`), e;
|
|
356
388
|
});
|
|
357
|
-
return (e, i) => (P(),
|
|
389
|
+
return (e, i) => (P(), L("div", {
|
|
358
390
|
class: "svg-icon-wrapper",
|
|
359
|
-
style: K(
|
|
391
|
+
style: K(s.value)
|
|
360
392
|
}, [
|
|
361
|
-
|
|
362
|
-
src:
|
|
393
|
+
x("img", {
|
|
394
|
+
src: a.value,
|
|
363
395
|
alt: t.name,
|
|
364
|
-
class:
|
|
396
|
+
class: W(["svg-icon", t.className]),
|
|
365
397
|
style: K(r.value)
|
|
366
398
|
}, null, 14, Oe)
|
|
367
399
|
], 4));
|
|
368
400
|
}
|
|
369
|
-
},
|
|
401
|
+
}, V = /* @__PURE__ */ le(Le, [["__scopeId", "data-v-490b11c1"]]), ze = async (t) => {
|
|
370
402
|
if (navigator.clipboard && navigator.permissions)
|
|
371
403
|
await navigator.clipboard.writeText(t);
|
|
372
404
|
else {
|
|
@@ -390,145 +422,145 @@ const ae = (t, n) => {
|
|
|
390
422
|
"completed",
|
|
391
423
|
"updating"
|
|
392
424
|
],
|
|
393
|
-
setup(t, { expose: n, emit:
|
|
394
|
-
const { appContext:
|
|
395
|
-
let
|
|
396
|
-
const
|
|
397
|
-
e.reader && e.reader.cancel(),
|
|
398
|
-
},
|
|
399
|
-
|
|
425
|
+
setup(t, { expose: n, emit: a }) {
|
|
426
|
+
const { appContext: s } = re(), { $message: r } = s.config.globalProperties, e = t, i = C(e.displayText || ""), f = C(""), v = C(!0), b = C(!1), _ = C(!!e.displayText), $ = a, N = C(null);
|
|
427
|
+
let T = null;
|
|
428
|
+
const U = q(() => F ? F.render(i.value) : i.value), I = () => {
|
|
429
|
+
e.reader && e.reader.cancel(), b.value = !0, c.value = !1, d(), _.value = !0, $("completed", i.value), v.value = !1, T && (cancelAnimationFrame(T), T = null);
|
|
430
|
+
}, z = q(() => `${U.value}`), p = C(!1), u = () => {
|
|
431
|
+
p.value = !0;
|
|
400
432
|
}, d = () => {
|
|
401
|
-
|
|
402
|
-
},
|
|
433
|
+
p.value = !1;
|
|
434
|
+
}, c = C(!1), l = async () => {
|
|
403
435
|
if (!e.reader) return;
|
|
404
|
-
const
|
|
405
|
-
for (
|
|
436
|
+
const g = new TextDecoder("utf-8");
|
|
437
|
+
for (v.value = !0; !b.value; )
|
|
406
438
|
try {
|
|
407
439
|
if (!e.reader) {
|
|
408
|
-
|
|
440
|
+
c.value = !0;
|
|
409
441
|
break;
|
|
410
442
|
}
|
|
411
|
-
const { value:
|
|
443
|
+
const { value: o, done: y } = await e.reader.read();
|
|
412
444
|
if (!e.reader) {
|
|
413
|
-
|
|
445
|
+
c.value = !0;
|
|
414
446
|
break;
|
|
415
447
|
}
|
|
416
|
-
if (
|
|
417
|
-
|
|
448
|
+
if (y) {
|
|
449
|
+
c.value = !0;
|
|
418
450
|
break;
|
|
419
451
|
}
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
452
|
+
const S = ee[e.model];
|
|
453
|
+
if (!S)
|
|
422
454
|
break;
|
|
423
|
-
const
|
|
424
|
-
if (
|
|
425
|
-
|
|
455
|
+
const O = S.call(ee, o, g);
|
|
456
|
+
if (O.done) {
|
|
457
|
+
c.value = !0;
|
|
426
458
|
break;
|
|
427
459
|
}
|
|
428
|
-
|
|
429
|
-
} catch (
|
|
430
|
-
|
|
460
|
+
f.value += O.content, T === null && k();
|
|
461
|
+
} catch (o) {
|
|
462
|
+
c.value = !0, console.log(3333, o), $("failed", o), I();
|
|
431
463
|
break;
|
|
432
464
|
} finally {
|
|
433
465
|
d();
|
|
434
466
|
}
|
|
435
|
-
},
|
|
467
|
+
}, m = async () => {
|
|
436
468
|
e.scrollToBottomFn && e.scrollToBottomFn();
|
|
437
|
-
},
|
|
438
|
-
},
|
|
469
|
+
}, h = (g = () => {
|
|
470
|
+
}, o = () => {
|
|
439
471
|
}) => {
|
|
440
|
-
if (
|
|
441
|
-
const
|
|
442
|
-
i.value +=
|
|
472
|
+
if (f.value.length > 0) {
|
|
473
|
+
const y = f.value.substring(0, 10);
|
|
474
|
+
i.value += y, f.value = f.value.substring(10), g();
|
|
443
475
|
} else
|
|
444
|
-
|
|
445
|
-
},
|
|
446
|
-
if (
|
|
447
|
-
cancelAnimationFrame(
|
|
476
|
+
o();
|
|
477
|
+
}, k = () => {
|
|
478
|
+
if (b.value && T) {
|
|
479
|
+
cancelAnimationFrame(T), T = null, v.value = !1;
|
|
448
480
|
return;
|
|
449
481
|
}
|
|
450
|
-
|
|
482
|
+
c.value ? h(
|
|
451
483
|
() => {
|
|
452
|
-
|
|
484
|
+
T = requestAnimationFrame(k), $("updating", null);
|
|
453
485
|
},
|
|
454
486
|
() => {
|
|
455
|
-
|
|
456
|
-
if (
|
|
487
|
+
$("completed", i.value), v.value = !1, _.value = !0, ae(() => {
|
|
488
|
+
if (c.value = !1, e.messagePostRender && N.value)
|
|
457
489
|
try {
|
|
458
|
-
e.messagePostRender(
|
|
459
|
-
} catch (
|
|
460
|
-
console.error("messagePostRender 执行失败:",
|
|
490
|
+
e.messagePostRender(N.value, i.value);
|
|
491
|
+
} catch (g) {
|
|
492
|
+
console.error("messagePostRender 执行失败:", g);
|
|
461
493
|
}
|
|
462
|
-
}),
|
|
494
|
+
}), T = null;
|
|
463
495
|
}
|
|
464
|
-
) : (
|
|
496
|
+
) : (h(), T = requestAnimationFrame(k)), m();
|
|
465
497
|
};
|
|
466
|
-
|
|
498
|
+
ue(
|
|
467
499
|
() => e.reader,
|
|
468
500
|
() => {
|
|
469
|
-
e.reader &&
|
|
501
|
+
e.reader && l();
|
|
470
502
|
},
|
|
471
503
|
{
|
|
472
504
|
immediate: !0,
|
|
473
505
|
deep: !0
|
|
474
506
|
}
|
|
475
|
-
),
|
|
476
|
-
|
|
507
|
+
), de(() => {
|
|
508
|
+
I();
|
|
477
509
|
}), n({
|
|
478
|
-
abortReader:
|
|
510
|
+
abortReader: I,
|
|
479
511
|
initializeStart: u,
|
|
480
512
|
initializeEnd: d
|
|
481
|
-
}), q(() =>
|
|
482
|
-
const
|
|
513
|
+
}), q(() => p.value ? !0 : (!e.reader || !v || i.value, !1));
|
|
514
|
+
const w = async () => {
|
|
483
515
|
try {
|
|
484
|
-
const
|
|
485
|
-
await
|
|
486
|
-
} catch (
|
|
487
|
-
console.error("复制失败:",
|
|
516
|
+
const g = i.value;
|
|
517
|
+
await ze(g), r.success("复制成功");
|
|
518
|
+
} catch (g) {
|
|
519
|
+
console.error("复制失败:", g), r.error("复制失败");
|
|
488
520
|
}
|
|
489
521
|
};
|
|
490
|
-
return (
|
|
491
|
-
default:
|
|
492
|
-
|
|
522
|
+
return (g, o) => (P(), J(oe, { name: "fade" }, {
|
|
523
|
+
default: M(() => [
|
|
524
|
+
z.value ? (P(), L("div", {
|
|
493
525
|
key: 0,
|
|
494
526
|
ref_key: "refWrapperContent",
|
|
495
|
-
ref:
|
|
527
|
+
ref: N,
|
|
496
528
|
"text-16": "",
|
|
497
529
|
class: "w-full h-full overflow-y-auto relative",
|
|
498
530
|
"p-24px": ""
|
|
499
531
|
}, [
|
|
500
|
-
|
|
532
|
+
x("div", {
|
|
501
533
|
class: "markdown-wrapper",
|
|
502
|
-
innerHTML:
|
|
534
|
+
innerHTML: z.value
|
|
503
535
|
}, null, 8, je),
|
|
504
|
-
|
|
536
|
+
_.value ? (P(), L("div", {
|
|
505
537
|
key: 0,
|
|
506
538
|
class: "ai-copy-btn-wrapper",
|
|
507
|
-
onClick:
|
|
539
|
+
onClick: w
|
|
508
540
|
}, [
|
|
509
|
-
|
|
541
|
+
E(V, {
|
|
510
542
|
name: "/images/svg/copy.svg",
|
|
511
543
|
color: "#666666"
|
|
512
544
|
}),
|
|
513
|
-
|
|
514
|
-
])) :
|
|
515
|
-
], 512)) :
|
|
545
|
+
o[0] || (o[0] = x("span", { class: "copy-text" }, "复制", -1))
|
|
546
|
+
])) : B("", !0)
|
|
547
|
+
], 512)) : B("", !0)
|
|
516
548
|
]),
|
|
517
549
|
_: 1
|
|
518
550
|
}));
|
|
519
551
|
}
|
|
520
|
-
},
|
|
552
|
+
}, Ae = { class: "panel-header" }, Ee = { class: "header-actions" }, $e = { class: "header-title" }, Ue = { class: "action-icons" }, qe = { class: "body-content" }, Me = {
|
|
521
553
|
key: 0,
|
|
522
554
|
class: "welcome-content"
|
|
523
|
-
},
|
|
555
|
+
}, Fe = { class: "subtitle" }, Be = { class: "highlight" }, De = { class: "quick-questions" }, Ve = ["onClick"], We = {
|
|
524
556
|
key: 1,
|
|
525
557
|
class: "message-content user-content"
|
|
526
|
-
}, Je = { class: "panel-footer" },
|
|
558
|
+
}, Je = { class: "panel-footer" }, He = {
|
|
527
559
|
key: 0,
|
|
528
560
|
src: ge,
|
|
529
561
|
alt: "加载中",
|
|
530
562
|
class: "loading-icon"
|
|
531
|
-
},
|
|
563
|
+
}, Qe = { class: "input-box" }, Ke = ["src"], Xe = {
|
|
532
564
|
__name: "ChatPanel",
|
|
533
565
|
props: {
|
|
534
566
|
modelValue: {
|
|
@@ -551,6 +583,14 @@ const ae = (t, n) => {
|
|
|
551
583
|
type: String,
|
|
552
584
|
default: "数智AI助理"
|
|
553
585
|
},
|
|
586
|
+
/**
|
|
587
|
+
* 大模型名称,对应 LLMTypes 中的 modelName
|
|
588
|
+
* 例如: 'szjy' | 'spark' | 'dify-openai' | 'siliconflow' 等
|
|
589
|
+
*/
|
|
590
|
+
llmName: {
|
|
591
|
+
type: String,
|
|
592
|
+
default: "szjy"
|
|
593
|
+
},
|
|
554
594
|
messagePostRender: {
|
|
555
595
|
type: Function,
|
|
556
596
|
default: null
|
|
@@ -558,106 +598,106 @@ const ae = (t, n) => {
|
|
|
558
598
|
},
|
|
559
599
|
emits: ["update:modelValue", "submit"],
|
|
560
600
|
setup(t, { emit: n }) {
|
|
561
|
-
const { appContext:
|
|
601
|
+
const { appContext: a } = re(), { $message: s } = a.config.globalProperties, r = t, e = q(() => G.find((o) => o.modelName === r.llmName) ?? G.find((o) => o.modelName === "szjy")), i = n, f = C(""), v = C(null), b = C(!1), _ = C([]), $ = C([
|
|
562
602
|
"什么是AI助理,能做什么?",
|
|
563
603
|
"当前项目的基本情况?",
|
|
564
604
|
"当前项目的进度情况?",
|
|
565
605
|
"当前项目的参建方有哪些?",
|
|
566
606
|
"数智建管平台有哪些功能?能做什么?"
|
|
567
|
-
]),
|
|
568
|
-
|
|
569
|
-
if (
|
|
570
|
-
const
|
|
571
|
-
|
|
572
|
-
top:
|
|
607
|
+
]), N = C([]), T = C(!1), U = C(null), I = () => {
|
|
608
|
+
ae(() => {
|
|
609
|
+
if (U.value) {
|
|
610
|
+
const o = U.value, y = o.scrollHeight, S = o.scrollTop, O = o.clientHeight;
|
|
611
|
+
y - S - O < 100 ? o.scrollTop = y : o.scrollTo({
|
|
612
|
+
top: y
|
|
573
613
|
});
|
|
574
614
|
}
|
|
575
615
|
});
|
|
576
|
-
},
|
|
577
|
-
console.log("onFailedReader",
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
|
|
616
|
+
}, z = C(!1), p = q(() => z.value ? "/images/ai-stop.png" : "/images/ai-send.png"), u = (o, y) => {
|
|
617
|
+
console.log("onFailedReader", o, y), T.value = !1;
|
|
618
|
+
const S = w();
|
|
619
|
+
S && S.initializeEnd(), s.error("转换失败,请重试"), z.value = !1, setTimeout(() => {
|
|
620
|
+
v.value && v.value.focus();
|
|
581
621
|
});
|
|
582
|
-
},
|
|
583
|
-
|
|
584
|
-
|
|
622
|
+
}, d = (o, y) => {
|
|
623
|
+
T.value = !1, z.value = !1, I(), y && _.value[o] && (_.value[o].displayText = y), setTimeout(() => {
|
|
624
|
+
v.value && v.value.focus();
|
|
585
625
|
});
|
|
586
|
-
},
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
},
|
|
593
|
-
|
|
594
|
-
},
|
|
595
|
-
for (let
|
|
596
|
-
if (
|
|
597
|
-
return
|
|
626
|
+
}, c = (o) => {
|
|
627
|
+
z.value = !0;
|
|
628
|
+
}, l = () => {
|
|
629
|
+
z.value = !1, i("update:modelValue", !1), b.value = !1, _.value = [];
|
|
630
|
+
}, m = C(!1), h = () => {
|
|
631
|
+
m.value = !m.value;
|
|
632
|
+
}, k = (o) => {
|
|
633
|
+
f.value = o, g();
|
|
634
|
+
}, w = () => {
|
|
635
|
+
for (let o = N.value.length - 1; o >= 0; o--)
|
|
636
|
+
if (N.value[o])
|
|
637
|
+
return N.value[o];
|
|
598
638
|
return null;
|
|
599
|
-
},
|
|
600
|
-
if (console.log("stylizingLoading:",
|
|
601
|
-
const R =
|
|
639
|
+
}, g = async () => {
|
|
640
|
+
if (console.log("stylizingLoading:", T.value), T.value) {
|
|
641
|
+
const R = w();
|
|
602
642
|
console.log("lastPreviewer:", R), R && (console.log("abortReader"), R.abortReader());
|
|
603
643
|
return;
|
|
604
644
|
}
|
|
605
|
-
if (!
|
|
606
|
-
console.log("no input, return"),
|
|
645
|
+
if (!f.value.trim()) {
|
|
646
|
+
console.log("no input, return"), v.value.focus();
|
|
607
647
|
return;
|
|
608
648
|
}
|
|
609
|
-
|
|
649
|
+
_.value.push({
|
|
610
650
|
type: "user",
|
|
611
|
-
content:
|
|
612
|
-
}),
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
const
|
|
616
|
-
|
|
651
|
+
content: f.value
|
|
652
|
+
}), z.value = !0, b.value = !0, i("submit", f.value), I();
|
|
653
|
+
const o = f.value;
|
|
654
|
+
f.value = "";
|
|
655
|
+
const y = _.value.length;
|
|
656
|
+
N.value[y] && N.value[y].initializeStart(), T.value = !0, _.value.push({
|
|
617
657
|
type: "ai"
|
|
618
658
|
});
|
|
619
|
-
const { error:
|
|
620
|
-
text:
|
|
621
|
-
token:
|
|
622
|
-
identifier:
|
|
623
|
-
baseUrl:
|
|
659
|
+
const { error: S, reader: O } = await Pe(e.value, {
|
|
660
|
+
text: o,
|
|
661
|
+
token: r.token,
|
|
662
|
+
identifier: r.identifier,
|
|
663
|
+
baseUrl: r.baseUrl
|
|
624
664
|
});
|
|
625
|
-
if (
|
|
626
|
-
console.log(45455,
|
|
665
|
+
if (S) {
|
|
666
|
+
console.log(45455, S), u(y, S);
|
|
627
667
|
return;
|
|
628
668
|
}
|
|
629
|
-
|
|
669
|
+
O && (_.value[y].reader = O);
|
|
630
670
|
};
|
|
631
|
-
return (
|
|
632
|
-
const
|
|
633
|
-
return P(), J(
|
|
634
|
-
default:
|
|
635
|
-
t.modelValue ? (P(),
|
|
671
|
+
return (o, y) => {
|
|
672
|
+
const S = X("el-icon"), O = X("el-input");
|
|
673
|
+
return P(), J(oe, { name: "slide" }, {
|
|
674
|
+
default: M(() => [
|
|
675
|
+
t.modelValue ? (P(), L("div", {
|
|
636
676
|
key: 0,
|
|
637
|
-
class:
|
|
677
|
+
class: W(["ai-panel", { "drawer-mode": m.value }])
|
|
638
678
|
}, [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
679
|
+
x("div", Ae, [
|
|
680
|
+
x("div", Ee, [
|
|
681
|
+
x("div", $e, D(t.title), 1),
|
|
682
|
+
x("div", Ue, [
|
|
683
|
+
E(S, {
|
|
644
684
|
class: "action-icon",
|
|
645
|
-
onClick:
|
|
685
|
+
onClick: h
|
|
646
686
|
}, {
|
|
647
|
-
default:
|
|
648
|
-
|
|
687
|
+
default: M(() => [
|
|
688
|
+
E(V, {
|
|
649
689
|
name: "/images/svg/drawer-layout.svg",
|
|
650
690
|
color: "#999999"
|
|
651
691
|
})
|
|
652
692
|
]),
|
|
653
693
|
_: 1
|
|
654
694
|
}),
|
|
655
|
-
|
|
695
|
+
E(S, {
|
|
656
696
|
class: "action-icon",
|
|
657
|
-
onClick:
|
|
697
|
+
onClick: l
|
|
658
698
|
}, {
|
|
659
|
-
default:
|
|
660
|
-
|
|
699
|
+
default: M(() => [
|
|
700
|
+
E(V, {
|
|
661
701
|
name: "/images/svg/close.svg",
|
|
662
702
|
color: "#999999"
|
|
663
703
|
})
|
|
@@ -667,123 +707,123 @@ const ae = (t, n) => {
|
|
|
667
707
|
])
|
|
668
708
|
])
|
|
669
709
|
]),
|
|
670
|
-
|
|
671
|
-
|
|
710
|
+
x("div", qe, [
|
|
711
|
+
b.value ? (P(), L("div", {
|
|
672
712
|
key: 1,
|
|
673
713
|
class: "chat-messages",
|
|
674
714
|
ref_key: "messageContainerRef",
|
|
675
|
-
ref:
|
|
715
|
+
ref: U
|
|
676
716
|
}, [
|
|
677
|
-
(P(!0),
|
|
678
|
-
key:
|
|
679
|
-
class:
|
|
717
|
+
(P(!0), L(Y, null, Z(_.value, (R, A) => (P(), L("div", {
|
|
718
|
+
key: A,
|
|
719
|
+
class: W(["message-item", R.type === "user" ? "user-message" : "ai-message"])
|
|
680
720
|
}, [
|
|
681
721
|
R.type === "ai" ? (P(), J(Ie, {
|
|
682
722
|
key: 0,
|
|
683
723
|
ref_for: !0,
|
|
684
|
-
ref: (
|
|
724
|
+
ref: (j) => N.value[A] = j,
|
|
685
725
|
reader: R.reader,
|
|
686
|
-
"onUpdate:reader": (
|
|
687
|
-
model:
|
|
726
|
+
"onUpdate:reader": (j) => R.reader = j,
|
|
727
|
+
model: r.llmName,
|
|
688
728
|
displayText: R.displayText,
|
|
689
|
-
scrollToBottomFn:
|
|
729
|
+
scrollToBottomFn: I,
|
|
690
730
|
messagePostRender: t.messagePostRender,
|
|
691
|
-
onFailed: (
|
|
692
|
-
onCompleted: (
|
|
693
|
-
onUpdating: () =>
|
|
694
|
-
}, null, 8, ["reader", "onUpdate:reader", "model", "displayText", "messagePostRender", "onFailed", "onCompleted", "onUpdating"])) : (P(),
|
|
731
|
+
onFailed: (j) => u(A, j),
|
|
732
|
+
onCompleted: (j) => d(A, j),
|
|
733
|
+
onUpdating: () => c()
|
|
734
|
+
}, null, 8, ["reader", "onUpdate:reader", "model", "displayText", "messagePostRender", "onFailed", "onCompleted", "onUpdating"])) : (P(), L("div", We, D(R.content), 1))
|
|
695
735
|
], 2))), 128))
|
|
696
|
-
], 512)) : (P(),
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
src:
|
|
736
|
+
], 512)) : (P(), L("div", Me, [
|
|
737
|
+
y[2] || (y[2] = x("div", { class: "title" }, [
|
|
738
|
+
x("img", {
|
|
739
|
+
src: ye,
|
|
700
740
|
alt: "AI助手",
|
|
701
741
|
class: "panel-icon"
|
|
702
742
|
}),
|
|
703
|
-
|
|
743
|
+
x("h3", { class: "title-text" }, "Hi, 您好")
|
|
704
744
|
], -1)),
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
745
|
+
x("div", Fe, [
|
|
746
|
+
y[1] || (y[1] = fe(" 我是", -1)),
|
|
747
|
+
x("span", Be, D(t.title), 1)
|
|
708
748
|
]),
|
|
709
|
-
|
|
710
|
-
(P(!0),
|
|
711
|
-
key:
|
|
749
|
+
x("div", De, [
|
|
750
|
+
(P(!0), L(Y, null, Z($.value, (R, A) => (P(), L("div", {
|
|
751
|
+
key: A,
|
|
712
752
|
class: "question-item",
|
|
713
|
-
onClick: (
|
|
753
|
+
onClick: (j) => k(R)
|
|
714
754
|
}, [
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
default:
|
|
718
|
-
|
|
755
|
+
x("span", null, D(R), 1),
|
|
756
|
+
E(S, null, {
|
|
757
|
+
default: M(() => [
|
|
758
|
+
E(V, {
|
|
719
759
|
name: "/images/svg/arrow-right.svg",
|
|
720
760
|
color: "#999999"
|
|
721
761
|
})
|
|
722
762
|
]),
|
|
723
763
|
_: 1
|
|
724
764
|
})
|
|
725
|
-
], 8,
|
|
765
|
+
], 8, Ve))), 128))
|
|
726
766
|
])
|
|
727
767
|
]))
|
|
728
768
|
]),
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
modelValue:
|
|
734
|
-
"onUpdate:modelValue":
|
|
769
|
+
x("div", Je, [
|
|
770
|
+
z.value ? (P(), L("img", He)) : B("", !0),
|
|
771
|
+
x("div", Qe, [
|
|
772
|
+
E(O, {
|
|
773
|
+
modelValue: f.value,
|
|
774
|
+
"onUpdate:modelValue": y[0] || (y[0] = (R) => f.value = R),
|
|
735
775
|
ref_key: "refInputTextString",
|
|
736
|
-
ref:
|
|
776
|
+
ref: v,
|
|
737
777
|
placeholder: "请输入您的问题",
|
|
738
778
|
autofocus: "",
|
|
739
|
-
onKeyup:
|
|
779
|
+
onKeyup: pe(g, ["enter"])
|
|
740
780
|
}, {
|
|
741
|
-
append:
|
|
742
|
-
|
|
781
|
+
append: M(() => [
|
|
782
|
+
x("div", {
|
|
743
783
|
class: "send-icon-box",
|
|
744
|
-
onClick:
|
|
784
|
+
onClick: g
|
|
745
785
|
}, [
|
|
746
|
-
|
|
747
|
-
src:
|
|
786
|
+
x("img", {
|
|
787
|
+
src: p.value,
|
|
748
788
|
alt: "发送",
|
|
749
789
|
class: "send-icon"
|
|
750
|
-
}, null, 8,
|
|
790
|
+
}, null, 8, Ke)
|
|
751
791
|
])
|
|
752
792
|
]),
|
|
753
793
|
_: 1
|
|
754
794
|
}, 8, ["modelValue"])
|
|
755
795
|
])
|
|
756
796
|
])
|
|
757
|
-
], 2)) :
|
|
797
|
+
], 2)) : B("", !0)
|
|
758
798
|
]),
|
|
759
799
|
_: 1
|
|
760
800
|
});
|
|
761
801
|
};
|
|
762
802
|
}
|
|
763
803
|
};
|
|
764
|
-
var
|
|
804
|
+
var ie = { exports: {} };
|
|
765
805
|
(function(t, n) {
|
|
766
|
-
(function(
|
|
767
|
-
t.exports =
|
|
806
|
+
(function(a, s) {
|
|
807
|
+
t.exports = s();
|
|
768
808
|
})(window, function() {
|
|
769
|
-
return function(
|
|
770
|
-
var
|
|
809
|
+
return function(a) {
|
|
810
|
+
var s = {};
|
|
771
811
|
function r(e) {
|
|
772
|
-
if (
|
|
773
|
-
var i =
|
|
774
|
-
return
|
|
812
|
+
if (s[e]) return s[e].exports;
|
|
813
|
+
var i = s[e] = { i: e, l: !1, exports: {} };
|
|
814
|
+
return a[e].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
|
|
775
815
|
}
|
|
776
|
-
return r.m =
|
|
777
|
-
r.o(e, i) || Object.defineProperty(e, i, { enumerable: !0, get:
|
|
816
|
+
return r.m = a, r.c = s, r.d = function(e, i, f) {
|
|
817
|
+
r.o(e, i) || Object.defineProperty(e, i, { enumerable: !0, get: f });
|
|
778
818
|
}, r.r = function(e) {
|
|
779
819
|
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
|
|
780
820
|
}, r.t = function(e, i) {
|
|
781
821
|
if (1 & i && (e = r(e)), 8 & i || 4 & i && typeof e == "object" && e && e.__esModule) return e;
|
|
782
|
-
var
|
|
783
|
-
if (r.r(
|
|
784
|
-
return e[
|
|
785
|
-
}).bind(null,
|
|
786
|
-
return
|
|
822
|
+
var f = /* @__PURE__ */ Object.create(null);
|
|
823
|
+
if (r.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: e }), 2 & i && typeof e != "string") for (var v in e) r.d(f, v, (function(b) {
|
|
824
|
+
return e[b];
|
|
825
|
+
}).bind(null, v));
|
|
826
|
+
return f;
|
|
787
827
|
}, r.n = function(e) {
|
|
788
828
|
var i = e && e.__esModule ? function() {
|
|
789
829
|
return e.default;
|
|
@@ -794,241 +834,241 @@ var se = { exports: {} };
|
|
|
794
834
|
}, r.o = function(e, i) {
|
|
795
835
|
return Object.prototype.hasOwnProperty.call(e, i);
|
|
796
836
|
}, r.p = "", r(r.s = 0);
|
|
797
|
-
}([function(
|
|
798
|
-
function e(
|
|
799
|
-
d.push(
|
|
837
|
+
}([function(a, s, r) {
|
|
838
|
+
function e(p, u, d, c) {
|
|
839
|
+
d.push(p), c.push([].concat(u[p] || []));
|
|
800
840
|
}
|
|
801
|
-
function i(
|
|
802
|
-
if (!
|
|
803
|
-
var d = [],
|
|
804
|
-
for (e(
|
|
805
|
-
var
|
|
806
|
-
if (
|
|
807
|
-
var
|
|
808
|
-
if (
|
|
809
|
-
e(
|
|
810
|
-
} else d.push([].concat(
|
|
841
|
+
function i(p, u) {
|
|
842
|
+
if (!p) throw new Error("[getMaxDepsChain] dep 参数不能为空");
|
|
843
|
+
var d = [], c = [], l = [];
|
|
844
|
+
for (e(p, u, c, l); c.length; ) {
|
|
845
|
+
var m = l.pop();
|
|
846
|
+
if (m && m.length) {
|
|
847
|
+
var h = m.shift();
|
|
848
|
+
if (l.push(m), ~c.indexOf(h)) throw new Error("[getMaxDepsChain][loop] 存在循环依赖,请检查依赖关系; nextName: " + h + ", mainStack: " + c);
|
|
849
|
+
e(h, u, c, l);
|
|
850
|
+
} else d.push([].concat(c)), c.pop();
|
|
811
851
|
}
|
|
812
|
-
return d.reduce(function(
|
|
813
|
-
return
|
|
852
|
+
return d.reduce(function(k, w) {
|
|
853
|
+
return w.length > k.length ? w : k;
|
|
814
854
|
}, []);
|
|
815
855
|
}
|
|
816
|
-
function
|
|
817
|
-
if (!
|
|
856
|
+
function f(p) {
|
|
857
|
+
if (!p) throw new Error("[depsParser] 入参不能为空");
|
|
818
858
|
var u = {};
|
|
819
|
-
|
|
820
|
-
u[
|
|
859
|
+
p.forEach(function(c) {
|
|
860
|
+
u[c.name] = c.deps || [];
|
|
821
861
|
});
|
|
822
862
|
var d = [];
|
|
823
|
-
return
|
|
824
|
-
var
|
|
825
|
-
|
|
863
|
+
return p.forEach(function(c) {
|
|
864
|
+
var l = i(c.name, u).length - 1;
|
|
865
|
+
c.priority = l, d[l] = (d[l] || []).concat(c);
|
|
826
866
|
}), d;
|
|
827
867
|
}
|
|
828
|
-
r.r(
|
|
829
|
-
return
|
|
830
|
-
}), r.d(
|
|
831
|
-
return
|
|
832
|
-
}), r.d(
|
|
833
|
-
return
|
|
834
|
-
}), r.d(
|
|
835
|
-
return
|
|
836
|
-
}), r.d(
|
|
837
|
-
return
|
|
838
|
-
}), r.d(
|
|
868
|
+
r.r(s), r.d(s, "loadScript", function() {
|
|
869
|
+
return N;
|
|
870
|
+
}), r.d(s, "loadScripts", function() {
|
|
871
|
+
return T;
|
|
872
|
+
}), r.d(s, "dynamicLoadScripts", function() {
|
|
873
|
+
return U;
|
|
874
|
+
}), r.d(s, "createScriptsLoadIterator", function() {
|
|
875
|
+
return I;
|
|
876
|
+
}), r.d(s, "loadScriptsQueue", function() {
|
|
877
|
+
return z;
|
|
878
|
+
}), r.d(s, "getMaxDepsChain", function() {
|
|
839
879
|
return i;
|
|
840
|
-
}), r.d(
|
|
841
|
-
return
|
|
880
|
+
}), r.d(s, "depsParser", function() {
|
|
881
|
+
return f;
|
|
842
882
|
});
|
|
843
|
-
var
|
|
844
|
-
return (
|
|
845
|
-
for (var u, d = 1,
|
|
846
|
-
return
|
|
883
|
+
var v = function() {
|
|
884
|
+
return (v = Object.assign || function(p) {
|
|
885
|
+
for (var u, d = 1, c = arguments.length; d < c; d++) for (var l in u = arguments[d]) Object.prototype.hasOwnProperty.call(u, l) && (p[l] = u[l]);
|
|
886
|
+
return p;
|
|
847
887
|
}).apply(this, arguments);
|
|
848
|
-
},
|
|
849
|
-
return new (d || (d = Promise))(function(
|
|
850
|
-
function
|
|
888
|
+
}, b = function(p, u, d, c) {
|
|
889
|
+
return new (d || (d = Promise))(function(l, m) {
|
|
890
|
+
function h(g) {
|
|
851
891
|
try {
|
|
852
|
-
|
|
853
|
-
} catch (
|
|
854
|
-
|
|
892
|
+
w(c.next(g));
|
|
893
|
+
} catch (o) {
|
|
894
|
+
m(o);
|
|
855
895
|
}
|
|
856
896
|
}
|
|
857
|
-
function
|
|
897
|
+
function k(g) {
|
|
858
898
|
try {
|
|
859
|
-
|
|
860
|
-
} catch (
|
|
861
|
-
|
|
899
|
+
w(c.throw(g));
|
|
900
|
+
} catch (o) {
|
|
901
|
+
m(o);
|
|
862
902
|
}
|
|
863
903
|
}
|
|
864
|
-
function
|
|
865
|
-
var
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
})).then(
|
|
904
|
+
function w(g) {
|
|
905
|
+
var o;
|
|
906
|
+
g.done ? l(g.value) : (o = g.value, o instanceof d ? o : new d(function(y) {
|
|
907
|
+
y(o);
|
|
908
|
+
})).then(h, k);
|
|
869
909
|
}
|
|
870
|
-
|
|
910
|
+
w((c = c.apply(p, [])).next());
|
|
871
911
|
});
|
|
872
|
-
},
|
|
873
|
-
var d,
|
|
874
|
-
if (1 &
|
|
875
|
-
return
|
|
912
|
+
}, _ = function(p, u) {
|
|
913
|
+
var d, c, l, m, h = { label: 0, sent: function() {
|
|
914
|
+
if (1 & l[0]) throw l[1];
|
|
915
|
+
return l[1];
|
|
876
916
|
}, trys: [], ops: [] };
|
|
877
|
-
return
|
|
917
|
+
return m = { next: k(0), throw: k(1), return: k(2) }, typeof Symbol == "function" && (m[Symbol.iterator] = function() {
|
|
878
918
|
return this;
|
|
879
|
-
}),
|
|
880
|
-
function
|
|
881
|
-
return function(
|
|
882
|
-
return function(
|
|
919
|
+
}), m;
|
|
920
|
+
function k(w) {
|
|
921
|
+
return function(g) {
|
|
922
|
+
return function(o) {
|
|
883
923
|
if (d) throw new TypeError("Generator is already executing.");
|
|
884
|
-
for (;
|
|
885
|
-
if (d = 1,
|
|
886
|
-
switch (
|
|
924
|
+
for (; h; ) try {
|
|
925
|
+
if (d = 1, c && (l = 2 & o[0] ? c.return : o[0] ? c.throw || ((l = c.return) && l.call(c), 0) : c.next) && !(l = l.call(c, o[1])).done) return l;
|
|
926
|
+
switch (c = 0, l && (o = [2 & o[0], l.value]), o[0]) {
|
|
887
927
|
case 0:
|
|
888
928
|
case 1:
|
|
889
|
-
|
|
929
|
+
l = o;
|
|
890
930
|
break;
|
|
891
931
|
case 4:
|
|
892
|
-
return
|
|
932
|
+
return h.label++, { value: o[1], done: !1 };
|
|
893
933
|
case 5:
|
|
894
|
-
|
|
934
|
+
h.label++, c = o[1], o = [0];
|
|
895
935
|
continue;
|
|
896
936
|
case 7:
|
|
897
|
-
|
|
937
|
+
o = h.ops.pop(), h.trys.pop();
|
|
898
938
|
continue;
|
|
899
939
|
default:
|
|
900
|
-
if (
|
|
901
|
-
|
|
940
|
+
if (l = h.trys, !((l = l.length > 0 && l[l.length - 1]) || o[0] !== 6 && o[0] !== 2)) {
|
|
941
|
+
h = 0;
|
|
902
942
|
continue;
|
|
903
943
|
}
|
|
904
|
-
if (
|
|
905
|
-
|
|
944
|
+
if (o[0] === 3 && (!l || o[1] > l[0] && o[1] < l[3])) {
|
|
945
|
+
h.label = o[1];
|
|
906
946
|
break;
|
|
907
947
|
}
|
|
908
|
-
if (
|
|
909
|
-
|
|
948
|
+
if (o[0] === 6 && h.label < l[1]) {
|
|
949
|
+
h.label = l[1], l = o;
|
|
910
950
|
break;
|
|
911
951
|
}
|
|
912
|
-
if (
|
|
913
|
-
|
|
952
|
+
if (l && h.label < l[2]) {
|
|
953
|
+
h.label = l[2], h.ops.push(o);
|
|
914
954
|
break;
|
|
915
955
|
}
|
|
916
|
-
|
|
956
|
+
l[2] && h.ops.pop(), h.trys.pop();
|
|
917
957
|
continue;
|
|
918
958
|
}
|
|
919
|
-
|
|
920
|
-
} catch (
|
|
921
|
-
|
|
959
|
+
o = u.call(p, h);
|
|
960
|
+
} catch (y) {
|
|
961
|
+
o = [6, y], c = 0;
|
|
922
962
|
} finally {
|
|
923
|
-
d =
|
|
963
|
+
d = l = 0;
|
|
924
964
|
}
|
|
925
|
-
if (5 &
|
|
926
|
-
return { value:
|
|
927
|
-
}([
|
|
965
|
+
if (5 & o[0]) throw o[1];
|
|
966
|
+
return { value: o[0] ? o[1] : void 0, done: !0 };
|
|
967
|
+
}([w, g]);
|
|
928
968
|
};
|
|
929
969
|
}
|
|
930
|
-
},
|
|
970
|
+
}, $ = function(p) {
|
|
931
971
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
932
|
-
var u, d =
|
|
933
|
-
return d ? d.call(
|
|
972
|
+
var u, d = p[Symbol.asyncIterator];
|
|
973
|
+
return d ? d.call(p) : (p = typeof __values == "function" ? __values(p) : p[Symbol.iterator](), u = {}, c("next"), c("throw"), c("return"), u[Symbol.asyncIterator] = function() {
|
|
934
974
|
return this;
|
|
935
975
|
}, u);
|
|
936
|
-
function l
|
|
937
|
-
u[
|
|
938
|
-
return new Promise(function(
|
|
939
|
-
(function(
|
|
940
|
-
Promise.resolve(
|
|
941
|
-
|
|
942
|
-
},
|
|
943
|
-
})(
|
|
976
|
+
function c(l) {
|
|
977
|
+
u[l] = p[l] && function(m) {
|
|
978
|
+
return new Promise(function(h, k) {
|
|
979
|
+
(function(w, g, o, y) {
|
|
980
|
+
Promise.resolve(y).then(function(S) {
|
|
981
|
+
w({ value: S, done: o });
|
|
982
|
+
}, g);
|
|
983
|
+
})(h, k, (m = p[l](m)).done, m.value);
|
|
944
984
|
});
|
|
945
985
|
};
|
|
946
986
|
}
|
|
947
987
|
};
|
|
948
|
-
function
|
|
949
|
-
return u === void 0 && (u = !1), new Promise(function(d,
|
|
950
|
-
var
|
|
951
|
-
|
|
988
|
+
function N(p, u) {
|
|
989
|
+
return u === void 0 && (u = !1), new Promise(function(d, c) {
|
|
990
|
+
var l = u ? document.head : document.body, m = document.createElement("script");
|
|
991
|
+
m.type = "text/javascript", m.src = p, m.crossOrigin = "anonymous", m.onreadystatechange = d, m.onload = d, m.onerror = c, l.appendChild(m);
|
|
952
992
|
});
|
|
953
993
|
}
|
|
954
|
-
var
|
|
955
|
-
return u === void 0 && (u = {}),
|
|
956
|
-
var d,
|
|
957
|
-
return
|
|
958
|
-
switch (
|
|
994
|
+
var T = function(p, u) {
|
|
995
|
+
return u === void 0 && (u = {}), b(void 0, void 0, void 0, function() {
|
|
996
|
+
var d, c, l, m, h;
|
|
997
|
+
return _(this, function(k) {
|
|
998
|
+
switch (k.label) {
|
|
959
999
|
case 0:
|
|
960
|
-
return d = u.baseUrl,
|
|
961
|
-
return
|
|
962
|
-
var
|
|
963
|
-
return
|
|
964
|
-
switch (
|
|
1000
|
+
return d = u.baseUrl, c = d === void 0 ? "" : d, l = u.lastLoadResult, m = u.inHead, h = m !== void 0 && m, [4, Promise.all(p.map(function(w) {
|
|
1001
|
+
return b(void 0, void 0, void 0, function() {
|
|
1002
|
+
var g, o, y, S, O, R, A, j;
|
|
1003
|
+
return _(this, function(Q) {
|
|
1004
|
+
switch (Q.label) {
|
|
965
1005
|
case 0:
|
|
966
|
-
return
|
|
1006
|
+
return g = w.name, o = w.path, y = w.deps, (A = {})[g] = !0, S = A, (j = {})[g] = !1, O = j, window[g] ? [2, S] : [3, 1];
|
|
967
1007
|
case 1:
|
|
968
|
-
return
|
|
969
|
-
|
|
970
|
-
}),
|
|
971
|
-
return
|
|
1008
|
+
return R = !0, y && l && [].concat(y).forEach(function(ce) {
|
|
1009
|
+
l[ce] !== !1 && (R = !0);
|
|
1010
|
+
}), R ? [4, N(o.indexOf("http") === 0 || o.indexOf("//:") === 0 ? o : c + o, h).then(function() {
|
|
1011
|
+
return S;
|
|
972
1012
|
}).catch(function() {
|
|
973
|
-
return
|
|
1013
|
+
return O;
|
|
974
1014
|
})] : [3, 3];
|
|
975
1015
|
case 2:
|
|
976
|
-
return [2,
|
|
1016
|
+
return [2, Q.sent()];
|
|
977
1017
|
case 3:
|
|
978
|
-
return [2,
|
|
1018
|
+
return [2, O];
|
|
979
1019
|
}
|
|
980
1020
|
});
|
|
981
1021
|
});
|
|
982
1022
|
}))];
|
|
983
1023
|
case 1:
|
|
984
|
-
return [2,
|
|
1024
|
+
return [2, k.sent()];
|
|
985
1025
|
}
|
|
986
1026
|
});
|
|
987
1027
|
});
|
|
988
|
-
},
|
|
1028
|
+
}, U = function(p, u) {
|
|
989
1029
|
return u === void 0 && (u = {}), function() {
|
|
990
|
-
var d = [].concat(
|
|
1030
|
+
var d = [].concat(f(p));
|
|
991
1031
|
return { next: function() {
|
|
992
1032
|
if (d.length) {
|
|
993
|
-
var
|
|
994
|
-
return
|
|
995
|
-
return { value:
|
|
1033
|
+
var c = d.shift();
|
|
1034
|
+
return T(c, u).then(function(l) {
|
|
1035
|
+
return { value: l, done: !1 };
|
|
996
1036
|
});
|
|
997
1037
|
}
|
|
998
1038
|
return Promise.resolve({ done: !0 });
|
|
999
1039
|
} };
|
|
1000
1040
|
};
|
|
1001
|
-
},
|
|
1041
|
+
}, I = function(p, u) {
|
|
1002
1042
|
var d;
|
|
1003
|
-
return u === void 0 && (u = {}), (d = {})[Symbol.asyncIterator] =
|
|
1004
|
-
},
|
|
1005
|
-
return u === void 0 && (u = {}),
|
|
1006
|
-
var d,
|
|
1007
|
-
return
|
|
1008
|
-
switch (
|
|
1043
|
+
return u === void 0 && (u = {}), (d = {})[Symbol.asyncIterator] = U(p, u), d;
|
|
1044
|
+
}, z = function(p, u) {
|
|
1045
|
+
return u === void 0 && (u = {}), b(void 0, void 0, void 0, function() {
|
|
1046
|
+
var d, c, l, m, h, k;
|
|
1047
|
+
return _(this, function(w) {
|
|
1048
|
+
switch (w.label) {
|
|
1009
1049
|
case 0:
|
|
1010
|
-
|
|
1050
|
+
w.trys.push([0, 5, 6, 11]), d = $(I(p, u)), w.label = 1;
|
|
1011
1051
|
case 1:
|
|
1012
1052
|
return [4, d.next()];
|
|
1013
1053
|
case 2:
|
|
1014
|
-
if ((
|
|
1015
|
-
|
|
1016
|
-
u.lastLoadResult =
|
|
1017
|
-
}),
|
|
1054
|
+
if ((c = w.sent()).done) return [3, 4];
|
|
1055
|
+
l = c.value, u.lastLoadResult = u.lastLoadResult || {}, console.log("current load: ", l), l.forEach(function(g) {
|
|
1056
|
+
u.lastLoadResult = v(v({}, u.lastLoadResult), g);
|
|
1057
|
+
}), w.label = 3;
|
|
1018
1058
|
case 3:
|
|
1019
1059
|
return [3, 1];
|
|
1020
1060
|
case 4:
|
|
1021
1061
|
return [3, 11];
|
|
1022
1062
|
case 5:
|
|
1023
|
-
return
|
|
1063
|
+
return m = w.sent(), h = { error: m }, [3, 11];
|
|
1024
1064
|
case 6:
|
|
1025
|
-
return
|
|
1065
|
+
return w.trys.push([6, , 9, 10]), c && !c.done && (k = d.return) ? [4, k.call(d)] : [3, 8];
|
|
1026
1066
|
case 7:
|
|
1027
|
-
|
|
1067
|
+
w.sent(), w.label = 8;
|
|
1028
1068
|
case 8:
|
|
1029
1069
|
return [3, 10];
|
|
1030
1070
|
case 9:
|
|
1031
|
-
if (
|
|
1071
|
+
if (h) throw h.error;
|
|
1032
1072
|
return [7];
|
|
1033
1073
|
case 10:
|
|
1034
1074
|
return [7];
|
|
@@ -1040,16 +1080,16 @@ var se = { exports: {} };
|
|
|
1040
1080
|
};
|
|
1041
1081
|
}]);
|
|
1042
1082
|
});
|
|
1043
|
-
})(
|
|
1044
|
-
var Ye =
|
|
1083
|
+
})(ie);
|
|
1084
|
+
var Ye = ie.exports;
|
|
1045
1085
|
const Ze = {
|
|
1046
1086
|
key: 0,
|
|
1047
1087
|
class: "ai-assistant"
|
|
1048
|
-
},
|
|
1088
|
+
}, Ge = {
|
|
1049
1089
|
name: "AiChat"
|
|
1050
1090
|
//这个⾮常重要,就是未来你放到其他项⽬中,组件标签的名字,⽐如:<sz-workflow></sz-workflow>
|
|
1051
|
-
},
|
|
1052
|
-
...
|
|
1091
|
+
}, et = /* @__PURE__ */ me({
|
|
1092
|
+
...Ge,
|
|
1053
1093
|
props: {
|
|
1054
1094
|
token: {
|
|
1055
1095
|
type: String,
|
|
@@ -1067,6 +1107,15 @@ const Ze = {
|
|
|
1067
1107
|
type: String,
|
|
1068
1108
|
default: "数智AI助理"
|
|
1069
1109
|
},
|
|
1110
|
+
/**
|
|
1111
|
+
* 大模型名称,对应 LLMTypes 中的 modelName
|
|
1112
|
+
* 例如: 'szjy' | 'spark' | 'dify-openai' | 'siliconflow' 等
|
|
1113
|
+
* 默认使用 'szjy'
|
|
1114
|
+
*/
|
|
1115
|
+
llmName: {
|
|
1116
|
+
type: String,
|
|
1117
|
+
default: "szjy"
|
|
1118
|
+
},
|
|
1070
1119
|
/**
|
|
1071
1120
|
* 消息后处理回调函数
|
|
1072
1121
|
* 在 AI 消息渲染完成后调用,可用于自定义处理渲染后的内容
|
|
@@ -1079,12 +1128,12 @@ const Ze = {
|
|
|
1079
1128
|
}
|
|
1080
1129
|
},
|
|
1081
1130
|
setup(t) {
|
|
1082
|
-
const n = C(!1),
|
|
1131
|
+
const n = C(!1), a = C(!1), s = () => {
|
|
1083
1132
|
n.value = !n.value;
|
|
1084
1133
|
}, r = () => {
|
|
1085
|
-
|
|
1086
|
-
}, e = (
|
|
1087
|
-
console.log("用户输入:",
|
|
1134
|
+
a.value = !0, n.value = !1;
|
|
1135
|
+
}, e = (v) => {
|
|
1136
|
+
console.log("用户输入:", v);
|
|
1088
1137
|
}, i = [
|
|
1089
1138
|
{
|
|
1090
1139
|
name: "markdownit",
|
|
@@ -1095,159 +1144,160 @@ const Ze = {
|
|
|
1095
1144
|
path: "highlight.11.11.1.min.js"
|
|
1096
1145
|
}
|
|
1097
1146
|
];
|
|
1098
|
-
let
|
|
1147
|
+
let f = {};
|
|
1099
1148
|
return Ye.loadScriptsQueue(i, {
|
|
1100
1149
|
baseUrl: "/scripts/ai/",
|
|
1101
|
-
lastLoadResult:
|
|
1150
|
+
lastLoadResult: f,
|
|
1102
1151
|
inHead: !1
|
|
1103
|
-
}).then((
|
|
1104
|
-
if (console.log("load ai deps: ",
|
|
1105
|
-
const
|
|
1106
|
-
console.log("markdownit: ",
|
|
1152
|
+
}).then((v) => {
|
|
1153
|
+
if (console.log("load ai deps: ", v), window.markdownit) {
|
|
1154
|
+
const b = window.markdownit();
|
|
1155
|
+
console.log("markdownit: ", b), Ne();
|
|
1107
1156
|
}
|
|
1108
|
-
}), (
|
|
1109
|
-
|
|
1157
|
+
}), (v, b) => a.value ? B("", !0) : (P(), L("div", Ze, [
|
|
1158
|
+
E(Xe, {
|
|
1110
1159
|
modelValue: n.value,
|
|
1111
|
-
"onUpdate:modelValue":
|
|
1160
|
+
"onUpdate:modelValue": b[0] || (b[0] = (_) => n.value = _),
|
|
1112
1161
|
onSubmit: e,
|
|
1113
1162
|
token: t.token,
|
|
1114
1163
|
identifier: t.identifier,
|
|
1115
1164
|
baseUrl: t.baseUrl,
|
|
1116
1165
|
title: t.title,
|
|
1166
|
+
llmName: t.llmName,
|
|
1117
1167
|
messagePostRender: t.messagePostRender
|
|
1118
|
-
}, null, 8, ["modelValue", "token", "identifier", "baseUrl", "title", "messagePostRender"]),
|
|
1119
|
-
|
|
1168
|
+
}, null, 8, ["modelValue", "token", "identifier", "baseUrl", "title", "llmName", "messagePostRender"]),
|
|
1169
|
+
x("div", {
|
|
1120
1170
|
class: "ai-icon",
|
|
1121
|
-
onClick:
|
|
1171
|
+
onClick: s
|
|
1122
1172
|
}, [
|
|
1123
|
-
|
|
1173
|
+
x("div", {
|
|
1124
1174
|
class: "close-icon",
|
|
1125
|
-
onClick:
|
|
1126
|
-
}, [...
|
|
1127
|
-
|
|
1175
|
+
onClick: he(r, ["stop"])
|
|
1176
|
+
}, [...b[1] || (b[1] = [
|
|
1177
|
+
x("svg", {
|
|
1128
1178
|
viewBox: "0 0 1024 1024",
|
|
1129
1179
|
width: "8",
|
|
1130
1180
|
height: "8"
|
|
1131
1181
|
}, [
|
|
1132
|
-
|
|
1182
|
+
x("path", {
|
|
1133
1183
|
d: "M512 456.310154L94.247385 38.557538a39.384615 39.384615 0 0 0-55.689847 55.689847L456.310154 512 38.557538 929.752615a39.384615 39.384615 0 0 0 55.689847 55.689847L512 567.689846l417.752615 417.752616c15.163077 15.163077 40.526769 15.163077 55.689847 0s15.163077-40.526769 0-55.689847L567.689846 512l417.752616-417.752615a39.384615 39.384615 0 0 0-55.689847-55.689847L512 456.310154z",
|
|
1134
1184
|
fill: "currentColor"
|
|
1135
1185
|
})
|
|
1136
1186
|
], -1)
|
|
1137
1187
|
])]),
|
|
1138
|
-
|
|
1139
|
-
src:
|
|
1188
|
+
b[2] || (b[2] = x("img", {
|
|
1189
|
+
src: ve,
|
|
1140
1190
|
alt: "AI助手"
|
|
1141
1191
|
}, null, -1)),
|
|
1142
|
-
|
|
1192
|
+
b[3] || (b[3] = x("span", { class: "ai-icon-text" }, "AI助手", -1))
|
|
1143
1193
|
])
|
|
1144
1194
|
]));
|
|
1145
1195
|
}
|
|
1146
|
-
}),
|
|
1196
|
+
}), tt = /* @__PURE__ */ le(et, [["__scopeId", "data-v-9d212a48"]]), ne = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1147
1197
|
__proto__: null,
|
|
1148
|
-
SzAiChat:
|
|
1149
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1150
|
-
if (!
|
|
1151
|
-
|
|
1152
|
-
for (let n in
|
|
1153
|
-
const
|
|
1154
|
-
t.component(
|
|
1198
|
+
SzAiChat: tt
|
|
1199
|
+
}, Symbol.toStringTag, { value: "Module" })), H = function(t) {
|
|
1200
|
+
if (!H.installed) {
|
|
1201
|
+
H.installed = !0;
|
|
1202
|
+
for (let n in ne) {
|
|
1203
|
+
const a = Reflect.get(ne, n);
|
|
1204
|
+
t.component(a.name, a);
|
|
1155
1205
|
}
|
|
1156
1206
|
}
|
|
1157
|
-
},
|
|
1207
|
+
}, nt = (t) => {
|
|
1158
1208
|
console.log(`点击了路由链接: ${t}`);
|
|
1159
|
-
},
|
|
1209
|
+
}, rt = {
|
|
1160
1210
|
color: "#536fec",
|
|
1161
1211
|
fontWeight: "bold",
|
|
1162
1212
|
textDecoration: "underline",
|
|
1163
1213
|
cursor: "pointer",
|
|
1164
1214
|
padding: "0 3px"
|
|
1165
|
-
},
|
|
1166
|
-
const n = /#router:([^#]+)#/g,
|
|
1167
|
-
let
|
|
1215
|
+
}, ot = (t) => {
|
|
1216
|
+
const n = /#router:([^#]+)#/g, a = [];
|
|
1217
|
+
let s = 0, r;
|
|
1168
1218
|
for (; (r = n.exec(t)) !== null; ) {
|
|
1169
|
-
r.index >
|
|
1219
|
+
r.index > s && a.push({ text: t.substring(s, r.index) });
|
|
1170
1220
|
const e = r[1];
|
|
1171
|
-
|
|
1221
|
+
a.push({ text: e, routeName: e }), s = n.lastIndex;
|
|
1172
1222
|
}
|
|
1173
|
-
return
|
|
1174
|
-
},
|
|
1175
|
-
const { onRouteClick:
|
|
1223
|
+
return s < t.length && a.push({ text: t.substring(s) }), a;
|
|
1224
|
+
}, at = (t, n, a = {}) => {
|
|
1225
|
+
const { onRouteClick: s = nt, linkStyle: r = {} } = a, e = document.createElement("a");
|
|
1176
1226
|
e.href = "#", e.textContent = t;
|
|
1177
|
-
const i = { ...
|
|
1178
|
-
return Object.assign(e.style, i), e.addEventListener("click", (
|
|
1179
|
-
|
|
1227
|
+
const i = { ...rt, ...r };
|
|
1228
|
+
return Object.assign(e.style, i), e.addEventListener("click", (f) => {
|
|
1229
|
+
f.preventDefault(), s(n);
|
|
1180
1230
|
}), e;
|
|
1181
|
-
},
|
|
1182
|
-
const n = /#router:([^#]+)#/g,
|
|
1231
|
+
}, st = (t) => {
|
|
1232
|
+
const n = /#router:([^#]+)#/g, a = [], s = document.createTreeWalker(
|
|
1183
1233
|
t,
|
|
1184
1234
|
NodeFilter.SHOW_TEXT,
|
|
1185
1235
|
null
|
|
1186
1236
|
);
|
|
1187
|
-
let r =
|
|
1237
|
+
let r = s.nextNode();
|
|
1188
1238
|
for (; r; ) {
|
|
1189
1239
|
const e = r, i = e.textContent || "";
|
|
1190
1240
|
if (n.test(i)) {
|
|
1191
1241
|
n.lastIndex = 0;
|
|
1192
|
-
const
|
|
1193
|
-
|
|
1242
|
+
const f = ot(i);
|
|
1243
|
+
f.length > 0 && a.push({ node: e, replacements: f });
|
|
1194
1244
|
}
|
|
1195
|
-
r =
|
|
1245
|
+
r = s.nextNode();
|
|
1196
1246
|
}
|
|
1197
|
-
return
|
|
1198
|
-
},
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
var
|
|
1247
|
+
return a;
|
|
1248
|
+
}, ut = (t, n, a = {}) => {
|
|
1249
|
+
const s = st(t);
|
|
1250
|
+
s.forEach(({ node: r, replacements: e }) => {
|
|
1251
|
+
var f;
|
|
1202
1252
|
const i = document.createDocumentFragment();
|
|
1203
|
-
e.forEach(({ text:
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
i.appendChild(
|
|
1253
|
+
e.forEach(({ text: v, routeName: b }) => {
|
|
1254
|
+
if (b) {
|
|
1255
|
+
const _ = at(v, b, a);
|
|
1256
|
+
i.appendChild(_);
|
|
1207
1257
|
} else
|
|
1208
|
-
i.appendChild(document.createTextNode(
|
|
1209
|
-
}), (
|
|
1210
|
-
}),
|
|
1258
|
+
i.appendChild(document.createTextNode(v));
|
|
1259
|
+
}), (f = r.parentNode) == null || f.replaceChild(i, r);
|
|
1260
|
+
}), a != null && a.nodeCallback && s.forEach(({ node: r, replacements: e }) => {
|
|
1211
1261
|
var i;
|
|
1212
|
-
(i =
|
|
1262
|
+
(i = a.nodeCallback) == null || i.call(a, r, e);
|
|
1213
1263
|
});
|
|
1214
|
-
},
|
|
1215
|
-
function
|
|
1216
|
-
componentPrefix: t =
|
|
1264
|
+
}, lt = "0.1.5", it = "Sz";
|
|
1265
|
+
function dt({
|
|
1266
|
+
componentPrefix: t = it,
|
|
1217
1267
|
components: n = []
|
|
1218
1268
|
} = {}) {
|
|
1219
|
-
const
|
|
1220
|
-
function
|
|
1269
|
+
const a = [];
|
|
1270
|
+
function s(e, i, f) {
|
|
1221
1271
|
e.component(t + i) || e.component(
|
|
1222
1272
|
t + i,
|
|
1223
|
-
|
|
1273
|
+
f
|
|
1224
1274
|
);
|
|
1225
1275
|
}
|
|
1226
1276
|
function r(e) {
|
|
1227
|
-
|
|
1228
|
-
const { name:
|
|
1229
|
-
|
|
1230
|
-
|
|
1277
|
+
a.includes(e) || (a.push(e), n.forEach((i) => {
|
|
1278
|
+
const { name: f, alias: v } = i;
|
|
1279
|
+
s(e, f, i), v && v.forEach((b) => {
|
|
1280
|
+
s(e, b, i);
|
|
1231
1281
|
});
|
|
1232
1282
|
}));
|
|
1233
1283
|
}
|
|
1234
1284
|
return {
|
|
1235
|
-
version:
|
|
1285
|
+
version: lt,
|
|
1236
1286
|
componentPrefix: t,
|
|
1237
1287
|
install: r
|
|
1238
1288
|
};
|
|
1239
1289
|
}
|
|
1240
|
-
const
|
|
1290
|
+
const ft = {
|
|
1241
1291
|
install(t) {
|
|
1242
|
-
|
|
1292
|
+
H(t);
|
|
1243
1293
|
}
|
|
1244
1294
|
};
|
|
1245
1295
|
export {
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1296
|
+
tt as SzAiChat,
|
|
1297
|
+
dt as create,
|
|
1298
|
+
at as createRouteLink,
|
|
1299
|
+
ft as default,
|
|
1300
|
+
st as findRouteTextNodes,
|
|
1301
|
+
ot as parseRouteMarkers,
|
|
1302
|
+
ut as routeLinkRender
|
|
1253
1303
|
};
|