@blueking/ai-blueking 0.3.21 → 0.3.23
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/README.md +10 -3
- package/dist/composables/use-bk-ai.d.ts +22 -0
- package/dist/vue2/index.es.min.js +1 -1
- package/dist/vue2/index.iife.min.js +58 -58
- package/dist/vue2/index.umd.min.js +2 -2
- package/dist/vue2/style.css +1 -1
- package/dist/vue3/index.es.min.js +36 -36
- package/dist/vue3/index.iife.min.js +59 -59
- package/dist/vue3/index.umd.min.js +5 -5
- package/dist/vue3/style.css +1 -1
- package/package.json +6 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var O = (o, n, e) => (
|
|
1
|
+
var Te = Object.defineProperty;
|
|
2
|
+
var He = (o, n, e) => n in o ? Te(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
|
|
3
|
+
var O = (o, n, e) => (He(o, typeof n != "symbol" ? n + "" : n, e), e);
|
|
4
4
|
import { Popover as Re, Input as ve, Exception as Ve, clickoutside as De, bkTooltips as pe, Tag as xe, Alert as Ee, Button as Ye, Message as fe, Select as be, provideGlobalConfig as Ie } from "bkui-vue";
|
|
5
|
-
import { inject as Ae, ref as Y, onMounted as ae, onBeforeUnmount as le, defineComponent as I, withDirectives as q, openBlock as h, createElementBlock as g, createElementVNode as u, toDisplayString as
|
|
5
|
+
import { inject as Ae, ref as Y, onMounted as ae, onBeforeUnmount as le, defineComponent as I, withDirectives as q, openBlock as h, createElementBlock as g, createElementVNode as u, toDisplayString as H, unref as c, createCommentVNode as S, vShow as ke, createTextVNode as te, pushScopeId as ie, popScopeId as re, computed as K, normalizeStyle as Z, normalizeClass as ee, createVNode as R, Fragment as j, watch as we, createBlock as U, withCtx as F, renderList as ce, nextTick as Le, withModifiers as E, onBeforeMount as Xe, renderSlot as qe, provide as Ke } from "vue";
|
|
6
6
|
import se from "dayjs";
|
|
7
7
|
import ye from "highlight.js";
|
|
8
8
|
import Ue from "markdown-it";
|
|
@@ -45,12 +45,12 @@ function me(o) {
|
|
|
45
45
|
const M = a.getRangeAt(0).getBoundingClientRect(), y = window.innerWidth;
|
|
46
46
|
$.value = a.toString().trim();
|
|
47
47
|
const z = 80, B = 34, C = 10;
|
|
48
|
-
let
|
|
49
|
-
|
|
48
|
+
let T = M.left + window.scrollX + M.width / 2 - z / 2;
|
|
49
|
+
T = Math.max(C, Math.min(T, y - z - C));
|
|
50
50
|
let D = M.top + window.scrollY - B - C;
|
|
51
51
|
M.top > B + C || (D = M.bottom + window.scrollY + C), e.value = {
|
|
52
52
|
top: `${D}px`,
|
|
53
|
-
left: `${
|
|
53
|
+
left: `${T}px`
|
|
54
54
|
}, n.value = !0;
|
|
55
55
|
} else
|
|
56
56
|
i();
|
|
@@ -135,7 +135,7 @@ const We = (o) => {
|
|
|
135
135
|
translateShortcut: `你是受过语言翻译训练的高技能人工智能。我想让你把用三引号分隔的文本翻译(中文翻译成英文,其他语言翻译成中文),确保译文口语化、地道。
|
|
136
136
|
只给我输出结果,其他内容一概不要。请勿用引号将回复包起来
|
|
137
137
|
'''
|
|
138
|
-
{{
|
|
138
|
+
{{ SELECTED_TEXT }}
|
|
139
139
|
'''`,
|
|
140
140
|
explanationShortcut: "您是一位专业的解释者。请详细解释“{{ SELECTED_TEXT }}”。您的解释应包括 1) 基本含义和概念解释;2) 实际应用或使用案例;3) 如果是技术术语,请提供相关技术背景;4) 适当时提供具体示例,以帮助理解。使用清晰易懂的语言,确保非专业人员也能理解。如果该词/短语有多种含义,请列出主要定义。在确保信息完整性和准确性的同时,请保持答复简洁明了。"
|
|
141
141
|
}, f = (o) => Oe !== "en" ? Ne[o] || o : Ze[o] || o, Fe = [
|
|
@@ -162,14 +162,14 @@ const We = (o) => {
|
|
|
162
162
|
u(
|
|
163
163
|
"span",
|
|
164
164
|
$e,
|
|
165
|
-
|
|
165
|
+
H(n.text),
|
|
166
166
|
1
|
|
167
167
|
/* TEXT */
|
|
168
168
|
),
|
|
169
169
|
u(
|
|
170
170
|
"span",
|
|
171
171
|
et,
|
|
172
|
-
|
|
172
|
+
H(c(f)("您选择的文本内容")),
|
|
173
173
|
1
|
|
174
174
|
/* TEXT */
|
|
175
175
|
),
|
|
@@ -208,7 +208,7 @@ const We = (o) => {
|
|
|
208
208
|
}, [
|
|
209
209
|
nt,
|
|
210
210
|
te(
|
|
211
|
-
" " +
|
|
211
|
+
" " + H(c(f)("返回最新")),
|
|
212
212
|
1
|
|
213
213
|
/* TEXT */
|
|
214
214
|
)
|
|
@@ -340,7 +340,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
340
340
|
i.value ? (h(), g(
|
|
341
341
|
"span",
|
|
342
342
|
ht,
|
|
343
|
-
|
|
343
|
+
H(i.value),
|
|
344
344
|
1
|
|
345
345
|
/* TEXT */
|
|
346
346
|
)) : S("v-if", !0),
|
|
@@ -364,7 +364,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
364
364
|
i.value ? (h(), g(
|
|
365
365
|
"span",
|
|
366
366
|
bt,
|
|
367
|
-
|
|
367
|
+
H(i.value),
|
|
368
368
|
1
|
|
369
369
|
/* TEXT */
|
|
370
370
|
)) : S("v-if", !0),
|
|
@@ -382,7 +382,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
382
382
|
t.message.status === c(ne).Error ? (h(), g(
|
|
383
383
|
"span",
|
|
384
384
|
Lt,
|
|
385
|
-
|
|
385
|
+
H(t.message.content),
|
|
386
386
|
1
|
|
387
387
|
/* TEXT */
|
|
388
388
|
)) : (h(), g("span", {
|
|
@@ -404,7 +404,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
404
404
|
/* CLASS */
|
|
405
405
|
));
|
|
406
406
|
}
|
|
407
|
-
}), zt = { class: "prompt-list" }, Ct = { class: "search-group" }, Pt = ["onClick"], Bt = { class: "prompt-content" },
|
|
407
|
+
}), zt = { class: "prompt-list" }, Ct = { class: "search-group" }, Pt = ["onClick"], Bt = { class: "prompt-content" }, Tt = /* @__PURE__ */ I({
|
|
408
408
|
__name: "render-send",
|
|
409
409
|
props: {
|
|
410
410
|
prompts: {},
|
|
@@ -419,7 +419,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
419
419
|
}), C = K(() => {
|
|
420
420
|
var v;
|
|
421
421
|
return e.placeholder ? e.placeholder : (v = e.prompts) != null && v.length ? f("您可以键入 “/” 查看更多Prompt") : f("请输入");
|
|
422
|
-
}),
|
|
422
|
+
}), T = (v) => {
|
|
423
423
|
s("update:value", v), s("change-prompt", v);
|
|
424
424
|
}, D = () => {
|
|
425
425
|
var v;
|
|
@@ -435,7 +435,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
435
435
|
}, Q = (v, L) => {
|
|
436
436
|
L.key === "Enter" && !L.shiftKey && (L.preventDefault(), s("enter"));
|
|
437
437
|
}, W = () => {
|
|
438
|
-
|
|
438
|
+
T("");
|
|
439
439
|
}, N = () => {
|
|
440
440
|
var L;
|
|
441
441
|
const v = (L = y.value) == null ? void 0 : L.$el.querySelector("textarea");
|
|
@@ -487,7 +487,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
487
487
|
u(
|
|
488
488
|
"span",
|
|
489
489
|
Bt,
|
|
490
|
-
|
|
490
|
+
H(G.content),
|
|
491
491
|
1
|
|
492
492
|
/* TEXT */
|
|
493
493
|
)
|
|
@@ -538,7 +538,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
538
538
|
row: "1",
|
|
539
539
|
type: "textarea",
|
|
540
540
|
onFocus: d,
|
|
541
|
-
onInput:
|
|
541
|
+
onInput: T,
|
|
542
542
|
onKeydown: Q
|
|
543
543
|
}, null, 8, ["model-value", "placeholder"]),
|
|
544
544
|
v.value ? (h(), U(c(je), {
|
|
@@ -555,7 +555,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
555
555
|
/* STABLE */
|
|
556
556
|
}, 8, ["is-show"]));
|
|
557
557
|
}
|
|
558
|
-
}),
|
|
558
|
+
}), Ht = /* @__PURE__ */ A(Tt, [["__scopeId", "data-v-dd1d94cb"]]), Rt = { class: "ai-shortcuts" }, Vt = /* @__PURE__ */ I({
|
|
559
559
|
__name: "render-shortcuts",
|
|
560
560
|
props: {
|
|
561
561
|
shortcuts: {}
|
|
@@ -577,7 +577,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
577
577
|
}, {
|
|
578
578
|
default: F(() => [
|
|
579
579
|
te(
|
|
580
|
-
|
|
580
|
+
H(t.label),
|
|
581
581
|
1
|
|
582
582
|
/* TEXT */
|
|
583
583
|
)
|
|
@@ -620,7 +620,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
620
620
|
}, [
|
|
621
621
|
Et,
|
|
622
622
|
te(
|
|
623
|
-
" " +
|
|
623
|
+
" " + H(c(f)("终止生成")),
|
|
624
624
|
1
|
|
625
625
|
/* TEXT */
|
|
626
626
|
)
|
|
@@ -654,7 +654,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
654
654
|
u(
|
|
655
655
|
"span",
|
|
656
656
|
Xt,
|
|
657
|
-
|
|
657
|
+
H(e.value),
|
|
658
658
|
1
|
|
659
659
|
/* TEXT */
|
|
660
660
|
)
|
|
@@ -718,7 +718,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
718
718
|
}
|
|
719
719
|
}, C = (d) => {
|
|
720
720
|
l("choose-prompt", d);
|
|
721
|
-
},
|
|
721
|
+
}, T = (d) => {
|
|
722
722
|
l("change-prompt", d);
|
|
723
723
|
}, D = () => {
|
|
724
724
|
l("stop");
|
|
@@ -847,7 +847,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
847
847
|
u(
|
|
848
848
|
"span",
|
|
849
849
|
Jt,
|
|
850
|
-
|
|
850
|
+
H(c(f)("想对选中的文本做什么")),
|
|
851
851
|
1
|
|
852
852
|
/* TEXT */
|
|
853
853
|
),
|
|
@@ -860,12 +860,12 @@ const rt = /* @__PURE__ */ I({
|
|
|
860
860
|
/* CLASS, NEED_HYDRATION */
|
|
861
861
|
)) : S("v-if", !0),
|
|
862
862
|
u("section", Ot, [
|
|
863
|
-
R(
|
|
863
|
+
R(Ht, {
|
|
864
864
|
value: m.value,
|
|
865
865
|
"onUpdate:value": b[3] || (b[3] = (k) => m.value = k),
|
|
866
866
|
placeholder: d.placeholder,
|
|
867
867
|
prompts: d.prompts,
|
|
868
|
-
onChangePrompt:
|
|
868
|
+
onChangePrompt: T,
|
|
869
869
|
onChoosePrompt: C,
|
|
870
870
|
onEnter: B
|
|
871
871
|
}, null, 8, ["value", "placeholder", "prompts"]),
|
|
@@ -879,7 +879,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
879
879
|
default: F(() => [
|
|
880
880
|
Zt,
|
|
881
881
|
te(
|
|
882
|
-
" " +
|
|
882
|
+
" " + H(c(f)("发送")),
|
|
883
883
|
1
|
|
884
884
|
/* TEXT */
|
|
885
885
|
)
|
|
@@ -958,7 +958,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
958
958
|
y(), t.isMove = !0, t.type = "move", t.clientX = r.clientX, t.clientY = r.clientY;
|
|
959
959
|
}, C = (r) => {
|
|
960
960
|
y(), t.isMove = !0, t.type = "rightDrag", t.clientX = r.clientX;
|
|
961
|
-
},
|
|
961
|
+
}, T = (r) => {
|
|
962
962
|
y(), t.isMove = !0, t.type = "leftDrag", t.clientX = r.clientX;
|
|
963
963
|
}, D = (r) => {
|
|
964
964
|
y(), t.isMove = !0, t.type = "topDrag", t.clientY = r.clientY;
|
|
@@ -1038,7 +1038,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
1038
1038
|
/* CLASS */
|
|
1039
1039
|
),
|
|
1040
1040
|
te(
|
|
1041
|
-
" " +
|
|
1041
|
+
" " + H(r.name || c(f)("小鲸")) + " ",
|
|
1042
1042
|
1
|
|
1043
1043
|
/* TEXT */
|
|
1044
1044
|
),
|
|
@@ -1138,7 +1138,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
1138
1138
|
"span",
|
|
1139
1139
|
{
|
|
1140
1140
|
class: "drag-line left",
|
|
1141
|
-
onMousedown: E(
|
|
1141
|
+
onMousedown: E(T, ["stop"])
|
|
1142
1142
|
},
|
|
1143
1143
|
null,
|
|
1144
1144
|
32
|
|
@@ -1250,7 +1250,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
1250
1250
|
u(
|
|
1251
1251
|
"span",
|
|
1252
1252
|
no,
|
|
1253
|
-
|
|
1253
|
+
H(c(f)("问小鲸")),
|
|
1254
1254
|
1
|
|
1255
1255
|
/* TEXT */
|
|
1256
1256
|
)
|
|
@@ -1306,7 +1306,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
1306
1306
|
l("scroll-load");
|
|
1307
1307
|
}, C = (p) => {
|
|
1308
1308
|
l("ai-click", p);
|
|
1309
|
-
},
|
|
1309
|
+
}, T = (p) => {
|
|
1310
1310
|
l("choose-prompt", p);
|
|
1311
1311
|
}, D = (p) => {
|
|
1312
1312
|
l("change-prompt", p);
|
|
@@ -1346,7 +1346,7 @@ const rt = /* @__PURE__ */ I({
|
|
|
1346
1346
|
"user-photo": p.userPhoto,
|
|
1347
1347
|
onAiClick: C,
|
|
1348
1348
|
onChangePrompt: D,
|
|
1349
|
-
onChoosePrompt:
|
|
1349
|
+
onChoosePrompt: T,
|
|
1350
1350
|
onScrollLoad: B,
|
|
1351
1351
|
onSend: y,
|
|
1352
1352
|
onStop: z
|
|
@@ -1434,7 +1434,7 @@ class fo {
|
|
|
1434
1434
|
`).forEach((y) => {
|
|
1435
1435
|
const z = y.replace("data:", "").trim();
|
|
1436
1436
|
if (Ge(z)) {
|
|
1437
|
-
const { event: B, content: C, cover:
|
|
1437
|
+
const { event: B, content: C, cover: T, documents: D, result: p, code: x, message: Q } = JSON.parse(z);
|
|
1438
1438
|
if (p === !1 || i.status !== 200) {
|
|
1439
1439
|
this.handleError(Q, x, e);
|
|
1440
1440
|
return;
|
|
@@ -1448,7 +1448,7 @@ class fo {
|
|
|
1448
1448
|
this.handleReceiveMessage(W, e);
|
|
1449
1449
|
break;
|
|
1450
1450
|
case "done":
|
|
1451
|
-
this.handleEnd(e,
|
|
1451
|
+
this.handleEnd(e, T ? C : "");
|
|
1452
1452
|
break;
|
|
1453
1453
|
case "error":
|
|
1454
1454
|
this.handleError(Q, x, e);
|