@aleph-alpha/chat-kit 0.9.0 → 1.0.0
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/{CkInput.vue_vue_type_script_setup_true_lang-DmcLXAgB.js → CkInput.vue_vue_type_script_setup_true_lang-744ZHsQU.js} +525 -78
- package/dist/chat-kit.css +9 -14
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts +20 -0
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/CkAgentMessage.vue.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/index.d.ts +1 -0
- package/dist/components/base/CkAgentMessage/index.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/types.d.ts +12 -0
- package/dist/components/base/CkAgentMessage/types.d.ts.map +1 -0
- package/dist/components/base/CkConversationLayout/CkConversationLayout.stories.d.ts +13 -0
- package/dist/components/base/CkConversationLayout/CkConversationLayout.stories.d.ts.map +1 -1
- package/dist/components/base/CkConversationLayout/CkConversationLayout.vue.d.ts.map +1 -1
- package/dist/components/base/CkConversationLayout/types.d.ts +9 -2
- package/dist/components/base/CkConversationLayout/types.d.ts.map +1 -1
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts +8 -0
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map +1 -1
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts +3 -15
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkCopyMessageActionButton/index.d.ts +1 -0
- package/dist/components/base/CkCopyMessageActionButton/index.d.ts.map +1 -1
- package/dist/components/base/CkCopyMessageActionButton/types.d.ts +45 -0
- package/dist/components/base/CkCopyMessageActionButton/types.d.ts.map +1 -0
- package/dist/components/base/CkHistoryItem/CkHistoryItem.stories.d.ts +31 -0
- package/dist/components/base/CkHistoryItem/CkHistoryItem.stories.d.ts.map +1 -0
- package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts +32 -0
- package/dist/components/base/CkHistoryItem/CkHistoryItem.vue.d.ts.map +1 -0
- package/dist/components/base/CkHistoryItem/activeIndicator.d.ts +15 -0
- package/dist/components/base/CkHistoryItem/activeIndicator.d.ts.map +1 -0
- package/dist/components/base/CkHistoryItem/index.d.ts +3 -0
- package/dist/components/base/CkHistoryItem/index.d.ts.map +1 -0
- package/dist/components/base/CkHistoryItem/types.d.ts +95 -0
- package/dist/components/base/CkHistoryItem/types.d.ts.map +1 -0
- package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.d.ts +16 -0
- package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.stories.d.ts.map +1 -0
- package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.vue.d.ts +17 -0
- package/dist/components/base/CkHistoryWrapper/CkHistoryWrapper.vue.d.ts.map +1 -0
- package/dist/components/base/CkHistoryWrapper/index.d.ts +3 -0
- package/dist/components/base/CkHistoryWrapper/index.d.ts.map +1 -0
- package/dist/components/base/CkHistoryWrapper/types.d.ts +17 -0
- package/dist/components/base/CkHistoryWrapper/types.d.ts.map +1 -0
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +28 -0
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/index.d.ts +1 -1
- package/dist/components/base/CkMarkdownRenderer/index.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/types.d.ts +16 -0
- package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts +4 -0
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts.map +1 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts +2 -5
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkMessageActionButton/index.d.ts +1 -0
- package/dist/components/base/CkMessageActionButton/index.d.ts.map +1 -1
- package/dist/components/base/CkMessageActionButton/types.d.ts +22 -0
- package/dist/components/base/CkMessageActionButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.stories.d.ts +12 -0
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts +2 -7
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptActionButton/index.d.ts +1 -0
- package/dist/components/base/CkPromptActionButton/index.d.ts.map +1 -1
- package/dist/components/base/CkPromptActionButton/types.d.ts +33 -0
- package/dist/components/base/CkPromptActionButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts +17 -0
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts +3 -9
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/index.d.ts +1 -0
- package/dist/components/base/CkPromptInput/index.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/types.d.ts +39 -0
- package/dist/components/base/CkPromptInput/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.d.ts +12 -0
- package/dist/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue.d.ts +2 -4
- package/dist/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInputDisclaimer/index.d.ts +1 -0
- package/dist/components/base/CkPromptInputDisclaimer/index.d.ts.map +1 -1
- package/dist/components/base/CkPromptInputDisclaimer/types.d.ts +18 -0
- package/dist/components/base/CkPromptInputDisclaimer/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +8 -0
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts +3 -6
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptStopButton/index.d.ts +1 -0
- package/dist/components/base/CkPromptStopButton/index.d.ts.map +1 -1
- package/dist/components/base/CkPromptStopButton/types.d.ts +28 -0
- package/dist/components/base/CkPromptStopButton/types.d.ts.map +1 -0
- package/dist/components/base/CkUserMessage/CkUserMessage.stories.d.ts +15 -0
- package/dist/components/base/CkUserMessage/CkUserMessage.stories.d.ts.map +1 -1
- package/dist/components/base/CkUserMessage/CkUserMessage.vue.d.ts.map +1 -1
- package/dist/components/base/CkUserMessage/types.d.ts +9 -2
- package/dist/components/base/CkUserMessage/types.d.ts.map +1 -1
- package/dist/components/base/icons/CkStopIcon.vue.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +5 -1
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/CkConversation.stories.d.ts +55 -0
- package/dist/components/composed/CkConversation/CkConversation.stories.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/CkConversation.vue.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/types.d.ts +25 -6
- package/dist/components/composed/CkConversation/types.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/CkHistory.stories.d.ts +33 -0
- package/dist/components/composed/CkHistory/CkHistory.stories.d.ts.map +1 -0
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts +50 -0
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts.map +1 -0
- package/dist/components/composed/CkHistory/index.d.ts +3 -0
- package/dist/components/composed/CkHistory/index.d.ts.map +1 -0
- package/dist/components/composed/CkHistory/types.d.ts +71 -0
- package/dist/components/composed/CkHistory/types.d.ts.map +1 -0
- package/dist/components/composed/CkInput/CkInput.stories.d.ts +31 -1
- package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +3 -12
- package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
- package/dist/components/composed/CkInput/index.d.ts +1 -0
- package/dist/components/composed/CkInput/index.d.ts.map +1 -1
- package/dist/components/composed/CkInput/types.d.ts +60 -0
- package/dist/components/composed/CkInput/types.d.ts.map +1 -0
- package/dist/components/composed/index.d.ts +2 -0
- package/dist/components/composed/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +14 -11
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/index.js +3 -3
- package/dist/composables/useConversations.d.ts +72 -0
- package/dist/composables/useConversations.d.ts.map +1 -0
- package/dist/generateId-BHf0W4Rq.js +6 -0
- package/dist/handlers/index.js +2 -2
- package/dist/handlers/useChatKitLabels.d.ts +8 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/handlers/useMarkdownParser.d.ts.map +1 -1
- package/dist/helpers/conversationTree.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/secondsToDate.d.ts +6 -0
- package/dist/helpers/secondsToDate.d.ts.map +1 -0
- package/dist/helpers/toError.d.ts +7 -0
- package/dist/helpers/toError.d.ts.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -16
- package/dist/services/ChatService.d.ts.map +1 -1
- package/dist/services/MockChatService.d.ts.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +4 -1
- package/dist/services/types.d.ts +53 -0
- package/dist/services/types.d.ts.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useChatKitLabels-DNwoZ1x6.js → useChatKitLabels-Dvi2FmjE.js} +8 -2
- package/dist/useConversations-Ca242D2P.js +195 -0
- package/dist/{useMessageHandler-D7OdrrcB.js → useMessageHandler-uLHNac39.js} +1 -3
- package/package.json +4 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString,
|
|
2
|
-
import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-
|
|
3
|
-
import {
|
|
4
|
-
const _hoisted_1$
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, createBlock, unref, mergeProps, withCtx, createVNode, Transition, toDisplayString, Comment, cloneVNode, h, useAttrs, useSlots, computed, normalizeClass, withModifiers, resolveDynamicComponent, toRefs, useId, useTemplateRef, createTextVNode, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { a as useMarkdownParser, u as useChatKitLabels } from "./useChatKitLabels-Dvi2FmjE.js";
|
|
3
|
+
import { UiButton, UiTooltip, UiIcon, UiPopover, UiPopoverTrigger, UiPopoverContent, UiIconButton, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
|
|
4
|
+
const _hoisted_1$8 = {
|
|
5
5
|
xmlns: "http://www.w3.org/2000/svg",
|
|
6
6
|
width: "16",
|
|
7
7
|
height: "16",
|
|
@@ -12,31 +12,31 @@ const _hoisted_1$7 = {
|
|
|
12
12
|
"stroke-linecap": "round",
|
|
13
13
|
"stroke-linejoin": "round"
|
|
14
14
|
};
|
|
15
|
-
const _sfc_main$
|
|
15
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
16
16
|
...{ name: "CkSendIcon" },
|
|
17
17
|
__name: "CkSendIcon",
|
|
18
18
|
setup(__props) {
|
|
19
19
|
return (_ctx, _cache) => {
|
|
20
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
20
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$8, [..._cache[0] || (_cache[0] = [
|
|
21
21
|
createElementVNode("path", { d: "M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" }, null, -1),
|
|
22
22
|
createElementVNode("path", { d: "M6 12h16" }, null, -1)
|
|
23
23
|
])]);
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
const _hoisted_1$
|
|
27
|
+
const _hoisted_1$7 = {
|
|
28
28
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29
29
|
width: "16",
|
|
30
30
|
height: "16",
|
|
31
31
|
viewBox: "0 0 16 16",
|
|
32
32
|
fill: "none"
|
|
33
33
|
};
|
|
34
|
-
const _sfc_main$
|
|
34
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
35
35
|
...{ name: "CkStopIcon" },
|
|
36
36
|
__name: "CkStopIcon",
|
|
37
37
|
setup(__props) {
|
|
38
38
|
return (_ctx, _cache) => {
|
|
39
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
39
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$7, [..._cache[0] || (_cache[0] = [
|
|
40
40
|
createElementVNode("path", {
|
|
41
41
|
d: "M13.3335 3.33301C13.3335 2.96482 13.035 2.66634 12.6668 2.66634H3.3335C2.96531 2.66634 2.66683 2.96482 2.66683 3.33301V12.6663C2.66683 13.0345 2.96531 13.333 3.3335 13.333H12.6668C13.035 13.333 13.3335 13.0345 13.3335 12.6663V3.33301ZM14.6668 12.6663C14.6668 13.7709 13.7714 14.6663 12.6668 14.6663H3.3335C2.22893 14.6663 1.3335 13.7709 1.3335 12.6663V3.33301C1.3335 2.22844 2.22893 1.33301 3.3335 1.33301H12.6668C13.7714 1.33301 14.6668 2.22844 14.6668 3.33301V12.6663Z",
|
|
42
42
|
fill: "#1D1D1B"
|
|
@@ -45,37 +45,37 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
const _hoisted_1$
|
|
49
|
-
const _hoisted_2$
|
|
48
|
+
const _hoisted_1$6 = { class: "flex w-full items-start gap-2" };
|
|
49
|
+
const _hoisted_2$4 = {
|
|
50
50
|
key: 0,
|
|
51
51
|
class: "flex flex-shrink-0 items-center justify-center"
|
|
52
52
|
};
|
|
53
|
-
const _hoisted_3$
|
|
54
|
-
const _hoisted_4$
|
|
53
|
+
const _hoisted_3$3 = { class: "text-core-content-primary flex min-w-0 flex-1 flex-col gap-2" };
|
|
54
|
+
const _hoisted_4$2 = {
|
|
55
55
|
key: 0,
|
|
56
56
|
class: "text-sm font-bold"
|
|
57
57
|
};
|
|
58
|
-
const _hoisted_5$
|
|
58
|
+
const _hoisted_5$2 = {
|
|
59
59
|
key: 1,
|
|
60
60
|
class: "flex items-center"
|
|
61
61
|
};
|
|
62
|
-
const _sfc_main$
|
|
62
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
63
63
|
...{ name: "CkAgentMessage" },
|
|
64
64
|
__name: "CkAgentMessage",
|
|
65
65
|
setup(__props) {
|
|
66
66
|
return (_ctx, _cache) => {
|
|
67
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
68
|
-
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
67
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
68
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
|
|
69
69
|
renderSlot(_ctx.$slots, "icon")
|
|
70
70
|
])) : createCommentVNode("", true),
|
|
71
|
-
createElementVNode("div", _hoisted_3$
|
|
72
|
-
_ctx.$slots.header ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
71
|
+
createElementVNode("div", _hoisted_3$3, [
|
|
72
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("span", _hoisted_4$2, [
|
|
73
73
|
renderSlot(_ctx.$slots, "header")
|
|
74
74
|
])) : createCommentVNode("", true),
|
|
75
75
|
createElementVNode("div", null, [
|
|
76
76
|
renderSlot(_ctx.$slots, "default")
|
|
77
77
|
]),
|
|
78
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
78
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
|
|
79
79
|
renderSlot(_ctx.$slots, "footer")
|
|
80
80
|
])) : createCommentVNode("", true)
|
|
81
81
|
])
|
|
@@ -83,16 +83,16 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
|
-
const _hoisted_1$
|
|
87
|
-
const _hoisted_2$
|
|
86
|
+
const _hoisted_1$5 = ["data-message-row"];
|
|
87
|
+
const _hoisted_2$3 = {
|
|
88
88
|
key: 0,
|
|
89
89
|
class: "flex justify-end"
|
|
90
90
|
};
|
|
91
|
-
const _hoisted_3$
|
|
91
|
+
const _hoisted_3$2 = {
|
|
92
92
|
key: 1,
|
|
93
93
|
class: "flex justify-start"
|
|
94
94
|
};
|
|
95
|
-
const _sfc_main$
|
|
95
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
96
96
|
...{ name: "CkConversationLayout" },
|
|
97
97
|
__name: "CkConversationLayout",
|
|
98
98
|
props: {
|
|
@@ -143,7 +143,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
143
143
|
spacerHeight.value = 0;
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
const userRows = container.querySelectorAll(
|
|
146
|
+
const userRows = container.querySelectorAll(
|
|
147
|
+
'[data-message-row="user"]'
|
|
148
|
+
);
|
|
147
149
|
const lastUserRow = userRows[userRows.length - 1];
|
|
148
150
|
if (!lastUserRow) {
|
|
149
151
|
spacerHeight.value = 0;
|
|
@@ -159,7 +161,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
159
161
|
const lastRowBottom = lastRow.offsetTop + lastRow.offsetHeight;
|
|
160
162
|
const contentFromUserToEnd = lastRowBottom - lastUserTop;
|
|
161
163
|
const gap = parseFloat(getComputedStyle(container).rowGap) || 0;
|
|
162
|
-
spacerHeight.value = Math.max(
|
|
164
|
+
spacerHeight.value = Math.max(
|
|
165
|
+
0,
|
|
166
|
+
containerHeight.value - contentFromUserToEnd - gap
|
|
167
|
+
);
|
|
163
168
|
}
|
|
164
169
|
function scrollUserMessageToTop() {
|
|
165
170
|
const container = scrollContainerRef.value;
|
|
@@ -167,7 +172,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
167
172
|
hasBottomSpacer.value = true;
|
|
168
173
|
spacerHeight.value = containerHeight.value;
|
|
169
174
|
nextTick(() => {
|
|
170
|
-
const userRows = container.querySelectorAll(
|
|
175
|
+
const userRows = container.querySelectorAll(
|
|
176
|
+
'[data-message-row="user"]'
|
|
177
|
+
);
|
|
171
178
|
const lastUserRow = userRows[userRows.length - 1];
|
|
172
179
|
if (lastUserRow) {
|
|
173
180
|
lastUserRow.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
@@ -225,12 +232,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
225
232
|
key: message.id,
|
|
226
233
|
"data-message-row": message.role
|
|
227
234
|
}, [
|
|
228
|
-
message.role === "user" ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
235
|
+
message.role === "user" ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
|
|
229
236
|
renderSlot(_ctx.$slots, "user-message", { message })
|
|
230
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_3$
|
|
237
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_3$2, [
|
|
231
238
|
renderSlot(_ctx.$slots, "agent-message", { message })
|
|
232
239
|
]))
|
|
233
|
-
], 8, _hoisted_1$
|
|
240
|
+
], 8, _hoisted_1$5);
|
|
234
241
|
}), 128)),
|
|
235
242
|
hasBottomSpacer.value ? (openBlock(), createElementBlock("div", {
|
|
236
243
|
key: 0,
|
|
@@ -241,7 +248,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
241
248
|
};
|
|
242
249
|
}
|
|
243
250
|
});
|
|
244
|
-
const _sfc_main$
|
|
251
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
245
252
|
...{
|
|
246
253
|
name: "CkMessageActionButton"
|
|
247
254
|
},
|
|
@@ -252,32 +259,24 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
252
259
|
},
|
|
253
260
|
setup(__props) {
|
|
254
261
|
return (_ctx, _cache) => {
|
|
255
|
-
return openBlock(), createBlock(unref(
|
|
262
|
+
return openBlock(), createBlock(unref(UiButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
|
|
256
263
|
disabled: __props.disabled,
|
|
257
264
|
variant: "ghost",
|
|
258
|
-
|
|
265
|
+
size: "icon-sm"
|
|
259
266
|
}), {
|
|
260
267
|
default: withCtx(() => [
|
|
261
|
-
renderSlot(_ctx.$slots, "default"
|
|
268
|
+
renderSlot(_ctx.$slots, "default")
|
|
262
269
|
]),
|
|
263
270
|
_: 3
|
|
264
271
|
}, 16, ["disabled"]);
|
|
265
272
|
};
|
|
266
273
|
}
|
|
267
274
|
});
|
|
268
|
-
const
|
|
269
|
-
const target = sfc.__vccOpts || sfc;
|
|
270
|
-
for (const [key, val] of props) {
|
|
271
|
-
target[key] = val;
|
|
272
|
-
}
|
|
273
|
-
return target;
|
|
274
|
-
};
|
|
275
|
-
const CkMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-ee7595cc"]]);
|
|
276
|
-
const _hoisted_1$3 = {
|
|
275
|
+
const _hoisted_1$4 = {
|
|
277
276
|
class: "sr-only",
|
|
278
277
|
"aria-live": "polite"
|
|
279
278
|
};
|
|
280
|
-
const _sfc_main$
|
|
279
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
281
280
|
...{
|
|
282
281
|
name: "CkCopyMessageActionButton"
|
|
283
282
|
},
|
|
@@ -334,7 +333,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
334
333
|
"delay-duration": 0
|
|
335
334
|
}, {
|
|
336
335
|
default: withCtx(() => [
|
|
337
|
-
createVNode(unref(
|
|
336
|
+
createVNode(unref(_sfc_main$c), mergeProps({ ariaLabel: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy }, {
|
|
338
337
|
disabled: __props.disabled,
|
|
339
338
|
onClick: handleClick
|
|
340
339
|
}), {
|
|
@@ -361,14 +360,361 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
361
360
|
]),
|
|
362
361
|
_: 1
|
|
363
362
|
}, 16, ["disabled"]),
|
|
364
|
-
createElementVNode("span", _hoisted_1$
|
|
363
|
+
createElementVNode("span", _hoisted_1$4, toDisplayString(copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy), 1)
|
|
365
364
|
]),
|
|
366
365
|
_: 1
|
|
367
366
|
}, 8, ["open", "content"]);
|
|
368
367
|
};
|
|
369
368
|
}
|
|
370
369
|
});
|
|
371
|
-
const
|
|
370
|
+
const _export_sfc = (sfc, props) => {
|
|
371
|
+
const target = sfc.__vccOpts || sfc;
|
|
372
|
+
for (const [key, val] of props) {
|
|
373
|
+
target[key] = val;
|
|
374
|
+
}
|
|
375
|
+
return target;
|
|
376
|
+
};
|
|
377
|
+
const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-f77a1193"]]);
|
|
378
|
+
function renderSlotFragments(children) {
|
|
379
|
+
if (!children) return [];
|
|
380
|
+
return children.flatMap((child) => {
|
|
381
|
+
if (child.type === Fragment) return renderSlotFragments(child.children);
|
|
382
|
+
return [child];
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
const Slot = defineComponent({
|
|
386
|
+
name: "PrimitiveSlot",
|
|
387
|
+
inheritAttrs: false,
|
|
388
|
+
setup(_, { attrs, slots }) {
|
|
389
|
+
return () => {
|
|
390
|
+
if (!slots.default) return null;
|
|
391
|
+
const children = renderSlotFragments(slots.default());
|
|
392
|
+
const firstNonCommentChildrenIndex = children.findIndex((child) => child.type !== Comment);
|
|
393
|
+
if (firstNonCommentChildrenIndex === -1) return children;
|
|
394
|
+
const firstNonCommentChildren = children[firstNonCommentChildrenIndex];
|
|
395
|
+
delete firstNonCommentChildren.props?.ref;
|
|
396
|
+
const mergedProps = firstNonCommentChildren.props ? mergeProps(attrs, firstNonCommentChildren.props) : attrs;
|
|
397
|
+
const cloned = cloneVNode({
|
|
398
|
+
...firstNonCommentChildren,
|
|
399
|
+
props: {}
|
|
400
|
+
}, mergedProps);
|
|
401
|
+
if (children.length === 1) return cloned;
|
|
402
|
+
children[firstNonCommentChildrenIndex] = cloned;
|
|
403
|
+
return children;
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
const SELF_CLOSING_TAGS = [
|
|
408
|
+
"area",
|
|
409
|
+
"img",
|
|
410
|
+
"input"
|
|
411
|
+
];
|
|
412
|
+
const Primitive = defineComponent({
|
|
413
|
+
name: "Primitive",
|
|
414
|
+
inheritAttrs: false,
|
|
415
|
+
props: {
|
|
416
|
+
asChild: {
|
|
417
|
+
type: Boolean,
|
|
418
|
+
default: false
|
|
419
|
+
},
|
|
420
|
+
as: {
|
|
421
|
+
type: [String, Object],
|
|
422
|
+
default: "div"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
setup(props, { attrs, slots }) {
|
|
426
|
+
const asTag = props.asChild ? "template" : props.as;
|
|
427
|
+
if (typeof asTag === "string" && SELF_CLOSING_TAGS.includes(asTag)) return () => h(asTag, attrs);
|
|
428
|
+
if (asTag !== "template") return () => h(props.as, attrs, { default: slots.default });
|
|
429
|
+
return () => h(Slot, attrs, { default: slots.default });
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
const CHAT_HISTORY_ACTIVE_INDICATOR_CLASS = 'before:absolute before:z-10 before:top-1/2 before:left-0 before:h-1/2 before:w-0.5 before:-translate-y-1/2 before:origin-left before:scale-x-0 before:rounded-full before:bg-background-accent-default before:opacity-0 before:transition-[transform,opacity] before:duration-200 before:ease-linear before:content-[""] data-[active=true]:before:scale-x-100 data-[active=true]:before:opacity-100';
|
|
433
|
+
const _hoisted_1$3 = ["data-active"];
|
|
434
|
+
const _hoisted_2$2 = { class: "min-w-0 flex-1" };
|
|
435
|
+
const _hoisted_3$1 = { class: "truncate body-14-regular text-content-on-surface-primary" };
|
|
436
|
+
const _hoisted_4$1 = {
|
|
437
|
+
key: 0,
|
|
438
|
+
class: "mt-0.5 flex min-w-0 items-center gap-1 label-12-medium text-content-on-surface-muted"
|
|
439
|
+
};
|
|
440
|
+
const _hoisted_5$1 = {
|
|
441
|
+
key: 0,
|
|
442
|
+
class: "truncate"
|
|
443
|
+
};
|
|
444
|
+
const _hoisted_6$1 = {
|
|
445
|
+
key: 1,
|
|
446
|
+
"aria-hidden": "true"
|
|
447
|
+
};
|
|
448
|
+
const _hoisted_7$1 = {
|
|
449
|
+
key: 2,
|
|
450
|
+
class: "truncate"
|
|
451
|
+
};
|
|
452
|
+
const _hoisted_8 = ["aria-label"];
|
|
453
|
+
const _hoisted_9 = ["aria-label"];
|
|
454
|
+
const _hoisted_10 = ["aria-label"];
|
|
455
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
456
|
+
...{
|
|
457
|
+
name: "CkHistoryItem",
|
|
458
|
+
inheritAttrs: false
|
|
459
|
+
},
|
|
460
|
+
__name: "CkHistoryItem",
|
|
461
|
+
props: {
|
|
462
|
+
title: {},
|
|
463
|
+
metaStart: {},
|
|
464
|
+
metaEnd: {},
|
|
465
|
+
isActive: { type: Boolean, default: false },
|
|
466
|
+
showAction: { type: Boolean, default: true },
|
|
467
|
+
showActionOnHover: { type: Boolean, default: true },
|
|
468
|
+
actionTooltip: { default: "" },
|
|
469
|
+
actionAriaLabel: { default: "History item action" },
|
|
470
|
+
actionIcon: {},
|
|
471
|
+
actionPopover: { type: Boolean, default: false },
|
|
472
|
+
actionPopoverSide: { default: "right" },
|
|
473
|
+
actionPopoverAlign: { default: "start" },
|
|
474
|
+
actionPopoverSideOffset: { default: 8 },
|
|
475
|
+
actionPopoverContentClass: {},
|
|
476
|
+
asChild: { type: Boolean },
|
|
477
|
+
as: { default: "button" }
|
|
478
|
+
},
|
|
479
|
+
emits: ["action-click"],
|
|
480
|
+
setup(__props, { emit: __emit }) {
|
|
481
|
+
const emit = __emit;
|
|
482
|
+
const props = __props;
|
|
483
|
+
const attrs = useAttrs();
|
|
484
|
+
const slots = useSlots();
|
|
485
|
+
const hasMeta = computed(
|
|
486
|
+
() => Boolean(props.metaStart || props.metaEnd || slots.meta)
|
|
487
|
+
);
|
|
488
|
+
const pointerOnAction = ref(false);
|
|
489
|
+
function onActionPointerEnter() {
|
|
490
|
+
pointerOnAction.value = true;
|
|
491
|
+
}
|
|
492
|
+
function onActionPointerLeave() {
|
|
493
|
+
pointerOnAction.value = false;
|
|
494
|
+
}
|
|
495
|
+
function onActionFocusIn() {
|
|
496
|
+
pointerOnAction.value = true;
|
|
497
|
+
}
|
|
498
|
+
function onActionFocusOut() {
|
|
499
|
+
pointerOnAction.value = false;
|
|
500
|
+
}
|
|
501
|
+
watch(
|
|
502
|
+
() => props.showAction,
|
|
503
|
+
(show) => {
|
|
504
|
+
if (!show) {
|
|
505
|
+
pointerOnAction.value = false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
const containerClass = computed(() => [
|
|
510
|
+
"group/ck-history-item relative flex w-full min-w-0 items-stretch gap-2 rounded-md border border-transparent px-2 py-1.5 transition-colors",
|
|
511
|
+
hasMeta.value ? "h-12" : "h-10",
|
|
512
|
+
// Whole-row focus ring: first tab lands on the main row control; second tab on the action button — both are inside this container.
|
|
513
|
+
// `:has(:focus-visible)` instead of `:focus-within` so mouse clicks on the row don't flash a keyboard focus ring.
|
|
514
|
+
"has-[:focus-visible]:border-border-surface-focus-ring has-[:focus-visible]:ring-[3px] has-[:focus-visible]:ring-ring/50",
|
|
515
|
+
// Row hover/active tint — flat `default` hover-mix color. Hover is suppressed while the
|
|
516
|
+
// pointer/focus is on the action column so the icon's own tint does not stack on top.
|
|
517
|
+
props.isActive ? "bg-background-surface-primary-hover-default" : "",
|
|
518
|
+
!pointerOnAction.value ? "hover:bg-background-surface-primary-hover-default" : "",
|
|
519
|
+
CHAT_HISTORY_ACTIVE_INDICATOR_CLASS
|
|
520
|
+
]);
|
|
521
|
+
const itemClass = computed(() => [
|
|
522
|
+
"text-left outline-hidden transition-colors",
|
|
523
|
+
"body-14-regular text-content-on-surface-primary",
|
|
524
|
+
"!hover:bg-transparent !active:bg-transparent",
|
|
525
|
+
// Suppress a second ring on the primary control; the row ring is on the outer container.
|
|
526
|
+
"focus-visible:ring-0 focus-visible:outline-none",
|
|
527
|
+
"data-[active=true]:text-content-on-surface-primary",
|
|
528
|
+
// Stretched-link: extend the primary control's hit area to cover the full row
|
|
529
|
+
// container (including its `px-2 py-1.5` padding and the gap before the action
|
|
530
|
+
// column) so clicks anywhere on the row activate the item. The action button
|
|
531
|
+
// stays interactive because it comes later in the DOM and is `relative`.
|
|
532
|
+
'before:content-[""] before:absolute before:inset-0 before:z-0',
|
|
533
|
+
"flex min-w-0 flex-1 items-center",
|
|
534
|
+
attrs.class
|
|
535
|
+
]);
|
|
536
|
+
const actionColumnClass = computed(() => [
|
|
537
|
+
"ml-auto flex shrink-0 items-center self-stretch",
|
|
538
|
+
props.showActionOnHover ? "[&_button]:opacity-0 [&_button]:transition-opacity group-hover/ck-history-item:[&_button]:opacity-100 group-focus-within/ck-history-item:[&_button]:opacity-100" : ""
|
|
539
|
+
]);
|
|
540
|
+
const actionButtonClass = computed(() => [
|
|
541
|
+
"relative z-10 inline-flex size-8 shrink-0 items-center justify-center rounded-sm border border-transparent text-content-on-surface-primary outline-hidden transition-colors",
|
|
542
|
+
"[&_svg]:size-4 [&_svg]:shrink-0",
|
|
543
|
+
"focus-visible:ring-0 focus-visible:outline-none",
|
|
544
|
+
pointerOnAction.value ? "bg-background-surface-primary-hover-default border-border-button-outlined" : ""
|
|
545
|
+
]);
|
|
546
|
+
const actionPopoverPanelClass = computed(() => [
|
|
547
|
+
"w-auto min-w-48 max-w-sm p-0 bg-background-surface-secondary",
|
|
548
|
+
props.actionPopoverContentClass
|
|
549
|
+
]);
|
|
550
|
+
const passthroughAttrs = computed(() => {
|
|
551
|
+
const { class: _class, ...rest } = attrs;
|
|
552
|
+
return rest;
|
|
553
|
+
});
|
|
554
|
+
function onActionClick(event) {
|
|
555
|
+
event.stopPropagation();
|
|
556
|
+
const el = event.currentTarget;
|
|
557
|
+
if (el instanceof HTMLElement && el.focus) {
|
|
558
|
+
queueMicrotask(() => el.focus({ preventScroll: true }));
|
|
559
|
+
}
|
|
560
|
+
if (!props.actionPopover) {
|
|
561
|
+
emit("action-click", event);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return (_ctx, _cache) => {
|
|
565
|
+
return openBlock(), createElementBlock("div", {
|
|
566
|
+
"data-active": props.isActive,
|
|
567
|
+
class: normalizeClass(containerClass.value)
|
|
568
|
+
}, [
|
|
569
|
+
createVNode(unref(Primitive), mergeProps(passthroughAttrs.value, {
|
|
570
|
+
as: props.as,
|
|
571
|
+
"as-child": props.asChild,
|
|
572
|
+
"data-active": props.isActive,
|
|
573
|
+
class: itemClass.value
|
|
574
|
+
}), {
|
|
575
|
+
default: withCtx(() => [
|
|
576
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
577
|
+
createElementVNode("div", _hoisted_3$1, toDisplayString(props.title), 1),
|
|
578
|
+
props.metaStart || props.metaEnd || _ctx.$slots.meta ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
579
|
+
renderSlot(_ctx.$slots, "meta", {}, () => [
|
|
580
|
+
props.metaStart ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(props.metaStart), 1)) : createCommentVNode("", true),
|
|
581
|
+
props.metaStart && props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_6$1, "|")) : createCommentVNode("", true),
|
|
582
|
+
props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString(props.metaEnd), 1)) : createCommentVNode("", true)
|
|
583
|
+
])
|
|
584
|
+
])) : createCommentVNode("", true)
|
|
585
|
+
])
|
|
586
|
+
]),
|
|
587
|
+
_: 3
|
|
588
|
+
}, 16, ["as", "as-child", "data-active", "class"]),
|
|
589
|
+
props.showAction ? (openBlock(), createElementBlock("div", {
|
|
590
|
+
key: 0,
|
|
591
|
+
class: normalizeClass(actionColumnClass.value),
|
|
592
|
+
onPointerenter: onActionPointerEnter,
|
|
593
|
+
onPointerleave: onActionPointerLeave
|
|
594
|
+
}, [
|
|
595
|
+
props.actionPopover ? (openBlock(), createBlock(unref(UiPopover), { key: 0 }, {
|
|
596
|
+
default: withCtx(() => [
|
|
597
|
+
createVNode(unref(UiPopoverTrigger), { "as-child": "" }, {
|
|
598
|
+
default: withCtx(() => [
|
|
599
|
+
createElementVNode("button", {
|
|
600
|
+
type: "button",
|
|
601
|
+
"aria-label": props.actionAriaLabel,
|
|
602
|
+
"aria-haspopup": "dialog",
|
|
603
|
+
class: normalizeClass(actionButtonClass.value),
|
|
604
|
+
onFocusin: onActionFocusIn,
|
|
605
|
+
onFocusout: onActionFocusOut,
|
|
606
|
+
onClick: withModifiers(onActionClick, ["stop"])
|
|
607
|
+
}, [
|
|
608
|
+
props.actionIcon ? (openBlock(), createBlock(resolveDynamicComponent(props.actionIcon), {
|
|
609
|
+
key: 0,
|
|
610
|
+
size: 16,
|
|
611
|
+
"aria-hidden": "true"
|
|
612
|
+
})) : (openBlock(), createBlock(unref(UiIcon), {
|
|
613
|
+
key: 1,
|
|
614
|
+
name: "more-vertical",
|
|
615
|
+
size: 16,
|
|
616
|
+
"aria-hidden": "true"
|
|
617
|
+
}))
|
|
618
|
+
], 42, _hoisted_8)
|
|
619
|
+
]),
|
|
620
|
+
_: 1
|
|
621
|
+
}),
|
|
622
|
+
createVNode(unref(UiPopoverContent), {
|
|
623
|
+
side: props.actionPopoverSide,
|
|
624
|
+
align: props.actionPopoverAlign,
|
|
625
|
+
"side-offset": props.actionPopoverSideOffset,
|
|
626
|
+
class: normalizeClass(actionPopoverPanelClass.value)
|
|
627
|
+
}, {
|
|
628
|
+
default: withCtx(() => [
|
|
629
|
+
renderSlot(_ctx.$slots, "action-popover")
|
|
630
|
+
]),
|
|
631
|
+
_: 3
|
|
632
|
+
}, 8, ["side", "align", "side-offset", "class"])
|
|
633
|
+
]),
|
|
634
|
+
_: 3
|
|
635
|
+
})) : props.actionTooltip ? (openBlock(), createBlock(unref(UiTooltip), {
|
|
636
|
+
key: 1,
|
|
637
|
+
content: props.actionTooltip,
|
|
638
|
+
side: "right"
|
|
639
|
+
}, {
|
|
640
|
+
default: withCtx(() => [
|
|
641
|
+
createElementVNode("button", {
|
|
642
|
+
type: "button",
|
|
643
|
+
"aria-label": props.actionAriaLabel,
|
|
644
|
+
class: normalizeClass(actionButtonClass.value),
|
|
645
|
+
onFocusin: onActionFocusIn,
|
|
646
|
+
onFocusout: onActionFocusOut,
|
|
647
|
+
onClick: withModifiers(onActionClick, ["stop"])
|
|
648
|
+
}, [
|
|
649
|
+
props.actionIcon ? (openBlock(), createBlock(resolveDynamicComponent(props.actionIcon), {
|
|
650
|
+
key: 0,
|
|
651
|
+
size: 16,
|
|
652
|
+
"aria-hidden": "true"
|
|
653
|
+
})) : (openBlock(), createBlock(unref(UiIcon), {
|
|
654
|
+
key: 1,
|
|
655
|
+
name: "more-vertical",
|
|
656
|
+
size: 16,
|
|
657
|
+
"aria-hidden": "true"
|
|
658
|
+
}))
|
|
659
|
+
], 42, _hoisted_9)
|
|
660
|
+
]),
|
|
661
|
+
_: 1
|
|
662
|
+
}, 8, ["content"])) : (openBlock(), createElementBlock("button", {
|
|
663
|
+
key: 2,
|
|
664
|
+
type: "button",
|
|
665
|
+
"aria-label": props.actionAriaLabel,
|
|
666
|
+
class: normalizeClass(actionButtonClass.value),
|
|
667
|
+
onFocusin: onActionFocusIn,
|
|
668
|
+
onFocusout: onActionFocusOut,
|
|
669
|
+
onClick: withModifiers(onActionClick, ["stop"])
|
|
670
|
+
}, [
|
|
671
|
+
props.actionIcon ? (openBlock(), createBlock(resolveDynamicComponent(props.actionIcon), {
|
|
672
|
+
key: 0,
|
|
673
|
+
size: 16,
|
|
674
|
+
"aria-hidden": "true"
|
|
675
|
+
})) : (openBlock(), createBlock(unref(UiIcon), {
|
|
676
|
+
key: 1,
|
|
677
|
+
name: "more-vertical",
|
|
678
|
+
size: 16,
|
|
679
|
+
"aria-hidden": "true"
|
|
680
|
+
}))
|
|
681
|
+
], 42, _hoisted_10))
|
|
682
|
+
], 34)) : createCommentVNode("", true)
|
|
683
|
+
], 10, _hoisted_1$3);
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
const baseClass = "flex w-full min-w-0 flex-col p-2";
|
|
688
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
689
|
+
...{
|
|
690
|
+
name: "CkHistoryWrapper",
|
|
691
|
+
inheritAttrs: false
|
|
692
|
+
},
|
|
693
|
+
__name: "CkHistoryWrapper",
|
|
694
|
+
props: {
|
|
695
|
+
withGap: { type: Boolean, default: true }
|
|
696
|
+
},
|
|
697
|
+
setup(__props) {
|
|
698
|
+
const props = __props;
|
|
699
|
+
const attrs = useAttrs();
|
|
700
|
+
const rootClass = computed(() => {
|
|
701
|
+
const consumerClass = typeof attrs.class === "string" ? attrs.class : void 0;
|
|
702
|
+
return [baseClass, props.withGap ? "gap-1" : void 0, consumerClass].filter(Boolean).join(" ");
|
|
703
|
+
});
|
|
704
|
+
const passthroughAttrs = computed(() => {
|
|
705
|
+
const { class: _class, ...rest } = attrs;
|
|
706
|
+
return rest;
|
|
707
|
+
});
|
|
708
|
+
return (_ctx, _cache) => {
|
|
709
|
+
return openBlock(), createElementBlock("div", mergeProps(passthroughAttrs.value, {
|
|
710
|
+
"data-slot": "chat-history",
|
|
711
|
+
class: rootClass.value
|
|
712
|
+
}), [
|
|
713
|
+
renderSlot(_ctx.$slots, "default")
|
|
714
|
+
], 16);
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
});
|
|
372
718
|
const defaultMarkdownClasses = {
|
|
373
719
|
p: "my-1 leading-7",
|
|
374
720
|
a: "underline underline-offset-4",
|
|
@@ -410,11 +756,14 @@ function domToVNode(node, slots, classes) {
|
|
|
410
756
|
}
|
|
411
757
|
return h(tag, attrs, children);
|
|
412
758
|
}
|
|
413
|
-
const _sfc_main$
|
|
759
|
+
const _sfc_main$8 = defineComponent({
|
|
414
760
|
name: "CkMarkdownRenderer",
|
|
415
761
|
props: {
|
|
416
762
|
content: { type: String, required: true },
|
|
417
|
-
classes: {
|
|
763
|
+
classes: {
|
|
764
|
+
type: Object,
|
|
765
|
+
default: () => ({})
|
|
766
|
+
},
|
|
418
767
|
plugins: { type: Array, default: void 0 }
|
|
419
768
|
},
|
|
420
769
|
setup(props, { slots }) {
|
|
@@ -437,7 +786,7 @@ const _sfc_main$7 = defineComponent({
|
|
|
437
786
|
};
|
|
438
787
|
}
|
|
439
788
|
});
|
|
440
|
-
const _sfc_main$
|
|
789
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
441
790
|
...{ name: "CkPromptActionButton" },
|
|
442
791
|
__name: "CkPromptActionButton",
|
|
443
792
|
props: {
|
|
@@ -463,7 +812,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
463
812
|
};
|
|
464
813
|
}
|
|
465
814
|
});
|
|
466
|
-
const _sfc_main$
|
|
815
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
467
816
|
...{ name: "CkPromptStopButton" },
|
|
468
817
|
__name: "CkPromptStopButton",
|
|
469
818
|
props: {
|
|
@@ -494,7 +843,7 @@ const _hoisted_4 = { class: "flex items-center justify-between" };
|
|
|
494
843
|
const _hoisted_5 = { key: 0 };
|
|
495
844
|
const _hoisted_6 = { key: 1 };
|
|
496
845
|
const _hoisted_7 = { class: "ml-auto" };
|
|
497
|
-
const _sfc_main$
|
|
846
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
498
847
|
...{ name: "CkPromptInput" },
|
|
499
848
|
__name: "CkPromptInput",
|
|
500
849
|
props: {
|
|
@@ -590,7 +939,7 @@ const _hoisted_1$1 = {
|
|
|
590
939
|
key: 0,
|
|
591
940
|
class: "text-core-content-tertiary text-center text-xs leading-3.5"
|
|
592
941
|
};
|
|
593
|
-
const _sfc_main$
|
|
942
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
594
943
|
...{ name: "CkPromptInputDisclaimer" },
|
|
595
944
|
__name: "CkPromptInputDisclaimer",
|
|
596
945
|
props: {
|
|
@@ -608,7 +957,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
608
957
|
});
|
|
609
958
|
const _hoisted_1 = { class: "bg-background-surface-primary inline-flex max-w-[600px] flex-col items-end justify-start gap-4 rounded-xl p-6" };
|
|
610
959
|
const _hoisted_2 = { class: "text-content-on-surface-primary justify-start self-stretch text-base leading-6 font-normal" };
|
|
611
|
-
const _sfc_main$
|
|
960
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
612
961
|
...{ name: "CkUserMessage" },
|
|
613
962
|
__name: "CkUserMessage",
|
|
614
963
|
props: {
|
|
@@ -626,7 +975,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
626
975
|
};
|
|
627
976
|
}
|
|
628
977
|
});
|
|
629
|
-
const _sfc_main$
|
|
978
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
630
979
|
...{ name: "CkConversation" },
|
|
631
980
|
__name: "CkConversation",
|
|
632
981
|
props: {
|
|
@@ -645,13 +994,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
645
994
|
);
|
|
646
995
|
const isLoading = (message) => message.status === "started" || message.status === "sending";
|
|
647
996
|
return (_ctx, _cache) => {
|
|
648
|
-
return openBlock(), createBlock(_sfc_main$
|
|
997
|
+
return openBlock(), createBlock(_sfc_main$d, { messages: __props.messages }, {
|
|
649
998
|
"user-message": withCtx(({ message }) => [
|
|
650
999
|
createElementVNode("div", {
|
|
651
1000
|
class: normalizeClass({ "ml-8": hasIcon.value })
|
|
652
1001
|
}, [
|
|
653
1002
|
renderSlot(_ctx.$slots, "user-message", { message }, () => [
|
|
654
|
-
createVNode(_sfc_main$
|
|
1003
|
+
createVNode(_sfc_main$3, {
|
|
655
1004
|
message: message.content
|
|
656
1005
|
}, {
|
|
657
1006
|
default: withCtx(() => [
|
|
@@ -666,7 +1015,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
666
1015
|
]),
|
|
667
1016
|
"agent-message": withCtx(({ message }) => [
|
|
668
1017
|
renderSlot(_ctx.$slots, "agent-message", { message }, () => [
|
|
669
|
-
createVNode(_sfc_main$
|
|
1018
|
+
createVNode(_sfc_main$e, null, createSlots({
|
|
670
1019
|
footer: withCtx(() => [
|
|
671
1020
|
renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
|
|
672
1021
|
message.content && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
|
|
@@ -679,7 +1028,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
679
1028
|
]),
|
|
680
1029
|
default: withCtx(() => [
|
|
681
1030
|
renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
|
|
682
|
-
createVNode(_sfc_main$
|
|
1031
|
+
createVNode(_sfc_main$8, {
|
|
683
1032
|
content: message.content,
|
|
684
1033
|
classes: __props.agentMarkdownClasses
|
|
685
1034
|
}, createSlots({ _: 2 }, [
|
|
@@ -757,6 +1106,101 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
757
1106
|
};
|
|
758
1107
|
}
|
|
759
1108
|
});
|
|
1109
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1110
|
+
...{ name: "CkHistory" },
|
|
1111
|
+
__name: "CkHistory",
|
|
1112
|
+
props: {
|
|
1113
|
+
conversations: {},
|
|
1114
|
+
hrefResolver: {},
|
|
1115
|
+
activeId: { default: void 0 },
|
|
1116
|
+
showAction: { type: Boolean, default: true },
|
|
1117
|
+
showActionOnHover: { type: Boolean, default: true }
|
|
1118
|
+
},
|
|
1119
|
+
emits: ["select", "edit", "delete"],
|
|
1120
|
+
setup(__props, { emit: __emit }) {
|
|
1121
|
+
const props = __props;
|
|
1122
|
+
const emit = __emit;
|
|
1123
|
+
const labels = useChatKitLabels();
|
|
1124
|
+
function hrefFor(c) {
|
|
1125
|
+
return props.hrefResolver(c.id);
|
|
1126
|
+
}
|
|
1127
|
+
function titleFor(c) {
|
|
1128
|
+
const title = c.title?.trim();
|
|
1129
|
+
return title ? title : labels.value.historyItemUntitled;
|
|
1130
|
+
}
|
|
1131
|
+
function handleRowClick(c, event) {
|
|
1132
|
+
if (event.defaultPrevented) return;
|
|
1133
|
+
if (event.button !== 0) return;
|
|
1134
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
1135
|
+
event.preventDefault();
|
|
1136
|
+
emit("select", c, event);
|
|
1137
|
+
}
|
|
1138
|
+
return (_ctx, _cache) => {
|
|
1139
|
+
return openBlock(), createBlock(_sfc_main$9, null, {
|
|
1140
|
+
default: withCtx(() => [
|
|
1141
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.conversations, (conversation) => {
|
|
1142
|
+
return renderSlot(_ctx.$slots, "item", {
|
|
1143
|
+
key: conversation.id,
|
|
1144
|
+
conversation,
|
|
1145
|
+
href: hrefFor(conversation),
|
|
1146
|
+
isActive: conversation.id === props.activeId,
|
|
1147
|
+
title: titleFor(conversation),
|
|
1148
|
+
select: (event) => handleRowClick(conversation, event),
|
|
1149
|
+
edit: () => emit("edit", conversation),
|
|
1150
|
+
delete: () => emit("delete", conversation)
|
|
1151
|
+
}, () => [
|
|
1152
|
+
createVNode(_sfc_main$a, {
|
|
1153
|
+
as: "a",
|
|
1154
|
+
href: hrefFor(conversation),
|
|
1155
|
+
"is-active": conversation.id === props.activeId,
|
|
1156
|
+
title: titleFor(conversation),
|
|
1157
|
+
"show-action": props.showAction,
|
|
1158
|
+
"show-action-on-hover": props.showActionOnHover,
|
|
1159
|
+
"action-popover": props.showAction,
|
|
1160
|
+
"action-aria-label": unref(labels).historyItemActionAriaLabel,
|
|
1161
|
+
onClick: ($event) => handleRowClick(conversation, $event)
|
|
1162
|
+
}, {
|
|
1163
|
+
"action-popover": withCtx(() => [
|
|
1164
|
+
createVNode(unref(UiSidebarPopoverMenu), { "show-footer-separator": false }, {
|
|
1165
|
+
default: withCtx(() => [
|
|
1166
|
+
createVNode(unref(UiSidebarPopoverMenuItem), {
|
|
1167
|
+
label: unref(labels).historyItemEditAction,
|
|
1168
|
+
onClick: ($event) => emit("edit", conversation)
|
|
1169
|
+
}, {
|
|
1170
|
+
icon: withCtx(() => [
|
|
1171
|
+
createVNode(unref(UiIcon), {
|
|
1172
|
+
name: "pencil",
|
|
1173
|
+
size: "s"
|
|
1174
|
+
})
|
|
1175
|
+
]),
|
|
1176
|
+
_: 1
|
|
1177
|
+
}, 8, ["label", "onClick"]),
|
|
1178
|
+
createVNode(unref(UiSidebarPopoverMenuItem), {
|
|
1179
|
+
label: unref(labels).historyItemDeleteAction,
|
|
1180
|
+
onClick: ($event) => emit("delete", conversation)
|
|
1181
|
+
}, {
|
|
1182
|
+
icon: withCtx(() => [
|
|
1183
|
+
createVNode(unref(UiIcon), {
|
|
1184
|
+
name: "trash",
|
|
1185
|
+
size: "s"
|
|
1186
|
+
})
|
|
1187
|
+
]),
|
|
1188
|
+
_: 1
|
|
1189
|
+
}, 8, ["label", "onClick"])
|
|
1190
|
+
]),
|
|
1191
|
+
_: 2
|
|
1192
|
+
}, 1024)
|
|
1193
|
+
]),
|
|
1194
|
+
_: 2
|
|
1195
|
+
}, 1032, ["href", "is-active", "title", "show-action", "show-action-on-hover", "action-popover", "action-aria-label", "onClick"])
|
|
1196
|
+
]);
|
|
1197
|
+
}), 128))
|
|
1198
|
+
]),
|
|
1199
|
+
_: 3
|
|
1200
|
+
});
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
});
|
|
760
1204
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
761
1205
|
...{ name: "CkInput" },
|
|
762
1206
|
__name: "CkInput",
|
|
@@ -793,7 +1237,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
793
1237
|
}
|
|
794
1238
|
__expose({ focus, submit });
|
|
795
1239
|
return (_ctx, _cache) => {
|
|
796
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1240
|
+
return openBlock(), createBlock(_sfc_main$5, {
|
|
797
1241
|
ref_key: "promptInputRef",
|
|
798
1242
|
ref: promptInputRef,
|
|
799
1243
|
"model-value": __props.modelValue,
|
|
@@ -806,7 +1250,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
806
1250
|
}, createSlots({
|
|
807
1251
|
"toolbar-right": withCtx((scope) => [
|
|
808
1252
|
renderSlot(_ctx.$slots, "toolbar-right", normalizeProps(guardReactiveProps(scope)), () => [
|
|
809
|
-
__props.loading ? (openBlock(), createBlock(_sfc_main$
|
|
1253
|
+
__props.loading ? (openBlock(), createBlock(_sfc_main$6, {
|
|
810
1254
|
key: 0,
|
|
811
1255
|
"aria-label": __props.stopAriaLabel,
|
|
812
1256
|
disabled: __props.disabled,
|
|
@@ -814,17 +1258,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
814
1258
|
}, {
|
|
815
1259
|
default: withCtx(() => [
|
|
816
1260
|
renderSlot(_ctx.$slots, "stop-icon", {}, () => [
|
|
817
|
-
createVNode(_sfc_main$
|
|
1261
|
+
createVNode(_sfc_main$f)
|
|
818
1262
|
])
|
|
819
1263
|
]),
|
|
820
1264
|
_: 3
|
|
821
|
-
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$
|
|
1265
|
+
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$7, mergeProps({ key: 1 }, { ariaLabel: "Send message" }, {
|
|
822
1266
|
type: "submit",
|
|
823
1267
|
disabled: scope.disabled
|
|
824
1268
|
}), {
|
|
825
1269
|
default: withCtx(() => [
|
|
826
1270
|
renderSlot(_ctx.$slots, "send-icon", {}, () => [
|
|
827
|
-
createVNode(_sfc_main$
|
|
1271
|
+
createVNode(_sfc_main$g)
|
|
828
1272
|
])
|
|
829
1273
|
]),
|
|
830
1274
|
_: 3
|
|
@@ -833,7 +1277,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
833
1277
|
]),
|
|
834
1278
|
footer: withCtx(() => [
|
|
835
1279
|
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
836
|
-
__props.disclaimer ? (openBlock(), createBlock(_sfc_main$
|
|
1280
|
+
__props.disclaimer ? (openBlock(), createBlock(_sfc_main$4, {
|
|
837
1281
|
key: 0,
|
|
838
1282
|
text: __props.disclaimer
|
|
839
1283
|
}, null, 8, ["text"])) : createCommentVNode("", true)
|
|
@@ -854,17 +1298,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
854
1298
|
});
|
|
855
1299
|
export {
|
|
856
1300
|
CkCopyMessageActionButton as C,
|
|
857
|
-
_sfc_main$
|
|
858
|
-
_sfc_main$
|
|
859
|
-
_sfc_main$
|
|
860
|
-
_sfc_main as c,
|
|
861
|
-
_sfc_main$
|
|
862
|
-
|
|
863
|
-
_sfc_main
|
|
864
|
-
_sfc_main$
|
|
865
|
-
_sfc_main$
|
|
866
|
-
_sfc_main$
|
|
867
|
-
_sfc_main$
|
|
868
|
-
_sfc_main$
|
|
869
|
-
_sfc_main$
|
|
1301
|
+
_sfc_main$e as _,
|
|
1302
|
+
_sfc_main$2 as a,
|
|
1303
|
+
_sfc_main$d as b,
|
|
1304
|
+
_sfc_main$1 as c,
|
|
1305
|
+
_sfc_main$a as d,
|
|
1306
|
+
_sfc_main$9 as e,
|
|
1307
|
+
_sfc_main as f,
|
|
1308
|
+
_sfc_main$8 as g,
|
|
1309
|
+
_sfc_main$c as h,
|
|
1310
|
+
_sfc_main$7 as i,
|
|
1311
|
+
_sfc_main$5 as j,
|
|
1312
|
+
_sfc_main$4 as k,
|
|
1313
|
+
_sfc_main$6 as l,
|
|
1314
|
+
_sfc_main$g as m,
|
|
1315
|
+
_sfc_main$f as n,
|
|
1316
|
+
_sfc_main$3 as o
|
|
870
1317
|
};
|