@szjy/ai-coms 0.1.1 → 0.1.2

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