@epam/ai-dial-conversation-input 0.0.0-dev.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/components/AddAttachmentButton/AddAttachmentButton.d.ts +39 -0
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -0
- package/components/BottomSheet/BottomSheet.d.ts +45 -0
- package/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/components/BottomSheetShell/BottomSheetShell.d.ts +39 -0
- package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -0
- package/components/ChatSettingsBottomSheet/ChatSettingsBottomSheet.d.ts +58 -0
- package/components/ChatSettingsBottomSheet/ChatSettingsBottomSheet.d.ts.map +1 -0
- package/components/ChatSettingsFields/ChatSettingsFields.d.ts +40 -0
- package/components/ChatSettingsFields/ChatSettingsFields.d.ts.map +1 -0
- package/components/ChatSettingsModal/ChatSettingsModal.d.ts +46 -0
- package/components/ChatSettingsModal/ChatSettingsModal.d.ts.map +1 -0
- package/components/ConversationInput/ConversationInput.d.ts +4 -0
- package/components/ConversationInput/ConversationInput.d.ts.map +1 -0
- package/components/EditMessageInput/EditMessageInput.d.ts +4 -0
- package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -0
- package/components/Input/Buttons/SendButton.d.ts +12 -0
- package/components/Input/Buttons/SendButton.d.ts.map +1 -0
- package/components/Input/Buttons/StopButton.d.ts +9 -0
- package/components/Input/Buttons/StopButton.d.ts.map +1 -0
- package/components/Input/Input.d.ts +4 -0
- package/components/Input/Input.d.ts.map +1 -0
- package/components/Input/ModelSelectorControl.d.ts +25 -0
- package/components/Input/ModelSelectorControl.d.ts.map +1 -0
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +40 -0
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -0
- package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts +16 -0
- package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts.map +1 -0
- package/components/VoiceBar/VoiceBar.d.ts +36 -0
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -0
- package/hooks/useAttachments.d.ts +55 -0
- package/hooks/useAttachments.d.ts.map +1 -0
- package/hooks/useBottomSheet.d.ts +6 -0
- package/hooks/useBottomSheet.d.ts.map +1 -0
- package/hooks/useChatSettingsForm.d.ts +30 -0
- package/hooks/useChatSettingsForm.d.ts.map +1 -0
- package/hooks/useInputHistoryNavigation.d.ts +18 -0
- package/hooks/useInputHistoryNavigation.d.ts.map +1 -0
- package/hooks/useMessageState.d.ts +24 -0
- package/hooks/useMessageState.d.ts.map +1 -0
- package/hooks/useModelSelector.d.ts +35 -0
- package/hooks/useModelSelector.d.ts.map +1 -0
- package/hooks/useVoiceRecorder.d.ts +48 -0
- package/hooks/useVoiceRecorder.d.ts.map +1 -0
- package/index.css +2 -0
- package/index.d.ts +12 -0
- package/index.d.ts.map +1 -0
- package/index.js +83660 -0
- package/models/ConversationInput.d.ts +204 -0
- package/models/ConversationInput.d.ts.map +1 -0
- package/models/Input.d.ts +283 -0
- package/models/Input.d.ts.map +1 -0
- package/package.json +30 -0
- package/test-setup.d.ts +6 -0
- package/test-setup.d.ts.map +1 -0
- package/utils/concurrency.d.ts +17 -0
- package/utils/concurrency.d.ts.map +1 -0
- package/utils/deployment.d.ts +15 -0
- package/utils/deployment.d.ts.map +1 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Attachment, AttachmentErrorReason, DeploymentItem, DisplayAttachment } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ChatSettingsConfig, InputColors, InputTypography, ModelSelectorLabels, SendOnEnter } from './Input';
|
|
4
|
+
/** CSS custom-property overrides for the `ConversationInput` component. */
|
|
5
|
+
export interface ConversationInputColors {
|
|
6
|
+
/** Root container background color. */
|
|
7
|
+
background?: string;
|
|
8
|
+
/** Welcome heading text color. */
|
|
9
|
+
welcomeText?: string;
|
|
10
|
+
/** Color overrides forwarded to the inner `Input` component. */
|
|
11
|
+
input?: InputColors;
|
|
12
|
+
}
|
|
13
|
+
/** Typography overrides for the `ConversationInput` component. */
|
|
14
|
+
export interface ConversationInputTypography {
|
|
15
|
+
/** Tailwind (or custom) class applied to the welcome heading. */
|
|
16
|
+
welcomeClassName?: string;
|
|
17
|
+
/** Typography overrides forwarded to the inner `Input` component. */
|
|
18
|
+
input?: InputTypography;
|
|
19
|
+
}
|
|
20
|
+
/** Combined color and typography overrides for the `ConversationInput` component. */
|
|
21
|
+
export interface ConversationInputStyles {
|
|
22
|
+
/** Color overrides applied as CSS custom properties. */
|
|
23
|
+
colors?: ConversationInputColors;
|
|
24
|
+
/** Typography overrides for the welcome heading and input. */
|
|
25
|
+
typography?: ConversationInputTypography;
|
|
26
|
+
}
|
|
27
|
+
/** Props accepted by the `EditMessageInput` component. */
|
|
28
|
+
export interface EditMessageInputProps {
|
|
29
|
+
/** Initial message text pre-populated in the textarea. */
|
|
30
|
+
message?: string;
|
|
31
|
+
/** Pre-existing attachments from the original message, shown in the attachment tray. */
|
|
32
|
+
initialAttachments?: DisplayAttachment[];
|
|
33
|
+
/** Called when the user clicks the Cancel button. */
|
|
34
|
+
onCancel: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Called when the user clicks Save & Submit.
|
|
37
|
+
* @param message - The edited message text.
|
|
38
|
+
* @param keptAttachments - Pre-existing attachments the user did not remove.
|
|
39
|
+
* @param newAttachments - New attachments added during editing.
|
|
40
|
+
*/
|
|
41
|
+
onSave: (message: string, keptAttachments: DisplayAttachment[], newAttachments: Attachment[]) => void;
|
|
42
|
+
/** Called immediately after a new attachment is added. Returns the uploaded attachment URL. */
|
|
43
|
+
onUploadAttachment?: (attachment: Attachment) => Promise<string>;
|
|
44
|
+
/** Label for the Cancel button. Defaults to `'Cancel'`. */
|
|
45
|
+
cancelLabel?: string;
|
|
46
|
+
/** Label for the Save & Submit button. Defaults to `'Save & Submit'`. */
|
|
47
|
+
saveLabel?: string;
|
|
48
|
+
/** `aria-label` applied to the textarea. */
|
|
49
|
+
ariaLabel?: string;
|
|
50
|
+
/** Accessible label for each attachment card's remove button. */
|
|
51
|
+
removeLabel?: string;
|
|
52
|
+
/** Accessible label for each attachment card's retry button (error state only). */
|
|
53
|
+
retryLabel?: string;
|
|
54
|
+
/** Accessible label for the add-menu trigger button. */
|
|
55
|
+
addMenuTitle?: string;
|
|
56
|
+
/** Label for the attach-file menu item. */
|
|
57
|
+
attachLabel?: string;
|
|
58
|
+
/** Heading text shown in the mobile bottom-sheet add-menu. Defaults to `'Menu'`. */
|
|
59
|
+
menuTitle?: string;
|
|
60
|
+
/** Accessible label for the bottom-sheet close button. Defaults to `'Close'`. */
|
|
61
|
+
menuCloseLabel?: string;
|
|
62
|
+
/** Extra class name(s) merged onto the root wrapper element. */
|
|
63
|
+
className?: string;
|
|
64
|
+
/** Files supplied by a page-level drag-and-drop handler to be added as attachments. */
|
|
65
|
+
pendingDropFiles?: File[];
|
|
66
|
+
/** Called after the files have been consumed, signalling the parent to clear its state. */
|
|
67
|
+
onDropFilesConsumed?: () => void;
|
|
68
|
+
/**
|
|
69
|
+
* Called synchronously for each attachment after it is added, before upload begins.
|
|
70
|
+
* Return an `AttachmentErrorReason` to reject the attachment (it enters error state
|
|
71
|
+
* and `onUploadAttachment` is NOT called). Return `undefined` to allow normal upload.
|
|
72
|
+
*/
|
|
73
|
+
validateAttachment?: (attachment: Attachment) => AttachmentErrorReason | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* When `true`, the "Attach file" button is hidden.
|
|
76
|
+
*/
|
|
77
|
+
hideAttachFile?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/** Props accepted by the `ConversationInput` component. */
|
|
80
|
+
export interface ConversationInputProps {
|
|
81
|
+
/** Placeholder text shown inside the textarea when empty. */
|
|
82
|
+
placeholder?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Message value. Sets the initial textarea content on mount and syncs the
|
|
85
|
+
* textarea whenever the value changes to a non-empty string.
|
|
86
|
+
*/
|
|
87
|
+
message?: string;
|
|
88
|
+
/** Optional welcome heading rendered above the input. */
|
|
89
|
+
welcomeText?: string;
|
|
90
|
+
/** Called when the user submits a message (Enter or send button). Receives the current local attachments as the second argument. */
|
|
91
|
+
onSend?: (message: string, attachments: Attachment[]) => void;
|
|
92
|
+
/** Called immediately after an attachment is added. Returns the uploaded attachment URL. */
|
|
93
|
+
onUploadAttachment?: (attachment: Attachment) => Promise<string>;
|
|
94
|
+
/** Called when the user clicks the stop button during streaming. */
|
|
95
|
+
onStop?: () => void;
|
|
96
|
+
/** When `true`, shows a stop button instead of the send button and blocks Enter. */
|
|
97
|
+
isStreaming?: boolean;
|
|
98
|
+
/** Called whenever the attachment list changes. */
|
|
99
|
+
onAttachmentsChange?: (attachments: Attachment[]) => void;
|
|
100
|
+
/** Color and typography overrides applied as CSS custom properties. */
|
|
101
|
+
styles?: ConversationInputStyles;
|
|
102
|
+
/** Extra class name(s) merged onto the root wrapper element. */
|
|
103
|
+
className?: string;
|
|
104
|
+
/** Files supplied by a page-level drag-and-drop handler to be added as attachments. */
|
|
105
|
+
pendingDropFiles?: File[];
|
|
106
|
+
/** Called after the inner `Input` has consumed `pendingDropFiles`, signalling the parent to clear its state. */
|
|
107
|
+
onDropFilesConsumed?: () => void;
|
|
108
|
+
/** Already-uploaded attachments supplied by the host and awaiting insertion into the local tray. */
|
|
109
|
+
pendingAttachments?: Attachment[];
|
|
110
|
+
/** Called after `pendingAttachments` have been inserted into the local tray. */
|
|
111
|
+
onPendingAttachmentsConsumed?: () => void;
|
|
112
|
+
/** Character count above which a pasted plain-text string is converted to an attachment rather than inserted inline. Defaults to `4000`. Pass `Infinity` to disable. */
|
|
113
|
+
pasteTextThreshold?: number;
|
|
114
|
+
/**
|
|
115
|
+
* List of deployment items to populate the model selector menu. When `undefined`, the selector is not rendered.
|
|
116
|
+
* `iconUrl` on each item must already be a fully resolved URL usable in `<img src>`.
|
|
117
|
+
*/
|
|
118
|
+
deployments?: DeploymentItem[];
|
|
119
|
+
/** ID of the currently selected deployment. When `null` or `undefined` and `deployments` is defined, the send button is disabled. */
|
|
120
|
+
selectedDeploymentId?: string | null;
|
|
121
|
+
/** Called when the user selects a different deployment from the dropdown. Receives the selected item's `id`. */
|
|
122
|
+
onDeploymentChange?: (id: string) => void;
|
|
123
|
+
/** Labels shown inside the model selector dropdown for the trigger and various loading states. */
|
|
124
|
+
modelSelectorLabels?: ModelSelectorLabels;
|
|
125
|
+
/** Accessible label for the send button. */
|
|
126
|
+
sendLabel?: string;
|
|
127
|
+
/** Tooltip shown on hover over the send button. */
|
|
128
|
+
sendTitle?: string;
|
|
129
|
+
/** Accessible label for the stop button. */
|
|
130
|
+
stopLabel?: string;
|
|
131
|
+
/** When `true`, blocks all text input, send, attach, and drop interactions. Starter/action buttons remain usable. Defaults to `false`. */
|
|
132
|
+
isInputDisabled?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* When `true`, the mic button is rendered and voice recording is enabled.
|
|
135
|
+
* The host app derives this from the selected deployment's `inputAttachmentTypes`.
|
|
136
|
+
* When `false` or absent, the mic button is hidden and the voice bar is never shown.
|
|
137
|
+
*/
|
|
138
|
+
isTranscriptionSupported?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Called when the user confirms a voice recording.
|
|
141
|
+
* Receives the recorded `File` and its detected MIME type.
|
|
142
|
+
* Should resolve with the DIAL storage URL for the uploaded audio.
|
|
143
|
+
*/
|
|
144
|
+
onUploadAudio?: (file: File, contentType: string) => Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* Called after successful audio upload with the returned DIAL storage URL.
|
|
147
|
+
* Should resolve with the transcript text.
|
|
148
|
+
*/
|
|
149
|
+
onTranscribeAudio?: (audioUrl: string) => Promise<string>;
|
|
150
|
+
/** Accessible label for the mic button. Defaults to `'Record voice message'`. */
|
|
151
|
+
micLabel?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Controls which key combination submits the message.
|
|
154
|
+
* - `SendOnEnter.Enter` (default): Enter submits; Shift+Enter inserts a newline.
|
|
155
|
+
* - `SendOnEnter.MetaEnter`: ⌘+Enter (macOS) / Ctrl+Enter (Windows/Linux) submits; bare Enter inserts a newline.
|
|
156
|
+
*/
|
|
157
|
+
sendOnEnter?: SendOnEnter;
|
|
158
|
+
/**
|
|
159
|
+
* When provided, a "Chat settings" item is added to the `+` menu.
|
|
160
|
+
* Clicking it opens a modal with fields gated by `features`.
|
|
161
|
+
*/
|
|
162
|
+
chatSettings?: ChatSettingsConfig;
|
|
163
|
+
/** When `true`, focuses the textarea on mount. Defaults to `false`. */
|
|
164
|
+
autoFocus?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Ordered list of previously sent message strings for the current
|
|
167
|
+
* conversation (oldest first, most-recent last). When provided, pressing
|
|
168
|
+
* Up in the textarea recalls the previous entry; pressing Down returns
|
|
169
|
+
* toward the current draft. Omit or pass an empty array to disable
|
|
170
|
+
* keyboard history navigation.
|
|
171
|
+
*/
|
|
172
|
+
messageHistory?: readonly string[];
|
|
173
|
+
/** Called when user selects "DIAL file system" from the attach menu. When absent, the menu item is not rendered. */
|
|
174
|
+
onDialFileSystemClick?: () => void;
|
|
175
|
+
/** Label for the "DIAL file system" menu item. Defaults to `'DIAL file system'`. */
|
|
176
|
+
dialFileSystemLabel?: string;
|
|
177
|
+
/** Accessible label for the `+` trigger button. Defaults to `'Add'`. */
|
|
178
|
+
addMenuTitle?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Called synchronously for each attachment after it is added, before upload begins.
|
|
181
|
+
* Return an `AttachmentErrorReason` to reject the attachment (it enters error state
|
|
182
|
+
* and `onUploadAttachment` is NOT called). Return `undefined` to allow normal upload.
|
|
183
|
+
*/
|
|
184
|
+
validateAttachment?: (attachment: Attachment) => AttachmentErrorReason | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* When `true`, the "Attach file" item is removed from the attach menu.
|
|
187
|
+
* Other menu items (e.g. DIAL file system) remain visible. When no items
|
|
188
|
+
* remain in the menu the entire attach (+) button is hidden automatically.
|
|
189
|
+
*/
|
|
190
|
+
hideAttachFile?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Called when the user clicks or keyboard-activates an attachment card.
|
|
193
|
+
* Receives the full `Attachment` object (including the local `File`).
|
|
194
|
+
* When absent the card is not rendered as interactive.
|
|
195
|
+
*/
|
|
196
|
+
onAttachmentClick?: (attachment: Attachment) => void;
|
|
197
|
+
/**
|
|
198
|
+
* When provided, the desktop model-selector chip opens this panel instead of
|
|
199
|
+
* the flat deployment list. Receives `onClose` so the panel can close the
|
|
200
|
+
* popover after a selection or an explicit dismiss.
|
|
201
|
+
*/
|
|
202
|
+
modelPickerOverlay?: (onClose: () => void) => ReactNode;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=ConversationInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationInput.d.ts","sourceRoot":"","sources":["../../src/models/ConversationInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,2EAA2E;AAC3E,MAAM,WAAW,uBAAuB;IACtC,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,kEAAkE;AAClE,MAAM,WAAW,2BAA2B;IAC1C,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,KAAK,CAAC,EAA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H,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,CAAC;IACrD;;;;OAIG;IAEH,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,SAAS,CAAC;CACzD"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { Attachment, AttachmentErrorReason, DeploymentFeatures, DeploymentItem, DisplayAttachment, ResponseFormat } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Controls which key combination submits the message in the `Input` component.
|
|
5
|
+
* - `Enter` (default): Enter submits; Shift+Enter inserts a newline.
|
|
6
|
+
* - `MetaEnter`: ⌘+Enter (macOS) / Ctrl+Enter (Windows/Linux) submits; bare Enter inserts a newline.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum SendOnEnter {
|
|
9
|
+
/** Enter submits; Shift+Enter inserts a newline. */
|
|
10
|
+
Enter = "enter",
|
|
11
|
+
/** ⌘+Enter (macOS) / Ctrl+Enter (Windows/Linux) submits; bare Enter inserts a newline. */
|
|
12
|
+
MetaEnter = "meta-enter"
|
|
13
|
+
}
|
|
14
|
+
/** CSS custom-property overrides for the `Input` component. */
|
|
15
|
+
export interface InputColors {
|
|
16
|
+
/** Input area background color. */
|
|
17
|
+
background?: string;
|
|
18
|
+
/** Typed text color. */
|
|
19
|
+
text?: string;
|
|
20
|
+
/** Border color in the default (unfocused) state. */
|
|
21
|
+
border?: string;
|
|
22
|
+
/** Border color on hover (unfocused). */
|
|
23
|
+
borderHover?: string;
|
|
24
|
+
/** Border color when the input is focused. */
|
|
25
|
+
borderFocus?: string;
|
|
26
|
+
/** Placeholder text color. */
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
/** Box-shadow in the default state (e.g. a subtle inset shadow). */
|
|
29
|
+
shadow?: string;
|
|
30
|
+
/** Box-shadow when the input is focused. Falls back to `shadow` when unset. */
|
|
31
|
+
shadowFocus?: string;
|
|
32
|
+
/** Background color of the send button. */
|
|
33
|
+
sendBackground?: string;
|
|
34
|
+
/** Icon/text color of the send button. */
|
|
35
|
+
sendText?: string;
|
|
36
|
+
/** Icon color of the stop button. Defaults to `--text-secondary` (`#9fa6bd`). */
|
|
37
|
+
stopColor?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Typography overrides for the `Input` component. */
|
|
40
|
+
export interface InputTypography {
|
|
41
|
+
/** Typography utility class applied to the textarea (e.g. `'dial-body-paragraph-text'`). */
|
|
42
|
+
fontClassName?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Status labels displayed inside the model selector dropdown and mobile bottom-sheet. */
|
|
45
|
+
export interface ModelSelectorLabels {
|
|
46
|
+
/** Accessible label for the selector trigger button (e.g. `"Select model"`). */
|
|
47
|
+
ariaLabel?: string;
|
|
48
|
+
/** Shown as a disabled item while deployments are loading. */
|
|
49
|
+
loading?: string;
|
|
50
|
+
/** Shown as a disabled item when the deployments fetch failed. */
|
|
51
|
+
error?: string;
|
|
52
|
+
/** Shown as a disabled item when the deployments list is empty. */
|
|
53
|
+
empty?: string;
|
|
54
|
+
/** Placeholder for the search input. Defaults to `'Search'`. */
|
|
55
|
+
searchPlaceholder?: string;
|
|
56
|
+
/** Accessible label for the close button in the mobile bottom-sheet. Defaults to `'Close'`. */
|
|
57
|
+
closeLabel?: string;
|
|
58
|
+
}
|
|
59
|
+
/** Props accepted by the `Input` component. */
|
|
60
|
+
export interface InputProps {
|
|
61
|
+
/**
|
|
62
|
+
* Message value. Sets the initial textarea content on mount and syncs the
|
|
63
|
+
* textarea whenever the value changes to a non-empty string.
|
|
64
|
+
*/
|
|
65
|
+
message?: string;
|
|
66
|
+
/** Called on every keystroke with the current textarea value. */
|
|
67
|
+
onChange?: (message: string) => void;
|
|
68
|
+
/** Called when the user submits a message (Enter or send button). Receives the current local attachments as the second argument. Returning a rejected promise transitions attachments to Error state. */
|
|
69
|
+
onSend?: (message: string, attachments: Attachment[]) => Promise<void> | void;
|
|
70
|
+
/** Called immediately after an attachment is added. Returns the uploaded attachment URL. */
|
|
71
|
+
onUploadAttachment?: (attachment: Attachment) => Promise<string>;
|
|
72
|
+
/** Called when the user clicks the stop button during streaming. */
|
|
73
|
+
onStop?: () => void;
|
|
74
|
+
/** When `true`, shows a stop button instead of the send button. */
|
|
75
|
+
isStreaming?: boolean;
|
|
76
|
+
/** Called whenever the attachment list changes. */
|
|
77
|
+
onAttachmentsChange?: (attachments: Attachment[]) => void;
|
|
78
|
+
/** Placeholder text shown when the textarea is empty. */
|
|
79
|
+
placeholder?: string;
|
|
80
|
+
/** `aria-label` applied to the textarea for screen readers. */
|
|
81
|
+
ariaLabel?: string;
|
|
82
|
+
/** Color overrides applied as CSS custom properties. */
|
|
83
|
+
colors?: InputColors;
|
|
84
|
+
/** Typography overrides applied as CSS custom properties. */
|
|
85
|
+
typography?: InputTypography;
|
|
86
|
+
/** Label for the attach-file menu item. */
|
|
87
|
+
attachLabel?: string;
|
|
88
|
+
/** Tooltip title for the add-menu trigger button. */
|
|
89
|
+
addMenuTitle?: string;
|
|
90
|
+
/** Accessible label for each attachment card's remove button. */
|
|
91
|
+
removeLabel?: string;
|
|
92
|
+
/** Accessible label for each attachment card's retry button (error state only). */
|
|
93
|
+
retryLabel?: string;
|
|
94
|
+
/** Accessible label for the send button. */
|
|
95
|
+
sendLabel?: string;
|
|
96
|
+
/** Tooltip shown on hover over the send button. */
|
|
97
|
+
sendTitle?: string;
|
|
98
|
+
/** Accessible label for the stop button. */
|
|
99
|
+
stopLabel?: string;
|
|
100
|
+
/** Extra class name(s) merged onto the root wrapper element. */
|
|
101
|
+
className?: string;
|
|
102
|
+
/** Files dropped onto the parent that should be processed as attachments. Reset to `[]` after processing. */
|
|
103
|
+
pendingDropFiles?: File[];
|
|
104
|
+
/** Called after `pendingDropFiles` have been consumed so the parent can reset its state. */
|
|
105
|
+
onDropFilesConsumed?: () => void;
|
|
106
|
+
/** Already-uploaded attachments supplied by the host and awaiting insertion into the local tray. */
|
|
107
|
+
pendingAttachments?: Attachment[];
|
|
108
|
+
/** Called after `pendingAttachments` have been inserted into the local tray. */
|
|
109
|
+
onPendingAttachmentsConsumed?: () => void;
|
|
110
|
+
/** Character count above which a pasted plain-text string is converted to an attachment rather than inserted inline. Defaults to `4000`. Pass `Infinity` to disable. */
|
|
111
|
+
pasteTextThreshold?: number;
|
|
112
|
+
/**
|
|
113
|
+
* List of deployment items to populate the model selector menu. When `undefined`, the selector is not rendered.
|
|
114
|
+
* `iconUrl` on each item must already be a fully resolved URL usable in `<img src>` — the host app
|
|
115
|
+
* resolves DIAL file IDs, theme-relative names, etc. before passing the list.
|
|
116
|
+
*/
|
|
117
|
+
deployments?: DeploymentItem[];
|
|
118
|
+
/** ID of the currently selected deployment. When `null` or `undefined` and `deployments` is defined, the send button is disabled. */
|
|
119
|
+
selectedDeploymentId?: string | null;
|
|
120
|
+
/** Called when the user selects a different deployment from the dropdown. Receives the selected item's `id`. */
|
|
121
|
+
onDeploymentChange?: (id: string) => void;
|
|
122
|
+
/** Labels shown inside the model selector dropdown for the trigger and various loading states. */
|
|
123
|
+
modelSelectorLabels?: ModelSelectorLabels;
|
|
124
|
+
/** Heading text shown in the mobile bottom-sheet add-menu. Defaults to `'Menu'`. */
|
|
125
|
+
menuTitle?: string;
|
|
126
|
+
/** Accessible label for the bottom-sheet close button. Defaults to `'Close'`. */
|
|
127
|
+
menuCloseLabel?: string;
|
|
128
|
+
/** Attachments pre-populated in the tray on mount (e.g. when editing an existing message). */
|
|
129
|
+
initialAttachments?: Attachment[];
|
|
130
|
+
/**
|
|
131
|
+
* When `true`, the textarea always renders on its own row above the action bar
|
|
132
|
+
* (attach button on the left, footer actions on the right), instead of the
|
|
133
|
+
* compact single-row layout used when no attachments are present. Used by the
|
|
134
|
+
* edit-message UI, which always wants the stacked layout.
|
|
135
|
+
*/
|
|
136
|
+
isStacked?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* When `true`, the attach (+) button and its associated hidden file input are
|
|
139
|
+
* not rendered. Use this when the caller manages file picking outside the
|
|
140
|
+
* component (e.g. `EditMessageInput` renders the `+` button outside the
|
|
141
|
+
* bordered box and feeds files back via `pendingDropFiles`).
|
|
142
|
+
*/
|
|
143
|
+
hideAddButton?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* When `true`, the "Attach file" item is removed from the attach menu.
|
|
146
|
+
* Other menu items (e.g. DIAL file system) remain visible. When no items
|
|
147
|
+
* remain in the menu the entire attach (+) button is hidden automatically.
|
|
148
|
+
*/
|
|
149
|
+
hideAttachFile?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* When `true`, the entire action bar row (attach button, send/stop button,
|
|
152
|
+
* model selector, and any `renderFooterActions` content) is not rendered.
|
|
153
|
+
* The bordered box contains only the attachment tray and textarea. Use in
|
|
154
|
+
* `EditMessageInput` where the action row lives outside the bordered box.
|
|
155
|
+
*/
|
|
156
|
+
hideActionBar?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* When provided, replaces the default send/stop/model-selector area with custom content.
|
|
159
|
+
* Receives `canSend` (textarea has non-empty trimmed content) and `onSend` (triggers the
|
|
160
|
+
* same internal send flow as the default send button).
|
|
161
|
+
*/
|
|
162
|
+
renderFooterActions?: (helpers: {
|
|
163
|
+
canSend: boolean;
|
|
164
|
+
onSend: () => void;
|
|
165
|
+
}) => ReactNode;
|
|
166
|
+
/** When `true`, blocks all text input, send, attach, and drop interactions. Starter/action buttons remain usable. Defaults to `false`. */
|
|
167
|
+
isInputDisabled?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* When `true`, the mic button is rendered and voice recording is enabled.
|
|
170
|
+
* Derived by the host app from the selected deployment's `inputAttachmentTypes`.
|
|
171
|
+
*/
|
|
172
|
+
isTranscriptionSupported?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Called when the user confirms a voice recording.
|
|
175
|
+
* Receives the recorded `File` and its detected MIME type.
|
|
176
|
+
* Resolves with the DIAL storage URL for the uploaded audio.
|
|
177
|
+
*/
|
|
178
|
+
onUploadAudio?: (file: File, contentType: string) => Promise<string>;
|
|
179
|
+
/**
|
|
180
|
+
* Called after successful audio upload with the DIAL storage URL.
|
|
181
|
+
* Resolves with the transcript text.
|
|
182
|
+
*/
|
|
183
|
+
onTranscribeAudio?: (audioUrl: string) => Promise<string>;
|
|
184
|
+
/** Accessible label for the mic button. Defaults to `'Record voice message'`. */
|
|
185
|
+
micLabel?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Controls which key combination submits the message.
|
|
188
|
+
* - `SendOnEnter.Enter` (default): Enter submits; Shift+Enter inserts a newline.
|
|
189
|
+
* - `SendOnEnter.MetaEnter`: ⌘+Enter (macOS) / Ctrl+Enter (Windows/Linux) submits; bare Enter inserts a newline.
|
|
190
|
+
*/
|
|
191
|
+
sendOnEnter?: SendOnEnter;
|
|
192
|
+
/** Attachments managed externally (e.g. pre-existing kept attachments in edit mode) prepended to the tray alongside locally-added ones. */
|
|
193
|
+
prefixAttachments?: DisplayAttachment[];
|
|
194
|
+
/** Called when the user removes an attachment from `prefixAttachments`. */
|
|
195
|
+
onRemovePrefixAttachment?: (id: string) => void;
|
|
196
|
+
/**
|
|
197
|
+
* When provided, a "Chat settings" item is added to the `+` menu.
|
|
198
|
+
* Clicking it opens a modal with fields gated by `features`.
|
|
199
|
+
* Modal state is managed internally by the component.
|
|
200
|
+
*/
|
|
201
|
+
chatSettings?: ChatSettingsConfig;
|
|
202
|
+
/** When `true`, focuses the textarea on mount. Defaults to `false`. */
|
|
203
|
+
autoFocus?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Ordered list of previously sent message strings (oldest first, most-recent
|
|
206
|
+
* last). When provided, Up/Down arrow keys navigate through the history.
|
|
207
|
+
* Omit or pass an empty array to disable keyboard history navigation.
|
|
208
|
+
*/
|
|
209
|
+
messageHistory?: readonly string[];
|
|
210
|
+
/** Called when user selects "DIAL file system" from the attach menu. When absent, the menu item is not rendered. */
|
|
211
|
+
onDialFileSystemClick?: () => void;
|
|
212
|
+
/** Label for the "DIAL file system" menu item. Defaults to `'DIAL file system'`. */
|
|
213
|
+
dialFileSystemLabel?: string;
|
|
214
|
+
/**
|
|
215
|
+
* Called synchronously for each attachment after it is added, before upload begins.
|
|
216
|
+
* Return an `AttachmentErrorReason` to reject the attachment (it enters error state
|
|
217
|
+
* and `onUploadAttachment` is NOT called). Return `undefined` to allow normal upload.
|
|
218
|
+
*/
|
|
219
|
+
validateAttachment?: (attachment: Attachment) => AttachmentErrorReason | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* Called when the user clicks or keyboard-activates an attachment card.
|
|
222
|
+
* Receives the full `Attachment` object (including the local `File`).
|
|
223
|
+
* When absent the card is not rendered as interactive.
|
|
224
|
+
*/
|
|
225
|
+
onAttachmentClick?: (attachment: Attachment) => void;
|
|
226
|
+
/**
|
|
227
|
+
* When provided, the desktop model-selector chip opens this panel instead of
|
|
228
|
+
* the flat deployment list. Receives `onClose` so the panel can close the
|
|
229
|
+
* popover after a selection or an explicit dismiss.
|
|
230
|
+
*/
|
|
231
|
+
modelPickerOverlay?: (onClose: () => void) => ReactNode;
|
|
232
|
+
}
|
|
233
|
+
/** Values emitted by the chat-settings modal when the user clicks Save. */
|
|
234
|
+
export interface ChatSettingsValues {
|
|
235
|
+
/** Updated response format, present when the response-format field was shown. */
|
|
236
|
+
responseFormat?: ResponseFormat;
|
|
237
|
+
/** Updated system prompt, present when the system-prompt field was shown. */
|
|
238
|
+
systemPrompt?: string;
|
|
239
|
+
/** Updated temperature, present when the temperature field was shown. */
|
|
240
|
+
temperature?: number;
|
|
241
|
+
}
|
|
242
|
+
/** Configuration for the built-in chat-settings menu entry and modal. */
|
|
243
|
+
export interface ChatSettingsConfig {
|
|
244
|
+
/** Feature flags controlling which fields appear in the modal. */
|
|
245
|
+
features: DeploymentFeatures;
|
|
246
|
+
/** Current response format pre-selected in the modal. Defaults to `ResponseFormat.Markdown`. */
|
|
247
|
+
responseFormat?: ResponseFormat;
|
|
248
|
+
/** Current system prompt pre-populated in the modal textarea. */
|
|
249
|
+
systemPrompt: string;
|
|
250
|
+
/** Current temperature pre-populated in the modal numeric input. */
|
|
251
|
+
temperature: number;
|
|
252
|
+
/** Called with updated values when the user clicks Save. */
|
|
253
|
+
onSave: (values: ChatSettingsValues) => void;
|
|
254
|
+
/** Label for the "Chat settings" dropdown item. Defaults to `'Chat settings'`. */
|
|
255
|
+
menuItemLabel?: string;
|
|
256
|
+
/** Modal title. Defaults to `'Chat settings'`. */
|
|
257
|
+
title?: string;
|
|
258
|
+
/** Label for the response format field. Defaults to `'Response format'`. */
|
|
259
|
+
responseFormatLabel?: string;
|
|
260
|
+
/** Helper text shown below the response format field. Defaults to `'Applies to new and existing messages'`. */
|
|
261
|
+
responseFormatHint?: string;
|
|
262
|
+
/** Label for the Markdown radio option. Defaults to `'Markdown'`. */
|
|
263
|
+
responseFormatMarkdownLabel?: string;
|
|
264
|
+
/** Label for the Plain text radio option. Defaults to `'Plain text'`. */
|
|
265
|
+
responseFormatPlainTextLabel?: string;
|
|
266
|
+
/** Label for the system prompt field. Defaults to `'System prompt'`. */
|
|
267
|
+
systemPromptLabel?: string;
|
|
268
|
+
/** Tooltip shown on the system prompt input. Defaults to `'Enter a prompt'`. */
|
|
269
|
+
systemPromptTooltip?: string;
|
|
270
|
+
/** Label for the temperature field. Defaults to `'Temperature'`. */
|
|
271
|
+
temperatureLabel?: string;
|
|
272
|
+
/** Labels rendered below the temperature slider: [start, middle, end]. Defaults to `['Precise', 'Neutral', 'Creative']`. */
|
|
273
|
+
temperatureLabels?: [string, string, string];
|
|
274
|
+
/** Helper text shown below the temperature field. */
|
|
275
|
+
temperatureHint?: string;
|
|
276
|
+
/** Label for the save button. Defaults to `'Apply changes'`. */
|
|
277
|
+
saveLabel?: string;
|
|
278
|
+
/** Tooltip shown on the save button when it is disabled (e.g. no response format selected). */
|
|
279
|
+
saveDisabledTooltip?: string;
|
|
280
|
+
/** Accessible label for the back arrow in the mobile bottom-sheet stack. Defaults to `'Back'`. */
|
|
281
|
+
backLabel?: string;
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/models/Input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;GAIG;AACH,oBAAY,WAAW;IACrB,oDAAoD;IACpD,KAAK,UAAU;IACf,0FAA0F;IAC1F,SAAS,eAAe;CACzB;AAED,+DAA+D;AAC/D,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,0FAA0F;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S,CAAC,EAAE,MAAM,CAAC;IACnB,+FAA+F;IAC/F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@epam/ai-dial-conversation-input",
|
|
3
|
+
"version": "0.0.0-dev.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"module": "./index.js",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./styles.css": "./style.css",
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./index.d.ts",
|
|
14
|
+
"import": "./index.js",
|
|
15
|
+
"default": "./index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"@epam/ai-dial-attachment-input": "0.0.0-dev.0",
|
|
20
|
+
"@epam/ai-dial-chat-shared": "0.0.0-dev.0",
|
|
21
|
+
"@epam/ai-dial-ui-kit": "0.12.0-dev.21",
|
|
22
|
+
"@tabler/icons-react": "^3.44.0",
|
|
23
|
+
"react": "^19.0.0",
|
|
24
|
+
"react-dom": "^19.2.6",
|
|
25
|
+
"@epam/ai-dial-kit": "0.0.0-dev.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"react-window": "^2.2.7"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/test-setup.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAaA,cAAM,wBAAwB;IAC5B,OAAO;IACP,SAAS;IACT,UAAU;CACX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `fn` over every item in `items` with at most `concurrency` calls in flight
|
|
3
|
+
* at a time. Items are consumed from a shared queue by N concurrent workers, so
|
|
4
|
+
* faster tasks don't leave workers idle waiting for a slow sibling.
|
|
5
|
+
*/
|
|
6
|
+
export declare const runConcurrent: <T>(items: T[], concurrency: number, fn: (item: T) => Promise<void>) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Runs `fn` over every item in `items` at a steady rate of `maxPerMinute` calls
|
|
9
|
+
* per minute. All calls run concurrently — the rate limit controls when each
|
|
10
|
+
* call starts, not how many are in flight. This prevents bursting past a
|
|
11
|
+
* server-side throttle window while still parallelising the work.
|
|
12
|
+
*
|
|
13
|
+
* Example: 200 items at 100/min → one call every 600 ms, all overlapping,
|
|
14
|
+
* never more than 100 starts within any 60-second window.
|
|
15
|
+
*/
|
|
16
|
+
export declare const runAtRate: <T>(items: T[], maxPerMinute: number, fn: (item: T) => Promise<void>) => Promise<void>;
|
|
17
|
+
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/utils/concurrency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAU,CAAC,EACnC,OAAO,CAAC,EAAE,EACV,aAAa,MAAM,EACnB,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KAC7B,OAAO,CAAC,IAAI,CAYd,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAU,CAAC,EAC/B,OAAO,CAAC,EAAE,EACV,cAAc,MAAM,EACpB,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KAC7B,OAAO,CAAC,IAAI,CAYd,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeploymentItem } from '@epam/ai-dial-chat-shared';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
/** Returns the human-readable label for a deployment, falling back to its id. */
|
|
4
|
+
export declare const getDeploymentLabel: (item: DeploymentItem) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Filters deployments by a case-insensitive substring match against their label.
|
|
7
|
+
* An empty/whitespace query returns the list unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export declare const filterDeployments: (deployments: DeploymentItem[], query: string) => DeploymentItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Builds the leading icon for a deployment. Uses the resolved image URL when
|
|
12
|
+
* available (with an error fallback and lazy loading) and an initials avatar otherwise.
|
|
13
|
+
*/
|
|
14
|
+
export declare const buildDeploymentIcon: (resolvedIconUrl: string | undefined, type: string | undefined, displayName: string, size?: number, tooltip?: string) => ReactNode;
|
|
15
|
+
//# sourceMappingURL=deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/utils/deployment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,2BAA2B,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,iFAAiF;AACjF,eAAO,MAAM,kBAAkB,GAAI,MAAM,cAAc,KAAG,MAC7B,CAAC;AAE9B;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,aAAa,cAAc,EAAE,EAC7B,OAAO,MAAM,KACZ,cAAc,EAMhB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,iBAAiB,MAAM,GAAG,SAAS,EACnC,MAAM,MAAM,GAAG,SAAS,EACxB,aAAa,MAAM,EACnB,aAAS,EACT,UAAU,MAAM,KACf,SAOF,CAAC"}
|