@aleph-alpha/chat-kit 2.2.0 → 3.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.
Files changed (102) hide show
  1. package/dist/{CkInput.vue_vue_type_script_setup_true_lang-CjfKRuZs.js → CkInput.vue_vue_type_script_setup_true_lang-CwH5M5WD.js} +263 -142
  2. package/dist/chat-kit.css +33 -6
  3. package/dist/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue.d.ts.map +1 -1
  4. package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts +7 -0
  5. package/dist/components/base/CkFileItemsList/CkFileItemsList.stories.d.ts.map +1 -1
  6. package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts +1 -0
  7. package/dist/components/base/CkFileItemsList/CkFileItemsList.vue.d.ts.map +1 -1
  8. package/dist/components/base/CkFileItemsList/types.d.ts +9 -0
  9. package/dist/components/base/CkFileItemsList/types.d.ts.map +1 -1
  10. package/dist/components/base/CkModelSelector/types.d.ts +1 -1
  11. package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts +48 -5
  12. package/dist/components/base/CkPromptInput/CkPromptInput.stories.d.ts.map +1 -1
  13. package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts +7 -6
  14. package/dist/components/base/CkPromptInput/CkPromptInput.vue.d.ts.map +1 -1
  15. package/dist/components/base/CkPromptInput/types.d.ts +11 -12
  16. package/dist/components/base/CkPromptInput/types.d.ts.map +1 -1
  17. package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts +18 -0
  18. package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.d.ts.map +1 -0
  19. package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts +18 -0
  20. package/dist/components/base/CkPromptMenuButton/CkPromptMenuButton.vue.d.ts.map +1 -0
  21. package/dist/components/base/CkPromptMenuButton/index.d.ts +3 -0
  22. package/dist/components/base/CkPromptMenuButton/index.d.ts.map +1 -0
  23. package/dist/components/base/CkPromptMenuButton/types.d.ts +30 -0
  24. package/dist/components/base/CkPromptMenuButton/types.d.ts.map +1 -0
  25. package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.stories.d.ts → CkPromptSendButton/CkPromptSendButton.stories.d.ts} +5 -5
  26. package/dist/components/base/CkPromptSendButton/CkPromptSendButton.stories.d.ts.map +1 -0
  27. package/dist/components/base/{CkPromptActionButton/CkPromptActionButton.vue.d.ts → CkPromptSendButton/CkPromptSendButton.vue.d.ts} +3 -3
  28. package/dist/components/base/CkPromptSendButton/CkPromptSendButton.vue.d.ts.map +1 -0
  29. package/dist/components/base/CkPromptSendButton/index.d.ts +3 -0
  30. package/dist/components/base/CkPromptSendButton/index.d.ts.map +1 -0
  31. package/dist/components/base/CkPromptSendButton/types.d.ts +34 -0
  32. package/dist/components/base/CkPromptSendButton/types.d.ts.map +1 -0
  33. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.stories.d.ts +1 -1
  34. package/dist/components/base/CkPromptStopButton/CkPromptStopButton.vue.d.ts.map +1 -1
  35. package/dist/components/base/CkPromptStopButton/types.d.ts +6 -4
  36. package/dist/components/base/CkPromptStopButton/types.d.ts.map +1 -1
  37. package/dist/components/base/icons/CkSendIcon.vue.d.ts.map +1 -1
  38. package/dist/components/base/index.d.ts +3 -1
  39. package/dist/components/base/index.d.ts.map +1 -1
  40. package/dist/components/composed/CkHistory/CkHistory.vue.d.ts +1 -1
  41. package/dist/components/composed/CkInput/CkInput.stories.d.ts.map +1 -1
  42. package/dist/components/composed/CkInput/CkInput.vue.d.ts +9 -8
  43. package/dist/components/composed/CkInput/CkInput.vue.d.ts.map +1 -1
  44. package/dist/components/composed/CkInput/types.d.ts +2 -7
  45. package/dist/components/composed/CkInput/types.d.ts.map +1 -1
  46. package/dist/components/index.d.ts +2 -2
  47. package/dist/components/index.d.ts.map +1 -1
  48. package/dist/components/index.js +9 -8
  49. package/dist/composables/fileUpload/types.d.ts +1 -1
  50. package/dist/composables/fileUpload/types.d.ts.map +1 -1
  51. package/dist/composables/fileUpload/useFileUpload.d.ts.map +1 -1
  52. package/dist/composables/index.js +1 -1
  53. package/dist/{index-CfXEGjc7.js → index-THzZwfMU.js} +6 -4
  54. package/dist/index.d.ts +2 -2
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +11 -10
  57. package/package.json +1 -1
  58. package/src/components/base/CkDropZoneOverlay/CkDropZoneOverlay.vue +2 -7
  59. package/src/components/base/CkFileItemsList/CkFileItemsList.spec.ts +67 -0
  60. package/src/components/base/CkFileItemsList/CkFileItemsList.stories.ts +48 -0
  61. package/src/components/base/CkFileItemsList/CkFileItemsList.vue +78 -4
  62. package/src/components/base/CkFileItemsList/types.ts +9 -0
  63. package/src/components/base/CkModelSelector/types.ts +1 -1
  64. package/src/components/base/CkPromptInput/CkPromptInput.spec.ts +206 -11
  65. package/src/components/base/CkPromptInput/CkPromptInput.stories.ts +1068 -43
  66. package/src/components/base/CkPromptInput/CkPromptInput.vue +137 -28
  67. package/src/components/base/CkPromptInput/types.ts +11 -12
  68. package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.spec.ts +62 -0
  69. package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.stories.ts +75 -0
  70. package/src/components/base/CkPromptMenuButton/CkPromptMenuButton.vue +26 -0
  71. package/src/components/base/CkPromptMenuButton/index.ts +2 -0
  72. package/src/components/base/CkPromptMenuButton/types.ts +29 -0
  73. package/src/components/base/{CkPromptActionButton/CkPromptActionButton.spec.ts → CkPromptSendButton/CkPromptSendButton.spec.ts} +11 -11
  74. package/src/components/base/CkPromptSendButton/CkPromptSendButton.stories.ts +117 -0
  75. package/src/components/base/{CkPromptActionButton/CkPromptActionButton.vue → CkPromptSendButton/CkPromptSendButton.vue} +4 -4
  76. package/src/components/base/CkPromptSendButton/index.ts +2 -0
  77. package/src/components/base/CkPromptSendButton/types.ts +33 -0
  78. package/src/components/base/CkPromptStopButton/CkPromptStopButton.spec.ts +5 -5
  79. package/src/components/base/CkPromptStopButton/CkPromptStopButton.stories.ts +1 -1
  80. package/src/components/base/CkPromptStopButton/CkPromptStopButton.vue +3 -2
  81. package/src/components/base/CkPromptStopButton/types.ts +6 -4
  82. package/src/components/base/icons/CkSendIcon.vue +3 -16
  83. package/src/components/base/icons/CkStopIcon.vue +1 -1
  84. package/src/components/base/index.ts +3 -1
  85. package/src/components/composed/CkInput/CkInput.stories.ts +0 -4
  86. package/src/components/composed/CkInput/CkInput.vue +7 -5
  87. package/src/components/composed/CkInput/types.ts +2 -7
  88. package/src/components/index.ts +3 -1
  89. package/src/composables/fileUpload/types.ts +1 -1
  90. package/src/composables/fileUpload/useFileUpload.spec.ts +26 -0
  91. package/src/composables/fileUpload/useFileUpload.ts +12 -3
  92. package/src/composables/fileUpload/useFileUploadWrapper.ts +1 -1
  93. package/src/index.ts +3 -1
  94. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.stories.d.ts.map +0 -1
  95. package/dist/components/base/CkPromptActionButton/CkPromptActionButton.vue.d.ts.map +0 -1
  96. package/dist/components/base/CkPromptActionButton/index.d.ts +0 -3
  97. package/dist/components/base/CkPromptActionButton/index.d.ts.map +0 -1
  98. package/dist/components/base/CkPromptActionButton/types.d.ts +0 -33
  99. package/dist/components/base/CkPromptActionButton/types.d.ts.map +0 -1
  100. package/src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts +0 -126
  101. package/src/components/base/CkPromptActionButton/index.ts +0 -2
  102. package/src/components/base/CkPromptActionButton/types.ts +0 -32
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Icon-only send button styled for the chat prompt area (brand color, pill
3
+ * shape). Sits in `CkPromptInput`'s `toolbar-right` slot as the submit
4
+ * trigger. Shows a spinner via `loading` while the previous request is in
5
+ * flight; pair with `CkPromptStopButton` to expose an abort control.
6
+ *
7
+ * @category Actions
8
+ * @useCases send message button, submit prompt, primary chat send action, loading send button, disabled send button
9
+ * @keywords prompt, send, submit, button, icon, loading, brand
10
+ * @related CkPromptInput, CkPromptStopButton, CkInput, CkSendIcon
11
+ */
12
+ export interface CkPromptSendButtonProps {
13
+ /**
14
+ * Accessible label for the button. **Required** because the button only
15
+ * renders an icon.
16
+ */
17
+ ariaLabel: string;
18
+ /**
19
+ * Whether the button is disabled.
20
+ * @default false
21
+ */
22
+ disabled?: boolean;
23
+ /**
24
+ * Whether to show a loading spinner instead of the slotted icon.
25
+ * @default false
26
+ */
27
+ loading?: boolean;
28
+ /**
29
+ * Native button `type`. Set `'submit'` when placed inside a `<form>`.
30
+ * @default 'button'
31
+ */
32
+ type?: 'button' | 'submit';
33
+ }
@@ -52,13 +52,13 @@ describe('CkPromptStopButton', () => {
52
52
  ).toBeDisabled();
53
53
  });
54
54
 
55
- it('applies brand styling classes', () => {
55
+ it('applies secondary pill styling per Figma spec', () => {
56
56
  render(CkPromptStopButton);
57
57
 
58
58
  const button = screen.getByRole('button', { name: 'Stop generating' });
59
- expect(button.className).toContain('!bg-brand-bg-brand');
60
- expect(button.className).toContain('hover:!bg-brand-bg-brand-hover');
61
- expect(button.className).toContain('!text-brand-content-default');
62
- expect(button.className).toContain('!rounded-md');
59
+ // Secondary variant + icon size from UiButton + Figma pill override.
60
+ expect(button.className).toContain('bg-background-button-secondary-button');
61
+ expect(button.className).toContain('size-9');
62
+ expect(button.className).toContain('!rounded-full');
63
63
  });
64
64
  });
@@ -49,7 +49,7 @@ import { CkPromptStopButton, CkStopIcon } from '@aleph-alpha/chat-kit';
49
49
  </template>`;
50
50
 
51
51
  /**
52
- * Default stop button. Swap it in for `CkPromptActionButton` while an
52
+ * Default stop button. Swap it in for `CkPromptSendButton` while an
53
53
  * assistant reply is streaming so users can cancel the response.
54
54
  */
55
55
  export const Default: Story = {
@@ -17,9 +17,10 @@ defineEmits<{
17
17
  <template>
18
18
  <UiButton
19
19
  v-bind="{ ariaLabel }"
20
- size="icon-sm"
20
+ variant="secondary"
21
+ size="icon"
21
22
  :disabled="props.disabled"
22
- class="!bg-brand-bg-brand hover:!bg-brand-bg-brand-hover !text-brand-content-default !rounded-md"
23
+ class="!rounded-full"
23
24
  @click="$emit('click', $event)"
24
25
  >
25
26
  <slot />
@@ -1,12 +1,14 @@
1
1
  /**
2
- * Icon-only button used to stop an in-flight assistant generation. Shares the
3
- * brand styling of `CkPromptActionButton` but is intended to replace it in the
2
+ * Icon-only button used to stop an in-flight assistant generation. Visually
3
+ * de-emphasized counterpart to `CkPromptSendButton` — uses UiButton's `secondary`
4
+ * variant (muted background) per Figma spec, so the user's eye doesn't read it
5
+ * as a primary call-to-action. Swap it in for `CkPromptSendButton` in the
4
6
  * prompt toolbar while a response is streaming.
5
7
  *
6
8
  * @category Actions
7
9
  * @useCases stop assistant generation, cancel streaming reply, abort in-flight request, halt llm response
8
- * @keywords stop, cancel, abort, prompt, action, button, icon, streaming
9
- * @related CkPromptActionButton, CkPromptInput, CkInput
10
+ * @keywords stop, cancel, abort, prompt, button, icon, streaming, secondary
11
+ * @related CkPromptSendButton, CkPromptMenuButton, CkPromptInput, CkInput, CkStopIcon
10
12
  */
11
13
  export interface CkPromptStopButtonProps {
12
14
  /**
@@ -1,22 +1,9 @@
1
1
  <script setup lang="ts">
2
+ import { UiIcon } from '@aleph-alpha/ui-library';
3
+
2
4
  defineOptions({ name: 'CkSendIcon' });
3
5
  </script>
4
6
 
5
7
  <template>
6
- <svg
7
- xmlns="http://www.w3.org/2000/svg"
8
- width="16"
9
- height="16"
10
- viewBox="0 0 24 24"
11
- fill="none"
12
- stroke="currentColor"
13
- stroke-width="2"
14
- stroke-linecap="round"
15
- stroke-linejoin="round"
16
- >
17
- <path
18
- d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"
19
- />
20
- <path d="M6 12h16" />
21
- </svg>
8
+ <UiIcon name="arrow-up-right" />
22
9
  </template>
@@ -12,7 +12,7 @@ defineOptions({ name: 'CkStopIcon' });
12
12
  >
13
13
  <path
14
14
  d="M13.3335 3.33301C13.3335 2.96482 13.035 2.66634 12.6668 2.66634H3.3335C2.96531 2.66634 2.66683 2.96482 2.66683 3.33301V12.6663C2.66683 13.0345 2.96531 13.333 3.3335 13.333H12.6668C13.035 13.333 13.3335 13.0345 13.3335 12.6663V3.33301ZM14.6668 12.6663C14.6668 13.7709 13.7714 14.6663 12.6668 14.6663H3.3335C2.22893 14.6663 1.3335 13.7709 1.3335 12.6663V3.33301C1.3335 2.22844 2.22893 1.33301 3.3335 1.33301H12.6668C13.7714 1.33301 14.6668 2.22844 14.6668 3.33301V12.6663Z"
15
- fill="#1D1D1B"
15
+ fill="currentColor"
16
16
  />
17
17
  </svg>
18
18
  </template>
@@ -45,7 +45,9 @@ export type {
45
45
  CkModelSelectorProps,
46
46
  CkModelSelectorEmits,
47
47
  } from './CkModelSelector';
48
- export { CkPromptActionButton } from './CkPromptActionButton';
48
+ export { CkPromptSendButton } from './CkPromptSendButton';
49
+ export { CkPromptMenuButton } from './CkPromptMenuButton';
50
+ export type { CkPromptMenuButtonProps } from './CkPromptMenuButton';
49
51
  export { CkPromptStopButton } from './CkPromptStopButton';
50
52
  export { CkPromptInput } from './CkPromptInput';
51
53
  export { CkPromptInputDisclaimer } from './CkPromptInputDisclaimer';
@@ -27,10 +27,6 @@ const meta: Meta<typeof CkInput> = {
27
27
  description:
28
28
  'Shows a spinner in the send button and blocks further input.',
29
29
  },
30
- maxHeight: {
31
- control: 'number',
32
- description: 'Max textarea height (px) before it becomes scrollable.',
33
- },
34
30
  ariaLabel: {
35
31
  control: 'text',
36
32
  description: 'Accessible label for the textarea.',
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import CkPromptActionButton from '../../base/CkPromptActionButton/CkPromptActionButton.vue';
2
+ import CkPromptSendButton from '../../base/CkPromptSendButton/CkPromptSendButton.vue';
3
3
  import CkPromptStopButton from '../../base/CkPromptStopButton/CkPromptStopButton.vue';
4
4
  import CkPromptInput from '../../base/CkPromptInput/CkPromptInput.vue';
5
5
  import CkPromptInputDisclaimer from '../../base/CkPromptInputDisclaimer/CkPromptInputDisclaimer.vue';
@@ -15,7 +15,6 @@ const props = withDefaults(defineProps<CkInputProps>(), {
15
15
  placeholder: 'Ask me anything',
16
16
  disabled: false,
17
17
  loading: false,
18
- maxHeight: 200,
19
18
  ariaLabel: 'Chat message input',
20
19
  stopAriaLabel: 'Stop generating',
21
20
  disclaimer: undefined,
@@ -61,11 +60,14 @@ defineExpose({ focus, submit });
61
60
  :model-value="modelValue"
62
61
  :placeholder="placeholder"
63
62
  :disabled="isDisabled"
64
- :max-height="maxHeight"
65
63
  :aria-label="ariaLabel"
66
64
  @update:model-value="onUpdateModelValue"
67
65
  @submit="onSubmit"
68
66
  >
67
+ <template v-if="$slots['toolbar-top']" #toolbar-top>
68
+ <slot name="toolbar-top" />
69
+ </template>
70
+
69
71
  <template v-if="$slots['toolbar-left']" #toolbar-left>
70
72
  <slot name="toolbar-left" />
71
73
  </template>
@@ -82,7 +84,7 @@ defineExpose({ focus, submit });
82
84
  <CkStopIcon />
83
85
  </slot>
84
86
  </CkPromptStopButton>
85
- <CkPromptActionButton
87
+ <CkPromptSendButton
86
88
  v-else
87
89
  v-bind="{ ariaLabel: 'Send message' }"
88
90
  type="submit"
@@ -91,7 +93,7 @@ defineExpose({ focus, submit });
91
93
  <slot name="send-icon">
92
94
  <CkSendIcon />
93
95
  </slot>
94
- </CkPromptActionButton>
96
+ </CkPromptSendButton>
95
97
  </slot>
96
98
  </template>
97
99
 
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Drop-in chat input: combines `CkPromptInput`, a `CkPromptActionButton` send
2
+ * Drop-in chat input: combines `CkPromptInput`, a `CkPromptSendButton` send
3
3
  * button, and a `CkPromptInputDisclaimer`. Supports `v-model`, loading and
4
4
  * disabled states, and slots to customize the toolbar and footer.
5
5
  *
6
6
  * @category Form Inputs
7
7
  * @useCases chat compose input, prompt box with send button, llm input with disclaimer, quick-start chat input, turnkey chat input
8
8
  * @keywords input, prompt, chat, send, compose, disclaimer, loading, v-model, textarea
9
- * @related CkPromptInput, CkPromptActionButton, CkPromptInputDisclaimer, CkConversation
9
+ * @related CkPromptInput, CkPromptSendButton, CkPromptInputDisclaimer, CkConversation
10
10
  */
11
11
  export interface CkInputProps {
12
12
  /**
@@ -30,11 +30,6 @@ export interface CkInputProps {
30
30
  * @default false
31
31
  */
32
32
  loading?: boolean;
33
- /**
34
- * Max height (in px) of the underlying textarea before it becomes scrollable.
35
- * @default 200
36
- */
37
- maxHeight?: number;
38
33
  /**
39
34
  * Accessible label for the input.
40
35
  * @default 'Chat message input'
@@ -12,7 +12,8 @@ export {
12
12
  CkMarkdownRenderer,
13
13
  CkMessageActionButton,
14
14
  CkModelSelector,
15
- CkPromptActionButton,
15
+ CkPromptSendButton,
16
+ CkPromptMenuButton,
16
17
  CkPromptStopButton,
17
18
  CkPromptInput,
18
19
  CkPromptInputDisclaimer,
@@ -44,6 +45,7 @@ export type {
44
45
  CkModelOption,
45
46
  CkModelSelectorProps,
46
47
  CkModelSelectorEmits,
48
+ CkPromptMenuButtonProps,
47
49
  CkUserMessageProps,
48
50
  } from './base';
49
51
 
@@ -336,7 +336,7 @@ export interface SearchStoreModel {
336
336
 
337
337
  export interface DocumentUploadConfig {
338
338
  baseUrl: string;
339
- userId: string;
339
+ userId?: string;
340
340
  workflowId: string;
341
341
  searchStoreConfig: {
342
342
  models: SearchStoreModel[];
@@ -128,6 +128,32 @@ describe('useFileUpload runWorkflow', () => {
128
128
  expect(upload.getFileState('key-1')?.status).toBe('success');
129
129
  expect(upload.getFileState('key-1')?.metadata.documentId).toBeUndefined();
130
130
  });
131
+
132
+ it('marks involved files failed on a bare SSE `error` event (no status field)', async () => {
133
+ const captured: { cb?: (event: SseEvent) => void } = {};
134
+ const events: string[] = [];
135
+ const upload = useFileUpload({
136
+ client: createMockClient(captured),
137
+ workflowId: 'wf',
138
+ storeId: 'ss-1',
139
+ onEvent: (e) => events.push(e.type),
140
+ });
141
+
142
+ upload.files.value.set('key-1', makeEntry('key-1', 'file-1'));
143
+
144
+ await upload.runWorkflow(['file-1']);
145
+ captured.cb!({
146
+ event: 'error',
147
+ data: JSON.stringify({ error: 'ActivityError: Activity task failed' }),
148
+ });
149
+
150
+ expect(upload.getFileState('key-1')?.status).toBe('failed');
151
+ expect(upload.getFileState('key-1')?.error?.message).toBe(
152
+ 'ActivityError: Activity task failed',
153
+ );
154
+ expect(upload.workflowRun.value?.status).toBe('failed');
155
+ expect(events).toContain('workflow:failed');
156
+ });
131
157
  });
132
158
 
133
159
  describe('useFileUpload maxFilesPerUpload', () => {
@@ -1126,6 +1126,7 @@ export function useFileUpload(
1126
1126
  let data: {
1127
1127
  id?: string;
1128
1128
  status?: string;
1129
+ error?: string;
1129
1130
  documents?: Array<{ document_id?: string; file_id?: string }>;
1130
1131
  };
1131
1132
  try {
@@ -1134,6 +1135,11 @@ export function useFileUpload(
1134
1135
  data = {};
1135
1136
  }
1136
1137
 
1138
+ const isFailure =
1139
+ data.status === 'failed' ||
1140
+ data.status === 'error' ||
1141
+ event.event === 'error';
1142
+
1137
1143
  const runEvent: WorkflowRunEvent = {
1138
1144
  id: data.id ?? '',
1139
1145
  status: data.status ?? event.event,
@@ -1149,16 +1155,19 @@ export function useFileUpload(
1149
1155
  Array.isArray(data.documents) ? data.documents : [],
1150
1156
  );
1151
1157
  emit({ type: 'workflow:completed', runId });
1152
- } else if (data.status === 'failed' || data.status === 'error') {
1158
+ } else if (isFailure) {
1153
1159
  workflowRun.value.status = 'failed';
1154
1160
  workflowRun.value.completedAt = now();
1161
+ const message =
1162
+ (typeof data.error === 'string' && data.error.trim()) ||
1163
+ `Workflow run ${runId} failed.`;
1155
1164
  workflowRun.value.error = {
1156
1165
  code: 'WORKFLOW_RUN_FAILED',
1157
- message: `Workflow run ${runId} failed.`,
1166
+ message,
1158
1167
  };
1159
1168
  const workflowErr: FileUploadError = {
1160
1169
  code: 'UPLOAD_FAILED',
1161
- message: `Workflow run ${runId} failed.`,
1170
+ message,
1162
1171
  occurredAt: now(),
1163
1172
  };
1164
1173
  for (const key of involvedStateKeys) {
@@ -171,7 +171,7 @@ export function createDocumentUploadProvider(
171
171
  } = config;
172
172
 
173
173
  const defaultHeaders: Record<string, string> = {
174
- 'x-user-id': userId,
174
+ ...(userId ? { 'x-user-id': userId } : {}),
175
175
  ...(config.headers ?? {}),
176
176
  };
177
177
 
package/src/index.ts CHANGED
@@ -77,7 +77,8 @@ export {
77
77
  CkMarkdownRenderer,
78
78
  CkMessageActionButton,
79
79
  CkModelSelector,
80
- CkPromptActionButton,
80
+ CkPromptSendButton,
81
+ CkPromptMenuButton,
81
82
  CkPromptStopButton,
82
83
  CkPromptInput,
83
84
  CkPromptInputDisclaimer,
@@ -112,6 +113,7 @@ export type {
112
113
  CkModelOption,
113
114
  CkModelSelectorProps,
114
115
  CkModelSelectorEmits,
116
+ CkPromptMenuButtonProps,
115
117
  CkUserMessageProps,
116
118
  } from './components';
117
119
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"CkPromptActionButton.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,oBAAoB,CA+B3C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAiCnC;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CkPromptActionButton.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/CkPromptActionButton.vue"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAkEzD,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK/C,QAAA,MAAM,UAAU;;;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as CkPromptActionButton } from './CkPromptActionButton.vue';
2
- export type * from './types';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,mBAAmB,SAAS,CAAC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Icon-only call-to-action button styled for the chat prompt area (brand color).
3
- * Typically used as the "send" button inside a prompt input toolbar, but works
4
- * for any primary prompt-level action.
5
- *
6
- * @category Actions
7
- * @useCases send message button, submit prompt, primary chat action, loading send button, disabled send button
8
- * @keywords prompt, send, action, button, icon, submit, loading, brand
9
- * @related CkPromptInput, CkInput, CkMessageActionButton
10
- */
11
- export interface CkPromptActionButtonProps {
12
- /**
13
- * Accessible label for the button. **Required** because the button only
14
- * renders an icon.
15
- */
16
- ariaLabel: string;
17
- /**
18
- * Whether the button is disabled.
19
- * @default false
20
- */
21
- disabled?: boolean;
22
- /**
23
- * Whether to show a loading spinner instead of the slotted icon.
24
- * @default false
25
- */
26
- loading?: boolean;
27
- /**
28
- * Native button `type`. Set `'submit'` when placed inside a `<form>`.
29
- * @default 'button'
30
- */
31
- type?: 'button' | 'submit';
32
- }
33
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/base/CkPromptActionButton/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC5B"}
@@ -1,126 +0,0 @@
1
- import CkPromptActionButton from './CkPromptActionButton.vue';
2
- import type { Meta, StoryObj } from '@storybook/vue3-vite';
3
-
4
- const meta: Meta<typeof CkPromptActionButton> = {
5
- title: 'Base/CkPromptActionButton',
6
- component: CkPromptActionButton,
7
- tags: ['autodocs'],
8
- argTypes: {
9
- ariaLabel: {
10
- control: 'text',
11
- description:
12
- 'Accessible label for the button. Required because the button is icon-only.',
13
- },
14
- disabled: {
15
- control: 'boolean',
16
- description: 'Whether the button is disabled.',
17
- },
18
- loading: {
19
- control: 'boolean',
20
- description:
21
- 'Shows a spinner instead of the slotted icon and blocks clicks.',
22
- },
23
- type: {
24
- control: 'radio',
25
- options: ['button', 'submit'],
26
- description: 'Native button type. Use `submit` inside a <form>.',
27
- },
28
- },
29
- decorators: [
30
- () => ({
31
- template:
32
- '<div style="max-width: 640px; margin: 0 auto; padding: 24px;"><story /></div>',
33
- }),
34
- ],
35
- };
36
-
37
- export default meta;
38
- type Story = StoryObj<typeof meta>;
39
-
40
- const defaultTemplateSource = `<script setup lang="ts">
41
- import { CkPromptActionButton } from '@aleph-alpha/chat-kit';
42
- import { CkSendIcon } from '@aleph-alpha/chat-kit';
43
- </script>
44
-
45
- <template>
46
- <CkPromptActionButton ariaLabel="Send message">
47
- <CkSendIcon />
48
- </CkPromptActionButton>
49
- </template>`;
50
-
51
- const disabledTemplateSource = `<script setup lang="ts">
52
- import { CkPromptActionButton, CkSendIcon } from '@aleph-alpha/chat-kit';
53
- </script>
54
-
55
- <template>
56
- <CkPromptActionButton ariaLabel="Send message" disabled>
57
- <CkSendIcon />
58
- </CkPromptActionButton>
59
- </template>`;
60
-
61
- const loadingTemplateSource = `<script setup lang="ts">
62
- import { CkPromptActionButton, CkSendIcon } from '@aleph-alpha/chat-kit';
63
- </script>
64
-
65
- <template>
66
- <CkPromptActionButton ariaLabel="Send message" loading>
67
- <CkSendIcon />
68
- </CkPromptActionButton>
69
- </template>`;
70
-
71
- /**
72
- * Default send-style button. Use in a prompt input toolbar to submit a message
73
- * or trigger a primary chat action.
74
- */
75
- export const Default: Story = {
76
- render: () => ({
77
- components: { CkPromptActionButton },
78
- template: `
79
- <CkPromptActionButton ariaLabel="Send message">
80
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
81
- <path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
82
- <path d="M6 12h16" />
83
- </svg>
84
- </CkPromptActionButton>
85
- `,
86
- }),
87
- parameters: { docs: { source: { code: defaultTemplateSource } } },
88
- };
89
-
90
- /**
91
- * Disabled state — use when the input is empty or a submit is otherwise
92
- * blocked (e.g. rate-limited).
93
- */
94
- export const Disabled: Story = {
95
- render: () => ({
96
- components: { CkPromptActionButton },
97
- template: `
98
- <CkPromptActionButton ariaLabel="Send message" disabled>
99
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
100
- <path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
101
- <path d="M6 12h16" />
102
- </svg>
103
- </CkPromptActionButton>
104
- `,
105
- }),
106
- parameters: { docs: { source: { code: disabledTemplateSource } } },
107
- };
108
-
109
- /**
110
- * Loading state — shows a spinner and blocks clicks. Use while the previous
111
- * message is still streaming or the request is in flight.
112
- */
113
- export const Loading: Story = {
114
- render: () => ({
115
- components: { CkPromptActionButton },
116
- template: `
117
- <CkPromptActionButton ariaLabel="Send message" loading>
118
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
119
- <path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z" />
120
- <path d="M6 12h16" />
121
- </svg>
122
- </CkPromptActionButton>
123
- `,
124
- }),
125
- parameters: { docs: { source: { code: loadingTemplateSource } } },
126
- };
@@ -1,2 +0,0 @@
1
- export { default as CkPromptActionButton } from './CkPromptActionButton.vue';
2
- export type * from './types';
@@ -1,32 +0,0 @@
1
- /**
2
- * Icon-only call-to-action button styled for the chat prompt area (brand color).
3
- * Typically used as the "send" button inside a prompt input toolbar, but works
4
- * for any primary prompt-level action.
5
- *
6
- * @category Actions
7
- * @useCases send message button, submit prompt, primary chat action, loading send button, disabled send button
8
- * @keywords prompt, send, action, button, icon, submit, loading, brand
9
- * @related CkPromptInput, CkInput, CkMessageActionButton
10
- */
11
- export interface CkPromptActionButtonProps {
12
- /**
13
- * Accessible label for the button. **Required** because the button only
14
- * renders an icon.
15
- */
16
- ariaLabel: string;
17
- /**
18
- * Whether the button is disabled.
19
- * @default false
20
- */
21
- disabled?: boolean;
22
- /**
23
- * Whether to show a loading spinner instead of the slotted icon.
24
- * @default false
25
- */
26
- loading?: boolean;
27
- /**
28
- * Native button `type`. Set `'submit'` when placed inside a `<form>`.
29
- * @default 'button'
30
- */
31
- type?: 'button' | 'submit';
32
- }