@blueking/chat-x 0.0.1-beta.10 → 0.0.1-beta.11
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/components/ai-buttons/file-upload-btn/file-upload-btn.vue.d.ts +1 -0
- package/dist/components/ai-buttons/tool-btn/tool-btn.vue.d.ts +1 -0
- package/dist/components/chat-content/reference-content/reference-content.vue.d.ts +1 -0
- package/dist/components/chat-input/input-attachment/input-attachment.vue.d.ts +1 -0
- package/dist/components/markdown-token/code-content/code-content.vue.d.ts +1 -0
- package/dist/components/message-tools/message-tools.vue.d.ts +1 -0
- package/dist/composables/use-container-scroll.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/index.js +53 -44
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3612,49 +3612,53 @@ const useClipboard = () => ({ copy: function() {
|
|
|
3612
3612
|
}
|
|
3613
3613
|
};
|
|
3614
3614
|
}, CONTAINER_SCROLL_TOKEN = Symbol("CONTAINER_SCROLL_TOKEN"), useContainerScrollProvider = (e, n) => {
|
|
3615
|
-
let r = shallowRef(!1), i = null, o = shallowRef(0);
|
|
3615
|
+
let r = shallowRef(!1), i = null, o = shallowRef(0), s = shallowRef(!0);
|
|
3616
3616
|
provide(CONTAINER_SCROLL_TOKEN, computed(() => ({
|
|
3617
|
+
autoScrollEnabled: s.value,
|
|
3617
3618
|
isScrollBottom: r,
|
|
3618
3619
|
scrollBottomHeight: o,
|
|
3619
|
-
toScrollBottom:
|
|
3620
|
-
toScrollTop:
|
|
3620
|
+
toScrollBottom: c,
|
|
3621
|
+
toScrollTop: l
|
|
3621
3622
|
})));
|
|
3622
|
-
let
|
|
3623
|
+
let c = () => {
|
|
3623
3624
|
var e;
|
|
3624
|
-
(e = toValue(n)) == null || e.scrollIntoView({
|
|
3625
|
+
s.value = !0, (e = toValue(n)) == null || e.scrollIntoView({
|
|
3625
3626
|
behavior: "smooth",
|
|
3626
3627
|
block: "end"
|
|
3627
3628
|
});
|
|
3628
|
-
},
|
|
3629
|
+
}, l = () => {
|
|
3629
3630
|
var n;
|
|
3630
3631
|
(n = toValue(e)) == null || n.scrollTo({
|
|
3631
3632
|
top: 0,
|
|
3632
3633
|
behavior: "smooth"
|
|
3633
3634
|
});
|
|
3634
|
-
},
|
|
3635
|
+
}, u = () => {
|
|
3635
3636
|
let n = toValue(e);
|
|
3636
3637
|
if (!n) return;
|
|
3637
3638
|
let { scrollHeight: r, scrollTop: i, clientHeight: a } = n, s = r - i - a;
|
|
3638
3639
|
o.value = Math.max(0, s);
|
|
3640
|
+
}, d = (e) => {
|
|
3641
|
+
e.deltaY < 0 && (s.value = !1);
|
|
3639
3642
|
};
|
|
3640
3643
|
return onMounted(() => {
|
|
3641
3644
|
watchEffect(() => {
|
|
3642
|
-
let a = toValue(e),
|
|
3643
|
-
!a || !
|
|
3645
|
+
let a = toValue(e), c = toValue(n);
|
|
3646
|
+
!a || !c || (i == null || i.disconnect(), a.removeEventListener("scroll", u), a.removeEventListener("wheel", d), u(), i = new IntersectionObserver((e) => {
|
|
3644
3647
|
e.forEach((e) => {
|
|
3645
|
-
e.isIntersecting ? (r.value = !0, o.value = 0) : (r.value = !1,
|
|
3648
|
+
e.isIntersecting ? (r.value = !0, o.value = 0, s.value = !0) : (r.value = !1, u());
|
|
3646
3649
|
});
|
|
3647
|
-
}), i.observe(
|
|
3650
|
+
}), i.observe(c), a.addEventListener("scroll", u, { passive: !0 }), a.addEventListener("wheel", d, { passive: !0 }));
|
|
3648
3651
|
});
|
|
3649
3652
|
}), onScopeDispose(() => {
|
|
3650
3653
|
i == null || i.disconnect();
|
|
3651
3654
|
let n = toValue(e);
|
|
3652
|
-
n && n.removeEventListener("scroll",
|
|
3655
|
+
n && (n.removeEventListener("scroll", u), n.removeEventListener("wheel", d));
|
|
3653
3656
|
}), {
|
|
3657
|
+
autoScrollEnabled: s,
|
|
3654
3658
|
isScrollBottom: r,
|
|
3655
3659
|
scrollBottomHeight: o,
|
|
3656
|
-
toScrollBottom:
|
|
3657
|
-
toScrollTop:
|
|
3660
|
+
toScrollBottom: c,
|
|
3661
|
+
toScrollTop: l
|
|
3658
3662
|
};
|
|
3659
3663
|
}, useContainerScrollConsumer = () => inject(CONTAINER_SCROLL_TOKEN), MESSAGE_SLOT_ID = "ai-blueking-message-slot", AI_BLUEKING_MESSAGE_SLOT_ID = Symbol(MESSAGE_SLOT_ID), getMessageSlotId = () => inject(AI_BLUEKING_MESSAGE_SLOT_ID), useGlobalConfig = () => {
|
|
3660
3664
|
let e = computed(() => `#${MESSAGE_SLOT_ID}`);
|
|
@@ -6817,15 +6821,12 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6817
6821
|
onClick: c
|
|
6818
6822
|
}, [e.id in unref(ToolIconsMap) ? (openBlock(), createBlock(resolveDynamicComponent(unref(ToolIconsMap)[e.id]), { key: 0 })) : (openBlock(), createElementBlock("div", _hoisted_1$29, toDisplayString(e.name), 1))], 2)), [[unref(directive), o.value]]);
|
|
6819
6823
|
}
|
|
6820
|
-
}), _hoisted_1$28 = { class: "code-content-wrapper" }, _hoisted_2$19 = { class: "code-content-header" }, _hoisted_3$14 = { class: "code-header-language" }, _hoisted_4$12 = { class: "hljs-pre" }, _hoisted_5$9 = ["innerHTML"], _hoisted_6$4 = {
|
|
6821
|
-
key: 0,
|
|
6822
|
-
class: "code-line current-line"
|
|
6823
|
-
}, MAX_CACHE_SIZE = 500, code_content_default = /* @__PURE__ */ defineComponent({
|
|
6824
|
+
}), _hoisted_1$28 = { class: "code-content-wrapper" }, _hoisted_2$19 = { class: "code-content-header" }, _hoisted_3$14 = { class: "code-header-language" }, _hoisted_4$12 = { class: "hljs-pre" }, _hoisted_5$9 = ["innerHTML"], _hoisted_6$4 = ["innerHTML"], MAX_CACHE_SIZE = 500, code_content_default = /* @__PURE__ */ defineComponent({
|
|
6824
6825
|
__name: "code-content",
|
|
6825
6826
|
props: { token: {} },
|
|
6826
6827
|
emits: ["mounted"],
|
|
6827
6828
|
setup(n, { emit: r }) {
|
|
6828
|
-
let i = n, o = r, s = useTemplateRef("codeRef"), p = shallowRef(""), { copy: m } = useClipboard(), g = shallowRef([]), _ = shallowRef(""), v = /* @__PURE__ */ new Map(),
|
|
6829
|
+
let i = n, o = r, s = useTemplateRef("codeRef"), p = shallowRef(""), { copy: m } = useClipboard(), g = shallowRef([]), _ = shallowRef(""), v = shallowRef(""), y = /* @__PURE__ */ new Map(), b = (e) => {
|
|
6829
6830
|
for (let r of e) if (r.type === "fence" || r.type === "code_block") {
|
|
6830
6831
|
var n;
|
|
6831
6832
|
return {
|
|
@@ -6838,16 +6839,18 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6838
6839
|
language: ""
|
|
6839
6840
|
};
|
|
6840
6841
|
}, x = (e) => {
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6842
|
+
var n;
|
|
6843
|
+
let r = MarkdownLanguageMap[e] || e;
|
|
6844
|
+
if (hljs.getLanguage(r)) return r;
|
|
6845
|
+
let i = (n = e.match(/\.\w+$/)) == null ? void 0 : n[0];
|
|
6846
|
+
if (i) {
|
|
6847
|
+
let e = i.slice(1);
|
|
6848
|
+
if (hljs.getLanguage(e)) return e;
|
|
6846
6849
|
}
|
|
6847
|
-
return
|
|
6850
|
+
return null;
|
|
6848
6851
|
}, S = (e, n) => {
|
|
6849
6852
|
if (!e) return "";
|
|
6850
|
-
let r = `${n || ""}:${e}`, i =
|
|
6853
|
+
let r = `${n || ""}:${e}`, i = y.get(r);
|
|
6851
6854
|
if (i !== void 0) return i;
|
|
6852
6855
|
let a;
|
|
6853
6856
|
if (n) try {
|
|
@@ -6859,13 +6862,15 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6859
6862
|
a = C(e);
|
|
6860
6863
|
}
|
|
6861
6864
|
else a = C(e);
|
|
6862
|
-
return
|
|
6865
|
+
return y.set(r, a), y.size > MAX_CACHE_SIZE && Array.from(y.keys()).slice(0, Math.floor(MAX_CACHE_SIZE / 2)).forEach((e) => y.delete(e)), a;
|
|
6863
6866
|
}, C = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """), w = (e, n) => {
|
|
6864
6867
|
var r;
|
|
6865
6868
|
let i = x(n), a = e.split("\n");
|
|
6866
6869
|
if (a.length === 1) {
|
|
6867
6870
|
var o;
|
|
6868
|
-
g.value = []
|
|
6871
|
+
g.value = [];
|
|
6872
|
+
let e = (o = a[0]) == null ? "" : o;
|
|
6873
|
+
_.value = e, v.value = e ? S(e, i) : "";
|
|
6869
6874
|
return;
|
|
6870
6875
|
}
|
|
6871
6876
|
let s = a.slice(0, -1), c = (r = a[a.length - 1]) == null ? "" : r, l = g.value, u = [];
|
|
@@ -6877,14 +6882,8 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6877
6882
|
html: S(n, i)
|
|
6878
6883
|
});
|
|
6879
6884
|
}
|
|
6880
|
-
g.value = u, _.value = c,
|
|
6881
|
-
}, D = () => {
|
|
6882
|
-
y !== null && cancelAnimationFrame(y), y = requestAnimationFrame(() => {
|
|
6883
|
-
y = requestAnimationFrame(() => {
|
|
6884
|
-
y = null;
|
|
6885
|
-
});
|
|
6886
|
-
});
|
|
6887
|
-
}, O = computed(() => {
|
|
6885
|
+
g.value = u, _.value = c, v.value = c ? S(c, i) : "";
|
|
6886
|
+
}, D = computed(() => {
|
|
6888
6887
|
let { language: e } = b(i.token), n = ["hljs"];
|
|
6889
6888
|
return e && n.push(`language-${e}`), n.join(" ");
|
|
6890
6889
|
});
|
|
@@ -6899,7 +6898,7 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6899
6898
|
immediate: !0,
|
|
6900
6899
|
deep: !0
|
|
6901
6900
|
});
|
|
6902
|
-
let
|
|
6901
|
+
let O = () => {
|
|
6903
6902
|
var e;
|
|
6904
6903
|
let n = (e = s.value) == null ? void 0 : e.innerText;
|
|
6905
6904
|
n && m(n);
|
|
@@ -6908,15 +6907,19 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6908
6907
|
id: "copy",
|
|
6909
6908
|
description: "复制",
|
|
6910
6909
|
name: "复制",
|
|
6911
|
-
onClick:
|
|
6910
|
+
onClick: O
|
|
6912
6911
|
})]), createElementVNode("pre", _hoisted_4$12, [createElementVNode("code", {
|
|
6913
6912
|
ref_key: "codeRef",
|
|
6914
6913
|
ref: s,
|
|
6915
|
-
class: normalizeClass(
|
|
6914
|
+
class: normalizeClass(D.value)
|
|
6916
6915
|
}, [(openBlock(!0), createElementBlock(Fragment, null, renderList(g.value, (n, i) => (openBlock(), createElementBlock(Fragment, { key: `completed-${i}` }, [createElementVNode("span", {
|
|
6917
6916
|
class: "code-line",
|
|
6918
6917
|
innerHTML: n.html
|
|
6919
|
-
}, null, 8, _hoisted_5$9), r[0] || (r[0] = createTextVNode(toDisplayString("\n"), -1))], 64))), 128)), _.value ? (openBlock(), createElementBlock("span",
|
|
6918
|
+
}, null, 8, _hoisted_5$9), r[0] || (r[0] = createTextVNode(toDisplayString("\n"), -1))], 64))), 128)), _.value ? (openBlock(), createElementBlock("span", {
|
|
6919
|
+
key: 0,
|
|
6920
|
+
class: "code-line current-line",
|
|
6921
|
+
innerHTML: v.value
|
|
6922
|
+
}, null, 8, _hoisted_6$4)) : createCommentVNode("", !0)], 2)])]));
|
|
6920
6923
|
}
|
|
6921
6924
|
}), import_debounce = /* @__PURE__ */ __toESM(require_debounce()), _hoisted_1$27 = { class: "md-image-wrapper" }, _hoisted_2$18 = {
|
|
6922
6925
|
key: 0,
|
|
@@ -7528,8 +7531,11 @@ var vnode_renderer_default = defineComponent({
|
|
|
7528
7531
|
trailing: !0
|
|
7529
7532
|
}), { immediate: !0 });
|
|
7530
7533
|
let g = (0, import_throttle.default)(() => {
|
|
7531
|
-
var e
|
|
7532
|
-
a == null || (e = a.value) == null
|
|
7534
|
+
var e;
|
|
7535
|
+
if ((a == null || (e = a.value) == null ? void 0 : e.autoScrollEnabled) !== !1) {
|
|
7536
|
+
var n, r;
|
|
7537
|
+
a == null || (n = a.value) == null || (r = n.toScrollBottom) == null || r.call(n);
|
|
7538
|
+
}
|
|
7533
7539
|
}, 100, {
|
|
7534
7540
|
leading: !0,
|
|
7535
7541
|
trailing: !0
|
|
@@ -10715,7 +10721,10 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10715
10721
|
class: "ai-activity-message-title",
|
|
10716
10722
|
onClick: a[0] || (a[0] = (e) => o.value = !o.value)
|
|
10717
10723
|
}, [
|
|
10718
|
-
createElementVNode("span", _hoisted_2$7, [r.value
|
|
10724
|
+
createElementVNode("span", _hoisted_2$7, [r.value && (e.status === unref(MessageStatus).Pending || e.status === unref(MessageStatus).Streaming) ? (openBlock(), createBlock(ai_loading_default, { key: 0 })) : (openBlock(), createBlock(unref(DocumentIcon), {
|
|
10725
|
+
key: 1,
|
|
10726
|
+
style: { "font-size": "12px" }
|
|
10727
|
+
}))]),
|
|
10719
10728
|
createElementVNode("span", _hoisted_3$6, toDisplayString(i.value), 1),
|
|
10720
10729
|
createElementVNode("span", { class: normalizeClass(["ai-activity-message-title-icon collapsed-icon", { "is-collapsed": o.value }]) }, [createVNode(unref(CollapsedIcon))], 2)
|
|
10721
10730
|
]), withDirectives(createElementVNode("div", _hoisted_4$4, [r.value ? (openBlock(), createElementBlock("div", _hoisted_5$3, [createVNode(markdown_content_default, { content: Array.isArray(e.content) ? e.content.join("\n") : ((d = e.content) == null ? void 0 : d.content) || "" }, null, 8, ["content"])])) : createCommentVNode("", !0), createVNode(reference_content_default, { content: Array.isArray(e.content) ? e.content : ((p = e.content) == null ? void 0 : p.referenceDocument) || [] }, null, 8, ["content"])], 512), [[vShow, !o.value]])]);
|
|
@@ -11165,7 +11174,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11165
11174
|
props: /* @__PURE__ */ mergeModels({
|
|
11166
11175
|
enableSelection: {
|
|
11167
11176
|
type: Boolean,
|
|
11168
|
-
default: !
|
|
11177
|
+
default: !1
|
|
11169
11178
|
},
|
|
11170
11179
|
messages: {},
|
|
11171
11180
|
messageStatus: {},
|