@blueking/ai-blueking 0.3.5 → 0.3.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.
@@ -1,8 +1,8 @@
1
1
  var ze = Object.defineProperty;
2
2
  var Ce = (o, n, t) => n in o ? ze(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
- var U = (o, n, t) => (Ce(o, typeof n != "symbol" ? n + "" : n, t), t);
3
+ var j = (o, n, t) => (Ce(o, typeof n != "symbol" ? n + "" : n, t), t);
4
4
  import { Popover as Be, Input as he, Exception as He, clickoutside as Te, bkTooltips as ue, Tag as Pe, Alert as Re, Button as Ve, Message as me, Select as ge, provideGlobalConfig as De } from "bkui-vue";
5
- import { ref as x, onMounted as ne, onBeforeUnmount as le, defineComponent as Y, withDirectives as A, openBlock as m, createElementBlock as g, createElementVNode as d, toDisplayString as P, unref as r, createCommentVNode as M, vShow as fe, createTextVNode as ee, pushScopeId as ae, popScopeId as ie, computed as E, normalizeStyle as Q, normalizeClass as $, createVNode as T, Fragment as q, watch as be, createBlock as X, withCtx as W, renderList as ce, nextTick as ye, withModifiers as D, onBeforeMount as xe, renderSlot as Ye } from "vue";
5
+ import { ref as x, onMounted as ne, onBeforeUnmount as le, defineComponent as Y, withDirectives as E, openBlock as m, createElementBlock as g, createElementVNode as d, toDisplayString as P, unref as c, createCommentVNode as M, vShow as fe, createTextVNode as ee, pushScopeId as ae, popScopeId as ie, computed as X, normalizeStyle as W, normalizeClass as $, createVNode as T, Fragment as K, watch as be, createBlock as q, withCtx as G, renderList as re, nextTick as ye, withModifiers as D, onBeforeMount as xe, renderSlot as Ye } from "vue";
6
6
  import se from "dayjs";
7
7
  import ve from "highlight.js";
8
8
  import Ie from "markdown-it";
@@ -33,17 +33,17 @@ function pe() {
33
33
  let t;
34
34
  const s = () => {
35
35
  clearTimeout(t), t = setTimeout(() => {
36
- const c = window.getSelection();
37
- if (c && c.toString().trim().length > 0) {
36
+ const r = window.getSelection();
37
+ if (r && r.toString().trim().length > 0) {
38
38
  de.value = !1;
39
- const k = c.getRangeAt(0).getBoundingClientRect(), C = window.innerWidth;
40
- _.value = c.toString().trim();
39
+ const k = r.getRangeAt(0).getBoundingClientRect(), C = window.innerWidth;
40
+ _.value = r.toString().trim();
41
41
  const w = 80, B = 34, z = 10;
42
42
  let H = k.left + window.scrollX + k.width / 2 - w / 2;
43
43
  H = Math.max(z, Math.min(H, C - w - z));
44
- let u = k.top + window.scrollY - B - z;
45
- k.top > B + z || (u = k.bottom + window.scrollY + z), n.value = {
46
- top: `${u}px`,
44
+ let R = k.top + window.scrollY - B - z;
45
+ k.top > B + z || (R = k.bottom + window.scrollY + z), n.value = {
46
+ top: `${R}px`,
47
47
  left: `${H}px`
48
48
  }, o.value = !0;
49
49
  } else
@@ -52,10 +52,10 @@ function pe() {
52
52
  }, i = () => {
53
53
  o.value = !1, de.value || (_.value = "");
54
54
  }, l = () => {
55
- const c = window.getSelection();
56
- c && c.removeAllRanges(), _.value = "";
57
- }, e = (c) => {
58
- _.value = c;
55
+ const r = window.getSelection();
56
+ r && r.removeAllRanges(), _.value = "";
57
+ }, e = (r) => {
58
+ _.value = r;
59
59
  };
60
60
  return ne(() => {
61
61
  document.addEventListener("selectionchange", s);
@@ -138,7 +138,7 @@ const Xe = [
138
138
  },
139
139
  emits: ["close"],
140
140
  setup(o) {
141
- return (n, t) => A((m(), g(
141
+ return (n, t) => E((m(), g(
142
142
  "section",
143
143
  We,
144
144
  [
@@ -152,7 +152,7 @@ const Xe = [
152
152
  d(
153
153
  "span",
154
154
  Je,
155
- P(r(b)("您选择的文本内容")),
155
+ P(c(b)("您选择的文本内容")),
156
156
  1
157
157
  /* TEXT */
158
158
  ),
@@ -183,15 +183,15 @@ const Xe = [
183
183
  __name: "render-back",
184
184
  setup(o) {
185
185
  const { isShow: n, scrollToBottom: t } = ke();
186
- return (s, i) => r(n) ? (m(), g("span", {
186
+ return (s, i) => c(n) ? (m(), g("span", {
187
187
  key: 0,
188
188
  class: "ai-blueking-render-back",
189
189
  onClick: i[0] || (i[0] = //@ts-ignore
190
- (...l) => r(t) && r(t)(...l))
190
+ (...l) => c(t) && c(t)(...l))
191
191
  }, [
192
192
  Ne,
193
193
  ee(
194
- " " + P(r(b)("返回最新")),
194
+ " " + P(c(b)("返回最新")),
195
195
  1
196
196
  /* TEXT */
197
197
  )
@@ -205,28 +205,28 @@ const et = /* @__PURE__ */ Y({
205
205
  size: { default: 36 }
206
206
  },
207
207
  setup(o) {
208
- const n = o, t = E(() => ({
208
+ const n = o, t = X(() => ({
209
209
  minWidth: `${n.size}px`,
210
210
  maxWidth: `${n.size}px`,
211
211
  minHeight: `${n.size}px`,
212
212
  maxHeight: `${n.size}px`,
213
213
  padding: `${n.size * 0.208}px ${n.size * 0.222}px ${n.size * 0.194}px ${n.size * 0.18}px`
214
214
  // 保持原比例
215
- })), s = E(() => ({
215
+ })), s = X(() => ({
216
216
  fontSize: `${n.size * 0.611}px`
217
217
  // 保持原比例 22/36
218
218
  }));
219
219
  return (i, l) => (m(), g(
220
220
  "span",
221
221
  {
222
- style: Q(t.value),
222
+ style: W(t.value),
223
223
  class: "message-photo ai"
224
224
  },
225
225
  [
226
226
  d(
227
227
  "i",
228
228
  {
229
- style: Q(s.value),
229
+ style: W(s.value),
230
230
  class: "ai-blueking-icon ai-blueking-ai"
231
231
  },
232
232
  null,
@@ -244,7 +244,7 @@ const et = /* @__PURE__ */ Y({
244
244
  }, st = { class: "message-content-container" }, nt = { class: "message-content user" }, lt = {
245
245
  key: 0,
246
246
  class: "time-message user"
247
- }, at = ["innerHTML"], it = { class: "message-photo user" }, ct = ["src"], rt = { class: "message-content ai" }, dt = {
247
+ }, at = ["innerHTML"], it = { class: "message-photo user" }, rt = ["src"], ct = { class: "message-content ai" }, dt = {
248
248
  key: 0,
249
249
  class: "time-message ai"
250
250
  }, ut = {
@@ -273,10 +273,10 @@ const et = /* @__PURE__ */ Y({
273
273
  setup(o) {
274
274
  const n = new Ie({
275
275
  html: !0,
276
- highlight: function(e, c) {
277
- if (c && ve.getLanguage(c))
276
+ highlight: function(e, r) {
277
+ if (r && ve.getLanguage(r))
278
278
  try {
279
- return ve.highlight(e, { language: c }).value;
279
+ return ve.highlight(e, { language: r }).value;
280
280
  } catch {
281
281
  }
282
282
  return "";
@@ -284,19 +284,19 @@ const et = /* @__PURE__ */ Y({
284
284
  }).use(Ae, {
285
285
  iconClass: "ai-blueking-icon ai-blueking-copy",
286
286
  buttonClass: "ai-blueking-copy-button"
287
- }), t = o, s = E(() => {
288
- var c;
287
+ }), t = o, s = X(() => {
288
+ var r;
289
289
  const e = {
290
290
  error: "ai-blueking-icon ai-blueking-warning-circle-fill",
291
291
  loading: "",
292
292
  success: ""
293
293
  };
294
- return (c = t.message) != null && c.status ? e[t.message.status] : "";
295
- }), i = E(() => t.message.content ? n.render(t.message.content) : ""), l = E(() => {
296
- const e = se(t.message.time), c = se();
297
- return t.message.time ? c.isSame(e, "year") ? e.format("MM-DD HH:mm:ss") : e.format("YYYY-MM-DD HH:mm:ss") : "";
294
+ return (r = t.message) != null && r.status ? e[t.message.status] : "";
295
+ }), i = X(() => t.message.content ? n.render(t.message.content) : ""), l = X(() => {
296
+ const e = se(t.message.time), r = se();
297
+ return t.message.time ? r.isSame(e, "year") ? e.format("MM-DD HH:mm:ss") : e.format("YYYY-MM-DD HH:mm:ss") : "";
298
298
  });
299
- return (e, c) => (m(), g(
299
+ return (e, r) => (m(), g(
300
300
  "li",
301
301
  {
302
302
  class: $([e.message.role, "message-main"])
@@ -308,8 +308,8 @@ const et = /* @__PURE__ */ Y({
308
308
  }, null, 8, ["text"])
309
309
  ])) : M("v-if", !0),
310
310
  d("div", st, [
311
- e.message.role === r(Le).User ? (m(), g(
312
- q,
311
+ e.message.role === c(Le).User ? (m(), g(
312
+ K,
313
313
  { key: 0 },
314
314
  [
315
315
  d("p", nt, [
@@ -326,17 +326,17 @@ const et = /* @__PURE__ */ Y({
326
326
  }, null, 8, at)
327
327
  ]),
328
328
  d("span", it, [
329
- d("img", { src: e.userPhoto }, null, 8, ct)
329
+ d("img", { src: e.userPhoto }, null, 8, rt)
330
330
  ])
331
331
  ],
332
332
  64
333
333
  /* STABLE_FRAGMENT */
334
334
  )) : (m(), g(
335
- q,
335
+ K,
336
336
  { key: 1 },
337
337
  [
338
338
  T(tt),
339
- d("p", rt, [
339
+ d("p", ct, [
340
340
  l.value ? (m(), g(
341
341
  "span",
342
342
  dt,
@@ -354,8 +354,8 @@ const et = /* @__PURE__ */ Y({
354
354
  2
355
355
  /* CLASS */
356
356
  )) : M("v-if", !0),
357
- e.message.status === r(oe).Loading ? (m(), g("svg", ut, ht)) : M("v-if", !0),
358
- e.message.status === r(oe).Error ? (m(), g(
357
+ e.message.status === c(oe).Loading ? (m(), g("svg", ut, ht)) : M("v-if", !0),
358
+ e.message.status === c(oe).Error ? (m(), g(
359
359
  "span",
360
360
  mt,
361
361
  P(e.message.content),
@@ -366,7 +366,7 @@ const et = /* @__PURE__ */ Y({
366
366
  innerHTML: i.value,
367
367
  class: $({
368
368
  "markdown-message": !0,
369
- loading: e.message.status === r(oe).Loading
369
+ loading: e.message.status === c(oe).Loading
370
370
  })
371
371
  }, null, 10, gt))
372
372
  ])
@@ -387,48 +387,48 @@ const et = /* @__PURE__ */ Y({
387
387
  placeholder: {},
388
388
  value: {}
389
389
  },
390
- emits: ["update:value", "enter", "choose-prompt"],
390
+ emits: ["change-prompt", "update:value", "enter", "choose-prompt"],
391
391
  setup(o, { emit: n }) {
392
- const t = o, s = n, i = Te, l = ue, { selectedText: e, lockSelectedText: c } = pe(), h = x(""), k = x(40), C = x(), w = x(!1), B = E(() => {
392
+ const t = o, s = n, i = Te, l = ue, { selectedText: e, lockSelectedText: r } = pe(), h = x(""), k = x(40), C = x(), w = x(!1), B = X(() => {
393
393
  var v;
394
394
  return ((v = t.prompts) == null ? void 0 : v.filter((L) => L.content.includes(h.value))) || [];
395
- }), z = E(() => {
395
+ }), z = X(() => {
396
396
  var v;
397
397
  return t.placeholder ? t.placeholder : (v = t.prompts) != null && v.length ? b("您可以键入 “/” 查看更多Prompt") : b("请输入");
398
398
  }), H = (v) => {
399
- s("update:value", v);
400
- }, u = () => {
401
- var v;
402
- t.value === "/" && ((v = t.prompts) != null && v.length) ? y() : j();
399
+ s("update:value", v), s("change-prompt", v);
403
400
  }, R = () => {
401
+ var v;
402
+ t.value === "/" && ((v = t.prompts) != null && v.length) ? f() : y();
403
+ }, u = () => {
404
404
  ye(() => {
405
405
  var L;
406
406
  const v = (L = C.value) == null ? void 0 : L.$el.querySelector("textarea");
407
407
  (v == null ? void 0 : v.scrollHeight) > 40 && t.value ? k.value = v.scrollHeight <= 300 ? v.scrollHeight : 300 : k.value = 40;
408
408
  });
409
- }, G = (v) => {
410
- s("update:value", v.content), s("choose-prompt", v), j(), p();
409
+ }, A = (v) => {
410
+ s("update:value", v.content), s("choose-prompt", v), y(), U();
411
411
  }, J = (v, L) => {
412
412
  L.key === "Enter" && !L.shiftKey && (L.preventDefault(), s("enter"));
413
413
  }, Z = () => {
414
414
  H("");
415
- }, p = () => {
415
+ }, U = () => {
416
416
  var L;
417
417
  const v = (L = C.value) == null ? void 0 : L.$el.querySelector("textarea");
418
418
  v == null || v.focus();
419
+ }, p = () => {
420
+ e.value && (r.value = !0);
419
421
  }, f = () => {
420
- e.value && (c.value = !0);
421
- }, y = () => {
422
422
  w.value = !0;
423
- }, j = () => {
423
+ }, y = () => {
424
424
  w.value = !1;
425
425
  };
426
426
  return be(
427
427
  () => t.value,
428
428
  () => {
429
- R(), u();
429
+ u(), R();
430
430
  }
431
- ), ne(p), (v, L) => (m(), X(r(Be), {
431
+ ), ne(U), (v, L) => (m(), q(c(Be), {
432
432
  width: "calc(100% - 118px)",
433
433
  "ext-cls": "empty-padding",
434
434
  arrow: !1,
@@ -439,37 +439,37 @@ const et = /* @__PURE__ */ Y({
439
439
  theme: "light",
440
440
  trigger: "manual"
441
441
  }, {
442
- content: W(() => {
442
+ content: G(() => {
443
443
  var te;
444
444
  return [
445
445
  d("div", null, [
446
- A((m(), g("section", ft, [
447
- T(r(he), {
446
+ E((m(), g("section", ft, [
447
+ T(c(he), {
448
448
  class: "input-search",
449
449
  modelValue: h.value,
450
- "onUpdate:modelValue": L[0] || (L[0] = (K) => h.value = K),
450
+ "onUpdate:modelValue": L[0] || (L[0] = (Q) => h.value = Q),
451
451
  behavior: "simplicity",
452
452
  clearable: ""
453
453
  }, null, 8, ["modelValue"]),
454
454
  d("section", bt, [
455
455
  (m(!0), g(
456
- q,
456
+ K,
457
457
  null,
458
- ce(B.value, (K, re) => A((m(), g("span", {
458
+ re(B.value, (Q, ce) => E((m(), g("span", {
459
459
  class: "group-prompt",
460
- key: re,
461
- onClick: (a) => G(K)
460
+ key: ce,
461
+ onClick: (a) => A(Q)
462
462
  }, [
463
463
  d(
464
464
  "span",
465
465
  kt,
466
- P(K.content),
466
+ P(Q.content),
467
467
  1
468
468
  /* TEXT */
469
469
  )
470
470
  ], 8, yt)), [
471
- [r(l), {
472
- content: K.content,
471
+ [c(l), {
472
+ content: Q.content,
473
473
  placement: "right",
474
474
  theme: "light",
475
475
  width: 300,
@@ -479,7 +479,7 @@ const et = /* @__PURE__ */ Y({
479
479
  128
480
480
  /* KEYED_FRAGMENT */
481
481
  )),
482
- (te = B.value) != null && te.length ? M("v-if", !0) : (m(), X(r(He), {
482
+ (te = B.value) != null && te.length ? M("v-if", !0) : (m(), q(c(He), {
483
483
  key: 0,
484
484
  class: "exception-wrap-item exception-part",
485
485
  scene: "part",
@@ -487,22 +487,22 @@ const et = /* @__PURE__ */ Y({
487
487
  }))
488
488
  ])
489
489
  ])), [
490
- [r(i), j]
490
+ [c(i), y]
491
491
  ])
492
492
  ])
493
493
  ];
494
494
  }),
495
- default: W(() => [
495
+ default: G(() => [
496
496
  d(
497
497
  "section",
498
498
  {
499
- style: Q({
499
+ style: W({
500
500
  "--text-height": k.value + "px"
501
501
  }),
502
502
  class: "send-prompt-container"
503
503
  },
504
504
  [
505
- T(r(he), {
505
+ T(c(he), {
506
506
  ref_key: "inputRef",
507
507
  ref: C,
508
508
  class: "send-prompt",
@@ -513,11 +513,11 @@ const et = /* @__PURE__ */ Y({
513
513
  placeholder: z.value,
514
514
  row: "1",
515
515
  type: "textarea",
516
- onFocus: f,
516
+ onFocus: p,
517
517
  onInput: H,
518
518
  onKeydown: J
519
519
  }, null, 8, ["model-value", "placeholder"]),
520
- v.value ? (m(), X(r(Ee), {
520
+ v.value ? (m(), q(c(Ee), {
521
521
  key: 0,
522
522
  class: "show-clear-only-hover bk-input--clear-icon clear-icon",
523
523
  onClick: Z
@@ -531,7 +531,7 @@ const et = /* @__PURE__ */ Y({
531
531
  /* STABLE */
532
532
  }, 8, ["is-show"]));
533
533
  }
534
- }), Lt = /* @__PURE__ */ I(wt, [["__scopeId", "data-v-3354f392"]]), St = { class: "ai-shortcuts" }, Mt = /* @__PURE__ */ Y({
534
+ }), Lt = /* @__PURE__ */ I(wt, [["__scopeId", "data-v-f75335eb"]]), St = { class: "ai-shortcuts" }, Mt = /* @__PURE__ */ Y({
535
535
  __name: "render-shortcuts",
536
536
  props: {
537
537
  shortcuts: {}
@@ -543,15 +543,15 @@ const et = /* @__PURE__ */ Y({
543
543
  };
544
544
  return (i, l) => (m(), g("ul", St, [
545
545
  (m(!0), g(
546
- q,
546
+ K,
547
547
  null,
548
- ce(i.shortcuts, (e) => (m(), X(r(Pe), {
548
+ re(i.shortcuts, (e) => (m(), q(c(Pe), {
549
549
  class: "ai-blueking-shortcut",
550
550
  key: e.label,
551
551
  theme: "info",
552
- onClick: (c) => s(e)
552
+ onClick: (r) => s(e)
553
553
  }, {
554
- default: W(() => [
554
+ default: G(() => [
555
555
  ee(
556
556
  P(e.label),
557
557
  1
@@ -596,7 +596,7 @@ const et = /* @__PURE__ */ Y({
596
596
  }, [
597
597
  Bt,
598
598
  ee(
599
- " " + P(r(b)("终止生成")),
599
+ " " + P(c(b)("终止生成")),
600
600
  1
601
601
  /* TEXT */
602
602
  )
@@ -611,7 +611,7 @@ const et = /* @__PURE__ */ Y({
611
611
  message: {}
612
612
  },
613
613
  setup(o) {
614
- const n = o, t = E(() => {
614
+ const n = o, t = X(() => {
615
615
  var e;
616
616
  const s = se(n.message.time), i = se(), l = {
617
617
  0: b("日"),
@@ -623,7 +623,7 @@ const et = /* @__PURE__ */ Y({
623
623
  6: b("六")
624
624
  };
625
625
  return !n.message.time || (e = window.showTimes) != null && e.some(
626
- (c) => Math.abs(s.diff(c, "minute")) < 10 && c !== n.message.time
626
+ (r) => Math.abs(s.diff(r, "minute")) < 10 && r !== n.message.time
627
627
  ) ? "" : (window.showTimes = [...window.showTimes || [], n.message.time], i.isSame(s, "day") ? s.format("HH:mm:ss") : i.subtract(1, "day").isSame(s, "week") ? b("昨天") + " " + s.format("HH:mm:ss") : i.isSame(s, "week") ? b("本周") + l[s.day()] + " " + s.format("HH:mm:ss") : i.subtract(1, "week").isSame(s, "week") ? b("上周") + l[s.day()] + " " + s.format("HH:mm:ss") : i.isSame(s, "year") ? s.format("MM-DD HH:mm:ss") : s.format("YYYY-MM-DD HH:mm:ss"));
628
628
  });
629
629
  return (s, i) => t.value ? (m(), g("section", Pt, [
@@ -636,7 +636,7 @@ const et = /* @__PURE__ */ Y({
636
636
  )
637
637
  ])) : M("v-if", !0);
638
638
  }
639
- }), Dt = /* @__PURE__ */ I(Vt, [["__scopeId", "data-v-55c9a119"]]), Se = (o) => (ae("data-v-36d4ce8f"), o = o(), ie(), o), xt = {
639
+ }), Dt = /* @__PURE__ */ I(Vt, [["__scopeId", "data-v-55c9a119"]]), Se = (o) => (ae("data-v-de79ff73"), o = o(), ie(), o), xt = {
640
640
  key: 0,
641
641
  width: "18",
642
642
  height: "18",
@@ -670,9 +670,9 @@ const et = /* @__PURE__ */ Y({
670
670
  alert: {},
671
671
  shortcuts: { default: () => Xe }
672
672
  },
673
- emits: ["ai-click", "send", "choose-prompt", "scroll-load", "stop"],
673
+ emits: ["ai-click", "change-prompt", "send", "choose-prompt", "scroll-load", "stop"],
674
674
  setup(o, { expose: n, emit: t }) {
675
- const s = o, i = t, l = ue, e = x(""), { selectedText: c, clearSelection: h } = pe(), { isShow: k } = ke(), C = () => {
675
+ const s = o, i = t, l = ue, e = x(""), { selectedText: r, clearSelection: h } = pe(), { isShow: k } = ke(), C = () => {
676
676
  ye(() => {
677
677
  const p = document.querySelector(".ai-blueking-messages");
678
678
  p.scrollTop = p.scrollHeight;
@@ -689,12 +689,14 @@ const et = /* @__PURE__ */ Y({
689
689
  }
690
690
  i("send", {
691
691
  content: e.value,
692
- cite: c.value
693
- }), e.value = "", c.value = "";
692
+ cite: r.value
693
+ }), e.value = "", r.value = "";
694
694
  }
695
695
  }, z = (p) => {
696
696
  i("choose-prompt", p);
697
- }, H = () => {
697
+ }, H = (p) => {
698
+ i("change-prompt", p);
699
+ }, R = () => {
698
700
  i("stop");
699
701
  }, u = (p) => {
700
702
  const f = p.target;
@@ -703,23 +705,23 @@ const et = /* @__PURE__ */ Y({
703
705
  y != null && y.classList.contains("closed") ? y == null || y.classList.remove("closed") : y == null || y.classList.add("closed");
704
706
  }
705
707
  f != null && f.classList.contains("ai-clickable") && i("ai-click", f.dataset.ai);
706
- }, R = () => {
708
+ }, A = () => {
707
709
  C(), document.addEventListener("click", u);
708
- }, G = () => {
710
+ }, J = () => {
709
711
  window.showTimes = [], document.removeEventListener("click", u);
710
- }, J = (p) => {
711
- e.value = p;
712
712
  }, Z = (p) => {
713
- const f = p.prompt.replace("{{ SELECTED_TEXT }}", c.value);
713
+ e.value = p;
714
+ }, U = (p) => {
715
+ const f = p.prompt.replace("{{ SELECTED_TEXT }}", r.value);
714
716
  if (s.loading) {
715
717
  me({ theme: "warning", message: b("内容正在执行中,请执行完成后再发送") });
716
718
  return;
717
719
  }
718
720
  i("send", {
719
721
  content: p.label,
720
- cite: c.value,
722
+ cite: r.value,
721
723
  prompt: f
722
- }), c.value = "";
724
+ }), r.value = "";
723
725
  };
724
726
  return be(
725
727
  () => s.messages,
@@ -730,18 +732,18 @@ const et = /* @__PURE__ */ Y({
730
732
  {
731
733
  deep: !0
732
734
  }
733
- ), ne(R), le(G), n({
734
- setInputMessage: J
735
+ ), ne(A), le(J), n({
736
+ setInputMessage: Z
735
737
  }), (p, f) => (m(), g(
736
738
  "section",
737
739
  {
738
- style: Q({
740
+ style: W({
739
741
  background: p.background
740
742
  }),
741
743
  class: "ai-content"
742
744
  },
743
745
  [
744
- p.alert ? (m(), X(r(Re), {
746
+ p.alert ? (m(), q(c(Re), {
745
747
  key: 0,
746
748
  title: p.alert,
747
749
  theme: "warning",
@@ -752,15 +754,15 @@ const et = /* @__PURE__ */ Y({
752
754
  {
753
755
  class: "ai-messages ai-blueking-messages",
754
756
  onScrollPassive: f[0] || (f[0] = //@ts-ignore
755
- (...y) => r(w) && r(w)(...y))
757
+ (...y) => c(w) && c(w)(...y))
756
758
  },
757
759
  [
758
760
  p.scrollLoading ? (m(), g("svg", xt, It)) : M("v-if", !0),
759
761
  (m(!0), g(
760
- q,
762
+ K,
761
763
  null,
762
- ce(p.messages, (y) => (m(), g(
763
- q,
764
+ re(p.messages, (y) => (m(), g(
765
+ K,
764
766
  {
765
767
  key: y.content
766
768
  },
@@ -797,37 +799,37 @@ const et = /* @__PURE__ */ Y({
797
799
  T(_e),
798
800
  T(Tt, {
799
801
  "is-show": p.loading,
800
- onStop: H
802
+ onStop: R
801
803
  }, null, 8, ["is-show"])
802
804
  ],
803
805
  32
804
806
  /* NEED_HYDRATION */
805
807
  ),
806
808
  d("section", Et, [
807
- r(c) ? (m(), g(
809
+ c(r) ? (m(), g(
808
810
  "div",
809
811
  {
810
812
  key: 0,
811
- class: $(["ai-cite-container", { "is-back-show": !r(k) }]),
813
+ class: $(["ai-cite-container", { "is-back-show": !c(k) }]),
812
814
  onMousedown: f[2] || (f[2] = D(() => {
813
815
  }, ["prevent"]))
814
816
  },
815
817
  [
816
818
  T(we, {
817
819
  "show-close-icon": !0,
818
- text: r(c),
819
- onClose: r(h)
820
+ text: c(r),
821
+ onClose: c(h)
820
822
  }, null, 8, ["text", "onClose"]),
821
823
  d(
822
824
  "span",
823
825
  Xt,
824
- P(r(b)("想对选中的文本做什么")),
826
+ P(c(b)("想对选中的文本做什么")),
825
827
  1
826
828
  /* TEXT */
827
829
  ),
828
830
  T(zt, {
829
831
  shortcuts: p.shortcuts,
830
- onSelect: Z
832
+ onSelect: U
831
833
  }, null, 8, ["shortcuts"])
832
834
  ],
833
835
  34
@@ -839,20 +841,21 @@ const et = /* @__PURE__ */ Y({
839
841
  "onUpdate:value": f[3] || (f[3] = (y) => e.value = y),
840
842
  placeholder: p.placeholder,
841
843
  prompts: p.prompts,
844
+ onChangePrompt: H,
842
845
  onChoosePrompt: z,
843
846
  onEnter: B
844
847
  }, null, 8, ["value", "placeholder", "prompts"]),
845
- A((m(), X(r(Ve), {
848
+ E((m(), q(c(Ve), {
846
849
  class: "ai-operation-button",
847
850
  disabled: p.loading || !e.value,
848
851
  size: "large",
849
852
  theme: "primary",
850
853
  onClick: B
851
854
  }, {
852
- default: W(() => [
855
+ default: G(() => [
853
856
  Kt,
854
857
  ee(
855
- " " + P(r(b)("发送")),
858
+ " " + P(c(b)("发送")),
856
859
  1
857
860
  /* TEXT */
858
861
  )
@@ -860,8 +863,8 @@ const et = /* @__PURE__ */ Y({
860
863
  _: 1
861
864
  /* STABLE */
862
865
  }, 8, ["disabled"])), [
863
- [r(l), {
864
- content: r(b)("内容正在执行中,请执行完成后再发送"),
866
+ [c(l), {
867
+ content: c(b)("内容正在执行中,请执行完成后再发送"),
865
868
  disabled: !p.loading
866
869
  }]
867
870
  ])
@@ -873,7 +876,7 @@ const et = /* @__PURE__ */ Y({
873
876
  /* STYLE */
874
877
  ));
875
878
  }
876
- }), Qt = /* @__PURE__ */ I(Ut, [["__scopeId", "data-v-36d4ce8f"]]), jt = { class: "ai-modal-header-icon" }, Wt = /* @__PURE__ */ Y({
879
+ }), Qt = /* @__PURE__ */ I(Ut, [["__scopeId", "data-v-de79ff73"]]), jt = { class: "ai-modal-header-icon" }, Wt = /* @__PURE__ */ Y({
877
880
  __name: "render-modal",
878
881
  props: {
879
882
  headBackground: { default: "linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)" },
@@ -908,7 +911,7 @@ const et = /* @__PURE__ */ Y({
908
911
  type: "",
909
912
  clientX: 0,
910
913
  clientY: 0
911
- }, c = () => {
914
+ }, r = () => {
912
915
  var S, V, O, N;
913
916
  const a = (F, Me) => F === void 0 ? Me : F;
914
917
  return {
@@ -917,7 +920,7 @@ const et = /* @__PURE__ */ Y({
917
920
  left: a((O = t.startPosition) == null ? void 0 : O.left, 0),
918
921
  right: a((N = t.startPosition) == null ? void 0 : N.right, l.width - t.sizeLimit.width)
919
922
  };
920
- }, h = x(c()), k = E(() => h.value.top <= t.positionLimit.top && h.value.bottom <= t.positionLimit.bottom), C = (a) => {
923
+ }, h = x(r()), k = X(() => h.value.top <= t.positionLimit.top && h.value.bottom <= t.positionLimit.bottom), C = (a) => {
921
924
  s("choose-model", a);
922
925
  }, w = (a) => {
923
926
  e.isMove = !0, e.type = "move", e.clientX = a.clientX, e.clientY = a.clientY;
@@ -927,48 +930,48 @@ const et = /* @__PURE__ */ Y({
927
930
  e.isMove = !0, e.type = "leftDrag", e.clientX = a.clientX;
928
931
  }, H = (a) => {
929
932
  e.isMove = !0, e.type = "topDrag", e.clientY = a.clientY;
930
- }, u = (a) => {
931
- e.isMove = !0, e.type = "bottomDrag", e.clientY = a.clientY;
932
933
  }, R = (a) => {
934
+ e.isMove = !0, e.type = "bottomDrag", e.clientY = a.clientY;
935
+ }, u = (a) => {
933
936
  e.isMove = !0, e.type = "topLeftDrag", e.clientY = a.clientY, e.clientX = a.clientX;
934
- }, G = (a) => {
937
+ }, A = (a) => {
935
938
  e.isMove = !0, e.type = "topRightDrag", e.clientY = a.clientY, e.clientX = a.clientX;
936
939
  }, J = (a) => {
937
940
  e.isMove = !0, e.type = "bottomLeftDrag", e.clientY = a.clientY, e.clientX = a.clientX;
938
941
  }, Z = (a) => {
939
942
  e.isMove = !0, e.type = "bottomRightDrag", e.clientY = a.clientY, e.clientX = a.clientX;
940
- }, p = () => {
943
+ }, U = () => {
941
944
  e.isMove = !1;
942
- }, f = (a, S) => {
945
+ }, p = (a, S) => {
943
946
  ["move", "leftDrag"].includes(e.type) && (h.value.left += a), ["move", "rightDrag"].includes(e.type) && (h.value.right -= a), ["move", "topDrag"].includes(e.type) && (h.value.top += S), ["move", "bottomDrag"].includes(e.type) && (h.value.bottom -= S), ["topLeftDrag"].includes(e.type) && (h.value.left += a, h.value.top += S), ["topRightDrag"].includes(e.type) && (h.value.right -= a, h.value.top += S), ["bottomLeftDrag"].includes(e.type) && (h.value.left += a, h.value.bottom -= S), ["bottomRightDrag"].includes(e.type) && (h.value.right -= a, h.value.bottom -= S);
944
- }, y = (a, S) => {
947
+ }, f = (a, S) => {
945
948
  const { top: V, bottom: O, left: N, right: F } = h.value;
946
949
  (l.width - N - F < t.sizeLimit.width || N < t.positionLimit.left || F < t.positionLimit.right) && (["move", "leftDrag", "topLeftDrag", "bottomLeftDrag"].includes(e.type) && (h.value.left -= a), ["move", "rightDrag", "topRightDrag", "bottomRightDrag"].includes(e.type) && (h.value.right += a)), (l.height - V - O < t.sizeLimit.height || V < t.positionLimit.top || O < t.positionLimit.bottom) && (["move", "topDrag", "topRightDrag", "topLeftDrag"].includes(e.type) && (h.value.top -= S), ["move", "bottomDrag", "bottomLeftDrag", "bottomRightDrag"].includes(e.type) && (h.value.bottom += S));
947
- }, j = (a) => {
950
+ }, y = (a) => {
948
951
  if (!e.isMove)
949
952
  return;
950
953
  a.preventDefault();
951
954
  const S = a.clientX - e.clientX, V = a.clientY - e.clientY;
952
- f(S, V), y(S, V), e.clientX = a.clientX, e.clientY = a.clientY;
955
+ p(S, V), f(S, V), e.clientX = a.clientX, e.clientY = a.clientY;
953
956
  }, v = () => {
954
- l.height = window.innerHeight, l.width = window.innerWidth, h.value = c();
957
+ l.height = window.innerHeight, l.width = window.innerWidth, h.value = r();
955
958
  }, L = () => {
956
959
  h.value.top = t.positionLimit.top, h.value.bottom = t.positionLimit.bottom;
957
960
  }, te = () => {
958
961
  h.value.top = l.height - t.sizeLimit.height, h.value.bottom = t.positionLimit.bottom;
959
- }, K = () => {
962
+ }, Q = () => {
960
963
  s("clear");
961
- }, re = () => {
964
+ }, ce = () => {
962
965
  s("close");
963
966
  };
964
967
  return xe(() => {
965
- window.addEventListener("mousemove", j, !0), window.addEventListener("mouseup", p), window.addEventListener("resize", v);
968
+ window.addEventListener("mousemove", y, !0), window.addEventListener("mouseup", U), window.addEventListener("resize", v);
966
969
  }), le(() => {
967
- window.removeEventListener("mousemove", j, !0), window.removeEventListener("mouseup", p), window.removeEventListener("resize", v);
970
+ window.removeEventListener("mousemove", y, !0), window.removeEventListener("mouseup", U), window.removeEventListener("resize", v);
968
971
  }), (a, S) => (m(), g(
969
972
  "section",
970
973
  {
971
- style: Q({
974
+ style: W({
972
975
  top: h.value.top + "px",
973
976
  bottom: h.value.bottom + "px",
974
977
  left: h.value.left + "px",
@@ -980,7 +983,7 @@ const et = /* @__PURE__ */ Y({
980
983
  d(
981
984
  "header",
982
985
  {
983
- style: Q({
986
+ style: W({
984
987
  background: a.headBackground
985
988
  }),
986
989
  class: "ai-modal-header",
@@ -998,22 +1001,22 @@ const et = /* @__PURE__ */ Y({
998
1001
  /* CLASS */
999
1002
  ),
1000
1003
  ee(
1001
- " " + P(a.name || r(b)("小鲸")) + " ",
1004
+ " " + P(a.name || c(b)("小鲸")) + " ",
1002
1005
  1
1003
1006
  /* TEXT */
1004
1007
  ),
1005
- a.models ? (m(), X(r(ge), {
1008
+ a.models ? (m(), q(c(ge), {
1006
1009
  key: 0,
1007
1010
  class: "ai-modal-header-models",
1008
1011
  "model-value": a.model,
1009
1012
  size: "small",
1010
1013
  onChange: C
1011
1014
  }, {
1012
- default: W(() => [
1015
+ default: G(() => [
1013
1016
  (m(!0), g(
1014
- q,
1017
+ K,
1015
1018
  null,
1016
- ce(a.models, (V) => (m(), X(r(ge).Option, {
1019
+ re(a.models, (V) => (m(), q(c(ge).Option, {
1017
1020
  key: V.id,
1018
1021
  name: V.name,
1019
1022
  value: V.id
@@ -1027,7 +1030,7 @@ const et = /* @__PURE__ */ Y({
1027
1030
  }, 8, ["model-value"])) : M("v-if", !0)
1028
1031
  ]),
1029
1032
  d("span", null, [
1030
- k.value ? A((m(), g(
1033
+ k.value ? E((m(), g(
1031
1034
  "i",
1032
1035
  {
1033
1036
  key: 0,
@@ -1038,11 +1041,11 @@ const et = /* @__PURE__ */ Y({
1038
1041
  512
1039
1042
  /* NEED_PATCH */
1040
1043
  )), [
1041
- [r(i), {
1042
- content: r(b)("向下收缩"),
1044
+ [c(i), {
1045
+ content: c(b)("向下收缩"),
1043
1046
  distance: 20
1044
1047
  }]
1045
- ]) : A((m(), g(
1048
+ ]) : E((m(), g(
1046
1049
  "i",
1047
1050
  {
1048
1051
  key: 1,
@@ -1053,38 +1056,38 @@ const et = /* @__PURE__ */ Y({
1053
1056
  512
1054
1057
  /* NEED_PATCH */
1055
1058
  )), [
1056
- [r(i), {
1057
- content: r(b)("向上扩展"),
1059
+ [c(i), {
1060
+ content: c(b)("向上扩展"),
1058
1061
  distance: 20
1059
1062
  }]
1060
1063
  ]),
1061
- A(d(
1064
+ E(d(
1062
1065
  "i",
1063
1066
  {
1064
1067
  class: "ai-header-tool ai-blueking-icon ai-blueking-saoba",
1065
- onClick: K
1068
+ onClick: Q
1066
1069
  },
1067
1070
  null,
1068
1071
  512
1069
1072
  /* NEED_PATCH */
1070
1073
  ), [
1071
- [r(i), {
1072
- content: r(b)("清空聊天记录"),
1074
+ [c(i), {
1075
+ content: c(b)("清空聊天记录"),
1073
1076
  distance: 20
1074
1077
  }]
1075
1078
  ]),
1076
- A(d(
1079
+ E(d(
1077
1080
  "i",
1078
1081
  {
1079
1082
  class: "ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",
1080
- onClick: re
1083
+ onClick: ce
1081
1084
  },
1082
1085
  null,
1083
1086
  512
1084
1087
  /* NEED_PATCH */
1085
1088
  ), [
1086
- [r(i), {
1087
- content: r(b)("关闭"),
1089
+ [c(i), {
1090
+ content: c(b)("关闭"),
1088
1091
  distance: 20
1089
1092
  }]
1090
1093
  ])
@@ -1128,7 +1131,7 @@ const et = /* @__PURE__ */ Y({
1128
1131
  "span",
1129
1132
  {
1130
1133
  class: "drag-line bottom",
1131
- onMousedown: D(u, ["stop"])
1134
+ onMousedown: D(R, ["stop"])
1132
1135
  },
1133
1136
  null,
1134
1137
  32
@@ -1138,7 +1141,7 @@ const et = /* @__PURE__ */ Y({
1138
1141
  "span",
1139
1142
  {
1140
1143
  class: "drag-line top-left-corner",
1141
- onMousedown: D(R, ["stop"])
1144
+ onMousedown: D(u, ["stop"])
1142
1145
  },
1143
1146
  null,
1144
1147
  32
@@ -1148,7 +1151,7 @@ const et = /* @__PURE__ */ Y({
1148
1151
  "span",
1149
1152
  {
1150
1153
  class: "drag-line top-right-corner",
1151
- onMousedown: D(G, ["stop"])
1154
+ onMousedown: D(A, ["stop"])
1152
1155
  },
1153
1156
  null,
1154
1157
  32
@@ -1192,13 +1195,13 @@ const et = /* @__PURE__ */ Y({
1192
1195
  const { isIconVisible: t, iconPosition: s } = pe(), i = n, l = () => {
1193
1196
  i("click"), t.value = !1;
1194
1197
  };
1195
- return (e, c) => r(t) ? (m(), g(
1198
+ return (e, r) => c(t) ? (m(), g(
1196
1199
  "div",
1197
1200
  {
1198
1201
  key: 0,
1199
- style: Q(r(s)),
1202
+ style: W(c(s)),
1200
1203
  class: "ai-blueking-render-popup",
1201
- onMousedown: c[0] || (c[0] = D(() => {
1204
+ onMousedown: r[0] || (r[0] = D(() => {
1202
1205
  }, ["prevent"]))
1203
1206
  },
1204
1207
  [
@@ -1210,7 +1213,7 @@ const et = /* @__PURE__ */ Y({
1210
1213
  d(
1211
1214
  "span",
1212
1215
  Ot,
1213
- P(r(b)("问小鲸")),
1216
+ P(c(b)("问小鲸")),
1214
1217
  1
1215
1218
  /* TEXT */
1216
1219
  )
@@ -1243,14 +1246,14 @@ const et = /* @__PURE__ */ Y({
1243
1246
  isShow: { type: Boolean },
1244
1247
  shortcuts: {}
1245
1248
  },
1246
- emits: ["clear", "close", "scroll-load", "stop", "ai-click", "update:model", "choose-prompt", "send", "update:isShow"],
1249
+ emits: ["clear", "close", "scroll-load", "stop", "ai-click", "change-prompt", "update:model", "choose-prompt", "send", "update:isShow"],
1247
1250
  setup(o, { expose: n, emit: t }) {
1248
1251
  const s = t, i = x(), l = (u) => {
1249
- var R;
1250
- (R = i.value) == null || R.setInputMessage(u);
1252
+ var A;
1253
+ (A = i.value) == null || A.setInputMessage(u);
1251
1254
  }, e = () => {
1252
1255
  s("update:isShow", !0);
1253
- }, c = () => {
1256
+ }, r = () => {
1254
1257
  s("clear");
1255
1258
  }, h = () => {
1256
1259
  s("update:isShow", !1), s("close");
@@ -1266,14 +1269,16 @@ const et = /* @__PURE__ */ Y({
1266
1269
  s("ai-click", u);
1267
1270
  }, H = (u) => {
1268
1271
  s("choose-prompt", u);
1272
+ }, R = (u) => {
1273
+ s("change-prompt", u);
1269
1274
  };
1270
1275
  return n({
1271
1276
  setInputMessage: l
1272
- }), (u, R) => (m(), g(
1273
- q,
1277
+ }), (u, A) => (m(), g(
1278
+ K,
1274
1279
  null,
1275
1280
  [
1276
- A(T(Gt, {
1281
+ E(T(Gt, {
1277
1282
  "head-background": u.headBackground,
1278
1283
  logo: u.logo,
1279
1284
  model: u.model,
@@ -1283,10 +1288,10 @@ const et = /* @__PURE__ */ Y({
1283
1288
  "size-limit": u.sizeLimit,
1284
1289
  "start-position": u.startPosition,
1285
1290
  onChooseModel: k,
1286
- onClear: c,
1291
+ onClear: r,
1287
1292
  onClose: h
1288
1293
  }, {
1289
- default: W(() => [
1294
+ default: G(() => [
1290
1295
  T(Qt, {
1291
1296
  ref_key: "contentRef",
1292
1297
  ref: i,
@@ -1298,14 +1303,15 @@ const et = /* @__PURE__ */ Y({
1298
1303
  prompts: u.prompts,
1299
1304
  "scroll-loading": u.scrollLoading,
1300
1305
  "scroll-loading-end": u.scrollLoadingEnd,
1301
- "user-photo": u.userPhoto,
1302
1306
  shortcuts: u.shortcuts,
1307
+ "user-photo": u.userPhoto,
1303
1308
  onAiClick: z,
1309
+ onChangePrompt: R,
1304
1310
  onChoosePrompt: H,
1305
1311
  onScrollLoad: B,
1306
1312
  onSend: C,
1307
1313
  onStop: w
1308
- }, null, 8, ["alert", "background", "loading", "messages", "placeholder", "prompts", "scroll-loading", "scroll-loading-end", "user-photo", "shortcuts"])
1314
+ }, null, 8, ["alert", "background", "loading", "messages", "placeholder", "prompts", "scroll-loading", "scroll-loading-end", "shortcuts", "user-photo"])
1309
1315
  ]),
1310
1316
  _: 1
1311
1317
  /* STABLE */
@@ -1327,12 +1333,12 @@ const et = /* @__PURE__ */ Y({
1327
1333
  })();
1328
1334
  class io {
1329
1335
  constructor(n, t, s, i, l) {
1330
- U(this, "controllerMap");
1331
- U(this, "handleEnd");
1332
- U(this, "handleError");
1333
- U(this, "handleReceiveMessage");
1334
- U(this, "handleStart");
1335
- U(this, "url");
1336
+ j(this, "controllerMap");
1337
+ j(this, "handleEnd");
1338
+ j(this, "handleError");
1339
+ j(this, "handleReceiveMessage");
1340
+ j(this, "handleStart");
1341
+ j(this, "url");
1336
1342
  this.url = n, this.handleStart = t, this.handleReceiveMessage = s, this.handleEnd = i, this.handleError = l, this.controllerMap = {};
1337
1343
  }
1338
1344
  stop(n) {
@@ -1355,22 +1361,22 @@ class io {
1355
1361
  const e = l.body.pipeThrough(new window.TextDecoderStream()).getReader();
1356
1362
  for (; ; )
1357
1363
  try {
1358
- const { value: c, done: h } = await e.read();
1364
+ const { value: r, done: h } = await e.read();
1359
1365
  if (!l.ok) {
1360
- this.handleError(c || l.statusText, l.status, t);
1366
+ this.handleError(r || l.statusText, l.status, t);
1361
1367
  break;
1362
1368
  }
1363
1369
  if (h) {
1364
1370
  this.handleEnd(t);
1365
1371
  break;
1366
1372
  }
1367
- c.toString().split(`
1373
+ r.toString().split(`
1368
1374
  `).forEach((C) => {
1369
1375
  const w = C.replace("data:", "").trim();
1370
1376
  if (Ke(w)) {
1371
- const { event: B, content: z, result: H, code: u, message: R } = JSON.parse(w);
1377
+ const { event: B, content: z, result: H, code: R, message: u } = JSON.parse(w);
1372
1378
  if (H === !1 || l.status !== 200) {
1373
- this.handleError(R, u, t);
1379
+ this.handleError(u, R, t);
1374
1380
  return;
1375
1381
  }
1376
1382
  switch (B) {
@@ -1381,13 +1387,13 @@ class io {
1381
1387
  this.handleEnd(t);
1382
1388
  break;
1383
1389
  case "error":
1384
- this.handleError(R, u, t);
1390
+ this.handleError(u, R, t);
1385
1391
  break;
1386
1392
  }
1387
1393
  }
1388
1394
  });
1389
- } catch (c) {
1390
- (c == null ? void 0 : c.code) !== 20 && this.handleError(c.message, c.code, t);
1395
+ } catch (r) {
1396
+ (r == null ? void 0 : r.code) !== 20 && this.handleError(r.message, r.code, t);
1391
1397
  break;
1392
1398
  }
1393
1399
  }).catch((l) => {