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