@ai-group/chat-sdk 1.0.11 → 1.0.13
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/cjs/components/DislikeFeedback.js +79 -0
- package/dist/cjs/components/DislikeFeedback.js.map +7 -0
- package/dist/cjs/components/FeedbackTags.js +62 -0
- package/dist/cjs/components/FeedbackTags.js.map +7 -0
- package/dist/cjs/components/XAiChatbot/index.js +5 -3
- package/dist/cjs/components/XAiChatbot/index.js.map +2 -2
- package/dist/cjs/components/XAiProvider/index.d.ts +2 -2
- package/dist/cjs/components/XAiProvider/index.js +145 -45
- package/dist/cjs/components/XAiProvider/index.js.map +3 -3
- package/dist/cjs/hooks/useAgentGenerator.js +26 -26
- package/dist/cjs/hooks/useAgentGenerator.js.map +2 -2
- package/dist/cjs/services/api.d.ts +32 -3
- package/dist/cjs/services/api.js +15 -0
- package/dist/cjs/services/api.js.map +2 -2
- package/dist/cjs/types/XAiMessage.js.map +1 -1
- package/dist/esm/components/DislikeFeedback.js +97 -0
- package/dist/esm/components/DislikeFeedback.js.map +1 -0
- package/dist/esm/components/FeedbackTags.js +34 -0
- package/dist/esm/components/FeedbackTags.js.map +1 -0
- package/dist/esm/components/XAiChatbot/index.js +2 -2
- package/dist/esm/components/XAiChatbot/index.js.map +1 -1
- package/dist/esm/components/XAiProvider/index.d.ts +2 -2
- package/dist/esm/components/XAiProvider/index.js +218 -84
- package/dist/esm/components/XAiProvider/index.js.map +1 -1
- package/dist/esm/hooks/useAgentGenerator.js +10 -2
- package/dist/esm/hooks/useAgentGenerator.js.map +1 -1
- package/dist/esm/services/api.d.ts +32 -3
- package/dist/esm/services/api.js +32 -1
- package/dist/esm/services/api.js.map +1 -1
- package/dist/esm/types/XAiMessage.js.map +1 -1
- package/dist/umd/chat-sdk.min.js +1 -1
- package/package.json +16 -13
- package/dist/cjs/assets/svg/AddChatIcon.d.ts +0 -3
- package/dist/cjs/client/base.d.ts +0 -9
- package/dist/cjs/client/restClient.d.ts +0 -0
- package/dist/cjs/client/wsClient.d.ts +0 -0
- package/dist/cjs/components/XAiChatbot/index.d.ts +0 -9
- package/dist/cjs/components/XAiChatbot/styles.d.ts +0 -67
- package/dist/cjs/components/XAiConversations/XAiConversations.stories.d.ts +0 -6
- package/dist/cjs/components/XAiConversations/index.d.ts +0 -4
- package/dist/cjs/components/XAiConversations/styles.d.ts +0 -49
- package/dist/cjs/components/XAiProvider/demo.styles.d.ts +0 -37
- package/dist/cjs/components/XAiSender/XAiSender.stories.d.ts +0 -6
- package/dist/cjs/components/XAiSender/index.d.ts +0 -4
- package/dist/cjs/components/XAiSender/styles.d.ts +0 -47
- package/dist/cjs/constants/index.d.ts +0 -2
- package/dist/cjs/context/AiProviderContext.d.ts +0 -14
- package/dist/cjs/context/ThemeContext.d.ts +0 -20
- package/dist/cjs/hooks/useEventStreamRequest.d.ts +0 -30
- package/dist/cjs/hooks/useProviderContext.d.ts +0 -33
- package/dist/cjs/styles/common.d.ts +0 -73
- package/dist/cjs/styles/markdown.d.ts +0 -3
- package/dist/cjs/types/XAiChatbot.d.ts +0 -156
- package/dist/cjs/types/XAiConversations.d.ts +0 -20
- package/dist/cjs/types/XAiMessage.d.ts +0 -108
- package/dist/cjs/types/XAiProvider.d.ts +0 -347
- package/dist/cjs/types/XAiSender.d.ts +0 -13
- package/dist/cjs/types/index.d.ts +0 -5
- package/dist/cjs/types/node.d.ts +0 -10
- package/dist/cjs/utils/chat.d.ts +0 -34
- package/dist/cjs/utils/index.d.ts +0 -2
- package/dist/cjs/utils/providerManager.d.ts +0 -22
- package/dist/cjs/utils/request.d.ts +0 -78
- package/dist/cjs/utils/request.example.d.ts +0 -39
- package/dist/cjs/utils/workflowNode.d.ts +0 -2
- package/dist/esm/assets/svg/AddChatIcon.d.ts +0 -3
- package/dist/esm/client/base.d.ts +0 -9
- package/dist/esm/client/restClient.d.ts +0 -0
- package/dist/esm/client/wsClient.d.ts +0 -0
- package/dist/esm/components/XAiChatbot/index.d.ts +0 -9
- package/dist/esm/components/XAiChatbot/styles.d.ts +0 -67
- package/dist/esm/components/XAiConversations/XAiConversations.stories.d.ts +0 -6
- package/dist/esm/components/XAiConversations/index.d.ts +0 -4
- package/dist/esm/components/XAiConversations/styles.d.ts +0 -49
- package/dist/esm/components/XAiProvider/demo.styles.d.ts +0 -37
- package/dist/esm/components/XAiSender/XAiSender.stories.d.ts +0 -6
- package/dist/esm/components/XAiSender/index.d.ts +0 -4
- package/dist/esm/components/XAiSender/styles.d.ts +0 -47
- package/dist/esm/constants/index.d.ts +0 -2
- package/dist/esm/context/AiProviderContext.d.ts +0 -14
- package/dist/esm/context/ThemeContext.d.ts +0 -20
- package/dist/esm/hooks/useEventStreamRequest.d.ts +0 -30
- package/dist/esm/hooks/useProviderContext.d.ts +0 -33
- package/dist/esm/styles/common.d.ts +0 -73
- package/dist/esm/styles/markdown.d.ts +0 -3
- package/dist/esm/types/XAiChatbot.d.ts +0 -156
- package/dist/esm/types/XAiConversations.d.ts +0 -20
- package/dist/esm/types/XAiMessage.d.ts +0 -108
- package/dist/esm/types/XAiProvider.d.ts +0 -347
- package/dist/esm/types/XAiSender.d.ts +0 -13
- package/dist/esm/types/index.d.ts +0 -5
- package/dist/esm/types/node.d.ts +0 -10
- package/dist/esm/utils/chat.d.ts +0 -34
- package/dist/esm/utils/index.d.ts +0 -2
- package/dist/esm/utils/providerManager.d.ts +0 -22
- package/dist/esm/utils/request.d.ts +0 -78
- package/dist/esm/utils/request.example.d.ts +0 -39
- package/dist/esm/utils/workflowNode.d.ts +0 -2
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const useStyles: () => {
|
|
3
|
-
wrapper: string;
|
|
4
|
-
navbar: string;
|
|
5
|
-
userAvatar: string;
|
|
6
|
-
avatar: string;
|
|
7
|
-
title: string;
|
|
8
|
-
subtitle: string;
|
|
9
|
-
messageContainer: string;
|
|
10
|
-
messageList: string;
|
|
11
|
-
emptyWrapper: string;
|
|
12
|
-
emptyImg: string;
|
|
13
|
-
message: string;
|
|
14
|
-
messageRight: string;
|
|
15
|
-
quickReplies: string;
|
|
16
|
-
replyItem: string;
|
|
17
|
-
highlight: string;
|
|
18
|
-
inputBar: string;
|
|
19
|
-
input: string;
|
|
20
|
-
actionDetailContent: string;
|
|
21
|
-
actionHeaderWrapper: string;
|
|
22
|
-
actionHeaderIcon: string;
|
|
23
|
-
actionHeaderDetail: string;
|
|
24
|
-
actionDetailTitle: string;
|
|
25
|
-
executeHeaderIcon: string;
|
|
26
|
-
actionTitle: string;
|
|
27
|
-
actionHeaderDetailItem: string;
|
|
28
|
-
actionHeaderCost: string;
|
|
29
|
-
executeHiddenWrapper: string;
|
|
30
|
-
executeTitle: string;
|
|
31
|
-
executeContent: string;
|
|
32
|
-
executeWrapper: string;
|
|
33
|
-
} & {
|
|
34
|
-
w: (width: string | number) => string;
|
|
35
|
-
h: (height: string | number) => string;
|
|
36
|
-
p: (padding: string) => string;
|
|
37
|
-
pb: (padding: string | number) => string;
|
|
38
|
-
pt: (padding: string | number) => string;
|
|
39
|
-
pl: (padding: string | number) => string;
|
|
40
|
-
pr: (padding: string | number) => string;
|
|
41
|
-
m: (margin: string) => string;
|
|
42
|
-
mb: (margin: string | number) => string;
|
|
43
|
-
mt: (margin: string | number) => string;
|
|
44
|
-
ml: (margin: string | number) => string;
|
|
45
|
-
mr: (margin: string | number) => string;
|
|
46
|
-
text: (size: string | number) => string;
|
|
47
|
-
weight: (size: number) => string;
|
|
48
|
-
textColor: (c: string) => string;
|
|
49
|
-
bg: (c: string) => string;
|
|
50
|
-
rs: (radius: string | number) => string;
|
|
51
|
-
gap: (g: string | number) => string;
|
|
52
|
-
flex: string;
|
|
53
|
-
flexCenter: string;
|
|
54
|
-
flexBetween: string;
|
|
55
|
-
flexColumn: string;
|
|
56
|
-
flex1: string;
|
|
57
|
-
cursor: (type: string) => string;
|
|
58
|
-
border: (color: string, width?: string) => string;
|
|
59
|
-
boxShadow: (shadow: string) => string;
|
|
60
|
-
transition: (property?: string, duration?: string) => string;
|
|
61
|
-
overflow: (type: string) => string;
|
|
62
|
-
position: (type: string) => string;
|
|
63
|
-
zIndex: (index: number) => string;
|
|
64
|
-
flexCenterGap2: string;
|
|
65
|
-
flexCenterGap4: string;
|
|
66
|
-
};
|
|
67
|
-
export declare const GlobalStyle: React.FC;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const useStyles: () => {
|
|
3
|
-
capWrapper: string;
|
|
4
|
-
capShape: string;
|
|
5
|
-
capIcon: string;
|
|
6
|
-
addChatBtn: string;
|
|
7
|
-
tipTitle: string;
|
|
8
|
-
fWrapper: string;
|
|
9
|
-
nWrapper: string;
|
|
10
|
-
mask: string;
|
|
11
|
-
fheaderWrapper: string;
|
|
12
|
-
scrollList: string;
|
|
13
|
-
slideIn: string;
|
|
14
|
-
slideOut: string;
|
|
15
|
-
} & {
|
|
16
|
-
w: (width: string | number) => string;
|
|
17
|
-
h: (height: string | number) => string;
|
|
18
|
-
p: (padding: string) => string;
|
|
19
|
-
pb: (padding: string | number) => string;
|
|
20
|
-
pt: (padding: string | number) => string;
|
|
21
|
-
pl: (padding: string | number) => string;
|
|
22
|
-
pr: (padding: string | number) => string;
|
|
23
|
-
m: (margin: string) => string;
|
|
24
|
-
mb: (margin: string | number) => string;
|
|
25
|
-
mt: (margin: string | number) => string;
|
|
26
|
-
ml: (margin: string | number) => string;
|
|
27
|
-
mr: (margin: string | number) => string;
|
|
28
|
-
text: (size: string | number) => string;
|
|
29
|
-
weight: (size: number) => string;
|
|
30
|
-
textColor: (c: string) => string;
|
|
31
|
-
bg: (c: string) => string;
|
|
32
|
-
rs: (radius: string | number) => string;
|
|
33
|
-
gap: (g: string | number) => string;
|
|
34
|
-
flex: string;
|
|
35
|
-
flexCenter: string;
|
|
36
|
-
flexBetween: string;
|
|
37
|
-
flexColumn: string;
|
|
38
|
-
flex1: string;
|
|
39
|
-
cursor: (type: string) => string;
|
|
40
|
-
border: (color: string, width?: string) => string;
|
|
41
|
-
boxShadow: (shadow: string) => string;
|
|
42
|
-
transition: (property?: string, duration?: string) => string;
|
|
43
|
-
overflow: (type: string) => string;
|
|
44
|
-
position: (type: string) => string;
|
|
45
|
-
zIndex: (index: number) => string;
|
|
46
|
-
flexCenterGap2: string;
|
|
47
|
-
flexCenterGap4: string;
|
|
48
|
-
};
|
|
49
|
-
export declare const GlobalStyle: React.FC;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
declare const useStyles: () => {
|
|
2
|
-
wrapper: string;
|
|
3
|
-
} & {
|
|
4
|
-
w: (width: string | number) => string;
|
|
5
|
-
h: (height: string | number) => string;
|
|
6
|
-
p: (padding: string) => string;
|
|
7
|
-
pb: (padding: string | number) => string;
|
|
8
|
-
pt: (padding: string | number) => string;
|
|
9
|
-
pl: (padding: string | number) => string;
|
|
10
|
-
pr: (padding: string | number) => string;
|
|
11
|
-
m: (margin: string) => string;
|
|
12
|
-
mb: (margin: string | number) => string;
|
|
13
|
-
mt: (margin: string | number) => string;
|
|
14
|
-
ml: (margin: string | number) => string;
|
|
15
|
-
mr: (margin: string | number) => string;
|
|
16
|
-
text: (size: string | number) => string;
|
|
17
|
-
weight: (size: number) => string;
|
|
18
|
-
textColor: (c: string) => string;
|
|
19
|
-
bg: (c: string) => string;
|
|
20
|
-
rs: (radius: string | number) => string;
|
|
21
|
-
gap: (g: string | number) => string;
|
|
22
|
-
flex: string;
|
|
23
|
-
flexCenter: string;
|
|
24
|
-
flexBetween: string;
|
|
25
|
-
flexColumn: string;
|
|
26
|
-
flex1: string;
|
|
27
|
-
cursor: (type: string) => string;
|
|
28
|
-
border: (color: string, width?: string) => string;
|
|
29
|
-
boxShadow: (shadow: string) => string;
|
|
30
|
-
transition: (property?: string, duration?: string) => string;
|
|
31
|
-
overflow: (type: string) => string;
|
|
32
|
-
position: (type: string) => string;
|
|
33
|
-
zIndex: (index: number) => string;
|
|
34
|
-
flexCenterGap2: string;
|
|
35
|
-
flexCenterGap4: string;
|
|
36
|
-
};
|
|
37
|
-
export default useStyles;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: () => {
|
|
2
|
-
chatFooter: string;
|
|
3
|
-
footerTips: string;
|
|
4
|
-
popoverFooter: string;
|
|
5
|
-
sendButton: string;
|
|
6
|
-
uploadBtn: string;
|
|
7
|
-
clearBtn: string;
|
|
8
|
-
stopButton: string;
|
|
9
|
-
divider: string;
|
|
10
|
-
sendWrapper: string;
|
|
11
|
-
iconHuihuarenqun: string;
|
|
12
|
-
iconZengjiaDisabled: string;
|
|
13
|
-
iconZengjiaNormal: string;
|
|
14
|
-
} & {
|
|
15
|
-
w: (width: string | number) => string;
|
|
16
|
-
h: (height: string | number) => string;
|
|
17
|
-
p: (padding: string) => string;
|
|
18
|
-
pb: (padding: string | number) => string;
|
|
19
|
-
pt: (padding: string | number) => string;
|
|
20
|
-
pl: (padding: string | number) => string;
|
|
21
|
-
pr: (padding: string | number) => string;
|
|
22
|
-
m: (margin: string) => string;
|
|
23
|
-
mb: (margin: string | number) => string;
|
|
24
|
-
mt: (margin: string | number) => string;
|
|
25
|
-
ml: (margin: string | number) => string;
|
|
26
|
-
mr: (margin: string | number) => string;
|
|
27
|
-
text: (size: string | number) => string;
|
|
28
|
-
weight: (size: number) => string;
|
|
29
|
-
textColor: (c: string) => string;
|
|
30
|
-
bg: (c: string) => string;
|
|
31
|
-
rs: (radius: string | number) => string;
|
|
32
|
-
gap: (g: string | number) => string;
|
|
33
|
-
flex: string;
|
|
34
|
-
flexCenter: string;
|
|
35
|
-
flexBetween: string;
|
|
36
|
-
flexColumn: string;
|
|
37
|
-
flex1: string;
|
|
38
|
-
cursor: (type: string) => string;
|
|
39
|
-
border: (color: string, width?: string) => string;
|
|
40
|
-
boxShadow: (shadow: string) => string;
|
|
41
|
-
transition: (property?: string, duration?: string) => string;
|
|
42
|
-
overflow: (type: string) => string;
|
|
43
|
-
position: (type: string) => string;
|
|
44
|
-
zIndex: (index: number) => string;
|
|
45
|
-
flexCenterGap2: string;
|
|
46
|
-
flexCenterGap4: string;
|
|
47
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { XAiChatbotProps, XAiConversationsProps } from "../types";
|
|
3
|
-
export interface XAiContextType extends Omit<XAiChatbotProps, 'onScroll'>, Omit<XAiConversationsProps, 'onScroll'> {
|
|
4
|
-
onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
|
|
5
|
-
providerId?: string;
|
|
6
|
-
token: string;
|
|
7
|
-
error: string | null;
|
|
8
|
-
loadMoreSessions?: () => void;
|
|
9
|
-
isInProvider?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const XAiContext: React.Context<XAiContextType>;
|
|
12
|
-
export { XAiContext };
|
|
13
|
-
export declare const useXAi: () => XAiContextType | undefined;
|
|
14
|
-
export declare const useXAiProviders: () => string[];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface XThemeConfig {
|
|
3
|
-
mode?: 'light' | 'dark';
|
|
4
|
-
primaryColor?: string;
|
|
5
|
-
bubble?: {
|
|
6
|
-
className?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
classNames?: Record<string, string>;
|
|
9
|
-
styles?: Record<string, React.CSSProperties>;
|
|
10
|
-
};
|
|
11
|
-
sender?: {
|
|
12
|
-
className?: string;
|
|
13
|
-
style?: React.CSSProperties;
|
|
14
|
-
classNames?: Record<string, string>;
|
|
15
|
-
styles?: Record<string, React.CSSProperties>;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
export declare const ThemeContext: React.Context<XThemeConfig>;
|
|
19
|
-
export declare const useTheme: () => XThemeConfig;
|
|
20
|
-
export declare const ThemeProvider: React.Provider<XThemeConfig>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
interface IResponseData {
|
|
2
|
-
code: string;
|
|
3
|
-
httpCode?: number;
|
|
4
|
-
data: string | {
|
|
5
|
-
message: string;
|
|
6
|
-
};
|
|
7
|
-
message: string;
|
|
8
|
-
content: string;
|
|
9
|
-
requestId: string;
|
|
10
|
-
sessionId: string;
|
|
11
|
-
error?: boolean;
|
|
12
|
-
success?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface UseEventStreamProps {
|
|
15
|
-
streaming: boolean;
|
|
16
|
-
options?: RequestInit;
|
|
17
|
-
onOpen?: (response: Response) => void;
|
|
18
|
-
onError?: (error: Error) => void;
|
|
19
|
-
onClose?: () => void;
|
|
20
|
-
textSpeed?: number;
|
|
21
|
-
}
|
|
22
|
-
interface UseEventStreamReturn {
|
|
23
|
-
responseData: IResponseData | Record<any, any>;
|
|
24
|
-
loading: boolean;
|
|
25
|
-
start: (url: string, values?: any, headers?: Record<string, string>) => void;
|
|
26
|
-
stop: () => void;
|
|
27
|
-
onError?: (error: Error) => void;
|
|
28
|
-
}
|
|
29
|
-
export declare const useEventStreamRequest: ({ onOpen, onError, streaming, onClose, textSpeed, }: UseEventStreamProps) => UseEventStreamReturn;
|
|
30
|
-
export default useEventStreamRequest;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { XAiContextType } from "../context/AiProviderContext";
|
|
2
|
-
export interface UseProviderContextOptions<T> {
|
|
3
|
-
props: T;
|
|
4
|
-
providerProps?: (keyof XAiContextType)[];
|
|
5
|
-
mergeLogic?: (props: T, context: XAiContextType | undefined) => T;
|
|
6
|
-
}
|
|
7
|
-
export interface UseProviderContextReturn<T> {
|
|
8
|
-
mergedProps: T;
|
|
9
|
-
isInProvider: boolean;
|
|
10
|
-
context: XAiContextType | undefined;
|
|
11
|
-
getProviderValue: <K extends keyof XAiContextType>(key: K) => XAiContextType[K] | undefined;
|
|
12
|
-
}
|
|
13
|
-
export type MethodCaller<T extends any[] = any[], R = any> = (...args: T) => R;
|
|
14
|
-
export interface ProviderMethods {
|
|
15
|
-
isInProvider: boolean;
|
|
16
|
-
sendMessage: MethodCaller<[string], void>;
|
|
17
|
-
stopGeneration: MethodCaller<[], void>;
|
|
18
|
-
clearMessages: MethodCaller<[], void>;
|
|
19
|
-
regenerateLastMessage: MethodCaller<[string], void>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* 通用的 Provider 上下文 Hook
|
|
23
|
-
* 用于判断组件是否在 XAiProvider 中,并合并相关属性
|
|
24
|
-
*/
|
|
25
|
-
export declare const useProviderContext: <T extends Record<string, any>>(options: UseProviderContextOptions<T>) => UseProviderContextReturn<T>;
|
|
26
|
-
/**
|
|
27
|
-
* 专门为 XAiChatbot 设计的 Hook
|
|
28
|
-
*/
|
|
29
|
-
export declare const useChatbotContext: (componentProps: any) => UseProviderContextReturn<any>;
|
|
30
|
-
/**
|
|
31
|
-
* 通用的 Provider 方法调用 Hook
|
|
32
|
-
*/
|
|
33
|
-
export declare const useProviderMethods: () => ProviderMethods;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export declare const primaryBlue = "#0078FF";
|
|
2
|
-
export declare const lightBlue = "#E6F0FF";
|
|
3
|
-
export declare const darkGray = "#333";
|
|
4
|
-
export declare const lightGray = "#888";
|
|
5
|
-
export declare const borderGray = "#ddd";
|
|
6
|
-
export declare const basicStyles: {
|
|
7
|
-
w: (width: number | string) => string;
|
|
8
|
-
h: (height: number | string) => string;
|
|
9
|
-
p: (padding: string) => string;
|
|
10
|
-
pb: (padding: number | string) => string;
|
|
11
|
-
pt: (padding: number | string) => string;
|
|
12
|
-
pl: (padding: number | string) => string;
|
|
13
|
-
pr: (padding: number | string) => string;
|
|
14
|
-
m: (margin: string) => string;
|
|
15
|
-
mb: (margin: number | string) => string;
|
|
16
|
-
mt: (margin: number | string) => string;
|
|
17
|
-
ml: (margin: number | string) => string;
|
|
18
|
-
mr: (margin: number | string) => string;
|
|
19
|
-
text: (size: number | string) => string;
|
|
20
|
-
weight: (size: number) => string;
|
|
21
|
-
textColor: (c: string) => string;
|
|
22
|
-
bg: (c: string) => string;
|
|
23
|
-
rs: (radius: number | string) => string;
|
|
24
|
-
gap: (g: number | string) => string;
|
|
25
|
-
flex: string;
|
|
26
|
-
flexCenter: string;
|
|
27
|
-
flexBetween: string;
|
|
28
|
-
flexColumn: string;
|
|
29
|
-
flex1: string;
|
|
30
|
-
cursor: (type: string) => string;
|
|
31
|
-
border: (color: string, width?: string) => string;
|
|
32
|
-
boxShadow: (shadow: string) => string;
|
|
33
|
-
transition: (property?: string, duration?: string) => string;
|
|
34
|
-
overflow: (type: string) => string;
|
|
35
|
-
position: (type: string) => string;
|
|
36
|
-
zIndex: (index: number) => string;
|
|
37
|
-
flexCenterGap2: string;
|
|
38
|
-
flexCenterGap4: string;
|
|
39
|
-
};
|
|
40
|
-
export declare function withBasicStyles<T extends Record<string, any>>(useCustomStyles: () => T): () => T & {
|
|
41
|
-
w: (width: string | number) => string;
|
|
42
|
-
h: (height: string | number) => string;
|
|
43
|
-
p: (padding: string) => string;
|
|
44
|
-
pb: (padding: string | number) => string;
|
|
45
|
-
pt: (padding: string | number) => string;
|
|
46
|
-
pl: (padding: string | number) => string;
|
|
47
|
-
pr: (padding: string | number) => string;
|
|
48
|
-
m: (margin: string) => string;
|
|
49
|
-
mb: (margin: string | number) => string;
|
|
50
|
-
mt: (margin: string | number) => string;
|
|
51
|
-
ml: (margin: string | number) => string;
|
|
52
|
-
mr: (margin: string | number) => string;
|
|
53
|
-
text: (size: string | number) => string;
|
|
54
|
-
weight: (size: number) => string;
|
|
55
|
-
textColor: (c: string) => string;
|
|
56
|
-
bg: (c: string) => string;
|
|
57
|
-
rs: (radius: string | number) => string;
|
|
58
|
-
gap: (g: string | number) => string;
|
|
59
|
-
flex: string;
|
|
60
|
-
flexCenter: string;
|
|
61
|
-
flexBetween: string;
|
|
62
|
-
flexColumn: string;
|
|
63
|
-
flex1: string;
|
|
64
|
-
cursor: (type: string) => string;
|
|
65
|
-
border: (color: string, width?: string) => string;
|
|
66
|
-
boxShadow: (shadow: string) => string;
|
|
67
|
-
transition: (property?: string, duration?: string) => string;
|
|
68
|
-
overflow: (type: string) => string;
|
|
69
|
-
position: (type: string) => string;
|
|
70
|
-
zIndex: (index: number) => string;
|
|
71
|
-
flexCenterGap2: string;
|
|
72
|
-
flexCenterGap4: string;
|
|
73
|
-
};
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode, RefObject, MouseEvent, ReactElement } from 'react';
|
|
2
|
-
import type { PromptProps } from '@ant-design/x';
|
|
3
|
-
import type { MessageType } from 'src/client/base';
|
|
4
|
-
import type { Messages } from './XAiMessage';
|
|
5
|
-
export interface User {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
avatar?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface MessageProps {
|
|
11
|
-
_id: string;
|
|
12
|
-
type: string;
|
|
13
|
-
content: Record<string, any>;
|
|
14
|
-
createdAt: number;
|
|
15
|
-
user: User;
|
|
16
|
-
position?: 'left' | 'right' | 'center' | 'pop';
|
|
17
|
-
hasTime?: boolean;
|
|
18
|
-
status?: 'pending' | 'sent' | 'fail';
|
|
19
|
-
}
|
|
20
|
-
export interface QuickReplyItemProps {
|
|
21
|
-
name: string;
|
|
22
|
-
code: string;
|
|
23
|
-
icon?: string;
|
|
24
|
-
img?: string;
|
|
25
|
-
isNew?: boolean;
|
|
26
|
-
isHighlight?: boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface ComposerHandle {
|
|
29
|
-
setText: (text: string) => void;
|
|
30
|
-
}
|
|
31
|
-
export interface ScrollToEndOptions {
|
|
32
|
-
animated?: boolean;
|
|
33
|
-
force?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface MessageContainerHandle {
|
|
36
|
-
scrollToEnd: (options?: ScrollToEndOptions) => void;
|
|
37
|
-
}
|
|
38
|
-
export interface NavbarProps {
|
|
39
|
-
title?: string;
|
|
40
|
-
subtitle?: string;
|
|
41
|
-
avatar?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ToolbarItemProps {
|
|
44
|
-
id: string;
|
|
45
|
-
icon: string;
|
|
46
|
-
label: string;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
}
|
|
49
|
-
export interface IconButtonProps {
|
|
50
|
-
icon: string;
|
|
51
|
-
onClick: () => void;
|
|
52
|
-
disabled?: boolean;
|
|
53
|
-
}
|
|
54
|
-
export interface RecorderProps {
|
|
55
|
-
onStart?: () => void;
|
|
56
|
-
onStop?: (audioBlob: Blob) => void;
|
|
57
|
-
onError?: (error: Error) => void;
|
|
58
|
-
}
|
|
59
|
-
export type InputType = 'text' | 'voice';
|
|
60
|
-
export interface ChatbotMessageFields {
|
|
61
|
-
messages?: MessageType[];
|
|
62
|
-
setMessages?: React.Dispatch<React.SetStateAction<MessageType[]>>;
|
|
63
|
-
/** 发送消息回调 */
|
|
64
|
-
onSend?: (type: string, content: string) => void;
|
|
65
|
-
/** 清空消息回调 */
|
|
66
|
-
onClear?: () => void;
|
|
67
|
-
/** 停止生成回调 */
|
|
68
|
-
onStop?: () => void;
|
|
69
|
-
}
|
|
70
|
-
export interface ActionItem {
|
|
71
|
-
key?: string;
|
|
72
|
-
icon?: React.ReactNode;
|
|
73
|
-
render?: (index: number, msg: any) => React.ReactNode;
|
|
74
|
-
tooltip?: string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* AI 聊天机器人组件
|
|
78
|
-
*/
|
|
79
|
-
export interface XAiChatbotProps extends ChatbotMessageFields {
|
|
80
|
-
/** 宽屏断点 */
|
|
81
|
-
wideBreakpoint?: string;
|
|
82
|
-
/** 导航栏展示 */
|
|
83
|
-
navbarShow?: boolean;
|
|
84
|
-
/** 导航栏配置 */
|
|
85
|
-
navbar?: NavbarProps;
|
|
86
|
-
/** 导航栏渲染函数,会覆盖 navbar */
|
|
87
|
-
renderNavbar?: () => ReactNode;
|
|
88
|
-
/** 是否加载中 */
|
|
89
|
-
loading?: boolean;
|
|
90
|
-
/** 加载更多文案 */
|
|
91
|
-
loadMoreText?: string;
|
|
92
|
-
/** 在消息列表上面的渲染函数 */
|
|
93
|
-
renderBeforeMessageList?: () => ReactNode;
|
|
94
|
-
/** 消息列表 ref */
|
|
95
|
-
messagesRef?: RefObject<MessageContainerHandle>;
|
|
96
|
-
/** 下拉加载回调 */
|
|
97
|
-
onRefresh?: () => Promise<any>;
|
|
98
|
-
/** 滚动消息列表回调 */
|
|
99
|
-
onScroll?: (event: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
100
|
-
/** 消息内容渲染函数 */
|
|
101
|
-
renderMessageContent?: (message: MessageProps) => ReactNode;
|
|
102
|
-
/** 快捷短语列表 */
|
|
103
|
-
quickReplies?: QuickReplyItemProps[];
|
|
104
|
-
/** 快捷短语是否可见 */
|
|
105
|
-
quickRepliesVisible?: boolean;
|
|
106
|
-
/** 输入框初始内容 */
|
|
107
|
-
text?: string;
|
|
108
|
-
/** 空状态渲染插槽 */
|
|
109
|
-
empty?: ReactElement;
|
|
110
|
-
/** 空状态图片 */
|
|
111
|
-
emptyStateImage?: string;
|
|
112
|
-
/** 空状态文案 */
|
|
113
|
-
emptyStateText?: string;
|
|
114
|
-
/** 输入框占位符 */
|
|
115
|
-
placeholder?: string;
|
|
116
|
-
/** 输入框粘贴图片后的回调 */
|
|
117
|
-
onImageSend?: (file: File) => Promise<any>;
|
|
118
|
-
/** 输入方式 */
|
|
119
|
-
inputType?: InputType;
|
|
120
|
-
/** 语音输入配置 */
|
|
121
|
-
recorder?: RecorderProps;
|
|
122
|
-
/** 工具栏配置 */
|
|
123
|
-
toolbar?: ToolbarItemProps[];
|
|
124
|
-
/** AI头像 */
|
|
125
|
-
avatar?: ReactNode;
|
|
126
|
-
/** 用户头像 */
|
|
127
|
-
userAvatar?: ReactNode;
|
|
128
|
-
/** 发送按钮 */
|
|
129
|
-
sendBtn?: ReactNode;
|
|
130
|
-
/** 是否展示清空按钮 */
|
|
131
|
-
clearBtnShow?: boolean;
|
|
132
|
-
/** 工具栏点击回调 */
|
|
133
|
-
onToolbarClick?: (item: ToolbarItemProps, event: MouseEvent) => void;
|
|
134
|
-
/** 工具栏打开/关闭回调 */
|
|
135
|
-
onAccessoryToggle?: (isAccessoryOpen: boolean) => void;
|
|
136
|
-
/** 输入框右边图标按钮配置 */
|
|
137
|
-
rightAction?: IconButtonProps;
|
|
138
|
-
/** 上传按钮是否显示 */
|
|
139
|
-
uploadBtnShow?: boolean;
|
|
140
|
-
/** 底部文案 */
|
|
141
|
-
footerTips?: string;
|
|
142
|
-
/** 帮助消息点击回调 */
|
|
143
|
-
onSuggestMessageClick?: (item: PromptProps, id: string) => void;
|
|
144
|
-
/** 消息左下角展示字段 */
|
|
145
|
-
messageTooltip?: (msg: Messages) => React.ReactNode;
|
|
146
|
-
/** 消息右下角功能区 */
|
|
147
|
-
messageActions?: ActionItem[];
|
|
148
|
-
/** 消息右下角功能区点击回调 */
|
|
149
|
-
onMessagesActionsCallback?: (index: number, data: Messages) => void;
|
|
150
|
-
/** 输入组件 */
|
|
151
|
-
Composer?: React.ElementType;
|
|
152
|
-
/** 是否展示输入框 */
|
|
153
|
-
inputShow?: boolean;
|
|
154
|
-
/** 消息顶部 */
|
|
155
|
-
messageHeader?: ReactNode;
|
|
156
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ConversationsProps, type Conversation } from '@ant-design/x';
|
|
2
|
-
type OmitItems = Omit<ConversationsProps, 'items'>;
|
|
3
|
-
export interface sessionData extends Conversation {
|
|
4
|
-
meta?: any;
|
|
5
|
-
}
|
|
6
|
-
export interface XAiConversationsProps extends OmitItems {
|
|
7
|
-
/** 配色 */
|
|
8
|
-
color?: string;
|
|
9
|
-
/** 侧边栏展示形式,若为 true 则为抽屉式展示 */
|
|
10
|
-
isNarrow?: boolean;
|
|
11
|
-
/** 会话列表,替换原来的 items 字段 */
|
|
12
|
-
sessionList?: sessionData[];
|
|
13
|
-
/** session总数,当设置该值时,会增加自动加载逻辑 */
|
|
14
|
-
sessionTotal?: number;
|
|
15
|
-
/** 加载更多函数 */
|
|
16
|
-
loadMoreSession?: () => void;
|
|
17
|
-
/** 点击生成新对话回调 */
|
|
18
|
-
onNewChat?: () => void;
|
|
19
|
-
}
|
|
20
|
-
export {};
|