@szjy/ai-coms 0.1.1 → 0.1.3
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/images/svg/arrow-right.svg +16 -0
- package/dist/images/svg/close.svg +16 -0
- package/dist/images/svg/copy.svg +1 -0
- package/dist/images/svg/drawer-layout.svg +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +675 -571
- 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 +45 -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 {
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
return new URLSearchParams(new URL(n).search).get(
|
|
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
|
|
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
|
|
10
|
-
const n = new URL("http://localhost:11434/api/chat"),
|
|
11
|
-
Object.keys(
|
|
12
|
-
n.searchParams.append(
|
|
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,19 +27,19 @@ async function be(e) {
|
|
|
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",
|
|
@@ -51,19 +51,19 @@ async function _e(e, n) {
|
|
|
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",
|
|
@@ -76,19 +76,19 @@ async function Se(e, n) {
|
|
|
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",
|
|
@@ -104,19 +104,19 @@ async function xe(e, n) {
|
|
|
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",
|
|
@@ -132,46 +132,45 @@ async function ke(e, n) {
|
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
t.searchParams.append(v, d[v]);
|
|
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]);
|
|
147
146
|
});
|
|
148
|
-
const
|
|
147
|
+
const v = new Request(e, {
|
|
149
148
|
method: "post",
|
|
150
149
|
headers: {
|
|
151
150
|
"Content-Type": "application/json",
|
|
152
151
|
Authorization: `Bearer ${n}`
|
|
153
152
|
},
|
|
154
153
|
body: JSON.stringify({
|
|
155
|
-
content:
|
|
154
|
+
content: t
|
|
156
155
|
})
|
|
157
156
|
});
|
|
158
|
-
return fetch(
|
|
157
|
+
return fetch(v);
|
|
159
158
|
}
|
|
160
|
-
const Te = (
|
|
161
|
-
if (
|
|
162
|
-
const n =
|
|
159
|
+
const Te = (t) => {
|
|
160
|
+
if (t.startsWith("data:")) {
|
|
161
|
+
const n = t.substring(5).trim();
|
|
163
162
|
if (n === "[DONE]")
|
|
164
163
|
return {
|
|
165
164
|
done: !0
|
|
166
165
|
};
|
|
167
166
|
try {
|
|
168
167
|
return JSON.parse(n);
|
|
169
|
-
} catch (
|
|
170
|
-
console.error("JSON parsing error:",
|
|
168
|
+
} catch (o) {
|
|
169
|
+
console.error("JSON parsing error:", o);
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
return null;
|
|
174
|
-
},
|
|
173
|
+
}, Re = [
|
|
175
174
|
{
|
|
176
175
|
label: "模拟数据模型",
|
|
177
176
|
modelName: "standard",
|
|
@@ -180,108 +179,108 @@ const Te = (e) => {
|
|
|
180
179
|
{
|
|
181
180
|
label: "Spark 星火大模型",
|
|
182
181
|
modelName: "spark",
|
|
183
|
-
api:
|
|
182
|
+
api: xe
|
|
184
183
|
},
|
|
185
184
|
{
|
|
186
185
|
label: "Ollama 3 大模型",
|
|
187
186
|
modelName: "ollama3",
|
|
188
|
-
api:
|
|
187
|
+
api: we
|
|
189
188
|
},
|
|
190
189
|
{
|
|
191
190
|
label: "SiliconFlow 硅基流动大模型",
|
|
192
191
|
modelName: "siliconflow",
|
|
193
|
-
api:
|
|
192
|
+
api: ke
|
|
194
193
|
},
|
|
195
194
|
{
|
|
196
195
|
label: "Kimi Moonshot 月之暗面大模型",
|
|
197
196
|
modelName: "moonshot",
|
|
198
|
-
api:
|
|
197
|
+
api: Se
|
|
199
198
|
},
|
|
200
199
|
{
|
|
201
200
|
label: "通义千问大模型",
|
|
202
201
|
modelName: "dashscope",
|
|
203
|
-
api:
|
|
202
|
+
api: _e
|
|
204
203
|
},
|
|
205
204
|
{
|
|
206
205
|
label: "数智建管大模型",
|
|
207
206
|
modelName: "szjy",
|
|
208
207
|
api: Ce
|
|
209
208
|
}
|
|
210
|
-
],
|
|
211
|
-
standard(
|
|
212
|
-
let
|
|
213
|
-
return
|
|
209
|
+
], Z = {
|
|
210
|
+
standard(t, n) {
|
|
211
|
+
let o = "";
|
|
212
|
+
return t instanceof Uint8Array ? o = n.decode(t, {
|
|
214
213
|
stream: !0
|
|
215
|
-
}) :
|
|
216
|
-
content:
|
|
214
|
+
}) : o = t, {
|
|
215
|
+
content: o
|
|
217
216
|
};
|
|
218
217
|
},
|
|
219
|
-
spark(
|
|
220
|
-
const n = Te(
|
|
218
|
+
spark(t) {
|
|
219
|
+
const n = Te(t);
|
|
221
220
|
return n.done ? {
|
|
222
221
|
done: !0
|
|
223
222
|
} : {
|
|
224
223
|
content: n.choices[0].delta.content || ""
|
|
225
224
|
};
|
|
226
225
|
},
|
|
227
|
-
siliconflow(
|
|
228
|
-
return this.spark(
|
|
226
|
+
siliconflow(t) {
|
|
227
|
+
return this.spark(t);
|
|
229
228
|
},
|
|
230
|
-
moonshot(
|
|
231
|
-
return this.spark(
|
|
229
|
+
moonshot(t) {
|
|
230
|
+
return this.spark(t);
|
|
232
231
|
},
|
|
233
|
-
dashscope(
|
|
234
|
-
return this.spark(
|
|
232
|
+
dashscope(t) {
|
|
233
|
+
return this.spark(t);
|
|
235
234
|
},
|
|
236
|
-
szjy(
|
|
237
|
-
return this.spark(
|
|
235
|
+
szjy(t) {
|
|
236
|
+
return this.spark(t);
|
|
238
237
|
},
|
|
239
|
-
ollama3(
|
|
238
|
+
ollama3(t) {
|
|
240
239
|
return {
|
|
241
|
-
content: JSON.parse(
|
|
240
|
+
content: JSON.parse(t).message.content
|
|
242
241
|
};
|
|
243
242
|
}
|
|
244
|
-
}, ee = (
|
|
245
|
-
const
|
|
246
|
-
return
|
|
247
|
-
|
|
248
|
-
}),
|
|
249
|
-
}, Pe = (
|
|
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) => {
|
|
250
249
|
let n = "";
|
|
251
250
|
return new TransformStream({
|
|
252
|
-
transform(
|
|
253
|
-
if (n +=
|
|
254
|
-
n = ee(n,
|
|
251
|
+
transform(o, a) {
|
|
252
|
+
if (n += o, n.trim().startsWith("data:"))
|
|
253
|
+
n = ee(n, a, t);
|
|
255
254
|
else
|
|
256
255
|
try {
|
|
257
|
-
JSON.parse(n), n = ee(n,
|
|
256
|
+
JSON.parse(n), n = ee(n, a, t);
|
|
258
257
|
} catch {
|
|
259
|
-
|
|
258
|
+
a.enqueue(o), n = "";
|
|
260
259
|
}
|
|
261
260
|
},
|
|
262
|
-
flush(
|
|
263
|
-
n.trim() !== "" &&
|
|
261
|
+
flush(o) {
|
|
262
|
+
n.trim() !== "" && o.enqueue(n);
|
|
264
263
|
}
|
|
265
264
|
});
|
|
266
265
|
};
|
|
267
|
-
async function
|
|
268
|
-
const
|
|
269
|
-
return
|
|
270
|
-
|
|
271
|
-
if (
|
|
272
|
-
const
|
|
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(`
|
|
273
272
|
`)).getReader();
|
|
274
|
-
console.log("reader from response:",
|
|
273
|
+
console.log("reader from response:", e), a({
|
|
275
274
|
error: 0,
|
|
276
|
-
reader:
|
|
275
|
+
reader: e
|
|
277
276
|
});
|
|
278
277
|
} else
|
|
279
|
-
|
|
278
|
+
a({
|
|
280
279
|
error: 1,
|
|
281
280
|
reader: null
|
|
282
281
|
});
|
|
283
|
-
}).catch((
|
|
284
|
-
|
|
282
|
+
}).catch((r) => {
|
|
283
|
+
a({
|
|
285
284
|
error: 1,
|
|
286
285
|
reader: null
|
|
287
286
|
});
|
|
@@ -291,205 +290,245 @@ async function Oe(e, n) {
|
|
|
291
290
|
reader: null
|
|
292
291
|
};
|
|
293
292
|
}
|
|
294
|
-
let
|
|
295
|
-
function
|
|
296
|
-
return
|
|
293
|
+
let B = null;
|
|
294
|
+
function Ne() {
|
|
295
|
+
return B || (window.markdownit ? B = new window.markdownit({
|
|
297
296
|
html: !0,
|
|
298
297
|
linkify: !0,
|
|
299
298
|
typographer: !0
|
|
300
|
-
}) : console.log("markdownit is not loaded"),
|
|
299
|
+
}) : console.log("markdownit is not loaded"), B);
|
|
301
300
|
}
|
|
302
|
-
const
|
|
303
|
-
const
|
|
304
|
-
for (const [
|
|
305
|
-
|
|
306
|
-
return
|
|
307
|
-
},
|
|
308
|
-
|
|
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
|
+
__name: "SvgIcon",
|
|
309
308
|
props: {
|
|
310
|
-
|
|
311
|
-
type: String,
|
|
312
|
-
default: "icon"
|
|
313
|
-
},
|
|
309
|
+
// 图标名称或完整URL
|
|
314
310
|
name: {
|
|
315
311
|
type: String,
|
|
316
312
|
required: !0
|
|
317
313
|
},
|
|
314
|
+
// 图标大小
|
|
315
|
+
size: {
|
|
316
|
+
type: [Number, String],
|
|
317
|
+
default: 16
|
|
318
|
+
},
|
|
319
|
+
// 图标颜色(注意:直接加载SVG URL时,颜色控制可能受限)
|
|
318
320
|
color: {
|
|
319
321
|
type: String,
|
|
320
|
-
default: "
|
|
322
|
+
default: ""
|
|
323
|
+
},
|
|
324
|
+
// 额外的class
|
|
325
|
+
className: {
|
|
326
|
+
type: String,
|
|
327
|
+
default: ""
|
|
328
|
+
},
|
|
329
|
+
// 基础URL路径,如果name不是完整URL,会与此路径拼接
|
|
330
|
+
basePath: {
|
|
331
|
+
type: String,
|
|
332
|
+
default: "/icons/"
|
|
321
333
|
}
|
|
322
334
|
},
|
|
323
|
-
setup(
|
|
324
|
-
const n =
|
|
325
|
-
|
|
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
|
+
return {
|
|
344
|
+
width: e,
|
|
345
|
+
height: e,
|
|
346
|
+
display: "inline-flex",
|
|
347
|
+
justifyContent: "center",
|
|
348
|
+
alignItems: "center"
|
|
349
|
+
};
|
|
350
|
+
}), r = q(() => {
|
|
351
|
+
const e = {
|
|
352
|
+
width: "100%",
|
|
353
|
+
height: "100%"
|
|
354
|
+
};
|
|
355
|
+
return n.color && (e.filter = `drop-shadow(0 0 0 ${n.color})`), e;
|
|
356
|
+
});
|
|
357
|
+
return (e, i) => (P(), O("div", {
|
|
358
|
+
class: "svg-icon-wrapper",
|
|
359
|
+
style: K(a.value)
|
|
360
|
+
}, [
|
|
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
|
+
], 4));
|
|
326
368
|
}
|
|
327
|
-
}
|
|
328
|
-
function $e(e, n, r, i, s, t) {
|
|
329
|
-
return P(), R("svg", ie({
|
|
330
|
-
class: e.svgClass,
|
|
331
|
-
"aria-hidden": "true"
|
|
332
|
-
}, e.$attrs), [
|
|
333
|
-
S("use", {
|
|
334
|
-
"xlink:href": e.symbolId,
|
|
335
|
-
fill: e.color
|
|
336
|
-
}, null, 8, Me)
|
|
337
|
-
], 16);
|
|
338
|
-
}
|
|
339
|
-
const D = /* @__PURE__ */ J(Re, [["render", $e], ["__scopeId", "data-v-349f049f"]]), Ie = async (e) => {
|
|
369
|
+
}, W = /* @__PURE__ */ ae(ze, [["__scopeId", "data-v-490b11c1"]]), je = async (t) => {
|
|
340
370
|
if (navigator.clipboard && navigator.permissions)
|
|
341
|
-
await navigator.clipboard.writeText(
|
|
371
|
+
await navigator.clipboard.writeText(t);
|
|
342
372
|
else {
|
|
343
373
|
const n = document.createElement("textArea");
|
|
344
|
-
n.value =
|
|
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);
|
|
345
375
|
}
|
|
346
|
-
},
|
|
376
|
+
}, Ee = ["innerHTML"], Ie = {
|
|
347
377
|
__name: "Previewer",
|
|
348
378
|
props: {
|
|
349
379
|
reader: null,
|
|
350
380
|
model: "szjy",
|
|
351
381
|
scrollToBottomFn: null,
|
|
352
|
-
displayText: ""
|
|
382
|
+
displayText: "",
|
|
383
|
+
messagePostRender: {
|
|
384
|
+
type: Function,
|
|
385
|
+
default: null
|
|
386
|
+
}
|
|
353
387
|
},
|
|
354
388
|
emits: [
|
|
355
389
|
"failed",
|
|
356
390
|
"completed",
|
|
357
391
|
"updating"
|
|
358
392
|
],
|
|
359
|
-
setup(
|
|
360
|
-
const { appContext:
|
|
361
|
-
let
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
},
|
|
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 j = q(() => B ? B.render(i.value) : i.value), E = () => {
|
|
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(() => `${j.value}`), f = C(!1), u = () => {
|
|
365
399
|
f.value = !0;
|
|
366
|
-
},
|
|
400
|
+
}, d = () => {
|
|
367
401
|
f.value = !1;
|
|
368
|
-
},
|
|
369
|
-
if (!
|
|
370
|
-
const
|
|
371
|
-
for (
|
|
402
|
+
}, l = C(!1), s = async () => {
|
|
403
|
+
if (!e.reader) return;
|
|
404
|
+
const b = new TextDecoder("utf-8");
|
|
405
|
+
for (h.value = !0; !y.value; )
|
|
372
406
|
try {
|
|
373
|
-
if (!
|
|
374
|
-
|
|
407
|
+
if (!e.reader) {
|
|
408
|
+
l.value = !0;
|
|
375
409
|
break;
|
|
376
410
|
}
|
|
377
|
-
const { value:
|
|
378
|
-
if (!
|
|
379
|
-
|
|
411
|
+
const { value: c, done: m } = await e.reader.read();
|
|
412
|
+
if (!e.reader) {
|
|
413
|
+
l.value = !0;
|
|
380
414
|
break;
|
|
381
415
|
}
|
|
382
416
|
if (m) {
|
|
383
|
-
|
|
417
|
+
l.value = !0;
|
|
384
418
|
break;
|
|
385
419
|
}
|
|
386
|
-
const w =
|
|
420
|
+
const w = Z[e.model];
|
|
387
421
|
if (!w)
|
|
388
422
|
break;
|
|
389
|
-
const T = w.call(
|
|
423
|
+
const T = w.call(Z, c, b);
|
|
390
424
|
if (T.done) {
|
|
391
|
-
|
|
425
|
+
l.value = !0;
|
|
392
426
|
break;
|
|
393
427
|
}
|
|
394
|
-
|
|
395
|
-
} catch (
|
|
396
|
-
|
|
428
|
+
v.value += T.content, _ === null && S();
|
|
429
|
+
} catch (c) {
|
|
430
|
+
l.value = !0, console.log(3333, c), N("failed", c), E();
|
|
397
431
|
break;
|
|
398
432
|
} finally {
|
|
399
|
-
|
|
433
|
+
d();
|
|
400
434
|
}
|
|
401
|
-
},
|
|
402
|
-
|
|
403
|
-
}, p = (
|
|
404
|
-
},
|
|
435
|
+
}, g = async () => {
|
|
436
|
+
e.scrollToBottomFn && e.scrollToBottomFn();
|
|
437
|
+
}, p = (b = () => {
|
|
438
|
+
}, c = () => {
|
|
405
439
|
}) => {
|
|
406
|
-
if (
|
|
407
|
-
const m =
|
|
408
|
-
|
|
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();
|
|
409
443
|
} else
|
|
410
|
-
|
|
411
|
-
},
|
|
412
|
-
if (
|
|
413
|
-
cancelAnimationFrame(
|
|
444
|
+
c();
|
|
445
|
+
}, S = () => {
|
|
446
|
+
if (y.value && _) {
|
|
447
|
+
cancelAnimationFrame(_), _ = null, h.value = !1;
|
|
414
448
|
return;
|
|
415
449
|
}
|
|
416
|
-
|
|
450
|
+
l.value ? p(
|
|
417
451
|
() => {
|
|
418
|
-
|
|
452
|
+
_ = requestAnimationFrame(S), N("updating", null);
|
|
419
453
|
},
|
|
420
454
|
() => {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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;
|
|
424
463
|
}
|
|
425
|
-
) : (p(),
|
|
464
|
+
) : (p(), _ = requestAnimationFrame(S)), g();
|
|
426
465
|
};
|
|
427
|
-
|
|
428
|
-
() =>
|
|
466
|
+
ie(
|
|
467
|
+
() => e.reader,
|
|
429
468
|
() => {
|
|
430
|
-
|
|
469
|
+
e.reader && s();
|
|
431
470
|
},
|
|
432
471
|
{
|
|
433
472
|
immediate: !0,
|
|
434
473
|
deep: !0
|
|
435
474
|
}
|
|
436
|
-
),
|
|
437
|
-
|
|
475
|
+
), ce(() => {
|
|
476
|
+
E();
|
|
438
477
|
}), n({
|
|
439
|
-
abortReader:
|
|
440
|
-
initializeStart:
|
|
441
|
-
initializeEnd:
|
|
442
|
-
}),
|
|
443
|
-
const
|
|
478
|
+
abortReader: E,
|
|
479
|
+
initializeStart: u,
|
|
480
|
+
initializeEnd: d
|
|
481
|
+
}), q(() => f.value ? !0 : (!e.reader || !h || i.value, !1));
|
|
482
|
+
const x = async () => {
|
|
444
483
|
try {
|
|
445
|
-
const
|
|
446
|
-
await
|
|
447
|
-
} catch (
|
|
448
|
-
console.error("复制失败:",
|
|
484
|
+
const b = i.value;
|
|
485
|
+
await je(b), r.success("复制成功");
|
|
486
|
+
} catch (b) {
|
|
487
|
+
console.error("复制失败:", b), r.error("复制失败");
|
|
449
488
|
}
|
|
450
489
|
};
|
|
451
|
-
return (
|
|
452
|
-
default:
|
|
453
|
-
|
|
490
|
+
return (b, c) => (P(), J(re, { name: "fade" }, {
|
|
491
|
+
default: F(() => [
|
|
492
|
+
M.value ? (P(), O("div", {
|
|
454
493
|
key: 0,
|
|
455
494
|
ref_key: "refWrapperContent",
|
|
456
|
-
ref:
|
|
495
|
+
ref: A,
|
|
457
496
|
"text-16": "",
|
|
458
497
|
class: "w-full h-full overflow-y-auto relative",
|
|
459
498
|
"p-24px": ""
|
|
460
499
|
}, [
|
|
461
|
-
|
|
500
|
+
k("div", {
|
|
462
501
|
class: "markdown-wrapper",
|
|
463
|
-
innerHTML:
|
|
464
|
-
}, null, 8,
|
|
465
|
-
|
|
502
|
+
innerHTML: M.value
|
|
503
|
+
}, null, 8, Ee),
|
|
504
|
+
L.value ? (P(), O("div", {
|
|
466
505
|
key: 0,
|
|
467
|
-
class: "copy-btn-wrapper",
|
|
468
|
-
onClick:
|
|
506
|
+
class: "ai-copy-btn-wrapper",
|
|
507
|
+
onClick: x
|
|
469
508
|
}, [
|
|
470
|
-
|
|
471
|
-
name: "copy",
|
|
509
|
+
$(W, {
|
|
510
|
+
name: "/images/svg/copy.svg",
|
|
472
511
|
color: "#666666"
|
|
473
512
|
}),
|
|
474
|
-
|
|
475
|
-
])) :
|
|
476
|
-
], 512)) :
|
|
513
|
+
c[0] || (c[0] = k("span", { class: "copy-text" }, "复制", -1))
|
|
514
|
+
])) : D("", !0)
|
|
515
|
+
], 512)) : D("", !0)
|
|
477
516
|
]),
|
|
478
517
|
_: 1
|
|
479
518
|
}));
|
|
480
519
|
}
|
|
481
|
-
},
|
|
520
|
+
}, Ue = { class: "panel-header" }, $e = { class: "header-actions" }, Ae = { class: "header-title" }, Me = { class: "action-icons" }, qe = { class: "body-content" }, Fe = {
|
|
482
521
|
key: 0,
|
|
483
522
|
class: "welcome-content"
|
|
484
|
-
},
|
|
523
|
+
}, Be = { class: "subtitle" }, De = { class: "highlight" }, Ve = { class: "quick-questions" }, We = ["onClick"], He = {
|
|
485
524
|
key: 1,
|
|
486
525
|
class: "message-content user-content"
|
|
487
|
-
},
|
|
526
|
+
}, Je = { class: "panel-footer" }, Qe = {
|
|
488
527
|
key: 0,
|
|
489
|
-
src:
|
|
528
|
+
src: ge,
|
|
490
529
|
alt: "加载中",
|
|
491
530
|
class: "loading-icon"
|
|
492
|
-
},
|
|
531
|
+
}, Ke = { class: "input-box" }, Xe = ["src"], Ge = {
|
|
493
532
|
__name: "ChatPanel",
|
|
494
533
|
props: {
|
|
495
534
|
modelValue: {
|
|
@@ -511,111 +550,115 @@ const D = /* @__PURE__ */ J(Re, [["render", $e], ["__scopeId", "data-v-349f049f"
|
|
|
511
550
|
title: {
|
|
512
551
|
type: String,
|
|
513
552
|
default: "数智AI助理"
|
|
553
|
+
},
|
|
554
|
+
messagePostRender: {
|
|
555
|
+
type: Function,
|
|
556
|
+
default: null
|
|
514
557
|
}
|
|
515
558
|
},
|
|
516
559
|
emits: ["update:modelValue", "submit"],
|
|
517
|
-
setup(
|
|
518
|
-
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([
|
|
519
562
|
"什么是AI助理,能做什么?",
|
|
520
563
|
"当前项目的基本情况?",
|
|
521
564
|
"当前项目的进度情况?",
|
|
522
565
|
"当前项目的参建方有哪些?",
|
|
523
566
|
"数智建管平台有哪些功能?能做什么?"
|
|
524
|
-
]),
|
|
525
|
-
|
|
526
|
-
if (
|
|
527
|
-
const m =
|
|
528
|
-
w - T -
|
|
567
|
+
]), _ = C([]), j = C(!1), E = C(null), M = () => {
|
|
568
|
+
oe(() => {
|
|
569
|
+
if (E.value) {
|
|
570
|
+
const m = E.value, w = m.scrollHeight, T = m.scrollTop, I = m.clientHeight;
|
|
571
|
+
w - T - I < 100 ? m.scrollTop = w : m.scrollTo({
|
|
529
572
|
top: w
|
|
530
573
|
});
|
|
531
574
|
}
|
|
532
575
|
});
|
|
533
|
-
}, f = C(!1),
|
|
534
|
-
console.log("onFailedReader", m, w),
|
|
535
|
-
const T =
|
|
536
|
-
T && T.initializeEnd(),
|
|
537
|
-
|
|
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), j.value = !1;
|
|
578
|
+
const T = b();
|
|
579
|
+
T && T.initializeEnd(), a.error("转换失败,请重试"), f.value = !1, setTimeout(() => {
|
|
580
|
+
y.value && y.value.focus();
|
|
538
581
|
});
|
|
539
|
-
},
|
|
540
|
-
|
|
541
|
-
|
|
582
|
+
}, l = (m, w) => {
|
|
583
|
+
j.value = !1, f.value = !1, M(), w && N.value[m] && (N.value[m].displayText = w), setTimeout(() => {
|
|
584
|
+
y.value && y.value.focus();
|
|
542
585
|
});
|
|
543
|
-
},
|
|
586
|
+
}, s = (m) => {
|
|
544
587
|
f.value = !0;
|
|
545
|
-
},
|
|
546
|
-
f.value = !1,
|
|
547
|
-
}, p = C(!1),
|
|
588
|
+
}, g = () => {
|
|
589
|
+
f.value = !1, v("update:modelValue", !1), L.value = !1, N.value = [];
|
|
590
|
+
}, p = C(!1), S = () => {
|
|
548
591
|
p.value = !p.value;
|
|
549
|
-
},
|
|
550
|
-
|
|
551
|
-
},
|
|
552
|
-
for (let m =
|
|
553
|
-
if (
|
|
554
|
-
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];
|
|
555
598
|
return null;
|
|
556
|
-
},
|
|
557
|
-
if (console.log("stylizingLoading:",
|
|
558
|
-
const
|
|
559
|
-
console.log("lastPreviewer:",
|
|
599
|
+
}, c = async () => {
|
|
600
|
+
if (console.log("stylizingLoading:", j.value), j.value) {
|
|
601
|
+
const R = b();
|
|
602
|
+
console.log("lastPreviewer:", R), R && (console.log("abortReader"), R.abortReader());
|
|
560
603
|
return;
|
|
561
604
|
}
|
|
562
|
-
if (!
|
|
563
|
-
console.log("no input, return"),
|
|
605
|
+
if (!h.value.trim()) {
|
|
606
|
+
console.log("no input, return"), y.value.focus();
|
|
564
607
|
return;
|
|
565
608
|
}
|
|
566
|
-
|
|
609
|
+
N.value.push({
|
|
567
610
|
type: "user",
|
|
568
|
-
content:
|
|
569
|
-
}), f.value = !0,
|
|
570
|
-
const m =
|
|
571
|
-
|
|
572
|
-
const w =
|
|
573
|
-
|
|
611
|
+
content: h.value
|
|
612
|
+
}), f.value = !0, L.value = !0, v("submit", h.value), M();
|
|
613
|
+
const m = h.value;
|
|
614
|
+
h.value = "";
|
|
615
|
+
const w = N.value.length;
|
|
616
|
+
_.value[w] && _.value[w].initializeStart(), j.value = !0, N.value.push({
|
|
574
617
|
type: "ai"
|
|
575
618
|
});
|
|
576
|
-
const { error: T, reader:
|
|
619
|
+
const { error: T, reader: I } = await Le(e.value, {
|
|
577
620
|
text: m,
|
|
578
|
-
token:
|
|
579
|
-
identifier:
|
|
580
|
-
baseUrl:
|
|
621
|
+
token: i.token,
|
|
622
|
+
identifier: i.identifier,
|
|
623
|
+
baseUrl: i.baseUrl
|
|
581
624
|
});
|
|
582
625
|
if (T) {
|
|
583
|
-
console.log(45455, T),
|
|
626
|
+
console.log(45455, T), d(w, T);
|
|
584
627
|
return;
|
|
585
628
|
}
|
|
586
|
-
|
|
629
|
+
I && (N.value[w].reader = I);
|
|
587
630
|
};
|
|
588
631
|
return (m, w) => {
|
|
589
|
-
const T =
|
|
590
|
-
return P(),
|
|
591
|
-
default:
|
|
592
|
-
|
|
632
|
+
const T = X("el-icon"), I = X("el-input");
|
|
633
|
+
return P(), J(re, { name: "slide" }, {
|
|
634
|
+
default: F(() => [
|
|
635
|
+
t.modelValue ? (P(), O("div", {
|
|
593
636
|
key: 0,
|
|
594
|
-
class:
|
|
637
|
+
class: H(["ai-panel", { "drawer-mode": p.value }])
|
|
595
638
|
}, [
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
639
|
+
k("div", Ue, [
|
|
640
|
+
k("div", $e, [
|
|
641
|
+
k("div", Ae, V(t.title), 1),
|
|
642
|
+
k("div", Me, [
|
|
643
|
+
$(T, {
|
|
601
644
|
class: "action-icon",
|
|
602
|
-
onClick:
|
|
645
|
+
onClick: S
|
|
603
646
|
}, {
|
|
604
|
-
default:
|
|
605
|
-
|
|
606
|
-
name: "drawer-layout",
|
|
647
|
+
default: F(() => [
|
|
648
|
+
$(W, {
|
|
649
|
+
name: "/images/svg/drawer-layout.svg",
|
|
607
650
|
color: "#999999"
|
|
608
651
|
})
|
|
609
652
|
]),
|
|
610
653
|
_: 1
|
|
611
654
|
}),
|
|
612
|
-
|
|
655
|
+
$(T, {
|
|
613
656
|
class: "action-icon",
|
|
614
|
-
onClick:
|
|
657
|
+
onClick: g
|
|
615
658
|
}, {
|
|
616
|
-
default:
|
|
617
|
-
|
|
618
|
-
name: "close",
|
|
659
|
+
default: F(() => [
|
|
660
|
+
$(W, {
|
|
661
|
+
name: "/images/svg/close.svg",
|
|
619
662
|
color: "#999999"
|
|
620
663
|
})
|
|
621
664
|
]),
|
|
@@ -624,83 +667,84 @@ const D = /* @__PURE__ */ J(Re, [["render", $e], ["__scopeId", "data-v-349f049f"
|
|
|
624
667
|
])
|
|
625
668
|
])
|
|
626
669
|
]),
|
|
627
|
-
|
|
628
|
-
|
|
670
|
+
k("div", qe, [
|
|
671
|
+
L.value ? (P(), O("div", {
|
|
629
672
|
key: 1,
|
|
630
673
|
class: "chat-messages",
|
|
631
674
|
ref_key: "messageContainerRef",
|
|
632
|
-
ref:
|
|
675
|
+
ref: E
|
|
633
676
|
}, [
|
|
634
|
-
(P(!0),
|
|
635
|
-
key:
|
|
636
|
-
class:
|
|
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"])
|
|
637
680
|
}, [
|
|
638
|
-
|
|
681
|
+
R.type === "ai" ? (P(), J(Ie, {
|
|
639
682
|
key: 0,
|
|
640
683
|
ref_for: !0,
|
|
641
|
-
ref: (
|
|
642
|
-
reader:
|
|
643
|
-
"onUpdate:reader": (
|
|
644
|
-
model:
|
|
645
|
-
displayText:
|
|
646
|
-
scrollToBottomFn:
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
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))
|
|
651
695
|
], 2))), 128))
|
|
652
|
-
], 512)) : (P(),
|
|
653
|
-
w[2] || (w[2] =
|
|
654
|
-
|
|
655
|
-
src:
|
|
696
|
+
], 512)) : (P(), O("div", Fe, [
|
|
697
|
+
w[2] || (w[2] = k("div", { class: "title" }, [
|
|
698
|
+
k("img", {
|
|
699
|
+
src: ve,
|
|
656
700
|
alt: "AI助手",
|
|
657
701
|
class: "panel-icon"
|
|
658
702
|
}),
|
|
659
|
-
|
|
703
|
+
k("h3", { class: "title-text" }, "Hi, 您好")
|
|
660
704
|
], -1)),
|
|
661
|
-
|
|
662
|
-
w[1] || (w[1] =
|
|
663
|
-
|
|
705
|
+
k("div", Be, [
|
|
706
|
+
w[1] || (w[1] = ue(" 我是", -1)),
|
|
707
|
+
k("span", De, V(t.title), 1)
|
|
664
708
|
]),
|
|
665
|
-
|
|
666
|
-
(P(!0),
|
|
667
|
-
key:
|
|
709
|
+
k("div", Ve, [
|
|
710
|
+
(P(!0), O(G, null, Y(A.value, (R, U) => (P(), O("div", {
|
|
711
|
+
key: U,
|
|
668
712
|
class: "question-item",
|
|
669
|
-
onClick: (
|
|
713
|
+
onClick: (z) => x(R)
|
|
670
714
|
}, [
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
default:
|
|
674
|
-
|
|
675
|
-
name: "arrow-right",
|
|
715
|
+
k("span", null, V(R), 1),
|
|
716
|
+
$(T, null, {
|
|
717
|
+
default: F(() => [
|
|
718
|
+
$(W, {
|
|
719
|
+
name: "/images/svg/arrow-right.svg",
|
|
676
720
|
color: "#999999"
|
|
677
721
|
})
|
|
678
722
|
]),
|
|
679
723
|
_: 1
|
|
680
724
|
})
|
|
681
|
-
], 8,
|
|
725
|
+
], 8, We))), 128))
|
|
682
726
|
])
|
|
683
727
|
]))
|
|
684
728
|
]),
|
|
685
|
-
|
|
686
|
-
f.value ? (P(),
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
modelValue:
|
|
690
|
-
"onUpdate:modelValue": w[0] || (w[0] = (
|
|
729
|
+
k("div", Je, [
|
|
730
|
+
f.value ? (P(), O("img", Qe)) : D("", !0),
|
|
731
|
+
k("div", Ke, [
|
|
732
|
+
$(I, {
|
|
733
|
+
modelValue: h.value,
|
|
734
|
+
"onUpdate:modelValue": w[0] || (w[0] = (R) => h.value = R),
|
|
691
735
|
ref_key: "refInputTextString",
|
|
692
|
-
ref:
|
|
736
|
+
ref: y,
|
|
693
737
|
placeholder: "请输入您的问题",
|
|
694
738
|
autofocus: "",
|
|
695
|
-
onKeyup:
|
|
739
|
+
onKeyup: fe(c, ["enter"])
|
|
696
740
|
}, {
|
|
697
|
-
append:
|
|
698
|
-
|
|
741
|
+
append: F(() => [
|
|
742
|
+
k("div", {
|
|
699
743
|
class: "send-icon-box",
|
|
700
|
-
onClick:
|
|
744
|
+
onClick: c
|
|
701
745
|
}, [
|
|
702
|
-
|
|
703
|
-
src:
|
|
746
|
+
k("img", {
|
|
747
|
+
src: u.value,
|
|
704
748
|
alt: "发送",
|
|
705
749
|
class: "send-icon"
|
|
706
750
|
}, null, 8, Xe)
|
|
@@ -710,226 +754,226 @@ const D = /* @__PURE__ */ J(Re, [["render", $e], ["__scopeId", "data-v-349f049f"
|
|
|
710
754
|
}, 8, ["modelValue"])
|
|
711
755
|
])
|
|
712
756
|
])
|
|
713
|
-
], 2)) :
|
|
757
|
+
], 2)) : D("", !0)
|
|
714
758
|
]),
|
|
715
759
|
_: 1
|
|
716
760
|
});
|
|
717
761
|
};
|
|
718
762
|
}
|
|
719
|
-
}
|
|
763
|
+
};
|
|
720
764
|
var se = { exports: {} };
|
|
721
|
-
(function(
|
|
722
|
-
(function(
|
|
723
|
-
|
|
765
|
+
(function(t, n) {
|
|
766
|
+
(function(o, a) {
|
|
767
|
+
t.exports = a();
|
|
724
768
|
})(window, function() {
|
|
725
|
-
return function(
|
|
726
|
-
var
|
|
727
|
-
function
|
|
728
|
-
if (
|
|
729
|
-
var
|
|
730
|
-
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;
|
|
731
775
|
}
|
|
732
|
-
return
|
|
733
|
-
|
|
734
|
-
},
|
|
735
|
-
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(
|
|
736
|
-
},
|
|
737
|
-
if (1 &
|
|
738
|
-
var
|
|
739
|
-
if (
|
|
740
|
-
return
|
|
741
|
-
}).bind(null,
|
|
742
|
-
return
|
|
743
|
-
},
|
|
744
|
-
var
|
|
745
|
-
return
|
|
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) {
|
|
779
|
+
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
|
|
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];
|
|
785
|
+
}).bind(null, h));
|
|
786
|
+
return v;
|
|
787
|
+
}, r.n = function(e) {
|
|
788
|
+
var i = e && e.__esModule ? function() {
|
|
789
|
+
return e.default;
|
|
746
790
|
} : function() {
|
|
747
|
-
return
|
|
791
|
+
return e;
|
|
748
792
|
};
|
|
749
|
-
return
|
|
750
|
-
},
|
|
751
|
-
return Object.prototype.hasOwnProperty.call(
|
|
752
|
-
},
|
|
753
|
-
}([function(
|
|
754
|
-
function
|
|
755
|
-
|
|
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] || []));
|
|
756
800
|
}
|
|
757
|
-
function
|
|
801
|
+
function i(f, u) {
|
|
758
802
|
if (!f) throw new Error("[getMaxDepsChain] dep 参数不能为空");
|
|
759
|
-
var
|
|
760
|
-
for (
|
|
761
|
-
var
|
|
762
|
-
if (
|
|
763
|
-
var p =
|
|
764
|
-
if (
|
|
765
|
-
|
|
766
|
-
} 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();
|
|
767
811
|
}
|
|
768
|
-
return
|
|
769
|
-
return
|
|
812
|
+
return d.reduce(function(S, x) {
|
|
813
|
+
return x.length > S.length ? x : S;
|
|
770
814
|
}, []);
|
|
771
815
|
}
|
|
772
|
-
function
|
|
816
|
+
function v(f) {
|
|
773
817
|
if (!f) throw new Error("[depsParser] 入参不能为空");
|
|
774
|
-
var
|
|
775
|
-
f.forEach(function(
|
|
776
|
-
|
|
818
|
+
var u = {};
|
|
819
|
+
f.forEach(function(l) {
|
|
820
|
+
u[l.name] = l.deps || [];
|
|
777
821
|
});
|
|
778
|
-
var
|
|
779
|
-
return f.forEach(function(
|
|
780
|
-
var
|
|
781
|
-
|
|
782
|
-
}),
|
|
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;
|
|
783
827
|
}
|
|
784
|
-
|
|
785
|
-
return
|
|
786
|
-
}),
|
|
787
|
-
return k;
|
|
788
|
-
}), s.d(i, "dynamicLoadScripts", function() {
|
|
789
|
-
return $;
|
|
790
|
-
}), s.d(i, "createScriptsLoadIterator", function() {
|
|
791
|
-
return I;
|
|
792
|
-
}), s.d(i, "loadScriptsQueue", function() {
|
|
793
|
-
return U;
|
|
794
|
-
}), s.d(i, "getMaxDepsChain", function() {
|
|
795
|
-
return d;
|
|
796
|
-
}), s.d(i, "depsParser", function() {
|
|
828
|
+
r.r(a), r.d(a, "loadScript", function() {
|
|
829
|
+
return A;
|
|
830
|
+
}), r.d(a, "loadScripts", function() {
|
|
797
831
|
return _;
|
|
832
|
+
}), r.d(a, "dynamicLoadScripts", function() {
|
|
833
|
+
return j;
|
|
834
|
+
}), r.d(a, "createScriptsLoadIterator", function() {
|
|
835
|
+
return E;
|
|
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;
|
|
798
842
|
});
|
|
799
|
-
var
|
|
800
|
-
return (
|
|
801
|
-
for (var
|
|
843
|
+
var h = function() {
|
|
844
|
+
return (h = Object.assign || function(f) {
|
|
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]);
|
|
802
846
|
return f;
|
|
803
847
|
}).apply(this, arguments);
|
|
804
|
-
},
|
|
805
|
-
return new (
|
|
806
|
-
function p(
|
|
848
|
+
}, y = function(f, u, d, l) {
|
|
849
|
+
return new (d || (d = Promise))(function(s, g) {
|
|
850
|
+
function p(b) {
|
|
807
851
|
try {
|
|
808
|
-
|
|
809
|
-
} catch (
|
|
810
|
-
|
|
852
|
+
x(l.next(b));
|
|
853
|
+
} catch (c) {
|
|
854
|
+
g(c);
|
|
811
855
|
}
|
|
812
856
|
}
|
|
813
|
-
function
|
|
857
|
+
function S(b) {
|
|
814
858
|
try {
|
|
815
|
-
|
|
816
|
-
} catch (
|
|
817
|
-
|
|
859
|
+
x(l.throw(b));
|
|
860
|
+
} catch (c) {
|
|
861
|
+
g(c);
|
|
818
862
|
}
|
|
819
863
|
}
|
|
820
|
-
function b
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
m(
|
|
824
|
-
})).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);
|
|
825
869
|
}
|
|
826
|
-
|
|
870
|
+
x((l = l.apply(f, [])).next());
|
|
827
871
|
});
|
|
828
|
-
},
|
|
829
|
-
var
|
|
830
|
-
if (1 &
|
|
831
|
-
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];
|
|
832
876
|
}, trys: [], ops: [] };
|
|
833
|
-
return
|
|
877
|
+
return g = { next: S(0), throw: S(1), return: S(2) }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
|
|
834
878
|
return this;
|
|
835
|
-
}),
|
|
836
|
-
function x
|
|
837
|
-
return function(
|
|
838
|
-
return function(
|
|
839
|
-
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.");
|
|
840
884
|
for (; p; ) try {
|
|
841
|
-
if (
|
|
842
|
-
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]) {
|
|
843
887
|
case 0:
|
|
844
888
|
case 1:
|
|
845
|
-
|
|
889
|
+
s = c;
|
|
846
890
|
break;
|
|
847
891
|
case 4:
|
|
848
|
-
return p.label++, { value:
|
|
892
|
+
return p.label++, { value: c[1], done: !1 };
|
|
849
893
|
case 5:
|
|
850
|
-
p.label++,
|
|
894
|
+
p.label++, l = c[1], c = [0];
|
|
851
895
|
continue;
|
|
852
896
|
case 7:
|
|
853
|
-
|
|
897
|
+
c = p.ops.pop(), p.trys.pop();
|
|
854
898
|
continue;
|
|
855
899
|
default:
|
|
856
|
-
if (
|
|
900
|
+
if (s = p.trys, !((s = s.length > 0 && s[s.length - 1]) || c[0] !== 6 && c[0] !== 2)) {
|
|
857
901
|
p = 0;
|
|
858
902
|
continue;
|
|
859
903
|
}
|
|
860
|
-
if (
|
|
861
|
-
p.label =
|
|
904
|
+
if (c[0] === 3 && (!s || c[1] > s[0] && c[1] < s[3])) {
|
|
905
|
+
p.label = c[1];
|
|
862
906
|
break;
|
|
863
907
|
}
|
|
864
|
-
if (
|
|
865
|
-
p.label =
|
|
908
|
+
if (c[0] === 6 && p.label < s[1]) {
|
|
909
|
+
p.label = s[1], s = c;
|
|
866
910
|
break;
|
|
867
911
|
}
|
|
868
|
-
if (
|
|
869
|
-
p.label =
|
|
912
|
+
if (s && p.label < s[2]) {
|
|
913
|
+
p.label = s[2], p.ops.push(c);
|
|
870
914
|
break;
|
|
871
915
|
}
|
|
872
|
-
|
|
916
|
+
s[2] && p.ops.pop(), p.trys.pop();
|
|
873
917
|
continue;
|
|
874
918
|
}
|
|
875
|
-
|
|
919
|
+
c = u.call(f, p);
|
|
876
920
|
} catch (m) {
|
|
877
|
-
|
|
921
|
+
c = [6, m], l = 0;
|
|
878
922
|
} finally {
|
|
879
|
-
|
|
923
|
+
d = s = 0;
|
|
880
924
|
}
|
|
881
|
-
if (5 &
|
|
882
|
-
return { value:
|
|
883
|
-
}([
|
|
925
|
+
if (5 & c[0]) throw c[1];
|
|
926
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
927
|
+
}([x, b]);
|
|
884
928
|
};
|
|
885
929
|
}
|
|
886
|
-
},
|
|
930
|
+
}, N = function(f) {
|
|
887
931
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
888
|
-
var
|
|
889
|
-
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() {
|
|
890
934
|
return this;
|
|
891
|
-
},
|
|
892
|
-
function
|
|
893
|
-
|
|
894
|
-
return new Promise(function(p,
|
|
895
|
-
(function(
|
|
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) {
|
|
896
940
|
Promise.resolve(m).then(function(w) {
|
|
897
|
-
|
|
898
|
-
},
|
|
899
|
-
})(p,
|
|
941
|
+
x({ value: w, done: c });
|
|
942
|
+
}, b);
|
|
943
|
+
})(p, S, (g = f[s](g)).done, g.value);
|
|
900
944
|
});
|
|
901
945
|
};
|
|
902
946
|
}
|
|
903
947
|
};
|
|
904
|
-
function
|
|
905
|
-
return
|
|
906
|
-
var
|
|
907
|
-
|
|
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);
|
|
908
952
|
});
|
|
909
953
|
}
|
|
910
|
-
var
|
|
911
|
-
return
|
|
912
|
-
var
|
|
913
|
-
return
|
|
914
|
-
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) {
|
|
915
959
|
case 0:
|
|
916
|
-
return
|
|
917
|
-
return
|
|
918
|
-
var
|
|
919
|
-
return
|
|
920
|
-
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) {
|
|
921
965
|
case 0:
|
|
922
|
-
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];
|
|
923
967
|
case 1:
|
|
924
|
-
return
|
|
925
|
-
|
|
926
|
-
}),
|
|
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() {
|
|
927
971
|
return w;
|
|
928
972
|
}).catch(function() {
|
|
929
973
|
return T;
|
|
930
974
|
})] : [3, 3];
|
|
931
975
|
case 2:
|
|
932
|
-
return [2,
|
|
976
|
+
return [2, z.sent()];
|
|
933
977
|
case 3:
|
|
934
978
|
return [2, T];
|
|
935
979
|
}
|
|
@@ -937,50 +981,50 @@ var se = { exports: {} };
|
|
|
937
981
|
});
|
|
938
982
|
}))];
|
|
939
983
|
case 1:
|
|
940
|
-
return [2,
|
|
984
|
+
return [2, S.sent()];
|
|
941
985
|
}
|
|
942
986
|
});
|
|
943
987
|
});
|
|
944
|
-
},
|
|
945
|
-
return
|
|
946
|
-
var
|
|
988
|
+
}, j = function(f, u) {
|
|
989
|
+
return u === void 0 && (u = {}), function() {
|
|
990
|
+
var d = [].concat(v(f));
|
|
947
991
|
return { next: function() {
|
|
948
|
-
if (
|
|
949
|
-
var
|
|
950
|
-
return
|
|
951
|
-
return { value:
|
|
992
|
+
if (d.length) {
|
|
993
|
+
var l = d.shift();
|
|
994
|
+
return _(l, u).then(function(s) {
|
|
995
|
+
return { value: s, done: !1 };
|
|
952
996
|
});
|
|
953
997
|
}
|
|
954
998
|
return Promise.resolve({ done: !0 });
|
|
955
999
|
} };
|
|
956
1000
|
};
|
|
957
|
-
},
|
|
958
|
-
var
|
|
959
|
-
return
|
|
960
|
-
},
|
|
961
|
-
return
|
|
962
|
-
var
|
|
963
|
-
return
|
|
964
|
-
switch (
|
|
1001
|
+
}, E = function(f, u) {
|
|
1002
|
+
var d;
|
|
1003
|
+
return u === void 0 && (u = {}), (d = {})[Symbol.asyncIterator] = j(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) {
|
|
965
1009
|
case 0:
|
|
966
|
-
|
|
1010
|
+
x.trys.push([0, 5, 6, 11]), d = N(E(f, u)), x.label = 1;
|
|
967
1011
|
case 1:
|
|
968
|
-
return [4,
|
|
1012
|
+
return [4, d.next()];
|
|
969
1013
|
case 2:
|
|
970
|
-
if ((
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
}),
|
|
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;
|
|
974
1018
|
case 3:
|
|
975
1019
|
return [3, 1];
|
|
976
1020
|
case 4:
|
|
977
1021
|
return [3, 11];
|
|
978
1022
|
case 5:
|
|
979
|
-
return
|
|
1023
|
+
return g = x.sent(), p = { error: g }, [3, 11];
|
|
980
1024
|
case 6:
|
|
981
|
-
return
|
|
1025
|
+
return x.trys.push([6, , 9, 10]), l && !l.done && (S = d.return) ? [4, S.call(d)] : [3, 8];
|
|
982
1026
|
case 7:
|
|
983
|
-
|
|
1027
|
+
x.sent(), x.label = 8;
|
|
984
1028
|
case 8:
|
|
985
1029
|
return [3, 10];
|
|
986
1030
|
case 9:
|
|
@@ -989,7 +1033,7 @@ var se = { exports: {} };
|
|
|
989
1033
|
case 10:
|
|
990
1034
|
return [7];
|
|
991
1035
|
case 11:
|
|
992
|
-
return [2,
|
|
1036
|
+
return [2, u.lastLoadResult];
|
|
993
1037
|
}
|
|
994
1038
|
});
|
|
995
1039
|
});
|
|
@@ -997,15 +1041,15 @@ var se = { exports: {} };
|
|
|
997
1041
|
}]);
|
|
998
1042
|
});
|
|
999
1043
|
})(se);
|
|
1000
|
-
var
|
|
1001
|
-
const
|
|
1044
|
+
var Ye = se.exports;
|
|
1045
|
+
const Ze = {
|
|
1002
1046
|
key: 0,
|
|
1003
1047
|
class: "ai-assistant"
|
|
1004
|
-
},
|
|
1048
|
+
}, et = {
|
|
1005
1049
|
name: "AiChat"
|
|
1006
1050
|
//这个⾮常重要,就是未来你放到其他项⽬中,组件标签的名字,⽐如:<sz-workflow></sz-workflow>
|
|
1007
|
-
},
|
|
1008
|
-
...
|
|
1051
|
+
}, tt = /* @__PURE__ */ pe({
|
|
1052
|
+
...et,
|
|
1009
1053
|
props: {
|
|
1010
1054
|
token: {
|
|
1011
1055
|
type: String,
|
|
@@ -1022,16 +1066,26 @@ const nt = {
|
|
|
1022
1066
|
title: {
|
|
1023
1067
|
type: String,
|
|
1024
1068
|
default: "数智AI助理"
|
|
1069
|
+
},
|
|
1070
|
+
/**
|
|
1071
|
+
* 消息后处理回调函数
|
|
1072
|
+
* 在 AI 消息渲染完成后调用,可用于自定义处理渲染后的内容
|
|
1073
|
+
* @param container - 消息容器的 DOM 元素
|
|
1074
|
+
* @param textContent - 消息的文本内容
|
|
1075
|
+
*/
|
|
1076
|
+
messagePostRender: {
|
|
1077
|
+
type: Function,
|
|
1078
|
+
default: null
|
|
1025
1079
|
}
|
|
1026
1080
|
},
|
|
1027
|
-
setup(
|
|
1028
|
-
const n = C(!1),
|
|
1081
|
+
setup(t) {
|
|
1082
|
+
const n = C(!1), o = C(!1), a = () => {
|
|
1029
1083
|
n.value = !n.value;
|
|
1030
|
-
},
|
|
1031
|
-
|
|
1032
|
-
},
|
|
1033
|
-
console.log("用户输入:",
|
|
1034
|
-
},
|
|
1084
|
+
}, r = () => {
|
|
1085
|
+
o.value = !0, n.value = !1;
|
|
1086
|
+
}, e = (h) => {
|
|
1087
|
+
console.log("用户输入:", h);
|
|
1088
|
+
}, i = [
|
|
1035
1089
|
{
|
|
1036
1090
|
name: "markdownit",
|
|
1037
1091
|
path: "markdown-it.min.js"
|
|
@@ -1041,105 +1095,155 @@ const nt = {
|
|
|
1041
1095
|
path: "highlight.11.11.1.min.js"
|
|
1042
1096
|
}
|
|
1043
1097
|
];
|
|
1044
|
-
let
|
|
1045
|
-
return
|
|
1098
|
+
let v = {};
|
|
1099
|
+
return Ye.loadScriptsQueue(i, {
|
|
1046
1100
|
baseUrl: "/scripts/ai/",
|
|
1047
|
-
lastLoadResult:
|
|
1101
|
+
lastLoadResult: v,
|
|
1048
1102
|
inHead: !1
|
|
1049
|
-
}).then((
|
|
1050
|
-
if (console.log("load ai deps: ",
|
|
1051
|
-
const
|
|
1052
|
-
console.log("markdownit: ",
|
|
1103
|
+
}).then((h) => {
|
|
1104
|
+
if (console.log("load ai deps: ", h), window.markdownit) {
|
|
1105
|
+
const y = window.markdownit();
|
|
1106
|
+
console.log("markdownit: ", y), Ne();
|
|
1053
1107
|
}
|
|
1054
|
-
}), (
|
|
1055
|
-
|
|
1108
|
+
}), (h, y) => o.value ? D("", !0) : (P(), O("div", Ze, [
|
|
1109
|
+
$(Ge, {
|
|
1056
1110
|
modelValue: n.value,
|
|
1057
|
-
"onUpdate:modelValue":
|
|
1058
|
-
onSubmit:
|
|
1059
|
-
token:
|
|
1060
|
-
identifier:
|
|
1061
|
-
baseUrl:
|
|
1062
|
-
title:
|
|
1063
|
-
|
|
1064
|
-
|
|
1111
|
+
"onUpdate:modelValue": y[0] || (y[0] = (L) => n.value = L),
|
|
1112
|
+
onSubmit: e,
|
|
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", {
|
|
1065
1120
|
class: "ai-icon",
|
|
1066
|
-
onClick:
|
|
1121
|
+
onClick: a
|
|
1067
1122
|
}, [
|
|
1068
|
-
|
|
1123
|
+
k("div", {
|
|
1069
1124
|
class: "close-icon",
|
|
1070
|
-
onClick: me(
|
|
1071
|
-
},
|
|
1072
|
-
|
|
1125
|
+
onClick: me(r, ["stop"])
|
|
1126
|
+
}, [...y[1] || (y[1] = [
|
|
1127
|
+
k("svg", {
|
|
1073
1128
|
viewBox: "0 0 1024 1024",
|
|
1074
1129
|
width: "8",
|
|
1075
1130
|
height: "8"
|
|
1076
1131
|
}, [
|
|
1077
|
-
|
|
1132
|
+
k("path", {
|
|
1078
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",
|
|
1079
1134
|
fill: "currentColor"
|
|
1080
1135
|
})
|
|
1081
1136
|
], -1)
|
|
1082
|
-
])),
|
|
1083
|
-
|
|
1084
|
-
src:
|
|
1137
|
+
])]),
|
|
1138
|
+
y[2] || (y[2] = k("img", {
|
|
1139
|
+
src: he,
|
|
1085
1140
|
alt: "AI助手"
|
|
1086
1141
|
}, null, -1)),
|
|
1087
|
-
|
|
1142
|
+
y[3] || (y[3] = k("span", { class: "ai-icon-text" }, "AI助手", -1))
|
|
1088
1143
|
])
|
|
1089
1144
|
]));
|
|
1090
1145
|
}
|
|
1091
|
-
}),
|
|
1092
|
-
if (typeof window < "u") {
|
|
1093
|
-
let e = function() {
|
|
1094
|
-
var n = document.body, r = document.getElementById("__svg__icons__dom__");
|
|
1095
|
-
r || (r = document.createElementNS("http://www.w3.org/2000/svg", "svg"), r.style.position = "absolute", r.style.width = "0", r.style.height = "0", r.id = "__svg__icons__dom__", r.setAttribute("xmlns", "http://www.w3.org/2000/svg"), r.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink")), r.innerHTML = '<symbol viewBox="0 0 16 16" id="icon-arrow-right"><g fill="none" fill-rule="evenodd"><path d="M0 0h16v16H0Z" /><path d="m8.44 3.854.706-.707 4.642 4.641a.3.3 0 0 1 0 .424l-4.642 4.642-.707-.708L12.086 8.5H2v-1h10.086L8.439 3.854Z" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 24 24" id="icon-close"><g fill="none" fill-rule="evenodd"><path d="M0 0h24v24H0z" /><path d="m12.865 12 3.956-3.955a.61.61 0 1 0-.864-.864L12 11.135 8.043 7.179a.61.61 0 1 0-.863.864L11.134 12 7.18 15.956a.61.61 0 1 0 .864.864L12 12.864l3.957 3.957c.12.12.275.179.432.179a.61.61 0 0 0 .432-1.042L12.865 12Z" fill-opacity=".65" fill="currentColor" fill-rule="nonzero" /></g></symbol><symbol viewBox="0 0 32 32" id="icon-copy"><path fill="currentColor" d="m27.4 14.7-6.1-6.1C21 8.2 20.5 8 20 8h-8c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V16.1c0-.5-.2-1-.6-1.4M20 10l5.9 6H20zm-8 18V10h6v6c0 1.1.9 2 2 2h6v10z" /><path fill="currentColor" d="M6 18H4V4c0-1.1.9-2 2-2h14v2H6z" /></symbol><symbol viewBox="0 0 24 24" id="icon-drawer-layout"><path d="M4.813 4.188a.624.624 0 0 0-.625.625v14.375c0 .345.279.625.625.625h14.375c.345 0 .625-.28.625-.625V4.813a.624.624 0 0 0-.625-.625ZM15.75 5.593h2.656v12.812H15.75V5.594Zm-10.156 0H14.5v12.812H5.594V5.594Z" fill="#999" fill-rule="nonzero" /></symbol>', n.insertBefore(r, n.lastChild);
|
|
1096
|
-
};
|
|
1097
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
|
|
1098
|
-
}
|
|
1099
|
-
const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1146
|
+
}), nt = /* @__PURE__ */ ae(tt, [["__scopeId", "data-v-a4639f2d"]]), te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1100
1147
|
__proto__: null,
|
|
1101
|
-
SzAiChat:
|
|
1102
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1103
|
-
if (!
|
|
1104
|
-
|
|
1148
|
+
SzAiChat: nt
|
|
1149
|
+
}, Symbol.toStringTag, { value: "Module" })), Q = function(t) {
|
|
1150
|
+
if (!Q.installed) {
|
|
1151
|
+
Q.installed = !0;
|
|
1105
1152
|
for (let n in te) {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1153
|
+
const o = Reflect.get(te, n);
|
|
1154
|
+
t.component(o.name, o);
|
|
1108
1155
|
}
|
|
1109
1156
|
}
|
|
1110
|
-
},
|
|
1111
|
-
|
|
1112
|
-
|
|
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
|
+
lt(t).forEach(({ node: r, replacements: e }) => {
|
|
1200
|
+
var v;
|
|
1201
|
+
const i = document.createDocumentFragment();
|
|
1202
|
+
e.forEach(({ text: h, routeName: y }) => {
|
|
1203
|
+
if (y) {
|
|
1204
|
+
const L = st(h, y, o);
|
|
1205
|
+
i.appendChild(L);
|
|
1206
|
+
} else
|
|
1207
|
+
i.appendChild(document.createTextNode(h));
|
|
1208
|
+
}), (v = r.parentNode) == null || v.replaceChild(i, r);
|
|
1209
|
+
});
|
|
1210
|
+
}, it = "0.1.3", ct = "Sz";
|
|
1211
|
+
function ft({
|
|
1212
|
+
componentPrefix: t = ct,
|
|
1113
1213
|
components: n = []
|
|
1114
1214
|
} = {}) {
|
|
1115
|
-
const
|
|
1116
|
-
function
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1215
|
+
const o = [];
|
|
1216
|
+
function a(e, i, v) {
|
|
1217
|
+
e.component(t + i) || e.component(
|
|
1218
|
+
t + i,
|
|
1219
|
+
v
|
|
1120
1220
|
);
|
|
1121
1221
|
}
|
|
1122
|
-
function
|
|
1123
|
-
|
|
1124
|
-
const { name:
|
|
1125
|
-
|
|
1126
|
-
|
|
1222
|
+
function r(e) {
|
|
1223
|
+
o.includes(e) || (o.push(e), n.forEach((i) => {
|
|
1224
|
+
const { name: v, alias: h } = i;
|
|
1225
|
+
a(e, v, i), h && h.forEach((y) => {
|
|
1226
|
+
a(e, y, i);
|
|
1127
1227
|
});
|
|
1128
1228
|
}));
|
|
1129
1229
|
}
|
|
1130
1230
|
return {
|
|
1131
|
-
version:
|
|
1132
|
-
componentPrefix:
|
|
1133
|
-
install:
|
|
1231
|
+
version: it,
|
|
1232
|
+
componentPrefix: t,
|
|
1233
|
+
install: r
|
|
1134
1234
|
};
|
|
1135
1235
|
}
|
|
1136
|
-
const
|
|
1137
|
-
install(
|
|
1138
|
-
|
|
1236
|
+
const pt = {
|
|
1237
|
+
install(t) {
|
|
1238
|
+
Q(t);
|
|
1139
1239
|
}
|
|
1140
1240
|
};
|
|
1141
1241
|
export {
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1242
|
+
nt as SzAiChat,
|
|
1243
|
+
ft as create,
|
|
1244
|
+
st as createRouteLink,
|
|
1245
|
+
pt as default,
|
|
1246
|
+
lt as findRouteTextNodes,
|
|
1247
|
+
at as parseRouteMarkers,
|
|
1248
|
+
dt as routeLinkRender
|
|
1145
1249
|
};
|