@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/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import { defineComponent as ne, computed as N, createElementBlock as R, openBlock as P, mergeProps as ie, createElementVNode as S, getCurrentInstance as re, ref as C, watch as ce, onUnmounted as ue, createBlock as Q, Transition as oe, withCtx as q, createCommentVNode as H, createVNode as E, nextTick as ae, resolveComponent as Z, normalizeClass as K, toDisplayString as F, createTextVNode as de, Fragment as G, renderList as X, unref as fe, withKeys as pe, withModifiers as me } from "vue";
2
- const ve = "/images/ai-round.png", he = "/images/ai-sqrt.png", ye = "/images/bars-loading.svg";
3
- function ge(e, n = location.href) {
4
- return new URLSearchParams(new URL(n).search).get(e);
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 we(e) {
7
- return e.startsWith("http://") || e.startsWith("https://") ? e : `${location.protocol}//${location.host}${e}`;
6
+ function be(t) {
7
+ return t.startsWith("http://") || t.startsWith("https://") ? t : `${location.protocol}//${location.host}${t}`;
8
8
  }
9
- async function be(e) {
10
- const n = new URL("http://localhost:11434/api/chat"), r = {};
11
- Object.keys(r).forEach((s) => {
12
- n.searchParams.append(s, r[s]);
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 i = new Request(n, {
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: e
30
+ content: t
31
31
  }
32
32
  ]
33
33
  })
34
34
  });
35
- return fetch(i);
35
+ return fetch(a);
36
36
  }
37
- async function _e(e, n) {
38
- const r = new URL(`${location.origin}/spark/v1/chat/completions`), i = {};
39
- Object.keys(i).forEach((t) => {
40
- r.searchParams.append(t, i[t]);
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 s = new Request(r, {
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: e
54
+ content: t
55
55
  }
56
56
  ]
57
57
  })
58
58
  });
59
- return fetch(s);
59
+ return fetch(r);
60
60
  }
61
- async function Se(e, n) {
62
- const r = new URL(`${location.origin}/siliconflow/v1/chat/completions`), i = {};
63
- Object.keys(i).forEach((t) => {
64
- r.searchParams.append(t, i[t]);
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 s = new Request(r, {
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: e
79
+ content: t
80
80
  }
81
81
  ]
82
82
  })
83
83
  });
84
- return fetch(s);
84
+ return fetch(r);
85
85
  }
86
- async function xe(e, n) {
87
- const r = new URL(`${location.origin}/moonshot/v1/chat/completions`), i = {};
88
- Object.keys(i).forEach((t) => {
89
- r.searchParams.append(t, i[t]);
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 s = new Request(r, {
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: e
107
+ content: t
108
108
  }
109
109
  ]
110
110
  })
111
111
  });
112
- return fetch(s);
112
+ return fetch(r);
113
113
  }
114
- async function ke(e, n) {
115
- const r = new URL(`${location.origin}/dashscope/compatible-mode/v1/chat/completions`), i = {};
116
- Object.keys(i).forEach((t) => {
117
- r.searchParams.append(t, i[t]);
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 s = new Request(r, {
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: e
135
+ content: t
136
136
  }
137
137
  ]
138
138
  })
139
139
  });
140
- return fetch(s);
140
+ return fetch(r);
141
141
  }
142
- async function Ce(e, n, r, i = "") {
143
- console.log(12342, n, r);
144
- const s = we(i), t = new URL(`${s}/support/${r}/a`), d = {};
145
- Object.keys(d).forEach((v) => {
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 _ = new Request(t, {
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: e
154
+ content: t
156
155
  })
157
156
  });
158
- return fetch(_);
157
+ return fetch(v);
159
158
  }
160
- const Te = (e) => {
161
- if (e.startsWith("data:")) {
162
- const n = e.substring(5).trim();
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 (r) {
170
- console.error("JSON parsing error:", r);
168
+ } catch (o) {
169
+ console.error("JSON parsing error:", o);
171
170
  }
172
171
  }
173
172
  return null;
174
- }, Le = [
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: _e
182
+ api: xe
184
183
  },
185
184
  {
186
185
  label: "Ollama 3 大模型",
187
186
  modelName: "ollama3",
188
- api: be
187
+ api: we
189
188
  },
190
189
  {
191
190
  label: "SiliconFlow 硅基流动大模型",
192
191
  modelName: "siliconflow",
193
- api: Se
192
+ api: ke
194
193
  },
195
194
  {
196
195
  label: "Kimi Moonshot 月之暗面大模型",
197
196
  modelName: "moonshot",
198
- api: xe
197
+ api: Se
199
198
  },
200
199
  {
201
200
  label: "通义千问大模型",
202
201
  modelName: "dashscope",
203
- api: ke
202
+ api: _e
204
203
  },
205
204
  {
206
205
  label: "数智建管大模型",
207
206
  modelName: "szjy",
208
207
  api: Ce
209
208
  }
210
- ], Y = {
211
- standard(e, n) {
212
- let r = "";
213
- return e instanceof Uint8Array ? r = n.decode(e, {
209
+ ], Z = {
210
+ standard(t, n) {
211
+ let o = "";
212
+ return t instanceof Uint8Array ? o = n.decode(t, {
214
213
  stream: !0
215
- }) : r = e, {
216
- content: r
214
+ }) : o = t, {
215
+ content: o
217
216
  };
218
217
  },
219
- spark(e) {
220
- const n = Te(e);
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(e) {
228
- return this.spark(e);
226
+ siliconflow(t) {
227
+ return this.spark(t);
229
228
  },
230
- moonshot(e) {
231
- return this.spark(e);
229
+ moonshot(t) {
230
+ return this.spark(t);
232
231
  },
233
- dashscope(e) {
234
- return this.spark(e);
232
+ dashscope(t) {
233
+ return this.spark(t);
235
234
  },
236
- szjy(e) {
237
- return this.spark(e);
235
+ szjy(t) {
236
+ return this.spark(t);
238
237
  },
239
- ollama3(e) {
238
+ ollama3(t) {
240
239
  return {
241
- content: JSON.parse(e).message.content
240
+ content: JSON.parse(t).message.content
242
241
  };
243
242
  }
244
- }, ee = (e, n, r) => {
245
- const i = e.split(r);
246
- return i.slice(0, -1).forEach((s) => {
247
- s.trim() !== "" && n.enqueue(s);
248
- }), i[i.length - 1];
249
- }, Pe = (e) => {
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(r, i) {
253
- if (n += r, n.trim().startsWith("data:"))
254
- n = ee(n, i, e);
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, i, e);
256
+ JSON.parse(n), n = ee(n, a, t);
258
257
  } catch {
259
- i.enqueue(r), n = "";
258
+ a.enqueue(o), n = "";
260
259
  }
261
260
  },
262
- flush(r) {
263
- n.trim() !== "" && r.enqueue(n);
261
+ flush(o) {
262
+ n.trim() !== "" && o.enqueue(n);
264
263
  }
265
264
  });
266
265
  };
267
- async function Oe(e, n) {
268
- const r = e.api;
269
- return r ? new Promise((i) => {
270
- r(n.text, n.token, n.identifier, n.baseUrl).then((s) => {
271
- if (s.body) {
272
- const t = s.body.pipeThrough(new TextDecoderStream()).pipeThrough(Pe(`
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:", t), i({
273
+ console.log("reader from response:", e), a({
275
274
  error: 0,
276
- reader: t
275
+ reader: e
277
276
  });
278
277
  } else
279
- i({
278
+ a({
280
279
  error: 1,
281
280
  reader: null
282
281
  });
283
- }).catch((s) => {
284
- i({
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 V = null;
295
- function ze() {
296
- return V || (window.markdownit ? V = new window.markdownit({
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"), V);
299
+ }) : console.log("markdownit is not loaded"), B);
301
300
  }
302
- const J = (e, n) => {
303
- const r = e.__vccOpts || e;
304
- for (const [i, s] of n)
305
- r[i] = s;
306
- return r;
307
- }, Re = ne({
308
- name: "SvgIcon",
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
- prefix: {
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: "#333"
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(e) {
324
- const n = N(() => `#${e.prefix}-${e.name}`), r = N(() => e.name ? `svg-icon icon-${e.name}` : "svg-icon");
325
- return { symbolId: n, svgClass: r };
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
- }), Me = ["xlink:href", "fill"];
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(e);
371
+ await navigator.clipboard.writeText(t);
342
372
  else {
343
373
  const n = document.createElement("textArea");
344
- n.value = e, 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);
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
- }, Ae = ["innerHTML"], je = {
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(e, { expose: n, emit: r }) {
360
- const { appContext: i } = re(), { $message: s } = i.config.globalProperties, t = e, d = C(t.displayText || ""), _ = C(""), v = C(!0), g = C(!1), z = C(!!t.displayText), O = r, B = C(null);
361
- let k = null;
362
- const $ = N(() => V ? V.render(d.value) : d.value), I = () => {
363
- t.reader && t.reader.cancel(), g.value = !0, a.value = !1, u(), z.value = !0, O("completed", d.value), v.value = !1, k && (cancelAnimationFrame(k), k = null);
364
- }, U = N(() => `${$.value}`), f = C(!1), c = () => {
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
- }, u = () => {
400
+ }, d = () => {
367
401
  f.value = !1;
368
- }, a = C(!1), o = async () => {
369
- if (!t.reader) return;
370
- const y = new TextDecoder("utf-8");
371
- for (v.value = !0; !g.value; )
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 (!t.reader) {
374
- a.value = !0;
407
+ if (!e.reader) {
408
+ l.value = !0;
375
409
  break;
376
410
  }
377
- const { value: l, done: m } = await t.reader.read();
378
- if (!t.reader) {
379
- a.value = !0;
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
- a.value = !0;
417
+ l.value = !0;
384
418
  break;
385
419
  }
386
- const w = Y[t.model];
420
+ const w = Z[e.model];
387
421
  if (!w)
388
422
  break;
389
- const T = w.call(Y, l, y);
423
+ const T = w.call(Z, c, b);
390
424
  if (T.done) {
391
- a.value = !0;
425
+ l.value = !0;
392
426
  break;
393
427
  }
394
- _.value += T.content, k === null && x();
395
- } catch (l) {
396
- a.value = !0, console.log(3333, l), O("failed", l), I();
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
- u();
433
+ d();
400
434
  }
401
- }, h = async () => {
402
- t.scrollToBottomFn && t.scrollToBottomFn();
403
- }, p = (y = () => {
404
- }, l = () => {
435
+ }, g = async () => {
436
+ e.scrollToBottomFn && e.scrollToBottomFn();
437
+ }, p = (b = () => {
438
+ }, c = () => {
405
439
  }) => {
406
- if (_.value.length > 0) {
407
- const m = _.value.substring(0, 10);
408
- d.value += m, _.value = _.value.substring(10), y();
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
- l();
411
- }, x = () => {
412
- if (g.value && k) {
413
- cancelAnimationFrame(k), k = null, v.value = !1;
444
+ c();
445
+ }, S = () => {
446
+ if (y.value && _) {
447
+ cancelAnimationFrame(_), _ = null, h.value = !1;
414
448
  return;
415
449
  }
416
- a.value ? p(
450
+ l.value ? p(
417
451
  () => {
418
- k = requestAnimationFrame(x), O("updating", null);
452
+ _ = requestAnimationFrame(S), N("updating", null);
419
453
  },
420
454
  () => {
421
- O("completed", d.value), v.value = !1, z.value = !0, ae(() => {
422
- a.value = !1;
423
- }), k = null;
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(), k = requestAnimationFrame(x)), h();
464
+ ) : (p(), _ = requestAnimationFrame(S)), g();
426
465
  };
427
- ce(
428
- () => t.reader,
466
+ ie(
467
+ () => e.reader,
429
468
  () => {
430
- t.reader && o();
469
+ e.reader && s();
431
470
  },
432
471
  {
433
472
  immediate: !0,
434
473
  deep: !0
435
474
  }
436
- ), ue(() => {
437
- I();
475
+ ), ce(() => {
476
+ E();
438
477
  }), n({
439
- abortReader: I,
440
- initializeStart: c,
441
- initializeEnd: u
442
- }), N(() => f.value ? !0 : (!t.reader || !v || d.value, !1));
443
- const b = async () => {
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 y = d.value;
446
- await Ie(y), s.success("复制成功");
447
- } catch (y) {
448
- console.error("复制失败:", y), s.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 (y, l) => (P(), Q(oe, { name: "fade" }, {
452
- default: q(() => [
453
- U.value ? (P(), R("div", {
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: B,
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
- S("div", {
500
+ k("div", {
462
501
  class: "markdown-wrapper",
463
- innerHTML: U.value
464
- }, null, 8, Ae),
465
- z.value ? (P(), R("div", {
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: b
506
+ class: "ai-copy-btn-wrapper",
507
+ onClick: x
469
508
  }, [
470
- E(D, {
471
- name: "copy",
509
+ $(W, {
510
+ name: "/images/svg/copy.svg",
472
511
  color: "#666666"
473
512
  }),
474
- l[0] || (l[0] = S("span", { class: "copy-text" }, "复制", -1))
475
- ])) : H("", !0)
476
- ], 512)) : H("", !0)
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
- }, Ee = /* @__PURE__ */ J(je, [["__scopeId", "data-v-c3f65f53"]]), Ue = { class: "panel-header" }, Ne = { class: "header-actions" }, Be = { class: "header-title" }, qe = { class: "action-icons" }, Ve = { class: "body-content" }, He = {
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
- }, Fe = { class: "subtitle" }, De = { class: "highlight" }, Je = { class: "quick-questions" }, Qe = ["onClick"], We = {
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
- }, Ze = { class: "panel-footer" }, Ke = {
526
+ }, Je = { class: "panel-footer" }, Qe = {
488
527
  key: 0,
489
- src: ye,
528
+ src: ge,
490
529
  alt: "加载中",
491
530
  class: "loading-icon"
492
- }, Ge = { class: "input-box" }, Xe = ["src"], Ye = {
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(e, { emit: n }) {
518
- const { appContext: r } = re(), { $message: i } = r.config.globalProperties, s = ge("llmName") || "szjy", t = N(() => Le.find((m) => m.modelName === s)), d = e, _ = n, v = C(""), g = C(null), z = C(!1), O = C([]), B = C([
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
- ]), k = C([]), $ = C(!1), I = C(null), U = () => {
525
- ae(() => {
526
- if (I.value) {
527
- const m = I.value, w = m.scrollHeight, T = m.scrollTop, A = m.clientHeight;
528
- w - T - A < 100 ? m.scrollTop = w : m.scrollTo({
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), c = N(() => f.value ? "/images/ai-stop.png" : "/images/ai-send.png"), u = (m, w) => {
534
- console.log("onFailedReader", m, w), $.value = !1;
535
- const T = y();
536
- T && T.initializeEnd(), i.error("转换失败,请重试"), f.value = !1, setTimeout(() => {
537
- g.value && g.value.focus();
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
- }, a = (m, w) => {
540
- $.value = !1, f.value = !1, U(), w && O.value[m] && (O.value[m].displayText = w), setTimeout(() => {
541
- g.value && g.value.focus();
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
- }, o = (m) => {
586
+ }, s = (m) => {
544
587
  f.value = !0;
545
- }, h = () => {
546
- f.value = !1, _("update:modelValue", !1), z.value = !1, O.value = [];
547
- }, p = C(!1), x = () => {
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
- }, b = (m) => {
550
- v.value = m, l();
551
- }, y = () => {
552
- for (let m = k.value.length - 1; m >= 0; m--)
553
- if (k.value[m])
554
- return k.value[m];
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
- }, l = async () => {
557
- if (console.log("stylizingLoading:", $.value), $.value) {
558
- const L = y();
559
- console.log("lastPreviewer:", L), L && (console.log("abortReader"), L.abortReader());
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 (!v.value.trim()) {
563
- console.log("no input, return"), g.value.focus();
605
+ if (!h.value.trim()) {
606
+ console.log("no input, return"), y.value.focus();
564
607
  return;
565
608
  }
566
- O.value.push({
609
+ N.value.push({
567
610
  type: "user",
568
- content: v.value
569
- }), f.value = !0, z.value = !0, _("submit", v.value), U();
570
- const m = v.value;
571
- v.value = "";
572
- const w = O.value.length;
573
- k.value[w] && k.value[w].initializeStart(), $.value = !0, O.value.push({
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: A } = await Oe(t.value, {
619
+ const { error: T, reader: I } = await Le(e.value, {
577
620
  text: m,
578
- token: d.token,
579
- identifier: d.identifier,
580
- baseUrl: d.baseUrl
621
+ token: i.token,
622
+ identifier: i.identifier,
623
+ baseUrl: i.baseUrl
581
624
  });
582
625
  if (T) {
583
- console.log(45455, T), u(w, T);
626
+ console.log(45455, T), d(w, T);
584
627
  return;
585
628
  }
586
- A && (O.value[w].reader = A);
629
+ I && (N.value[w].reader = I);
587
630
  };
588
631
  return (m, w) => {
589
- const T = Z("el-icon"), A = Z("el-input");
590
- return P(), Q(oe, { name: "slide" }, {
591
- default: q(() => [
592
- e.modelValue ? (P(), R("div", {
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: K(["ai-panel", { "drawer-mode": p.value }])
637
+ class: H(["ai-panel", { "drawer-mode": p.value }])
595
638
  }, [
596
- S("div", Ue, [
597
- S("div", Ne, [
598
- S("div", Be, F(e.title), 1),
599
- S("div", qe, [
600
- E(T, {
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: x
645
+ onClick: S
603
646
  }, {
604
- default: q(() => [
605
- E(D, {
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
- E(T, {
655
+ $(T, {
613
656
  class: "action-icon",
614
- onClick: h
657
+ onClick: g
615
658
  }, {
616
- default: q(() => [
617
- E(D, {
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
- S("div", Ve, [
628
- z.value ? (P(), R("div", {
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: I
675
+ ref: E
633
676
  }, [
634
- (P(!0), R(G, null, X(O.value, (L, j) => (P(), R("div", {
635
- key: j,
636
- class: K(["message-item", L.type === "user" ? "user-message" : "ai-message"])
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
- L.type === "ai" ? (P(), Q(Ee, {
681
+ R.type === "ai" ? (P(), J(Ie, {
639
682
  key: 0,
640
683
  ref_for: !0,
641
- ref: (M) => k.value[j] = M,
642
- reader: L.reader,
643
- "onUpdate:reader": (M) => L.reader = M,
644
- model: fe(s),
645
- displayText: L.displayText,
646
- scrollToBottomFn: U,
647
- onFailed: (M) => u(j, M),
648
- onCompleted: (M) => a(j, M),
649
- onUpdating: () => o()
650
- }, null, 8, ["reader", "onUpdate:reader", "model", "displayText", "onFailed", "onCompleted", "onUpdating"])) : (P(), R("div", We, F(L.content), 1))
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(), R("div", He, [
653
- w[2] || (w[2] = S("div", { class: "title" }, [
654
- S("img", {
655
- src: he,
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
- S("h3", { class: "title-text" }, "Hi, 您好")
703
+ k("h3", { class: "title-text" }, "Hi, 您好")
660
704
  ], -1)),
661
- S("div", Fe, [
662
- w[1] || (w[1] = de(" 我是")),
663
- S("span", De, F(e.title), 1)
705
+ k("div", Be, [
706
+ w[1] || (w[1] = ue(" 我是", -1)),
707
+ k("span", De, V(t.title), 1)
664
708
  ]),
665
- S("div", Je, [
666
- (P(!0), R(G, null, X(B.value, (L, j) => (P(), R("div", {
667
- key: j,
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: (M) => b(L)
713
+ onClick: (z) => x(R)
670
714
  }, [
671
- S("span", null, F(L), 1),
672
- E(T, null, {
673
- default: q(() => [
674
- E(D, {
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, Qe))), 128))
725
+ ], 8, We))), 128))
682
726
  ])
683
727
  ]))
684
728
  ]),
685
- S("div", Ze, [
686
- f.value ? (P(), R("img", Ke)) : H("", !0),
687
- S("div", Ge, [
688
- E(A, {
689
- modelValue: v.value,
690
- "onUpdate:modelValue": w[0] || (w[0] = (L) => v.value = L),
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: g,
736
+ ref: y,
693
737
  placeholder: "请输入您的问题",
694
738
  autofocus: "",
695
- onKeyup: pe(l, ["enter"])
739
+ onKeyup: fe(c, ["enter"])
696
740
  }, {
697
- append: q(() => [
698
- S("div", {
741
+ append: F(() => [
742
+ k("div", {
699
743
  class: "send-icon-box",
700
- onClick: l
744
+ onClick: c
701
745
  }, [
702
- S("img", {
703
- src: c.value,
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)) : H("", !0)
757
+ ], 2)) : D("", !0)
714
758
  ]),
715
759
  _: 1
716
760
  });
717
761
  };
718
762
  }
719
- }, et = /* @__PURE__ */ J(Ye, [["__scopeId", "data-v-fe7b1f6c"]]);
763
+ };
720
764
  var se = { exports: {} };
721
- (function(e, n) {
722
- (function(r, i) {
723
- e.exports = i();
765
+ (function(t, n) {
766
+ (function(o, a) {
767
+ t.exports = a();
724
768
  })(window, function() {
725
- return function(r) {
726
- var i = {};
727
- function s(t) {
728
- if (i[t]) return i[t].exports;
729
- var d = i[t] = { i: t, l: !1, exports: {} };
730
- return r[t].call(d.exports, d, d.exports, s), d.l = !0, d.exports;
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 s.m = r, s.c = i, s.d = function(t, d, _) {
733
- s.o(t, d) || Object.defineProperty(t, d, { enumerable: !0, get: _ });
734
- }, s.r = function(t) {
735
- typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 });
736
- }, s.t = function(t, d) {
737
- if (1 & d && (t = s(t)), 8 & d || 4 & d && typeof t == "object" && t && t.__esModule) return t;
738
- var _ = /* @__PURE__ */ Object.create(null);
739
- if (s.r(_), Object.defineProperty(_, "default", { enumerable: !0, value: t }), 2 & d && typeof t != "string") for (var v in t) s.d(_, v, (function(g) {
740
- return t[g];
741
- }).bind(null, v));
742
- return _;
743
- }, s.n = function(t) {
744
- var d = t && t.__esModule ? function() {
745
- return t.default;
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 t;
791
+ return e;
748
792
  };
749
- return s.d(d, "a", d), d;
750
- }, s.o = function(t, d) {
751
- return Object.prototype.hasOwnProperty.call(t, d);
752
- }, s.p = "", s(s.s = 0);
753
- }([function(r, i, s) {
754
- function t(f, c, u, a) {
755
- u.push(f), a.push([].concat(c[f] || []));
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 d(f, c) {
801
+ function i(f, u) {
758
802
  if (!f) throw new Error("[getMaxDepsChain] dep 参数不能为空");
759
- var u = [], a = [], o = [];
760
- for (t(f, c, a, o); a.length; ) {
761
- var h = o.pop();
762
- if (h && h.length) {
763
- var p = h.shift();
764
- if (o.push(h), ~a.indexOf(p)) throw new Error("[getMaxDepsChain][loop] 存在循环依赖,请检查依赖关系; nextName: " + p + ", mainStack: " + a);
765
- t(p, c, a, o);
766
- } else u.push([].concat(a)), a.pop();
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 u.reduce(function(x, b) {
769
- return b.length > x.length ? b : x;
812
+ return d.reduce(function(S, x) {
813
+ return x.length > S.length ? x : S;
770
814
  }, []);
771
815
  }
772
- function _(f) {
816
+ function v(f) {
773
817
  if (!f) throw new Error("[depsParser] 入参不能为空");
774
- var c = {};
775
- f.forEach(function(a) {
776
- c[a.name] = a.deps || [];
818
+ var u = {};
819
+ f.forEach(function(l) {
820
+ u[l.name] = l.deps || [];
777
821
  });
778
- var u = [];
779
- return f.forEach(function(a) {
780
- var o = d(a.name, c).length - 1;
781
- a.priority = o, u[o] = (u[o] || []).concat(a);
782
- }), u;
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
- s.r(i), s.d(i, "loadScript", function() {
785
- return B;
786
- }), s.d(i, "loadScripts", function() {
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 v = function() {
800
- return (v = Object.assign || function(f) {
801
- for (var c, u = 1, a = arguments.length; u < a; u++) for (var o in c = arguments[u]) Object.prototype.hasOwnProperty.call(c, o) && (f[o] = c[o]);
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
- }, g = function(f, c, u, a) {
805
- return new (u || (u = Promise))(function(o, h) {
806
- function p(y) {
848
+ }, y = function(f, u, d, l) {
849
+ return new (d || (d = Promise))(function(s, g) {
850
+ function p(b) {
807
851
  try {
808
- b(a.next(y));
809
- } catch (l) {
810
- h(l);
852
+ x(l.next(b));
853
+ } catch (c) {
854
+ g(c);
811
855
  }
812
856
  }
813
- function x(y) {
857
+ function S(b) {
814
858
  try {
815
- b(a.throw(y));
816
- } catch (l) {
817
- h(l);
859
+ x(l.throw(b));
860
+ } catch (c) {
861
+ g(c);
818
862
  }
819
863
  }
820
- function b(y) {
821
- var l;
822
- y.done ? o(y.value) : (l = y.value, l instanceof u ? l : new u(function(m) {
823
- m(l);
824
- })).then(p, x);
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
- b((a = a.apply(f, [])).next());
870
+ x((l = l.apply(f, [])).next());
827
871
  });
828
- }, z = function(f, c) {
829
- var u, a, o, h, p = { label: 0, sent: function() {
830
- if (1 & o[0]) throw o[1];
831
- return o[1];
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 h = { next: x(0), throw: x(1), return: x(2) }, typeof Symbol == "function" && (h[Symbol.iterator] = function() {
877
+ return g = { next: S(0), throw: S(1), return: S(2) }, typeof Symbol == "function" && (g[Symbol.iterator] = function() {
834
878
  return this;
835
- }), h;
836
- function x(b) {
837
- return function(y) {
838
- return function(l) {
839
- if (u) throw new TypeError("Generator is already executing.");
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 (u = 1, a && (o = 2 & l[0] ? a.return : l[0] ? a.throw || ((o = a.return) && o.call(a), 0) : a.next) && !(o = o.call(a, l[1])).done) return o;
842
- switch (a = 0, o && (l = [2 & l[0], o.value]), l[0]) {
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
- o = l;
889
+ s = c;
846
890
  break;
847
891
  case 4:
848
- return p.label++, { value: l[1], done: !1 };
892
+ return p.label++, { value: c[1], done: !1 };
849
893
  case 5:
850
- p.label++, a = l[1], l = [0];
894
+ p.label++, l = c[1], c = [0];
851
895
  continue;
852
896
  case 7:
853
- l = p.ops.pop(), p.trys.pop();
897
+ c = p.ops.pop(), p.trys.pop();
854
898
  continue;
855
899
  default:
856
- if (o = p.trys, !((o = o.length > 0 && o[o.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
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 (l[0] === 3 && (!o || l[1] > o[0] && l[1] < o[3])) {
861
- p.label = l[1];
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 (l[0] === 6 && p.label < o[1]) {
865
- p.label = o[1], o = l;
908
+ if (c[0] === 6 && p.label < s[1]) {
909
+ p.label = s[1], s = c;
866
910
  break;
867
911
  }
868
- if (o && p.label < o[2]) {
869
- p.label = o[2], p.ops.push(l);
912
+ if (s && p.label < s[2]) {
913
+ p.label = s[2], p.ops.push(c);
870
914
  break;
871
915
  }
872
- o[2] && p.ops.pop(), p.trys.pop();
916
+ s[2] && p.ops.pop(), p.trys.pop();
873
917
  continue;
874
918
  }
875
- l = c.call(f, p);
919
+ c = u.call(f, p);
876
920
  } catch (m) {
877
- l = [6, m], a = 0;
921
+ c = [6, m], l = 0;
878
922
  } finally {
879
- u = o = 0;
923
+ d = s = 0;
880
924
  }
881
- if (5 & l[0]) throw l[1];
882
- return { value: l[0] ? l[1] : void 0, done: !0 };
883
- }([b, y]);
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
- }, O = function(f) {
930
+ }, N = function(f) {
887
931
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
888
- var c, u = f[Symbol.asyncIterator];
889
- return u ? u.call(f) : (f = typeof __values == "function" ? __values(f) : f[Symbol.iterator](), c = {}, a("next"), a("throw"), a("return"), c[Symbol.asyncIterator] = function() {
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
- }, c);
892
- function a(o) {
893
- c[o] = f[o] && function(h) {
894
- return new Promise(function(p, x) {
895
- (function(b, y, l, m) {
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
- b({ value: w, done: l });
898
- }, y);
899
- })(p, x, (h = f[o](h)).done, h.value);
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 B(f, c) {
905
- return c === void 0 && (c = !1), new Promise(function(u, a) {
906
- var o = c ? document.head : document.body, h = document.createElement("script");
907
- h.type = "text/javascript", h.src = f, h.crossOrigin = "anonymous", h.onreadystatechange = u, h.onload = u, h.onerror = a, o.appendChild(h);
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 k = function(f, c) {
911
- return c === void 0 && (c = {}), g(void 0, void 0, void 0, function() {
912
- var u, a, o, h, p;
913
- return z(this, function(x) {
914
- switch (x.label) {
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 u = c.baseUrl, a = u === void 0 ? "" : u, o = c.lastLoadResult, h = c.inHead, p = h !== void 0 && h, [4, Promise.all(f.map(function(b) {
917
- return g(void 0, void 0, void 0, function() {
918
- var y, l, m, w, T, A, L, j;
919
- return z(this, function(M) {
920
- switch (M.label) {
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 y = b.name, l = b.path, m = b.deps, (L = {})[y] = !0, w = L, (j = {})[y] = !1, T = j, window[y] ? [2, w] : [3, 1];
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 A = !0, m && o && [].concat(m).forEach(function(le) {
925
- o[le] !== !1 && (A = !0);
926
- }), A ? [4, B(l.indexOf("http") === 0 || l.indexOf("//:") === 0 ? l : a + l, p).then(function() {
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, M.sent()];
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, x.sent()];
984
+ return [2, S.sent()];
941
985
  }
942
986
  });
943
987
  });
944
- }, $ = function(f, c) {
945
- return c === void 0 && (c = {}), function() {
946
- var u = [].concat(_(f));
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 (u.length) {
949
- var a = u.shift();
950
- return k(a, c).then(function(o) {
951
- return { value: o, done: !1 };
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
- }, I = function(f, c) {
958
- var u;
959
- return c === void 0 && (c = {}), (u = {})[Symbol.asyncIterator] = $(f, c), u;
960
- }, U = function(f, c) {
961
- return c === void 0 && (c = {}), g(void 0, void 0, void 0, function() {
962
- var u, a, o, h, p, x;
963
- return z(this, function(b) {
964
- switch (b.label) {
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
- b.trys.push([0, 5, 6, 11]), u = O(I(f, c)), b.label = 1;
1010
+ x.trys.push([0, 5, 6, 11]), d = N(E(f, u)), x.label = 1;
967
1011
  case 1:
968
- return [4, u.next()];
1012
+ return [4, d.next()];
969
1013
  case 2:
970
- if ((a = b.sent()).done) return [3, 4];
971
- o = a.value, c.lastLoadResult = c.lastLoadResult || {}, console.log("current load: ", o), o.forEach(function(y) {
972
- c.lastLoadResult = v(v({}, c.lastLoadResult), y);
973
- }), b.label = 3;
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 h = b.sent(), p = { error: h }, [3, 11];
1023
+ return g = x.sent(), p = { error: g }, [3, 11];
980
1024
  case 6:
981
- return b.trys.push([6, , 9, 10]), a && !a.done && (x = u.return) ? [4, x.call(u)] : [3, 8];
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
- b.sent(), b.label = 8;
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, c.lastLoadResult];
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 tt = se.exports;
1001
- const nt = {
1044
+ var Ye = se.exports;
1045
+ const Ze = {
1002
1046
  key: 0,
1003
1047
  class: "ai-assistant"
1004
- }, rt = {
1048
+ }, et = {
1005
1049
  name: "AiChat"
1006
1050
  //这个⾮常重要,就是未来你放到其他项⽬中,组件标签的名字,⽐如:<sz-workflow></sz-workflow>
1007
- }, ot = /* @__PURE__ */ ne({
1008
- ...rt,
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(e) {
1028
- const n = C(!1), r = C(!1), i = () => {
1081
+ setup(t) {
1082
+ const n = C(!1), o = C(!1), a = () => {
1029
1083
  n.value = !n.value;
1030
- }, s = () => {
1031
- r.value = !0, n.value = !1;
1032
- }, t = (v) => {
1033
- console.log("用户输入:", v);
1034
- }, d = [
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 tt.loadScriptsQueue(d, {
1098
+ let v = {};
1099
+ return Ye.loadScriptsQueue(i, {
1046
1100
  baseUrl: "/scripts/ai/",
1047
- lastLoadResult: _,
1101
+ lastLoadResult: v,
1048
1102
  inHead: !1
1049
- }).then((v) => {
1050
- if (console.log("load ai deps: ", v), window.markdownit) {
1051
- const g = window.markdownit();
1052
- console.log("markdownit: ", g), ze();
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
- }), (v, g) => r.value ? H("", !0) : (P(), R("div", nt, [
1055
- E(et, {
1108
+ }), (h, y) => o.value ? D("", !0) : (P(), O("div", Ze, [
1109
+ $(Ge, {
1056
1110
  modelValue: n.value,
1057
- "onUpdate:modelValue": g[0] || (g[0] = (z) => n.value = z),
1058
- onSubmit: t,
1059
- token: e.token,
1060
- identifier: e.identifier,
1061
- baseUrl: e.baseUrl,
1062
- title: e.title
1063
- }, null, 8, ["modelValue", "token", "identifier", "baseUrl", "title"]),
1064
- S("div", {
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: i
1121
+ onClick: a
1067
1122
  }, [
1068
- S("div", {
1123
+ k("div", {
1069
1124
  class: "close-icon",
1070
- onClick: me(s, ["stop"])
1071
- }, g[1] || (g[1] = [
1072
- S("svg", {
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
- S("path", {
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
- g[2] || (g[2] = S("img", {
1084
- src: ve,
1137
+ ])]),
1138
+ y[2] || (y[2] = k("img", {
1139
+ src: he,
1085
1140
  alt: "AI助手"
1086
1141
  }, null, -1)),
1087
- g[3] || (g[3] = S("span", { class: "ai-icon-text" }, "AI助手", -1))
1142
+ y[3] || (y[3] = k("span", { class: "ai-icon-text" }, "AI助手", -1))
1088
1143
  ])
1089
1144
  ]));
1090
1145
  }
1091
- }), at = /* @__PURE__ */ J(ot, [["__scopeId", "data-v-4b85f480"]]);
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: at
1102
- }, Symbol.toStringTag, { value: "Module" })), W = function(e) {
1103
- if (!W.installed) {
1104
- W.installed = !0;
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 r = Reflect.get(te, n);
1107
- e.component(r.name, r);
1153
+ const o = Reflect.get(te, n);
1154
+ t.component(o.name, o);
1108
1155
  }
1109
1156
  }
1110
- }, st = "0.1.1", lt = "Sz";
1111
- function ct({
1112
- componentPrefix: e = lt,
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 r = [];
1116
- function i(t, d, _) {
1117
- t.component(e + d) || t.component(
1118
- e + d,
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 s(t) {
1123
- r.includes(t) || (r.push(t), n.forEach((d) => {
1124
- const { name: _, alias: v } = d;
1125
- console.log(444, _, v), i(t, _, d), v && v.forEach((g) => {
1126
- i(t, g, d);
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: st,
1132
- componentPrefix: e,
1133
- install: s
1231
+ version: it,
1232
+ componentPrefix: t,
1233
+ install: r
1134
1234
  };
1135
1235
  }
1136
- const ut = {
1137
- install(e) {
1138
- W(e);
1236
+ const pt = {
1237
+ install(t) {
1238
+ Q(t);
1139
1239
  }
1140
1240
  };
1141
1241
  export {
1142
- at as SzAiChat,
1143
- ct as create,
1144
- ut as default
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
  };