@blueking/chat-x 0.0.1-beta.12 → 0.0.1-beta.13
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,10 @@
|
|
|
1
|
+
import { type TippyOptions } from 'vue-tippy';
|
|
1
2
|
import type { IToolBtn } from '../../../types';
|
|
2
3
|
import 'tippy.js/dist/tippy.css';
|
|
3
4
|
type __VLS_Props = IToolBtn & {
|
|
4
5
|
active?: boolean;
|
|
5
6
|
disabled?: boolean;
|
|
7
|
+
tippyOptions?: Partial<Omit<TippyOptions, 'content' | 'getReferenceClientRect' | 'triggerTarget'>>;
|
|
6
8
|
};
|
|
7
9
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
10
|
click: (data: IToolBtn, event: MouseEvent) => any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Message, type UserMessage, MessageRole, MessageStatus } from '../../../ag-ui/types';
|
|
2
2
|
import { MessageToolsStatus } from '../../../types/tool';
|
|
3
|
+
import { type MessageToolsProps } from '../../message-tools/message-tools.vue';
|
|
3
4
|
import type { IToolBtn, TagSchema } from '../../../types';
|
|
4
5
|
/**
|
|
5
6
|
* Agent 工具操作回调类型
|
|
@@ -26,6 +27,7 @@ type __VLS_Props = {
|
|
|
26
27
|
messages: Message[];
|
|
27
28
|
messageStatus?: MessageStatus;
|
|
28
29
|
messageToolsStatus?: MessageToolsStatus;
|
|
30
|
+
messageToolsTippyOptions?: MessageToolsProps['tippyOptions'];
|
|
29
31
|
onAgentAction?: AgentActionCallback;
|
|
30
32
|
onAgentFeedback?: AgentFeedbackCallback;
|
|
31
33
|
onUserAction?: UserActionCallback;
|
package/dist/index.js
CHANGED
|
@@ -6801,17 +6801,17 @@ var _hoisted_1$29 = { key: 1 }, tool_btn_default = /* @__PURE__ */ defineCompone
|
|
|
6801
6801
|
id: {},
|
|
6802
6802
|
name: {},
|
|
6803
6803
|
active: { type: Boolean },
|
|
6804
|
-
disabled: { type: Boolean }
|
|
6804
|
+
disabled: { type: Boolean },
|
|
6805
|
+
tippyOptions: {}
|
|
6805
6806
|
},
|
|
6806
6807
|
emits: ["click"],
|
|
6807
6808
|
setup(e, { emit: n }) {
|
|
6808
|
-
let r = e, i = n, o = computed(() => ({
|
|
6809
|
+
let r = e, i = n, o = computed(() => _objectSpread2(_objectSpread2({
|
|
6809
6810
|
content: r.description,
|
|
6810
|
-
theme: "ai-chat-box"
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
})), c = (e) => {
|
|
6811
|
+
theme: "ai-chat-box"
|
|
6812
|
+
}, r.tippyOptions || {}), {}, { onShow: () => {
|
|
6813
|
+
if (r.disabled) return !1;
|
|
6814
|
+
} })), c = (e) => {
|
|
6815
6815
|
r.disabled || i("click", r, e);
|
|
6816
6816
|
};
|
|
6817
6817
|
return (n, r) => withDirectives((openBlock(), createElementBlock("div", {
|
|
@@ -10583,8 +10583,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10583
10583
|
ref_for: !0
|
|
10584
10584
|
}, e, {
|
|
10585
10585
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10586
|
+
"tippy-options": n.tippyOptions,
|
|
10586
10587
|
onClick: (n) => v(e)
|
|
10587
|
-
}), null, 16, [
|
|
10588
|
+
}), null, 16, [
|
|
10589
|
+
"disabled",
|
|
10590
|
+
"tippy-options",
|
|
10591
|
+
"onClick"
|
|
10592
|
+
]))), 128))]),
|
|
10588
10593
|
n.updateTools.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$8)) : createCommentVNode("", !0),
|
|
10589
10594
|
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
10595
|
key: 0,
|
|
@@ -10608,11 +10613,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10608
10613
|
id: b(r.id),
|
|
10609
10614
|
active: g.value === r.id,
|
|
10610
10615
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10616
|
+
"tippy-options": n.tippyOptions,
|
|
10611
10617
|
onClick: (e) => v(r)
|
|
10612
10618
|
}), null, 16, [
|
|
10613
10619
|
"id",
|
|
10614
10620
|
"active",
|
|
10615
10621
|
"disabled",
|
|
10622
|
+
"tippy-options",
|
|
10616
10623
|
"onClick"
|
|
10617
10624
|
])]),
|
|
10618
10625
|
_: 2
|
|
@@ -10621,8 +10628,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
10621
10628
|
ref_for: !0
|
|
10622
10629
|
}, r, {
|
|
10623
10630
|
disabled: n.messageToolsStatus === unref(MessageToolsStatus).Disabled,
|
|
10631
|
+
"tippy-options": n.tippyOptions,
|
|
10624
10632
|
onClick: (e) => v(r)
|
|
10625
|
-
}), null, 16, [
|
|
10633
|
+
}), null, 16, [
|
|
10634
|
+
"disabled",
|
|
10635
|
+
"tippy-options",
|
|
10636
|
+
"onClick"
|
|
10637
|
+
]))], 64))), 128))])
|
|
10626
10638
|
], 512));
|
|
10627
10639
|
}
|
|
10628
10640
|
}), _hoisted_1$11 = { class: "ai-loading-ring" }, _hoisted_2$8 = {
|
|
@@ -11180,6 +11192,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11180
11192
|
messages: {},
|
|
11181
11193
|
messageStatus: {},
|
|
11182
11194
|
messageToolsStatus: {},
|
|
11195
|
+
messageToolsTippyOptions: {},
|
|
11183
11196
|
onAgentAction: {},
|
|
11184
11197
|
onAgentFeedback: {},
|
|
11185
11198
|
onUserAction: {},
|
|
@@ -11191,7 +11204,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11191
11204
|
}),
|
|
11192
11205
|
emits: /* @__PURE__ */ mergeModels(["stopStreaming"], ["update:selectedMessages"]),
|
|
11193
11206
|
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()
|
|
11207
|
+
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
11208
|
watchEffect(() => {
|
|
11196
11209
|
var e;
|
|
11197
11210
|
let n = [], i = [];
|
|
@@ -11252,7 +11265,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11252
11265
|
immediate: !0,
|
|
11253
11266
|
flush: "post"
|
|
11254
11267
|
});
|
|
11255
|
-
let
|
|
11268
|
+
let v = function() {
|
|
11256
11269
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11257
11270
|
var i;
|
|
11258
11271
|
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 +11273,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11260
11273
|
return function(n, r) {
|
|
11261
11274
|
return e.apply(this, arguments);
|
|
11262
11275
|
};
|
|
11263
|
-
}(),
|
|
11276
|
+
}(), y = function() {
|
|
11264
11277
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11265
11278
|
var i;
|
|
11266
11279
|
(i = r.onUserAction) == null || i.call(r, e, n);
|
|
@@ -11268,11 +11281,11 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11268
11281
|
return function(n, r) {
|
|
11269
11282
|
return e.apply(this, arguments);
|
|
11270
11283
|
};
|
|
11271
|
-
}(),
|
|
11284
|
+
}(), b = (e) => {
|
|
11272
11285
|
e.isHover = !0;
|
|
11273
|
-
},
|
|
11286
|
+
}, x = (e) => {
|
|
11274
11287
|
e.isHover = !1;
|
|
11275
|
-
},
|
|
11288
|
+
}, S = (e, n) => {
|
|
11276
11289
|
var r, a;
|
|
11277
11290
|
let o = e.type === MessageRole.User;
|
|
11278
11291
|
(r = d.value) == null || r.forEach((r, i) => {
|
|
@@ -11282,7 +11295,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11282
11295
|
e && (e.checked = n);
|
|
11283
11296
|
}
|
|
11284
11297
|
}), i.value = (a = d.value) == null ? void 0 : a.filter((e) => e.checked).map((e) => e.messages).flat();
|
|
11285
|
-
},
|
|
11298
|
+
}, C = function() {
|
|
11286
11299
|
var e = _asyncToGenerator(function* (e, n, i) {
|
|
11287
11300
|
var a;
|
|
11288
11301
|
(a = r.onUserInputConfirm) == null || a.call(r, e, n, i);
|
|
@@ -11290,7 +11303,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11290
11303
|
return function(n, r, i) {
|
|
11291
11304
|
return e.apply(this, arguments);
|
|
11292
11305
|
};
|
|
11293
|
-
}(),
|
|
11306
|
+
}(), T = function() {
|
|
11294
11307
|
var e = _asyncToGenerator(function* (e, n) {
|
|
11295
11308
|
var i;
|
|
11296
11309
|
(i = r.onUserShortcutConfirm) == null || i.call(r, e, n);
|
|
@@ -11308,13 +11321,13 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11308
11321
|
key: o,
|
|
11309
11322
|
class: "message-group",
|
|
11310
11323
|
style: normalizeStyle({ backgroundColor: a.checked ? "#f5f7fa" : "transparent" }),
|
|
11311
|
-
onMouseenter: (e) =>
|
|
11312
|
-
onMouseleave: (e) =>
|
|
11324
|
+
onMouseenter: (e) => b(a),
|
|
11325
|
+
onMouseleave: (e) => x(a)
|
|
11313
11326
|
}, [n.enableSelection && a.type !== unref(MessageRole).Loading ? (openBlock(), createBlock(unref(Checkbox), {
|
|
11314
11327
|
key: o,
|
|
11315
11328
|
class: "message-group-checkbox",
|
|
11316
11329
|
"model-value": a.checked,
|
|
11317
|
-
"onUpdate:modelValue": (e) =>
|
|
11330
|
+
"onUpdate:modelValue": (e) => S(a, e)
|
|
11318
11331
|
}, 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
11332
|
key: r,
|
|
11320
11333
|
ref_for: !0
|
|
@@ -11325,9 +11338,9 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11325
11338
|
key: r,
|
|
11326
11339
|
message: e,
|
|
11327
11340
|
"message-tools-status": n.messageToolsStatus,
|
|
11328
|
-
"on-action": (n) =>
|
|
11329
|
-
"on-input-confirm": (n, r) =>
|
|
11330
|
-
"on-shortcut-confirm": (n) =>
|
|
11341
|
+
"on-action": (n) => y(n, e),
|
|
11342
|
+
"on-input-confirm": (n, r) => C(e, n, r),
|
|
11343
|
+
"on-shortcut-confirm": (n) => T(e, n)
|
|
11331
11344
|
}, null, 8, [
|
|
11332
11345
|
"message",
|
|
11333
11346
|
"message-tools-status",
|
|
@@ -11337,8 +11350,8 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11337
11350
|
]))])), 128)), a.type === unref(MessageRole).Assistant && n.messageToolsStatus !== unref(MessageToolsStatus).Hidden ? (openBlock(), createBlock(message_tools_default, {
|
|
11338
11351
|
key: 0,
|
|
11339
11352
|
"message-tools-status": n.messageToolsStatus,
|
|
11340
|
-
"on-action": (e) =>
|
|
11341
|
-
"tippy-options":
|
|
11353
|
+
"on-action": (e) => v(e, a.messages),
|
|
11354
|
+
"tippy-options": r.messageToolsTippyOptions,
|
|
11342
11355
|
onFeedback: (e, n, i) => {
|
|
11343
11356
|
var o;
|
|
11344
11357
|
return (o = r.onAgentFeedback) == null ? void 0 : o.call(r, e, a.messages, n, i);
|
|
@@ -11346,6 +11359,7 @@ var _hoisted_1$17 = { class: "ai-slash-input-wrapper" }, _hoisted_2$12 = ["aria-
|
|
|
11346
11359
|
}, null, 8, [
|
|
11347
11360
|
"message-tools-status",
|
|
11348
11361
|
"on-action",
|
|
11362
|
+
"tippy-options",
|
|
11349
11363
|
"onFeedback"
|
|
11350
11364
|
])) : createCommentVNode("", !0)])], 44, _hoisted_1))), 128)),
|
|
11351
11365
|
createElementVNode("div", {
|