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