@aleph-alpha/chat-kit 0.3.0 → 0.5.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/{ChatInput.vue_vue_type_script_setup_true_lang-BCa2ePSm.js → ChatInput.vue_vue_type_script_setup_true_lang-Cca7le4i.js} +24 -25
- package/dist/components/base/MarkdownRenderer/MarkdownRenderer.vue.d.ts.map +1 -1
- package/dist/components/base/MarkdownRenderer/defaultMarkdownClasses.d.ts +3 -0
- package/dist/components/base/MarkdownRenderer/defaultMarkdownClasses.d.ts.map +1 -0
- package/dist/components/composed/ChatConversation/ChatConversation.vue.d.ts.map +1 -1
- package/dist/components/composed/ChatConversation/index.d.ts +0 -1
- package/dist/components/composed/ChatConversation/index.d.ts.map +1 -1
- package/dist/components/composed/index.d.ts +1 -1
- package/dist/components/composed/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -3
- package/dist/composables/index.d.ts +0 -3
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/index.js +3 -8
- package/dist/handlers/index.d.ts +3 -0
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +7 -1
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -0
- package/dist/handlers/useMarkdownParser.d.ts.map +1 -0
- package/dist/handlers/useMessageHandler.d.ts +2 -19
- package/dist/handlers/useMessageHandler.d.ts.map +1 -1
- package/dist/helpers/conversationTree.d.ts.map +1 -0
- package/dist/helpers/generateId.d.ts +2 -0
- package/dist/helpers/generateId.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +2 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -6
- package/dist/{useMessageHandler-Day_sdpQ.js → useMessageHandler-D7OdrrcB.js} +4 -13
- package/package.json +2 -2
- package/dist/components/composed/ChatConversation/defaultAgentMarkdownClasses.d.ts +0 -3
- package/dist/components/composed/ChatConversation/defaultAgentMarkdownClasses.d.ts.map +0 -1
- package/dist/composables/useChatKitLabels.d.ts.map +0 -1
- package/dist/composables/useMarkdownParser.d.ts.map +0 -1
- package/dist/handlers/conversationTree.d.ts.map +0 -1
- package/dist/useChat-CtN_iBTc.js +0 -5
- /package/dist/{composables → handlers}/useChatKitLabels.d.ts +0 -0
- /package/dist/{composables → handlers}/useMarkdownParser.d.ts +0 -0
- /package/dist/{handlers → helpers}/conversationTree.d.ts +0 -0
|
@@ -213,6 +213,23 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
215
|
});
|
|
216
|
+
const defaultMarkdownClasses = {
|
|
217
|
+
p: "my-1 leading-7",
|
|
218
|
+
a: "underline underline-offset-4",
|
|
219
|
+
h1: "mt-4 mb-2 text-2xl font-bold",
|
|
220
|
+
h2: "mt-3 mb-2 text-xl font-semibold",
|
|
221
|
+
h3: "mt-3 mb-1 text-lg font-semibold",
|
|
222
|
+
ul: "my-1 ml-6 list-disc",
|
|
223
|
+
ol: "my-1 ml-6 list-decimal",
|
|
224
|
+
li: "my-0.5",
|
|
225
|
+
pre: "my-2 overflow-x-auto rounded-lg p-4",
|
|
226
|
+
code: "rounded px-1.5 py-0.5",
|
|
227
|
+
blockquote: "my-2 border-l-2 pl-4 italic",
|
|
228
|
+
table: "my-2 w-full border-collapse",
|
|
229
|
+
th: "border p-2 text-left font-semibold",
|
|
230
|
+
td: "border p-2",
|
|
231
|
+
hr: "my-4"
|
|
232
|
+
};
|
|
216
233
|
function domToVNode(node, slots, classes) {
|
|
217
234
|
if (node.nodeType === Node.TEXT_NODE) return node.textContent;
|
|
218
235
|
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
@@ -253,8 +270,12 @@ const _sfc_main$7 = defineComponent({
|
|
|
253
270
|
const doc = new DOMParser().parseFromString(raw, "text/html");
|
|
254
271
|
return Array.from(doc.body.childNodes);
|
|
255
272
|
});
|
|
273
|
+
const mergedClasses = computed(() => ({
|
|
274
|
+
...defaultMarkdownClasses,
|
|
275
|
+
...props.classes
|
|
276
|
+
}));
|
|
256
277
|
return () => {
|
|
257
|
-
const elementClasses =
|
|
278
|
+
const elementClasses = mergedClasses.value;
|
|
258
279
|
const children = parsedNodes.value.map((node) => domToVNode(node, slots, elementClasses)).filter((c) => c != null);
|
|
259
280
|
return h("div", { class: "markdown-renderer" }, children);
|
|
260
281
|
};
|
|
@@ -420,23 +441,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
420
441
|
};
|
|
421
442
|
}
|
|
422
443
|
});
|
|
423
|
-
const defaultAgentMarkdownClasses = {
|
|
424
|
-
p: "my-1 leading-7",
|
|
425
|
-
a: "underline underline-offset-4",
|
|
426
|
-
h1: "mt-4 mb-2 text-2xl font-bold",
|
|
427
|
-
h2: "mt-3 mb-2 text-xl font-semibold",
|
|
428
|
-
h3: "mt-3 mb-1 text-lg font-semibold",
|
|
429
|
-
ul: "my-1 ml-6 list-disc",
|
|
430
|
-
ol: "my-1 ml-6 list-decimal",
|
|
431
|
-
li: "my-0.5",
|
|
432
|
-
pre: "my-2 overflow-x-auto rounded-lg p-4",
|
|
433
|
-
code: "rounded px-1.5 py-0.5",
|
|
434
|
-
blockquote: "my-2 border-l-2 pl-4 italic",
|
|
435
|
-
table: "my-2 w-full border-collapse",
|
|
436
|
-
th: "border p-2 text-left font-semibold",
|
|
437
|
-
td: "border p-2",
|
|
438
|
-
hr: "my-4"
|
|
439
|
-
};
|
|
440
444
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
441
445
|
__name: "ChatConversation",
|
|
442
446
|
props: {
|
|
@@ -448,10 +452,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
448
452
|
},
|
|
449
453
|
setup(__props) {
|
|
450
454
|
const props = __props;
|
|
451
|
-
const mergedMarkdownClasses = computed(() => ({
|
|
452
|
-
...defaultAgentMarkdownClasses,
|
|
453
|
-
...props.agentMarkdownClasses
|
|
454
|
-
}));
|
|
455
455
|
const slots = useSlots();
|
|
456
456
|
const labels = useChatKitLabels();
|
|
457
457
|
const hasIcon = computed(
|
|
@@ -485,7 +485,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
485
485
|
renderSlot(_ctx.$slots, "agent-message-content", { message }, () => [
|
|
486
486
|
createVNode(_sfc_main$7, {
|
|
487
487
|
content: message.content,
|
|
488
|
-
classes:
|
|
488
|
+
classes: __props.agentMarkdownClasses
|
|
489
489
|
}, createSlots({ _: 2 }, [
|
|
490
490
|
_ctx.$slots["agent-message-code-block"] ? {
|
|
491
491
|
name: "code-block",
|
|
@@ -675,6 +675,5 @@ export {
|
|
|
675
675
|
_sfc_main$6 as d,
|
|
676
676
|
_sfc_main$5 as e,
|
|
677
677
|
_sfc_main$4 as f,
|
|
678
|
-
_sfc_main$3 as g
|
|
679
|
-
defaultAgentMarkdownClasses as h
|
|
678
|
+
_sfc_main$3 as g
|
|
680
679
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/MarkdownRenderer/MarkdownRenderer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/MarkdownRenderer/MarkdownRenderer.vue"],"names":[],"mappings":"AAiFE,OAAO,EAAwC,KAAK,QAAQ,EAAc,KAAK,KAAK,EAAE,MAAM,KAAK,CAAC;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;wBAyCjC,OAAO,YAAY;AAAxC,wBAAyC;AAQ3C,QAAA,MAAM,YAAY;;;;;;cAIe,QAAQ,CAAC,sBAAsB,CAAC;;;;cACjC,QAAQ,CAAC,aAAa,CAAC;;;;;;;;;;;cADtB,QAAQ,CAAC,sBAAsB,CAAC;;;;cACjC,QAAQ,CAAC,aAAa,CAAC;;;;;;4EA0BnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultMarkdownClasses.d.ts","sourceRoot":"","sources":["../../../../src/components/base/MarkdownRenderer/defaultMarkdownClasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,sBAAsB,EAAE,sBAgBpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatConversation.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/ChatConversation/ChatConversation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatConversation.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/ChatConversation/ChatConversation.vue"],"names":[],"mappings":"AAuHE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAWrD,KAAK,WAAW,GAAG;IACjB,gDAAgD;IAChD,cAAc,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAC1D,yDAAyD;IACzD,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,iDAAiD;IACjD,eAAe,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAC3D,oCAAoC;IACpC,oBAAoB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,8EAA8E;IAC9E,4BAA4B,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACxE,uCAAuC;IACvC,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,qCAAqC;IACrC,uBAAuB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,mDAAmD;IACnD,sBAAsB,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,qEAAqE;IACrE,0BAA0B,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACjF,CAAC;AAwQJ,QAAA,MAAM,UAAU;;;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/ChatConversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/ChatConversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ChatConversation
|
|
1
|
+
export { ChatConversation } from './ChatConversation';
|
|
2
2
|
export type { ChatConversationProps } from './ChatConversation';
|
|
3
3
|
export { ChatInput } from './ChatInput';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/composed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/composed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AgentMessage, ChatConversationLayout, MarkdownRenderer, PromptActionButton, PromptInput, PromptInputDisclaimer, UserMessage, } from './base';
|
|
2
2
|
export type { ChatConversationLayoutProps, MarkdownElementClasses, MarkdownRendererProps, UserMessageProps, } from './base';
|
|
3
|
-
export { ChatConversation, ChatInput
|
|
3
|
+
export { ChatConversation, ChatInput } from './composed';
|
|
4
4
|
export type { ChatConversationProps } from './composed';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,WAAW,GACZ,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,WAAW,GACZ,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, _, a, b, c, d, e, f, g
|
|
1
|
+
import { A, _, a, b, c, d, e, f, g } from "../ChatInput.vue_vue_type_script_setup_true_lang-Cca7le4i.js";
|
|
2
2
|
export {
|
|
3
3
|
A as AgentMessage,
|
|
4
4
|
_ as ChatConversation,
|
|
@@ -8,6 +8,5 @@ export {
|
|
|
8
8
|
d as PromptActionButton,
|
|
9
9
|
e as PromptInput,
|
|
10
10
|
f as PromptInputDisclaimer,
|
|
11
|
-
g as UserMessage
|
|
12
|
-
h as defaultAgentMarkdownClasses
|
|
11
|
+
g as UserMessage
|
|
13
12
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export { useChat } from './useChat';
|
|
2
|
-
export { useMarkdownParser } from './useMarkdownParser';
|
|
3
|
-
export { provideChatKitLabels, useChatKitLabels, defaultChatKitLabels, CHAT_KIT_LABELS, } from './useChatKitLabels';
|
|
4
|
-
export type { ChatKitLabels } from './useChatKitLabels';
|
|
5
2
|
export type { ChatActions, ChatState, UseChatReturn } from './types';
|
|
6
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
function useChat() {
|
|
2
|
+
}
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
d as defaultChatKitLabels,
|
|
6
|
-
p as provideChatKitLabels,
|
|
7
|
-
u as useChat,
|
|
8
|
-
u2 as useChatKitLabels,
|
|
9
|
-
a as useMarkdownParser
|
|
4
|
+
useChat
|
|
10
5
|
};
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { useMessageHandler } from './useMessageHandler';
|
|
2
|
+
export { useMarkdownParser } from './useMarkdownParser';
|
|
3
|
+
export { provideChatKitLabels, useChatKitLabels, defaultChatKitLabels, CHAT_KIT_LABELS, } from './useChatKitLabels';
|
|
4
|
+
export type { ChatKitLabels } from './useChatKitLabels';
|
|
2
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/handlers/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { u } from "../useMessageHandler-
|
|
1
|
+
import { u } from "../useMessageHandler-D7OdrrcB.js";
|
|
2
|
+
import { C, d, p, u as u2, a } from "../useChatKitLabels-xZXcnxZZ.js";
|
|
2
3
|
export {
|
|
4
|
+
C as CHAT_KIT_LABELS,
|
|
5
|
+
d as defaultChatKitLabels,
|
|
6
|
+
p as provideChatKitLabels,
|
|
7
|
+
u2 as useChatKitLabels,
|
|
8
|
+
a as useMarkdownParser,
|
|
3
9
|
u as useMessageHandler
|
|
4
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChatKitLabels.d.ts","sourceRoot":"","sources":["../../src/handlers/useChatKitLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,aAIlC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,aAAa,CAAC,CAA6B,CAAC;AAEnG,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5C,yFAAyF;AACzF,KAAK,cAAc,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,aAAa,CAAC,CAAC;AAE9F;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAKjE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAAC,aAAa,CAAC,CAK7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMarkdownParser.d.ts","sourceRoot":"","sources":["../../src/handlers/useMarkdownParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAW,MAAM,KAAK,CAAC;AAC/D,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAiBtD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;;EAwBrD"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { BaseMessage, ConversationTree, MessageRole, MessageStatus
|
|
1
|
+
import type { BaseMessage, ConversationTree, MessageRole, MessageStatus } from '../types';
|
|
2
2
|
import { type Ref } from 'vue';
|
|
3
3
|
export declare const useMessageHandler: () => {
|
|
4
4
|
messages: Ref<BaseMessage[]>;
|
|
5
5
|
currentUserMessage: Readonly<Ref<string, string>>;
|
|
6
|
+
currentLeafId: import("vue").ComputedRef<string | null>;
|
|
6
7
|
updateMessage: (message: {
|
|
7
8
|
id: string;
|
|
8
9
|
content: string;
|
|
@@ -13,27 +14,9 @@ export declare const useMessageHandler: () => {
|
|
|
13
14
|
getMessageById: (id: string) => BaseMessage | undefined;
|
|
14
15
|
clearCurrentUserMessage: () => void;
|
|
15
16
|
commitUserMessage: () => BaseMessage;
|
|
16
|
-
getLastUserMessage: () => BaseMessage | undefined;
|
|
17
17
|
updateMessageId: (oldId: string, newId: string) => void;
|
|
18
18
|
clearMessages: () => void;
|
|
19
|
-
currentLeafId: import("vue").ComputedRef<string | null>;
|
|
20
|
-
tree: {
|
|
21
|
-
readonly nodes: {
|
|
22
|
-
readonly [x: string]: {
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly parentId: string | null;
|
|
25
|
-
readonly childrenIds: readonly string[];
|
|
26
|
-
readonly activeChildIndex: number;
|
|
27
|
-
readonly role: MessageRole;
|
|
28
|
-
readonly content: string;
|
|
29
|
-
readonly status: MessageStatus;
|
|
30
|
-
readonly createdAt: Date;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
readonly rootId: string | null;
|
|
34
|
-
};
|
|
35
19
|
setTree: (incoming: ConversationTree) => void;
|
|
36
|
-
addNode: (node: TreeMessage) => void;
|
|
37
20
|
navigate: (targetId: string) => void;
|
|
38
21
|
};
|
|
39
22
|
//# sourceMappingURL=useMessageHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMessageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/useMessageHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMessageHandler.d.ts","sourceRoot":"","sources":["../../src/handlers/useMessageHandler.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAElE,eAAO,MAAM,iBAAiB;cA0GJ,GAAG,CAAC,WAAW,EAAE,CAAC;;;6BA3DV;QAC9B,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,aAAa,CAAC;KACvB;kCAzCoC,MAAM;yBAiEf,MAAM,KAAG,WAAW,GAAG,SAAS;;6BAzD9B,WAAW;6BAqET,MAAM,SAAS,MAAM;;wBAQ1B,gBAAgB;yBAKf,MAAM;CAkBnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversationTree.d.ts","sourceRoot":"","sources":["../../src/helpers/conversationTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE3E,wBAAgB,eAAe,IAAI,gBAAgB,CAElD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,EAAE,CAkCnE;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAYvE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC,GACjE,IAAI,CAON;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAsBvF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAWvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/helpers/generateId.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,WAIzB"}
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { ChatService, type IChatService, type ChatConfig, type ChatMessage, type ChatResponse, type StreamEvent, } from './services';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export { AgentMessage, ChatConversation, ChatConversationLayout, ChatInput, MarkdownRenderer, PromptActionButton, PromptInput, PromptInputDisclaimer, UserMessage,
|
|
2
|
+
export { useMessageHandler, useMarkdownParser, provideChatKitLabels, useChatKitLabels, defaultChatKitLabels, CHAT_KIT_LABELS, } from './handlers';
|
|
3
|
+
export type { ChatKitLabels } from './handlers';
|
|
4
|
+
export { useChat } from './composables';
|
|
5
|
+
export type { ChatActions, ChatState, UseChatReturn } from './composables';
|
|
6
|
+
export { AgentMessage, ChatConversation, ChatConversationLayout, ChatInput, MarkdownRenderer, PromptActionButton, PromptInput, PromptInputDisclaimer, UserMessage, } from './components';
|
|
7
7
|
export type { ChatConversationLayoutProps, ChatConversationProps, MarkdownElementClasses, MarkdownRendererProps, UserMessageProps, } from './components';
|
|
8
8
|
export type { BaseMessage, ConversationTree, MessageRole, MessageStatus, TreeMessage, } from './types';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG3E,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,qBAAqB,EACrB,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { C } from "./ChatService-LogwJNxh.js";
|
|
2
|
-
import { u } from "./
|
|
2
|
+
import { u } from "./useMessageHandler-D7OdrrcB.js";
|
|
3
3
|
import { C as C2, d, p, u as u2, a } from "./useChatKitLabels-xZXcnxZZ.js";
|
|
4
|
-
import {
|
|
5
|
-
import { A, _, a as a2, b, c, d as d2, e, f, g
|
|
4
|
+
import { useChat } from "./composables/index.js";
|
|
5
|
+
import { A, _, a as a2, b, c, d as d2, e, f, g } from "./ChatInput.vue_vue_type_script_setup_true_lang-Cca7le4i.js";
|
|
6
6
|
export {
|
|
7
7
|
A as AgentMessage,
|
|
8
8
|
C2 as CHAT_KIT_LABELS,
|
|
@@ -15,11 +15,10 @@ export {
|
|
|
15
15
|
e as PromptInput,
|
|
16
16
|
f as PromptInputDisclaimer,
|
|
17
17
|
g as UserMessage,
|
|
18
|
-
h as defaultAgentMarkdownClasses,
|
|
19
18
|
d as defaultChatKitLabels,
|
|
20
19
|
p as provideChatKitLabels,
|
|
21
|
-
|
|
20
|
+
useChat,
|
|
22
21
|
u2 as useChatKitLabels,
|
|
23
22
|
a as useMarkdownParser,
|
|
24
|
-
|
|
23
|
+
u as useMessageHandler
|
|
25
24
|
};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { reactive, ref, computed, readonly } from "vue";
|
|
2
|
-
function generateId() {
|
|
3
|
-
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : String(Date.now());
|
|
4
|
-
}
|
|
5
2
|
function createEmptyTree() {
|
|
6
3
|
return { nodes: {}, rootId: null };
|
|
7
4
|
}
|
|
@@ -80,6 +77,9 @@ function navigate(tree, targetId) {
|
|
|
80
77
|
if (idx === -1) return;
|
|
81
78
|
parent.activeChildIndex = idx;
|
|
82
79
|
}
|
|
80
|
+
function generateId() {
|
|
81
|
+
return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : String(Date.now());
|
|
82
|
+
}
|
|
83
83
|
const useMessageHandler = () => {
|
|
84
84
|
const tree = reactive(createEmptyTree());
|
|
85
85
|
const currentUserMessage = ref("");
|
|
@@ -151,9 +151,6 @@ const useMessageHandler = () => {
|
|
|
151
151
|
status: node.status
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
|
-
function getLastUserMessage() {
|
|
155
|
-
return messages.value.findLast((m) => m.role === "user");
|
|
156
|
-
}
|
|
157
154
|
function updateMessageId(oldId, newId) {
|
|
158
155
|
updateNodeId(tree, oldId, newId);
|
|
159
156
|
}
|
|
@@ -164,27 +161,21 @@ const useMessageHandler = () => {
|
|
|
164
161
|
tree.nodes = incoming.nodes;
|
|
165
162
|
tree.rootId = incoming.rootId;
|
|
166
163
|
}
|
|
167
|
-
function addNode$1(node) {
|
|
168
|
-
addNode(tree, node);
|
|
169
|
-
}
|
|
170
164
|
function navigate$1(targetId) {
|
|
171
165
|
navigate(tree, targetId);
|
|
172
166
|
}
|
|
173
167
|
return {
|
|
174
168
|
messages,
|
|
175
169
|
currentUserMessage: readonly(currentUserMessage),
|
|
170
|
+
currentLeafId,
|
|
176
171
|
updateMessage,
|
|
177
172
|
setCurrentUserMessage,
|
|
178
173
|
getMessageById,
|
|
179
174
|
clearCurrentUserMessage,
|
|
180
175
|
commitUserMessage,
|
|
181
|
-
getLastUserMessage,
|
|
182
176
|
updateMessageId,
|
|
183
177
|
clearMessages,
|
|
184
|
-
currentLeafId,
|
|
185
|
-
tree: readonly(tree),
|
|
186
178
|
setTree,
|
|
187
|
-
addNode: addNode$1,
|
|
188
179
|
navigate: navigate$1
|
|
189
180
|
};
|
|
190
181
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aleph-alpha/chat-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Chat kit package for building chat interfaces with Vue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"remark-parse": "^11.0.0",
|
|
64
64
|
"remark-rehype": "^11.1.2",
|
|
65
65
|
"unified": "^11.0.5",
|
|
66
|
-
"@aleph-alpha/ui-library": "1.
|
|
66
|
+
"@aleph-alpha/ui-library": "1.21.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@storybook/addon-a11y": "10.2.17",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaultAgentMarkdownClasses.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/ChatConversation/defaultAgentMarkdownClasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,eAAO,MAAM,2BAA2B,EAAE,sBAgBzC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useChatKitLabels.d.ts","sourceRoot":"","sources":["../../src/composables/useChatKitLabels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,aAIlC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,aAAa,CAAC,CAA6B,CAAC;AAEnG,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5C,yFAAyF;AACzF,KAAK,cAAc,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,WAAW,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,aAAa,CAAC,CAAC;AAE9F;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAKjE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAAC,aAAa,CAAC,CAK7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMarkdownParser.d.ts","sourceRoot":"","sources":["../../src/composables/useMarkdownParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAW,MAAM,KAAK,CAAC;AAC/D,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAiBtD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;;EAwBrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conversationTree.d.ts","sourceRoot":"","sources":["../../src/handlers/conversationTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE3E,wBAAgB,eAAe,IAAI,gBAAgB,CAElD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,gBAAgB,GAAG,WAAW,EAAE,CAkCnE;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAYvE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,gBAAgB,EACtB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC,GACjE,IAAI,CAON;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAsBvF;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAWvE"}
|
package/dist/useChat-CtN_iBTc.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|