@copilotz/chat-ui 0.1.31 → 0.1.32
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 +895 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +898 -294
- package/dist/index.js.map +1 -1
- package/dist/styles.css +21 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -25,6 +25,38 @@ type MediaAttachment = {
|
|
|
25
25
|
size?: number;
|
|
26
26
|
poster?: string;
|
|
27
27
|
};
|
|
28
|
+
type AudioAttachment = Extract<MediaAttachment, {
|
|
29
|
+
kind: 'audio';
|
|
30
|
+
}>;
|
|
31
|
+
type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
|
|
32
|
+
type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
|
|
33
|
+
interface VoiceTranscript {
|
|
34
|
+
partial?: string;
|
|
35
|
+
final?: string;
|
|
36
|
+
}
|
|
37
|
+
interface VoiceSegment {
|
|
38
|
+
attachment: AudioAttachment;
|
|
39
|
+
transcript?: VoiceTranscript;
|
|
40
|
+
metadata?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
interface VoiceProviderHandlers {
|
|
43
|
+
onStateChange?: (state: VoiceComposerState) => void;
|
|
44
|
+
onAudioLevelChange?: (level: number) => void;
|
|
45
|
+
onDurationChange?: (durationMs: number) => void;
|
|
46
|
+
onTranscriptChange?: (transcript: VoiceTranscript) => void;
|
|
47
|
+
onSegmentReady?: (segment: VoiceSegment) => void;
|
|
48
|
+
onError?: (error: Error) => void;
|
|
49
|
+
}
|
|
50
|
+
interface VoiceProviderOptions {
|
|
51
|
+
maxRecordingMs?: number;
|
|
52
|
+
}
|
|
53
|
+
interface VoiceProvider {
|
|
54
|
+
start: () => Promise<void>;
|
|
55
|
+
stop: () => Promise<void>;
|
|
56
|
+
cancel: () => Promise<void> | void;
|
|
57
|
+
destroy: () => Promise<void> | void;
|
|
58
|
+
}
|
|
59
|
+
type CreateVoiceProvider = (handlers: VoiceProviderHandlers, options?: VoiceProviderOptions) => VoiceProvider | Promise<VoiceProvider>;
|
|
28
60
|
interface ToolCall {
|
|
29
61
|
id: string;
|
|
30
62
|
name: string;
|
|
@@ -88,6 +120,23 @@ interface ChatConfig {
|
|
|
88
120
|
attachFileTooltip?: string;
|
|
89
121
|
recordAudio?: string;
|
|
90
122
|
recordAudioTooltip?: string;
|
|
123
|
+
voiceEnter?: string;
|
|
124
|
+
voiceExit?: string;
|
|
125
|
+
voiceTitle?: string;
|
|
126
|
+
voicePreparing?: string;
|
|
127
|
+
voiceWaiting?: string;
|
|
128
|
+
voiceListening?: string;
|
|
129
|
+
voiceFinishing?: string;
|
|
130
|
+
voiceReview?: string;
|
|
131
|
+
voiceStart?: string;
|
|
132
|
+
voiceStop?: string;
|
|
133
|
+
voiceSendNow?: string;
|
|
134
|
+
voiceCancel?: string;
|
|
135
|
+
voiceRecordAgain?: string;
|
|
136
|
+
voiceAutoSendIn?: string;
|
|
137
|
+
voiceTranscriptPending?: string;
|
|
138
|
+
voicePermissionDenied?: string;
|
|
139
|
+
voiceCaptureError?: string;
|
|
91
140
|
exportData?: string;
|
|
92
141
|
importData?: string;
|
|
93
142
|
clearAll?: string;
|
|
@@ -147,6 +196,15 @@ interface ChatConfig {
|
|
|
147
196
|
longMessageChunkChars?: number;
|
|
148
197
|
renderUserMarkdown?: boolean;
|
|
149
198
|
};
|
|
199
|
+
voiceCompose?: {
|
|
200
|
+
enabled?: boolean;
|
|
201
|
+
autoSendDelayMs?: number;
|
|
202
|
+
persistComposer?: boolean;
|
|
203
|
+
showTranscriptPreview?: boolean;
|
|
204
|
+
transcriptMode?: VoiceTranscriptMode;
|
|
205
|
+
maxRecordingMs?: number;
|
|
206
|
+
createProvider?: CreateVoiceProvider;
|
|
207
|
+
};
|
|
150
208
|
customComponent?: {
|
|
151
209
|
label?: string;
|
|
152
210
|
icon?: ReactNode;
|
|
@@ -607,4 +665,4 @@ declare const chatUtils: {
|
|
|
607
665
|
generateThreadTitle: (firstMessage: string) => string;
|
|
608
666
|
};
|
|
609
667
|
|
|
610
|
-
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, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
|
|
668
|
+
export { type AgentOption, type AudioAttachment, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, 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, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,38 @@ type MediaAttachment = {
|
|
|
25
25
|
size?: number;
|
|
26
26
|
poster?: string;
|
|
27
27
|
};
|
|
28
|
+
type AudioAttachment = Extract<MediaAttachment, {
|
|
29
|
+
kind: 'audio';
|
|
30
|
+
}>;
|
|
31
|
+
type VoiceComposerState = 'idle' | 'preparing' | 'waiting_for_speech' | 'listening' | 'finishing' | 'review' | 'sending' | 'error';
|
|
32
|
+
type VoiceTranscriptMode = 'none' | 'final-only' | 'partial-and-final';
|
|
33
|
+
interface VoiceTranscript {
|
|
34
|
+
partial?: string;
|
|
35
|
+
final?: string;
|
|
36
|
+
}
|
|
37
|
+
interface VoiceSegment {
|
|
38
|
+
attachment: AudioAttachment;
|
|
39
|
+
transcript?: VoiceTranscript;
|
|
40
|
+
metadata?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
interface VoiceProviderHandlers {
|
|
43
|
+
onStateChange?: (state: VoiceComposerState) => void;
|
|
44
|
+
onAudioLevelChange?: (level: number) => void;
|
|
45
|
+
onDurationChange?: (durationMs: number) => void;
|
|
46
|
+
onTranscriptChange?: (transcript: VoiceTranscript) => void;
|
|
47
|
+
onSegmentReady?: (segment: VoiceSegment) => void;
|
|
48
|
+
onError?: (error: Error) => void;
|
|
49
|
+
}
|
|
50
|
+
interface VoiceProviderOptions {
|
|
51
|
+
maxRecordingMs?: number;
|
|
52
|
+
}
|
|
53
|
+
interface VoiceProvider {
|
|
54
|
+
start: () => Promise<void>;
|
|
55
|
+
stop: () => Promise<void>;
|
|
56
|
+
cancel: () => Promise<void> | void;
|
|
57
|
+
destroy: () => Promise<void> | void;
|
|
58
|
+
}
|
|
59
|
+
type CreateVoiceProvider = (handlers: VoiceProviderHandlers, options?: VoiceProviderOptions) => VoiceProvider | Promise<VoiceProvider>;
|
|
28
60
|
interface ToolCall {
|
|
29
61
|
id: string;
|
|
30
62
|
name: string;
|
|
@@ -88,6 +120,23 @@ interface ChatConfig {
|
|
|
88
120
|
attachFileTooltip?: string;
|
|
89
121
|
recordAudio?: string;
|
|
90
122
|
recordAudioTooltip?: string;
|
|
123
|
+
voiceEnter?: string;
|
|
124
|
+
voiceExit?: string;
|
|
125
|
+
voiceTitle?: string;
|
|
126
|
+
voicePreparing?: string;
|
|
127
|
+
voiceWaiting?: string;
|
|
128
|
+
voiceListening?: string;
|
|
129
|
+
voiceFinishing?: string;
|
|
130
|
+
voiceReview?: string;
|
|
131
|
+
voiceStart?: string;
|
|
132
|
+
voiceStop?: string;
|
|
133
|
+
voiceSendNow?: string;
|
|
134
|
+
voiceCancel?: string;
|
|
135
|
+
voiceRecordAgain?: string;
|
|
136
|
+
voiceAutoSendIn?: string;
|
|
137
|
+
voiceTranscriptPending?: string;
|
|
138
|
+
voicePermissionDenied?: string;
|
|
139
|
+
voiceCaptureError?: string;
|
|
91
140
|
exportData?: string;
|
|
92
141
|
importData?: string;
|
|
93
142
|
clearAll?: string;
|
|
@@ -147,6 +196,15 @@ interface ChatConfig {
|
|
|
147
196
|
longMessageChunkChars?: number;
|
|
148
197
|
renderUserMarkdown?: boolean;
|
|
149
198
|
};
|
|
199
|
+
voiceCompose?: {
|
|
200
|
+
enabled?: boolean;
|
|
201
|
+
autoSendDelayMs?: number;
|
|
202
|
+
persistComposer?: boolean;
|
|
203
|
+
showTranscriptPreview?: boolean;
|
|
204
|
+
transcriptMode?: VoiceTranscriptMode;
|
|
205
|
+
maxRecordingMs?: number;
|
|
206
|
+
createProvider?: CreateVoiceProvider;
|
|
207
|
+
};
|
|
150
208
|
customComponent?: {
|
|
151
209
|
label?: string;
|
|
152
210
|
icon?: ReactNode;
|
|
@@ -607,4 +665,4 @@ declare const chatUtils: {
|
|
|
607
665
|
generateThreadTitle: (firstMessage: string) => string;
|
|
608
666
|
};
|
|
609
667
|
|
|
610
|
-
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, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
|
|
668
|
+
export { type AgentOption, type AudioAttachment, type ChatCallbacks, type ChatConfig, ChatHeader, type ChatHeaderConfig, type ChatHeaderProps, ChatInput, type ChatMessage, type ChatState, type ChatThread, ChatUI, type ChatUserContext, ChatUserContextProvider, type ChatV2Props, type CreateVoiceProvider, 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, type VoiceComposerState, type VoiceProvider, type VoiceProviderHandlers, type VoiceProviderOptions, type VoiceSegment, type VoiceTranscript, type VoiceTranscriptMode, chatConfigPresets, chatUtils, cn, configUtils, createObjectUrlFromDataUrl, defaultChatConfig, featureFlags, formatDate, mergeConfig, themeUtils, useChatUserContext, validateConfig };
|