@blueking/ai-blueking 0.3.27 → 0.3.28
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/types/enum.d.ts +1 -0
- package/dist/vue2/index.es.min.js +4 -4
- package/dist/vue2/index.iife.min.js +2 -2
- package/dist/vue2/index.umd.min.js +8 -8
- package/dist/vue2/style.css +1 -1
- package/dist/vue3/index.es.min.js +40 -40
- package/dist/vue3/index.iife.min.js +2 -2
- package/dist/vue3/index.umd.min.js +2 -2
- package/dist/vue3/style.css +1 -1
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ function me() {
|
|
|
14
14
|
enablePopup: Ke(Te, !0)
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Be() {
|
|
18
18
|
const o = I(!1), n = () => {
|
|
19
19
|
const l = document.querySelector(".ai-blueking-messages");
|
|
20
20
|
l.scrollTop = l.scrollHeight;
|
|
@@ -46,7 +46,7 @@ function ge(o) {
|
|
|
46
46
|
let t = !1, g = null;
|
|
47
47
|
const i = (m) => {
|
|
48
48
|
g = { x: m.clientX, y: m.clientY };
|
|
49
|
-
},
|
|
49
|
+
}, B = (m) => {
|
|
50
50
|
s = m, g && (t = Math.sqrt(
|
|
51
51
|
Math.pow(m.clientX - g.x, 2) + Math.pow(m.clientY - g.y, 2)
|
|
52
52
|
) > 5), g = null;
|
|
@@ -114,9 +114,9 @@ function ge(o) {
|
|
|
114
114
|
$.value = m;
|
|
115
115
|
};
|
|
116
116
|
return le(() => {
|
|
117
|
-
o && (document.addEventListener("selectionchange", P), document.addEventListener("mousedown", i), document.addEventListener("mouseup",
|
|
117
|
+
o && (document.addEventListener("selectionchange", P), document.addEventListener("mousedown", i), document.addEventListener("mouseup", B), document.addEventListener("click", R, !0));
|
|
118
118
|
}), ie(() => {
|
|
119
|
-
o && (document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", i), document.removeEventListener("mouseup",
|
|
119
|
+
o && (document.removeEventListener("selectionchange", P), document.removeEventListener("mousedown", i), document.removeEventListener("mouseup", B), document.removeEventListener("click", R, !0)), clearTimeout(a);
|
|
120
120
|
}), {
|
|
121
121
|
isIconVisible: n,
|
|
122
122
|
iconPosition: e,
|
|
@@ -243,7 +243,7 @@ const Ze = (o) => {
|
|
|
243
243
|
for (const [a, s] of n)
|
|
244
244
|
e[a] = s;
|
|
245
245
|
return e;
|
|
246
|
-
},
|
|
246
|
+
}, He = /* @__PURE__ */ W(at, [["__scopeId", "data-v-3fd96961"]]), lt = (o) => (re("data-v-a8d839da"), o = o(), ce(), o), it = /* @__PURE__ */ lt(() => /* @__PURE__ */ d(
|
|
247
247
|
"i",
|
|
248
248
|
{ class: "ai-blueking-icon ai-blueking-xiangxia-2" },
|
|
249
249
|
null,
|
|
@@ -252,7 +252,7 @@ const Ze = (o) => {
|
|
|
252
252
|
)), rt = /* @__PURE__ */ q({
|
|
253
253
|
__name: "render-back",
|
|
254
254
|
setup(o) {
|
|
255
|
-
const { isShow: n, scrollToBottom: e } =
|
|
255
|
+
const { isShow: n, scrollToBottom: e } = Be();
|
|
256
256
|
return (a, s) => p(n) ? (h(), f("span", {
|
|
257
257
|
key: 0,
|
|
258
258
|
class: "ai-blueking-render-back",
|
|
@@ -275,7 +275,7 @@ const Ze = (o) => {
|
|
|
275
275
|
return e[a].attrSet("target", "_blank"), n(e, a, s, l, t);
|
|
276
276
|
};
|
|
277
277
|
};
|
|
278
|
-
var Re = /* @__PURE__ */ ((o) => (o.Assistant = "assistant", o.Cite = "cite", o.System = "system", o.User = "user", o))(Re || {}), se = /* @__PURE__ */ ((o) => (o.Error = "error", o.Loading = "loading", o.Success = "success", o))(se || {});
|
|
278
|
+
var Re = /* @__PURE__ */ ((o) => (o.Assistant = "assistant", o.Cite = "cite", o.Ignore = "ignore", o.System = "system", o.User = "user", o))(Re || {}), se = /* @__PURE__ */ ((o) => (o.Error = "error", o.Loading = "loading", o.Success = "success", o))(se || {});
|
|
279
279
|
const pt = /* @__PURE__ */ q({
|
|
280
280
|
__name: "ai-avatar",
|
|
281
281
|
props: {
|
|
@@ -380,7 +380,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
380
380
|
},
|
|
381
381
|
[
|
|
382
382
|
t.message.cite ? (h(), f("div", mt, [
|
|
383
|
-
Y(
|
|
383
|
+
Y(He, {
|
|
384
384
|
text: t.message.cite
|
|
385
385
|
}, null, 8, ["text"])
|
|
386
386
|
])) : T("v-if", !0),
|
|
@@ -457,7 +457,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
457
457
|
/* CLASS */
|
|
458
458
|
));
|
|
459
459
|
}
|
|
460
|
-
}),
|
|
460
|
+
}), Bt = { class: "prompt-list" }, Ht = { class: "search-group" }, Rt = ["onClick"], xt = { class: "prompt-content" }, Vt = /* @__PURE__ */ q({
|
|
461
461
|
__name: "render-send",
|
|
462
462
|
props: {
|
|
463
463
|
prompts: {},
|
|
@@ -466,9 +466,9 @@ const pt = /* @__PURE__ */ q({
|
|
|
466
466
|
},
|
|
467
467
|
emits: ["change-prompt", "update:value", "enter", "choose-prompt"],
|
|
468
468
|
setup(o, { emit: n }) {
|
|
469
|
-
const e = o, a = n, { enablePopup: s } = me(), l = Ae, t = he, { selectedText: g, lockSelectedText: i } = ge(s),
|
|
469
|
+
const e = o, a = n, { enablePopup: s } = me(), l = Ae, t = he, { selectedText: g, lockSelectedText: i } = ge(s), B = I(""), V = I(40), w = I(), P = I(!1), L = Q(() => {
|
|
470
470
|
var b;
|
|
471
|
-
return ((b = e.prompts) == null ? void 0 : b.filter((
|
|
471
|
+
return ((b = e.prompts) == null ? void 0 : b.filter((H) => H.content.includes(B.value))) || [];
|
|
472
472
|
}), R = Q(() => {
|
|
473
473
|
var b;
|
|
474
474
|
return e.placeholder ? e.placeholder : (b = e.prompts) != null && b.length ? y("您可以键入 “/” 查看更多Prompt") : y("请输入");
|
|
@@ -479,19 +479,19 @@ const pt = /* @__PURE__ */ q({
|
|
|
479
479
|
e.value === "/" && ((b = e.prompts) != null && b.length) ? v() : k();
|
|
480
480
|
}, m = () => {
|
|
481
481
|
ze(() => {
|
|
482
|
-
var
|
|
483
|
-
const b = (
|
|
482
|
+
var H;
|
|
483
|
+
const b = (H = w.value) == null ? void 0 : H.$el.querySelector("textarea");
|
|
484
484
|
(b == null ? void 0 : b.scrollHeight) > 40 && e.value ? V.value = b.scrollHeight <= 300 ? b.scrollHeight : 300 : V.value = 40;
|
|
485
485
|
});
|
|
486
486
|
}, z = (b) => {
|
|
487
487
|
a("update:value", b.content), a("choose-prompt", b), k(), M();
|
|
488
|
-
}, u = (b,
|
|
489
|
-
|
|
488
|
+
}, u = (b, H) => {
|
|
489
|
+
H.key === "Enter" && !H.shiftKey && (H.preventDefault(), a("enter"));
|
|
490
490
|
}, S = () => {
|
|
491
491
|
x("");
|
|
492
492
|
}, M = () => {
|
|
493
|
-
var
|
|
494
|
-
const b = (
|
|
493
|
+
var H;
|
|
494
|
+
const b = (H = w.value) == null ? void 0 : H.$el.querySelector("textarea");
|
|
495
495
|
b == null || b.focus();
|
|
496
496
|
}, r = () => {
|
|
497
497
|
g.value && (i.value = !0);
|
|
@@ -505,7 +505,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
505
505
|
() => {
|
|
506
506
|
m(), A();
|
|
507
507
|
}
|
|
508
|
-
), le(M), (b,
|
|
508
|
+
), le(M), (b, H) => (h(), K(p(Ye), {
|
|
509
509
|
width: "calc(100% - 118px)",
|
|
510
510
|
"ext-cls": "empty-padding",
|
|
511
511
|
arrow: !1,
|
|
@@ -520,15 +520,15 @@ const pt = /* @__PURE__ */ q({
|
|
|
520
520
|
var ne;
|
|
521
521
|
return [
|
|
522
522
|
d("div", null, [
|
|
523
|
-
j((h(), f("section",
|
|
523
|
+
j((h(), f("section", Bt, [
|
|
524
524
|
Y(p(ke), {
|
|
525
525
|
class: "input-search",
|
|
526
|
-
modelValue:
|
|
527
|
-
"onUpdate:modelValue":
|
|
526
|
+
modelValue: B.value,
|
|
527
|
+
"onUpdate:modelValue": H[0] || (H[0] = (J) => B.value = J),
|
|
528
528
|
behavior: "simplicity",
|
|
529
529
|
clearable: ""
|
|
530
530
|
}, null, 8, ["modelValue"]),
|
|
531
|
-
d("section",
|
|
531
|
+
d("section", Ht, [
|
|
532
532
|
(h(!0), f(
|
|
533
533
|
U,
|
|
534
534
|
null,
|
|
@@ -749,7 +749,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
749
749
|
},
|
|
750
750
|
emits: ["ai-click", "change-prompt", "send", "choose-prompt", "scroll-load", "stop"],
|
|
751
751
|
setup(o, { expose: n, emit: e }) {
|
|
752
|
-
const a = o, s = e, { enablePopup: l } = me(), t = he, g = I(""), { selectedText: i, clearSelection:
|
|
752
|
+
const a = o, s = e, { enablePopup: l } = me(), t = he, g = I(""), { selectedText: i, clearSelection: B } = ge(l), { isShow: V } = Be(), w = () => {
|
|
753
753
|
ze(() => {
|
|
754
754
|
const r = document.querySelector(".ai-blueking-messages");
|
|
755
755
|
r.scrollTop = r.scrollHeight;
|
|
@@ -912,10 +912,10 @@ const pt = /* @__PURE__ */ q({
|
|
|
912
912
|
}, ["prevent"]))
|
|
913
913
|
},
|
|
914
914
|
[
|
|
915
|
-
Y(
|
|
915
|
+
Y(He, {
|
|
916
916
|
"show-close-icon": !0,
|
|
917
917
|
text: p(i),
|
|
918
|
-
onClose: p(
|
|
918
|
+
onClose: p(B)
|
|
919
919
|
}, null, 8, ["text", "onClose"]),
|
|
920
920
|
d(
|
|
921
921
|
"span",
|
|
@@ -990,9 +990,9 @@ const pt = /* @__PURE__ */ q({
|
|
|
990
990
|
logo: { default: "ai-blueking-icon ai-blueking-ai" },
|
|
991
991
|
name: {},
|
|
992
992
|
startPosition: { default: () => ({
|
|
993
|
-
top:
|
|
993
|
+
top: 0,
|
|
994
994
|
bottom: 0,
|
|
995
|
-
left: window.innerWidth -
|
|
995
|
+
left: window.innerWidth - 450,
|
|
996
996
|
right: 0
|
|
997
997
|
}) },
|
|
998
998
|
models: {},
|
|
@@ -1017,7 +1017,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1017
1017
|
left: c((N = e.startPosition) == null ? void 0 : N.left, 0),
|
|
1018
1018
|
right: c((G = e.startPosition) == null ? void 0 : G.right, l.width - e.sizeLimit.width)
|
|
1019
1019
|
};
|
|
1020
|
-
})()),
|
|
1020
|
+
})()), B = Q(() => i.value.top <= e.positionLimit.top && i.value.bottom <= e.positionLimit.bottom), V = (c) => {
|
|
1021
1021
|
a("choose-model", c);
|
|
1022
1022
|
}, w = () => {
|
|
1023
1023
|
document.querySelectorAll("iframe").forEach((C) => {
|
|
@@ -1058,7 +1058,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1058
1058
|
c.preventDefault();
|
|
1059
1059
|
const C = c.clientX - t.clientX, D = c.clientY - t.clientY;
|
|
1060
1060
|
v(C, D), k(C, D), t.clientX = c.clientX, t.clientY = c.clientY;
|
|
1061
|
-
},
|
|
1061
|
+
}, H = () => {
|
|
1062
1062
|
l.width = window.innerWidth, l.height = window.innerHeight;
|
|
1063
1063
|
const c = l.width - i.value.left - i.value.right, C = l.height - i.value.top - i.value.bottom, D = Math.max(c, e.sizeLimit.width), N = Math.max(C, e.sizeLimit.height), G = l.width - D, O = l.height - N;
|
|
1064
1064
|
i.value.top = Math.max(
|
|
@@ -1084,9 +1084,9 @@ const pt = /* @__PURE__ */ q({
|
|
|
1084
1084
|
a("close");
|
|
1085
1085
|
};
|
|
1086
1086
|
return je(() => {
|
|
1087
|
-
window.addEventListener("mousemove", b, !0), window.addEventListener("mouseup", r), window.addEventListener("resize",
|
|
1087
|
+
window.addEventListener("mousemove", b, !0), window.addEventListener("mouseup", r), window.addEventListener("resize", H);
|
|
1088
1088
|
}), ie(() => {
|
|
1089
|
-
window.removeEventListener("mousemove", b, !0), window.removeEventListener("mouseup", r), window.removeEventListener("resize",
|
|
1089
|
+
window.removeEventListener("mousemove", b, !0), window.removeEventListener("mouseup", r), window.removeEventListener("resize", H);
|
|
1090
1090
|
}), (c, C) => (h(), f(
|
|
1091
1091
|
"section",
|
|
1092
1092
|
{
|
|
@@ -1149,7 +1149,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1149
1149
|
}, 8, ["model-value"])) : T("v-if", !0)
|
|
1150
1150
|
]),
|
|
1151
1151
|
d("span", null, [
|
|
1152
|
-
|
|
1152
|
+
B.value ? j((h(), f(
|
|
1153
1153
|
"i",
|
|
1154
1154
|
{
|
|
1155
1155
|
key: 0,
|
|
@@ -1301,7 +1301,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1301
1301
|
/* STYLE */
|
|
1302
1302
|
));
|
|
1303
1303
|
}
|
|
1304
|
-
}), so = /* @__PURE__ */ W(no, [["__scopeId", "data-v-
|
|
1304
|
+
}), so = /* @__PURE__ */ W(no, [["__scopeId", "data-v-34f200d5"]]), ao = (o) => (re("data-v-fb4bdb25"), o = o(), ce(), o), lo = { class: "popup-content" }, io = /* @__PURE__ */ ao(() => /* @__PURE__ */ d(
|
|
1305
1305
|
"i",
|
|
1306
1306
|
{ class: "ai-blueking-icon ai-blueking-ai" },
|
|
1307
1307
|
null,
|
|
@@ -1313,12 +1313,12 @@ const pt = /* @__PURE__ */ q({
|
|
|
1313
1313
|
__name: "render-popup",
|
|
1314
1314
|
emits: ["click", "shortcutClick"],
|
|
1315
1315
|
setup(o, { emit: n }) {
|
|
1316
|
-
const { enablePopup: e } = me(), { isIconVisible: a, iconPosition: s, selectedText: l, clearSelection: t, popupRef: g } = ge(e), i = fe,
|
|
1317
|
-
|
|
1316
|
+
const { enablePopup: e } = me(), { isIconVisible: a, iconPosition: s, selectedText: l, clearSelection: t, popupRef: g } = ge(e), i = fe, B = n, V = () => {
|
|
1317
|
+
B("click"), a.value = !1;
|
|
1318
1318
|
}, w = (P) => {
|
|
1319
1319
|
try {
|
|
1320
1320
|
const L = ve(P.prompt, l.value);
|
|
1321
|
-
|
|
1321
|
+
B("shortcutClick", {
|
|
1322
1322
|
cite: l.value,
|
|
1323
1323
|
content: P.label,
|
|
1324
1324
|
prompt: L
|
|
@@ -1407,7 +1407,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1407
1407
|
s("update:isShow", !0);
|
|
1408
1408
|
}, i = () => {
|
|
1409
1409
|
s("clear");
|
|
1410
|
-
},
|
|
1410
|
+
}, B = () => {
|
|
1411
1411
|
s("update:isShow", !1), s("close");
|
|
1412
1412
|
}, V = (u) => {
|
|
1413
1413
|
s("update:model", u);
|
|
@@ -1457,7 +1457,7 @@ const pt = /* @__PURE__ */ q({
|
|
|
1457
1457
|
"start-position": u.startPosition,
|
|
1458
1458
|
onChooseModel: V,
|
|
1459
1459
|
onClear: i,
|
|
1460
|
-
onClose:
|
|
1460
|
+
onClose: B
|
|
1461
1461
|
}, {
|
|
1462
1462
|
default: _(() => [
|
|
1463
1463
|
Y(to, {
|
|
@@ -1551,12 +1551,12 @@ class Co {
|
|
|
1551
1551
|
let g = "";
|
|
1552
1552
|
for (; ; )
|
|
1553
1553
|
try {
|
|
1554
|
-
const { value: i, done:
|
|
1554
|
+
const { value: i, done: B } = await t.read();
|
|
1555
1555
|
if (!l.ok) {
|
|
1556
1556
|
this.handleError(i || l.statusText, l.status, e);
|
|
1557
1557
|
break;
|
|
1558
1558
|
}
|
|
1559
|
-
if (
|
|
1559
|
+
if (B) {
|
|
1560
1560
|
this.handleEnd(e);
|
|
1561
1561
|
break;
|
|
1562
1562
|
}
|