@copilotz/chat-ui 0.9.22 → 0.9.23
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/dist/index.cjs +54 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +54 -39
- package/dist/index.js.map +1 -1
- package/dist/styles.css +12 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -163,6 +163,10 @@ interface ChatConfig {
|
|
|
163
163
|
inputPlaceholder?: string;
|
|
164
164
|
sendButton?: string;
|
|
165
165
|
sendMessageTooltip?: string;
|
|
166
|
+
stageMessageTooltip?: string;
|
|
167
|
+
sendNowTooltip?: string;
|
|
168
|
+
stagedMessageLabel?: string;
|
|
169
|
+
discardStagedMessageTooltip?: string;
|
|
166
170
|
newThread?: string;
|
|
167
171
|
deleteThread?: string;
|
|
168
172
|
copyMessage?: string;
|
|
@@ -357,6 +361,10 @@ interface ChatCallbacks {
|
|
|
357
361
|
onThemeChange?: (theme: "light" | "dark" | "system") => void;
|
|
358
362
|
onLogout?: () => void;
|
|
359
363
|
}
|
|
364
|
+
interface ChatActivityNotice {
|
|
365
|
+
tone: "info" | "error";
|
|
366
|
+
message: string;
|
|
367
|
+
}
|
|
360
368
|
interface ChatV2Props {
|
|
361
369
|
messages?: ChatMessage[];
|
|
362
370
|
threads?: ChatThread[];
|
|
@@ -370,6 +378,7 @@ interface ChatV2Props {
|
|
|
370
378
|
isMessagesLoading?: boolean;
|
|
371
379
|
isLoadingOlderMessages?: boolean;
|
|
372
380
|
hasMoreMessagesBefore?: boolean;
|
|
381
|
+
activityNotice?: ChatActivityNotice | null;
|
|
373
382
|
callbacks?: ChatCallbacks;
|
|
374
383
|
onLoadOlderMessages?: () => void;
|
|
375
384
|
user?: {
|
|
@@ -519,4 +528,4 @@ declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatC
|
|
|
519
528
|
declare const getAttachmentKindFromMimeType: (mimeType?: string | null) => MediaAttachmentKind;
|
|
520
529
|
declare const getMimeTypeFromDataUrl: (dataUrl: string) => string | null;
|
|
521
530
|
|
|
522
|
-
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatHeaderMenuItem, type ChatMarkdownConfig, type ChatMessage, type ChatSender, type ChatState, type ChatThread, type ChatThreadTag, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MediaAttachmentKind, type MemoryItem, type MessageAction, type MessageActionEvent, MessageSenderAvatar, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, getAttachmentKindFromMimeType, getMimeTypeFromDataUrl, mergeConfig, resolveMessageSenderDisplay, useChatUserContext };
|
|
531
|
+
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatActivityNotice, type ChatCallbacks, type ChatConfig, type ChatHeaderMenuItem, type ChatMarkdownConfig, type ChatMessage, type ChatSender, type ChatState, type ChatThread, type ChatThreadTag, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MediaAttachmentKind, type MemoryItem, type MessageAction, type MessageActionEvent, MessageSenderAvatar, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, getAttachmentKindFromMimeType, getMimeTypeFromDataUrl, mergeConfig, resolveMessageSenderDisplay, useChatUserContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -163,6 +163,10 @@ interface ChatConfig {
|
|
|
163
163
|
inputPlaceholder?: string;
|
|
164
164
|
sendButton?: string;
|
|
165
165
|
sendMessageTooltip?: string;
|
|
166
|
+
stageMessageTooltip?: string;
|
|
167
|
+
sendNowTooltip?: string;
|
|
168
|
+
stagedMessageLabel?: string;
|
|
169
|
+
discardStagedMessageTooltip?: string;
|
|
166
170
|
newThread?: string;
|
|
167
171
|
deleteThread?: string;
|
|
168
172
|
copyMessage?: string;
|
|
@@ -357,6 +361,10 @@ interface ChatCallbacks {
|
|
|
357
361
|
onThemeChange?: (theme: "light" | "dark" | "system") => void;
|
|
358
362
|
onLogout?: () => void;
|
|
359
363
|
}
|
|
364
|
+
interface ChatActivityNotice {
|
|
365
|
+
tone: "info" | "error";
|
|
366
|
+
message: string;
|
|
367
|
+
}
|
|
360
368
|
interface ChatV2Props {
|
|
361
369
|
messages?: ChatMessage[];
|
|
362
370
|
threads?: ChatThread[];
|
|
@@ -370,6 +378,7 @@ interface ChatV2Props {
|
|
|
370
378
|
isMessagesLoading?: boolean;
|
|
371
379
|
isLoadingOlderMessages?: boolean;
|
|
372
380
|
hasMoreMessagesBefore?: boolean;
|
|
381
|
+
activityNotice?: ChatActivityNotice | null;
|
|
373
382
|
callbacks?: ChatCallbacks;
|
|
374
383
|
onLoadOlderMessages?: () => void;
|
|
375
384
|
user?: {
|
|
@@ -519,4 +528,4 @@ declare function mergeConfig(_baseConfig: ChatConfig, userConfig?: Partial<ChatC
|
|
|
519
528
|
declare const getAttachmentKindFromMimeType: (mimeType?: string | null) => MediaAttachmentKind;
|
|
520
529
|
declare const getMimeTypeFromDataUrl: (dataUrl: string) => string | null;
|
|
521
530
|
|
|
522
|
-
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatCallbacks, type ChatConfig, type ChatHeaderMenuItem, type ChatMarkdownConfig, type ChatMessage, type ChatSender, type ChatState, type ChatThread, type ChatThreadTag, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MediaAttachmentKind, type MemoryItem, type MessageAction, type MessageActionEvent, MessageSenderAvatar, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, getAttachmentKindFromMimeType, getMimeTypeFromDataUrl, mergeConfig, resolveMessageSenderDisplay, useChatUserContext };
|
|
531
|
+
export { type AgentOption, AssistantActivity, type AssistantActivityBlock, type AssistantActivityItem, type AssistantActivityKind, type AssistantActivityStatus, type AudioAttachment, type ChatActivityNotice, type ChatCallbacks, type ChatConfig, type ChatHeaderMenuItem, type ChatMarkdownConfig, type ChatMessage, type ChatSender, type ChatState, type ChatThread, type ChatThreadTag, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatUserMenuItem, type ChatUserMenuSection, type ChatV2Props, type CreateVoiceProvider, type FileUploadProgress, type MediaAttachment, type MediaAttachmentKind, type MemoryItem, type MessageAction, type MessageActionEvent, MessageSenderAvatar, type StateCallback, type StreamingUpdate, type ToolCall, type UserCustomField, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceReviewMode, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, defaultChatConfig, getAttachmentKindFromMimeType, getMimeTypeFromDataUrl, mergeConfig, resolveMessageSenderDisplay, useChatUserContext };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,10 @@ var defaultChatConfig = {
|
|
|
25
25
|
inputPlaceholder: "Type your message...",
|
|
26
26
|
sendButton: "Send",
|
|
27
27
|
sendMessageTooltip: "Send message",
|
|
28
|
+
stageMessageTooltip: "Stage message",
|
|
29
|
+
sendNowTooltip: "Send now",
|
|
30
|
+
stagedMessageLabel: "Not sent yet",
|
|
31
|
+
discardStagedMessageTooltip: "Discard",
|
|
28
32
|
newThread: "New Conversation",
|
|
29
33
|
deleteThread: "Delete Conversation",
|
|
30
34
|
copyMessage: "Copy",
|
|
@@ -5285,7 +5289,8 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
5285
5289
|
config?.labels?.attachmentsCount,
|
|
5286
5290
|
"{{count}}/{{max}} attachments",
|
|
5287
5291
|
{ count: staged.attachments.length, max: maxAttachments }
|
|
5288
|
-
) })
|
|
5292
|
+
) }),
|
|
5293
|
+
/* @__PURE__ */ jsx25("div", { className: "text-xs text-muted-foreground", children: config?.labels?.stagedMessageLabel || "Not sent yet" })
|
|
5289
5294
|
] }),
|
|
5290
5295
|
/* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
5291
5296
|
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
@@ -5298,7 +5303,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
5298
5303
|
children: /* @__PURE__ */ jsx25(Send2, { className: "h-4 w-4" })
|
|
5299
5304
|
}
|
|
5300
5305
|
) }),
|
|
5301
|
-
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
5306
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.sendNowTooltip || config?.labels?.sendMessageTooltip })
|
|
5302
5307
|
] }),
|
|
5303
5308
|
/* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
5304
5309
|
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
@@ -5312,7 +5317,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
5312
5317
|
children: /* @__PURE__ */ jsx25(X5, { className: "h-4 w-4" })
|
|
5313
5318
|
}
|
|
5314
5319
|
) }),
|
|
5315
|
-
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.voiceCancel })
|
|
5320
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.discardStagedMessageTooltip || config?.labels?.voiceCancel })
|
|
5316
5321
|
] })
|
|
5317
5322
|
]
|
|
5318
5323
|
},
|
|
@@ -5437,7 +5442,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
5437
5442
|
children: /* @__PURE__ */ jsx25(Send2, { className: "h-4 w-4" })
|
|
5438
5443
|
}
|
|
5439
5444
|
) }),
|
|
5440
|
-
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
5445
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.stageMessageTooltip || config?.labels?.sendMessageTooltip })
|
|
5441
5446
|
] }),
|
|
5442
5447
|
/* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
5443
5448
|
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
@@ -6069,6 +6074,7 @@ var ChatUI = ({
|
|
|
6069
6074
|
isMessagesLoading = false,
|
|
6070
6075
|
isLoadingOlderMessages = false,
|
|
6071
6076
|
hasMoreMessagesBefore = false,
|
|
6077
|
+
activityNotice = null,
|
|
6072
6078
|
callbacks = {},
|
|
6073
6079
|
onLoadOlderMessages,
|
|
6074
6080
|
user,
|
|
@@ -6717,41 +6723,50 @@ var ChatUI = ({
|
|
|
6717
6723
|
] })
|
|
6718
6724
|
}
|
|
6719
6725
|
),
|
|
6720
|
-
/* @__PURE__ */
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6726
|
+
/* @__PURE__ */ jsxs18("div", { className: "-mt-8 bg-gradient-to-t from-background via-background/95 to-transparent px-0 pb-[env(safe-area-inset-bottom)] pt-10", children: [
|
|
6727
|
+
activityNotice && /* @__PURE__ */ jsx28("div", { className: "mx-auto mb-2 w-full max-w-3xl px-3 md:px-2", children: /* @__PURE__ */ jsx28(
|
|
6728
|
+
"div",
|
|
6729
|
+
{
|
|
6730
|
+
className: activityNotice.tone === "error" ? "rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive" : "rounded-md border border-border bg-muted/70 px-3 py-2 text-sm text-muted-foreground",
|
|
6731
|
+
children: activityNotice.message
|
|
6732
|
+
}
|
|
6733
|
+
) }),
|
|
6734
|
+
/* @__PURE__ */ jsx28(
|
|
6735
|
+
ChatInput,
|
|
6736
|
+
{
|
|
6737
|
+
value: inputValue,
|
|
6738
|
+
onChange: (value) => {
|
|
6739
|
+
inputValueRef.current = value;
|
|
6740
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
6741
|
+
initialInputConsumedRef.current = true;
|
|
6742
|
+
onInitialInputConsumed?.();
|
|
6743
|
+
}
|
|
6744
|
+
},
|
|
6745
|
+
onSubmit: handleSendMessage,
|
|
6746
|
+
attachments,
|
|
6747
|
+
onAttachmentsChange: setAttachments,
|
|
6748
|
+
placeholder: config.labels.inputPlaceholder,
|
|
6749
|
+
disabled: false,
|
|
6750
|
+
isGenerating,
|
|
6751
|
+
onStopGeneration: callbacks.onStopGeneration,
|
|
6752
|
+
enableFileUpload: config.features.enableFileUpload,
|
|
6753
|
+
enableAudioRecording: config.features.enableAudioRecording,
|
|
6754
|
+
maxAttachments: config.features.maxAttachments,
|
|
6755
|
+
maxFileSize: config.features.maxFileSize,
|
|
6756
|
+
acceptedFileTypes: config.features.acceptedFileTypes,
|
|
6757
|
+
config,
|
|
6758
|
+
mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
6759
|
+
(a) => participantIds.includes(a.id)
|
|
6760
|
+
) : agentOptions,
|
|
6761
|
+
targetAgentId,
|
|
6762
|
+
showTargetAgentSelector: Boolean(
|
|
6763
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange
|
|
6764
|
+
),
|
|
6765
|
+
targetAgentSelectorPlaceholder: config.agentSelector?.label || "Select agent",
|
|
6766
|
+
onTargetAgentChange
|
|
6767
|
+
}
|
|
6768
|
+
)
|
|
6769
|
+
] })
|
|
6755
6770
|
] }),
|
|
6756
6771
|
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx28(
|
|
6757
6772
|
"div",
|