@aleph-alpha/chat-kit 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CkInput.vue_vue_type_script_setup_true_lang-B-4xnH2c.js → CkInput.vue_vue_type_script_setup_true_lang-DJN-nZ2-.js} +391 -113
- package/dist/adapters/responses-api.d.ts +11 -5
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -3
- package/dist/chat-kit.css +14 -8
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts +7 -0
- package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts.map +1 -1
- package/dist/components/base/CkAgentMessage/types.d.ts +1 -1
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts +47 -0
- package/dist/components/base/CkCitation/CkCitation.stories.d.ts.map +1 -0
- package/dist/components/base/CkCitation/CkCitation.vue.d.ts +15 -0
- package/dist/components/base/CkCitation/CkCitation.vue.d.ts.map +1 -0
- package/dist/components/base/CkCitation/index.d.ts +3 -0
- package/dist/components/base/CkCitation/index.d.ts.map +1 -0
- package/dist/components/base/CkCitation/types.d.ts +79 -0
- package/dist/components/base/CkCitation/types.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts +51 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts +13 -0
- package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/index.d.ts +3 -0
- package/dist/components/base/CkCitationCard/index.d.ts.map +1 -0
- package/dist/components/base/CkCitationCard/types.d.ts +51 -0
- package/dist/components/base/CkCitationCard/types.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts → CkCopyMessageButton/CkCopyMessageButton.stories.d.ts} +3 -3
- package/dist/components/base/CkCopyMessageButton/CkCopyMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts → CkCopyMessageButton/CkCopyMessageButton.vue.d.ts} +4 -4
- package/dist/components/base/CkCopyMessageButton/CkCopyMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkCopyMessageButton/index.d.ts +3 -0
- package/dist/components/base/CkCopyMessageButton/index.d.ts.map +1 -0
- package/dist/components/base/{CkCopyMessageActionButton → CkCopyMessageButton}/types.d.ts +3 -3
- package/dist/components/base/CkCopyMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts +1 -1
- package/dist/components/base/CkFeedbackButton/types.d.ts +1 -1
- package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts +2 -2
- package/dist/components/base/CkFeedbackDialog/types.d.ts +1 -1
- package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -1
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +15 -0
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts +16 -2
- package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/index.d.ts +1 -1
- package/dist/components/base/CkMarkdownRenderer/index.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/types.d.ts +25 -0
- package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
- package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts +17 -0
- package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton/CkMessageActionButton.stories.d.ts → CkMessageButton/CkMessageButton.stories.d.ts} +3 -3
- package/dist/components/base/CkMessageButton/CkMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton/CkMessageActionButton.vue.d.ts → CkMessageButton/CkMessageButton.vue.d.ts} +3 -3
- package/dist/components/base/CkMessageButton/CkMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkMessageButton/index.d.ts +3 -0
- package/dist/components/base/CkMessageButton/index.d.ts.map +1 -0
- package/dist/components/base/{CkMessageActionButton → CkMessageButton}/types.d.ts +2 -2
- package/dist/components/base/CkMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts +1 -1
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.d.ts +16 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.d.ts.map +1 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue.d.ts +12 -0
- package/dist/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue.d.ts.map +1 -0
- package/dist/components/base/CkRegenerateMessageButton/index.d.ts +3 -0
- package/dist/components/base/{CkCopyMessageActionButton → CkRegenerateMessageButton}/index.d.ts.map +1 -1
- package/dist/components/base/CkRegenerateMessageButton/types.d.ts +27 -0
- package/dist/components/base/CkRegenerateMessageButton/types.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +8 -3
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/composed/CkConversation/CkConversation.stories.d.ts +1 -1
- package/dist/components/composed/CkConversation/types.d.ts +1 -1
- package/dist/components/composed/CkInput/CkInput.vue.d.ts +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +26 -23
- package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
- package/dist/composables/fileUpload/useFileUploadWrapper.d.ts.map +1 -1
- package/dist/composables/index.js +1 -1
- package/dist/handlers/index.d.ts +2 -0
- package/dist/handlers/index.d.ts.map +1 -1
- package/dist/handlers/index.js +4 -3
- package/dist/handlers/useChatKitLabels.d.ts +13 -0
- package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
- package/dist/handlers/useMarkdownParser.d.ts.map +1 -1
- package/dist/handlers/useMessageHandler.d.ts +37 -0
- package/dist/handlers/useMessageHandler.d.ts.map +1 -1
- package/dist/helpers/conversationTree.d.ts +15 -0
- package/dist/helpers/conversationTree.d.ts.map +1 -1
- package/dist/helpers/unified/remarkCitations.d.ts +17 -0
- package/dist/helpers/unified/remarkCitations.d.ts.map +1 -0
- package/dist/{index-DAmWGYNH.js → index-CyrVnbS9.js} +86 -71
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -27
- package/dist/{useChatKitLabels-D5gNv8se.js → useChatKitLabels-zMFV7aEz.js} +31 -3
- package/dist/{useMessageHandler-CMdy-lm0.js → useMessageHandler-N50Yj-NU.js} +45 -7
- package/package.json +5 -3
- package/src/adapters/responses-api.spec.ts +52 -5
- package/src/adapters/responses-api.ts +26 -7
- package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +112 -0
- package/src/components/base/CkAgentMessage/types.ts +1 -1
- package/src/components/base/CkCitation/CkCitation.spec.ts +79 -0
- package/src/components/base/CkCitation/CkCitation.stories.ts +136 -0
- package/src/components/base/CkCitation/CkCitation.vue +145 -0
- package/src/components/base/CkCitation/index.ts +2 -0
- package/src/components/base/CkCitation/types.ts +80 -0
- package/src/components/base/CkCitationCard/CkCitationCard.spec.ts +77 -0
- package/src/components/base/CkCitationCard/CkCitationCard.stories.ts +144 -0
- package/src/components/base/CkCitationCard/CkCitationCard.vue +76 -0
- package/src/components/base/CkCitationCard/index.ts +2 -0
- package/src/components/base/CkCitationCard/types.ts +51 -0
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.spec.ts → CkCopyMessageButton/CkCopyMessageButton.spec.ts} +6 -6
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.stories.ts → CkCopyMessageButton/CkCopyMessageButton.stories.ts} +8 -8
- package/src/components/base/{CkCopyMessageActionButton/CkCopyMessageActionButton.vue → CkCopyMessageButton/CkCopyMessageButton.vue} +6 -6
- package/src/components/base/CkCopyMessageButton/index.ts +2 -0
- package/src/components/base/{CkCopyMessageActionButton → CkCopyMessageButton}/types.ts +3 -3
- package/src/components/base/CkFeedbackButton/CkFeedbackButton.vue +5 -5
- package/src/components/base/CkFeedbackButton/types.ts +1 -1
- package/src/components/base/CkFeedbackDialog/types.ts +1 -1
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +124 -0
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +118 -0
- package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +70 -28
- package/src/components/base/CkMarkdownRenderer/index.ts +1 -0
- package/src/components/base/CkMarkdownRenderer/types.ts +26 -0
- package/src/components/base/CkMarkdownRenderer/useCitationRendering.spec.ts +94 -0
- package/src/components/base/CkMarkdownRenderer/useCitationRendering.ts +52 -0
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.spec.ts → CkMessageButton/CkMessageButton.spec.ts} +6 -6
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.stories.ts → CkMessageButton/CkMessageButton.stories.ts} +10 -10
- package/src/components/base/{CkMessageActionButton/CkMessageActionButton.vue → CkMessageButton/CkMessageButton.vue} +3 -3
- package/src/components/base/CkMessageButton/index.ts +2 -0
- package/src/components/base/{CkMessageActionButton → CkMessageButton}/types.ts +2 -2
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.spec.ts +49 -0
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.stories.ts +63 -0
- package/src/components/base/CkRegenerateMessageButton/CkRegenerateMessageButton.vue +43 -0
- package/src/components/base/CkRegenerateMessageButton/index.ts +2 -0
- package/src/components/base/CkRegenerateMessageButton/types.ts +27 -0
- package/src/components/base/index.ts +15 -2
- package/src/components/composed/CkConversation/CkConversation.stories.ts +6 -6
- package/src/components/composed/CkConversation/CkConversation.vue +2 -2
- package/src/components/composed/CkConversation/types.ts +1 -1
- package/src/components/index.ts +11 -2
- package/src/composables/fileUpload/useFileUpload.spec.ts +2 -61
- package/src/composables/fileUpload/useFileUpload.ts +2 -9
- package/src/composables/fileUpload/useFileUploadWrapper.spec.ts +195 -14
- package/src/composables/fileUpload/useFileUploadWrapper.ts +114 -81
- package/src/handlers/index.ts +2 -0
- package/src/handlers/useChatKitLabels.spec.ts +1 -0
- package/src/handlers/useChatKitLabels.ts +16 -0
- package/src/handlers/useMarkdownParser.ts +5 -2
- package/src/handlers/useMessageHandler.spec.ts +79 -0
- package/src/handlers/useMessageHandler.ts +50 -2
- package/src/helpers/conversationTree.spec.ts +120 -0
- package/src/helpers/conversationTree.ts +57 -8
- package/src/helpers/unified/remarkCitations.spec.ts +112 -0
- package/src/helpers/unified/remarkCitations.ts +55 -0
- package/src/index.ts +11 -2
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkCopyMessageActionButton/CkCopyMessageActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkCopyMessageActionButton/index.d.ts +0 -3
- package/dist/components/base/CkCopyMessageActionButton/types.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.stories.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/CkMessageActionButton.vue.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/index.d.ts +0 -3
- package/dist/components/base/CkMessageActionButton/index.d.ts.map +0 -1
- package/dist/components/base/CkMessageActionButton/types.d.ts.map +0 -1
- package/src/components/base/CkCopyMessageActionButton/index.ts +0 -2
- package/src/components/base/CkMessageActionButton/index.ts +0 -2
|
@@ -28,4 +28,11 @@ export declare const WithCustomHeader: Story;
|
|
|
28
28
|
* the assistant identity is conveyed elsewhere.
|
|
29
29
|
*/
|
|
30
30
|
export declare const WithoutIcon: Story;
|
|
31
|
+
/**
|
|
32
|
+
* An assistant reply whose body is markdown containing inline `[n]` citations,
|
|
33
|
+
* rendered through `CkMarkdownRenderer` inside the message. Each `[n]` becomes
|
|
34
|
+
* an interactive `CkCitation` — hover a marker to preview its source. This is
|
|
35
|
+
* the end-to-end shape of a cited answer in a conversation.
|
|
36
|
+
*/
|
|
37
|
+
export declare const WithCitations: Story;
|
|
31
38
|
//# sourceMappingURL=CkAgentMessage.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkAgentMessage.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkAgentMessage/CkAgentMessage.stories.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CkAgentMessage.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkAgentMessage/CkAgentMessage.stories.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAIrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAyFnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAerB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAmB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAmB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAUzB,CAAC;AA+EF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAyB3B,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @category Messages
|
|
7
7
|
* @useCases render assistant reply, AI message layout, conversation turn, streaming message container
|
|
8
8
|
* @keywords agent, assistant, message, bubble, reply, ai, conversation
|
|
9
|
-
* @related CkUserMessage, CkConversation, CkMarkdownRenderer,
|
|
9
|
+
* @related CkUserMessage, CkConversation, CkMarkdownRenderer, CkCopyMessageButton
|
|
10
10
|
*/
|
|
11
11
|
export type CkAgentMessageProps = Record<string, never>;
|
|
12
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import CkCitation from './CkCitation.vue';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
+
/**
|
|
4
|
+
* CkCitation is the inline marker rendered in place of a `[n]` reference in an
|
|
5
|
+
* assistant answer — a numbered chip that reveals a `CkCitationCard` describing
|
|
6
|
+
* the source on hover or keyboard activation (Enter/Space). Drive it through `CkMarkdownRenderer`'s
|
|
7
|
+
* `citations` prop to render cited answers; use `CkCitationCard` on its own for
|
|
8
|
+
* a standalone source preview.
|
|
9
|
+
*/
|
|
10
|
+
declare const meta: Meta<typeof CkCitation>;
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
/**
|
|
14
|
+
* A single marker in its default (amber) state. Hover the chip (or focus it and
|
|
15
|
+
* press Enter) to reveal the source card.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Default: Story;
|
|
18
|
+
/**
|
|
19
|
+
* The selected (teal) state — set `selected` when the citation's source is the
|
|
20
|
+
* one currently open/highlighted, so the active marker stands out.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Selected: Story;
|
|
23
|
+
/**
|
|
24
|
+
* How markers read inside a sentence — two sources cited next to each other,
|
|
25
|
+
* the way they appear in an assistant answer.
|
|
26
|
+
*/
|
|
27
|
+
export declare const InlineInText: Story;
|
|
28
|
+
/**
|
|
29
|
+
* Multi-digit indices keep the chip legible — the marker grows with its
|
|
30
|
+
* number while staying aligned to the surrounding text.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MultiDigitIndex: Story;
|
|
33
|
+
/**
|
|
34
|
+
* No `url` — the card still appears on hover but without the external-link
|
|
35
|
+
* action (e.g. an internal chunk with no servable file).
|
|
36
|
+
*/
|
|
37
|
+
export declare const WithoutLink: Story;
|
|
38
|
+
/**
|
|
39
|
+
* Non-paginated source — the card omits the page footer.
|
|
40
|
+
*/
|
|
41
|
+
export declare const WithoutLocation: Story;
|
|
42
|
+
/**
|
|
43
|
+
* A row of markers with different file types — the card's badge tone follows
|
|
44
|
+
* each source's extension.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SourceTypes: Story;
|
|
47
|
+
//# sourceMappingURL=CkCitation.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCitation.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitation/CkCitation.stories.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAK3D;;;;;;GAMG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CA2BjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KAqB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAE7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAE7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CkCitationProps } from './types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CkCitationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
"open-source": (url: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<CkCitationProps> & Readonly<{
|
|
5
|
+
"onOpen-source"?: ((url: string) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
ariaLabel: string;
|
|
8
|
+
locationLabel: string;
|
|
9
|
+
url: string;
|
|
10
|
+
openSourceLabel: string;
|
|
11
|
+
selected: boolean;
|
|
12
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
//# sourceMappingURL=CkCitation.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCitation.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitation/CkCitation.vue"],"names":[],"mappings":"AA+JA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA0Q/C,QAAA,MAAM,YAAY;;;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACzD,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single citation source: the data needed to render a marker and its card.
|
|
3
|
+
* This is the per-source shape the host maps each backend citation into (the
|
|
4
|
+
* `index` matches the `[n]` reference in the answer text) and the element type
|
|
5
|
+
* of `CkMarkdownRenderer`'s `citations` prop.
|
|
6
|
+
*
|
|
7
|
+
* @category Data Display
|
|
8
|
+
* @useCases describe a cited source, build the citations map for an assistant reply
|
|
9
|
+
* @keywords citation, source, reference, file, page, snippet
|
|
10
|
+
* @related CkCitation, CkCitationCard, CkMarkdownRenderer
|
|
11
|
+
*/
|
|
12
|
+
export interface CkCitationSource {
|
|
13
|
+
/**
|
|
14
|
+
* 1-based source number rendered in the marker. Matches the `[n]`
|
|
15
|
+
* reference it replaces in the answer text.
|
|
16
|
+
*/
|
|
17
|
+
index: number;
|
|
18
|
+
/**
|
|
19
|
+
* Source file name. Title of the card and basis for the file-type badge
|
|
20
|
+
* (pass the original name with its extension).
|
|
21
|
+
*/
|
|
22
|
+
fileName: string;
|
|
23
|
+
/** The cited chunk text, shown in the card body. */
|
|
24
|
+
snippet: string;
|
|
25
|
+
/**
|
|
26
|
+
* Location label for the card footer, e.g. `"Page 3"`. Omit for
|
|
27
|
+
* non-paginated sources.
|
|
28
|
+
*/
|
|
29
|
+
locationLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Source URL for the card's external-link action. Activating it emits
|
|
32
|
+
* `open-source`. Omit to hide the action.
|
|
33
|
+
*/
|
|
34
|
+
url?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* An inline citation marker — the numbered chip rendered in place of a `[n]`
|
|
38
|
+
* reference inside an assistant answer. On hover, or when activated by
|
|
39
|
+
* keyboard (Enter/Space) or click, it reveals a `CkCitationCard` describing
|
|
40
|
+
* the source.
|
|
41
|
+
*
|
|
42
|
+
* The marker shows the bare source number (no brackets). Activating the
|
|
43
|
+
* card's external-link action re-emits `open-source` so the host can open
|
|
44
|
+
* the (possibly auth-proxied) source URL.
|
|
45
|
+
*
|
|
46
|
+
* @category Data Display
|
|
47
|
+
* @useCases inline citation in assistant reply, numbered source reference, hover to preview the cited file/page
|
|
48
|
+
* @keywords citation, source, reference, inline, marker, footnote, number, hover, popover
|
|
49
|
+
* @related CkCitationCard, CkMarkdownRenderer, CkAgentMessage
|
|
50
|
+
*/
|
|
51
|
+
export interface CkCitationProps extends CkCitationSource {
|
|
52
|
+
/**
|
|
53
|
+
* Marks the citation as selected/active (e.g. the source it points to is
|
|
54
|
+
* currently open or highlighted). Renders the marker in its selected (teal)
|
|
55
|
+
* state instead of the default amber.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
selected?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Accessible label for the marker trigger. When omitted, resolves to
|
|
61
|
+
* `"{citationSourceLabel} {index}"` from `useChatKitLabels` (English default
|
|
62
|
+
* `"Source {index}"`). Set this to override per instance.
|
|
63
|
+
*/
|
|
64
|
+
ariaLabel?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Accessible label for the card's external-link action. When omitted,
|
|
67
|
+
* resolves from `useChatKitLabels().citationOpenSource` (English default
|
|
68
|
+
* `"Open source"`).
|
|
69
|
+
*/
|
|
70
|
+
openSourceLabel?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface CkCitationEmits {
|
|
73
|
+
/**
|
|
74
|
+
* Re-emitted from the card when the user opens the source. The payload is
|
|
75
|
+
* `url`.
|
|
76
|
+
*/
|
|
77
|
+
(e: 'open-source', url: string): void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitation/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import CkCitationCard from './CkCitationCard.vue';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
+
/**
|
|
4
|
+
* CkCitationCard is the floating card that describes a single citation source:
|
|
5
|
+
* the file, the cited excerpt, an optional location (e.g. page), and an
|
|
6
|
+
* optional external-link action. It is the hover/focus content of `CkCitation`,
|
|
7
|
+
* but can be used on its own wherever a source preview is needed. The
|
|
8
|
+
* external-link action is exposed as an `open-source` event rather than a plain
|
|
9
|
+
* link, because the source URL is often auth-proxied.
|
|
10
|
+
*/
|
|
11
|
+
declare const meta: Meta<typeof CkCitationCard>;
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof meta>;
|
|
14
|
+
/**
|
|
15
|
+
* Full card: file-type badge, title, external-link action, excerpt, and a
|
|
16
|
+
* page footer. Matches the Figma `citation card` frame.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Default: Story;
|
|
19
|
+
/**
|
|
20
|
+
* No `url` — the external-link action is hidden. Use for sources that can't
|
|
21
|
+
* be opened (e.g. an internal chunk with no servable file).
|
|
22
|
+
*/
|
|
23
|
+
export declare const WithoutLink: Story;
|
|
24
|
+
/**
|
|
25
|
+
* No `locationLabel` — the footer is hidden. Use for non-paginated sources
|
|
26
|
+
* such as a plain web page or a whole-document citation.
|
|
27
|
+
*/
|
|
28
|
+
export declare const WithoutLocation: Story;
|
|
29
|
+
/**
|
|
30
|
+
* Minimal: title + excerpt only (no link, no location). The leanest source a
|
|
31
|
+
* card can describe.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MinimalSnippetOnly: Story;
|
|
34
|
+
/**
|
|
35
|
+
* A long file name truncates with an ellipsis (the badge and external-link
|
|
36
|
+
* action stay pinned, the card keeps its width); the full name stays available
|
|
37
|
+
* on hover via the `title` attribute. The `truncate` behaviour holds for any
|
|
38
|
+
* length, including a single unbroken token with no separators.
|
|
39
|
+
*/
|
|
40
|
+
export declare const LongFileName: Story;
|
|
41
|
+
/**
|
|
42
|
+
* A long excerpt wraps freely — the card grows vertically while keeping its
|
|
43
|
+
* fixed width.
|
|
44
|
+
*/
|
|
45
|
+
export declare const LongSnippet: Story;
|
|
46
|
+
/**
|
|
47
|
+
* The file-type badge derives its icon and tone from the file extension:
|
|
48
|
+
* `.pdf`/`.docx` → pink, `.md`/`.html` → soft, `.csv`/`.xlsx` → yellow.
|
|
49
|
+
*/
|
|
50
|
+
export declare const FileTypeVariants: Story;
|
|
51
|
+
//# sourceMappingURL=CkCitationCard.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCitationCard.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitationCard/CkCitationCard.stories.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAK3D;;;;;;;GAOG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAuBrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqBnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAErB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAE7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAIzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAuB9B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CkCitationCardProps } from './types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CkCitationCardProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
"open-source": (url: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<CkCitationCardProps> & Readonly<{
|
|
5
|
+
"onOpen-source"?: ((url: string) => any) | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
locationLabel: string;
|
|
8
|
+
url: string;
|
|
9
|
+
openSourceLabel: string;
|
|
10
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=CkCitationCard.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCitationCard.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitationCard/CkCitationCard.vue"],"names":[],"mappings":"AAqFA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA4KnD,QAAA,MAAM,YAAY;;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitationCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,mBAAmB,SAAS,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The floating card that describes a single citation source: the source file,
|
|
3
|
+
* the cited excerpt, an optional location (e.g. page), and an optional
|
|
4
|
+
* external-link action. Rendered as the hover/focus content of `CkCitation`,
|
|
5
|
+
* but usable on its own wherever a source preview is needed.
|
|
6
|
+
*
|
|
7
|
+
* Purely presentational and prop-driven. The external-link action is exposed
|
|
8
|
+
* as an `open-source` event rather than a plain link, because the source URL
|
|
9
|
+
* is often auth-proxied and cannot be navigated to directly.
|
|
10
|
+
*
|
|
11
|
+
* @category Data Display
|
|
12
|
+
* @useCases citation source preview, hover card for an inline reference, show the cited file/page/excerpt
|
|
13
|
+
* @keywords citation, source, card, popover, reference, file, page, excerpt, preview
|
|
14
|
+
* @related CkCitation, CkMarkdownRenderer, CkAgentMessage
|
|
15
|
+
*/
|
|
16
|
+
export interface CkCitationCardProps {
|
|
17
|
+
/**
|
|
18
|
+
* Source file name. Rendered as the card title and used to derive the
|
|
19
|
+
* file-type badge icon/tone (pass the original name with its extension,
|
|
20
|
+
* e.g. `q3-report.pdf`).
|
|
21
|
+
*/
|
|
22
|
+
fileName: string;
|
|
23
|
+
/** The cited chunk text, shown in the card body. */
|
|
24
|
+
snippet: string;
|
|
25
|
+
/**
|
|
26
|
+
* Location label shown in the footer, e.g. `"Page 3"`. Pass a fully
|
|
27
|
+
* formatted, localized string — the component does no number formatting.
|
|
28
|
+
* Omit for non-paginated sources to hide the footer.
|
|
29
|
+
*/
|
|
30
|
+
locationLabel?: string;
|
|
31
|
+
/**
|
|
32
|
+
* When set, the external-link action is shown in the header. Activating it
|
|
33
|
+
* emits `open-source` with this value; the host opens it (it may be an
|
|
34
|
+
* auth-proxied URL that can't be a plain link). Omit to hide the action.
|
|
35
|
+
*/
|
|
36
|
+
url?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Accessible label for the external-link action. When omitted, resolves from
|
|
39
|
+
* `useChatKitLabels().citationOpenSource` (English default `"Open source"`).
|
|
40
|
+
* Set this to override per instance.
|
|
41
|
+
*/
|
|
42
|
+
openSourceLabel?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface CkCitationCardEmits {
|
|
45
|
+
/**
|
|
46
|
+
* Emitted when the user activates the header external-link action. The
|
|
47
|
+
* payload is `url`. Only emitted when `url` is set.
|
|
48
|
+
*/
|
|
49
|
+
(e: 'open-source', url: string): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCitationCard/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CkCopyMessageButton from './CkCopyMessageButton.vue';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/vue3-vite';
|
|
3
|
-
declare const meta: Meta<typeof
|
|
3
|
+
declare const meta: Meta<typeof CkCopyMessageButton>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof meta>;
|
|
6
6
|
/**
|
|
@@ -13,4 +13,4 @@ export declare const Default: Story;
|
|
|
13
13
|
* Use while a message is still streaming or in an error state.
|
|
14
14
|
*/
|
|
15
15
|
export declare const Disabled: Story;
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=CkCopyMessageButton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCopyMessageButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageButton/CkCopyMessageButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,mBAAmB,CAwB1C,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"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
import type { CkCopyMessageButtonProps } from './types';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CkCopyMessageButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
copy: (payload: {
|
|
4
4
|
success: boolean;
|
|
5
5
|
}) => any;
|
|
6
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<CkCopyMessageButtonProps> & Readonly<{
|
|
7
7
|
onCopy?: ((payload: {
|
|
8
8
|
success: boolean;
|
|
9
9
|
}) => any) | undefined;
|
|
@@ -16,4 +16,4 @@ declare const __VLS_export: import("vue").DefineComponent<CkCopyMessageActionBut
|
|
|
16
16
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
17
|
declare const _default: typeof __VLS_export;
|
|
18
18
|
export default _default;
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=CkCopyMessageButton.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CkCopyMessageButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageButton/CkCopyMessageButton.vue"],"names":[],"mappings":"AAkHA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AA+MxD,QAAA,MAAM,YAAY;;iBA7LW,OAAO;;;;iBAAP,OAAO;;;;;;;;6EAiMlC,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,mBAAmB,SAAS,CAAC"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* @category Actions
|
|
6
6
|
* @useCases copy assistant reply, copy message to clipboard, chat message action, feedback action on message footer
|
|
7
7
|
* @keywords copy, clipboard, action, message, button, icon, feedback
|
|
8
|
-
* @related
|
|
8
|
+
* @related CkMessageButton, CkAgentMessage, CkConversation
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface CkCopyMessageButtonProps {
|
|
11
11
|
/** Plain text to copy to the clipboard. */
|
|
12
12
|
text: string;
|
|
13
13
|
/**
|
|
@@ -36,7 +36,7 @@ export interface CkCopyMessageActionButtonProps {
|
|
|
36
36
|
*/
|
|
37
37
|
writeToClipboard?: (text: string) => Promise<void>;
|
|
38
38
|
}
|
|
39
|
-
export interface
|
|
39
|
+
export interface CkCopyMessageButtonEmits {
|
|
40
40
|
/** Emitted after the clipboard operation finishes (success or failure). */
|
|
41
41
|
(e: 'copy', payload: {
|
|
42
42
|
success: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkCopyMessageButton/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC,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,wBAAwB;IACvC,2EAA2E;IAC3E,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAClD"}
|
|
@@ -10,12 +10,12 @@ declare const __VLS_base: import("vue").DefineComponent<CkDropZoneOverlayProps,
|
|
|
10
10
|
onFiles?: ((files: File[]) => any) | undefined;
|
|
11
11
|
onRejected?: ((rejections: CkDropZoneRejection[]) => any) | undefined;
|
|
12
12
|
}>, {
|
|
13
|
+
heading: string;
|
|
13
14
|
ariaLabel: string;
|
|
14
15
|
disabled: boolean;
|
|
15
16
|
accept: string;
|
|
16
17
|
maxFileSizeBytes: number;
|
|
17
18
|
maxFiles: number;
|
|
18
|
-
heading: string;
|
|
19
19
|
hint: string;
|
|
20
20
|
showErrors: boolean;
|
|
21
21
|
errorTimeoutMs: number;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @category Feedback
|
|
11
11
|
* @useCases like or dislike an assistant reply, collect binary message rating, lock feedback after submission, rate AI response
|
|
12
12
|
* @keywords feedback, thumbs up, thumbs down, like, dislike, rating, vote, action, message, button
|
|
13
|
-
* @related
|
|
13
|
+
* @related CkMessageButton, CkCopyMessageButton, CkAgentMessage, CkConversation
|
|
14
14
|
*/
|
|
15
15
|
export type CkFeedbackValue = 'up' | 'down' | null;
|
|
16
16
|
export interface CkFeedbackButtonProps {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload } from './types';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<CkFeedbackDialogProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
-
cancel: () => any;
|
|
4
3
|
submit: (payload: CkFeedbackDialogSubmitPayload) => any;
|
|
4
|
+
cancel: () => any;
|
|
5
5
|
"update:open": (open: boolean) => any;
|
|
6
6
|
}, string, import("vue").PublicProps, Readonly<CkFeedbackDialogProps> & Readonly<{
|
|
7
|
-
onCancel?: (() => any) | undefined;
|
|
8
7
|
onSubmit?: ((payload: CkFeedbackDialogSubmitPayload) => any) | undefined;
|
|
8
|
+
onCancel?: (() => any) | undefined;
|
|
9
9
|
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
10
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* capture a free-text comment, drive a two-step rating flow
|
|
19
19
|
* @keywords feedback, dialog, modal, reason codes, free text, qualitative,
|
|
20
20
|
* rating, comment
|
|
21
|
-
* @related CkFeedbackButton,
|
|
21
|
+
* @related CkFeedbackButton, CkMessageButton, CkAgentMessage,
|
|
22
22
|
* CkConversation, UiDialog, UiToggleGroup
|
|
23
23
|
*/
|
|
24
24
|
export type CkFeedbackSentiment = 'positive' | 'negative';
|
|
@@ -19,11 +19,11 @@ declare const __VLS_base: import("vue").DefineComponent<CkFileItemsListProps, {}
|
|
|
19
19
|
}>, {
|
|
20
20
|
size: UiFileItemSize;
|
|
21
21
|
disabled: boolean;
|
|
22
|
+
triggerLabel: string;
|
|
22
23
|
isRemovable: boolean;
|
|
23
24
|
removeLabel: string;
|
|
24
25
|
maxInline: number;
|
|
25
26
|
showStatus: boolean;
|
|
26
|
-
triggerLabel: string;
|
|
27
27
|
triggerAriaLabel: string;
|
|
28
28
|
listLabel: string;
|
|
29
29
|
popoverClass: string;
|
|
@@ -44,4 +44,19 @@ export declare const MathExpressions: Story;
|
|
|
44
44
|
* transform the AST before rendering (e.g. math, directive, custom nodes).
|
|
45
45
|
*/
|
|
46
46
|
export declare const WithCustomPlugin: Story;
|
|
47
|
+
/**
|
|
48
|
+
* The headline integration: an assistant reply is **markdown that contains
|
|
49
|
+
* inline `[n]` references**, and the `citations` prop turns each one into an
|
|
50
|
+
* interactive `CkCitation` (numbered marker + hover card) — handled as a
|
|
51
|
+
* dedicated case, distinct from ordinary markdown. Hover a marker to preview
|
|
52
|
+
* its source; the external-link action emits `open-source`.
|
|
53
|
+
*/
|
|
54
|
+
export declare const WithCitations: Story;
|
|
55
|
+
/**
|
|
56
|
+
* Unsupported markers degrade gracefully: a `[n]` with no matching source
|
|
57
|
+
* (here `[9]`) is left as plain text rather than rendered as a citation, while
|
|
58
|
+
* the markers that do have sources still render. Citation handling never
|
|
59
|
+
* touches code spans — the `[3]` inside `` `arr[3]` `` stays literal.
|
|
60
|
+
*/
|
|
61
|
+
export declare const WithUnsupportedAndCodeMarkers: Story;
|
|
47
62
|
//# sourceMappingURL=CkMarkdownRenderer.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkMarkdownRenderer.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAkBzC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqHnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAsB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,KA+BrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAwC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA0C/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KA4BzB,CAAC;AAsBF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAuB7B,CAAC;AAeF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAkB9B,CAAC"}
|
|
1
|
+
{"version":3,"file":"CkMarkdownRenderer.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,kBAAkB,CAkBzC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAqHnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAsB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,KA+BrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAwC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA0C/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KA4BzB,CAAC;AAsBF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAuB7B,CAAC;AAeF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAkB9B,CAAC;AAiEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,KAwB3B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAc3C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropType, type VNode } from 'vue';
|
|
2
2
|
import type { PluggableList } from 'unified';
|
|
3
|
+
import type { CkCitationSource } from '../CkCitation';
|
|
3
4
|
import type { CkMarkdownElementClasses } from './types';
|
|
4
5
|
declare const _default: typeof __VLS_export;
|
|
5
6
|
export default _default;
|
|
@@ -16,9 +17,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
16
17
|
type: PropType<PluggableList>;
|
|
17
18
|
default: undefined;
|
|
18
19
|
};
|
|
20
|
+
citations: {
|
|
21
|
+
type: PropType<CkCitationSource[]>;
|
|
22
|
+
default: undefined;
|
|
23
|
+
};
|
|
19
24
|
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
25
|
[key: string]: any;
|
|
21
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
'open-source': (url: string) => boolean;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
29
|
content: {
|
|
23
30
|
type: StringConstructor;
|
|
24
31
|
required: true;
|
|
@@ -31,8 +38,15 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
31
38
|
type: PropType<PluggableList>;
|
|
32
39
|
default: undefined;
|
|
33
40
|
};
|
|
34
|
-
|
|
41
|
+
citations: {
|
|
42
|
+
type: PropType<CkCitationSource[]>;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{
|
|
46
|
+
"onOpen-source"?: ((url: string) => any) | undefined;
|
|
47
|
+
}>, {
|
|
35
48
|
classes: CkMarkdownElementClasses;
|
|
36
49
|
plugins: PluggableList;
|
|
50
|
+
citations: CkCitationSource[];
|
|
37
51
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
38
52
|
//# sourceMappingURL=CkMarkdownRenderer.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CkMarkdownRenderer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CkMarkdownRenderer.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue"],"names":[],"mappings":"AAsKA,OAAO,EAKL,KAAK,QAAQ,EAEb,KAAK,KAAK,EACX,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;wBA2EnC,OAAO,YAAY;AAAxC,wBAAyC;AAQzC,QAAA,MAAM,YAAY;;;;;;cAKI,QAAQ,CAAC,wBAAwB,CAAC;;;;cAG1B,QAAQ,CAAC,aAAa,CAAC;;;;cAEhC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;;;;;;yBAKxB,MAAM;;;;;;;cAVT,QAAQ,CAAC,wBAAwB,CAAC;;;;cAG1B,QAAQ,CAAC,aAAa,CAAC;;;;cAEhC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;;;;;;;;;4EA0D/C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as CkMarkdownRenderer } from './CkMarkdownRenderer.vue';
|
|
2
|
-
export type { CkMarkdownRendererProps, CkMarkdownElementClasses, } from './types';
|
|
2
|
+
export type { CkMarkdownRendererProps, CkMarkdownRendererEmits, CkMarkdownElementClasses, } from './types';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACzE,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACzE,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PluggableList } from 'unified';
|
|
2
|
+
import type { CkCitationSource } from '../CkCitation';
|
|
2
3
|
export interface CkMarkdownElementClasses {
|
|
3
4
|
h1?: string;
|
|
4
5
|
h2?: string;
|
|
@@ -48,5 +49,29 @@ export interface CkMarkdownRendererProps {
|
|
|
48
49
|
classes?: CkMarkdownElementClasses;
|
|
49
50
|
/** Extra [unified](https://unifiedjs.com/) plugins to extend parsing. */
|
|
50
51
|
plugins?: PluggableList;
|
|
52
|
+
/**
|
|
53
|
+
* Citation sources for inline `[n]` references in `content`. When provided,
|
|
54
|
+
* each `[n]` whose number matches a source's `index` is rendered as an
|
|
55
|
+
* interactive `CkCitation` (numbered marker + hover card); unmatched markers
|
|
56
|
+
* stay as plain text. Fully opt-in — omit it and markdown renders unchanged.
|
|
57
|
+
*
|
|
58
|
+
* Notes for callers:
|
|
59
|
+
* - Any numeric `[n]` in prose is turned into a citation when source `n`
|
|
60
|
+
* exists — including incidental ones like array indexing (`arr[1]`). Wrap
|
|
61
|
+
* such text in a code span (`` `arr[1]` ``) to keep it literal. `[n]` inside
|
|
62
|
+
* code spans/blocks is never converted.
|
|
63
|
+
* - `index` must be unique across sources; on a collision the last wins.
|
|
64
|
+
* - Pass a stable/memoized array reference. A new array identity on every
|
|
65
|
+
* render forces the markdown processor to rebuild.
|
|
66
|
+
*/
|
|
67
|
+
citations?: CkCitationSource[];
|
|
68
|
+
}
|
|
69
|
+
export interface CkMarkdownRendererEmits {
|
|
70
|
+
/**
|
|
71
|
+
* Emitted when the user opens a citation's source from its card. The
|
|
72
|
+
* payload is the source `url`. Forward it to a handler that performs the
|
|
73
|
+
* (often auth-proxied) navigation.
|
|
74
|
+
*/
|
|
75
|
+
(e: 'open-source', url: string): void;
|
|
51
76
|
}
|
|
52
77
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkMarkdownRenderer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,uBAAuB;IACtC,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,yEAAyE;IACzE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,CAAC,CAAC,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|