@aleph-alpha/chat-kit 3.3.0 → 5.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-BAcBFs6I.js → CkHistory.vue_vue_type_script_setup_true_lang-Bp9hXdH6.js} +452 -348
- 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 +36 -14
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts +14 -13
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/CkAgentMessage.vue.d.ts +8 -7
- package/dist/components/base/CkAgentMessage/CkAgentMessage.vue.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/types.d.ts +16 -5
- package/dist/components/base/CkAgentMessage/types.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessageHeader/CkAgentMessageHeader.stories.d.ts +16 -0
- package/dist/components/base/CkAgentMessageHeader/CkAgentMessageHeader.stories.d.ts.map +1 -0
- package/dist/components/base/CkAgentMessageHeader/CkAgentMessageHeader.vue.d.ts +21 -0
- package/dist/components/base/CkAgentMessageHeader/CkAgentMessageHeader.vue.d.ts.map +1 -0
- package/dist/components/base/CkAgentMessageHeader/index.d.ts +3 -0
- package/dist/components/base/CkAgentMessageHeader/index.d.ts.map +1 -0
- package/dist/components/base/CkAgentMessageHeader/types.d.ts +22 -0
- package/dist/components/base/CkAgentMessageHeader/types.d.ts.map +1 -0
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts +6 -0
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts.map +1 -1
- package/dist/components/base/CkCitation/CkCitation.vue.d.ts.map +1 -1
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts +5 -4
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts.map +1 -1
- package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts.map +1 -1
- 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/CkFeedbackButton/types.d.ts +1 -1
- package/dist/components/base/CkFeedbackDialog/types.d.ts +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts +15 -4
- package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts.map +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +2 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts.map +1 -1
- package/dist/components/base/CkFileItemsList/types.d.ts +17 -4
- package/dist/components/base/CkFileItemsList/types.d.ts.map +1 -1
- package/dist/components/base/CkHeaderActivityButton/CkHeaderActivityButton.stories.d.ts +19 -0
- package/dist/components/base/CkHeaderActivityButton/CkHeaderActivityButton.stories.d.ts.map +1 -0
- package/dist/components/base/CkHeaderActivityButton/CkHeaderActivityButton.vue.d.ts +22 -0
- package/dist/components/base/CkHeaderActivityButton/CkHeaderActivityButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkHeaderActivityButton/index.d.ts +3 -0
- package/dist/components/base/CkHeaderActivityButton/index.d.ts.map +1 -0
- package/dist/components/base/CkHeaderActivityButton/types.d.ts +36 -0
- package/dist/components/base/CkHeaderActivityButton/types.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/CkPromptInput/CkPromptInput.stories.d.ts +6 -6
- package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInput/types.d.ts +4 -4
- package/dist/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue.d.ts.map +1 -1
- package/dist/components/base/CkPromptInputDisclaimer/types.d.ts +1 -1
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts +1 -1
- package/dist/components/base/CkPromptSendButton/types.d.ts +1 -1
- package/dist/components/base/CkPromptStopButton/types.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 +7 -2
- 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/CkConversation.vue.d.ts +13 -1
- package/dist/components/composed/CkConversation/CkConversation.vue.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/types.d.ts +1 -1
- package/dist/components/composed/index.d.ts +0 -1
- package/dist/components/composed/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +26 -24
- package/dist/composables/index.js +1 -1
- package/dist/handlers/index.js +2 -2
- package/dist/handlers/useChatKitLabels.d.ts +2 -0
- package/dist/handlers/useChatKitLabels.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/{index-C6njJ8EB.js → index-CyrVnbS9.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -28
- package/dist/{useChatKitLabels-BM2I7-9o.js → useChatKitLabels-zMFV7aEz.js} +1 -0
- package/dist/{useMessageHandler-CMdy-lm0.js → useMessageHandler-N50Yj-NU.js} +45 -7
- package/package.json +3 -3
- package/src/adapters/responses-api.spec.ts +52 -5
- package/src/adapters/responses-api.ts +26 -7
- package/src/components/base/CkAgentMessage/CkAgentMessage.spec.ts +12 -17
- package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +124 -113
- package/src/components/base/CkAgentMessage/CkAgentMessage.vue +18 -16
- package/src/components/base/CkAgentMessage/types.ts +16 -5
- package/src/components/base/CkAgentMessageHeader/CkAgentMessageHeader.spec.ts +64 -0
- package/src/components/base/CkAgentMessageHeader/CkAgentMessageHeader.stories.ts +90 -0
- package/src/components/base/CkAgentMessageHeader/CkAgentMessageHeader.vue +47 -0
- package/src/components/base/CkAgentMessageHeader/index.ts +2 -0
- package/src/components/base/CkAgentMessageHeader/types.ts +21 -0
- package/src/components/base/CkCitation/CkCitation.stories.ts +12 -0
- package/src/components/base/CkCitation/CkCitation.vue +34 -9
- package/src/components/base/CkCitationCard/CkCitationCard.stories.ts +5 -4
- package/src/components/base/CkCitationCard/CkCitationCard.vue +2 -2
- package/src/components/base/CkConversationLayout/CkConversationLayout.vue +1 -1
- 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/CkFileItemsList/CkFileItemsList.spec.ts +88 -13
- package/src/components/base/CkFileItemsList/CkFileItemsList.stories.ts +61 -13
- package/src/components/base/CkFileItemsList/CkFileItemsList.vue +153 -110
- package/src/components/base/CkFileItemsList/types.ts +17 -4
- package/src/components/base/CkHeaderActivityButton/CkHeaderActivityButton.spec.ts +50 -0
- package/src/components/base/CkHeaderActivityButton/CkHeaderActivityButton.stories.ts +102 -0
- package/src/components/base/CkHeaderActivityButton/CkHeaderActivityButton.vue +39 -0
- package/src/components/base/CkHeaderActivityButton/index.ts +2 -0
- package/src/components/base/CkHeaderActivityButton/types.ts +36 -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/CkPromptInput/CkPromptInput.spec.ts +88 -0
- package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +6 -6
- package/src/components/base/CkPromptInput/CkPromptInput.vue +63 -12
- package/src/components/base/CkPromptInput/types.ts +4 -4
- package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.spec.ts +1 -1
- package/src/components/base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue +1 -1
- package/src/components/base/CkPromptInputDisclaimer/types.ts +1 -1
- package/src/components/base/CkPromptSendButton/types.ts +1 -1
- package/src/components/base/CkPromptStopButton/types.ts +1 -1
- 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 +10 -2
- package/src/components/composed/CkConversation/CkConversation.spec.ts +81 -6
- package/src/components/composed/CkConversation/CkConversation.stories.ts +6 -6
- package/src/components/composed/CkConversation/CkConversation.vue +80 -37
- package/src/components/composed/CkConversation/types.ts +1 -1
- package/src/components/composed/index.ts +0 -1
- package/src/components/index.ts +9 -3
- package/src/handlers/useChatKitLabels.spec.ts +1 -0
- package/src/handlers/useChatKitLabels.ts +3 -0
- 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/index.ts +8 -3
- 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/dist/components/composed/CkInput/CkInput.stories.d.ts +0 -43
- package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +0 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +0 -50
- package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +0 -1
- package/dist/components/composed/CkInput/index.d.ts +0 -3
- package/dist/components/composed/CkInput/index.d.ts.map +0 -1
- package/dist/components/composed/CkInput/types.d.ts +0 -55
- package/dist/components/composed/CkInput/types.d.ts.map +0 -1
- package/src/components/base/CkCopyMessageActionButton/index.ts +0 -2
- package/src/components/base/CkMessageActionButton/index.ts +0 -2
- package/src/components/composed/CkInput/CkInput.spec.ts +0 -191
- package/src/components/composed/CkInput/CkInput.stories.ts +0 -434
- package/src/components/composed/CkInput/CkInput.vue +0 -106
- package/src/components/composed/CkInput/index.ts +0 -2
- package/src/components/composed/CkInput/types.ts +0 -55
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
addNode as treeAddNode,
|
|
4
4
|
createEmptyTree,
|
|
5
5
|
cutBranchAfter as treeCutBranchAfter,
|
|
6
|
+
cutBranchAt as treeCutBranchAt,
|
|
6
7
|
getLinearPath,
|
|
7
8
|
navigate as treeNavigate,
|
|
8
9
|
updateNode,
|
|
@@ -30,6 +31,19 @@ export const useMessageHandler = () => {
|
|
|
30
31
|
return list.length > 0 ? list[list.length - 1].id : null;
|
|
31
32
|
});
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the parent a new node should hang off. When an explicit
|
|
36
|
+
* `parentId` is given it must reference an existing node; otherwise the
|
|
37
|
+
* current leaf is used so messages append to the active branch.
|
|
38
|
+
*/
|
|
39
|
+
function resolveParentId(parentId?: string): string | null {
|
|
40
|
+
if (parentId === undefined) return currentLeafId.value;
|
|
41
|
+
if (!tree.nodes[parentId]) {
|
|
42
|
+
throw new Error(`Unknown parent message id: ${parentId}`);
|
|
43
|
+
}
|
|
44
|
+
return parentId;
|
|
45
|
+
}
|
|
46
|
+
|
|
33
47
|
function setCurrentUserMessage(text: string) {
|
|
34
48
|
currentUserMessage.value = text;
|
|
35
49
|
}
|
|
@@ -38,20 +52,31 @@ export const useMessageHandler = () => {
|
|
|
38
52
|
currentUserMessage.value = '';
|
|
39
53
|
}
|
|
40
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Commit the pending user message as a new node.
|
|
57
|
+
*
|
|
58
|
+
* By default the node is appended to the current leaf. Pass `parentId` to
|
|
59
|
+
* branch off an arbitrary message instead: the new node becomes a sibling
|
|
60
|
+
* of that parent's existing children, the parent's `childrenIds` gains the
|
|
61
|
+
* new id, and the branch is made active.
|
|
62
|
+
*/
|
|
41
63
|
function commitUserMessage(opts?: {
|
|
42
64
|
metadata?: MessageMetadata;
|
|
65
|
+
parentId?: string;
|
|
43
66
|
}): BaseMessage {
|
|
44
67
|
const id = generateId();
|
|
45
68
|
const text = currentUserMessage.value.trim();
|
|
46
69
|
if (!text) throw new Error('No message');
|
|
47
70
|
|
|
71
|
+
const parentId = resolveParentId(opts?.parentId);
|
|
72
|
+
|
|
48
73
|
const content: MessageContent[] = [
|
|
49
74
|
{ type: 'text', id: generateId(), text, status: 'completed' },
|
|
50
75
|
];
|
|
51
76
|
|
|
52
77
|
const node: TreeMessage = {
|
|
53
78
|
id,
|
|
54
|
-
parentId
|
|
79
|
+
parentId,
|
|
55
80
|
childrenIds: [],
|
|
56
81
|
activeChildIndex: 0,
|
|
57
82
|
role: 'user',
|
|
@@ -75,12 +100,20 @@ export const useMessageHandler = () => {
|
|
|
75
100
|
return base;
|
|
76
101
|
}
|
|
77
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Upsert a message by id. When the node does not yet exist it is created;
|
|
105
|
+
* pass `parentId` to branch the new node off an arbitrary message instead
|
|
106
|
+
* of the current leaf (the parent's `childrenIds` is updated and the new
|
|
107
|
+
* branch is made active). `parentId` is ignored when the node already
|
|
108
|
+
* exists.
|
|
109
|
+
*/
|
|
78
110
|
function updateMessage(message: {
|
|
79
111
|
id: string;
|
|
80
112
|
content: MessageContent[];
|
|
81
113
|
role: MessageRole;
|
|
82
114
|
status: MessageStatus;
|
|
83
115
|
metadata?: MessageMetadata;
|
|
116
|
+
parentId?: string;
|
|
84
117
|
}) {
|
|
85
118
|
const existing = tree.nodes[message.id];
|
|
86
119
|
|
|
@@ -96,7 +129,7 @@ export const useMessageHandler = () => {
|
|
|
96
129
|
} else {
|
|
97
130
|
const node: TreeMessage = {
|
|
98
131
|
id: message.id,
|
|
99
|
-
parentId:
|
|
132
|
+
parentId: resolveParentId(message.parentId),
|
|
100
133
|
childrenIds: [],
|
|
101
134
|
activeChildIndex: 0,
|
|
102
135
|
role: message.role,
|
|
@@ -159,6 +192,19 @@ export const useMessageHandler = () => {
|
|
|
159
192
|
treeCutBranchAfter(tree, messageId);
|
|
160
193
|
}
|
|
161
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Drop the message with `messageId` and its whole subtree, leaving sibling
|
|
197
|
+
* branches intact (the parent's active branch is clamped to a survivor).
|
|
198
|
+
* Use to discard one answer among several without cropping the others.
|
|
199
|
+
*/
|
|
200
|
+
function cutBranchAt(messageId: string) {
|
|
201
|
+
treeCutBranchAt(tree, messageId);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function getTree() {
|
|
205
|
+
return readonly(tree);
|
|
206
|
+
}
|
|
207
|
+
|
|
162
208
|
return {
|
|
163
209
|
messages: messages as Ref<BaseMessage[]>,
|
|
164
210
|
currentUserMessage: readonly(currentUserMessage),
|
|
@@ -173,5 +219,7 @@ export const useMessageHandler = () => {
|
|
|
173
219
|
setTree,
|
|
174
220
|
navigate,
|
|
175
221
|
cutBranchAfter,
|
|
222
|
+
cutBranchAt,
|
|
223
|
+
getTree,
|
|
176
224
|
};
|
|
177
225
|
};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
addNode,
|
|
9
9
|
createEmptyTree,
|
|
10
10
|
cutBranchAfter,
|
|
11
|
+
cutBranchAt,
|
|
11
12
|
getLinearPath,
|
|
12
13
|
navigate,
|
|
13
14
|
updateNode,
|
|
@@ -519,6 +520,125 @@ describe('cutBranchAfter', () => {
|
|
|
519
520
|
});
|
|
520
521
|
});
|
|
521
522
|
|
|
523
|
+
describe('cutBranchAt', () => {
|
|
524
|
+
it('removes the target node and its entire subtree', () => {
|
|
525
|
+
const tree = makeBranchingTree();
|
|
526
|
+
|
|
527
|
+
cutBranchAt(tree, 'a1');
|
|
528
|
+
|
|
529
|
+
expect(tree.nodes.a1).toBeUndefined();
|
|
530
|
+
expect(tree.nodes.u2).toBeUndefined();
|
|
531
|
+
expect(tree.nodes.a2).toBeUndefined();
|
|
532
|
+
expect(tree.nodes.a3).toBeUndefined();
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it('leaves sibling branches intact and unlinks from the parent', () => {
|
|
536
|
+
const tree = makeBranchingTree();
|
|
537
|
+
|
|
538
|
+
cutBranchAt(tree, 'a1');
|
|
539
|
+
|
|
540
|
+
expect(tree.nodes.a1b).toBeDefined();
|
|
541
|
+
expect(tree.nodes.u3).toBeDefined();
|
|
542
|
+
expect(tree.nodes.u1.childrenIds).toEqual(['a1b']);
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
it('clamps the parent activeChildIndex to a surviving sibling', () => {
|
|
546
|
+
const tree = makeBranchingTree();
|
|
547
|
+
// u2 → [a2, a3] with a3 active; removing a3 must not leave a dangling index.
|
|
548
|
+
tree.nodes.u2.activeChildIndex = 1;
|
|
549
|
+
|
|
550
|
+
cutBranchAt(tree, 'a3');
|
|
551
|
+
|
|
552
|
+
expect(tree.nodes.u2.childrenIds).toEqual(['a2']);
|
|
553
|
+
expect(tree.nodes.u2.activeChildIndex).toBe(0);
|
|
554
|
+
expect(getLinearPath(tree).map((m) => m.id)).toEqual([
|
|
555
|
+
'u1',
|
|
556
|
+
'a1',
|
|
557
|
+
'u2',
|
|
558
|
+
'a2',
|
|
559
|
+
]);
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// Parent with three sibling branches; needs ≥3 so removing an earlier
|
|
563
|
+
// sibling leaves the active index in-bounds (the clamp alone wouldn't catch
|
|
564
|
+
// a stale index, only an out-of-range one).
|
|
565
|
+
function makeThreeSiblingTree(): ConversationTree {
|
|
566
|
+
return makeTree(
|
|
567
|
+
{
|
|
568
|
+
p: makeTreeMessage({ id: 'p', role: 'user', content: [text('Q')] }),
|
|
569
|
+
cA: makeTreeMessage({
|
|
570
|
+
id: 'cA',
|
|
571
|
+
parentId: 'p',
|
|
572
|
+
role: 'assistant',
|
|
573
|
+
content: [text('A')],
|
|
574
|
+
}),
|
|
575
|
+
cB: makeTreeMessage({
|
|
576
|
+
id: 'cB',
|
|
577
|
+
parentId: 'p',
|
|
578
|
+
role: 'assistant',
|
|
579
|
+
content: [text('B')],
|
|
580
|
+
}),
|
|
581
|
+
cC: makeTreeMessage({
|
|
582
|
+
id: 'cC',
|
|
583
|
+
parentId: 'p',
|
|
584
|
+
role: 'assistant',
|
|
585
|
+
content: [text('C')],
|
|
586
|
+
}),
|
|
587
|
+
},
|
|
588
|
+
'p',
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
it('keeps the active branch on the same child when an earlier sibling is removed', () => {
|
|
593
|
+
const tree = makeThreeSiblingTree();
|
|
594
|
+
tree.nodes.p.activeChildIndex = 1; // cB active
|
|
595
|
+
// Removing cA shifts cB/cC down one slot; the active pointer must follow.
|
|
596
|
+
cutBranchAt(tree, 'cA');
|
|
597
|
+
|
|
598
|
+
expect(tree.nodes.p.childrenIds).toEqual(['cB', 'cC']);
|
|
599
|
+
expect(tree.nodes.p.activeChildIndex).toBe(0);
|
|
600
|
+
expect(getLinearPath(tree).map((m) => m.id)).toEqual(['p', 'cB']);
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
it('leaves the active index unchanged when a later sibling is removed', () => {
|
|
604
|
+
const tree = makeThreeSiblingTree();
|
|
605
|
+
tree.nodes.p.activeChildIndex = 0; // cA active
|
|
606
|
+
cutBranchAt(tree, 'cC');
|
|
607
|
+
|
|
608
|
+
expect(tree.nodes.p.childrenIds).toEqual(['cA', 'cB']);
|
|
609
|
+
expect(tree.nodes.p.activeChildIndex).toBe(0);
|
|
610
|
+
expect(getLinearPath(tree).map((m) => m.id)).toEqual(['p', 'cA']);
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
it('falls through to the next sibling when the active child itself is removed', () => {
|
|
614
|
+
const tree = makeThreeSiblingTree();
|
|
615
|
+
tree.nodes.p.activeChildIndex = 0; // cA active
|
|
616
|
+
cutBranchAt(tree, 'cA');
|
|
617
|
+
|
|
618
|
+
expect(tree.nodes.p.childrenIds).toEqual(['cB', 'cC']);
|
|
619
|
+
expect(tree.nodes.p.activeChildIndex).toBe(0);
|
|
620
|
+
expect(getLinearPath(tree).map((m) => m.id)).toEqual(['p', 'cB']);
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
it('clears the tree when the root is removed', () => {
|
|
624
|
+
const tree = makeBranchingTree();
|
|
625
|
+
|
|
626
|
+
cutBranchAt(tree, 'u1');
|
|
627
|
+
|
|
628
|
+
expect(tree.nodes).toEqual({});
|
|
629
|
+
expect(tree.rootId).toBeNull();
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
it('is a no-op for a nonexistent id', () => {
|
|
633
|
+
const tree = makeBranchingTree();
|
|
634
|
+
const before = Object.keys(tree.nodes).sort();
|
|
635
|
+
|
|
636
|
+
cutBranchAt(tree, 'nonexistent');
|
|
637
|
+
|
|
638
|
+
expect(Object.keys(tree.nodes).sort()).toEqual(before);
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
|
|
522
642
|
describe('integration: full branching scenario', () => {
|
|
523
643
|
it('simulates send → regenerate → navigate workflow', () => {
|
|
524
644
|
const tree = createEmptyTree();
|
|
@@ -105,6 +105,21 @@ export function updateNodeId(
|
|
|
105
105
|
if (tree.rootId === oldId) tree.rootId = newId;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Delete the given node ids and every descendant beneath them from
|
|
110
|
+
* `tree.nodes`. Does not touch parent links — callers fix those up.
|
|
111
|
+
*/
|
|
112
|
+
function deleteSubtrees(tree: ConversationTree, ids: readonly string[]): void {
|
|
113
|
+
const stack: string[] = [...ids];
|
|
114
|
+
while (stack.length > 0) {
|
|
115
|
+
const currentId = stack.pop() as string;
|
|
116
|
+
const current = tree.nodes[currentId];
|
|
117
|
+
if (!current) continue;
|
|
118
|
+
stack.push(...current.childrenIds);
|
|
119
|
+
delete tree.nodes[currentId];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
108
123
|
/**
|
|
109
124
|
* Remove every descendant of the node with the given id, keeping the node
|
|
110
125
|
* itself intact. The node's `childrenIds` is cleared and `activeChildIndex`
|
|
@@ -117,19 +132,53 @@ export function cutBranchAfter(tree: ConversationTree, id: string): void {
|
|
|
117
132
|
const node = tree.nodes[id];
|
|
118
133
|
if (!node) return;
|
|
119
134
|
|
|
120
|
-
|
|
121
|
-
while (stack.length > 0) {
|
|
122
|
-
const currentId = stack.pop() as string;
|
|
123
|
-
const current = tree.nodes[currentId];
|
|
124
|
-
if (!current) continue;
|
|
125
|
-
stack.push(...current.childrenIds);
|
|
126
|
-
delete tree.nodes[currentId];
|
|
127
|
-
}
|
|
135
|
+
deleteSubtrees(tree, node.childrenIds);
|
|
128
136
|
|
|
129
137
|
node.childrenIds = [];
|
|
130
138
|
node.activeChildIndex = 0;
|
|
131
139
|
}
|
|
132
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Remove the node with the given id *and* its entire subtree, then unlink it
|
|
143
|
+
* from its parent. Unlike {@link cutBranchAfter} (which keeps the target and
|
|
144
|
+
* drops only its descendants), this drops the target branch as a whole while
|
|
145
|
+
* leaving sibling branches intact — use it to discard one answer among several
|
|
146
|
+
* (e.g. an interrupted regenerate) without cropping the others.
|
|
147
|
+
*
|
|
148
|
+
* The parent's `activeChildIndex` is clamped to a remaining sibling so the
|
|
149
|
+
* active path stays valid. Removing the root clears the tree.
|
|
150
|
+
*
|
|
151
|
+
* Prefer {@link cutBranchAfter} when it fits the case: unlinking here scans
|
|
152
|
+
* and splices the parent's `childrenIds` (O(siblings)), whereas
|
|
153
|
+
* `cutBranchAfter` only clears the target's own `childrenIds`.
|
|
154
|
+
*/
|
|
155
|
+
export function cutBranchAt(tree: ConversationTree, id: string): void {
|
|
156
|
+
const node = tree.nodes[id];
|
|
157
|
+
if (!node) return;
|
|
158
|
+
|
|
159
|
+
deleteSubtrees(tree, [id]);
|
|
160
|
+
|
|
161
|
+
if (node.parentId === null) {
|
|
162
|
+
if (tree.rootId === id) tree.rootId = null;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const parent = tree.nodes[node.parentId];
|
|
167
|
+
if (!parent) return;
|
|
168
|
+
|
|
169
|
+
const idx = parent.childrenIds.indexOf(id);
|
|
170
|
+
if (idx !== -1) {
|
|
171
|
+
parent.childrenIds.splice(idx, 1);
|
|
172
|
+
// Removing a sibling positioned before the active one shifts every later
|
|
173
|
+
// child's index down by one; decrement so the active branch keeps pointing
|
|
174
|
+
// at the same child rather than silently jumping to its neighbour.
|
|
175
|
+
if (idx < parent.activeChildIndex) parent.activeChildIndex -= 1;
|
|
176
|
+
}
|
|
177
|
+
if (parent.activeChildIndex >= parent.childrenIds.length) {
|
|
178
|
+
parent.activeChildIndex = Math.max(0, parent.childrenIds.length - 1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
133
182
|
/**
|
|
134
183
|
* Navigate to a different branch by updating the parent's activeChildIndex
|
|
135
184
|
* to point at the target sibling.
|
package/src/index.ts
CHANGED
|
@@ -63,11 +63,13 @@ export type {
|
|
|
63
63
|
// Components
|
|
64
64
|
export {
|
|
65
65
|
CkAgentMessage,
|
|
66
|
+
CkAgentMessageHeader,
|
|
67
|
+
CkHeaderActivityButton,
|
|
66
68
|
CkCitation,
|
|
67
69
|
CkCitationCard,
|
|
68
70
|
CkConversation,
|
|
69
71
|
CkConversationLayout,
|
|
70
|
-
|
|
72
|
+
CkCopyMessageButton,
|
|
71
73
|
CkDropZoneOverlay,
|
|
72
74
|
CkFeedbackButton,
|
|
73
75
|
CkFeedbackDialog,
|
|
@@ -75,20 +77,23 @@ export {
|
|
|
75
77
|
CkHistory,
|
|
76
78
|
CkHistoryItem,
|
|
77
79
|
CkHistoryWrapper,
|
|
78
|
-
CkInput,
|
|
79
80
|
CkMarkdownRenderer,
|
|
80
|
-
|
|
81
|
+
CkMessageButton,
|
|
81
82
|
CkModelSelector,
|
|
82
83
|
CkPromptSendButton,
|
|
83
84
|
CkPromptMenuButton,
|
|
84
85
|
CkPromptStopButton,
|
|
85
86
|
CkPromptInput,
|
|
86
87
|
CkPromptInputDisclaimer,
|
|
88
|
+
CkRegenerateMessageButton,
|
|
87
89
|
CkSendIcon,
|
|
88
90
|
CkStopIcon,
|
|
89
91
|
CkUserMessage,
|
|
90
92
|
} from './components';
|
|
91
93
|
export type {
|
|
94
|
+
CkAgentMessageHeaderProps,
|
|
95
|
+
CkHeaderActivityButtonProps,
|
|
96
|
+
CkHeaderActivityButtonEmits,
|
|
92
97
|
CkCitationProps,
|
|
93
98
|
CkCitationEmits,
|
|
94
99
|
CkCitationSource,
|
package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkCopyMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,yBAAyB,CAwBhD,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAkBnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC"}
|
package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkCopyMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue"],"names":[],"mappings":"AAkHA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AA+M9D,QAAA,MAAM,YAAY;;iBA7LW,OAAO;;;;iBAAP,OAAO;;;;;;;;6EAiMlC,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageActionButton/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,8BAA8B;IAC7C,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,8BAA8B;IAC7C,2EAA2E;IAC3E,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAClD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkMessageActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,qBAAqB,CAqB5C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAanC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkMessageActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/CkMessageActionButton.vue"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAwD1D,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC/E,mBAAmB,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMessageActionButton/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import CkInput from './CkInput.vue';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
-
declare const meta: Meta<typeof CkInput>;
|
|
4
|
-
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof meta>;
|
|
6
|
-
/**
|
|
7
|
-
* Default chat input with disclaimer and the built-in send button.
|
|
8
|
-
* Use as the primary way to let users submit a prompt to the assistant.
|
|
9
|
-
*/
|
|
10
|
-
export declare const Default: Story;
|
|
11
|
-
/**
|
|
12
|
-
* Adds a mode toggle (Express/Smart) to the left side of the toolbar via
|
|
13
|
-
* `#toolbar-left`. Use when the user needs to switch between assistant
|
|
14
|
-
* presets or capabilities before submitting.
|
|
15
|
-
*/
|
|
16
|
-
export declare const WithModeToggle: Story;
|
|
17
|
-
/**
|
|
18
|
-
* End-to-end example: mode toggle on the left, attachment button + custom
|
|
19
|
-
* send button on the right, and a disclaimer underneath. Use as a reference
|
|
20
|
-
* for a production-ready chat compose UI.
|
|
21
|
-
*/
|
|
22
|
-
export declare const FullExample: Story;
|
|
23
|
-
/**
|
|
24
|
-
* Disabled state — the textarea is read-only and the send button is inactive.
|
|
25
|
-
* Use while waiting for an upstream action to resolve.
|
|
26
|
-
*/
|
|
27
|
-
export declare const Disabled: Story;
|
|
28
|
-
/**
|
|
29
|
-
* Loading state — shown while the assistant is generating a reply. The
|
|
30
|
-
* send button displays a spinner and the input is blocked.
|
|
31
|
-
*/
|
|
32
|
-
export declare const Loading: Story;
|
|
33
|
-
/**
|
|
34
|
-
* Demonstrates the textarea's auto-grow behavior with multi-paragraph content.
|
|
35
|
-
* Use when validating how the input handles long prompts.
|
|
36
|
-
*/
|
|
37
|
-
export declare const WithLongText: Story;
|
|
38
|
-
/**
|
|
39
|
-
* Narrow viewport preview (≈320px). Use to verify the input stays usable on
|
|
40
|
-
* small screens.
|
|
41
|
-
*/
|
|
42
|
-
export declare const MobileWidth: Story;
|
|
43
|
-
//# sourceMappingURL=CkInput.stories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkInput.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkInput/CkInput.stories.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAM3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAqC9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqGnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAerB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAgD5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,KA2FzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAiBtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KA2BrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAuB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { CkInputProps } from './types';
|
|
2
|
-
declare function focus(): void;
|
|
3
|
-
declare function submit(): void;
|
|
4
|
-
declare var __VLS_13: {}, __VLS_16: {}, __VLS_19: {
|
|
5
|
-
submit: () => void;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
isEmpty: boolean;
|
|
8
|
-
}, __VLS_29: {}, __VLS_42: {}, __VLS_50: {};
|
|
9
|
-
type __VLS_Slots = {} & {
|
|
10
|
-
'toolbar-top'?: (props: typeof __VLS_13) => any;
|
|
11
|
-
} & {
|
|
12
|
-
'toolbar-left'?: (props: typeof __VLS_16) => any;
|
|
13
|
-
} & {
|
|
14
|
-
'toolbar-right'?: (props: typeof __VLS_19) => any;
|
|
15
|
-
} & {
|
|
16
|
-
'stop-icon'?: (props: typeof __VLS_29) => any;
|
|
17
|
-
} & {
|
|
18
|
-
'send-icon'?: (props: typeof __VLS_42) => any;
|
|
19
|
-
} & {
|
|
20
|
-
footer?: (props: typeof __VLS_50) => any;
|
|
21
|
-
};
|
|
22
|
-
declare const __VLS_base: import("vue").DefineComponent<CkInputProps, {
|
|
23
|
-
focus: typeof focus;
|
|
24
|
-
submit: typeof submit;
|
|
25
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
|
-
stop: () => any;
|
|
27
|
-
submit: (value: string) => any;
|
|
28
|
-
"update:modelValue": (value: string) => any;
|
|
29
|
-
}, string, import("vue").PublicProps, Readonly<CkInputProps> & Readonly<{
|
|
30
|
-
onStop?: (() => any) | undefined;
|
|
31
|
-
onSubmit?: ((value: string) => any) | undefined;
|
|
32
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
33
|
-
}>, {
|
|
34
|
-
ariaLabel: string;
|
|
35
|
-
loading: boolean;
|
|
36
|
-
disabled: boolean;
|
|
37
|
-
modelValue: string;
|
|
38
|
-
placeholder: string;
|
|
39
|
-
stopAriaLabel: string;
|
|
40
|
-
disclaimer: string;
|
|
41
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
43
|
-
declare const _default: typeof __VLS_export;
|
|
44
|
-
export default _default;
|
|
45
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
46
|
-
new (): {
|
|
47
|
-
$slots: S;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=CkInput.vue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CkInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkInput/CkInput.vue"],"names":[],"mappings":"AAmHA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwC5C,iBAAS,KAAK,IAAI,IAAI,CAErB;AAED,iBAAS,MAAM,IAAI,IAAI,CAEtB;AA2KD,QAAA,IAAuB,QAAQ,IAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ;;;;CAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AACtJ,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACnD;IAAE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACpD;IAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACrD;IAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACjD;IAAE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACjD;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAO/C,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;6EAKd,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AACnD,mBAAmB,SAAS,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drop-in chat input: combines `CkPromptInput`, a `CkPromptSendButton` send
|
|
3
|
-
* button, and a `CkPromptInputDisclaimer`. Supports `v-model`, loading and
|
|
4
|
-
* disabled states, and slots to customize the toolbar and footer.
|
|
5
|
-
*
|
|
6
|
-
* @category Form Inputs
|
|
7
|
-
* @useCases chat compose input, prompt box with send button, llm input with disclaimer, quick-start chat input, turnkey chat input
|
|
8
|
-
* @keywords input, prompt, chat, send, compose, disclaimer, loading, v-model, textarea
|
|
9
|
-
* @related CkPromptInput, CkPromptSendButton, CkPromptInputDisclaimer, CkConversation
|
|
10
|
-
*/
|
|
11
|
-
export interface CkInputProps {
|
|
12
|
-
/**
|
|
13
|
-
* Current value of the input. Supports `v-model`.
|
|
14
|
-
* @default ''
|
|
15
|
-
*/
|
|
16
|
-
modelValue?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Placeholder shown when the input is empty.
|
|
19
|
-
* @default 'Ask me anything'
|
|
20
|
-
*/
|
|
21
|
-
placeholder?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Whether the input is disabled. Also implied when `loading` is `true`.
|
|
24
|
-
* @default false
|
|
25
|
-
*/
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Shows a spinner in the send button and disables the input while a reply
|
|
29
|
-
* is being generated.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
loading?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Accessible label for the input.
|
|
35
|
-
* @default 'Chat message input'
|
|
36
|
-
*/
|
|
37
|
-
ariaLabel?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Accessible label for the stop generating button.
|
|
40
|
-
* @default 'Stop generating'
|
|
41
|
-
*/
|
|
42
|
-
stopAriaLabel?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Optional disclaimer text rendered below the input via
|
|
45
|
-
* `CkPromptInputDisclaimer`. Omit to render no disclaimer.
|
|
46
|
-
*/
|
|
47
|
-
disclaimer?: string;
|
|
48
|
-
}
|
|
49
|
-
export interface CkInputEmits {
|
|
50
|
-
/** Emitted on every keystroke. */
|
|
51
|
-
(e: 'update:modelValue', value: string): void;
|
|
52
|
-
/** Emitted when the user submits via Enter or the send button. */
|
|
53
|
-
(e: 'submit', value: string): void;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/composed/CkInput/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,CAAC,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,kEAAkE;IAClE,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC"}
|