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