@szjy/ai-coms 0.1.6 → 0.1.7

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