@copilotz/chat-ui 0.1.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/README.md +38 -0
- package/dist/index.cjs +4146 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +546 -0
- package/dist/index.d.ts +546 -0
- package/dist/index.js +4177 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +4171 -0
- package/package.json +74 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
|
|
6
|
+
type MediaAttachment = {
|
|
7
|
+
kind: 'image';
|
|
8
|
+
dataUrl: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
fileName?: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'audio';
|
|
14
|
+
dataUrl: string;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
durationMs?: number;
|
|
17
|
+
fileName?: string;
|
|
18
|
+
size?: number;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'video';
|
|
21
|
+
dataUrl: string;
|
|
22
|
+
mimeType: string;
|
|
23
|
+
durationMs?: number;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
size?: number;
|
|
26
|
+
poster?: string;
|
|
27
|
+
};
|
|
28
|
+
interface ToolCall {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
arguments: Record<string, any>;
|
|
32
|
+
result?: any;
|
|
33
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
34
|
+
startTime?: number;
|
|
35
|
+
endTime?: number;
|
|
36
|
+
}
|
|
37
|
+
interface ChatMessage {
|
|
38
|
+
id: string;
|
|
39
|
+
role: 'user' | 'assistant' | 'system';
|
|
40
|
+
content: string;
|
|
41
|
+
timestamp: number;
|
|
42
|
+
attachments?: MediaAttachment[];
|
|
43
|
+
isStreaming?: boolean;
|
|
44
|
+
isComplete?: boolean;
|
|
45
|
+
isEdited?: boolean;
|
|
46
|
+
originalContent?: string;
|
|
47
|
+
editedAt?: number;
|
|
48
|
+
toolCalls?: ToolCall[];
|
|
49
|
+
metadata?: Record<string, any>;
|
|
50
|
+
}
|
|
51
|
+
interface ChatThread {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
createdAt: number;
|
|
55
|
+
updatedAt: number;
|
|
56
|
+
messageCount: number;
|
|
57
|
+
isArchived?: boolean;
|
|
58
|
+
metadata?: Record<string, any>;
|
|
59
|
+
}
|
|
60
|
+
interface ChatConfig {
|
|
61
|
+
branding?: {
|
|
62
|
+
logo?: ReactNode;
|
|
63
|
+
title?: string;
|
|
64
|
+
subtitle?: string;
|
|
65
|
+
avatar?: ReactNode;
|
|
66
|
+
};
|
|
67
|
+
labels?: {
|
|
68
|
+
inputPlaceholder?: string;
|
|
69
|
+
sendButton?: string;
|
|
70
|
+
sendMessageTooltip?: string;
|
|
71
|
+
newThread?: string;
|
|
72
|
+
deleteThread?: string;
|
|
73
|
+
copyMessage?: string;
|
|
74
|
+
editMessage?: string;
|
|
75
|
+
regenerateMessage?: string;
|
|
76
|
+
stopGeneration?: string;
|
|
77
|
+
stopGenerationTooltip?: string;
|
|
78
|
+
attachFiles?: string;
|
|
79
|
+
attachFileTooltip?: string;
|
|
80
|
+
recordAudio?: string;
|
|
81
|
+
recordAudioTooltip?: string;
|
|
82
|
+
exportData?: string;
|
|
83
|
+
importData?: string;
|
|
84
|
+
clearAll?: string;
|
|
85
|
+
sidebarToggle?: string;
|
|
86
|
+
customComponentToggle?: string;
|
|
87
|
+
settings?: string;
|
|
88
|
+
toggleDarkMode?: string;
|
|
89
|
+
lightMode?: string;
|
|
90
|
+
darkMode?: string;
|
|
91
|
+
newChat?: string;
|
|
92
|
+
search?: string;
|
|
93
|
+
customComponentLabel?: string;
|
|
94
|
+
showArchived?: string;
|
|
95
|
+
hideArchived?: string;
|
|
96
|
+
noThreadsFound?: string;
|
|
97
|
+
noThreadsYet?: string;
|
|
98
|
+
deleteConfirmTitle?: string;
|
|
99
|
+
deleteConfirmDescription?: string;
|
|
100
|
+
renameThread?: string;
|
|
101
|
+
archiveThread?: string;
|
|
102
|
+
unarchiveThread?: string;
|
|
103
|
+
today?: string;
|
|
104
|
+
yesterday?: string;
|
|
105
|
+
createNewThread?: string;
|
|
106
|
+
threadNamePlaceholder?: string;
|
|
107
|
+
cancel?: string;
|
|
108
|
+
create?: string;
|
|
109
|
+
footerLabel?: string;
|
|
110
|
+
toolUsed?: string;
|
|
111
|
+
daysAgo?: string;
|
|
112
|
+
inputHelpText?: string;
|
|
113
|
+
thinking?: string;
|
|
114
|
+
defaultThreadName?: string;
|
|
115
|
+
};
|
|
116
|
+
features?: {
|
|
117
|
+
enableThreads?: boolean;
|
|
118
|
+
enableFileUpload?: boolean;
|
|
119
|
+
enableAudioRecording?: boolean;
|
|
120
|
+
enableMessageEditing?: boolean;
|
|
121
|
+
enableMessageCopy?: boolean;
|
|
122
|
+
enableRegeneration?: boolean;
|
|
123
|
+
enableToolCallsDisplay?: boolean;
|
|
124
|
+
maxAttachments?: number;
|
|
125
|
+
maxFileSize?: number;
|
|
126
|
+
};
|
|
127
|
+
ui?: {
|
|
128
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
129
|
+
showTimestamps?: boolean;
|
|
130
|
+
showAvatars?: boolean;
|
|
131
|
+
compactMode?: boolean;
|
|
132
|
+
showWordCount?: boolean;
|
|
133
|
+
};
|
|
134
|
+
customComponent?: {
|
|
135
|
+
label?: string;
|
|
136
|
+
icon?: ReactNode;
|
|
137
|
+
/** Static component or render function receiving panel props */
|
|
138
|
+
component?: ReactNode | ((props: {
|
|
139
|
+
onClose: () => void;
|
|
140
|
+
isMobile: boolean;
|
|
141
|
+
}) => ReactNode);
|
|
142
|
+
};
|
|
143
|
+
/** Additional actions to render in the header */
|
|
144
|
+
headerActions?: ReactNode;
|
|
145
|
+
}
|
|
146
|
+
interface StateCallback<T = unknown> {
|
|
147
|
+
setState: (state: T | ((prev: T) => T)) => void;
|
|
148
|
+
getState: () => T;
|
|
149
|
+
}
|
|
150
|
+
interface ChatCallbacks {
|
|
151
|
+
onSendMessage?: (content: string, attachments?: MediaAttachment[], callback?: StateCallback<ChatState>) => void;
|
|
152
|
+
onEditMessage?: (messageId: string, newContent: string, callback?: StateCallback<ChatState>) => void;
|
|
153
|
+
onDeleteMessage?: (messageId: string, callback?: StateCallback<ChatState>) => void;
|
|
154
|
+
onRegenerateMessage?: (messageId: string, callback?: StateCallback<ChatState>) => void;
|
|
155
|
+
onStopGeneration?: (callback?: StateCallback<ChatState>) => void;
|
|
156
|
+
onCreateThread?: (title?: string, callback?: StateCallback<ChatState>) => void;
|
|
157
|
+
onSelectThread?: (threadId: string, callback?: StateCallback<ChatState>) => void;
|
|
158
|
+
onRenameThread?: (threadId: string, newTitle: string, callback?: StateCallback<ChatState>) => void;
|
|
159
|
+
onDeleteThread?: (threadId: string, callback?: StateCallback<ChatState>) => void;
|
|
160
|
+
onArchiveThread?: (threadId: string, callback?: StateCallback<ChatState>) => void;
|
|
161
|
+
onCopyMessage?: (messageId: string, content: string, callback?: StateCallback<ChatState>) => void;
|
|
162
|
+
onAttachmentRemove?: (attachmentIndex: number, callback?: StateCallback<ChatState>) => void;
|
|
163
|
+
onViewProfile?: () => void;
|
|
164
|
+
onOpenSettings?: () => void;
|
|
165
|
+
onThemeChange?: (theme: 'light' | 'dark' | 'system') => void;
|
|
166
|
+
onLogout?: () => void;
|
|
167
|
+
}
|
|
168
|
+
interface ChatV2Props {
|
|
169
|
+
messages?: ChatMessage[];
|
|
170
|
+
threads?: ChatThread[];
|
|
171
|
+
currentThreadId?: string | null;
|
|
172
|
+
config?: ChatConfig;
|
|
173
|
+
sidebar?: ReactNode;
|
|
174
|
+
isGenerating?: boolean;
|
|
175
|
+
callbacks?: ChatCallbacks;
|
|
176
|
+
user?: {
|
|
177
|
+
id: string;
|
|
178
|
+
name?: string;
|
|
179
|
+
avatar?: string;
|
|
180
|
+
email?: string;
|
|
181
|
+
};
|
|
182
|
+
assistant?: {
|
|
183
|
+
name?: string;
|
|
184
|
+
avatar?: ReactNode;
|
|
185
|
+
description?: string;
|
|
186
|
+
};
|
|
187
|
+
suggestions?: string[];
|
|
188
|
+
enabledFeatures?: string[];
|
|
189
|
+
className?: string;
|
|
190
|
+
onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
|
|
191
|
+
onUpdateMemory?: (memoryId: string, content: string) => void;
|
|
192
|
+
onDeleteMemory?: (memoryId: string) => void;
|
|
193
|
+
}
|
|
194
|
+
interface ChatState {
|
|
195
|
+
input: string;
|
|
196
|
+
attachments: MediaAttachment[];
|
|
197
|
+
isRecording: boolean;
|
|
198
|
+
selectedThreadId: string | null;
|
|
199
|
+
isAtBottom: boolean;
|
|
200
|
+
showSidebar: boolean;
|
|
201
|
+
showThreads: boolean;
|
|
202
|
+
editingMessageId: string | null;
|
|
203
|
+
isSidebarCollapsed: boolean;
|
|
204
|
+
}
|
|
205
|
+
type MessageAction = 'copy' | 'edit' | 'delete' | 'regenerate' | 'retry';
|
|
206
|
+
interface MessageActionEvent {
|
|
207
|
+
action: MessageAction;
|
|
208
|
+
messageId: string;
|
|
209
|
+
content?: string;
|
|
210
|
+
}
|
|
211
|
+
interface FileUploadProgress {
|
|
212
|
+
fileName: string;
|
|
213
|
+
progress: number;
|
|
214
|
+
status: 'uploading' | 'completed' | 'failed';
|
|
215
|
+
}
|
|
216
|
+
interface StreamingUpdate {
|
|
217
|
+
messageId: string;
|
|
218
|
+
delta: string;
|
|
219
|
+
isComplete?: boolean;
|
|
220
|
+
}
|
|
221
|
+
interface UserCustomField {
|
|
222
|
+
key: string;
|
|
223
|
+
label: string;
|
|
224
|
+
value: string | number | boolean | null | undefined;
|
|
225
|
+
type?: 'text' | 'email' | 'phone' | 'url' | 'date' | 'number' | 'boolean';
|
|
226
|
+
icon?: ReactNode;
|
|
227
|
+
}
|
|
228
|
+
interface MemoryItem {
|
|
229
|
+
id: string;
|
|
230
|
+
content: string;
|
|
231
|
+
category?: 'preference' | 'fact' | 'goal' | 'context' | 'other';
|
|
232
|
+
source: 'agent' | 'user';
|
|
233
|
+
createdAt: string;
|
|
234
|
+
updatedAt?: string;
|
|
235
|
+
}
|
|
236
|
+
interface ChatUserContext extends Record<string, unknown> {
|
|
237
|
+
/** Custom fields defined by the login component, shown in built-in user profile */
|
|
238
|
+
customFields?: UserCustomField[] | Record<string, unknown>;
|
|
239
|
+
/** Persistent memories about the user */
|
|
240
|
+
memories?: {
|
|
241
|
+
items?: MemoryItem[];
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare const ChatUI: React__default.FC<ChatV2Props>;
|
|
246
|
+
|
|
247
|
+
interface ChatHeaderConfig {
|
|
248
|
+
branding?: {
|
|
249
|
+
logo?: ReactNode;
|
|
250
|
+
title?: string;
|
|
251
|
+
subtitle?: string;
|
|
252
|
+
};
|
|
253
|
+
labels?: {
|
|
254
|
+
newThread?: string;
|
|
255
|
+
exportData?: string;
|
|
256
|
+
importData?: string;
|
|
257
|
+
clearAll?: string;
|
|
258
|
+
sidebarToggle?: string;
|
|
259
|
+
customComponentToggle?: string;
|
|
260
|
+
settings?: string;
|
|
261
|
+
toggleDarkMode?: string;
|
|
262
|
+
lightMode?: string;
|
|
263
|
+
darkMode?: string;
|
|
264
|
+
};
|
|
265
|
+
customComponent?: {
|
|
266
|
+
label?: string;
|
|
267
|
+
icon?: ReactNode;
|
|
268
|
+
onClick?: () => void;
|
|
269
|
+
};
|
|
270
|
+
/** Additional actions to render in the header (before the settings menu) */
|
|
271
|
+
headerActions?: ReactNode;
|
|
272
|
+
}
|
|
273
|
+
interface ChatHeaderProps {
|
|
274
|
+
config: ChatHeaderConfig;
|
|
275
|
+
currentThreadTitle?: string | null;
|
|
276
|
+
onSidebarToggle?: () => void;
|
|
277
|
+
onCustomComponentToggle?: () => void;
|
|
278
|
+
onNewThread?: () => void;
|
|
279
|
+
onExportData?: () => void;
|
|
280
|
+
onImportData?: (file: File) => void;
|
|
281
|
+
onClearAll?: () => void;
|
|
282
|
+
showCustomComponentButton?: boolean;
|
|
283
|
+
isMobile?: boolean;
|
|
284
|
+
className?: string;
|
|
285
|
+
}
|
|
286
|
+
declare const ChatHeader: React__default.FC<ChatHeaderProps>;
|
|
287
|
+
|
|
288
|
+
interface ChatInputProps {
|
|
289
|
+
value: string;
|
|
290
|
+
onChange: (value: string) => void;
|
|
291
|
+
onSubmit: (content: string, attachments: MediaAttachment[]) => void;
|
|
292
|
+
attachments: MediaAttachment[];
|
|
293
|
+
onAttachmentsChange: (attachments: MediaAttachment[]) => void;
|
|
294
|
+
placeholder?: string;
|
|
295
|
+
disabled?: boolean;
|
|
296
|
+
isGenerating?: boolean;
|
|
297
|
+
onStopGeneration?: () => void;
|
|
298
|
+
enableFileUpload?: boolean;
|
|
299
|
+
enableAudioRecording?: boolean;
|
|
300
|
+
maxAttachments?: number;
|
|
301
|
+
maxFileSize?: number;
|
|
302
|
+
acceptedFileTypes?: string[];
|
|
303
|
+
className?: string;
|
|
304
|
+
config?: ChatConfig;
|
|
305
|
+
}
|
|
306
|
+
declare const ChatInput: React__default.FC<ChatInputProps>;
|
|
307
|
+
|
|
308
|
+
interface MessageProps {
|
|
309
|
+
message: ChatMessage;
|
|
310
|
+
isUser?: boolean;
|
|
311
|
+
userAvatar?: string;
|
|
312
|
+
userName?: string;
|
|
313
|
+
assistantAvatar?: React__default.ReactNode;
|
|
314
|
+
assistantName?: string;
|
|
315
|
+
showTimestamp?: boolean;
|
|
316
|
+
showAvatar?: boolean;
|
|
317
|
+
enableCopy?: boolean;
|
|
318
|
+
enableEdit?: boolean;
|
|
319
|
+
enableRegenerate?: boolean;
|
|
320
|
+
enableToolCallsDisplay?: boolean;
|
|
321
|
+
compactMode?: boolean;
|
|
322
|
+
onAction?: (event: MessageActionEvent) => void;
|
|
323
|
+
className?: string;
|
|
324
|
+
toolUsedLabel?: string;
|
|
325
|
+
thinkingLabel?: string;
|
|
326
|
+
}
|
|
327
|
+
declare const Message: React__default.FC<MessageProps>;
|
|
328
|
+
|
|
329
|
+
declare function Sidebar$1({ side, variant, collapsible, className, children, ...props }: React.ComponentProps<"div"> & {
|
|
330
|
+
side?: "left" | "right";
|
|
331
|
+
variant?: "sidebar" | "floating" | "inset";
|
|
332
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
333
|
+
}): react_jsx_runtime.JSX.Element;
|
|
334
|
+
|
|
335
|
+
interface UserMenuConfig {
|
|
336
|
+
labels?: {
|
|
337
|
+
profile?: string;
|
|
338
|
+
settings?: string;
|
|
339
|
+
theme?: string;
|
|
340
|
+
lightMode?: string;
|
|
341
|
+
darkMode?: string;
|
|
342
|
+
systemTheme?: string;
|
|
343
|
+
logout?: string;
|
|
344
|
+
guest?: string;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
interface UserMenuUser {
|
|
348
|
+
id: string;
|
|
349
|
+
name?: string;
|
|
350
|
+
email?: string;
|
|
351
|
+
avatar?: string;
|
|
352
|
+
}
|
|
353
|
+
interface UserMenuCallbacks {
|
|
354
|
+
onViewProfile?: () => void;
|
|
355
|
+
onOpenSettings?: () => void;
|
|
356
|
+
onThemeChange?: (theme: 'light' | 'dark' | 'system') => void;
|
|
357
|
+
onLogout?: () => void;
|
|
358
|
+
}
|
|
359
|
+
interface UserMenuProps {
|
|
360
|
+
user?: UserMenuUser | null;
|
|
361
|
+
config?: UserMenuConfig;
|
|
362
|
+
callbacks?: UserMenuCallbacks;
|
|
363
|
+
currentTheme?: 'light' | 'dark' | 'system';
|
|
364
|
+
/** Show theme options in the menu */
|
|
365
|
+
showThemeOptions?: boolean;
|
|
366
|
+
/** Additional menu items to render */
|
|
367
|
+
additionalItems?: React__default.ReactNode;
|
|
368
|
+
}
|
|
369
|
+
declare const UserMenu: React__default.FC<UserMenuProps>;
|
|
370
|
+
|
|
371
|
+
interface SidebarConfig {
|
|
372
|
+
labels?: {
|
|
373
|
+
newChat?: string;
|
|
374
|
+
search?: string;
|
|
375
|
+
customComponentLabel?: string;
|
|
376
|
+
showArchived?: string;
|
|
377
|
+
hideArchived?: string;
|
|
378
|
+
noThreadsFound?: string;
|
|
379
|
+
noThreadsYet?: string;
|
|
380
|
+
deleteConfirmTitle?: string;
|
|
381
|
+
deleteConfirmDescription?: string;
|
|
382
|
+
renameThread?: string;
|
|
383
|
+
archiveThread?: string;
|
|
384
|
+
unarchiveThread?: string;
|
|
385
|
+
deleteThread?: string;
|
|
386
|
+
today?: string;
|
|
387
|
+
yesterday?: string;
|
|
388
|
+
createNewThread?: string;
|
|
389
|
+
threadNamePlaceholder?: string;
|
|
390
|
+
cancel?: string;
|
|
391
|
+
create?: string;
|
|
392
|
+
daysAgo?: string;
|
|
393
|
+
};
|
|
394
|
+
branding?: {
|
|
395
|
+
logo?: React__default.ReactNode;
|
|
396
|
+
title?: React__default.ReactNode;
|
|
397
|
+
subtitle?: React__default.ReactNode;
|
|
398
|
+
};
|
|
399
|
+
userMenu?: UserMenuConfig;
|
|
400
|
+
}
|
|
401
|
+
interface SidebarProps extends React__default.ComponentProps<typeof Sidebar$1> {
|
|
402
|
+
threads: ChatThread[];
|
|
403
|
+
currentThreadId?: string | null;
|
|
404
|
+
config: SidebarConfig;
|
|
405
|
+
onCreateThread?: (title?: string) => void;
|
|
406
|
+
onSelectThread?: (threadId: string) => void;
|
|
407
|
+
onRenameThread?: (threadId: string, newTitle: string) => void;
|
|
408
|
+
onDeleteThread?: (threadId: string) => void;
|
|
409
|
+
onArchiveThread?: (threadId: string) => void;
|
|
410
|
+
user?: UserMenuUser | null;
|
|
411
|
+
userMenuCallbacks?: UserMenuCallbacks;
|
|
412
|
+
currentTheme?: 'light' | 'dark' | 'system';
|
|
413
|
+
showThemeOptions?: boolean;
|
|
414
|
+
/** Additional items to render in the user menu */
|
|
415
|
+
userMenuAdditionalItems?: React__default.ReactNode;
|
|
416
|
+
}
|
|
417
|
+
declare const Sidebar: React__default.FC<SidebarProps>;
|
|
418
|
+
|
|
419
|
+
interface ThreadManagerProps {
|
|
420
|
+
threads: ChatThread[];
|
|
421
|
+
currentThreadId?: string | null;
|
|
422
|
+
config?: ChatConfig;
|
|
423
|
+
onCreateThread?: (title?: string) => void;
|
|
424
|
+
onSelectThread?: (threadId: string) => void;
|
|
425
|
+
onRenameThread?: (threadId: string, newTitle: string) => void;
|
|
426
|
+
onDeleteThread?: (threadId: string) => void;
|
|
427
|
+
onArchiveThread?: (threadId: string) => void;
|
|
428
|
+
isOpen?: boolean;
|
|
429
|
+
onClose?: () => void;
|
|
430
|
+
className?: string;
|
|
431
|
+
}
|
|
432
|
+
declare const ThreadManager: React__default.FC<ThreadManagerProps>;
|
|
433
|
+
|
|
434
|
+
type Setter = (next: Partial<ChatUserContext> | ((prev: ChatUserContext) => Partial<ChatUserContext>)) => void;
|
|
435
|
+
interface ChatUserContextValue {
|
|
436
|
+
context: ChatUserContext;
|
|
437
|
+
setContext: Setter;
|
|
438
|
+
resetContext: () => void;
|
|
439
|
+
}
|
|
440
|
+
declare const ChatUserContextProvider: React__default.FC<{
|
|
441
|
+
children: React__default.ReactNode;
|
|
442
|
+
initial?: Partial<ChatUserContext>;
|
|
443
|
+
}>;
|
|
444
|
+
declare function useChatUserContext(): ChatUserContextValue;
|
|
445
|
+
|
|
446
|
+
interface UserProfileConfig {
|
|
447
|
+
labels?: {
|
|
448
|
+
title?: string;
|
|
449
|
+
basicInfo?: string;
|
|
450
|
+
customFields?: string;
|
|
451
|
+
memories?: string;
|
|
452
|
+
addMemory?: string;
|
|
453
|
+
noMemories?: string;
|
|
454
|
+
close?: string;
|
|
455
|
+
noCustomFields?: string;
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
interface UserProfileUser {
|
|
459
|
+
id: string;
|
|
460
|
+
name?: string;
|
|
461
|
+
email?: string;
|
|
462
|
+
avatar?: string;
|
|
463
|
+
}
|
|
464
|
+
interface CustomField {
|
|
465
|
+
key: string;
|
|
466
|
+
label: string;
|
|
467
|
+
value: string | number | boolean | null | undefined;
|
|
468
|
+
type?: 'text' | 'email' | 'phone' | 'url' | 'date' | 'number' | 'boolean';
|
|
469
|
+
icon?: React__default.ReactNode;
|
|
470
|
+
}
|
|
471
|
+
interface UserProfileProps {
|
|
472
|
+
isOpen: boolean;
|
|
473
|
+
onClose: () => void;
|
|
474
|
+
user?: UserProfileUser | null;
|
|
475
|
+
/** Custom fields from userContext.customFields */
|
|
476
|
+
customFields?: CustomField[] | Record<string, unknown>;
|
|
477
|
+
/** User memories */
|
|
478
|
+
memories?: MemoryItem[];
|
|
479
|
+
config?: UserProfileConfig;
|
|
480
|
+
/** Called when user wants to edit their profile */
|
|
481
|
+
onEditProfile?: () => void;
|
|
482
|
+
/** Called when user wants to logout */
|
|
483
|
+
onLogout?: () => void;
|
|
484
|
+
/** Called when user adds a memory */
|
|
485
|
+
onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
|
|
486
|
+
/** Called when user updates a memory */
|
|
487
|
+
onUpdateMemory?: (memoryId: string, content: string) => void;
|
|
488
|
+
/** Called when user deletes a memory */
|
|
489
|
+
onDeleteMemory?: (memoryId: string) => void;
|
|
490
|
+
className?: string;
|
|
491
|
+
}
|
|
492
|
+
declare const UserProfile: React__default.FC<UserProfileProps>;
|
|
493
|
+
|
|
494
|
+
declare const defaultChatConfig: Required<ChatConfig>;
|
|
495
|
+
declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatConfig>): Required<ChatConfig>;
|
|
496
|
+
declare const chatConfigPresets: {
|
|
497
|
+
readonly minimal: Partial<ChatConfig>;
|
|
498
|
+
readonly full: Partial<ChatConfig>;
|
|
499
|
+
readonly developer: Partial<ChatConfig>;
|
|
500
|
+
readonly customer_support: Partial<ChatConfig>;
|
|
501
|
+
};
|
|
502
|
+
declare function validateConfig(config: ChatConfig): string[];
|
|
503
|
+
declare const themeUtils: {
|
|
504
|
+
getSystemTheme: () => "light" | "dark";
|
|
505
|
+
resolveTheme: (theme: "light" | "dark" | "auto") => "light" | "dark";
|
|
506
|
+
applyTheme: (theme: "light" | "dark" | "auto") => void;
|
|
507
|
+
};
|
|
508
|
+
declare const featureFlags: {
|
|
509
|
+
isEnabled: (config: Required<ChatConfig>, feature: keyof Required<ChatConfig>["features"]) => boolean;
|
|
510
|
+
getEnabledFeatures: (config: Required<ChatConfig>) => string[];
|
|
511
|
+
hasAnyFeature: (config: Required<ChatConfig>, features: (keyof Required<ChatConfig>["features"])[]) => boolean;
|
|
512
|
+
};
|
|
513
|
+
declare const configUtils: {
|
|
514
|
+
createConfigHook: (config: Required<ChatConfig>) => {
|
|
515
|
+
config: Required<ChatConfig>;
|
|
516
|
+
isFeatureEnabled: (feature: keyof Required<ChatConfig>["features"]) => boolean;
|
|
517
|
+
getLabel: (key: keyof Required<ChatConfig>["labels"]) => string | undefined;
|
|
518
|
+
getBranding: () => {
|
|
519
|
+
logo?: React.ReactNode;
|
|
520
|
+
title?: string;
|
|
521
|
+
subtitle?: string;
|
|
522
|
+
avatar?: React.ReactNode;
|
|
523
|
+
};
|
|
524
|
+
getUI: () => {
|
|
525
|
+
theme?: "light" | "dark" | "auto";
|
|
526
|
+
showTimestamps?: boolean;
|
|
527
|
+
showAvatars?: boolean;
|
|
528
|
+
compactMode?: boolean;
|
|
529
|
+
showWordCount?: boolean;
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
535
|
+
declare const formatDate: (timestamp: number, labels?: ChatConfig["labels"]) => string;
|
|
536
|
+
|
|
537
|
+
declare const chatUtils: {
|
|
538
|
+
generateId: () => string;
|
|
539
|
+
generateMessageId: () => string;
|
|
540
|
+
generateThreadId: () => string;
|
|
541
|
+
createMessage: (role: "user" | "assistant" | "system", content: string, attachments?: MediaAttachment[]) => ChatMessage;
|
|
542
|
+
createThread: (title: string) => ChatThread;
|
|
543
|
+
generateThreadTitle: (firstMessage: string) => string;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export { type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CustomField, type FileUploadProgress, type MediaAttachment, type MemoryItem, Message, type MessageAction, type MessageActionEvent, Sidebar, type SidebarConfig, type SidebarProps, type StateCallback, type StreamingUpdate, ThreadManager, type ToolCall, type UserCustomField, UserMenu, type UserMenuCallbacks, type UserMenuConfig, type UserMenuProps, type UserMenuUser, UserProfile, type UserProfileConfig, type UserProfileProps, type UserProfileUser, chatConfigPresets, chatUtils, cn, configUtils, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
|