@aleph-alpha/chat-kit 2.2.0 → 3.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-CjfKRuZs.js → CkInput.vue_vue_type_script_setup_true_lang-CwH5M5WD.js} +263 -142
- package/dist/chat-kit.css +33 -6
- package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts.map +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts +7 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts.map +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -0
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts.map +1 -1
- package/dist/components/base/CkFileItemsList/types.d.ts +9 -0
- package/dist/components/base/CkFileItemsList/types.d.ts.map +1 -1
- package/dist/components/base/CkModelSelector/types.d.ts +1 -1
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts +48 -5
- package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts +7 -6
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/types.d.ts +11 -12
- package/dist/components/base/CkPromptInput/types.d.ts.map +1 -1
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts +18 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts +18 -0
- package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/index.d.ts +3 -0
- package/dist/components/base/CkPromptMenuButton/index.d.ts.map +1 -0
- package/dist/components/base/CkPromptMenuButton/types.d.ts +30 -0
- package/dist/components/base/CkPromptMenuButton/types.d.ts.map +1 -0
- package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.stories.d.ts → CkPromptSendButton/CkPromptSendButton.stories.d.ts} +5 -5
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.vue.d.ts → CkPromptSendButton/CkPromptSendButton.vue.d.ts} +3 -3
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/index.d.ts +3 -0
- package/dist/components/base/CkPromptSendButton/index.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/types.d.ts +34 -0
- package/dist/components/base/CkPromptSendButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +1 -1
- package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptStopButton/types.d.ts +6 -4
- package/dist/components/base/CkPromptStopButton/types.d.ts.map +1 -1
- package/dist/components/base/icons/CkSendIcon.vue.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -1
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/composed/CkHistory/CkHistory.vue.d.ts +1 -1
- package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +9 -8
- package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
- package/dist/components/composed/CkInput/types.d.ts +2 -7
- package/dist/components/composed/CkInput/types.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +9 -8
- package/dist/composables/fileUpload/types.d.ts +1 -1
- package/dist/composables/fileUpload/types.d.ts.map +1 -1
- package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
- package/dist/composables/index.js +1 -1
- package/dist/{index-CfXEGjc7.js → index-THzZwfMU.js} +6 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/package.json +1 -1
- package/src/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue +2 -7
- package/src/components/base/CkFileItemsList/CkFileItemsList.spec.ts +67 -0
- package/src/components/base/CkFileItemsList/CkFileItemsList.stories.ts +48 -0
- package/src/components/base/CkFileItemsList/CkFileItemsList.vue +78 -4
- package/src/components/base/CkFileItemsList/types.ts +9 -0
- package/src/components/base/CkModelSelector/types.ts +1 -1
- package/src/components/base/CkPromptInput/CkPromptInput.spec.ts +206 -11
- package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +1068 -43
- package/src/components/base/CkPromptInput/CkPromptInput.vue +137 -28
- package/src/components/base/CkPromptInput/types.ts +11 -12
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.spec.ts +62 -0
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.ts +75 -0
- package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.vue +26 -0
- package/src/components/base/CkPromptMenuButton/index.ts +2 -0
- package/src/components/base/CkPromptMenuButton/types.ts +29 -0
- package/src/components/base/{CkPromptActionButton/CkPromptActionButton.spec.ts → CkPromptSendButton/CkPromptSendButton.spec.ts} +11 -11
- package/src/components/base/CkPromptSendButton/CkPromptSendButton.stories.ts +117 -0
- package/src/components/base/{CkPromptActionButton/CkPromptActionButton.vue → CkPromptSendButton/CkPromptSendButton.vue} +4 -4
- package/src/components/base/CkPromptSendButton/index.ts +2 -0
- package/src/components/base/CkPromptSendButton/types.ts +33 -0
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.spec.ts +5 -5
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts +1 -1
- package/src/components/base/CkPromptStopButton/CkPromptStopButton.vue +3 -2
- package/src/components/base/CkPromptStopButton/types.ts +6 -4
- package/src/components/base/icons/CkSendIcon.vue +3 -16
- package/src/components/base/icons/CkStopIcon.vue +1 -1
- package/src/components/base/index.ts +3 -1
- package/src/components/composed/CkInput/CkInput.stories.ts +0 -4
- package/src/components/composed/CkInput/CkInput.vue +7 -5
- package/src/components/composed/CkInput/types.ts +2 -7
- package/src/components/index.ts +3 -1
- package/src/composables/fileUpload/types.ts +1 -1
- package/src/composables/fileUpload/useFileUpload.spec.ts +26 -0
- package/src/composables/fileUpload/useFileUpload.ts +12 -3
- package/src/composables/fileUpload/useFileUploadWrapper.ts +1 -1
- package/src/index.ts +3 -1
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/index.d.ts +0 -3
- package/dist/components/base/CkPromptActionButton/index.d.ts.map +0 -1
- package/dist/components/base/CkPromptActionButton/types.d.ts +0 -33
- package/dist/components/base/CkPromptActionButton/types.d.ts.map +0 -1
- package/src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts +0 -126
- package/src/components/base/CkPromptActionButton/index.ts +0 -2
- package/src/components/base/CkPromptActionButton/types.ts +0 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle,
|
|
1
|
+
import { defineComponent, openBlock, createBlock, unref, createElementBlock, createElementVNode, renderSlot, createCommentVNode, ref, onMounted, nextTick, onUnmounted, watch, Fragment, renderList, normalizeStyle, mergeProps, withCtx, createVNode, Transition, toDisplayString, createStaticVNode, computed, onBeforeUnmount, Teleport, withModifiers, normalizeClass, toRefs, h, useId, createTextVNode, useAttrs, useSlots, resolveDynamicComponent, useTemplateRef, onUpdated, createSlots, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { UiIcon, UiButton, UiTooltip, formatFileSize, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiPopover, UiPopoverTrigger, UiFileType, UiProgress, UiPopoverContent, Primitive, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
|
|
2
3
|
import { u as useChatKitLabels, d as defaultChatKitLabels, a as useMarkdownParser } from "./useChatKitLabels-ZutacPad.js";
|
|
3
|
-
import { UiButton, UiTooltip, UiIcon, UiDialog, UiDialogContent, UiDialogDescription, UiFieldLabel, UiToggleGroup, UiToggleGroupItem, UiField, UiTextarea, UiFileItem, UiPopover, UiPopoverTrigger, UiFileType, UiPopoverContent, Primitive, UiAvatar, UiAvatarImage, UiSpinner, UiAvatarFallback, UiSidebarPopoverMenu, UiSidebarPopoverMenuItem } from "@aleph-alpha/ui-library";
|
|
4
4
|
const MINUTE = 60;
|
|
5
5
|
const HOUR = 60 * MINUTE;
|
|
6
6
|
const DAY = 24 * HOUR;
|
|
@@ -36,26 +36,12 @@ 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
|
|
40
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
-
width: "16",
|
|
42
|
-
height: "16",
|
|
43
|
-
viewBox: "0 0 24 24",
|
|
44
|
-
fill: "none",
|
|
45
|
-
stroke: "currentColor",
|
|
46
|
-
"stroke-width": "2",
|
|
47
|
-
"stroke-linecap": "round",
|
|
48
|
-
"stroke-linejoin": "round"
|
|
49
|
-
};
|
|
50
|
-
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
39
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
51
40
|
...{ name: "CkSendIcon" },
|
|
52
41
|
__name: "CkSendIcon",
|
|
53
42
|
setup(__props) {
|
|
54
43
|
return (_ctx, _cache) => {
|
|
55
|
-
return openBlock(),
|
|
56
|
-
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),
|
|
57
|
-
createElementVNode("path", { d: "M6 12h16" }, null, -1)
|
|
58
|
-
])]);
|
|
44
|
+
return openBlock(), createBlock(unref(UiIcon), { name: "arrow-up-right" });
|
|
59
45
|
};
|
|
60
46
|
}
|
|
61
47
|
});
|
|
@@ -66,7 +52,7 @@ const _hoisted_1$d = {
|
|
|
66
52
|
viewBox: "0 0 16 16",
|
|
67
53
|
fill: "none"
|
|
68
54
|
};
|
|
69
|
-
const _sfc_main$
|
|
55
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
70
56
|
...{ name: "CkStopIcon" },
|
|
71
57
|
__name: "CkStopIcon",
|
|
72
58
|
setup(__props) {
|
|
@@ -74,7 +60,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
74
60
|
return openBlock(), createElementBlock("svg", _hoisted_1$d, [..._cache[0] || (_cache[0] = [
|
|
75
61
|
createElementVNode("path", {
|
|
76
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",
|
|
77
|
-
fill: "
|
|
63
|
+
fill: "currentColor"
|
|
78
64
|
}, null, -1)
|
|
79
65
|
])]);
|
|
80
66
|
};
|
|
@@ -95,12 +81,12 @@ const _hoisted_4$6 = {
|
|
|
95
81
|
"data-testid": "ck-agent-message-header",
|
|
96
82
|
class: "body-14-regular text-content-on-surface-muted min-w-0 flex-1 [word-break:break-word]"
|
|
97
83
|
};
|
|
98
|
-
const _hoisted_5$
|
|
84
|
+
const _hoisted_5$4 = { class: "text-content-on-surface-primary text-base leading-7" };
|
|
99
85
|
const _hoisted_6$3 = {
|
|
100
86
|
key: 1,
|
|
101
87
|
class: "flex items-center gap-4"
|
|
102
88
|
};
|
|
103
|
-
const _sfc_main$
|
|
89
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
104
90
|
...{ name: "CkAgentMessage" },
|
|
105
91
|
__name: "CkAgentMessage",
|
|
106
92
|
setup(__props) {
|
|
@@ -114,7 +100,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
114
100
|
renderSlot(_ctx.$slots, "header")
|
|
115
101
|
])) : createCommentVNode("", true)
|
|
116
102
|
])) : createCommentVNode("", true),
|
|
117
|
-
createElementVNode("div", _hoisted_5$
|
|
103
|
+
createElementVNode("div", _hoisted_5$4, [
|
|
118
104
|
renderSlot(_ctx.$slots, "default")
|
|
119
105
|
]),
|
|
120
106
|
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$3, [
|
|
@@ -133,7 +119,7 @@ const _hoisted_3$6 = {
|
|
|
133
119
|
key: 1,
|
|
134
120
|
class: "flex justify-start"
|
|
135
121
|
};
|
|
136
|
-
const _sfc_main$
|
|
122
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
137
123
|
...{ name: "CkConversationLayout" },
|
|
138
124
|
__name: "CkConversationLayout",
|
|
139
125
|
props: {
|
|
@@ -289,7 +275,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
289
275
|
};
|
|
290
276
|
}
|
|
291
277
|
});
|
|
292
|
-
const _sfc_main$
|
|
278
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
293
279
|
...{
|
|
294
280
|
name: "CkMessageActionButton"
|
|
295
281
|
},
|
|
@@ -317,7 +303,7 @@ const _hoisted_1$a = {
|
|
|
317
303
|
class: "sr-only",
|
|
318
304
|
"aria-live": "polite"
|
|
319
305
|
};
|
|
320
|
-
const _sfc_main$
|
|
306
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
321
307
|
...{
|
|
322
308
|
name: "CkCopyMessageActionButton"
|
|
323
309
|
},
|
|
@@ -374,7 +360,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
374
360
|
"delay-duration": 0
|
|
375
361
|
}, {
|
|
376
362
|
default: withCtx(() => [
|
|
377
|
-
createVNode(unref(_sfc_main$
|
|
363
|
+
createVNode(unref(_sfc_main$k), mergeProps({ ariaLabel: copied.value ? __props.ariaLabelCopied : __props.ariaLabelCopy }, {
|
|
378
364
|
disabled: __props.disabled,
|
|
379
365
|
onClick: handleClick
|
|
380
366
|
}), {
|
|
@@ -415,7 +401,7 @@ const _export_sfc = (sfc, props) => {
|
|
|
415
401
|
}
|
|
416
402
|
return target;
|
|
417
403
|
};
|
|
418
|
-
const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
404
|
+
const CkCopyMessageActionButton = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-f77a1193"]]);
|
|
419
405
|
const _hoisted_1$9 = {
|
|
420
406
|
width: "208",
|
|
421
407
|
height: "144",
|
|
@@ -425,7 +411,7 @@ const _hoisted_1$9 = {
|
|
|
425
411
|
"aria-hidden": "true",
|
|
426
412
|
focusable: "false"
|
|
427
413
|
};
|
|
428
|
-
const _sfc_main$
|
|
414
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
429
415
|
...{ name: "CkDropZoneIllustration" },
|
|
430
416
|
__name: "CkDropZoneIllustration",
|
|
431
417
|
setup(__props) {
|
|
@@ -440,7 +426,7 @@ const _hoisted_1$8 = ["aria-label"];
|
|
|
440
426
|
const _hoisted_2$6 = { class: "pointer-events-none flex h-full w-full flex-col items-center justify-center gap-4 text-content-on-surface-primary" };
|
|
441
427
|
const _hoisted_3$5 = { class: "flex flex-col items-center gap-1 text-center" };
|
|
442
428
|
const _hoisted_4$5 = { class: "body-16-bold" };
|
|
443
|
-
const _hoisted_5$
|
|
429
|
+
const _hoisted_5$3 = {
|
|
444
430
|
key: 0,
|
|
445
431
|
class: "body-16-regular"
|
|
446
432
|
};
|
|
@@ -450,7 +436,7 @@ const _hoisted_6$2 = {
|
|
|
450
436
|
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",
|
|
451
437
|
role: "alert"
|
|
452
438
|
};
|
|
453
|
-
const _sfc_main$
|
|
439
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
454
440
|
...{
|
|
455
441
|
name: "CkDropZoneOverlay"
|
|
456
442
|
},
|
|
@@ -501,11 +487,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
501
487
|
if (type && wildcards.some((w) => type.startsWith(w))) return true;
|
|
502
488
|
return false;
|
|
503
489
|
}
|
|
504
|
-
function formatBytes(bytes) {
|
|
505
|
-
const mb = bytes / (1024 * 1024);
|
|
506
|
-
if (mb >= 1) return `${mb.toFixed(0)} MB`;
|
|
507
|
-
return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
|
508
|
-
}
|
|
509
490
|
const isSingle = computed(() => props.maxFiles === 1);
|
|
510
491
|
const resolvedHeading = computed(
|
|
511
492
|
() => props.heading ?? (isSingle.value ? "Drop a file here to add to chat" : "Drop files here to add to chat")
|
|
@@ -561,7 +542,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
561
542
|
rejected.push({
|
|
562
543
|
file,
|
|
563
544
|
reason: "too-large",
|
|
564
|
-
message: `"${file.name}" — exceeds ${
|
|
545
|
+
message: `"${file.name}" — exceeds ${formatFileSize(props.maxFileSizeBytes)} limit`
|
|
565
546
|
});
|
|
566
547
|
continue;
|
|
567
548
|
}
|
|
@@ -618,10 +599,10 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
618
599
|
}, [
|
|
619
600
|
createElementVNode("div", _hoisted_2$6, [
|
|
620
601
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
621
|
-
createVNode(_sfc_main$
|
|
602
|
+
createVNode(_sfc_main$i, { class: "h-36 w-52" }),
|
|
622
603
|
createElementVNode("div", _hoisted_3$5, [
|
|
623
604
|
createElementVNode("p", _hoisted_4$5, toDisplayString(resolvedHeading.value), 1),
|
|
624
|
-
__props.hint ? (openBlock(), createElementBlock("p", _hoisted_5$
|
|
605
|
+
__props.hint ? (openBlock(), createElementBlock("p", _hoisted_5$3, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
|
|
625
606
|
])
|
|
626
607
|
], true)
|
|
627
608
|
])
|
|
@@ -643,9 +624,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
643
624
|
};
|
|
644
625
|
}
|
|
645
626
|
});
|
|
646
|
-
const CkDropZoneOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
627
|
+
const CkDropZoneOverlay = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-54119668"]]);
|
|
647
628
|
const _hoisted_1$7 = ["aria-label"];
|
|
648
|
-
const _sfc_main$
|
|
629
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
649
630
|
...{
|
|
650
631
|
name: "CkFeedbackButton"
|
|
651
632
|
},
|
|
@@ -700,7 +681,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
700
681
|
"delay-duration": 0
|
|
701
682
|
}, {
|
|
702
683
|
default: withCtx(() => [
|
|
703
|
-
createVNode(unref(_sfc_main$
|
|
684
|
+
createVNode(unref(_sfc_main$k), mergeProps({ ariaLabel: thumbsUpLabel.value }, {
|
|
704
685
|
"aria-pressed": isUpSelected.value,
|
|
705
686
|
"aria-disabled": __props.locked || void 0,
|
|
706
687
|
disabled: isUpDisabled.value,
|
|
@@ -730,7 +711,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
730
711
|
"delay-duration": 0
|
|
731
712
|
}, {
|
|
732
713
|
default: withCtx(() => [
|
|
733
|
-
createVNode(unref(_sfc_main$
|
|
714
|
+
createVNode(unref(_sfc_main$k), mergeProps({ ariaLabel: thumbsDownLabel.value }, {
|
|
734
715
|
"aria-pressed": isDownSelected.value,
|
|
735
716
|
"aria-disabled": __props.locked || void 0,
|
|
736
717
|
disabled: isDownDisabled.value,
|
|
@@ -757,7 +738,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
757
738
|
};
|
|
758
739
|
}
|
|
759
740
|
});
|
|
760
|
-
const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
741
|
+
const CkFeedbackButton = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-245705b8"]]);
|
|
761
742
|
const defaultMarkdownClasses = {
|
|
762
743
|
p: "my-1 leading-7",
|
|
763
744
|
a: "underline underline-offset-4",
|
|
@@ -799,7 +780,7 @@ function domToVNode(node, slots, classes) {
|
|
|
799
780
|
}
|
|
800
781
|
return h(tag, attrs, children);
|
|
801
782
|
}
|
|
802
|
-
const _sfc_main$
|
|
783
|
+
const _sfc_main$f = defineComponent({
|
|
803
784
|
name: "CkMarkdownRenderer",
|
|
804
785
|
props: {
|
|
805
786
|
content: { type: String, required: true },
|
|
@@ -839,7 +820,7 @@ const _hoisted_4$4 = {
|
|
|
839
820
|
class: "self-end text-sm text-content-on-surface-muted tabular-nums",
|
|
840
821
|
"aria-live": "polite"
|
|
841
822
|
};
|
|
842
|
-
const _sfc_main$
|
|
823
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
843
824
|
...{
|
|
844
825
|
name: "CkFeedbackDialog"
|
|
845
826
|
},
|
|
@@ -1000,7 +981,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
1000
981
|
_: 1
|
|
1001
982
|
}),
|
|
1002
983
|
createElementVNode("div", _hoisted_2$5, [
|
|
1003
|
-
createVNode(unref(_sfc_main$
|
|
984
|
+
createVNode(unref(_sfc_main$f), { content: __props.responseText }, null, 8, ["content"])
|
|
1004
985
|
])
|
|
1005
986
|
])) : createCommentVNode("", true),
|
|
1006
987
|
createElementVNode("section", _hoisted_3$4, [
|
|
@@ -1066,8 +1047,8 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
1066
1047
|
};
|
|
1067
1048
|
}
|
|
1068
1049
|
});
|
|
1069
|
-
const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
1070
|
-
const _sfc_main$
|
|
1050
|
+
const CkFeedbackDialog = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-12dfee8a"]]);
|
|
1051
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1071
1052
|
...{
|
|
1072
1053
|
name: "CkFileItemRow",
|
|
1073
1054
|
inheritAttrs: false
|
|
@@ -1113,9 +1094,21 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
1113
1094
|
const _hoisted_1$5 = ["aria-label"];
|
|
1114
1095
|
const _hoisted_2$4 = ["onClick"];
|
|
1115
1096
|
const _hoisted_3$3 = ["disabled", "aria-label"];
|
|
1116
|
-
const _hoisted_4$3 =
|
|
1117
|
-
|
|
1118
|
-
|
|
1097
|
+
const _hoisted_4$3 = {
|
|
1098
|
+
key: 3,
|
|
1099
|
+
class: "flex min-w-0 flex-1 flex-col items-start gap-0.5"
|
|
1100
|
+
};
|
|
1101
|
+
const _hoisted_5$2 = {
|
|
1102
|
+
key: 1,
|
|
1103
|
+
class: "label-12-medium w-full truncate text-content-on-status-error-inverse"
|
|
1104
|
+
};
|
|
1105
|
+
const _hoisted_6$1 = {
|
|
1106
|
+
key: 2,
|
|
1107
|
+
class: "label-12-medium w-full truncate text-content-on-surface-muted"
|
|
1108
|
+
};
|
|
1109
|
+
const _hoisted_7$1 = ["aria-label"];
|
|
1110
|
+
const _hoisted_8$1 = ["onClick"];
|
|
1111
|
+
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
1119
1112
|
...{
|
|
1120
1113
|
name: "CkFileItemsList"
|
|
1121
1114
|
},
|
|
@@ -1127,6 +1120,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1127
1120
|
isRemovable: { type: Boolean, default: false },
|
|
1128
1121
|
removeLabel: { default: "Remove file" },
|
|
1129
1122
|
disabled: { type: Boolean, default: false },
|
|
1123
|
+
showStatus: { type: Boolean, default: false },
|
|
1130
1124
|
triggerLabel: { default: void 0 },
|
|
1131
1125
|
triggerAriaLabel: { default: void 0 },
|
|
1132
1126
|
listLabel: { default: void 0 },
|
|
@@ -1145,9 +1139,40 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1145
1139
|
const resolvedTriggerLabel = computed(
|
|
1146
1140
|
() => props.triggerLabel ?? defaultTriggerLabel.value
|
|
1147
1141
|
);
|
|
1148
|
-
|
|
1149
|
-
|
|
1142
|
+
function hasError(file) {
|
|
1143
|
+
return file.error != null && file.error !== "";
|
|
1144
|
+
}
|
|
1145
|
+
const failedFiles = computed(() => props.files.filter(hasError));
|
|
1146
|
+
const uploadingFiles = computed(
|
|
1147
|
+
() => props.files.filter(
|
|
1148
|
+
(f) => !hasError(f) && f.progress != null && f.progress < 100
|
|
1149
|
+
)
|
|
1150
1150
|
);
|
|
1151
|
+
const hasFailures = computed(() => failedFiles.value.length > 0);
|
|
1152
|
+
const uploadInProgress = computed(() => uploadingFiles.value.length > 0);
|
|
1153
|
+
const aggregateProgress = computed(() => {
|
|
1154
|
+
const list = uploadingFiles.value;
|
|
1155
|
+
if (!list.length) return 0;
|
|
1156
|
+
const total = list.reduce((sum, f) => sum + (f.progress ?? 0), 0);
|
|
1157
|
+
return Math.round(total / list.length);
|
|
1158
|
+
});
|
|
1159
|
+
const failedStatusLabel = computed(() => {
|
|
1160
|
+
const n = failedFiles.value.length;
|
|
1161
|
+
return `${n} ${n === 1 ? "upload" : "uploads"} failed`;
|
|
1162
|
+
});
|
|
1163
|
+
const countStatusLabel = computed(() => `${props.files.length} files`);
|
|
1164
|
+
const triggerStatusText = computed(() => {
|
|
1165
|
+
if (!props.showStatus) return "";
|
|
1166
|
+
if (uploadInProgress.value) return `uploading ${aggregateProgress.value}%`;
|
|
1167
|
+
if (hasFailures.value) return failedStatusLabel.value;
|
|
1168
|
+
if (props.triggerLabel) return countStatusLabel.value;
|
|
1169
|
+
return "";
|
|
1170
|
+
});
|
|
1171
|
+
const resolvedTriggerAriaLabel = computed(() => {
|
|
1172
|
+
if (props.triggerAriaLabel) return props.triggerAriaLabel;
|
|
1173
|
+
const base = props.triggerLabel ?? defaultTriggerLabel.value;
|
|
1174
|
+
return triggerStatusText.value ? `${base}, ${triggerStatusText.value}` : base;
|
|
1175
|
+
});
|
|
1151
1176
|
function handleRemove(file) {
|
|
1152
1177
|
if (isRowDisabled(file)) return;
|
|
1153
1178
|
emit("remove", file.id);
|
|
@@ -1172,7 +1197,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1172
1197
|
class: "min-w-0 max-w-64 flex-1 basis-0",
|
|
1173
1198
|
onClick: ($event) => handleRowClick(file, $event)
|
|
1174
1199
|
}, [
|
|
1175
|
-
createVNode(_sfc_main$
|
|
1200
|
+
createVNode(_sfc_main$d, {
|
|
1176
1201
|
file,
|
|
1177
1202
|
size: __props.size,
|
|
1178
1203
|
"is-removable": __props.isRemovable,
|
|
@@ -1202,13 +1227,28 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1202
1227
|
class: normalizeClass(["relative flex w-full max-w-64 min-w-0 items-center gap-3 rounded-xl bg-background-surface-muted-subtle text-left transition-colors hover:bg-background-surface-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-background-surface-muted-subtle", __props.size === "small" ? "p-2" : "p-3"]),
|
|
1203
1228
|
"aria-label": resolvedTriggerAriaLabel.value
|
|
1204
1229
|
}, [
|
|
1205
|
-
|
|
1230
|
+
__props.showStatus && hasFailures.value && !uploadInProgress.value ? (openBlock(), createBlock(unref(UiFileType), {
|
|
1231
|
+
key: 0,
|
|
1232
|
+
error: true
|
|
1233
|
+
})) : (openBlock(), createBlock(unref(UiFileType), {
|
|
1234
|
+
key: 1,
|
|
1206
1235
|
icon: "paperclip",
|
|
1207
1236
|
tone: "default"
|
|
1208
|
-
}),
|
|
1209
|
-
|
|
1237
|
+
})),
|
|
1238
|
+
!__props.showStatus ? (openBlock(), createElementBlock("span", {
|
|
1239
|
+
key: 2,
|
|
1210
1240
|
class: normalizeClass(["min-w-0 flex-1 truncate text-content-on-surface-primary", __props.size === "small" ? "label-12-medium" : "body-14-medium"])
|
|
1211
|
-
}, toDisplayString(resolvedTriggerLabel.value), 3),
|
|
1241
|
+
}, toDisplayString(resolvedTriggerLabel.value), 3)) : (openBlock(), createElementBlock("div", _hoisted_4$3, [
|
|
1242
|
+
createElementVNode("span", {
|
|
1243
|
+
class: normalizeClass(["w-full truncate text-content-on-surface-primary", __props.size === "small" ? "label-12-medium" : "body-14-medium"])
|
|
1244
|
+
}, toDisplayString(resolvedTriggerLabel.value), 3),
|
|
1245
|
+
uploadInProgress.value ? (openBlock(), createBlock(unref(UiProgress), {
|
|
1246
|
+
key: 0,
|
|
1247
|
+
"model-value": aggregateProgress.value,
|
|
1248
|
+
class: "h-1 w-full",
|
|
1249
|
+
"aria-label": `${resolvedTriggerLabel.value} upload progress`
|
|
1250
|
+
}, null, 8, ["model-value", "aria-label"])) : hasFailures.value ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(failedStatusLabel.value), 1)) : __props.triggerLabel ? (openBlock(), createElementBlock("span", _hoisted_6$1, toDisplayString(countStatusLabel.value), 1)) : createCommentVNode("", true)
|
|
1251
|
+
])),
|
|
1212
1252
|
createVNode(unref(UiIcon), {
|
|
1213
1253
|
name: "chevron-down",
|
|
1214
1254
|
size: 16,
|
|
@@ -1236,7 +1276,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1236
1276
|
class: "min-w-0 max-w-64",
|
|
1237
1277
|
onClick: ($event) => handleRowClick(file, $event)
|
|
1238
1278
|
}, [
|
|
1239
|
-
createVNode(_sfc_main$
|
|
1279
|
+
createVNode(_sfc_main$d, {
|
|
1240
1280
|
file,
|
|
1241
1281
|
size: __props.size,
|
|
1242
1282
|
"is-removable": __props.isRemovable,
|
|
@@ -1249,9 +1289,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
1249
1289
|
]),
|
|
1250
1290
|
_: 3
|
|
1251
1291
|
}, 8, ["file", "size", "is-removable", "remove-label", "disabled", "onRemove"])
|
|
1252
|
-
], 8,
|
|
1292
|
+
], 8, _hoisted_8$1);
|
|
1253
1293
|
}), 128))
|
|
1254
|
-
], 8,
|
|
1294
|
+
], 8, _hoisted_7$1)
|
|
1255
1295
|
]),
|
|
1256
1296
|
_: 3
|
|
1257
1297
|
}, 8, ["class"])
|
|
@@ -1269,22 +1309,22 @@ const _hoisted_4$2 = {
|
|
|
1269
1309
|
key: 0,
|
|
1270
1310
|
class: "mt-0.5 flex min-w-0 items-center gap-1 label-12-medium text-content-on-surface-muted"
|
|
1271
1311
|
};
|
|
1272
|
-
const _hoisted_5$
|
|
1312
|
+
const _hoisted_5$1 = {
|
|
1273
1313
|
key: 0,
|
|
1274
1314
|
class: "truncate"
|
|
1275
1315
|
};
|
|
1276
|
-
const _hoisted_6
|
|
1316
|
+
const _hoisted_6 = {
|
|
1277
1317
|
key: 1,
|
|
1278
1318
|
"aria-hidden": "true"
|
|
1279
1319
|
};
|
|
1280
|
-
const _hoisted_7
|
|
1320
|
+
const _hoisted_7 = {
|
|
1281
1321
|
key: 2,
|
|
1282
1322
|
class: "truncate"
|
|
1283
1323
|
};
|
|
1284
1324
|
const _hoisted_8 = ["aria-label"];
|
|
1285
1325
|
const _hoisted_9 = ["aria-label"];
|
|
1286
1326
|
const _hoisted_10 = ["aria-label"];
|
|
1287
|
-
const _sfc_main$
|
|
1327
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
1288
1328
|
...{
|
|
1289
1329
|
name: "CkHistoryItem",
|
|
1290
1330
|
inheritAttrs: false
|
|
@@ -1417,9 +1457,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
1417
1457
|
createElementVNode("div", _hoisted_3$2, toDisplayString(props.title), 1),
|
|
1418
1458
|
props.metaStart || props.metaEnd || _ctx.$slots.meta ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
1419
1459
|
renderSlot(_ctx.$slots, "meta", {}, () => [
|
|
1420
|
-
props.metaStart ? (openBlock(), createElementBlock("span", _hoisted_5$
|
|
1421
|
-
props.metaStart && props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_6
|
|
1422
|
-
props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_7
|
|
1460
|
+
props.metaStart ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(props.metaStart), 1)) : createCommentVNode("", true),
|
|
1461
|
+
props.metaStart && props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_6, "|")) : createCommentVNode("", true),
|
|
1462
|
+
props.metaEnd ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(props.metaEnd), 1)) : createCommentVNode("", true)
|
|
1423
1463
|
])
|
|
1424
1464
|
])) : createCommentVNode("", true)
|
|
1425
1465
|
])
|
|
@@ -1525,7 +1565,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
1525
1565
|
}
|
|
1526
1566
|
});
|
|
1527
1567
|
const baseClass = "flex w-full min-w-0 flex-col p-2";
|
|
1528
|
-
const _sfc_main$
|
|
1568
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1529
1569
|
...{
|
|
1530
1570
|
name: "CkHistoryWrapper",
|
|
1531
1571
|
inheritAttrs: false
|
|
@@ -1559,8 +1599,8 @@ const _hoisted_1$3 = ["disabled", "aria-expanded", "aria-label"];
|
|
|
1559
1599
|
const _hoisted_2$2 = { class: "max-w-[10rem] truncate" };
|
|
1560
1600
|
const _hoisted_3$1 = ["aria-label"];
|
|
1561
1601
|
const _hoisted_4$1 = ["aria-selected", "onClick"];
|
|
1562
|
-
const _hoisted_5
|
|
1563
|
-
const _sfc_main$
|
|
1602
|
+
const _hoisted_5 = { class: "min-w-0 flex-1 truncate" };
|
|
1603
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1564
1604
|
...{ name: "CkModelSelector" },
|
|
1565
1605
|
__name: "CkModelSelector",
|
|
1566
1606
|
props: {
|
|
@@ -1646,7 +1686,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1646
1686
|
class: "relative flex w-full items-center gap-2 rounded-sm py-2 pr-8 pl-3 text-left body-14-regular text-content-on-surface-primary outline-none hover:bg-background-surface-muted-subtle focus-visible:ring-2 focus-visible:ring-ring",
|
|
1647
1687
|
onClick: ($event) => select(model.id)
|
|
1648
1688
|
}, [
|
|
1649
|
-
createElementVNode("span", _hoisted_5
|
|
1689
|
+
createElementVNode("span", _hoisted_5, toDisplayString(model.label), 1),
|
|
1650
1690
|
model.id === __props.selectedModelId ? (openBlock(), createBlock(unref(UiIcon), {
|
|
1651
1691
|
key: 0,
|
|
1652
1692
|
name: "check",
|
|
@@ -1667,9 +1707,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1667
1707
|
};
|
|
1668
1708
|
}
|
|
1669
1709
|
});
|
|
1670
|
-
const _sfc_main$
|
|
1671
|
-
...{ name: "
|
|
1672
|
-
__name: "
|
|
1710
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1711
|
+
...{ name: "CkPromptSendButton" },
|
|
1712
|
+
__name: "CkPromptSendButton",
|
|
1673
1713
|
props: {
|
|
1674
1714
|
ariaLabel: {},
|
|
1675
1715
|
disabled: { type: Boolean, default: false },
|
|
@@ -1683,7 +1723,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1683
1723
|
type: __props.type,
|
|
1684
1724
|
disabled: __props.disabled,
|
|
1685
1725
|
loading: __props.loading,
|
|
1686
|
-
class: "!
|
|
1726
|
+
class: "!rounded-full"
|
|
1687
1727
|
}), {
|
|
1688
1728
|
default: withCtx(() => [
|
|
1689
1729
|
renderSlot(_ctx.$slots, "default")
|
|
@@ -1693,6 +1733,36 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1693
1733
|
};
|
|
1694
1734
|
}
|
|
1695
1735
|
});
|
|
1736
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1737
|
+
...{ name: "CkPromptMenuButton" },
|
|
1738
|
+
__name: "CkPromptMenuButton",
|
|
1739
|
+
props: {
|
|
1740
|
+
ariaLabel: {},
|
|
1741
|
+
disabled: { type: Boolean, default: false },
|
|
1742
|
+
type: { default: "button" }
|
|
1743
|
+
},
|
|
1744
|
+
setup(__props) {
|
|
1745
|
+
return (_ctx, _cache) => {
|
|
1746
|
+
return openBlock(), createBlock(unref(UiButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
|
|
1747
|
+
variant: "ghost",
|
|
1748
|
+
size: "icon",
|
|
1749
|
+
type: __props.type,
|
|
1750
|
+
disabled: __props.disabled,
|
|
1751
|
+
class: "!rounded-full"
|
|
1752
|
+
}), {
|
|
1753
|
+
default: withCtx(() => [
|
|
1754
|
+
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1755
|
+
createVNode(unref(UiIcon), {
|
|
1756
|
+
name: "plus",
|
|
1757
|
+
size: 20
|
|
1758
|
+
})
|
|
1759
|
+
])
|
|
1760
|
+
]),
|
|
1761
|
+
_: 3
|
|
1762
|
+
}, 16, ["type", "disabled"]);
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
});
|
|
1696
1766
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1697
1767
|
...{ name: "CkPromptStopButton" },
|
|
1698
1768
|
__name: "CkPromptStopButton",
|
|
@@ -1705,9 +1775,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1705
1775
|
const props = __props;
|
|
1706
1776
|
return (_ctx, _cache) => {
|
|
1707
1777
|
return openBlock(), createBlock(unref(UiButton), mergeProps({ ariaLabel: __props.ariaLabel }, {
|
|
1708
|
-
|
|
1778
|
+
variant: "secondary",
|
|
1779
|
+
size: "icon",
|
|
1709
1780
|
disabled: props.disabled,
|
|
1710
|
-
class: "!
|
|
1781
|
+
class: "!rounded-full",
|
|
1711
1782
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
|
|
1712
1783
|
}), {
|
|
1713
1784
|
default: withCtx(() => [
|
|
@@ -1719,12 +1790,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1719
1790
|
}
|
|
1720
1791
|
});
|
|
1721
1792
|
const _hoisted_1$2 = { class: "flex flex-col gap-2" };
|
|
1722
|
-
const _hoisted_2$1 =
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
const
|
|
1727
|
-
const
|
|
1793
|
+
const _hoisted_2$1 = {
|
|
1794
|
+
key: 0,
|
|
1795
|
+
style: { "grid-area": "top" }
|
|
1796
|
+
};
|
|
1797
|
+
const _hoisted_3 = ["for"];
|
|
1798
|
+
const _hoisted_4 = ["id", "value", "placeholder", "disabled"];
|
|
1799
|
+
const LINE_HEIGHT = 24;
|
|
1800
|
+
const MAX_LINES = 6;
|
|
1728
1801
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
1729
1802
|
...{ name: "CkPromptInput" },
|
|
1730
1803
|
__name: "CkPromptInput",
|
|
@@ -1732,27 +1805,51 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1732
1805
|
modelValue: { default: "" },
|
|
1733
1806
|
placeholder: { default: void 0 },
|
|
1734
1807
|
disabled: { type: Boolean, default: false },
|
|
1735
|
-
maxHeight: { default: 200 },
|
|
1736
1808
|
ariaLabel: { default: void 0 }
|
|
1737
1809
|
},
|
|
1738
1810
|
emits: ["update:modelValue", "submit"],
|
|
1739
1811
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1812
|
+
const MAX_HEIGHT = LINE_HEIGHT * MAX_LINES;
|
|
1740
1813
|
const props = __props;
|
|
1741
1814
|
const emit = __emit;
|
|
1742
1815
|
const textareaId = useId();
|
|
1743
1816
|
const textareaRef = useTemplateRef("textareaRef");
|
|
1817
|
+
const slots = useSlots();
|
|
1818
|
+
const isMultiLine = ref(false);
|
|
1744
1819
|
const isEmpty = computed(() => props.modelValue.trim() === "");
|
|
1745
1820
|
const isSubmitDisabled = computed(() => props.disabled || isEmpty.value);
|
|
1821
|
+
const hasToolbarTop = ref(typeof slots["toolbar-top"] === "function");
|
|
1822
|
+
function syncSlotState() {
|
|
1823
|
+
const next = typeof slots["toolbar-top"] === "function";
|
|
1824
|
+
if (next !== hasToolbarTop.value) hasToolbarTop.value = next;
|
|
1825
|
+
}
|
|
1826
|
+
onMounted(syncSlotState);
|
|
1827
|
+
onUpdated(syncSlotState);
|
|
1828
|
+
const hasMultipleRows = computed(
|
|
1829
|
+
() => isMultiLine.value || hasToolbarTop.value
|
|
1830
|
+
);
|
|
1831
|
+
const gridAreas = computed(() => {
|
|
1832
|
+
const top = hasToolbarTop.value ? '"top top top" ' : "";
|
|
1833
|
+
return isMultiLine.value ? `${top}"input input input" "left . right"` : `${top}"left input right"`;
|
|
1834
|
+
});
|
|
1746
1835
|
function adjustHeight() {
|
|
1747
1836
|
const el = textareaRef.value;
|
|
1748
1837
|
if (!el) return;
|
|
1838
|
+
if (props.modelValue === "") {
|
|
1839
|
+
isMultiLine.value = false;
|
|
1840
|
+
el.style.height = "";
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1749
1843
|
el.style.height = "auto";
|
|
1750
|
-
|
|
1844
|
+
const measured = el.scrollHeight;
|
|
1845
|
+
el.style.height = `${Math.min(measured, MAX_HEIGHT)}px`;
|
|
1846
|
+
const hasExplicitNewline = props.modelValue.includes("\n");
|
|
1847
|
+
if (!isMultiLine.value && (hasExplicitNewline || measured >= LINE_HEIGHT * 2)) {
|
|
1848
|
+
isMultiLine.value = true;
|
|
1849
|
+
}
|
|
1751
1850
|
}
|
|
1752
1851
|
function onInput(event) {
|
|
1753
|
-
|
|
1754
|
-
emit("update:modelValue", value);
|
|
1755
|
-
adjustHeight();
|
|
1852
|
+
emit("update:modelValue", event.target.value);
|
|
1756
1853
|
}
|
|
1757
1854
|
function submit() {
|
|
1758
1855
|
if (isSubmitDisabled.value) return;
|
|
@@ -1771,52 +1868,70 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1771
1868
|
}
|
|
1772
1869
|
watch(
|
|
1773
1870
|
() => props.modelValue,
|
|
1774
|
-
() =>
|
|
1775
|
-
nextTick(adjustHeight);
|
|
1776
|
-
}
|
|
1871
|
+
() => nextTick(adjustHeight)
|
|
1777
1872
|
);
|
|
1873
|
+
onMounted(adjustHeight);
|
|
1778
1874
|
__expose({ focus, submit });
|
|
1779
1875
|
return (_ctx, _cache) => {
|
|
1780
1876
|
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
1781
1877
|
createElementVNode("form", {
|
|
1782
|
-
class:
|
|
1878
|
+
class: normalizeClass([
|
|
1879
|
+
"ck-prompt-form border-border-surface-default bg-background-input-strong [&:has(textarea:focus)]:border-border-surface-focus-ring [&:has(textarea:focus)]:ring-border-surface-focus-ring/40 min-h-17 grid items-center gap-x-0 gap-y-5 border p-4 transition-[border-radius] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] [&:has(textarea:focus)]:ring-2",
|
|
1880
|
+
hasMultipleRows.value ? "rounded-2xl" : "rounded-3xl"
|
|
1881
|
+
]),
|
|
1882
|
+
style: normalizeStyle({
|
|
1883
|
+
gridTemplateColumns: "auto 1fr auto",
|
|
1884
|
+
gridTemplateAreas: gridAreas.value
|
|
1885
|
+
}),
|
|
1783
1886
|
onSubmit: withModifiers(submit, ["prevent"])
|
|
1784
1887
|
}, [
|
|
1888
|
+
hasToolbarTop.value ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
1889
|
+
renderSlot(_ctx.$slots, "toolbar-top", {}, void 0, true)
|
|
1890
|
+
])) : createCommentVNode("", true),
|
|
1785
1891
|
__props.ariaLabel ? (openBlock(), createElementBlock("label", {
|
|
1786
|
-
key:
|
|
1892
|
+
key: 1,
|
|
1787
1893
|
for: unref(textareaId),
|
|
1788
1894
|
class: "sr-only"
|
|
1789
|
-
}, toDisplayString(__props.ariaLabel), 9,
|
|
1895
|
+
}, toDisplayString(__props.ariaLabel), 9, _hoisted_3)) : createCommentVNode("", true),
|
|
1896
|
+
createElementVNode("div", {
|
|
1897
|
+
class: normalizeClass([!isMultiLine.value && "pr-2"]),
|
|
1898
|
+
style: { "grid-area": "left" }
|
|
1899
|
+
}, [
|
|
1900
|
+
renderSlot(_ctx.$slots, "toolbar-left", {}, void 0, true)
|
|
1901
|
+
], 2),
|
|
1790
1902
|
createElementVNode("textarea", {
|
|
1791
1903
|
id: unref(textareaId),
|
|
1792
1904
|
ref_key: "textareaRef",
|
|
1793
1905
|
ref: textareaRef,
|
|
1794
|
-
rows: "
|
|
1906
|
+
rows: "1",
|
|
1795
1907
|
value: __props.modelValue,
|
|
1796
1908
|
placeholder: __props.placeholder,
|
|
1797
1909
|
disabled: __props.disabled,
|
|
1798
|
-
|
|
1910
|
+
style: { "grid-area": "input" },
|
|
1911
|
+
class: normalizeClass([
|
|
1912
|
+
"ck-prompt-textarea text-content-on-surface-primary placeholder-content-on-surface-muted w-full min-w-0 resize-none overflow-y-auto bg-transparent py-0 font-sans text-base font-normal leading-6 max-h-36 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60",
|
|
1913
|
+
isMultiLine.value ? "pl-3 pr-3" : "px-0"
|
|
1914
|
+
]),
|
|
1799
1915
|
onInput,
|
|
1800
1916
|
onKeydown
|
|
1801
|
-
}, null,
|
|
1802
|
-
createElementVNode("div",
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
], 32),
|
|
1815
|
-
renderSlot(_ctx.$slots, "footer")
|
|
1917
|
+
}, null, 42, _hoisted_4),
|
|
1918
|
+
createElementVNode("div", {
|
|
1919
|
+
class: normalizeClass([!isMultiLine.value && "pl-4"]),
|
|
1920
|
+
style: { "grid-area": "right" }
|
|
1921
|
+
}, [
|
|
1922
|
+
renderSlot(_ctx.$slots, "toolbar-right", {
|
|
1923
|
+
submit,
|
|
1924
|
+
disabled: isSubmitDisabled.value,
|
|
1925
|
+
isEmpty: isEmpty.value
|
|
1926
|
+
}, void 0, true)
|
|
1927
|
+
], 2)
|
|
1928
|
+
], 38),
|
|
1929
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
1816
1930
|
]);
|
|
1817
1931
|
};
|
|
1818
1932
|
}
|
|
1819
1933
|
});
|
|
1934
|
+
const CkPromptInput = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-92b05731"]]);
|
|
1820
1935
|
const _hoisted_1$1 = {
|
|
1821
1936
|
key: 0,
|
|
1822
1937
|
class: "text-core-content-tertiary text-center text-xs leading-3.5"
|
|
@@ -1931,7 +2046,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1931
2046
|
return message.content.filter((c) => c.type === "text").map((c) => c.text).join("");
|
|
1932
2047
|
}
|
|
1933
2048
|
return (_ctx, _cache) => {
|
|
1934
|
-
return openBlock(), createBlock(_sfc_main$
|
|
2049
|
+
return openBlock(), createBlock(_sfc_main$l, { messages: __props.messages }, {
|
|
1935
2050
|
"user-message": withCtx(({ message }) => [
|
|
1936
2051
|
createElementVNode("div", {
|
|
1937
2052
|
class: normalizeClass({ "ml-8": hasIcon.value })
|
|
@@ -1950,7 +2065,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1950
2065
|
]),
|
|
1951
2066
|
"agent-message": withCtx(({ message }) => [
|
|
1952
2067
|
renderSlot(_ctx.$slots, "agent-message", { message }, () => [
|
|
1953
|
-
createVNode(_sfc_main$
|
|
2068
|
+
createVNode(_sfc_main$m, null, createSlots({
|
|
1954
2069
|
footer: withCtx(() => [
|
|
1955
2070
|
renderSlot(_ctx.$slots, "agent-message-footer", { message }, () => [
|
|
1956
2071
|
getMessageText(message) && !isLoading(message) ? (openBlock(), createBlock(CkCopyMessageActionButton, {
|
|
@@ -1963,7 +2078,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1963
2078
|
]),
|
|
1964
2079
|
default: withCtx(() => [
|
|
1965
2080
|
renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
|
|
1966
|
-
createVNode(_sfc_main$
|
|
2081
|
+
createVNode(_sfc_main$f, {
|
|
1967
2082
|
content: getMessageText(message),
|
|
1968
2083
|
classes: __props.agentMarkdownClasses
|
|
1969
2084
|
}, createSlots({ _: 2 }, [
|
|
@@ -2089,7 +2204,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2089
2204
|
}
|
|
2090
2205
|
return (_ctx, _cache) => {
|
|
2091
2206
|
return openBlock(), createElementBlock("div", null, [
|
|
2092
|
-
createVNode(_sfc_main$
|
|
2207
|
+
createVNode(_sfc_main$a, {
|
|
2093
2208
|
class: normalizeClass(isExpanded.value && props.maxHeight ? "overflow-y-auto" : void 0),
|
|
2094
2209
|
style: normalizeStyle(
|
|
2095
2210
|
isExpanded.value && props.maxHeight ? { maxHeight: props.maxHeight } : void 0
|
|
@@ -2108,7 +2223,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2108
2223
|
edit: () => emit("edit", conversation),
|
|
2109
2224
|
delete: () => emit("delete", conversation)
|
|
2110
2225
|
}, () => [
|
|
2111
|
-
createVNode(_sfc_main$
|
|
2226
|
+
createVNode(_sfc_main$b, {
|
|
2112
2227
|
as: "a",
|
|
2113
2228
|
href: hrefFor(conversation),
|
|
2114
2229
|
"is-active": conversation.id === props.activeId,
|
|
@@ -2182,7 +2297,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2182
2297
|
placeholder: { default: "Ask me anything" },
|
|
2183
2298
|
disabled: { type: Boolean, default: false },
|
|
2184
2299
|
loading: { type: Boolean, default: false },
|
|
2185
|
-
maxHeight: { default: 200 },
|
|
2186
2300
|
ariaLabel: { default: "Chat message input" },
|
|
2187
2301
|
stopAriaLabel: { default: "Stop generating" },
|
|
2188
2302
|
disclaimer: { default: void 0 }
|
|
@@ -2210,13 +2324,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2210
2324
|
}
|
|
2211
2325
|
__expose({ focus, submit });
|
|
2212
2326
|
return (_ctx, _cache) => {
|
|
2213
|
-
return openBlock(), createBlock(
|
|
2327
|
+
return openBlock(), createBlock(CkPromptInput, {
|
|
2214
2328
|
ref_key: "promptInputRef",
|
|
2215
2329
|
ref: promptInputRef,
|
|
2216
2330
|
"model-value": __props.modelValue,
|
|
2217
2331
|
placeholder: __props.placeholder,
|
|
2218
2332
|
disabled: isDisabled.value,
|
|
2219
|
-
"max-height": __props.maxHeight,
|
|
2220
2333
|
"aria-label": __props.ariaLabel,
|
|
2221
2334
|
"onUpdate:modelValue": onUpdateModelValue,
|
|
2222
2335
|
onSubmit
|
|
@@ -2231,17 +2344,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2231
2344
|
}, {
|
|
2232
2345
|
default: withCtx(() => [
|
|
2233
2346
|
renderSlot(_ctx.$slots, "stop-icon", {}, () => [
|
|
2234
|
-
createVNode(_sfc_main$
|
|
2347
|
+
createVNode(_sfc_main$n)
|
|
2235
2348
|
])
|
|
2236
2349
|
]),
|
|
2237
2350
|
_: 3
|
|
2238
|
-
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$
|
|
2351
|
+
}, 8, ["aria-label", "disabled"])) : (openBlock(), createBlock(_sfc_main$8, mergeProps({ key: 1 }, { ariaLabel: "Send message" }, {
|
|
2239
2352
|
type: "submit",
|
|
2240
2353
|
disabled: scope.disabled
|
|
2241
2354
|
}), {
|
|
2242
2355
|
default: withCtx(() => [
|
|
2243
2356
|
renderSlot(_ctx.$slots, "send-icon", {}, () => [
|
|
2244
|
-
createVNode(_sfc_main$
|
|
2357
|
+
createVNode(_sfc_main$o)
|
|
2245
2358
|
])
|
|
2246
2359
|
]),
|
|
2247
2360
|
_: 3
|
|
@@ -2258,39 +2371,47 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2258
2371
|
]),
|
|
2259
2372
|
_: 2
|
|
2260
2373
|
}, [
|
|
2374
|
+
_ctx.$slots["toolbar-top"] ? {
|
|
2375
|
+
name: "toolbar-top",
|
|
2376
|
+
fn: withCtx(() => [
|
|
2377
|
+
renderSlot(_ctx.$slots, "toolbar-top")
|
|
2378
|
+
]),
|
|
2379
|
+
key: "0"
|
|
2380
|
+
} : void 0,
|
|
2261
2381
|
_ctx.$slots["toolbar-left"] ? {
|
|
2262
2382
|
name: "toolbar-left",
|
|
2263
2383
|
fn: withCtx(() => [
|
|
2264
2384
|
renderSlot(_ctx.$slots, "toolbar-left")
|
|
2265
2385
|
]),
|
|
2266
|
-
key: "
|
|
2386
|
+
key: "1"
|
|
2267
2387
|
} : void 0
|
|
2268
|
-
]), 1032, ["model-value", "placeholder", "disabled", "
|
|
2388
|
+
]), 1032, ["model-value", "placeholder", "disabled", "aria-label"]);
|
|
2269
2389
|
};
|
|
2270
2390
|
}
|
|
2271
2391
|
});
|
|
2272
2392
|
export {
|
|
2273
2393
|
CkCopyMessageActionButton as C,
|
|
2274
|
-
_sfc_main$
|
|
2394
|
+
_sfc_main$m as _,
|
|
2275
2395
|
_sfc_main$2 as a,
|
|
2276
|
-
_sfc_main$
|
|
2396
|
+
_sfc_main$l as b,
|
|
2277
2397
|
CkDropZoneOverlay as c,
|
|
2278
2398
|
CkFeedbackButton as d,
|
|
2279
2399
|
CkFeedbackDialog as e,
|
|
2280
|
-
_sfc_main$
|
|
2400
|
+
_sfc_main$c as f,
|
|
2281
2401
|
_sfc_main$1 as g,
|
|
2282
|
-
_sfc_main$
|
|
2283
|
-
_sfc_main$
|
|
2402
|
+
_sfc_main$b as h,
|
|
2403
|
+
_sfc_main$a as i,
|
|
2284
2404
|
_sfc_main as j,
|
|
2285
|
-
_sfc_main$
|
|
2286
|
-
_sfc_main$
|
|
2287
|
-
_sfc_main$
|
|
2288
|
-
|
|
2289
|
-
_sfc_main$
|
|
2290
|
-
_sfc_main$
|
|
2291
|
-
_sfc_main$
|
|
2292
|
-
_sfc_main$
|
|
2293
|
-
_sfc_main$
|
|
2294
|
-
|
|
2295
|
-
|
|
2405
|
+
_sfc_main$f as k,
|
|
2406
|
+
_sfc_main$k as l,
|
|
2407
|
+
_sfc_main$9 as m,
|
|
2408
|
+
CkPromptInput as n,
|
|
2409
|
+
_sfc_main$4 as o,
|
|
2410
|
+
_sfc_main$7 as p,
|
|
2411
|
+
_sfc_main$8 as q,
|
|
2412
|
+
_sfc_main$6 as r,
|
|
2413
|
+
_sfc_main$o as s,
|
|
2414
|
+
_sfc_main$n as t,
|
|
2415
|
+
CkUserMessage as u,
|
|
2416
|
+
formatRelativeTime as v
|
|
2296
2417
|
};
|