@cagent/chat-embedding-core 0.0.1
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/.env.example +34 -0
- package/.eslintrc.cjs +15 -0
- package/.idea/flowise-chatbox.iml +10 -0
- package/.idea/modules.xml +8 -0
- package/.idea/workspace.xml +4 -0
- package/.prettierignore +3 -0
- package/.prettierrc +8 -0
- package/AGENTS.md +184 -0
- package/README.md +213 -0
- package/base.json +21 -0
- package/dist/api/chatRoom.d.ts +84 -0
- package/dist/assets/notificationSounds.d.ts +2 -0
- package/dist/components/Badge.d.ts +9 -0
- package/dist/components/Bot.d.ts +132 -0
- package/dist/components/FeedbackContentDialog.d.ts +12 -0
- package/dist/components/RoomReconnectAlert.d.ts +13 -0
- package/dist/components/Toast.d.ts +9 -0
- package/dist/components/TypingBubble.d.ts +1 -0
- package/dist/components/avatars/Avatar.d.ts +3 -0
- package/dist/components/avatars/DefaultAvatar.d.ts +1 -0
- package/dist/components/bubbles/AgentReasoningBubble.d.ts +15 -0
- package/dist/components/bubbles/BotBubble.d.ts +39 -0
- package/dist/components/bubbles/ChartBubble.d.ts +72 -0
- package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts +7 -0
- package/dist/components/bubbles/ChartPlaceholder.d.ts +19 -0
- package/dist/components/bubbles/ChartPopupModal.d.ts +3 -0
- package/dist/components/bubbles/FollowUpPromptBubble.d.ts +7 -0
- package/dist/components/bubbles/GuestBubble.d.ts +15 -0
- package/dist/components/bubbles/LeadCaptureBubble.d.ts +19 -0
- package/dist/components/bubbles/LoadingBubble.d.ts +7 -0
- package/dist/components/bubbles/SourceBubble.d.ts +8 -0
- package/dist/components/bubbles/StableChartWrapper.d.ts +17 -0
- package/dist/components/bubbles/StarterPromptBubble.d.ts +7 -0
- package/dist/components/buttons/AttachmentUploadButton.d.ts +10 -0
- package/dist/components/buttons/CancelButton.d.ts +9 -0
- package/dist/components/buttons/CopyMessageButton.d.ts +9 -0
- package/dist/components/buttons/EditMessageButton.d.ts +7 -0
- package/dist/components/buttons/FeedbackButtons.d.ts +13 -0
- package/dist/components/buttons/ImageUploadButton.d.ts +10 -0
- package/dist/components/buttons/LeadCaptureButtons.d.ts +10 -0
- package/dist/components/buttons/PopupToast.d.ts +6 -0
- package/dist/components/buttons/RecordAudioButton.d.ts +10 -0
- package/dist/components/buttons/SendButton.d.ts +12 -0
- package/dist/components/dialogs/EditMessageDialog.d.ts +8 -0
- package/dist/components/icons/AddImageIcon.d.ts +2 -0
- package/dist/components/icons/AttachmentIcon.d.ts +2 -0
- package/dist/components/icons/CheckIcon.d.ts +2 -0
- package/dist/components/icons/CircleDotIcon.d.ts +2 -0
- package/dist/components/icons/ClipboardIcon.d.ts +2 -0
- package/dist/components/icons/CopyIcon.d.ts +4 -0
- package/dist/components/icons/DeleteIcon.d.ts +2 -0
- package/dist/components/icons/EditIcon.d.ts +4 -0
- package/dist/components/icons/FullScreenIcon.d.ts +2 -0
- package/dist/components/icons/RecordIcon.d.ts +2 -0
- package/dist/components/icons/ResetZoomIcon.d.ts +2 -0
- package/dist/components/icons/SendIcon.d.ts +2 -0
- package/dist/components/icons/SparklesIcon.d.ts +2 -0
- package/dist/components/icons/StopIcon.d.ts +2 -0
- package/dist/components/icons/ThumbsDownIcon.d.ts +4 -0
- package/dist/components/icons/ThumbsUpIcon.d.ts +4 -0
- package/dist/components/icons/TickIcon.d.ts +1 -0
- package/dist/components/icons/TrashIcon.d.ts +2 -0
- package/dist/components/icons/XIcon.d.ts +4 -0
- package/dist/components/icons/ZoomInIcon.d.ts +2 -0
- package/dist/components/icons/ZoomOutIcon.d.ts +2 -0
- package/dist/components/icons/index.d.ts +21 -0
- package/dist/components/image/PreviewImage.d.ts +4 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/inputs/textInput/components/FilePreview.d.ts +11 -0
- package/dist/components/inputs/textInput/components/ShortTextInput.d.ts +13 -0
- package/dist/components/inputs/textInput/components/TextInput.d.ts +50 -0
- package/dist/components/inputs/textInput/index.d.ts +2 -0
- package/dist/constants.d.ts +2 -0
- package/dist/features/bubble/components/Bubble.d.ts +4 -0
- package/dist/features/bubble/components/BubbleButton.d.ts +15 -0
- package/dist/features/bubble/components/Tooltip.d.ts +14 -0
- package/dist/features/bubble/components/index.d.ts +1 -0
- package/dist/features/bubble/index.d.ts +1 -0
- package/dist/features/bubble/types.d.ts +108 -0
- package/dist/features/full/components/Full.d.ts +6 -0
- package/dist/features/full/components/index.d.ts +1 -0
- package/dist/features/full/index.d.ts +1 -0
- package/dist/features/popup/components/DisclaimerPopup.d.ts +13 -0
- package/dist/features/popup/components/Popup.d.ts +8 -0
- package/dist/features/popup/components/index.d.ts +2 -0
- package/dist/features/popup/index.d.ts +1 -0
- package/dist/features/popup/types.d.ts +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/queries/sendMessageQuery.d.ts +165 -0
- package/dist/register.d.ts +1 -0
- package/dist/store/constant.d.ts +42 -0
- package/dist/types/chart.d.ts +85 -0
- package/dist/utils/audioRecording.d.ts +20 -0
- package/dist/utils/chartInstanceManager.d.ts +42 -0
- package/dist/utils/chartTagParser.d.ts +38 -0
- package/dist/utils/chatInputHistory.d.ts +21 -0
- package/dist/utils/chatStreamHelper.d.ts +18 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/isMobileSignal.d.ts +1 -0
- package/dist/utils/transcriptApi.d.ts +7 -0
- package/dist/utils/ultimateJsonParser.d.ts +1 -0
- package/dist/web.d.ts +34 -0
- package/dist/web.js +1 -0
- package/dist/window.d.ts +35 -0
- package/docs/chart-rendering-implementation-plan.md +565 -0
- package/images/ChatEmbed.gif +0 -0
- package/images/proxyserver.png +0 -0
- package/package.json +87 -0
- package/public/index.html +43 -0
- package/server.js +477 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './ClipboardIcon';
|
|
2
|
+
export * from './ThumbsDownIcon';
|
|
3
|
+
export * from './ThumbsUpIcon';
|
|
4
|
+
export * from './AddImageIcon';
|
|
5
|
+
export * from './CircleDotIcon';
|
|
6
|
+
export * from './DeleteIcon';
|
|
7
|
+
export * from './RecordIcon';
|
|
8
|
+
export * from './SendIcon';
|
|
9
|
+
export * from './TrashIcon';
|
|
10
|
+
export * from './XIcon';
|
|
11
|
+
export * from './TickIcon';
|
|
12
|
+
export * from './AttachmentIcon';
|
|
13
|
+
export * from './SparklesIcon';
|
|
14
|
+
export * from './FullScreenIcon';
|
|
15
|
+
export * from './EditIcon';
|
|
16
|
+
export * from './CopyIcon';
|
|
17
|
+
export * from './CheckIcon';
|
|
18
|
+
export * from './ZoomInIcon';
|
|
19
|
+
export * from './ZoomOutIcon';
|
|
20
|
+
export * from './ResetZoomIcon';
|
|
21
|
+
export * from './StopIcon';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type CardWithDeleteOverlayProps = {
|
|
2
|
+
item: {
|
|
3
|
+
name: string;
|
|
4
|
+
};
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onDelete: (item: {
|
|
7
|
+
name: string;
|
|
8
|
+
}) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const FilePreview: (props: CardWithDeleteOverlayProps) => import("solid-js").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JSX } from 'solid-js/jsx-runtime';
|
|
2
|
+
type ShortTextInputProps = {
|
|
3
|
+
ref: HTMLInputElement | HTMLTextAreaElement | undefined;
|
|
4
|
+
onInput: (value: string) => void;
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isWelcomeScreen?: boolean;
|
|
8
|
+
onFocus?: () => void;
|
|
9
|
+
onBlur?: () => void;
|
|
10
|
+
onPaste?: (event: any) => void;
|
|
11
|
+
} & Omit<JSX.TextareaHTMLAttributes<HTMLTextAreaElement>, 'onInput'>;
|
|
12
|
+
export declare const ShortTextInput: (props: ShortTextInputProps) => JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Setter } from 'solid-js';
|
|
2
|
+
import { FileEvent, IAction, UploadsConfig } from '@/components/Bot';
|
|
3
|
+
type FilePreviewData = string | ArrayBuffer;
|
|
4
|
+
type FilePreview = {
|
|
5
|
+
data: FilePreviewData;
|
|
6
|
+
mime: string;
|
|
7
|
+
name: string;
|
|
8
|
+
preview: string;
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
type TextInputProps = {
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
textColor?: string;
|
|
15
|
+
sendButtonColor?: string;
|
|
16
|
+
inputValue: string;
|
|
17
|
+
fontSize?: number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onSubmit: (value: string, action?: IAction | undefined | null, faqId?: string) => void;
|
|
20
|
+
onInputChange: (value: string) => void;
|
|
21
|
+
uploadsConfig?: Partial<UploadsConfig>;
|
|
22
|
+
isFullFileUpload?: boolean;
|
|
23
|
+
setPreviews: Setter<FilePreview[]>;
|
|
24
|
+
onMicrophoneClicked: () => void;
|
|
25
|
+
handleFileChange: (event: FileEvent<HTMLInputElement>) => void;
|
|
26
|
+
maxChars?: number;
|
|
27
|
+
maxCharsWarningMessage?: string;
|
|
28
|
+
autoFocus?: boolean;
|
|
29
|
+
sendMessageSound?: boolean;
|
|
30
|
+
sendSoundLocation?: string;
|
|
31
|
+
enableInputHistory?: boolean;
|
|
32
|
+
maxHistorySize?: number;
|
|
33
|
+
isLoading?: boolean;
|
|
34
|
+
apiHost?: string;
|
|
35
|
+
chatflowid: string;
|
|
36
|
+
isUseFAQ?: boolean;
|
|
37
|
+
setDisableInput: Setter<boolean>;
|
|
38
|
+
isWelcomeScreen?: boolean;
|
|
39
|
+
onFocus?: () => void;
|
|
40
|
+
onBlur?: () => void;
|
|
41
|
+
uploadedFiles: {
|
|
42
|
+
file: File;
|
|
43
|
+
type: string;
|
|
44
|
+
}[];
|
|
45
|
+
isGenerating?: boolean;
|
|
46
|
+
isStopping?: boolean;
|
|
47
|
+
onStopClick?: () => void;
|
|
48
|
+
};
|
|
49
|
+
export declare const TextInput: (props: TextInputProps) => import("solid-js").JSX.Element;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonTheme } from '../types';
|
|
2
|
+
type Props = ButtonTheme & {
|
|
3
|
+
isBotOpened: boolean;
|
|
4
|
+
toggleBot: () => void;
|
|
5
|
+
setButtonPosition: (position: {
|
|
6
|
+
bottom: number;
|
|
7
|
+
right: number;
|
|
8
|
+
}) => void;
|
|
9
|
+
dragAndDrop: boolean;
|
|
10
|
+
autoOpen?: boolean;
|
|
11
|
+
openDelay?: number;
|
|
12
|
+
autoOpenOnMobile?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const BubbleButton: (props: Props) => import("solid-js").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type TooltipProps = {
|
|
2
|
+
showTooltip: boolean;
|
|
3
|
+
position: {
|
|
4
|
+
bottom: number;
|
|
5
|
+
right: number;
|
|
6
|
+
};
|
|
7
|
+
buttonSize: number;
|
|
8
|
+
tooltipMessage?: string;
|
|
9
|
+
tooltipBackgroundColor?: string;
|
|
10
|
+
tooltipTextColor?: string;
|
|
11
|
+
tooltipFontSize?: number;
|
|
12
|
+
};
|
|
13
|
+
declare const Tooltip: (props: TooltipProps) => import("solid-js").JSX.Element;
|
|
14
|
+
export default Tooltip;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Bubble';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export type BubbleParams = {
|
|
2
|
+
theme?: BubbleTheme;
|
|
3
|
+
};
|
|
4
|
+
export type BubbleTheme = {
|
|
5
|
+
chatWindow?: ChatWindowTheme;
|
|
6
|
+
button?: ButtonTheme;
|
|
7
|
+
tooltip?: ToolTipTheme;
|
|
8
|
+
disclaimer?: DisclaimerPopUpTheme;
|
|
9
|
+
customCSS?: string;
|
|
10
|
+
};
|
|
11
|
+
export type TextInputTheme = {
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
textColor?: string;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
sendButtonColor?: string;
|
|
16
|
+
maxChars?: number;
|
|
17
|
+
maxCharsWarningMessage?: string;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
sendMessageSound?: boolean;
|
|
20
|
+
sendSoundLocation?: string;
|
|
21
|
+
receiveMessageSound?: boolean;
|
|
22
|
+
receiveSoundLocation?: string;
|
|
23
|
+
};
|
|
24
|
+
export type UserMessageTheme = {
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
textColor?: string;
|
|
27
|
+
showAvatar?: boolean;
|
|
28
|
+
avatarSrc?: string;
|
|
29
|
+
};
|
|
30
|
+
export type BotMessageTheme = {
|
|
31
|
+
backgroundColor?: string;
|
|
32
|
+
textColor?: string;
|
|
33
|
+
showAvatar?: boolean;
|
|
34
|
+
avatarSrc?: string;
|
|
35
|
+
};
|
|
36
|
+
export type FooterTheme = {
|
|
37
|
+
showFooter?: boolean;
|
|
38
|
+
textColor?: string;
|
|
39
|
+
text?: string;
|
|
40
|
+
company?: string;
|
|
41
|
+
companyLink?: string;
|
|
42
|
+
};
|
|
43
|
+
export type FeedbackTheme = {
|
|
44
|
+
color?: string;
|
|
45
|
+
};
|
|
46
|
+
export type ChatWindowTheme = {
|
|
47
|
+
showTitle?: boolean;
|
|
48
|
+
showAgentMessages?: boolean;
|
|
49
|
+
title?: string;
|
|
50
|
+
titleAvatarSrc?: string;
|
|
51
|
+
welcomeMessage?: string;
|
|
52
|
+
secondMessage?: string;
|
|
53
|
+
errorMessage?: string;
|
|
54
|
+
backgroundColor?: string;
|
|
55
|
+
backgroundImage?: string;
|
|
56
|
+
height?: number;
|
|
57
|
+
width?: number;
|
|
58
|
+
fontSize?: number;
|
|
59
|
+
userMessage?: UserMessageTheme;
|
|
60
|
+
botMessage?: BotMessageTheme;
|
|
61
|
+
textInput?: TextInputTheme;
|
|
62
|
+
feedback?: FeedbackTheme;
|
|
63
|
+
footer?: FooterTheme;
|
|
64
|
+
sourceDocsTitle?: string;
|
|
65
|
+
poweredByTextColor?: string;
|
|
66
|
+
starterPrompts?: string[];
|
|
67
|
+
starterPromptFontSize?: number;
|
|
68
|
+
clearChatOnReload?: boolean;
|
|
69
|
+
dateTimeToggle?: DateTimeToggleTheme;
|
|
70
|
+
renderHTML?: boolean;
|
|
71
|
+
showResponseTime?: boolean;
|
|
72
|
+
};
|
|
73
|
+
export type ButtonTheme = {
|
|
74
|
+
size?: 'small' | 'medium' | 'large' | number;
|
|
75
|
+
backgroundColor?: string;
|
|
76
|
+
iconColor?: string;
|
|
77
|
+
customIconSrc?: string;
|
|
78
|
+
bottom?: number;
|
|
79
|
+
right?: number;
|
|
80
|
+
dragAndDrop?: boolean;
|
|
81
|
+
autoWindowOpen?: autoWindowOpenTheme;
|
|
82
|
+
};
|
|
83
|
+
export type ToolTipTheme = {
|
|
84
|
+
showTooltip?: boolean;
|
|
85
|
+
tooltipMessage?: string;
|
|
86
|
+
tooltipBackgroundColor?: string;
|
|
87
|
+
tooltipTextColor?: string;
|
|
88
|
+
tooltipFontSize?: number;
|
|
89
|
+
};
|
|
90
|
+
export type autoWindowOpenTheme = {
|
|
91
|
+
autoOpen?: boolean;
|
|
92
|
+
openDelay?: number;
|
|
93
|
+
autoOpenOnMobile?: boolean;
|
|
94
|
+
};
|
|
95
|
+
export type DisclaimerPopUpTheme = {
|
|
96
|
+
title?: string;
|
|
97
|
+
message?: string;
|
|
98
|
+
textColor?: string;
|
|
99
|
+
buttonColor?: string;
|
|
100
|
+
buttonTextColor?: string;
|
|
101
|
+
buttonText?: string;
|
|
102
|
+
blurredBackgroundColor?: string;
|
|
103
|
+
backgroundColor?: string;
|
|
104
|
+
};
|
|
105
|
+
export type DateTimeToggleTheme = {
|
|
106
|
+
date?: boolean;
|
|
107
|
+
time?: boolean;
|
|
108
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BotProps } from '@/components/Bot';
|
|
2
|
+
import { BubbleParams } from '@/features/bubble/types';
|
|
3
|
+
export type FullProps = BotProps & BubbleParams;
|
|
4
|
+
export declare const Full: (props: FullProps, { element }: {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
}) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Full';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type DisclaimerPopupProps = {
|
|
2
|
+
isOpen?: boolean;
|
|
3
|
+
onAccept?: () => void;
|
|
4
|
+
title?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
buttonText?: string;
|
|
7
|
+
blurredBackgroundColor?: string;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
buttonColor?: string;
|
|
10
|
+
textColor?: string;
|
|
11
|
+
buttonTextColor?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const DisclaimerPopup: (props: DisclaimerPopupProps) => import("solid-js").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { FileUpload, IAction } from '@/components/Bot';
|
|
2
|
+
export type IncomingInput = {
|
|
3
|
+
question: string;
|
|
4
|
+
uploads?: FileUpload[];
|
|
5
|
+
overrideConfig?: Record<string, unknown>;
|
|
6
|
+
socketIOClientId?: string;
|
|
7
|
+
chatId?: string;
|
|
8
|
+
fileName?: string;
|
|
9
|
+
leadEmail?: string;
|
|
10
|
+
action?: IAction;
|
|
11
|
+
stored?: Record<string, any>;
|
|
12
|
+
fetch?: boolean;
|
|
13
|
+
faqId?: string;
|
|
14
|
+
useId?: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
};
|
|
17
|
+
type BaseRequest = {
|
|
18
|
+
apiHost?: string;
|
|
19
|
+
onRequest?: (request: RequestInit) => Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export type MessageRequest = BaseRequest & {
|
|
22
|
+
chatflowid?: string;
|
|
23
|
+
body?: IncomingInput;
|
|
24
|
+
};
|
|
25
|
+
export type FeedbackRatingType = 'THUMBS_UP' | 'THUMBS_DOWN';
|
|
26
|
+
export type FeedbackInput = {
|
|
27
|
+
chatId: string;
|
|
28
|
+
messageId: string;
|
|
29
|
+
rating: any;
|
|
30
|
+
content?: string;
|
|
31
|
+
};
|
|
32
|
+
export type CreateFeedbackRequest = BaseRequest & {
|
|
33
|
+
chatflowid?: string;
|
|
34
|
+
body?: FeedbackInput;
|
|
35
|
+
};
|
|
36
|
+
export type UpdateFeedbackRequest = BaseRequest & {
|
|
37
|
+
id: string;
|
|
38
|
+
body?: Partial<FeedbackInput>;
|
|
39
|
+
};
|
|
40
|
+
export type UpsertRequest = BaseRequest & {
|
|
41
|
+
chatflowid: string;
|
|
42
|
+
apiHost?: string;
|
|
43
|
+
formData: FormData;
|
|
44
|
+
};
|
|
45
|
+
export type LeadCaptureInput = {
|
|
46
|
+
chatflowid: string;
|
|
47
|
+
chatId: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
email?: string;
|
|
50
|
+
phone?: string;
|
|
51
|
+
};
|
|
52
|
+
export type GetFeedbackByMessageIdRequest = BaseRequest & {
|
|
53
|
+
messageId: string;
|
|
54
|
+
};
|
|
55
|
+
export type LeadCaptureRequest = BaseRequest & {
|
|
56
|
+
body: Partial<LeadCaptureInput>;
|
|
57
|
+
};
|
|
58
|
+
export declare const getUserFromLocalStorage: () => {
|
|
59
|
+
accessToken: string | null;
|
|
60
|
+
username: string | null;
|
|
61
|
+
id: string | null;
|
|
62
|
+
};
|
|
63
|
+
export declare const sendFeedbackQuery: ({ chatflowid, apiHost, body, onRequest }: CreateFeedbackRequest) => Promise<{
|
|
64
|
+
data?: unknown;
|
|
65
|
+
error?: Error | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export declare const getFeedbackByMessageId: ({ messageId, apiHost, onRequest }: GetFeedbackByMessageIdRequest) => Promise<{
|
|
68
|
+
data?: unknown;
|
|
69
|
+
error?: Error | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const updateFeedbackQuery: ({ id, apiHost, body, onRequest }: UpdateFeedbackRequest) => Promise<{
|
|
72
|
+
data?: unknown;
|
|
73
|
+
error?: Error | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
export declare const sendMessageQuery: ({ chatflowid, apiHost, body, onRequest }: MessageRequest) => Promise<{
|
|
76
|
+
data?: any;
|
|
77
|
+
error?: Error | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export declare const createAttachmentWithFormData: ({ chatflowid, apiHost, formData, onRequest }: UpsertRequest) => Promise<{
|
|
80
|
+
data?: unknown;
|
|
81
|
+
error?: Error | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const upsertVectorStoreWithFormData: ({ chatflowid, apiHost, formData, onRequest }: UpsertRequest) => Promise<{
|
|
84
|
+
data?: unknown;
|
|
85
|
+
error?: Error | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
export declare const getChatbotConfig: ({ chatflowid, apiHost, onRequest }: MessageRequest) => Promise<{
|
|
88
|
+
data?: any;
|
|
89
|
+
error?: Error | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const getMessageById: ({ chatflowid, apiHost, messageId }: BaseRequest & {
|
|
92
|
+
chatflowid?: string | undefined;
|
|
93
|
+
body?: IncomingInput | undefined;
|
|
94
|
+
} & {
|
|
95
|
+
messageId: string;
|
|
96
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
97
|
+
export declare const updateMessage: ({ apiHost, body, onRequest }: MessageRequest) => Promise<{
|
|
98
|
+
data?: any;
|
|
99
|
+
error?: Error | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export declare const isStreamAvailableQuery: ({ chatflowid, apiHost, onRequest }: MessageRequest) => Promise<{
|
|
102
|
+
data?: any;
|
|
103
|
+
error?: Error | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
export type AbortChatMessageRequest = BaseRequest & {
|
|
106
|
+
chatflowid: string;
|
|
107
|
+
chatId: string;
|
|
108
|
+
};
|
|
109
|
+
export declare const abortChatMessage: ({ chatflowid, chatId, apiHost, onRequest }: AbortChatMessageRequest) => Promise<{
|
|
110
|
+
data?: any;
|
|
111
|
+
error?: Error | undefined;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const sendFileDownloadQuery: ({ apiHost, body, onRequest }: MessageRequest) => Promise<{
|
|
114
|
+
data?: any;
|
|
115
|
+
error?: Error | undefined;
|
|
116
|
+
}>;
|
|
117
|
+
export declare const popDataFromCache: ({ apiHost, key, onRequest, }: {
|
|
118
|
+
apiHost?: string | undefined;
|
|
119
|
+
key: string;
|
|
120
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
121
|
+
}) => Promise<{
|
|
122
|
+
data?: any;
|
|
123
|
+
error?: Error | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
export declare const addLeadQuery: ({ apiHost, body, onRequest }: LeadCaptureRequest) => Promise<{
|
|
126
|
+
data?: any;
|
|
127
|
+
error?: Error | undefined;
|
|
128
|
+
}>;
|
|
129
|
+
export declare const searchFaqsQuery: ({ chatflowid, apiHost, query, onRequest, }: {
|
|
130
|
+
chatflowid?: string | undefined;
|
|
131
|
+
apiHost?: string | undefined;
|
|
132
|
+
query: string;
|
|
133
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
134
|
+
}) => Promise<{
|
|
135
|
+
data?: any;
|
|
136
|
+
error?: Error | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
export declare const vectorSearchFaqsQuery: ({ chatflowid, apiHost, query, onRequest, }: {
|
|
139
|
+
chatflowid: string;
|
|
140
|
+
apiHost?: string | undefined;
|
|
141
|
+
query: string;
|
|
142
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
143
|
+
}) => Promise<{
|
|
144
|
+
data?: any;
|
|
145
|
+
error?: Error | undefined;
|
|
146
|
+
}>;
|
|
147
|
+
export declare const getFileContent: ({ apiHost, path, onRequest, }: {
|
|
148
|
+
apiHost?: string | undefined;
|
|
149
|
+
path: string;
|
|
150
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
151
|
+
}) => Promise<{
|
|
152
|
+
data?: any;
|
|
153
|
+
error?: Error | undefined;
|
|
154
|
+
}>;
|
|
155
|
+
export declare const sendEmailQuery: ({ apiHost, body, onRequest, }: {
|
|
156
|
+
apiHost?: string | undefined;
|
|
157
|
+
body: {
|
|
158
|
+
fileUrls: string[];
|
|
159
|
+
};
|
|
160
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
161
|
+
}) => Promise<{
|
|
162
|
+
data?: any;
|
|
163
|
+
error?: Error;
|
|
164
|
+
}>;
|
|
165
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const registerWebComponents: () => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for chat room and socket connection
|
|
3
|
+
* Used for human advisor/support feature integration
|
|
4
|
+
*/
|
|
5
|
+
export declare const SOCKET_PATH = "/socket.io";
|
|
6
|
+
export declare const ROOM_STATUS: {
|
|
7
|
+
readonly WAITING: "waiting";
|
|
8
|
+
readonly ACTIVE: "active";
|
|
9
|
+
readonly CLOSED: "closed";
|
|
10
|
+
};
|
|
11
|
+
export type RoomStatus = (typeof ROOM_STATUS)[keyof typeof ROOM_STATUS];
|
|
12
|
+
export declare const SENDER_TYPE: {
|
|
13
|
+
readonly USER: "user";
|
|
14
|
+
readonly AGENT: "agent";
|
|
15
|
+
readonly HUMAN: "human";
|
|
16
|
+
readonly SYSTEM: "system";
|
|
17
|
+
};
|
|
18
|
+
export type SenderType = (typeof SENDER_TYPE)[keyof typeof SENDER_TYPE];
|
|
19
|
+
export declare const SOCKET_EVENTS: {
|
|
20
|
+
readonly CONNECT: "connect";
|
|
21
|
+
readonly DISCONNECT: "disconnect";
|
|
22
|
+
readonly CONNECT_ERROR: "connect_error";
|
|
23
|
+
readonly JOIN_ROOM: "join_room";
|
|
24
|
+
readonly LEAVE_ROOM: "leave_room";
|
|
25
|
+
readonly ROOM_JOINED: "room_joined";
|
|
26
|
+
readonly ROOM_CLOSED: "room_closed";
|
|
27
|
+
readonly SEND_MESSAGE: "send_message";
|
|
28
|
+
readonly NEW_MESSAGE: "new_message";
|
|
29
|
+
readonly REQUEST_HUMAN: "request_human";
|
|
30
|
+
readonly HUMAN_JOINED: "human_joined";
|
|
31
|
+
readonly HUMAN_LEFT: "human_left";
|
|
32
|
+
readonly HUMAN_TYPING: "human_typing";
|
|
33
|
+
};
|
|
34
|
+
export declare const API_ENDPOINTS: {
|
|
35
|
+
readonly CREATE_ROOM: "/api/v1/chatroom/create";
|
|
36
|
+
readonly JOIN_ROOM: "/api/v1/chatroom/join";
|
|
37
|
+
readonly LEAVE_ROOM: "/api/v1/chatroom/leave";
|
|
38
|
+
readonly CLOSE_ROOM: "/api/v1/chatroom/close";
|
|
39
|
+
readonly GET_ROOM_STATUS: "/api/v1/chatroom/status";
|
|
40
|
+
readonly GET_MESSAGES: "/api/v1/chatroom/messages";
|
|
41
|
+
readonly REQUEST_HUMAN: "/api/v1/chatroom/request-human";
|
|
42
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ChartData, ChartOptions, ChartType } from 'chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* Supported chart types for the XML tag parser
|
|
4
|
+
*/
|
|
5
|
+
export type SupportedChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter';
|
|
6
|
+
/**
|
|
7
|
+
* Chart configuration parsed from XML tag
|
|
8
|
+
*/
|
|
9
|
+
export interface ChartConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
type: SupportedChartType;
|
|
12
|
+
title?: string;
|
|
13
|
+
unit?: string;
|
|
14
|
+
data: ChartData<ChartType>;
|
|
15
|
+
options?: ChartOptions<ChartType>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result from processing a token through the chart parser
|
|
19
|
+
*/
|
|
20
|
+
export interface ChartParseResult {
|
|
21
|
+
/** Regular text content to render (non-chart content) */
|
|
22
|
+
textContent: string;
|
|
23
|
+
/** IDs of chart placeholders that were added */
|
|
24
|
+
chartPlaceholders: string[];
|
|
25
|
+
/** Fully parsed chart configurations ready to render */
|
|
26
|
+
completedCharts: ChartConfig[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parser state machine states
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ChartParserState {
|
|
32
|
+
/** Normal text parsing mode */
|
|
33
|
+
IDLE = "IDLE",
|
|
34
|
+
/** Detected potential opening tag, buffering */
|
|
35
|
+
OPENING_TAG = "OPENING_TAG",
|
|
36
|
+
/** Inside chart tag, buffering JSON content */
|
|
37
|
+
INSIDE_TAG = "INSIDE_TAG",
|
|
38
|
+
/** Detected potential closing tag */
|
|
39
|
+
CLOSING_TAG = "CLOSING_TAG"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Chart tag attributes extracted from opening tag
|
|
43
|
+
*/
|
|
44
|
+
export interface ChartTagAttributes {
|
|
45
|
+
type: SupportedChartType;
|
|
46
|
+
title?: string;
|
|
47
|
+
unit?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Partial chart config for pending charts (streaming)
|
|
51
|
+
*/
|
|
52
|
+
export interface PendingChart {
|
|
53
|
+
id: string;
|
|
54
|
+
attributes?: ChartTagAttributes;
|
|
55
|
+
buffer?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Props for ChartBubble component
|
|
59
|
+
*/
|
|
60
|
+
export interface ChartBubbleProps {
|
|
61
|
+
config: ChartConfig;
|
|
62
|
+
backgroundColor?: string;
|
|
63
|
+
textColor?: string;
|
|
64
|
+
/** Enable zoom/pan interactivity (used in popup modal) */
|
|
65
|
+
enableZoom?: boolean;
|
|
66
|
+
/** Callback to open chart in fullscreen popup */
|
|
67
|
+
onOpenFullscreen?: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Props for ChartLoadingPlaceholder component
|
|
71
|
+
*/
|
|
72
|
+
export interface ChartLoadingPlaceholderProps {
|
|
73
|
+
chartId: string;
|
|
74
|
+
backgroundColor?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Props for ChartPopupModal component
|
|
78
|
+
*/
|
|
79
|
+
export interface ChartPopupModalProps {
|
|
80
|
+
isOpen: boolean;
|
|
81
|
+
config: ChartConfig;
|
|
82
|
+
onClose: () => void;
|
|
83
|
+
backgroundColor?: string;
|
|
84
|
+
textColor?: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function getElaspedTime(): string;
|
|
2
|
+
/** Starts the audio recording*/
|
|
3
|
+
export declare function startAudioRecording(onRecordingStart: (value: boolean) => void, onUnsupportedBrowser: (value: boolean) => void, setElapsedTime: (value: string) => void): void;
|
|
4
|
+
/** Stop the currently started audio recording & sends it
|
|
5
|
+
*/
|
|
6
|
+
export declare function stopAudioRecording(addRecordingToPreviews: null | ((blob: Blob) => void)): void;
|
|
7
|
+
/** Cancel the currently started audio recording */
|
|
8
|
+
export declare function cancelAudioRecording(): void;
|
|
9
|
+
type AudioRecorder = {
|
|
10
|
+
audioBlobs: Blob[];
|
|
11
|
+
mediaRecorder: MediaRecorder | null;
|
|
12
|
+
streamBeingCaptured: MediaStream | null;
|
|
13
|
+
start: () => Promise<void>;
|
|
14
|
+
stop: () => Promise<unknown>;
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
stopStream: () => void;
|
|
17
|
+
resetRecordingProperties: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const audioRecorder: AudioRecorder;
|
|
20
|
+
export {};
|