@aleph-alpha/chat-kit 3.2.0 → 4.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-B-4xnH2c.js → CkInput.vue_vue_type_script_setup_true_lang-DJN-nZ2-.js} +391 -113
- package/dist/adapters/responses-api.d.ts +11 -5
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -3
- package/dist/chat-kit.css +14 -8
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts +7 -0
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/types.d.ts +1 -1
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts +47 -0
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts.map +1 -0
- package/dist/components/base/CkCitation/CkCitation.vue.d.ts +15 -0
- package/dist/components/base/CkCitation/CkCitation.vue.d.ts.map +1 -0
- package/dist/components/base/CkCitation/index.d.ts +3 -0
- package/dist/components/base/CkCitation/index.d.ts.map +1 -0
- package/dist/components/base/CkCitation/types.d.ts +79 -0
- package/dist/components/base/CkCitation/types.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts +51 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts +13 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/index.d.ts +3 -0
- package/dist/components/base/CkCitationCard/index.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/types.d.ts +51 -0
- package/dist/components/base/CkCitationCard/types.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts → CkCopyMessageButton/CkCopyMessageButton.stories.d.ts} +3 -3
- package/dist/components/base/CkCopyMessageButton/CkCopyMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts → CkCopyMessageButton/CkCopyMessageButton.vue.d.ts} +4 -4
- package/dist/components/base/CkCopyMessageButton/CkCopyMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkCopyMessageButton/index.d.ts +3 -0
- package/dist/components/base/CkCopyMessageButton/index.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton → CkCopyMessageButton}/types.d.ts +3 -3
- package/dist/components/base/CkCopyMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts +1 -1
- package/dist/components/base/CkFeedbackButton/types.d.ts +1 -1
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts +2 -2
- package/dist/components/base/CkFeedbackDialog/types.d.ts +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -1
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +15 -0
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts +16 -2
- 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 +25 -0
- package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts +17 -0
- package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton/CkMessageActionButton.stories.d.ts → CkMessageButton/CkMessageButton.stories.d.ts} +3 -3
- package/dist/components/base/CkMessageButton/CkMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton/CkMessageActionButton.vue.d.ts → CkMessageButton/CkMessageButton.vue.d.ts} +3 -3
- package/dist/components/base/CkMessageButton/CkMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkMessageButton/index.d.ts +3 -0
- package/dist/components/base/CkMessageButton/index.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton → CkMessageButton}/types.d.ts +2 -2
- package/dist/components/base/CkMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts +1 -1
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.d.ts +16 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue.d.ts +12 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkRegenerateMessageButton/index.d.ts +3 -0
- package/dist/components/base/{CkCopyMessageActionButton → CkRegenerateMessageButton}/index.d.ts.map +1 -1
- package/dist/components/base/CkRegenerateMessageButton/types.d.ts +27 -0
- package/dist/components/base/CkRegenerateMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +8 -3
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/CkConversation.stories.d.ts +1 -1
- package/dist/components/composed/CkConversation/types.d.ts +1 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +26 -23
- package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
- package/dist/composables/fileUpload/useFileUploadWrapper.d.ts.map +1 -1
- package/dist/composables/index.js +1 -1
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +4 -3
- package/dist/handlers/useChatKitLabels.d.ts +13 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/handlers/useMarkdownParser.d.ts.map +1 -1
- package/dist/handlers/useMessageHandler.d.ts +37 -0
- package/dist/handlers/useMessageHandler.d.ts.map +1 -1
- package/dist/helpers/conversationTree.d.ts +15 -0
- package/dist/helpers/conversationTree.d.ts.map +1 -1
- package/dist/helpers/unified/remarkCitations.d.ts +17 -0
- package/dist/helpers/unified/remarkCitations.d.ts.map +1 -0
- package/dist/{index-DAmWGYNH.js → index-CyrVnbS9.js} +86 -71
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -27
- package/dist/{useChatKitLabels-D5gNv8se.js → useChatKitLabels-zMFV7aEz.js} +31 -3
- package/dist/{useMessageHandler-CMdy-lm0.js → useMessageHandler-N50Yj-NU.js} +45 -7
- package/package.json +5 -3
- package/src/adapters/responses-api.spec.ts +52 -5
- package/src/adapters/responses-api.ts +26 -7
- package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +112 -0
- package/src/components/base/CkAgentMessage/types.ts +1 -1
- package/src/components/base/CkCitation/CkCitation.spec.ts +79 -0
- package/src/components/base/CkCitation/CkCitation.stories.ts +136 -0
- package/src/components/base/CkCitation/CkCitation.vue +145 -0
- package/src/components/base/CkCitation/index.ts +2 -0
- package/src/components/base/CkCitation/types.ts +80 -0
- package/src/components/base/CkCitationCard/CkCitationCard.spec.ts +77 -0
- package/src/components/base/CkCitationCard/CkCitationCard.stories.ts +144 -0
- package/src/components/base/CkCitationCard/CkCitationCard.vue +76 -0
- package/src/components/base/CkCitationCard/index.ts +2 -0
- package/src/components/base/CkCitationCard/types.ts +51 -0
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.spec.ts → CkCopyMessageButton/CkCopyMessageButton.spec.ts} +6 -6
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts → CkCopyMessageButton/CkCopyMessageButton.stories.ts} +8 -8
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.vue → CkCopyMessageButton/CkCopyMessageButton.vue} +6 -6
- package/src/components/base/CkCopyMessageButton/index.ts +2 -0
- package/src/components/base/{CkCopyMessageActionButton → CkCopyMessageButton}/types.ts +3 -3
- package/src/components/base/CkFeedbackButton/CkFeedbackButton.vue +5 -5
- package/src/components/base/CkFeedbackButton/types.ts +1 -1
- package/src/components/base/CkFeedbackDialog/types.ts +1 -1
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +124 -0
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +118 -0
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +70 -28
- package/src/components/base/CkMarkdownRenderer/index.ts +1 -0
- package/src/components/base/CkMarkdownRenderer/types.ts +26 -0
- package/src/components/base/CkMarkdownRenderer/useCitationRendering.spec.ts +94 -0
- package/src/components/base/CkMarkdownRenderer/useCitationRendering.ts +52 -0
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.spec.ts → CkMessageButton/CkMessageButton.spec.ts} +6 -6
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.stories.ts → CkMessageButton/CkMessageButton.stories.ts} +10 -10
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.vue → CkMessageButton/CkMessageButton.vue} +3 -3
- package/src/components/base/CkMessageButton/index.ts +2 -0
- package/src/components/base/{CkMessageActionButton → CkMessageButton}/types.ts +2 -2
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.spec.ts +49 -0
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.ts +63 -0
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue +43 -0
- package/src/components/base/CkRegenerateMessageButton/index.ts +2 -0
- package/src/components/base/CkRegenerateMessageButton/types.ts +27 -0
- package/src/components/base/index.ts +15 -2
- package/src/components/composed/CkConversation/CkConversation.stories.ts +6 -6
- package/src/components/composed/CkConversation/CkConversation.vue +2 -2
- package/src/components/composed/CkConversation/types.ts +1 -1
- package/src/components/index.ts +11 -2
- package/src/composables/fileUpload/useFileUpload.spec.ts +2 -61
- package/src/composables/fileUpload/useFileUpload.ts +2 -9
- package/src/composables/fileUpload/useFileUploadWrapper.spec.ts +195 -14
- package/src/composables/fileUpload/useFileUploadWrapper.ts +114 -81
- package/src/handlers/index.ts +2 -0
- package/src/handlers/useChatKitLabels.spec.ts +1 -0
- package/src/handlers/useChatKitLabels.ts +16 -0
- package/src/handlers/useMarkdownParser.ts +5 -2
- package/src/handlers/useMessageHandler.spec.ts +79 -0
- package/src/handlers/useMessageHandler.ts +50 -2
- package/src/helpers/conversationTree.spec.ts +120 -0
- package/src/helpers/conversationTree.ts +57 -8
- package/src/helpers/unified/remarkCitations.spec.ts +112 -0
- package/src/helpers/unified/remarkCitations.ts +55 -0
- package/src/index.ts +11 -2
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkCopyMessageActionButton/index.d.ts +0 -3
- package/dist/components/base/CkCopyMessageActionButton/types.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/index.d.ts +0 -3
- package/dist/components/base/CkMessageActionButton/index.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/types.d.ts.map +0 -1
- package/src/components/base/CkCopyMessageActionButton/index.ts +0 -2
- package/src/components/base/CkMessageActionButton/index.ts +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, mergeProps,
|
|
2
|
-
import { UiIcon, UiButton, UiTooltip, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem,
|
|
3
|
-
import { u as useChatKitLabels, d as defaultChatKitLabels, a as useMarkdownParser } from "./useChatKitLabels-
|
|
1
|
+
import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, renderSlot, createCommentVNode, computed, createVNode, toDisplayString, withCtx, ref, onBeforeUnmount, normalizeClass, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, mergeProps, Transition, createStaticVNode, Teleport, withModifiers, toValue, h, toRefs, useId, createTextVNode, useAttrs, useSlots, resolveDynamicComponent, useTemplateRef, onUpdated, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { UiIcon, UiFileType, UiButton, UiPopover, UiPopoverTrigger, UiPopoverContent, UiTooltip, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiProgress, Primitive, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
|
|
3
|
+
import { u as useChatKitLabels, d as defaultChatKitLabels, r as remarkCitations, a as useMarkdownParser } from "./useChatKitLabels-zMFV7aEz.js";
|
|
4
4
|
const MINUTE = 60;
|
|
5
5
|
const HOUR = 60 * MINUTE;
|
|
6
6
|
const DAY = 24 * HOUR;
|
|
@@ -36,7 +36,7 @@ function formatRelativeTime(unixSeconds, nowSeconds = Math.floor(Date.now() / 1e
|
|
|
36
36
|
const years = Math.floor(delta / YEAR);
|
|
37
37
|
return years === 1 ? "1 year ago" : `${years} years ago`;
|
|
38
38
|
}
|
|
39
|
-
const _sfc_main$
|
|
39
|
+
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
40
40
|
...{ name: "CkSendIcon" },
|
|
41
41
|
__name: "CkSendIcon",
|
|
42
42
|
setup(__props) {
|
|
@@ -45,19 +45,19 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
const _hoisted_1$
|
|
48
|
+
const _hoisted_1$f = {
|
|
49
49
|
xmlns: "http://www.w3.org/2000/svg",
|
|
50
50
|
width: "16",
|
|
51
51
|
height: "16",
|
|
52
52
|
viewBox: "0 0 16 16",
|
|
53
53
|
fill: "none"
|
|
54
54
|
};
|
|
55
|
-
const _sfc_main$
|
|
55
|
+
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
56
56
|
...{ name: "CkStopIcon" },
|
|
57
57
|
__name: "CkStopIcon",
|
|
58
58
|
setup(__props) {
|
|
59
59
|
return (_ctx, _cache) => {
|
|
60
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
60
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$f, [..._cache[0] || (_cache[0] = [
|
|
61
61
|
createElementVNode("path", {
|
|
62
62
|
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",
|
|
63
63
|
fill: "currentColor"
|
|
@@ -66,41 +66,41 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
|
-
const _hoisted_1$
|
|
70
|
-
const _hoisted_2$
|
|
69
|
+
const _hoisted_1$e = { class: "flex w-full min-w-0 flex-col gap-6 pb-6" };
|
|
70
|
+
const _hoisted_2$9 = {
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "flex items-start gap-3"
|
|
73
73
|
};
|
|
74
|
-
const _hoisted_3$
|
|
74
|
+
const _hoisted_3$8 = {
|
|
75
75
|
key: 0,
|
|
76
76
|
"data-testid": "ck-agent-message-icon",
|
|
77
77
|
class: "flex flex-shrink-0 justify-center"
|
|
78
78
|
};
|
|
79
|
-
const _hoisted_4$
|
|
79
|
+
const _hoisted_4$7 = {
|
|
80
80
|
key: 1,
|
|
81
81
|
"data-testid": "ck-agent-message-header",
|
|
82
82
|
class: "body-14-regular text-content-on-surface-muted min-w-0 flex-1 [word-break:break-word]"
|
|
83
83
|
};
|
|
84
|
-
const _hoisted_5$
|
|
84
|
+
const _hoisted_5$5 = { class: "text-content-on-surface-primary min-w-0 text-base leading-7" };
|
|
85
85
|
const _hoisted_6$3 = {
|
|
86
86
|
key: 1,
|
|
87
87
|
class: "flex items-center gap-4"
|
|
88
88
|
};
|
|
89
|
-
const _sfc_main$
|
|
89
|
+
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
90
90
|
...{ name: "CkAgentMessage" },
|
|
91
91
|
__name: "CkAgentMessage",
|
|
92
92
|
setup(__props) {
|
|
93
93
|
return (_ctx, _cache) => {
|
|
94
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
95
|
-
_ctx.$slots.icon || _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
96
|
-
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
94
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
95
|
+
_ctx.$slots.icon || _ctx.$slots.header ? (openBlock(), createElementBlock("div", _hoisted_2$9, [
|
|
96
|
+
_ctx.$slots.icon ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
|
|
97
97
|
renderSlot(_ctx.$slots, "icon")
|
|
98
98
|
])) : createCommentVNode("", true),
|
|
99
|
-
_ctx.$slots.header ? (openBlock(), createElementBlock("span", _hoisted_4$
|
|
99
|
+
_ctx.$slots.header ? (openBlock(), createElementBlock("span", _hoisted_4$7, [
|
|
100
100
|
renderSlot(_ctx.$slots, "header")
|
|
101
101
|
])) : createCommentVNode("", true)
|
|
102
102
|
])) : createCommentVNode("", true),
|
|
103
|
-
createElementVNode("div", _hoisted_5$
|
|
103
|
+
createElementVNode("div", _hoisted_5$5, [
|
|
104
104
|
renderSlot(_ctx.$slots, "default")
|
|
105
105
|
]),
|
|
106
106
|
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
|
|
@@ -110,6 +110,194 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
|
+
const _hoisted_1$d = { class: "ck-citation-card flex w-[22.5rem] max-w-[90vw] flex-col gap-2 rounded-md bg-background-surface-floating px-6 pb-6 pt-4 shadow-md" };
|
|
114
|
+
const _hoisted_2$8 = { class: "flex items-center gap-3" };
|
|
115
|
+
const _hoisted_3$7 = ["title"];
|
|
116
|
+
const _hoisted_4$6 = { class: "break-words text-sm leading-5 text-content-on-surface-secondary" };
|
|
117
|
+
const _hoisted_5$4 = {
|
|
118
|
+
key: 0,
|
|
119
|
+
class: "text-sm leading-5 text-content-on-surface-muted"
|
|
120
|
+
};
|
|
121
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
122
|
+
...{
|
|
123
|
+
name: "CkCitationCard"
|
|
124
|
+
},
|
|
125
|
+
__name: "CkCitationCard",
|
|
126
|
+
props: {
|
|
127
|
+
fileName: {},
|
|
128
|
+
snippet: {},
|
|
129
|
+
locationLabel: { default: void 0 },
|
|
130
|
+
url: { default: void 0 },
|
|
131
|
+
openSourceLabel: { default: void 0 }
|
|
132
|
+
},
|
|
133
|
+
emits: ["open-source"],
|
|
134
|
+
setup(__props, { emit: __emit }) {
|
|
135
|
+
const props = __props;
|
|
136
|
+
const emit = __emit;
|
|
137
|
+
const labels = useChatKitLabels();
|
|
138
|
+
const openSourceAriaLabel = computed(
|
|
139
|
+
() => props.openSourceLabel ?? labels.value.citationOpenSource ?? defaultChatKitLabels.citationOpenSource
|
|
140
|
+
);
|
|
141
|
+
function handleOpen() {
|
|
142
|
+
if (props.url) {
|
|
143
|
+
emit("open-source", props.url);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return (_ctx, _cache) => {
|
|
147
|
+
return openBlock(), createElementBlock("div", _hoisted_1$d, [
|
|
148
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
149
|
+
createVNode(unref(UiFileType), {
|
|
150
|
+
filename: __props.fileName,
|
|
151
|
+
class: "shrink-0"
|
|
152
|
+
}, null, 8, ["filename"]),
|
|
153
|
+
createElementVNode("p", {
|
|
154
|
+
class: "min-w-0 flex-1 truncate text-sm font-medium text-content-on-surface-primary",
|
|
155
|
+
title: __props.fileName
|
|
156
|
+
}, toDisplayString(__props.fileName), 9, _hoisted_3$7),
|
|
157
|
+
__props.url ? (openBlock(), createBlock(unref(UiButton), {
|
|
158
|
+
key: 0,
|
|
159
|
+
variant: "ghost",
|
|
160
|
+
size: "icon-sm",
|
|
161
|
+
"aria-label": openSourceAriaLabel.value,
|
|
162
|
+
class: "shrink-0",
|
|
163
|
+
onClick: handleOpen
|
|
164
|
+
}, {
|
|
165
|
+
default: withCtx(() => [
|
|
166
|
+
createVNode(unref(UiIcon), {
|
|
167
|
+
name: "external-link",
|
|
168
|
+
size: 16,
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
})
|
|
171
|
+
]),
|
|
172
|
+
_: 1
|
|
173
|
+
}, 8, ["aria-label"])) : createCommentVNode("", true)
|
|
174
|
+
]),
|
|
175
|
+
createElementVNode("p", _hoisted_4$6, toDisplayString(__props.snippet), 1),
|
|
176
|
+
__props.locationLabel ? (openBlock(), createElementBlock("p", _hoisted_5$4, toDisplayString(__props.locationLabel), 1)) : createCommentVNode("", true)
|
|
177
|
+
]);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const _hoisted_1$c = ["aria-label"];
|
|
182
|
+
const CLOSE_DELAY_MS = 80;
|
|
183
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
184
|
+
...{
|
|
185
|
+
name: "CkCitation"
|
|
186
|
+
},
|
|
187
|
+
__name: "CkCitation",
|
|
188
|
+
props: {
|
|
189
|
+
selected: { type: Boolean, default: false },
|
|
190
|
+
ariaLabel: { default: void 0 },
|
|
191
|
+
openSourceLabel: { default: void 0 },
|
|
192
|
+
index: {},
|
|
193
|
+
fileName: {},
|
|
194
|
+
snippet: {},
|
|
195
|
+
locationLabel: { default: void 0 },
|
|
196
|
+
url: { default: void 0 }
|
|
197
|
+
},
|
|
198
|
+
emits: ["open-source"],
|
|
199
|
+
setup(__props, { emit: __emit }) {
|
|
200
|
+
const props = __props;
|
|
201
|
+
const emit = __emit;
|
|
202
|
+
const labels = useChatKitLabels();
|
|
203
|
+
const triggerLabel = computed(
|
|
204
|
+
() => props.ariaLabel ?? `${labels.value.citationSourceLabel ?? defaultChatKitLabels.citationSourceLabel} ${props.index}`
|
|
205
|
+
);
|
|
206
|
+
const open = ref(false);
|
|
207
|
+
const isPointerInteraction = ref(false);
|
|
208
|
+
let closeTimer;
|
|
209
|
+
function show() {
|
|
210
|
+
if (closeTimer) {
|
|
211
|
+
clearTimeout(closeTimer);
|
|
212
|
+
closeTimer = void 0;
|
|
213
|
+
}
|
|
214
|
+
open.value = true;
|
|
215
|
+
}
|
|
216
|
+
function scheduleHide() {
|
|
217
|
+
if (closeTimer) clearTimeout(closeTimer);
|
|
218
|
+
closeTimer = setTimeout(() => {
|
|
219
|
+
open.value = false;
|
|
220
|
+
closeTimer = void 0;
|
|
221
|
+
}, CLOSE_DELAY_MS);
|
|
222
|
+
}
|
|
223
|
+
function onPointerEnter() {
|
|
224
|
+
isPointerInteraction.value = true;
|
|
225
|
+
show();
|
|
226
|
+
}
|
|
227
|
+
function onPointerLeave() {
|
|
228
|
+
isPointerInteraction.value = false;
|
|
229
|
+
scheduleHide();
|
|
230
|
+
}
|
|
231
|
+
function onOpenAutoFocus(event) {
|
|
232
|
+
if (isPointerInteraction.value) event.preventDefault();
|
|
233
|
+
}
|
|
234
|
+
function onContentFocusOut(event) {
|
|
235
|
+
const nextTarget = event.relatedTarget;
|
|
236
|
+
const content = event.currentTarget;
|
|
237
|
+
if (!nextTarget || !content.contains(nextTarget)) {
|
|
238
|
+
scheduleHide();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
onBeforeUnmount(() => {
|
|
242
|
+
if (closeTimer) clearTimeout(closeTimer);
|
|
243
|
+
});
|
|
244
|
+
return (_ctx, _cache) => {
|
|
245
|
+
return openBlock(), createBlock(unref(UiPopover), {
|
|
246
|
+
open: open.value,
|
|
247
|
+
"onUpdate:open": _cache[1] || (_cache[1] = ($event) => open.value = $event)
|
|
248
|
+
}, {
|
|
249
|
+
default: withCtx(() => [
|
|
250
|
+
createVNode(unref(UiPopoverTrigger), { "as-child": "" }, {
|
|
251
|
+
default: withCtx(() => [
|
|
252
|
+
createElementVNode("button", {
|
|
253
|
+
type: "button",
|
|
254
|
+
"aria-label": triggerLabel.value,
|
|
255
|
+
class: normalizeClass([
|
|
256
|
+
"ck-citation mx-px inline-flex h-5 min-w-5 select-none items-center justify-center rounded-sm px-1 align-middle text-sm leading-4 tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
257
|
+
__props.selected ? "bg-background-accent-soft text-black" : "bg-background-accent-yellow text-background-status-warning"
|
|
258
|
+
]),
|
|
259
|
+
onMouseenter: onPointerEnter,
|
|
260
|
+
onMouseleave: onPointerLeave
|
|
261
|
+
}, toDisplayString(__props.index), 43, _hoisted_1$c)
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
}),
|
|
265
|
+
createVNode(unref(UiPopoverContent), {
|
|
266
|
+
align: "start",
|
|
267
|
+
"side-offset": 8,
|
|
268
|
+
class: "w-auto border-0 bg-transparent p-0 shadow-none",
|
|
269
|
+
onOpenAutoFocus,
|
|
270
|
+
onMouseenter: onPointerEnter,
|
|
271
|
+
onMouseleave: onPointerLeave,
|
|
272
|
+
onFocusin: show,
|
|
273
|
+
onFocusout: onContentFocusOut
|
|
274
|
+
}, {
|
|
275
|
+
default: withCtx(() => [
|
|
276
|
+
createVNode(unref(_sfc_main$o), {
|
|
277
|
+
"file-name": __props.fileName,
|
|
278
|
+
snippet: __props.snippet,
|
|
279
|
+
"location-label": __props.locationLabel,
|
|
280
|
+
url: __props.url,
|
|
281
|
+
"open-source-label": __props.openSourceLabel,
|
|
282
|
+
onOpenSource: _cache[0] || (_cache[0] = (u) => emit("open-source", u))
|
|
283
|
+
}, null, 8, ["file-name", "snippet", "location-label", "url", "open-source-label"])
|
|
284
|
+
]),
|
|
285
|
+
_: 1
|
|
286
|
+
})
|
|
287
|
+
]),
|
|
288
|
+
_: 1
|
|
289
|
+
}, 8, ["open"]);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
const _export_sfc = (sfc, props) => {
|
|
294
|
+
const target = sfc.__vccOpts || sfc;
|
|
295
|
+
for (const [key, val] of props) {
|
|
296
|
+
target[key] = val;
|
|
297
|
+
}
|
|
298
|
+
return target;
|
|
299
|
+
};
|
|
300
|
+
const CkCitation = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-0d83c5f8"]]);
|
|
113
301
|
const _hoisted_1$b = ["data-message-row"];
|
|
114
302
|
const _hoisted_2$7 = {
|
|
115
303
|
key: 0,
|
|
@@ -119,7 +307,7 @@ const _hoisted_3$6 = {
|
|
|
119
307
|
key: 1,
|
|
120
308
|
class: "flex min-w-0 justify-start"
|
|
121
309
|
};
|
|
122
|
-
const _sfc_main$
|
|
310
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
123
311
|
...{ name: "CkConversationLayout" },
|
|
124
312
|
__name: "CkConversationLayout",
|
|
125
313
|
props: {
|
|
@@ -276,11 +464,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
276
464
|
};
|
|
277
465
|
}
|
|
278
466
|
});
|
|
279
|
-
const _sfc_main$
|
|
467
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
280
468
|
...{
|
|
281
|
-
name: "
|
|
469
|
+
name: "CkMessageButton"
|
|
282
470
|
},
|
|
283
|
-
__name: "
|
|
471
|
+
__name: "CkMessageButton",
|
|
284
472
|
props: {
|
|
285
473
|
ariaLabel: {},
|
|
286
474
|
disabled: { type: Boolean, default: false }
|
|
@@ -304,11 +492,11 @@ const _hoisted_1$a = {
|
|
|
304
492
|
class: "sr-only",
|
|
305
493
|
"aria-live": "polite"
|
|
306
494
|
};
|
|
307
|
-
const _sfc_main$
|
|
495
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
308
496
|
...{
|
|
309
|
-
name: "
|
|
497
|
+
name: "CkCopyMessageButton"
|
|
310
498
|
},
|
|
311
|
-
__name: "
|
|
499
|
+
__name: "CkCopyMessageButton",
|
|
312
500
|
props: {
|
|
313
501
|
text: {},
|
|
314
502
|
disabled: { type: Boolean, default: false },
|
|
@@ -361,7 +549,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
361
549
|
"delay-duration": 0
|
|
362
550
|
}, {
|
|
363
551
|
default: withCtx(() => [
|
|
364
|
-
createVNode(unref(_sfc_main$
|
|
552
|
+
createVNode(unref(_sfc_main$l), mergeProps({ ariaLabel: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy }, {
|
|
365
553
|
disabled: __props.disabled,
|
|
366
554
|
onClick: handleClick
|
|
367
555
|
}), {
|
|
@@ -395,14 +583,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
395
583
|
};
|
|
396
584
|
}
|
|
397
585
|
});
|
|
398
|
-
const
|
|
399
|
-
const target = sfc.__vccOpts || sfc;
|
|
400
|
-
for (const [key, val] of props) {
|
|
401
|
-
target[key] = val;
|
|
402
|
-
}
|
|
403
|
-
return target;
|
|
404
|
-
};
|
|
405
|
-
const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-f77a1193"]]);
|
|
586
|
+
const CkCopyMessageButton = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-ba2e5f32"]]);
|
|
406
587
|
const _hoisted_1$9 = {
|
|
407
588
|
width: "208",
|
|
408
589
|
height: "144",
|
|
@@ -412,7 +593,7 @@ const _hoisted_1$9 = {
|
|
|
412
593
|
"aria-hidden": "true",
|
|
413
594
|
focusable: "false"
|
|
414
595
|
};
|
|
415
|
-
const _sfc_main$
|
|
596
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
416
597
|
...{ name: "CkDropZoneIllustration" },
|
|
417
598
|
__name: "CkDropZoneIllustration",
|
|
418
599
|
setup(__props) {
|
|
@@ -437,7 +618,7 @@ const _hoisted_6$2 = {
|
|
|
437
618
|
class: "pointer-events-none fixed bottom-6 left-1/2 z-50 max-w-[36rem] -translate-x-1/2 flex list-inside list-disc flex-col gap-1 rounded-md border border-border-surface-default bg-background-surface-default p-3 text-sm text-content-on-surface-secondary",
|
|
438
619
|
role: "alert"
|
|
439
620
|
};
|
|
440
|
-
const _sfc_main$
|
|
621
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
441
622
|
...{
|
|
442
623
|
name: "CkDropZoneOverlay"
|
|
443
624
|
},
|
|
@@ -600,7 +781,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
600
781
|
}, [
|
|
601
782
|
createElementVNode("div", _hoisted_2$6, [
|
|
602
783
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
603
|
-
createVNode(_sfc_main$
|
|
784
|
+
createVNode(_sfc_main$j, { class: "h-36 w-52" }),
|
|
604
785
|
createElementVNode("div", _hoisted_3$5, [
|
|
605
786
|
createElementVNode("p", _hoisted_4$5, toDisplayString(resolvedHeading.value), 1),
|
|
606
787
|
__props.hint ? (openBlock(), createElementBlock("p", _hoisted_5$3, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
|
|
@@ -625,9 +806,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
625
806
|
};
|
|
626
807
|
}
|
|
627
808
|
});
|
|
628
|
-
const CkDropZoneOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
809
|
+
const CkDropZoneOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__scopeId", "data-v-54119668"]]);
|
|
629
810
|
const _hoisted_1$7 = ["aria-label"];
|
|
630
|
-
const _sfc_main$
|
|
811
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
631
812
|
...{
|
|
632
813
|
name: "CkFeedbackButton"
|
|
633
814
|
},
|
|
@@ -682,7 +863,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
682
863
|
"delay-duration": 0
|
|
683
864
|
}, {
|
|
684
865
|
default: withCtx(() => [
|
|
685
|
-
createVNode(unref(_sfc_main$
|
|
866
|
+
createVNode(unref(_sfc_main$l), mergeProps({ ariaLabel: thumbsUpLabel.value }, {
|
|
686
867
|
"aria-pressed": isUpSelected.value,
|
|
687
868
|
"aria-disabled": __props.locked || void 0,
|
|
688
869
|
disabled: isUpDisabled.value,
|
|
@@ -712,7 +893,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
712
893
|
"delay-duration": 0
|
|
713
894
|
}, {
|
|
714
895
|
default: withCtx(() => [
|
|
715
|
-
createVNode(unref(_sfc_main$
|
|
896
|
+
createVNode(unref(_sfc_main$l), mergeProps({ ariaLabel: thumbsDownLabel.value }, {
|
|
716
897
|
"aria-pressed": isDownSelected.value,
|
|
717
898
|
"aria-disabled": __props.locked || void 0,
|
|
718
899
|
disabled: isDownDisabled.value,
|
|
@@ -739,7 +920,29 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
739
920
|
};
|
|
740
921
|
}
|
|
741
922
|
});
|
|
742
|
-
const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
923
|
+
const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-cf3d46b6"]]);
|
|
924
|
+
function useCitationRendering(citations, onOpenSource) {
|
|
925
|
+
const sourcesByIndex = computed(
|
|
926
|
+
() => new Map(
|
|
927
|
+
(toValue(citations) ?? []).map((source) => [source.index, source])
|
|
928
|
+
)
|
|
929
|
+
);
|
|
930
|
+
const citationPlugins = computed(() => {
|
|
931
|
+
const list = toValue(citations);
|
|
932
|
+
if (!list?.length) return [];
|
|
933
|
+
const indices = new Set(list.map((source) => source.index));
|
|
934
|
+
return [[remarkCitations, { indices }]];
|
|
935
|
+
});
|
|
936
|
+
function renderCitationNode(el, slot) {
|
|
937
|
+
if (!el.hasAttribute("data-citation-index")) return null;
|
|
938
|
+
const index = Number(el.getAttribute("data-citation-index"));
|
|
939
|
+
const source = sourcesByIndex.value.get(index);
|
|
940
|
+
if (!source) return null;
|
|
941
|
+
if (slot) return slot({ source, openSource: onOpenSource });
|
|
942
|
+
return h(CkCitation, { ...source, onOpenSource });
|
|
943
|
+
}
|
|
944
|
+
return { citationPlugins, renderCitationNode };
|
|
945
|
+
}
|
|
743
946
|
const defaultMarkdownClasses = {
|
|
744
947
|
p: "my-1 leading-7",
|
|
745
948
|
a: "underline underline-offset-4",
|
|
@@ -759,25 +962,29 @@ const defaultMarkdownClasses = {
|
|
|
759
962
|
hr: "my-4"
|
|
760
963
|
};
|
|
761
964
|
const TABLE_WRAPPER_CLASS = "max-w-full overflow-x-auto";
|
|
762
|
-
function
|
|
965
|
+
function renderCodeBlock(el, ctx) {
|
|
966
|
+
if (el.tagName !== "PRE" || el.firstElementChild?.tagName !== "CODE") {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
if (!ctx.slots["code-block"]) return null;
|
|
970
|
+
const codeEl = el.firstElementChild;
|
|
971
|
+
const language = codeEl.className?.match(/language-(\S+)/)?.[1] ?? "";
|
|
972
|
+
const code = codeEl.textContent ?? "";
|
|
973
|
+
return ctx.slots["code-block"]({ code, language });
|
|
974
|
+
}
|
|
975
|
+
function domToVNode(node, ctx) {
|
|
763
976
|
if (node.nodeType === Node.TEXT_NODE) return node.textContent;
|
|
764
977
|
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
765
978
|
const el = node;
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
const code = codeEl.textContent ?? "";
|
|
770
|
-
if (slots["code-block"]) {
|
|
771
|
-
return slots["code-block"]({ code, language });
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
const children = Array.from(node.childNodes).map((child) => domToVNode(child, slots, classes, tableLabel)).filter((c) => c != null);
|
|
979
|
+
const special = renderCodeBlock(el, ctx) ?? ctx.renderCitation(el);
|
|
980
|
+
if (special != null) return special;
|
|
981
|
+
const children = Array.from(node.childNodes).map((child) => domToVNode(child, ctx)).filter((c) => c != null);
|
|
775
982
|
const attrs = {};
|
|
776
983
|
for (const attr of el.attributes) {
|
|
777
984
|
attrs[attr.name] = attr.value;
|
|
778
985
|
}
|
|
779
986
|
const tag = el.tagName.toLowerCase();
|
|
780
|
-
const customClass = classes[tag];
|
|
987
|
+
const customClass = ctx.classes[tag];
|
|
781
988
|
if (customClass) {
|
|
782
989
|
attrs.class = attrs.class ? `${attrs.class} ${customClass}` : customClass;
|
|
783
990
|
}
|
|
@@ -789,14 +996,14 @@ function domToVNode(node, slots, classes, tableLabel) {
|
|
|
789
996
|
class: TABLE_WRAPPER_CLASS,
|
|
790
997
|
tabindex: "0",
|
|
791
998
|
role: "region",
|
|
792
|
-
"aria-label": tableLabel
|
|
999
|
+
"aria-label": ctx.tableLabel
|
|
793
1000
|
},
|
|
794
1001
|
[vnode]
|
|
795
1002
|
);
|
|
796
1003
|
}
|
|
797
1004
|
return vnode;
|
|
798
1005
|
}
|
|
799
|
-
const _sfc_main$
|
|
1006
|
+
const _sfc_main$g = defineComponent({
|
|
800
1007
|
name: "CkMarkdownRenderer",
|
|
801
1008
|
props: {
|
|
802
1009
|
content: { type: String, required: true },
|
|
@@ -804,12 +1011,30 @@ const _sfc_main$f = defineComponent({
|
|
|
804
1011
|
type: Object,
|
|
805
1012
|
default: () => ({})
|
|
806
1013
|
},
|
|
807
|
-
plugins: { type: Array, default: void 0 }
|
|
1014
|
+
plugins: { type: Array, default: void 0 },
|
|
1015
|
+
citations: {
|
|
1016
|
+
type: Array,
|
|
1017
|
+
default: void 0
|
|
1018
|
+
}
|
|
1019
|
+
},
|
|
1020
|
+
emits: {
|
|
1021
|
+
"open-source": (url) => typeof url === "string"
|
|
808
1022
|
},
|
|
809
|
-
setup(props, { slots }) {
|
|
810
|
-
const { content
|
|
811
|
-
const { html } = useMarkdownParser(content, plugins);
|
|
1023
|
+
setup(props, { slots, emit }) {
|
|
1024
|
+
const { content } = toRefs(props);
|
|
812
1025
|
const labels = useChatKitLabels();
|
|
1026
|
+
function handleOpenSource(url) {
|
|
1027
|
+
emit("open-source", url);
|
|
1028
|
+
}
|
|
1029
|
+
const { citationPlugins, renderCitationNode } = useCitationRendering(
|
|
1030
|
+
() => props.citations,
|
|
1031
|
+
handleOpenSource
|
|
1032
|
+
);
|
|
1033
|
+
const effectivePlugins = computed(() => [
|
|
1034
|
+
...props.plugins ?? [],
|
|
1035
|
+
...citationPlugins.value
|
|
1036
|
+
]);
|
|
1037
|
+
const { html } = useMarkdownParser(content, effectivePlugins);
|
|
813
1038
|
const parsedNodes = computed(() => {
|
|
814
1039
|
const raw = html.value;
|
|
815
1040
|
if (!raw) return [];
|
|
@@ -821,9 +1046,13 @@ const _sfc_main$f = defineComponent({
|
|
|
821
1046
|
...props.classes
|
|
822
1047
|
}));
|
|
823
1048
|
return () => {
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
|
|
1049
|
+
const ctx = {
|
|
1050
|
+
slots,
|
|
1051
|
+
classes: mergedClasses.value,
|
|
1052
|
+
tableLabel: labels.value.markdownTableLabel ?? defaultChatKitLabels.markdownTableLabel,
|
|
1053
|
+
renderCitation: (el) => renderCitationNode(el, slots.citation)
|
|
1054
|
+
};
|
|
1055
|
+
const children = parsedNodes.value.map((node) => domToVNode(node, ctx)).filter((c) => c != null);
|
|
827
1056
|
return h(
|
|
828
1057
|
"div",
|
|
829
1058
|
{ class: "markdown-renderer min-w-0 break-words" },
|
|
@@ -842,7 +1071,7 @@ const _hoisted_4$4 = {
|
|
|
842
1071
|
class: "self-end text-sm text-content-on-surface-muted tabular-nums",
|
|
843
1072
|
"aria-live": "polite"
|
|
844
1073
|
};
|
|
845
|
-
const _sfc_main$
|
|
1074
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
846
1075
|
...{
|
|
847
1076
|
name: "CkFeedbackDialog"
|
|
848
1077
|
},
|
|
@@ -1003,7 +1232,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
1003
1232
|
_: 1
|
|
1004
1233
|
}),
|
|
1005
1234
|
createElementVNode("div", _hoisted_2$5, [
|
|
1006
|
-
createVNode(unref(_sfc_main$
|
|
1235
|
+
createVNode(unref(_sfc_main$g), { content: __props.responseText }, null, 8, ["content"])
|
|
1007
1236
|
])
|
|
1008
1237
|
])) : createCommentVNode("", true),
|
|
1009
1238
|
createElementVNode("section", _hoisted_3$4, [
|
|
@@ -1069,8 +1298,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
1069
1298
|
};
|
|
1070
1299
|
}
|
|
1071
1300
|
});
|
|
1072
|
-
const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1073
|
-
const _sfc_main$
|
|
1301
|
+
const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-12dfee8a"]]);
|
|
1302
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
1074
1303
|
...{
|
|
1075
1304
|
name: "CkFileItemRow",
|
|
1076
1305
|
inheritAttrs: false
|
|
@@ -1130,7 +1359,7 @@ const _hoisted_6$1 = {
|
|
|
1130
1359
|
};
|
|
1131
1360
|
const _hoisted_7$1 = ["aria-label"];
|
|
1132
1361
|
const _hoisted_8$1 = ["onClick"];
|
|
1133
|
-
const _sfc_main$
|
|
1362
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1134
1363
|
...{
|
|
1135
1364
|
name: "CkFileItemsList"
|
|
1136
1365
|
},
|
|
@@ -1219,7 +1448,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1219
1448
|
class: "min-w-0 max-w-64 flex-1 basis-0",
|
|
1220
1449
|
onClick: ($event) => handleRowClick(file, $event)
|
|
1221
1450
|
}, [
|
|
1222
|
-
createVNode(_sfc_main$
|
|
1451
|
+
createVNode(_sfc_main$e, {
|
|
1223
1452
|
file,
|
|
1224
1453
|
size: __props.size,
|
|
1225
1454
|
"is-removable": __props.isRemovable,
|
|
@@ -1298,7 +1527,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1298
1527
|
class: "min-w-0 max-w-64",
|
|
1299
1528
|
onClick: ($event) => handleRowClick(file, $event)
|
|
1300
1529
|
}, [
|
|
1301
|
-
createVNode(_sfc_main$
|
|
1530
|
+
createVNode(_sfc_main$e, {
|
|
1302
1531
|
file,
|
|
1303
1532
|
size: __props.size,
|
|
1304
1533
|
"is-removable": __props.isRemovable,
|
|
@@ -1346,7 +1575,7 @@ const _hoisted_7 = {
|
|
|
1346
1575
|
const _hoisted_8 = ["aria-label"];
|
|
1347
1576
|
const _hoisted_9 = ["aria-label"];
|
|
1348
1577
|
const _hoisted_10 = ["aria-label"];
|
|
1349
|
-
const _sfc_main$
|
|
1578
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1350
1579
|
...{
|
|
1351
1580
|
name: "CkHistoryItem",
|
|
1352
1581
|
inheritAttrs: false
|
|
@@ -1587,7 +1816,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1587
1816
|
}
|
|
1588
1817
|
});
|
|
1589
1818
|
const baseClass = "flex w-full min-w-0 flex-col p-2";
|
|
1590
|
-
const _sfc_main$
|
|
1819
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1591
1820
|
...{
|
|
1592
1821
|
name: "CkHistoryWrapper",
|
|
1593
1822
|
inheritAttrs: false
|
|
@@ -1622,7 +1851,7 @@ const _hoisted_2$2 = { class: "min-w-0 max-w-[10rem] truncate" };
|
|
|
1622
1851
|
const _hoisted_3$1 = ["aria-label"];
|
|
1623
1852
|
const _hoisted_4$1 = ["aria-selected", "onClick"];
|
|
1624
1853
|
const _hoisted_5 = { class: "min-w-0 flex-1 truncate" };
|
|
1625
|
-
const _sfc_main$
|
|
1854
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1626
1855
|
...{ name: "CkModelSelector" },
|
|
1627
1856
|
__name: "CkModelSelector",
|
|
1628
1857
|
props: {
|
|
@@ -1730,7 +1959,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
1730
1959
|
};
|
|
1731
1960
|
}
|
|
1732
1961
|
});
|
|
1733
|
-
const _sfc_main$
|
|
1962
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1734
1963
|
...{ name: "CkPromptSendButton" },
|
|
1735
1964
|
__name: "CkPromptSendButton",
|
|
1736
1965
|
props: {
|
|
@@ -1756,7 +1985,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1756
1985
|
};
|
|
1757
1986
|
}
|
|
1758
1987
|
});
|
|
1759
|
-
const _sfc_main$
|
|
1988
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1760
1989
|
...{ name: "CkPromptMenuButton" },
|
|
1761
1990
|
__name: "CkPromptMenuButton",
|
|
1762
1991
|
props: {
|
|
@@ -1786,7 +2015,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1786
2015
|
};
|
|
1787
2016
|
}
|
|
1788
2017
|
});
|
|
1789
|
-
const _sfc_main$
|
|
2018
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1790
2019
|
...{ name: "CkPromptStopButton" },
|
|
1791
2020
|
__name: "CkPromptStopButton",
|
|
1792
2021
|
props: {
|
|
@@ -1821,7 +2050,7 @@ const _hoisted_3 = ["for"];
|
|
|
1821
2050
|
const _hoisted_4 = ["id", "value", "placeholder", "disabled"];
|
|
1822
2051
|
const LINE_HEIGHT = 24;
|
|
1823
2052
|
const MAX_LINES = 6;
|
|
1824
|
-
const _sfc_main$
|
|
2053
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1825
2054
|
...{ name: "CkPromptInput" },
|
|
1826
2055
|
__name: "CkPromptInput",
|
|
1827
2056
|
props: {
|
|
@@ -1954,12 +2183,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1954
2183
|
};
|
|
1955
2184
|
}
|
|
1956
2185
|
});
|
|
1957
|
-
const CkPromptInput = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
2186
|
+
const CkPromptInput = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-92b05731"]]);
|
|
1958
2187
|
const _hoisted_1$1 = {
|
|
1959
2188
|
key: 0,
|
|
1960
2189
|
class: "text-core-content-tertiary text-center text-xs leading-3.5"
|
|
1961
2190
|
};
|
|
1962
|
-
const _sfc_main$
|
|
2191
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1963
2192
|
...{ name: "CkPromptInputDisclaimer" },
|
|
1964
2193
|
__name: "CkPromptInputDisclaimer",
|
|
1965
2194
|
props: {
|
|
@@ -1975,6 +2204,52 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1975
2204
|
};
|
|
1976
2205
|
}
|
|
1977
2206
|
});
|
|
2207
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2208
|
+
...{
|
|
2209
|
+
name: "CkRegenerateMessageButton"
|
|
2210
|
+
},
|
|
2211
|
+
__name: "CkRegenerateMessageButton",
|
|
2212
|
+
props: {
|
|
2213
|
+
disabled: { type: Boolean, default: false },
|
|
2214
|
+
ariaLabel: { default: "Regenerate response" }
|
|
2215
|
+
},
|
|
2216
|
+
emits: ["regenerate"],
|
|
2217
|
+
setup(__props, { emit: __emit }) {
|
|
2218
|
+
const props = __props;
|
|
2219
|
+
const emit = __emit;
|
|
2220
|
+
function handleClick() {
|
|
2221
|
+
if (props.disabled) {
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
emit("regenerate");
|
|
2225
|
+
}
|
|
2226
|
+
return (_ctx, _cache) => {
|
|
2227
|
+
return openBlock(), createBlock(unref(UiTooltip), {
|
|
2228
|
+
content: __props.ariaLabel,
|
|
2229
|
+
side: "bottom",
|
|
2230
|
+
align: "center",
|
|
2231
|
+
"delay-duration": 0
|
|
2232
|
+
}, {
|
|
2233
|
+
default: withCtx(() => [
|
|
2234
|
+
createVNode(unref(_sfc_main$l), mergeProps({ ariaLabel: __props.ariaLabel }, {
|
|
2235
|
+
disabled: __props.disabled,
|
|
2236
|
+
onClick: handleClick
|
|
2237
|
+
}), {
|
|
2238
|
+
default: withCtx(() => [
|
|
2239
|
+
createVNode(unref(UiIcon), {
|
|
2240
|
+
name: "repeat",
|
|
2241
|
+
size: 16,
|
|
2242
|
+
"aria-hidden": "true"
|
|
2243
|
+
})
|
|
2244
|
+
]),
|
|
2245
|
+
_: 1
|
|
2246
|
+
}, 16, ["disabled"])
|
|
2247
|
+
]),
|
|
2248
|
+
_: 1
|
|
2249
|
+
}, 8, ["content"]);
|
|
2250
|
+
};
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
1978
2253
|
const _hoisted_1 = { class: "inline-flex max-w-[536px] flex-col items-end justify-start gap-1" };
|
|
1979
2254
|
const _hoisted_2 = ["aria-expanded"];
|
|
1980
2255
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
@@ -2069,7 +2344,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2069
2344
|
return message.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|
|
2070
2345
|
}
|
|
2071
2346
|
return (_ctx, _cache) => {
|
|
2072
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2347
|
+
return openBlock(), createBlock(_sfc_main$m, { messages: __props.messages }, {
|
|
2073
2348
|
"user-message": withCtx(({ message }) => [
|
|
2074
2349
|
createElementVNode("div", {
|
|
2075
2350
|
class: normalizeClass({ "ml-8": hasIcon.value })
|
|
@@ -2088,10 +2363,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2088
2363
|
]),
|
|
2089
2364
|
"agent-message": withCtx(({ message }) => [
|
|
2090
2365
|
renderSlot(_ctx.$slots, "agent-message", { message }, () => [
|
|
2091
|
-
createVNode(_sfc_main$
|
|
2366
|
+
createVNode(_sfc_main$p, null, createSlots({
|
|
2092
2367
|
footer: withCtx(() => [
|
|
2093
2368
|
renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
|
|
2094
|
-
getMessageText(message) && !isLoading(message) ? (openBlock(), createBlock(
|
|
2369
|
+
getMessageText(message) && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageButton, {
|
|
2095
2370
|
key: 0,
|
|
2096
2371
|
text: getMessageText(message),
|
|
2097
2372
|
"aria-label-copy": unref(labels).copyMessageAction,
|
|
@@ -2101,7 +2376,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2101
2376
|
]),
|
|
2102
2377
|
default: withCtx(() => [
|
|
2103
2378
|
renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
|
|
2104
|
-
createVNode(_sfc_main$
|
|
2379
|
+
createVNode(_sfc_main$g, {
|
|
2105
2380
|
content: getMessageText(message),
|
|
2106
2381
|
classes: __props.agentMarkdownClasses
|
|
2107
2382
|
}, createSlots({ _: 2 }, [
|
|
@@ -2227,7 +2502,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2227
2502
|
}
|
|
2228
2503
|
return (_ctx, _cache) => {
|
|
2229
2504
|
return openBlock(), createElementBlock("div", null, [
|
|
2230
|
-
createVNode(_sfc_main$
|
|
2505
|
+
createVNode(_sfc_main$b, {
|
|
2231
2506
|
class: normalizeClass(isExpanded.value && props.maxHeight ? "overflow-y-auto" : void 0),
|
|
2232
2507
|
style: normalizeStyle(
|
|
2233
2508
|
isExpanded.value && props.maxHeight ? { maxHeight: props.maxHeight } : void 0
|
|
@@ -2246,7 +2521,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2246
2521
|
edit: () => emit("edit", conversation),
|
|
2247
2522
|
delete: () => emit("delete", conversation)
|
|
2248
2523
|
}, () => [
|
|
2249
|
-
createVNode(_sfc_main$
|
|
2524
|
+
createVNode(_sfc_main$c, {
|
|
2250
2525
|
as: "a",
|
|
2251
2526
|
href: hrefFor(conversation),
|
|
2252
2527
|
"is-active": conversation.id === props.activeId,
|
|
@@ -2359,7 +2634,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2359
2634
|
}, createSlots({
|
|
2360
2635
|
"toolbar-right": withCtx((scope) => [
|
|
2361
2636
|
renderSlot(_ctx.$slots, "toolbar-right", normalizeProps(guardReactiveProps(scope)), () => [
|
|
2362
|
-
__props.loading ? (openBlock(), createBlock(_sfc_main$
|
|
2637
|
+
__props.loading ? (openBlock(), createBlock(_sfc_main$7, {
|
|
2363
2638
|
key: 0,
|
|
2364
2639
|
"aria-label": __props.stopAriaLabel,
|
|
2365
2640
|
disabled: __props.disabled,
|
|
@@ -2367,17 +2642,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2367
2642
|
}, {
|
|
2368
2643
|
default: withCtx(() => [
|
|
2369
2644
|
renderSlot(_ctx.$slots, "stop-icon", {}, () => [
|
|
2370
|
-
createVNode(_sfc_main$
|
|
2645
|
+
createVNode(_sfc_main$q)
|
|
2371
2646
|
])
|
|
2372
2647
|
]),
|
|
2373
2648
|
_: 3
|
|
2374
|
-
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$
|
|
2649
|
+
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$9, mergeProps({ key: 1 }, { ariaLabel: "Send message" }, {
|
|
2375
2650
|
type: "submit",
|
|
2376
2651
|
disabled: scope.disabled
|
|
2377
2652
|
}), {
|
|
2378
2653
|
default: withCtx(() => [
|
|
2379
2654
|
renderSlot(_ctx.$slots, "send-icon", {}, () => [
|
|
2380
|
-
createVNode(_sfc_main$
|
|
2655
|
+
createVNode(_sfc_main$r)
|
|
2381
2656
|
])
|
|
2382
2657
|
]),
|
|
2383
2658
|
_: 3
|
|
@@ -2386,7 +2661,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2386
2661
|
]),
|
|
2387
2662
|
footer: withCtx(() => [
|
|
2388
2663
|
renderSlot(_ctx.$slots, "footer", {}, () => [
|
|
2389
|
-
__props.disclaimer ? (openBlock(), createBlock(_sfc_main$
|
|
2664
|
+
__props.disclaimer ? (openBlock(), createBlock(_sfc_main$5, {
|
|
2390
2665
|
key: 0,
|
|
2391
2666
|
text: __props.disclaimer
|
|
2392
2667
|
}, null, 8, ["text"])) : createCommentVNode("", true)
|
|
@@ -2413,28 +2688,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2413
2688
|
}
|
|
2414
2689
|
});
|
|
2415
2690
|
export {
|
|
2416
|
-
|
|
2417
|
-
_sfc_main$
|
|
2418
|
-
_sfc_main$
|
|
2419
|
-
_sfc_main$
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
_sfc_main$
|
|
2426
|
-
_sfc_main$
|
|
2427
|
-
_sfc_main as j,
|
|
2428
|
-
_sfc_main$
|
|
2429
|
-
_sfc_main
|
|
2430
|
-
_sfc_main$
|
|
2431
|
-
|
|
2432
|
-
_sfc_main$
|
|
2433
|
-
|
|
2434
|
-
_sfc_main$
|
|
2435
|
-
_sfc_main$
|
|
2436
|
-
_sfc_main$
|
|
2437
|
-
_sfc_main$
|
|
2438
|
-
|
|
2439
|
-
|
|
2691
|
+
CkCitation as C,
|
|
2692
|
+
_sfc_main$p as _,
|
|
2693
|
+
_sfc_main$o as a,
|
|
2694
|
+
_sfc_main$2 as b,
|
|
2695
|
+
_sfc_main$m as c,
|
|
2696
|
+
CkCopyMessageButton as d,
|
|
2697
|
+
CkDropZoneOverlay as e,
|
|
2698
|
+
CkFeedbackButton as f,
|
|
2699
|
+
CkFeedbackDialog as g,
|
|
2700
|
+
_sfc_main$d as h,
|
|
2701
|
+
_sfc_main$1 as i,
|
|
2702
|
+
_sfc_main$c as j,
|
|
2703
|
+
_sfc_main$b as k,
|
|
2704
|
+
_sfc_main as l,
|
|
2705
|
+
_sfc_main$g as m,
|
|
2706
|
+
_sfc_main$l as n,
|
|
2707
|
+
_sfc_main$a as o,
|
|
2708
|
+
CkPromptInput as p,
|
|
2709
|
+
_sfc_main$5 as q,
|
|
2710
|
+
_sfc_main$8 as r,
|
|
2711
|
+
_sfc_main$9 as s,
|
|
2712
|
+
_sfc_main$7 as t,
|
|
2713
|
+
_sfc_main$4 as u,
|
|
2714
|
+
_sfc_main$r as v,
|
|
2715
|
+
_sfc_main$q as w,
|
|
2716
|
+
CkUserMessage as x,
|
|
2717
|
+
formatRelativeTime as y
|
|
2440
2718
|
};
|