@aleph-alpha/chat-kit 1.11.1 → 1.13.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-C1Jnn1fK.js → CkInput.vue_vue_type_script_setup_true_lang-DCZTSiBj.js} +371 -135
- package/dist/adapters/responses-api.d.ts +54 -5
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +43 -9
- package/dist/chat-kit.css +19 -0
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.d.ts +30 -0
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.d.ts.map +1 -0
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts +13 -0
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts.map +1 -0
- package/dist/components/base/CkFeedbackDialog/index.d.ts +3 -0
- package/dist/components/base/CkFeedbackDialog/index.d.ts.map +1 -0
- package/dist/components/base/CkFeedbackDialog/types.d.ts +152 -0
- package/dist/components/base/CkFeedbackDialog/types.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +2 -0
- package/dist/components/base/index.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 +16 -15
- package/dist/composables/index.js +1 -1
- package/dist/handlers/index.js +2 -2
- package/dist/handlers/useChatKitLabels.d.ts +18 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/handlers/useMessageHandler.d.ts +6 -2
- package/dist/handlers/useMessageHandler.d.ts.map +1 -1
- package/dist/helpers/conversationTree.d.ts +10 -1
- package/dist/helpers/conversationTree.d.ts.map +1 -1
- package/dist/{index-BLq6_Lt2.js → index-Ct5hD214.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -18
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{useChatKitLabels-ftC52m7f.js → useChatKitLabels-DeHxZG2a.js} +9 -0
- package/dist/{useMessageHandler-ZRC-gIOJ.js → useMessageHandler-CMdy-lm0.js} +36 -9
- package/package.json +5 -5
- package/src/adapters/responses-api.spec.ts +70 -0
- package/src/adapters/responses-api.ts +123 -12
- package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.spec.ts +177 -0
- package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.ts +258 -0
- package/src/components/base/CkFeedbackDialog/CkFeedbackDialog.vue +288 -0
- package/src/components/base/CkFeedbackDialog/index.ts +2 -0
- package/src/components/base/CkFeedbackDialog/types.ts +155 -0
- package/src/components/base/index.ts +8 -0
- package/src/components/index.ts +6 -0
- package/src/handlers/useChatKitLabels.spec.ts +11 -0
- package/src/handlers/useChatKitLabels.ts +29 -0
- package/src/handlers/useMessageHandler.spec.ts +214 -0
- package/src/handlers/useMessageHandler.ts +28 -3
- package/src/helpers/conversationTree.spec.ts +134 -0
- package/src/helpers/conversationTree.ts +32 -1
- package/src/index.ts +7 -0
- package/src/types.ts +15 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConversationTree } from '../types';
|
|
1
|
+
import type { ConversationTree, MessageMetadata, TreeMessage } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Annotation attached to a Responses-API content part (citations, file
|
|
4
4
|
* references, etc.). chat-kit does not render annotations itself; the shape
|
|
@@ -157,6 +157,21 @@ export interface ResponseAttachment {
|
|
|
157
157
|
fileName: string;
|
|
158
158
|
searchStoreId: string;
|
|
159
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Render-side attachment shape produced by `responsesToTree`. Stored under
|
|
162
|
+
* `metadata.attachments` on the user `TreeMessage` (chat-kit's `BaseMessage`
|
|
163
|
+
* /`TreeMessage` carry `metadata` as an opaque `Record<string, unknown>`).
|
|
164
|
+
*
|
|
165
|
+
* The shape is intentionally minimal — a human-readable `name` plus the
|
|
166
|
+
* optional ids needed to resolve a public URL for the file. Consumers
|
|
167
|
+
* using a different attachment shape can either skip this adapter or
|
|
168
|
+
* project this onto their own type at the read site.
|
|
169
|
+
*/
|
|
170
|
+
export interface ResponseMessageAttachment {
|
|
171
|
+
name: string;
|
|
172
|
+
fileId?: string;
|
|
173
|
+
searchStoreId?: string;
|
|
174
|
+
}
|
|
160
175
|
/**
|
|
161
176
|
* One stored response from the OpenAI-style Responses API, as returned by
|
|
162
177
|
* `GET /conversations/:id/responses`. `previous_response_id` chains
|
|
@@ -174,7 +189,7 @@ export interface StoredResponse {
|
|
|
174
189
|
output: ResponseOutput[];
|
|
175
190
|
request_input: Record<string, unknown>[];
|
|
176
191
|
metadata?: Record<string, unknown> & {
|
|
177
|
-
attachments?:
|
|
192
|
+
attachments?: string;
|
|
178
193
|
};
|
|
179
194
|
conversation?: {
|
|
180
195
|
id: string;
|
|
@@ -192,6 +207,38 @@ export interface ResponseList {
|
|
|
192
207
|
object: 'list';
|
|
193
208
|
data: StoredResponse[];
|
|
194
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Per-node metadata produced by `responsesToTree`. The adapter is the
|
|
212
|
+
* single point that knows about the Responses-API wire format, so it
|
|
213
|
+
* stamps the originating `responseId` onto every node it emits. Anything
|
|
214
|
+
* downstream that reads it (typically a host app linking a tree message
|
|
215
|
+
* back to its server-side response) does so via this narrower metadata
|
|
216
|
+
* shape — chat-kit core stays oblivious to the field and treats it as
|
|
217
|
+
* opaque metadata.
|
|
218
|
+
*/
|
|
219
|
+
export type ResponseTreeMessageMetadata = MessageMetadata & {
|
|
220
|
+
responseId: string;
|
|
221
|
+
attachments?: ResponseMessageAttachment[];
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Tree node emitted by `responsesToTree`. Structurally a `TreeMessage`,
|
|
225
|
+
* but with `metadata` narrowed to {@link ResponseTreeMessageMetadata} and
|
|
226
|
+
* promoted from optional to required: every node carries at least the
|
|
227
|
+
* originating `responseId`. Assignable to `TreeMessage` so the resulting
|
|
228
|
+
* tree can be passed directly to `useMessageHandler().setTree(...)`.
|
|
229
|
+
*/
|
|
230
|
+
export type ResponseTreeMessage = Omit<TreeMessage, 'metadata'> & {
|
|
231
|
+
metadata: ResponseTreeMessageMetadata;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* `ConversationTree` returned by `responsesToTree`. Same shape as the
|
|
235
|
+
* core `ConversationTree`, with every node typed as a
|
|
236
|
+
* {@link ResponseTreeMessage} so callers can read `metadata.responseId`
|
|
237
|
+
* without re-narrowing. Structurally assignable to `ConversationTree`.
|
|
238
|
+
*/
|
|
239
|
+
export interface ResponseConversationTree extends ConversationTree {
|
|
240
|
+
nodes: Record<string, ResponseTreeMessage>;
|
|
241
|
+
}
|
|
195
242
|
/**
|
|
196
243
|
* Convert an OpenAI Responses API list (already ordered by `created_at`
|
|
197
244
|
* ascending) into a chat-kit `ConversationTree`.
|
|
@@ -202,8 +249,10 @@ export interface ResponseList {
|
|
|
202
249
|
* last message immediately. Sibling responses (same `previous_response_id`)
|
|
203
250
|
* surface as branches; the latest one wins as the active branch.
|
|
204
251
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
252
|
+
* Every emitted node carries `metadata.responseId` pointing back to the
|
|
253
|
+
* originating `StoredResponse.id` (see {@link ResponseTreeMessage}). The
|
|
254
|
+
* return type is assignable to `ConversationTree`, so you can pipe it
|
|
255
|
+
* straight into `useMessageHandler().setTree(...)`.
|
|
207
256
|
*/
|
|
208
|
-
export declare function responsesToTree(responses: StoredResponse[]):
|
|
257
|
+
export declare function responsesToTree(responses: StoredResponse[]): ResponseConversationTree;
|
|
209
258
|
//# sourceMappingURL=responses-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses-api.d.ts","sourceRoot":"","sources":["../../src/adapters/responses-api.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"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AAmB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG;IAChE,QAAQ,EAAE,2BAA2B,CAAC;CACvC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB;IAChE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC5C;AAmND;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,cAAc,EAAE,GAC1B,wBAAwB,CAmE1B"}
|
|
@@ -83,21 +83,53 @@ function extractInputText(rawContent) {
|
|
|
83
83
|
}
|
|
84
84
|
return text.trim();
|
|
85
85
|
}
|
|
86
|
+
function parseResponseAttachments(resp) {
|
|
87
|
+
const raw = resp.metadata?.attachments;
|
|
88
|
+
if (!raw) return null;
|
|
89
|
+
let attachments;
|
|
90
|
+
try {
|
|
91
|
+
attachments = JSON.parse(raw);
|
|
92
|
+
} catch {
|
|
93
|
+
console.warn(
|
|
94
|
+
"[chat-kit] Failed to parse metadata.attachments as JSON; skipping.",
|
|
95
|
+
raw
|
|
96
|
+
);
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
if (!Array.isArray(attachments) || attachments.length === 0) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return attachments;
|
|
103
|
+
}
|
|
86
104
|
function responseToMessageNodes(resp) {
|
|
87
105
|
const nodes = [];
|
|
106
|
+
const responseAttachments = parseResponseAttachments(resp);
|
|
107
|
+
let userNodesPushed = 0;
|
|
88
108
|
if (resp.request_input) {
|
|
89
109
|
for (const [idx, input] of resp.request_input.entries()) {
|
|
90
110
|
const role = input.role;
|
|
91
111
|
const rawContent = input.content;
|
|
92
112
|
const text = extractInputText(rawContent);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
const userContent = text || responseAttachments?.length;
|
|
114
|
+
if (role !== "user" || !userContent) continue;
|
|
115
|
+
const metadata = { responseId: resp.id };
|
|
116
|
+
if (responseAttachments && userNodesPushed === 0) {
|
|
117
|
+
metadata.attachments = responseAttachments.map(
|
|
118
|
+
(a) => ({
|
|
119
|
+
name: a.fileName,
|
|
120
|
+
fileId: a.fileId,
|
|
121
|
+
searchStoreId: a.searchStoreId
|
|
122
|
+
})
|
|
123
|
+
);
|
|
100
124
|
}
|
|
125
|
+
nodes.push({
|
|
126
|
+
id: `user-${resp.id}-${idx}`,
|
|
127
|
+
role: "user",
|
|
128
|
+
content: [textPart(text)],
|
|
129
|
+
createdAt: new Date(resp.created_at * 1e3),
|
|
130
|
+
metadata
|
|
131
|
+
});
|
|
132
|
+
userNodesPushed += 1;
|
|
101
133
|
}
|
|
102
134
|
}
|
|
103
135
|
const assistantParts = toAssistantParts(resp);
|
|
@@ -106,7 +138,8 @@ function responseToMessageNodes(resp) {
|
|
|
106
138
|
id: getAssistantNodeId(resp),
|
|
107
139
|
role: "assistant",
|
|
108
140
|
content: assistantParts,
|
|
109
|
-
createdAt: new Date((resp.completed_at ?? resp.created_at) * 1e3)
|
|
141
|
+
createdAt: new Date((resp.completed_at ?? resp.created_at) * 1e3),
|
|
142
|
+
metadata: { responseId: resp.id }
|
|
110
143
|
});
|
|
111
144
|
}
|
|
112
145
|
return nodes;
|
|
@@ -127,7 +160,8 @@ function responsesToTree(responses) {
|
|
|
127
160
|
role: node.role,
|
|
128
161
|
content: node.content,
|
|
129
162
|
status: "completed",
|
|
130
|
-
createdAt: node.createdAt
|
|
163
|
+
createdAt: node.createdAt,
|
|
164
|
+
metadata: node.metadata
|
|
131
165
|
};
|
|
132
166
|
if (parentId !== null) {
|
|
133
167
|
const parent = treeNodes[parentId];
|
package/dist/chat-kit.css
CHANGED
|
@@ -22,3 +22,22 @@
|
|
|
22
22
|
transition-duration: 0.01ms;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
.ck-feedback-dialog__chip[data-v-eaffd2d5] {
|
|
27
|
+
width: 100%;
|
|
28
|
+
min-height: 36px;
|
|
29
|
+
height: auto;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
text-align: center;
|
|
32
|
+
line-height: 1rem;
|
|
33
|
+
}
|
|
34
|
+
.ck-feedback-dialog__response[data-v-eaffd2d5] p,
|
|
35
|
+
.ck-feedback-dialog__response[data-v-eaffd2d5] li {
|
|
36
|
+
line-height: 1.5rem;
|
|
37
|
+
}
|
|
38
|
+
.ck-feedback-dialog__response[data-v-eaffd2d5] p {
|
|
39
|
+
margin: 0 0 0.5rem 0;
|
|
40
|
+
}
|
|
41
|
+
.ck-feedback-dialog__response[data-v-eaffd2d5] p:last-child {
|
|
42
|
+
margin-bottom: 0;
|
|
43
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import CkFeedbackDialog from './CkFeedbackDialog.vue';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
+
declare const meta: Meta<typeof CkFeedbackDialog>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
/**
|
|
7
|
+
* Positive variant. Single-select reason chips on the right, the response on
|
|
8
|
+
* the left, optional free text underneath.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Positive: Story;
|
|
11
|
+
/**
|
|
12
|
+
* Negative variant. Same shape, different reason set and title.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Negative: Story;
|
|
15
|
+
/**
|
|
16
|
+
* When no response text is provided, the left column collapses and the reasons
|
|
17
|
+
* + free-text input fill the dialog.
|
|
18
|
+
*/
|
|
19
|
+
export declare const NoResponseColumn: Story;
|
|
20
|
+
/**
|
|
21
|
+
* Submit shows a busy state while the host persists the payload; both actions
|
|
22
|
+
* are non-interactive.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Submitting: Story;
|
|
25
|
+
/**
|
|
26
|
+
* Realistic end-to-end flow wired to `CkFeedbackButton`. Click a thumb to open
|
|
27
|
+
* the dialog; submit or cancel; the button locks only on submit.
|
|
28
|
+
*/
|
|
29
|
+
export declare const WithFeedbackButton: Story;
|
|
30
|
+
//# sourceMappingURL=CkFeedbackDialog.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkFeedbackDialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackDialog/CkFeedbackDialog.stories.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAOtD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAsC3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAgBvC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAoEnC;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAO9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KAQxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAqEhC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload } from './types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CkFeedbackDialogProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
cancel: () => any;
|
|
4
|
+
submit: (payload: CkFeedbackDialogSubmitPayload) => any;
|
|
5
|
+
"update:open": (open: boolean) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<CkFeedbackDialogProps> & Readonly<{
|
|
7
|
+
onCancel?: (() => any) | undefined;
|
|
8
|
+
onSubmit?: ((payload: CkFeedbackDialogSubmitPayload) => any) | undefined;
|
|
9
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=CkFeedbackDialog.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkFeedbackDialog.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackDialog/CkFeedbackDialog.vue"],"names":[],"mappings":"AAwSA,OAAO,KAAK,EACV,qBAAqB,EACrB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAqgBjB,QAAA,MAAM,YAAY;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal dialog for collecting qualitative feedback on an assistant response.
|
|
3
|
+
* Opened after a binary thumbs-up / thumbs-down click (see `CkFeedbackButton`),
|
|
4
|
+
* it lets the user pick a single reason code and add an optional free-text
|
|
5
|
+
* comment, then submit both alongside the original sentiment.
|
|
6
|
+
*
|
|
7
|
+
* One reason per submission: the backend (feedback-kit) stores a single
|
|
8
|
+
* `reason` enum per response, so the dialog is single-select by design.
|
|
9
|
+
*
|
|
10
|
+
* Fully prop-driven: the host application owns `open`, the list of reasons to
|
|
11
|
+
* show (fetched from `GET /feedback/config`), the response text to display, and
|
|
12
|
+
* the submission handler. The component only manages transient form state (the
|
|
13
|
+
* selected reason and free-text value) until the user submits or cancels.
|
|
14
|
+
*
|
|
15
|
+
* @category Feedback
|
|
16
|
+
* @useCases collect qualitative feedback, gather a reason code for a response,
|
|
17
|
+
* capture a free-text comment, drive a two-step rating flow
|
|
18
|
+
* @keywords feedback, dialog, modal, reason codes, free text, qualitative,
|
|
19
|
+
* rating, comment
|
|
20
|
+
* @related CkFeedbackButton, CkMessageActionButton, CkAgentMessage,
|
|
21
|
+
* CkConversation, UiDialog, UiToggleGroup
|
|
22
|
+
*/
|
|
23
|
+
export type CkFeedbackSentiment = 'positive' | 'negative';
|
|
24
|
+
/**
|
|
25
|
+
* A selectable reason: `code` is the stable machine value submitted to the
|
|
26
|
+
* backend; `label` is the human-readable string shown on the chip. Both come
|
|
27
|
+
* from the backend's `GET /feedback/config` so the UI never drifts from what
|
|
28
|
+
* the backend accepts.
|
|
29
|
+
*/
|
|
30
|
+
export interface CkFeedbackReason {
|
|
31
|
+
code: string;
|
|
32
|
+
label: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CkFeedbackDialogSubmitPayload {
|
|
35
|
+
/** The sentiment the dialog was opened for. */
|
|
36
|
+
sentiment: CkFeedbackSentiment;
|
|
37
|
+
/** The selected reason `code`, or `null` if the user only left free text. */
|
|
38
|
+
reason: string | null;
|
|
39
|
+
/** Free-text comment, trimmed. Empty string when the user typed nothing. */
|
|
40
|
+
reasonText: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CkFeedbackDialogProps {
|
|
43
|
+
/**
|
|
44
|
+
* Controlled open state. Use with `v-model:open`. When `true` the dialog is
|
|
45
|
+
* visible and form state is editable; when `false` the dialog is closed.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
open?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Which sentiment the user gave before this dialog opened. Drives the title
|
|
51
|
+
* ("Give positive feedback" vs "Give negative feedback") and is echoed back
|
|
52
|
+
* on submit.
|
|
53
|
+
*/
|
|
54
|
+
sentiment: CkFeedbackSentiment;
|
|
55
|
+
/**
|
|
56
|
+
* The assistant response being rated. Rendered as markdown in the left
|
|
57
|
+
* column so the user can see what they're giving feedback on. Omit (or pass
|
|
58
|
+
* an empty string) to hide the response column entirely.
|
|
59
|
+
* @default undefined
|
|
60
|
+
*/
|
|
61
|
+
responseText?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Available reasons to render as single-select chips. The host fetches the
|
|
64
|
+
* appropriate per-sentiment list from `GET /feedback/config` and passes it
|
|
65
|
+
* here. The chip shows `label`; the selected `code` is emitted on submit.
|
|
66
|
+
*/
|
|
67
|
+
reasons: CkFeedbackReason[];
|
|
68
|
+
/**
|
|
69
|
+
* Maximum length for the free-text input. The browser will hard-limit the
|
|
70
|
+
* field via the native `maxlength` attribute, and a "x/max" counter is
|
|
71
|
+
* shown beneath the textarea.
|
|
72
|
+
* @default 250
|
|
73
|
+
*/
|
|
74
|
+
maxFreeTextLength?: number;
|
|
75
|
+
/**
|
|
76
|
+
* When `true`, the Submit button shows a busy state and clicks are ignored.
|
|
77
|
+
* Use while the parent is awaiting the backend POST.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
submitting?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* When `true`, both Submit and Cancel are non-interactive. Primarily used
|
|
83
|
+
* to keep the dialog frozen while showing a confirmation or error state
|
|
84
|
+
* before the host closes it.
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Overrides the injected dialog title for positive feedback. Defaults to
|
|
90
|
+
* `useChatKitLabels().feedbackDialogTitlePositive`.
|
|
91
|
+
*/
|
|
92
|
+
titlePositive?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Overrides the injected dialog title for negative feedback. Defaults to
|
|
95
|
+
* `useChatKitLabels().feedbackDialogTitleNegative`.
|
|
96
|
+
*/
|
|
97
|
+
titleNegative?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Overrides the injected "Response" heading shown above the response
|
|
100
|
+
* preview column. Defaults to `useChatKitLabels().feedbackDialogResponseHeading`.
|
|
101
|
+
*/
|
|
102
|
+
responseHeading?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Screen-reader description for the dialog (sets `aria-describedby`; not
|
|
105
|
+
* shown visually). Defaults to `useChatKitLabels().feedbackDialogDescription`.
|
|
106
|
+
*/
|
|
107
|
+
description?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Overrides the injected "Other" label above the free-text input.
|
|
110
|
+
* Defaults to `useChatKitLabels().feedbackDialogOtherLabel`.
|
|
111
|
+
*/
|
|
112
|
+
otherLabel?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Tooltip text shown when the user hovers the (i) icon next to the "Other"
|
|
115
|
+
* label. Defaults to `useChatKitLabels().feedbackDialogOtherTooltip`.
|
|
116
|
+
*/
|
|
117
|
+
otherTooltip?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Placeholder text for the free-text input. Defaults to
|
|
120
|
+
* `useChatKitLabels().feedbackDialogFreeTextPlaceholder`.
|
|
121
|
+
*/
|
|
122
|
+
freeTextPlaceholder?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Label for the Cancel button. Defaults to
|
|
125
|
+
* `useChatKitLabels().feedbackDialogCancelLabel`.
|
|
126
|
+
*/
|
|
127
|
+
cancelLabel?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Label for the Submit button. Defaults to
|
|
130
|
+
* `useChatKitLabels().feedbackDialogSubmitLabel`.
|
|
131
|
+
*/
|
|
132
|
+
submitLabel?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface CkFeedbackDialogEmits {
|
|
135
|
+
/**
|
|
136
|
+
* Two-way binding for the `open` prop. Emitted when the dialog requests to
|
|
137
|
+
* be closed (Cancel button, close icon, ESC, or outside click).
|
|
138
|
+
*/
|
|
139
|
+
(e: 'update:open', open: boolean): void;
|
|
140
|
+
/**
|
|
141
|
+
* Emitted when the user clicks Submit. The host should persist the payload
|
|
142
|
+
* (e.g. POST to `/feedback/`) then close the dialog by setting `open` to
|
|
143
|
+
* `false`. Not emitted while `submitting` or `disabled`.
|
|
144
|
+
*/
|
|
145
|
+
(e: 'submit', payload: CkFeedbackDialogSubmitPayload): void;
|
|
146
|
+
/**
|
|
147
|
+
* Emitted when the user clicks Cancel or otherwise dismisses the dialog
|
|
148
|
+
* without submitting (close icon, ESC, outside click).
|
|
149
|
+
*/
|
|
150
|
+
(e: 'cancel'): void;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkFeedbackDialog/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,6BAA6B;IAC5C,+CAA+C;IAC/C,SAAS,EAAE,mBAAmB,CAAC;IAC/B,6EAA6E;IAC7E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,SAAS,EAAE,mBAAmB,CAAC;IAC/B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC5D;;;OAGG;IACH,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACrB"}
|
|
@@ -5,6 +5,8 @@ export type { CkConversationLayoutProps } from './CkConversationLayout';
|
|
|
5
5
|
export { CkCopyMessageActionButton } from './CkCopyMessageActionButton';
|
|
6
6
|
export { CkFeedbackButton } from './CkFeedbackButton';
|
|
7
7
|
export type { CkFeedbackButtonProps, CkFeedbackValue, } from './CkFeedbackButton';
|
|
8
|
+
export { CkFeedbackDialog } from './CkFeedbackDialog';
|
|
9
|
+
export type { CkFeedbackDialogProps, CkFeedbackDialogEmits, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, } from './CkFeedbackDialog';
|
|
8
10
|
export { CkFileItemsList } from './CkFileItemsList';
|
|
9
11
|
export type { CkFileEntry, CkFileItemsListProps, CkFileItemsListEmits, } from './CkFileItemsList';
|
|
10
12
|
export { CkHistoryItem } from './CkHistoryItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,u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sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CkAgentMessage, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkFileItemsList, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './base';
|
|
2
|
-
export type { CkConversationLayoutProps, CkFeedbackButtonProps, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './base';
|
|
1
|
+
export { CkAgentMessage, CkConversationLayout, CkCopyMessageActionButton, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistoryItem, CkHistoryWrapper, CkMarkdownRenderer, CkMessageActionButton, CkPromptActionButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './base';
|
|
2
|
+
export type { CkConversationLayoutProps, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkUserMessageProps, } from './base';
|
|
3
3
|
export { CkConversation, CkHistory, CkInput } from './composed';
|
|
4
4
|
export type { CkConversationProps, CkHistoryEmits, CkHistoryProps, } 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,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,YAAY,EACV,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,YAAY,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q } from "../CkInput.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r } from "../CkInput.vue_vue_type_script_setup_true_lang-DCZTSiBj.js";
|
|
2
2
|
export {
|
|
3
3
|
_ as CkAgentMessage,
|
|
4
4
|
a as CkConversation,
|
|
5
5
|
b as CkConversationLayout,
|
|
6
6
|
C as CkCopyMessageActionButton,
|
|
7
7
|
c as CkFeedbackButton,
|
|
8
|
-
d as
|
|
9
|
-
e as
|
|
10
|
-
f as
|
|
11
|
-
g as
|
|
12
|
-
h as
|
|
13
|
-
i as
|
|
14
|
-
j as
|
|
15
|
-
k as
|
|
16
|
-
l as
|
|
17
|
-
m as
|
|
18
|
-
n as
|
|
19
|
-
o as
|
|
20
|
-
p as
|
|
21
|
-
q as
|
|
8
|
+
d as CkFeedbackDialog,
|
|
9
|
+
e as CkFileItemsList,
|
|
10
|
+
f as CkHistory,
|
|
11
|
+
g as CkHistoryItem,
|
|
12
|
+
h as CkHistoryWrapper,
|
|
13
|
+
i as CkInput,
|
|
14
|
+
j as CkMarkdownRenderer,
|
|
15
|
+
k as CkMessageActionButton,
|
|
16
|
+
l as CkPromptActionButton,
|
|
17
|
+
m as CkPromptInput,
|
|
18
|
+
n as CkPromptInputDisclaimer,
|
|
19
|
+
o as CkPromptStopButton,
|
|
20
|
+
p as CkSendIcon,
|
|
21
|
+
q as CkStopIcon,
|
|
22
|
+
r as CkUserMessage
|
|
22
23
|
};
|
package/dist/handlers/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u } from "../useMessageHandler-
|
|
2
|
-
import { C, d, p, u as u2, a } from "../useChatKitLabels-
|
|
1
|
+
import { u } from "../useMessageHandler-CMdy-lm0.js";
|
|
2
|
+
import { C, d, p, u as u2, a } from "../useChatKitLabels-DeHxZG2a.js";
|
|
3
3
|
export {
|
|
4
4
|
C as CHAT_KIT_LABELS,
|
|
5
5
|
d as defaultChatKitLabels,
|
|
@@ -45,6 +45,24 @@ export type ChatKitLabels = {
|
|
|
45
45
|
* `defaultChatKitLabels.feedbackGroup` when omitted.
|
|
46
46
|
*/
|
|
47
47
|
feedbackGroup?: string;
|
|
48
|
+
/** `CkFeedbackDialog` title when sentiment is `'positive'`. */
|
|
49
|
+
feedbackDialogTitlePositive?: string;
|
|
50
|
+
/** `CkFeedbackDialog` title when sentiment is `'negative'`. */
|
|
51
|
+
feedbackDialogTitleNegative?: string;
|
|
52
|
+
/** Heading above the response preview in `CkFeedbackDialog`. */
|
|
53
|
+
feedbackDialogResponseHeading?: string;
|
|
54
|
+
/** Screen-reader description for `CkFeedbackDialog` (sets `aria-describedby`). */
|
|
55
|
+
feedbackDialogDescription?: string;
|
|
56
|
+
/** "Other" label above the free-text input in `CkFeedbackDialog`. */
|
|
57
|
+
feedbackDialogOtherLabel?: string;
|
|
58
|
+
/** Tooltip on the (i) icon next to "Other" in `CkFeedbackDialog`. */
|
|
59
|
+
feedbackDialogOtherTooltip?: string;
|
|
60
|
+
/** Placeholder for the free-text input in `CkFeedbackDialog`. */
|
|
61
|
+
feedbackDialogFreeTextPlaceholder?: string;
|
|
62
|
+
/** Cancel button label in `CkFeedbackDialog`. */
|
|
63
|
+
feedbackDialogCancelLabel?: string;
|
|
64
|
+
/** Submit button label in `CkFeedbackDialog`. */
|
|
65
|
+
feedbackDialogSubmitLabel?: string;
|
|
48
66
|
/** Fallback title used by `CkHistory` when a conversation has no `title`. */
|
|
49
67
|
historyItemUntitled: string;
|
|
50
68
|
/** Accessible name for the trailing kebab trigger on each `CkHistory` row. */
|
|
@@ -1 +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;IACzB,sFAAsF;IACtF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4FAA4F;IAC5F,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,0BAA0B,EAAE,MAAM,CAAC;IACnC,uEAAuE;IACvE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"useChatKitLabels.d.ts","sourceR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,uBAAuB,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,aAwBlC,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAAC,aAAa,CAAC,CAC1C,CAAC;AAE5B,KAAK,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5C,yFAAyF;AACzF,KAAK,cAAc,GACf,GAAG,CAAC,aAAa,CAAC,GAClB,WAAW,CAAC,aAAa,CAAC,GAC1B,CAAC,MAAM,aAAa,CAAC,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAKjE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAAC,aAAa,CAAC,CAK7D"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseMessage, ConversationTree, MessageContent, MessageRole, MessageStatus } from '../types';
|
|
1
|
+
import type { BaseMessage, ConversationTree, MessageContent, MessageMetadata, MessageRole, MessageStatus } from '../types';
|
|
2
2
|
import { type Ref } from 'vue';
|
|
3
3
|
export declare const useMessageHandler: () => {
|
|
4
4
|
messages: Ref<BaseMessage[]>;
|
|
@@ -9,14 +9,18 @@ export declare const useMessageHandler: () => {
|
|
|
9
9
|
content: MessageContent[];
|
|
10
10
|
role: MessageRole;
|
|
11
11
|
status: MessageStatus;
|
|
12
|
+
metadata?: MessageMetadata;
|
|
12
13
|
}) => void;
|
|
13
14
|
setCurrentUserMessage: (text: string) => void;
|
|
14
15
|
getMessageById: (id: string) => BaseMessage | undefined;
|
|
15
16
|
clearCurrentUserMessage: () => void;
|
|
16
|
-
commitUserMessage: (
|
|
17
|
+
commitUserMessage: (opts?: {
|
|
18
|
+
metadata?: MessageMetadata;
|
|
19
|
+
}) => BaseMessage;
|
|
17
20
|
updateMessageId: (oldId: string, newId: string) => void;
|
|
18
21
|
clearMessages: () => void;
|
|
19
22
|
setTree: (incoming: ConversationTree) => void;
|
|
20
23
|
navigate: (targetId: string) => void;
|
|
24
|
+
cutBranchAfter: (messageId: string) => void;
|
|
21
25
|
};
|
|
22
26
|
//# 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":"AAUA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,WAAW,EACX,aAAa,EAEd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAqC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAElE,eAAO,MAAM,iBAAiB;cA6IJ,GAAG,CAAC,WAAW,EAAE,CAAC;;;6BArFV;QAC9B,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,IAAI,EAAE,WAAW,CAAC;QAClB,MAAM,EAAE,aAAa,CAAC;QACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;KAC5B;kCAnDoC,MAAM;yBAiFf,MAAM,KAAG,WAAW,GAAG,SAAS;;+BAzE1B;QAChC,QAAQ,CAAC,EAAE,eAAe,CAAC;KAC5B,KAAG,WAAW;6BAqFiB,MAAM,SAAS,MAAM;;wBAiB1B,gBAAgB;yBAKf,MAAM;gCAQC,MAAM;CAmB1C,CAAC"}
|
|
@@ -6,8 +6,17 @@ export declare function createEmptyTree(): ConversationTree;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function getLinearPath(tree: ConversationTree): BaseMessage[];
|
|
8
8
|
export declare function addNode(tree: ConversationTree, node: TreeMessage): void;
|
|
9
|
-
export declare function updateNode(tree: ConversationTree, id: string, updates: Partial<Pick<TreeMessage, 'content' | 'status' | 'role'>>): void;
|
|
9
|
+
export declare function updateNode(tree: ConversationTree, id: string, updates: Partial<Pick<TreeMessage, 'content' | 'status' | 'role' | 'metadata'>>): void;
|
|
10
10
|
export declare function updateNodeId(tree: ConversationTree, oldId: string, newId: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* Remove every descendant of the node with the given id, keeping the node
|
|
13
|
+
* itself intact. The node's `childrenIds` is cleared and `activeChildIndex`
|
|
14
|
+
* is reset to 0, which makes the node the new leaf of its branch.
|
|
15
|
+
*
|
|
16
|
+
* Useful when editing a message and discarding the conversation that was
|
|
17
|
+
* generated after it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function cutBranchAfter(tree: ConversationTree, id: string): void;
|
|
11
20
|
/**
|
|
12
21
|
* Navigate to a different branch by updating the parent's activeChildIndex
|
|
13
22
|
* to point at the target sibling.
|
|
@@ -1 +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,
|
|
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,CAmCnE;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,CACd,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC,CAC9D,GACA,IAAI,CAUN;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI,CAsBN;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAevE;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAWvE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as generateId } from "./generateId-BHf0W4Rq.js";
|
|
2
2
|
import { ref, shallowRef, computed, readonly, toRaw, toValue, watch } from "vue";
|
|
3
|
-
import { u as useMessageHandler } from "./useMessageHandler-
|
|
3
|
+
import { u as useMessageHandler } from "./useMessageHandler-CMdy-lm0.js";
|
|
4
4
|
import "./purify.es-md74IFlY.js";
|
|
5
5
|
function secondsToDate(seconds) {
|
|
6
6
|
return new Date(seconds * 1e3);
|