@blueking/chat-x 0.0.1-beta.12 → 0.0.1-beta.14
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/tool-btn/tool-btn.vue.d.ts +2 -0
- package/dist/components/ai-selection/ai-selection.vue.d.ts +2 -0
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +2 -0
- package/dist/index.css +1 -1
- package/dist/index.js +72 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2998,14 +2998,15 @@ var _hoisted_1$33 = ["src"], shortcut_btn_default = /* @__PURE__ */ defineCompon
|
|
|
2998
2998
|
props: /* @__PURE__ */ mergeModels({
|
|
2999
2999
|
maxShortcutCount: { default: 3 },
|
|
3000
3000
|
offset: { default: 10 },
|
|
3001
|
-
shortcuts: { default: () => DEFAULT_SHORTCUTS }
|
|
3001
|
+
shortcuts: { default: () => DEFAULT_SHORTCUTS },
|
|
3002
|
+
excludeSelectors: { default: () => [] }
|
|
3002
3003
|
}, {
|
|
3003
3004
|
visible: _objectSpread2({ type: Boolean }, { required: !0 }),
|
|
3004
3005
|
visibleModifiers: {}
|
|
3005
3006
|
}),
|
|
3006
3007
|
emits: /* @__PURE__ */ mergeModels(["selectShortcut", "selectionChange"], ["update:visible"]),
|
|
3007
3008
|
setup(r, { emit: a }) {
|
|
3008
|
-
useCssVars((e) => ({
|
|
3009
|
+
useCssVars((e) => ({ e53ba118: unref(SELECTION_Z_INDEX) }));
|
|
3009
3010
|
let o = r, d = useModel(r, "visible"), p = a, m = useTemplateRef("popoverRef"), g = useTemplateRef("moreMenuRef"), _ = shallowRef({
|
|
3010
3011
|
x: 0,
|
|
3011
3012
|
y: 0
|
|
@@ -3036,7 +3037,7 @@ var _hoisted_1$33 = ["src"], shortcut_btn_default = /* @__PURE__ */ defineCompon
|
|
|
3036
3037
|
}
|
|
3037
3038
|
}, S = function() {
|
|
3038
3039
|
var e = _asyncToGenerator(function* () {
|
|
3039
|
-
var e;
|
|
3040
|
+
var e, n;
|
|
3040
3041
|
if (y.value = window.getSelection(), !y.value) {
|
|
3041
3042
|
let e = document.activeElement;
|
|
3042
3043
|
if (e) {
|
|
@@ -3044,37 +3045,49 @@ var _hoisted_1$33 = ["src"], shortcut_btn_default = /* @__PURE__ */ defineCompon
|
|
|
3044
3045
|
n && (y.value = n);
|
|
3045
3046
|
}
|
|
3046
3047
|
}
|
|
3047
|
-
let
|
|
3048
|
-
if (!
|
|
3048
|
+
let r = (e = y.value) == null || (e = e.toString()) == null ? void 0 : e.trim();
|
|
3049
|
+
if (!r) {
|
|
3049
3050
|
C();
|
|
3050
3051
|
return;
|
|
3051
3052
|
}
|
|
3052
|
-
|
|
3053
|
-
|
|
3053
|
+
if (o.excludeSelectors.length > 0 && (n = y.value) != null && n.rangeCount) try {
|
|
3054
|
+
let e = y.value.getRangeAt(0).commonAncestorContainer, n = e.nodeType === Node.TEXT_NODE ? e.parentNode : e;
|
|
3055
|
+
for (; n && n !== document.body;) {
|
|
3056
|
+
if (n instanceof Element) {
|
|
3057
|
+
for (let e of o.excludeSelectors) if (n.closest(e)) {
|
|
3058
|
+
C();
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
n = n.parentNode;
|
|
3063
|
+
}
|
|
3064
|
+
} catch (e) {}
|
|
3065
|
+
r !== v.value && p("selectionChange", r), v.value = r;
|
|
3066
|
+
let i = null;
|
|
3054
3067
|
try {
|
|
3055
|
-
var
|
|
3056
|
-
if ((
|
|
3057
|
-
var
|
|
3058
|
-
let e = (
|
|
3059
|
-
(e == null ? void 0 : e.getClientRects()).length > 0 && (
|
|
3068
|
+
var a;
|
|
3069
|
+
if ((a = y.value) != null && a.rangeCount) {
|
|
3070
|
+
var s;
|
|
3071
|
+
let e = (s = y.value) == null ? void 0 : s.getRangeAt(0);
|
|
3072
|
+
(e == null ? void 0 : e.getClientRects()).length > 0 && (i = e.getBoundingClientRect());
|
|
3060
3073
|
}
|
|
3061
3074
|
} catch (e) {
|
|
3062
3075
|
C();
|
|
3063
3076
|
return;
|
|
3064
3077
|
}
|
|
3065
|
-
let
|
|
3066
|
-
if (!
|
|
3078
|
+
let c = document.activeElement;
|
|
3079
|
+
if (!i || i.width === 0 && i.height === 0) if (c instanceof HTMLInputElement || c instanceof HTMLTextAreaElement) i = c.getBoundingClientRect();
|
|
3067
3080
|
else {
|
|
3068
3081
|
C();
|
|
3069
3082
|
return;
|
|
3070
3083
|
}
|
|
3071
3084
|
d.value = !0, yield nextTick();
|
|
3072
|
-
let
|
|
3073
|
-
|
|
3074
|
-
let
|
|
3075
|
-
|
|
3076
|
-
x:
|
|
3077
|
-
y:
|
|
3085
|
+
let l = m.value.getBoundingClientRect(), u = window.innerWidth, f = window.innerHeight, g = i.left + i.width / 2 - l.width / 2;
|
|
3086
|
+
g < 8 ? g = 8 : g + l.width > u - 8 && (g = u - l.width - 8);
|
|
3087
|
+
let b, S = i.top, w = f - i.bottom, E = l.height + o.offset;
|
|
3088
|
+
b = S >= E ? i.top - l.height - o.offset : w >= E ? i.bottom + o.offset : S >= w ? Math.max(8, i.top - l.height - o.offset) : Math.min(f - l.height - 8, i.bottom + o.offset), _.value = {
|
|
3089
|
+
x: g,
|
|
3090
|
+
y: b
|
|
3078
3091
|
};
|
|
3079
3092
|
});
|
|
3080
3093
|
return function() {
|
|
@@ -6801,17 +6814,17 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6801
6814
|
id: {},
|
|
6802
6815
|
name: {},
|
|
6803
6816
|
active: { type: Boolean },
|
|
6804
|
-
disabled: { type: Boolean }
|
|
6817
|
+
disabled: { type: Boolean },
|
|
6818
|
+
tippyOptions: {}
|
|
6805
6819
|
},
|
|
6806
6820
|
emits: ["click"],
|
|
6807
6821
|
setup(e, { emit: n }) {
|
|
6808
|
-
let r = e, i = n, o = computed(() => ({
|
|
6822
|
+
let r = e, i = n, o = computed(() => _objectSpread2(_objectSpread2({
|
|
6809
6823
|
content: r.description,
|
|
6810
|
-
theme: "ai-chat-box"
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
})), c = (e) => {
|
|
6824
|
+
theme: "ai-chat-box"
|
|
6825
|
+
}, r.tippyOptions || {}), {}, { onShow: () => {
|
|
6826
|
+
if (r.disabled) return !1;
|
|
6827
|
+
} })), c = (e) => {
|
|
6815
6828
|
r.disabled || i("click", r, e);
|
|
6816
6829
|
};
|
|
6817
6830
|
return (n, r) => withDirectives((openBlock(), createElementBlock("div", {
|
|
@@ -10583,8 +10596,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10583
10596
|
ref_for: !0
|
|
10584
10597
|
}, e, {
|
|
10585
10598
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10599
|
+
"tippy-options": n.tippyOptions,
|
|
10586
10600
|
onClick: (n) => v(e)
|
|
10587
|
-
}), null, 16, [
|
|
10601
|
+
}), null, 16, [
|
|
10602
|
+
"disabled",
|
|
10603
|
+
"tippy-options",
|
|
10604
|
+
"onClick"
|
|
10605
|
+
]))), 128))]),
|
|
10588
10606
|
n.updateTools.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$8)) : createCommentVNode("", !0),
|
|
10589
10607
|
createElementVNode("div", _hoisted_4$6, [(openBlock(!0), createElementBlock(Fragment, null, renderList(n.updateTools, (r) => (openBlock(), createElementBlock(Fragment, { key: r.id }, [["like", "unlike"].includes(r.id) ? (openBlock(), createBlock(unref(TippyComponent), mergeProps({
|
|
10590
10608
|
key: 0,
|
|
@@ -10608,11 +10626,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10608
10626
|
id: b(r.id),
|
|
10609
10627
|
active: g.value === r.id,
|
|
10610
10628
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10629
|
+
"tippy-options": n.tippyOptions,
|
|
10611
10630
|
onClick: (e) => v(r)
|
|
10612
10631
|
}), null, 16, [
|
|
10613
10632
|
"id",
|
|
10614
10633
|
"active",
|
|
10615
10634
|
"disabled",
|
|
10635
|
+
"tippy-options",
|
|
10616
10636
|
"onClick"
|
|
10617
10637
|
])]),
|
|
10618
10638
|
_: 2
|
|
@@ -10621,8 +10641,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10621
10641
|
ref_for: !0
|
|
10622
10642
|
}, r, {
|
|
10623
10643
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10644
|
+
"tippy-options": n.tippyOptions,
|
|
10624
10645
|
onClick: (e) => v(r)
|
|
10625
|
-
}), null, 16, [
|
|
10646
|
+
}), null, 16, [
|
|
10647
|
+
"disabled",
|
|
10648
|
+
"tippy-options",
|
|
10649
|
+
"onClick"
|
|
10650
|
+
]))], 64))), 128))])
|
|
10626
10651
|
], 512));
|
|
10627
10652
|
}
|
|
10628
10653
|
}), _hoisted_1$11 = { class: "ai-loading-ring" }, _hoisted_2$8 = {
|
|
@@ -11180,6 +11205,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11180
11205
|
messages: {},
|
|
11181
11206
|
messageStatus: {},
|
|
11182
11207
|
messageToolsStatus: {},
|
|
11208
|
+
messageToolsTippyOptions: {},
|
|
11183
11209
|
onAgentAction: {},
|
|
11184
11210
|
onAgentFeedback: {},
|
|
11185
11211
|
onUserAction: {},
|
|
@@ -11191,7 +11217,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11191
11217
|
}),
|
|
11192
11218
|
emits: /* @__PURE__ */ mergeModels(["stopStreaming"], ["update:selectedMessages"]),
|
|
11193
11219
|
setup(n) {
|
|
11194
|
-
let r = n, i = useModel(n, "selectedMessages"), a = useTemplateRef("messageContainerRef"), o = useTemplateRef("messageContainerBottomRef"), d = ref([]), { isScrollBottom: p, toScrollBottom: m, scrollBottomHeight: g } = useContainerScrollProvider(a, o), { copy: _ } = useClipboard()
|
|
11220
|
+
let r = n, i = useModel(n, "selectedMessages"), a = useTemplateRef("messageContainerRef"), o = useTemplateRef("messageContainerBottomRef"), d = ref([]), { isScrollBottom: p, toScrollBottom: m, scrollBottomHeight: g } = useContainerScrollProvider(a, o), { copy: _ } = useClipboard();
|
|
11195
11221
|
watchEffect(() => {
|
|
11196
11222
|
var e;
|
|
11197
11223
|
let n = [], i = [];
|
|
@@ -11252,7 +11278,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11252
11278
|
immediate: !0,
|
|
11253
11279
|
flush: "post"
|
|
11254
11280
|
});
|
|
11255
|
-
let
|
|
11281
|
+
let v = function() {
|
|
11256
11282
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11257
11283
|
var i;
|
|
11258
11284
|
return e.id === "copy" && (console.log("messages", n), _(n.filter((e) => e.role !== MessageRole.Reasoning).map((e) => typeof e.content == "string" ? e.content : JSON.stringify(e.content || "")).join("\n"))), (i = r.onAgentAction) == null ? void 0 : i.call(r, e, n);
|
|
@@ -11260,7 +11286,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11260
11286
|
return function(n, r) {
|
|
11261
11287
|
return e.apply(this, arguments);
|
|
11262
11288
|
};
|
|
11263
|
-
}(),
|
|
11289
|
+
}(), y = function() {
|
|
11264
11290
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11265
11291
|
var i;
|
|
11266
11292
|
(i = r.onUserAction) == null || i.call(r, e, n);
|
|
@@ -11268,11 +11294,11 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11268
11294
|
return function(n, r) {
|
|
11269
11295
|
return e.apply(this, arguments);
|
|
11270
11296
|
};
|
|
11271
|
-
}(),
|
|
11297
|
+
}(), b = (e) => {
|
|
11272
11298
|
e.isHover = !0;
|
|
11273
|
-
},
|
|
11299
|
+
}, x = (e) => {
|
|
11274
11300
|
e.isHover = !1;
|
|
11275
|
-
},
|
|
11301
|
+
}, S = (e, n) => {
|
|
11276
11302
|
var r, a;
|
|
11277
11303
|
let o = e.type === MessageRole.User;
|
|
11278
11304
|
(r = d.value) == null || r.forEach((r, i) => {
|
|
@@ -11282,7 +11308,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11282
11308
|
e && (e.checked = n);
|
|
11283
11309
|
}
|
|
11284
11310
|
}), i.value = (a = d.value) == null ? void 0 : a.filter((e) => e.checked).map((e) => e.messages).flat();
|
|
11285
|
-
},
|
|
11311
|
+
}, C = function() {
|
|
11286
11312
|
var e = _asyncToGenerator(function* (e, n, i) {
|
|
11287
11313
|
var a;
|
|
11288
11314
|
(a = r.onUserInputConfirm) == null || a.call(r, e, n, i);
|
|
@@ -11290,7 +11316,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11290
11316
|
return function(n, r, i) {
|
|
11291
11317
|
return e.apply(this, arguments);
|
|
11292
11318
|
};
|
|
11293
|
-
}(),
|
|
11319
|
+
}(), T = function() {
|
|
11294
11320
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11295
11321
|
var i;
|
|
11296
11322
|
(i = r.onUserShortcutConfirm) == null || i.call(r, e, n);
|
|
@@ -11308,13 +11334,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11308
11334
|
key: o,
|
|
11309
11335
|
class: "message-group",
|
|
11310
11336
|
style: normalizeStyle({ backgroundColor: a.checked ? "#f5f7fa" : "transparent" }),
|
|
11311
|
-
onMouseenter: (e) =>
|
|
11312
|
-
onMouseleave: (e) =>
|
|
11337
|
+
onMouseenter: (e) => b(a),
|
|
11338
|
+
onMouseleave: (e) => x(a)
|
|
11313
11339
|
}, [n.enableSelection && a.type !== unref(MessageRole).Loading ? (openBlock(), createBlock(unref(Checkbox), {
|
|
11314
11340
|
key: o,
|
|
11315
11341
|
class: "message-group-checkbox",
|
|
11316
11342
|
"model-value": a.checked,
|
|
11317
|
-
"onUpdate:modelValue": (e) =>
|
|
11343
|
+
"onUpdate:modelValue": (e) => S(a, e)
|
|
11318
11344
|
}, null, 8, ["model-value", "onUpdate:modelValue"])) : createCommentVNode("", !0), createElementVNode("div", _hoisted_2, [(openBlock(!0), createElementBlock(Fragment, null, renderList(a.messages, (e, r) => renderSlot(i.$slots, "default", mergeProps({
|
|
11319
11345
|
key: r,
|
|
11320
11346
|
ref_for: !0
|
|
@@ -11325,9 +11351,9 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11325
11351
|
key: r,
|
|
11326
11352
|
message: e,
|
|
11327
11353
|
"message-tools-status": n.messageToolsStatus,
|
|
11328
|
-
"on-action": (n) =>
|
|
11329
|
-
"on-input-confirm": (n, r) =>
|
|
11330
|
-
"on-shortcut-confirm": (n) =>
|
|
11354
|
+
"on-action": (n) => y(n, e),
|
|
11355
|
+
"on-input-confirm": (n, r) => C(e, n, r),
|
|
11356
|
+
"on-shortcut-confirm": (n) => T(e, n)
|
|
11331
11357
|
}, null, 8, [
|
|
11332
11358
|
"message",
|
|
11333
11359
|
"message-tools-status",
|
|
@@ -11337,8 +11363,8 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11337
11363
|
]))])), 128)), a.type === unref(MessageRole).Assistant && n.messageToolsStatus !== unref(MessageToolsStatus).Hidden ? (openBlock(), createBlock(message_tools_default, {
|
|
11338
11364
|
key: 0,
|
|
11339
11365
|
"message-tools-status": n.messageToolsStatus,
|
|
11340
|
-
"on-action": (e) =>
|
|
11341
|
-
"tippy-options":
|
|
11366
|
+
"on-action": (e) => v(e, a.messages),
|
|
11367
|
+
"tippy-options": r.messageToolsTippyOptions,
|
|
11342
11368
|
onFeedback: (e, n, i) => {
|
|
11343
11369
|
var o;
|
|
11344
11370
|
return (o = r.onAgentFeedback) == null ? void 0 : o.call(r, e, a.messages, n, i);
|
|
@@ -11346,6 +11372,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11346
11372
|
}, null, 8, [
|
|
11347
11373
|
"message-tools-status",
|
|
11348
11374
|
"on-action",
|
|
11375
|
+
"tippy-options",
|
|
11349
11376
|
"onFeedback"
|
|
11350
11377
|
])) : createCommentVNode("", !0)])], 44, _hoisted_1))), 128)),
|
|
11351
11378
|
createElementVNode("div", {
|