@copilotz/chat-ui 0.1.0 → 0.1.2
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 +405 -13
- package/dist/index.cjs +861 -567
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +775 -478
- package/dist/index.js.map +1 -1
- package/dist/styles.css +246 -18
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -64,6 +64,11 @@ interface ChatConfig {
|
|
|
64
64
|
subtitle?: string;
|
|
65
65
|
avatar?: ReactNode;
|
|
66
66
|
};
|
|
67
|
+
agentSelector?: {
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
label?: string;
|
|
70
|
+
hideIfSingle?: boolean;
|
|
71
|
+
};
|
|
67
72
|
labels?: {
|
|
68
73
|
inputPlaceholder?: string;
|
|
69
74
|
sendButton?: string;
|
|
@@ -172,6 +177,7 @@ interface ChatV2Props {
|
|
|
172
177
|
config?: ChatConfig;
|
|
173
178
|
sidebar?: ReactNode;
|
|
174
179
|
isGenerating?: boolean;
|
|
180
|
+
isMessagesLoading?: boolean;
|
|
175
181
|
callbacks?: ChatCallbacks;
|
|
176
182
|
user?: {
|
|
177
183
|
id: string;
|
|
@@ -184,12 +190,27 @@ interface ChatV2Props {
|
|
|
184
190
|
avatar?: ReactNode;
|
|
185
191
|
description?: string;
|
|
186
192
|
};
|
|
193
|
+
agentOptions?: AgentOption[];
|
|
194
|
+
selectedAgentId?: string | null;
|
|
195
|
+
onSelectAgent?: (agentId: string) => void;
|
|
187
196
|
suggestions?: string[];
|
|
197
|
+
messageSuggestions?: Record<string, string[]>;
|
|
188
198
|
enabledFeatures?: string[];
|
|
189
199
|
className?: string;
|
|
190
200
|
onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
|
|
191
201
|
onUpdateMemory?: (memoryId: string, content: string) => void;
|
|
192
202
|
onDeleteMemory?: (memoryId: string) => void;
|
|
203
|
+
/**
|
|
204
|
+
* Initial value for the input field.
|
|
205
|
+
* Useful for pre-filling the input from URL parameters or other sources.
|
|
206
|
+
* The value is only used once on mount or when it changes.
|
|
207
|
+
*/
|
|
208
|
+
initialInput?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Callback when the initial input has been consumed (user started typing or sent).
|
|
211
|
+
* Call this to clear the source (e.g., URL parameter) to prevent re-prefilling.
|
|
212
|
+
*/
|
|
213
|
+
onInitialInputConsumed?: () => void;
|
|
193
214
|
}
|
|
194
215
|
interface ChatState {
|
|
195
216
|
input: string;
|
|
@@ -202,6 +223,12 @@ interface ChatState {
|
|
|
202
223
|
editingMessageId: string | null;
|
|
203
224
|
isSidebarCollapsed: boolean;
|
|
204
225
|
}
|
|
226
|
+
interface AgentOption {
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
description?: string;
|
|
230
|
+
avatarUrl?: string;
|
|
231
|
+
}
|
|
205
232
|
type MessageAction = 'copy' | 'edit' | 'delete' | 'regenerate' | 'retry';
|
|
206
233
|
interface MessageActionEvent {
|
|
207
234
|
action: MessageAction;
|
|
@@ -250,6 +277,11 @@ interface ChatHeaderConfig {
|
|
|
250
277
|
title?: string;
|
|
251
278
|
subtitle?: string;
|
|
252
279
|
};
|
|
280
|
+
agentSelector?: {
|
|
281
|
+
enabled?: boolean;
|
|
282
|
+
label?: string;
|
|
283
|
+
hideIfSingle?: boolean;
|
|
284
|
+
};
|
|
253
285
|
labels?: {
|
|
254
286
|
newThread?: string;
|
|
255
287
|
exportData?: string;
|
|
@@ -281,6 +313,10 @@ interface ChatHeaderProps {
|
|
|
281
313
|
onClearAll?: () => void;
|
|
282
314
|
showCustomComponentButton?: boolean;
|
|
283
315
|
isMobile?: boolean;
|
|
316
|
+
showAgentSelector?: boolean;
|
|
317
|
+
agentOptions?: AgentOption[];
|
|
318
|
+
selectedAgentId?: string | null;
|
|
319
|
+
onSelectAgent?: (agentId: string) => void;
|
|
284
320
|
className?: string;
|
|
285
321
|
}
|
|
286
322
|
declare const ChatHeader: React__default.FC<ChatHeaderProps>;
|
|
@@ -323,6 +359,8 @@ interface MessageProps {
|
|
|
323
359
|
className?: string;
|
|
324
360
|
toolUsedLabel?: string;
|
|
325
361
|
thinkingLabel?: string;
|
|
362
|
+
/** When true, hides the avatar and name (for grouped consecutive messages from same sender) */
|
|
363
|
+
isGrouped?: boolean;
|
|
326
364
|
}
|
|
327
365
|
declare const Message: React__default.FC<MessageProps>;
|
|
328
366
|
|
|
@@ -543,4 +581,4 @@ declare const chatUtils: {
|
|
|
543
581
|
generateThreadTitle: (firstMessage: string) => string;
|
|
544
582
|
};
|
|
545
583
|
|
|
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 };
|
|
584
|
+
export { type AgentOption, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,11 @@ interface ChatConfig {
|
|
|
64
64
|
subtitle?: string;
|
|
65
65
|
avatar?: ReactNode;
|
|
66
66
|
};
|
|
67
|
+
agentSelector?: {
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
label?: string;
|
|
70
|
+
hideIfSingle?: boolean;
|
|
71
|
+
};
|
|
67
72
|
labels?: {
|
|
68
73
|
inputPlaceholder?: string;
|
|
69
74
|
sendButton?: string;
|
|
@@ -172,6 +177,7 @@ interface ChatV2Props {
|
|
|
172
177
|
config?: ChatConfig;
|
|
173
178
|
sidebar?: ReactNode;
|
|
174
179
|
isGenerating?: boolean;
|
|
180
|
+
isMessagesLoading?: boolean;
|
|
175
181
|
callbacks?: ChatCallbacks;
|
|
176
182
|
user?: {
|
|
177
183
|
id: string;
|
|
@@ -184,12 +190,27 @@ interface ChatV2Props {
|
|
|
184
190
|
avatar?: ReactNode;
|
|
185
191
|
description?: string;
|
|
186
192
|
};
|
|
193
|
+
agentOptions?: AgentOption[];
|
|
194
|
+
selectedAgentId?: string | null;
|
|
195
|
+
onSelectAgent?: (agentId: string) => void;
|
|
187
196
|
suggestions?: string[];
|
|
197
|
+
messageSuggestions?: Record<string, string[]>;
|
|
188
198
|
enabledFeatures?: string[];
|
|
189
199
|
className?: string;
|
|
190
200
|
onAddMemory?: (content: string, category?: MemoryItem['category']) => void;
|
|
191
201
|
onUpdateMemory?: (memoryId: string, content: string) => void;
|
|
192
202
|
onDeleteMemory?: (memoryId: string) => void;
|
|
203
|
+
/**
|
|
204
|
+
* Initial value for the input field.
|
|
205
|
+
* Useful for pre-filling the input from URL parameters or other sources.
|
|
206
|
+
* The value is only used once on mount or when it changes.
|
|
207
|
+
*/
|
|
208
|
+
initialInput?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Callback when the initial input has been consumed (user started typing or sent).
|
|
211
|
+
* Call this to clear the source (e.g., URL parameter) to prevent re-prefilling.
|
|
212
|
+
*/
|
|
213
|
+
onInitialInputConsumed?: () => void;
|
|
193
214
|
}
|
|
194
215
|
interface ChatState {
|
|
195
216
|
input: string;
|
|
@@ -202,6 +223,12 @@ interface ChatState {
|
|
|
202
223
|
editingMessageId: string | null;
|
|
203
224
|
isSidebarCollapsed: boolean;
|
|
204
225
|
}
|
|
226
|
+
interface AgentOption {
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
description?: string;
|
|
230
|
+
avatarUrl?: string;
|
|
231
|
+
}
|
|
205
232
|
type MessageAction = 'copy' | 'edit' | 'delete' | 'regenerate' | 'retry';
|
|
206
233
|
interface MessageActionEvent {
|
|
207
234
|
action: MessageAction;
|
|
@@ -250,6 +277,11 @@ interface ChatHeaderConfig {
|
|
|
250
277
|
title?: string;
|
|
251
278
|
subtitle?: string;
|
|
252
279
|
};
|
|
280
|
+
agentSelector?: {
|
|
281
|
+
enabled?: boolean;
|
|
282
|
+
label?: string;
|
|
283
|
+
hideIfSingle?: boolean;
|
|
284
|
+
};
|
|
253
285
|
labels?: {
|
|
254
286
|
newThread?: string;
|
|
255
287
|
exportData?: string;
|
|
@@ -281,6 +313,10 @@ interface ChatHeaderProps {
|
|
|
281
313
|
onClearAll?: () => void;
|
|
282
314
|
showCustomComponentButton?: boolean;
|
|
283
315
|
isMobile?: boolean;
|
|
316
|
+
showAgentSelector?: boolean;
|
|
317
|
+
agentOptions?: AgentOption[];
|
|
318
|
+
selectedAgentId?: string | null;
|
|
319
|
+
onSelectAgent?: (agentId: string) => void;
|
|
284
320
|
className?: string;
|
|
285
321
|
}
|
|
286
322
|
declare const ChatHeader: React__default.FC<ChatHeaderProps>;
|
|
@@ -323,6 +359,8 @@ interface MessageProps {
|
|
|
323
359
|
className?: string;
|
|
324
360
|
toolUsedLabel?: string;
|
|
325
361
|
thinkingLabel?: string;
|
|
362
|
+
/** When true, hides the avatar and name (for grouped consecutive messages from same sender) */
|
|
363
|
+
isGrouped?: boolean;
|
|
326
364
|
}
|
|
327
365
|
declare const Message: React__default.FC<MessageProps>;
|
|
328
366
|
|
|
@@ -543,4 +581,4 @@ declare const chatUtils: {
|
|
|
543
581
|
generateThreadTitle: (firstMessage: string) => string;
|
|
544
582
|
};
|
|
545
583
|
|
|
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 };
|
|
584
|
+
export { type AgentOption, 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 };
|