@aleph-alpha/chat-kit 3.2.0 → 3.3.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.
Files changed (87) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-B-4xnH2c.js → CkInput.vue_vue_type_script_setup_true_lang-BAcBFs6I.js} +302 -71
  2. package/dist/chat-kit.css +6 -0
  3. package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts +7 -0
  4. package/dist/components/base/CkAgentMessage/CkAgentMessage.stories.d.ts.map +1 -1
  5. package/dist/components/base/CkCitation/CkCitation.stories.d.ts +47 -0
  6. package/dist/components/base/CkCitation/CkCitation.stories.d.ts.map +1 -0
  7. package/dist/components/base/CkCitation/CkCitation.vue.d.ts +15 -0
  8. package/dist/components/base/CkCitation/CkCitation.vue.d.ts.map +1 -0
  9. package/dist/components/base/CkCitation/index.d.ts +3 -0
  10. package/dist/components/base/CkCitation/index.d.ts.map +1 -0
  11. package/dist/components/base/CkCitation/types.d.ts +79 -0
  12. package/dist/components/base/CkCitation/types.d.ts.map +1 -0
  13. package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts +51 -0
  14. package/dist/components/base/CkCitationCard/CkCitationCard.stories.d.ts.map +1 -0
  15. package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts +13 -0
  16. package/dist/components/base/CkCitationCard/CkCitationCard.vue.d.ts.map +1 -0
  17. package/dist/components/base/CkCitationCard/index.d.ts +3 -0
  18. package/dist/components/base/CkCitationCard/index.d.ts.map +1 -0
  19. package/dist/components/base/CkCitationCard/types.d.ts +51 -0
  20. package/dist/components/base/CkCitationCard/types.d.ts.map +1 -0
  21. package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts +1 -1
  22. package/dist/components/base/CkFeedbackDialog/CkFeedbackDialog.vue.d.ts +2 -2
  23. package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -1
  24. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts +15 -0
  25. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.d.ts.map +1 -1
  26. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts +16 -2
  27. package/dist/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue.d.ts.map +1 -1
  28. package/dist/components/base/CkMarkdownRenderer/index.d.ts +1 -1
  29. package/dist/components/base/CkMarkdownRenderer/index.d.ts.map +1 -1
  30. package/dist/components/base/CkMarkdownRenderer/types.d.ts +25 -0
  31. package/dist/components/base/CkMarkdownRenderer/types.d.ts.map +1 -1
  32. package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts +17 -0
  33. package/dist/components/base/CkMarkdownRenderer/useCitationRendering.d.ts.map +1 -0
  34. package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts +1 -1
  35. package/dist/components/base/index.d.ts +5 -1
  36. package/dist/components/base/index.d.ts.map +1 -1
  37. package/dist/components/composed/CkInput/CkInput.vue.d.ts +1 -1
  38. package/dist/components/index.d.ts +2 -2
  39. package/dist/components/index.d.ts.map +1 -1
  40. package/dist/components/index.js +25 -23
  41. package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
  42. package/dist/composables/fileUpload/useFileUploadWrapper.d.ts.map +1 -1
  43. package/dist/composables/index.js +1 -1
  44. package/dist/handlers/index.d.ts +2 -0
  45. package/dist/handlers/index.d.ts.map +1 -1
  46. package/dist/handlers/index.js +3 -2
  47. package/dist/handlers/useChatKitLabels.d.ts +11 -0
  48. package/dist/handlers/useChatKitLabels.d.ts.map +1 -1
  49. package/dist/handlers/useMarkdownParser.d.ts.map +1 -1
  50. package/dist/helpers/unified/remarkCitations.d.ts +17 -0
  51. package/dist/helpers/unified/remarkCitations.d.ts.map +1 -0
  52. package/dist/{index-DAmWGYNH.js → index-C6njJ8EB.js} +85 -70
  53. package/dist/index.d.ts +2 -2
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +28 -26
  56. package/dist/{useChatKitLabels-D5gNv8se.js → useChatKitLabels-BM2I7-9o.js} +30 -3
  57. package/package.json +4 -2
  58. package/src/components/base/CkAgentMessage/CkAgentMessage.stories.ts +112 -0
  59. package/src/components/base/CkCitation/CkCitation.spec.ts +79 -0
  60. package/src/components/base/CkCitation/CkCitation.stories.ts +136 -0
  61. package/src/components/base/CkCitation/CkCitation.vue +145 -0
  62. package/src/components/base/CkCitation/index.ts +2 -0
  63. package/src/components/base/CkCitation/types.ts +80 -0
  64. package/src/components/base/CkCitationCard/CkCitationCard.spec.ts +77 -0
  65. package/src/components/base/CkCitationCard/CkCitationCard.stories.ts +144 -0
  66. package/src/components/base/CkCitationCard/CkCitationCard.vue +76 -0
  67. package/src/components/base/CkCitationCard/index.ts +2 -0
  68. package/src/components/base/CkCitationCard/types.ts +51 -0
  69. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.spec.ts +124 -0
  70. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.stories.ts +118 -0
  71. package/src/components/base/CkMarkdownRenderer/CkMarkdownRenderer.vue +70 -28
  72. package/src/components/base/CkMarkdownRenderer/index.ts +1 -0
  73. package/src/components/base/CkMarkdownRenderer/types.ts +26 -0
  74. package/src/components/base/CkMarkdownRenderer/useCitationRendering.spec.ts +94 -0
  75. package/src/components/base/CkMarkdownRenderer/useCitationRendering.ts +52 -0
  76. package/src/components/base/index.ts +12 -0
  77. package/src/components/index.ts +8 -0
  78. package/src/composables/fileUpload/useFileUpload.spec.ts +2 -61
  79. package/src/composables/fileUpload/useFileUpload.ts +2 -9
  80. package/src/composables/fileUpload/useFileUploadWrapper.spec.ts +195 -14
  81. package/src/composables/fileUpload/useFileUploadWrapper.ts +114 -81
  82. package/src/handlers/index.ts +2 -0
  83. package/src/handlers/useChatKitLabels.ts +13 -0
  84. package/src/handlers/useMarkdownParser.ts +5 -2
  85. package/src/helpers/unified/remarkCitations.spec.ts +112 -0
  86. package/src/helpers/unified/remarkCitations.ts +55 -0
  87. package/src/index.ts +8 -0
@@ -1,26 +1,28 @@
1
- import { _, a, b, C, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u } from "../CkInput.vue_vue_type_script_setup_true_lang-B-4xnH2c.js";
1
+ import { _, C, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w } from "../CkInput.vue_vue_type_script_setup_true_lang-BAcBFs6I.js";
2
2
  export {
3
3
  _ as CkAgentMessage,
4
- a as CkConversation,
5
- b as CkConversationLayout,
6
- C as CkCopyMessageActionButton,
7
- c as CkDropZoneOverlay,
8
- d as CkFeedbackButton,
9
- e as CkFeedbackDialog,
10
- f as CkFileItemsList,
11
- g as CkHistory,
12
- h as CkHistoryItem,
13
- i as CkHistoryWrapper,
14
- j as CkInput,
15
- k as CkMarkdownRenderer,
16
- l as CkMessageActionButton,
17
- m as CkModelSelector,
18
- n as CkPromptInput,
19
- o as CkPromptInputDisclaimer,
20
- p as CkPromptMenuButton,
21
- q as CkPromptSendButton,
22
- r as CkPromptStopButton,
23
- s as CkSendIcon,
24
- t as CkStopIcon,
25
- u as CkUserMessage
4
+ C as CkCitation,
5
+ a as CkCitationCard,
6
+ b as CkConversation,
7
+ c as CkConversationLayout,
8
+ d as CkCopyMessageActionButton,
9
+ e as CkDropZoneOverlay,
10
+ f as CkFeedbackButton,
11
+ g as CkFeedbackDialog,
12
+ h as CkFileItemsList,
13
+ i as CkHistory,
14
+ j as CkHistoryItem,
15
+ k as CkHistoryWrapper,
16
+ l as CkInput,
17
+ m as CkMarkdownRenderer,
18
+ n as CkMessageActionButton,
19
+ o as CkModelSelector,
20
+ p as CkPromptInput,
21
+ q as CkPromptInputDisclaimer,
22
+ r as CkPromptMenuButton,
23
+ s as CkPromptSendButton,
24
+ t as CkPromptStopButton,
25
+ u as CkSendIcon,
26
+ v as CkStopIcon,
27
+ w as CkUserMessage
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUpload.d.ts","sourceRoot":"","sources":["../../../src/composables/fileUpload/useFileUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAkBL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAKzB,MAAM,SAAS,CAAC;AAEjB,cAAc,SAAS,CAAC;AAybxB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CA0zBrB"}
1
+ {"version":3,"file":"useFileUpload.d.ts","sourceRoot":"","sources":["../../../src/composables/fileUpload/useFileUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAkBL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAKzB,MAAM,SAAS,CAAC;AAEjB,cAAc,SAAS,CAAC;AAybxB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CAmzBrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFileUploadWrapper.d.ts","sourceRoot":"","sources":["../../../src/composables/fileUpload/useFileUploadWrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAOV,oBAAoB,EACpB,sBAAsB,EAIvB,MAAM,SAAS,CAAC;AAkJjB,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,sBAAsB,CA4SxB"}
1
+ {"version":3,"file":"useFileUploadWrapper.d.ts","sourceRoot":"","sources":["../../../src/composables/fileUpload/useFileUploadWrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAOV,oBAAoB,EACpB,sBAAsB,EAIvB,MAAM,SAAS,CAAC;AAiJjB,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,sBAAsB,CA8UxB"}
@@ -1,4 +1,4 @@
1
- import { c, d, u, b, e, f } from "../index-DAmWGYNH.js";
1
+ import { c, d, u, b, e, f } from "../index-C6njJ8EB.js";
2
2
  export {
3
3
  c as createDocumentUploadProvider,
4
4
  d as defaultDocumentUploadConfig,
@@ -1,6 +1,8 @@
1
1
  export { useMessageHandler } from './useMessageHandler';
2
2
  export { useMarkdownParser } from './useMarkdownParser';
3
3
  export { remarkNormalizeMath, normalizeMathDelimiters, } from '../helpers/unified/remarkNormalizeMath';
4
+ export { remarkCitations } from '../helpers/unified/remarkCitations';
5
+ export type { RemarkCitationsOptions } from '../helpers/unified/remarkCitations';
4
6
  export { provideChatKitLabels, useChatKitLabels, defaultChatKitLabels, CHAT_KIT_LABELS, } from './useChatKitLabels';
5
7
  export type { ChatKitLabels } from './useChatKitLabels';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import { u } from "../useMessageHandler-CMdy-lm0.js";
2
- import { C, d, n, p, r, u as u2, a } from "../useChatKitLabels-D5gNv8se.js";
2
+ import { C, d, n, p, r, b, u as u2, a } from "../useChatKitLabels-BM2I7-9o.js";
3
3
  export {
4
4
  C as CHAT_KIT_LABELS,
5
5
  d as defaultChatKitLabels,
6
6
  n as normalizeMathDelimiters,
7
7
  p as provideChatKitLabels,
8
- r as remarkNormalizeMath,
8
+ r as remarkCitations,
9
+ b as remarkNormalizeMath,
9
10
  u2 as useChatKitLabels,
10
11
  a as useMarkdownParser,
11
12
  u as useMessageHandler
@@ -79,6 +79,17 @@ export type ChatKitLabels = {
79
79
  * can scroll wide tables). Falls back to `defaultChatKitLabels` when omitted.
80
80
  */
81
81
  markdownTableLabel?: string;
82
+ /**
83
+ * Accessible label for the external-link action in a citation card
84
+ * (`CkCitation` / `CkCitationCard`). Falls back to `defaultChatKitLabels`.
85
+ */
86
+ citationOpenSource?: string;
87
+ /**
88
+ * Prefix for a citation marker's accessible name in `CkCitation`, composed
89
+ * as `"{citationSourceLabel} {index}"` (e.g. "Source 1"). Falls back to
90
+ * `defaultChatKitLabels`.
91
+ */
92
+ citationSourceLabel?: string;
82
93
  /** Fallback title used by `CkHistory` when a conversation has no `title`. */
83
94
  historyItemUntitled: string;
84
95
  /** 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,g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aAiClC,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 +1 @@
1
- {"version":3,"file":"useMarkdownParser.d.ts","sourceRoot":"","sources":["../../src/handlers/useMarkdownParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAW,MAAM,KAAK,CAAC;AAC/D,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAQtD,OAAO,0BAA0B,CAAC;AAkFlC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;;EA0BrD"}
1
+ {"version":3,"file":"useMarkdownParser.d.ts","sourceRoot":"","sources":["../../src/handlers/useMarkdownParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,gBAAgB,EAAW,MAAM,KAAK,CAAC;AAC/D,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAQtD,OAAO,0BAA0B,CAAC;AAqFlC,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,EAAE,gBAAgB,CAAC,aAAa,GAAG,SAAS,CAAC;;EA0BrD"}
@@ -0,0 +1,17 @@
1
+ import type { Plugin } from 'unified';
2
+ export interface RemarkCitationsOptions {
3
+ /**
4
+ * When provided, only `[n]` markers whose number is in this set are turned
5
+ * into citation placeholders; any other `[n]` is left as literal text
6
+ * (an "unsupported" marker with no backing source). When omitted, every
7
+ * `[n]` is treated as a citation.
8
+ */
9
+ indices?: ReadonlySet<number>;
10
+ }
11
+ /**
12
+ * Replaces inline `[n]` citation references in the parsed markdown with a
13
+ * placeholder element (`<span data-citation-index="n">n</span>`) that survives
14
+ * stringify + sanitisation (`data-*` attributes are allowed by default).
15
+ */
16
+ export declare const remarkCitations: Plugin<[RemarkCitationsOptions?]>;
17
+ //# sourceMappingURL=remarkCitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remarkCitations.d.ts","sourceRoot":"","sources":["../../../src/helpers/unified/remarkCitations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAItC,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAQD;;;;GAIG;AAIH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,CAAC,sBAAsB,CAAC,CAAC,CA0B7D,CAAC"}
@@ -765,13 +765,10 @@ function useFileUpload(options) {
765
765
  }
766
766
  async function upload(params) {
767
767
  const fileList = Array.isArray(params.files) ? params.files : [params.files];
768
- const activeFileCount = [...files.value.values()].filter(
769
- (e) => e.status !== "failed" && e.status !== "cancelled" && e.status !== "removed"
770
- ).length;
771
- if (activeFileCount + fileList.length > constraints.maxFilesPerUpload) {
768
+ if (fileList.length > constraints.maxFilesPerUpload) {
772
769
  throw new SdkError(
773
770
  "MAX_FILES_EXCEEDED",
774
- `Cannot upload ${fileList.length} file(s) — ${activeFileCount} already active, maximum is ${constraints.maxFilesPerUpload}.`
771
+ `Cannot upload ${fileList.length} file(s) — maximum per selection is ${constraints.maxFilesPerUpload}.`
775
772
  );
776
773
  }
777
774
  const mergedMeta = {
@@ -1346,68 +1343,80 @@ function createDocumentUploadProvider(config) {
1346
1343
  ...config.headers ?? {}
1347
1344
  };
1348
1345
  const httpClient = buildHttpClient(baseUrl, defaultHeaders);
1349
- const endpoints = defaultEndpoints;
1350
- let resolvedStoreId = null;
1351
- let resolvePromise = null;
1352
- const resolvedWorkflowIdByStore = /* @__PURE__ */ new Map();
1353
- async function createWorkflowForStore(storeId) {
1354
- const workflowRes = await httpClient.post(
1355
- endpoints.createWorkflow(storeId),
1346
+ const storeIdByConversation = /* @__PURE__ */ new Map();
1347
+ const resolvePromises = /* @__PURE__ */ new Map();
1348
+ function searchStoreNameForConversation(conversationId) {
1349
+ return conversationId;
1350
+ }
1351
+ function findConfiguredWorkflow(items) {
1352
+ const configuredWorkflowName = typeof workflowConfig.name === "string" ? workflowConfig.name : void 0;
1353
+ return items?.find(
1354
+ (workflow) => workflow.id === workflowId || workflow.name === workflowId || configuredWorkflowName != null && workflow.name === configuredWorkflowName
1355
+ );
1356
+ }
1357
+ async function resolveWorkflowId(storeId) {
1358
+ const response = await httpClient.get(
1359
+ `search-stores/${storeId}/workflows`
1360
+ );
1361
+ const existing = findConfiguredWorkflow(response.items);
1362
+ if (existing) {
1363
+ return existing.id;
1364
+ }
1365
+ const created = await httpClient.post(
1366
+ `search-stores/${storeId}/workflows`,
1356
1367
  workflowConfig
1357
1368
  );
1358
- return workflowRes.id;
1369
+ return created.id;
1359
1370
  }
1360
- async function createSearchStoreWithWorkflow() {
1361
- const name = `store-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
1371
+ async function createSearchStore(conversationId) {
1362
1372
  const storeRes = await httpClient.post("search-stores", {
1363
- name,
1373
+ name: searchStoreNameForConversation(conversationId),
1364
1374
  ...searchStoreConfig
1365
1375
  });
1366
- const newStoreId = storeRes.id;
1367
- const workflowApiId = await createWorkflowForStore(newStoreId);
1368
- resolvedWorkflowIdByStore.set(newStoreId, workflowApiId);
1369
- return newStoreId;
1376
+ await httpClient.post(
1377
+ `search-stores/${storeRes.id}/workflows`,
1378
+ workflowConfig
1379
+ );
1380
+ return storeRes.id;
1370
1381
  }
1371
- async function fetchOrCreateWorkflow(storeId) {
1372
- const cached = resolvedWorkflowIdByStore.get(storeId);
1373
- if (cached) return cached;
1374
- const response = await httpClient.get(
1375
- endpoints.workflows(storeId)
1382
+ function findStoreForConversation(items, conversationId) {
1383
+ const expectedName = searchStoreNameForConversation(conversationId);
1384
+ const expectedModel = searchStoreConfig.models[0]?.embedding_model;
1385
+ return items.find(
1386
+ (store) => store.name === expectedName && (!expectedModel || store.models.some((m) => m.embedding_model === expectedModel))
1376
1387
  );
1377
- if (response.items.length > 0) {
1378
- const match = response.items.find((item) => item.name === workflowId);
1379
- const selected = match ?? response.items[0];
1380
- resolvedWorkflowIdByStore.set(storeId, selected.id);
1381
- return selected.id;
1388
+ }
1389
+ async function fetchOrCreateStore(conversationId) {
1390
+ const response = await httpClient.get("search-stores");
1391
+ const existing = findStoreForConversation(response.items, conversationId);
1392
+ if (existing) {
1393
+ await resolveWorkflowId(existing.id);
1394
+ storeIdByConversation.set(conversationId, existing.id);
1395
+ return existing.id;
1382
1396
  }
1383
- const workflowApiId = await createWorkflowForStore(storeId);
1384
- resolvedWorkflowIdByStore.set(storeId, workflowApiId);
1385
- return workflowApiId;
1397
+ const newStoreId = await createSearchStore(conversationId);
1398
+ storeIdByConversation.set(conversationId, newStoreId);
1399
+ return newStoreId;
1386
1400
  }
1387
- async function fetchOrCreateStore() {
1388
- try {
1389
- const response = await httpClient.get("search-stores");
1390
- const expectedModel = searchStoreConfig.models[0]?.embedding_model;
1391
- const match = response.items.find(
1392
- (store) => store.models.some((m) => m.embedding_model === expectedModel)
1393
- );
1394
- if (match) {
1395
- resolvedStoreId = match.id;
1396
- return resolvedStoreId;
1397
- }
1398
- resolvedStoreId = await createSearchStoreWithWorkflow();
1399
- return resolvedStoreId;
1400
- } catch (err) {
1401
- resolvePromise = null;
1401
+ async function resolveSearchStore(conversationId) {
1402
+ if (!conversationId) {
1403
+ throw new Error("conversationId is required to resolve a search store.");
1404
+ }
1405
+ const cached = storeIdByConversation.get(conversationId);
1406
+ if (cached) return cached;
1407
+ const pending = resolvePromises.get(conversationId);
1408
+ if (pending) return pending;
1409
+ const promise = fetchOrCreateStore(conversationId).catch((err) => {
1410
+ storeIdByConversation.delete(conversationId);
1402
1411
  throw err;
1412
+ });
1413
+ resolvePromises.set(conversationId, promise);
1414
+ try {
1415
+ return await promise;
1416
+ } finally {
1417
+ resolvePromises.delete(conversationId);
1403
1418
  }
1404
1419
  }
1405
- async function resolveSearchStore() {
1406
- if (resolvedStoreId) return resolvedStoreId;
1407
- if (resolvePromise) return resolvePromise;
1408
- resolvePromise = fetchOrCreateStore();
1409
- return resolvePromise;
1410
- }
1411
1420
  let instance = null;
1412
1421
  function purgeInterruptedFiles() {
1413
1422
  if (!instance) return;
@@ -1441,33 +1450,40 @@ function createDocumentUploadProvider(config) {
1441
1450
  const fileInput = ref(null);
1442
1451
  const upload = getUploadInstance();
1443
1452
  const resolvedMaxFiles = upload.getSupportedFileTypes().maxFilesPerUpload;
1444
- const storeId = ref(resolvedStoreId ?? "");
1453
+ const storeId = ref(
1454
+ storeIdByConversation.get(toValue(conversationIdRef)) ?? ""
1455
+ );
1445
1456
  const currentScope = shallowRef(
1446
1457
  upload.scopeBy("conversationId", toValue(conversationIdRef))
1447
1458
  );
1448
1459
  watch(
1449
1460
  () => toValue(conversationIdRef),
1450
- (newId, oldId) => {
1451
- if (oldId && oldId !== newId) {
1452
- const oldScope = upload.scopeBy("conversationId", oldId);
1453
- for (const entry of oldScope.files.value) {
1454
- upload.updateFileMetadata(entry.id, { conversationId: newId });
1455
- }
1456
- }
1461
+ async (newId) => {
1457
1462
  currentScope.value = upload.scopeBy("conversationId", newId);
1458
- }
1463
+ if (!newId) {
1464
+ storeId.value = "";
1465
+ return;
1466
+ }
1467
+ try {
1468
+ storeId.value = await resolveSearchStore(newId);
1469
+ } catch {
1470
+ storeId.value = "";
1471
+ }
1472
+ },
1473
+ { immediate: true }
1459
1474
  );
1460
1475
  function scopedFiles() {
1461
1476
  return currentScope.value?.files.value ?? [];
1462
1477
  }
1463
1478
  async function uploadFiles(files) {
1464
1479
  if (!files.length) return;
1465
- const userStoreId = await resolveSearchStore();
1466
- const workflowApiId = await fetchOrCreateWorkflow(userStoreId);
1480
+ const conversationId = toValue(conversationIdRef);
1481
+ if (!conversationId) return;
1482
+ const userStoreId = await resolveSearchStore(conversationId);
1483
+ const workflowApiId = await resolveWorkflowId(userStoreId);
1467
1484
  upload.setStoreId(userStoreId);
1468
1485
  upload.setWorkflowId(workflowApiId);
1469
1486
  storeId.value = userStoreId;
1470
- const conversationId = toValue(conversationIdRef);
1471
1487
  const result = await upload.upload({
1472
1488
  id: `${conversationId}::${Date.now()}`,
1473
1489
  files,
@@ -1521,12 +1537,11 @@ function createDocumentUploadProvider(config) {
1521
1537
  function handleFilesSelected(event, options) {
1522
1538
  const input = event.target;
1523
1539
  let fileList = Array.from(input.files ?? []);
1524
- const availableSlots = resolvedMaxFiles - unassignedFiles.value.length;
1525
- if (fileList.length > availableSlots) {
1526
- const kept = Math.max(0, availableSlots);
1540
+ if (fileList.length > resolvedMaxFiles) {
1541
+ const kept = Math.max(0, resolvedMaxFiles);
1527
1542
  options?.onFilesExceeded?.({
1528
1543
  selected: fileList.length,
1529
- allowed: availableSlots,
1544
+ allowed: resolvedMaxFiles,
1530
1545
  kept
1531
1546
  });
1532
1547
  fileList = fileList.slice(0, kept);
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { useChat, useConversationSessions, useConversations, } from './composabl
5
5
  export type { ChatActions, ChatState, ConversationSession, CreateConversationInput, MessageHandler, MutationOptions, UseChatReturn, UseConversationSessionsReturn, UseConversationsOptions, UseConversationsReturn, } from './composables';
6
6
  export { SdkError, createDocumentUploadProvider, defaultDocumentUploadConfig, defaultEndpoints, useDocumentUploadWithDefaultConfig, } from './composables/fileUpload';
7
7
  export type { DocumentUploadConfig, DocumentUploadProvider, FileEntry, FileStatus, } from './composables/fileUpload';
8
- export { CkAgentMessage, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkDropZoneOverlay, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkModelSelector, CkPromptSendButton, CkPromptMenuButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
9
- export type { CkConversationLayoutProps, CkConversationProps, CkDropZoneOverlayProps, CkDropZoneOverlayEmits, CkDropZoneRejection, CkDropZoneRejectionReason, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkModelOption, CkModelSelectorProps, CkModelSelectorEmits, CkPromptMenuButtonProps, CkUserMessageProps, } from './components';
8
+ export { CkAgentMessage, CkCitation, CkCitationCard, CkConversation, CkConversationLayout, CkCopyMessageActionButton, CkDropZoneOverlay, CkFeedbackButton, CkFeedbackDialog, CkFileItemsList, CkHistory, CkHistoryItem, CkHistoryWrapper, CkInput, CkMarkdownRenderer, CkMessageActionButton, CkModelSelector, CkPromptSendButton, CkPromptMenuButton, CkPromptStopButton, CkPromptInput, CkPromptInputDisclaimer, CkSendIcon, CkStopIcon, CkUserMessage, } from './components';
9
+ export type { CkCitationProps, CkCitationEmits, CkCitationSource, CkCitationCardProps, CkCitationCardEmits, CkConversationLayoutProps, CkConversationProps, CkDropZoneOverlayProps, CkDropZoneOverlayEmits, CkDropZoneRejection, CkDropZoneRejectionReason, CkFeedbackButtonProps, CkFeedbackDialogEmits, CkFeedbackDialogProps, CkFeedbackDialogSubmitPayload, CkFeedbackReason, CkFeedbackSentiment, CkFeedbackValue, CkFileEntry, CkFileItemsListEmits, CkFileItemsListProps, CkHistoryEmits, CkHistoryItemEmits, CkHistoryItemProps, CkHistoryProps, CkHistoryWrapperProps, CkMarkdownElementClasses, CkMarkdownRendererProps, CkMarkdownRendererEmits, CkModelOption, CkModelSelectorProps, CkModelSelectorEmits, CkPromptMenuButtonProps, CkUserMessageProps, } from './components';
10
10
  export { formatRelativeTime } from './helpers';
11
11
  export type { BaseMessage, Conversation, ConversationTree, MessageContent, MessageContentStatus, MessageMetadata, MessageReasoningContent, MessageRole, MessageStatus, MessageTextContent, MessageToolContent, TreeMessage, } from './types';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AASpB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,EACL,OAAO,EACP,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,QAAQ,EACR,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAA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AyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,38 +1,40 @@
1
1
  import { u } from "./useMessageHandler-CMdy-lm0.js";
2
- import { C, d, p, u as u2, a } from "./useChatKitLabels-D5gNv8se.js";
3
- import { S, c, d as d2, a as a2, u as u3, b, e, f } from "./index-DAmWGYNH.js";
4
- import { _, a as a3, b as b2, C as C2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r, s, t, u as u4, v } from "./CkInput.vue_vue_type_script_setup_true_lang-B-4xnH2c.js";
2
+ import { C, d, p, u as u2, a } from "./useChatKitLabels-BM2I7-9o.js";
3
+ import { S, c, d as d2, a as a2, u as u3, b, e, f } from "./index-C6njJ8EB.js";
4
+ import { _, C as C2, a as a3, b as b2, c as c2, d as d3, e as e2, f as f2, g, h, i, j, k, l, m, n, o, p as p2, q, r, s, t, u as u4, v, w, x } from "./CkInput.vue_vue_type_script_setup_true_lang-BAcBFs6I.js";
5
5
  export {
6
6
  C as CHAT_KIT_LABELS,
7
7
  _ as CkAgentMessage,
8
- a3 as CkConversation,
9
- b2 as CkConversationLayout,
10
- C2 as CkCopyMessageActionButton,
11
- c2 as CkDropZoneOverlay,
12
- d3 as CkFeedbackButton,
13
- e2 as CkFeedbackDialog,
14
- f2 as CkFileItemsList,
15
- g as CkHistory,
16
- h as CkHistoryItem,
17
- i as CkHistoryWrapper,
18
- j as CkInput,
19
- k as CkMarkdownRenderer,
20
- l as CkMessageActionButton,
21
- m as CkModelSelector,
22
- n as CkPromptInput,
23
- o as CkPromptInputDisclaimer,
24
- p2 as CkPromptMenuButton,
25
- q as CkPromptSendButton,
26
- r as CkPromptStopButton,
27
- s as CkSendIcon,
28
- t as CkStopIcon,
29
- u4 as CkUserMessage,
8
+ C2 as CkCitation,
9
+ a3 as CkCitationCard,
10
+ b2 as CkConversation,
11
+ c2 as CkConversationLayout,
12
+ d3 as CkCopyMessageActionButton,
13
+ e2 as CkDropZoneOverlay,
14
+ f2 as CkFeedbackButton,
15
+ g as CkFeedbackDialog,
16
+ h as CkFileItemsList,
17
+ i as CkHistory,
18
+ j as CkHistoryItem,
19
+ k as CkHistoryWrapper,
20
+ l as CkInput,
21
+ m as CkMarkdownRenderer,
22
+ n as CkMessageActionButton,
23
+ o as CkModelSelector,
24
+ p2 as CkPromptInput,
25
+ q as CkPromptInputDisclaimer,
26
+ r as CkPromptMenuButton,
27
+ s as CkPromptSendButton,
28
+ t as CkPromptStopButton,
29
+ u4 as CkSendIcon,
30
+ v as CkStopIcon,
31
+ w as CkUserMessage,
30
32
  S as SdkError,
31
33
  c as createDocumentUploadProvider,
32
34
  d as defaultChatKitLabels,
33
35
  d2 as defaultDocumentUploadConfig,
34
36
  a2 as defaultEndpoints,
35
- v as formatRelativeTime,
37
+ x as formatRelativeTime,
36
38
  p as provideChatKitLabels,
37
39
  u3 as useChat,
38
40
  u2 as useChatKitLabels,
@@ -28622,8 +28622,8 @@ const SANITIZE_CONFIG = {
28622
28622
  };
28623
28623
  function buildProcessor(plugins) {
28624
28624
  let proc = unified().use(remarkParse).use(remarkNormalizeMath).use(remarkGfm).use(remarkMath);
28625
- for (const plugin of plugins) {
28626
- proc = proc.use(plugin);
28625
+ if (plugins.length > 0) {
28626
+ proc = proc.use(plugins);
28627
28627
  }
28628
28628
  return proc.use(remarkRehype).use(rehypeKatex).use(rehypeStringify);
28629
28629
  }
@@ -28650,6 +28650,30 @@ function useMarkdownParser(source, plugins) {
28650
28650
  });
28651
28651
  return { html: html2 };
28652
28652
  }
28653
+ const CITATION_RE = /\[(\d+)\]/g;
28654
+ const remarkCitations = (options = {}) => {
28655
+ const { indices } = options;
28656
+ return (tree) => {
28657
+ findAndReplace(tree, [
28658
+ CITATION_RE,
28659
+ (_match, digits) => {
28660
+ const index2 = Number(digits);
28661
+ if (index2 < 1) return false;
28662
+ if (indices && !indices.has(index2)) return false;
28663
+ return {
28664
+ type: "citationReference",
28665
+ data: {
28666
+ hName: "span",
28667
+ // Use the literal attribute name so the placeholder contract matches
28668
+ // the renderer's `getAttribute('data-citation-index')` lookup exactly.
28669
+ hProperties: { "data-citation-index": index2 },
28670
+ hChildren: [{ type: "text", value: String(index2) }]
28671
+ }
28672
+ };
28673
+ }
28674
+ ]);
28675
+ };
28676
+ };
28653
28677
  const defaultChatKitLabels = {
28654
28678
  agentAvatarAlt: "Agent avatar",
28655
28679
  agentLoadingAvatarAlt: "Agent loading",
@@ -28674,6 +28698,8 @@ const defaultChatKitLabels = {
28674
28698
  modelSelectorListAriaLabel: "Models",
28675
28699
  modelSelectorPlaceholder: "Select model",
28676
28700
  markdownTableLabel: "Table",
28701
+ citationOpenSource: "Open source",
28702
+ citationSourceLabel: "Source",
28677
28703
  historyItemUntitled: "Untitled conversation",
28678
28704
  historyItemActionAriaLabel: "Conversation options",
28679
28705
  historyItemEditAction: "Edit",
@@ -28696,9 +28722,10 @@ function useChatKitLabels() {
28696
28722
  export {
28697
28723
  CHAT_KIT_LABELS as C,
28698
28724
  useMarkdownParser as a,
28725
+ remarkNormalizeMath as b,
28699
28726
  defaultChatKitLabels as d,
28700
28727
  normalizeMathDelimiters as n,
28701
28728
  provideChatKitLabels as p,
28702
- remarkNormalizeMath as r,
28729
+ remarkCitations as r,
28703
28730
  useChatKitLabels as u
28704
28731
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aleph-alpha/chat-kit",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Chat kit package for building chat interfaces with Vue",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -68,6 +68,7 @@
68
68
  "@aleph-alpha/ui-library": "^2.8.3",
69
69
  "dompurify": "^3.3.2",
70
70
  "katex": "^0.17.0",
71
+ "mdast-util-find-and-replace": "^3.0.2",
71
72
  "rehype-katex": "^7.0.1",
72
73
  "rehype-stringify": "^10.0.1",
73
74
  "remark-gfm": "^4.0.1",
@@ -84,6 +85,7 @@
84
85
  "@testing-library/jest-dom": "6.9.1",
85
86
  "@testing-library/vue": "8.1.0",
86
87
  "@types/dompurify": "^3.2.0",
88
+ "@types/mdast": "^4.0.4",
87
89
  "@types/node": "^25.1.0",
88
90
  "@unocss/preset-wind4": "^66.6.2",
89
91
  "@unocss/reset": "^66.6.2",
@@ -100,8 +102,8 @@
100
102
  "vitest": "3.2.6",
101
103
  "vue": "^3.5.27",
102
104
  "vue-tsc": "^3.2.4",
103
- "@aleph-alpha/prettier-config-frontend": "2.1.0",
104
105
  "@aleph-alpha/tsconfig-frontend": "0.7.0",
106
+ "@aleph-alpha/prettier-config-frontend": "2.1.0",
105
107
  "@aleph-alpha/eslint-config-frontend": "0.7.0"
106
108
  },
107
109
  "scripts": {