@ai-group/chat-sdk 1.0.20 → 1.0.21
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 +4 -0
- package/dist/cjs/components/DislikeFeedback.js.map +2 -2
- package/dist/esm/components/DislikeFeedback.js +7 -3
- package/dist/esm/components/DislikeFeedback.js.map +1 -1
- package/dist/umd/chat-sdk.min.js +1 -1
- package/package.json +15 -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/XAiConversations/styles.d.ts +0 -49
- package/dist/cjs/components/XAiProvider/demo.styles.d.ts +0 -37
- package/dist/cjs/components/XAiSender/styles.d.ts +0 -47
- package/dist/cjs/constants/index.d.ts +0 -2
- package/dist/cjs/context/ThemeContext.d.ts +0 -20
- package/dist/cjs/styles/common.d.ts +0 -73
- package/dist/cjs/styles/markdown.d.ts +0 -3
- package/dist/cjs/types/XAiConversations.d.ts +0 -20
- package/dist/cjs/types/XAiSender.d.ts +0 -13
- 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/XAiConversations/styles.d.ts +0 -49
- package/dist/esm/components/XAiProvider/demo.styles.d.ts +0 -37
- package/dist/esm/components/XAiSender/styles.d.ts +0 -47
- package/dist/esm/constants/index.d.ts +0 -2
- package/dist/esm/context/ThemeContext.d.ts +0 -20
- package/dist/esm/styles/common.d.ts +0 -73
- package/dist/esm/styles/markdown.d.ts +0 -3
- package/dist/esm/types/XAiConversations.d.ts +0 -20
- package/dist/esm/types/XAiSender.d.ts +0 -13
- 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,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,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,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,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 {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { SenderProps } from "@ant-design/x";
|
|
2
|
-
export interface XAiSenderProps extends Omit<SenderProps, 'onSubmit' | 'onCancel'> {
|
|
3
|
-
/** 是否展示清空按钮 */
|
|
4
|
-
clearBtnShow?: boolean;
|
|
5
|
-
/** 底部文案 */
|
|
6
|
-
footerTips?: string;
|
|
7
|
-
/** 清空对话框按钮回调 */
|
|
8
|
-
onClear?: () => void;
|
|
9
|
-
/** 加载中,点击停止生成按钮回调 */
|
|
10
|
-
onStop?: () => void;
|
|
11
|
-
/** 点击发送按钮的回调 */
|
|
12
|
-
onSubmit?: (type: string, content: string) => void;
|
|
13
|
-
}
|
package/dist/esm/types/node.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export type INodeCategoryEnum = 'CONTROL' | 'LOGIC' | 'EXTERNAL' | 'MEMORY' | 'PLUGIN' | 'DEV_TOOL' | 'TEXT_TOOL' | 'IMAGE_TOOL' | 'VOICE_TOOL';
|
|
3
|
-
export interface INodeTemplate {
|
|
4
|
-
category: INodeCategoryEnum;
|
|
5
|
-
name: string;
|
|
6
|
-
code: string;
|
|
7
|
-
toolCode?: string;
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
icon?: React.ReactNode;
|
|
10
|
-
}
|
package/dist/esm/utils/chat.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 处理发送消息并接收流式响应
|
|
3
|
-
* @param {Object} params - 参数对象
|
|
4
|
-
* @param {string} params.message - 用户输入的消息
|
|
5
|
-
* @param {Array} params.files - 上传的文件列表
|
|
6
|
-
* @param {string} params.botNo - 机器人编号
|
|
7
|
-
* @param {string} params.agentNo - 代理编号
|
|
8
|
-
* @param {string} params.agentVersionNo - 代理版本编号
|
|
9
|
-
* @param {string} params.sessionId - 会话ID
|
|
10
|
-
* @param {string} params.botPrefix - API前缀
|
|
11
|
-
* @param {string} params.mode - 模式
|
|
12
|
-
* @param {Function} params.setMessages - 设置消息列表的函数
|
|
13
|
-
* @param {Function} params.setLoading - 设置加载状态的函数
|
|
14
|
-
* @param {Function} params.setContent - 设置输入内容的函数
|
|
15
|
-
* @param {Function} params.setSessionId - 设置会话ID的函数
|
|
16
|
-
* @param {Function} params.scrollToBottom - 滚动到底部的函数
|
|
17
|
-
* @param {Object} params.controllerRef - AbortController引用
|
|
18
|
-
* @param {Object} params.timeoutRef - 超时计时器引用
|
|
19
|
-
* @param {Function} params.setServerTime - 设置服务器时间的函数
|
|
20
|
-
* @param {Function} params.processActionData - 处理动作数据的函数
|
|
21
|
-
* @param {Function} params.handleNeedApprove - 处理需要授权的回调函数
|
|
22
|
-
* @param {boolean} params.isJsonMode - 是否为JSON模式
|
|
23
|
-
* @param {boolean} params.skipUserMessage - 是否跳过添加用户消息(用于授权后重新发送)
|
|
24
|
-
* @param {string} params.aiMessageId - 已创建的AI消息ID(配合skipUserMessage使用)
|
|
25
|
-
* @returns {Promise<void>}
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* 停止生成响应
|
|
29
|
-
* @param {Object} params - 参数对象
|
|
30
|
-
* @param {Object} params.controllerRef - AbortController引用
|
|
31
|
-
* @param {Object} params.timeoutRef - 超时计时器引用
|
|
32
|
-
* @param {Function} params.setLoading - 设置加载状态的函数
|
|
33
|
-
* @param {Function} params.setMessages - 设置消息列表的函数
|
|
34
|
-
*/
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { MessageType } from 'src/client/base';
|
|
2
|
-
declare class ProviderManager {
|
|
3
|
-
private providers;
|
|
4
|
-
register(providerId: string, data: {
|
|
5
|
-
client: any;
|
|
6
|
-
token: string;
|
|
7
|
-
url: string;
|
|
8
|
-
}): void;
|
|
9
|
-
unregister(providerId: string): void;
|
|
10
|
-
getProvider(providerId: string): {
|
|
11
|
-
client: any;
|
|
12
|
-
messages: import("src/client/base").MessageType[];
|
|
13
|
-
token: string;
|
|
14
|
-
url: string;
|
|
15
|
-
} | undefined;
|
|
16
|
-
addMessage(providerId: string, message: MessageType): void;
|
|
17
|
-
clearMessages(providerId: string): void;
|
|
18
|
-
getProviderIds(): string[];
|
|
19
|
-
}
|
|
20
|
-
export declare const providerManager: ProviderManager;
|
|
21
|
-
export declare const useProviderManager: () => ProviderManager;
|
|
22
|
-
export {};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
export interface RequestConfig extends AxiosRequestConfig {
|
|
3
|
-
showError?: boolean;
|
|
4
|
-
retry?: number;
|
|
5
|
-
retryDelay?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface ApiResponse<T = any> {
|
|
8
|
-
code: number;
|
|
9
|
-
message: string;
|
|
10
|
-
data: T;
|
|
11
|
-
success: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface RequestError {
|
|
14
|
-
code: number;
|
|
15
|
-
message: string;
|
|
16
|
-
details?: any;
|
|
17
|
-
}
|
|
18
|
-
export interface RequestInterceptor {
|
|
19
|
-
onRequest?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>;
|
|
20
|
-
onRequestError?: (error: AxiosError) => Promise<AxiosError>;
|
|
21
|
-
}
|
|
22
|
-
export interface ResponseInterceptor {
|
|
23
|
-
onResponse?: <T>(response: AxiosResponse<ApiResponse<T>>) => AxiosResponse<ApiResponse<T>> | Promise<AxiosResponse<ApiResponse<T>>>;
|
|
24
|
-
onResponseError?: (error: AxiosError) => Promise<AxiosError>;
|
|
25
|
-
}
|
|
26
|
-
export interface CreateRequestConfig {
|
|
27
|
-
baseURL?: string;
|
|
28
|
-
timeout?: number;
|
|
29
|
-
headers?: Record<string, string>;
|
|
30
|
-
requestInterceptor?: RequestInterceptor;
|
|
31
|
-
responseInterceptor?: ResponseInterceptor;
|
|
32
|
-
onError?: (error: RequestError) => void;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 创建请求实例
|
|
36
|
-
*/
|
|
37
|
-
export declare function createRequest(config?: CreateRequestConfig): AxiosInstance;
|
|
38
|
-
/**
|
|
39
|
-
* 通用 GET 请求
|
|
40
|
-
*/
|
|
41
|
-
export declare function get<T = any>(url: string, params?: any, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
42
|
-
/**
|
|
43
|
-
* 通用 POST 请求
|
|
44
|
-
*/
|
|
45
|
-
export declare function post<T = any>(url: string, data?: any, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
46
|
-
/**
|
|
47
|
-
* 通用 PUT 请求
|
|
48
|
-
*/
|
|
49
|
-
export declare function put<T = any>(url: string, data?: any, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
50
|
-
/**
|
|
51
|
-
* 通用 DELETE 请求
|
|
52
|
-
*/
|
|
53
|
-
export declare function del<T = any>(url: string, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
54
|
-
/**
|
|
55
|
-
* 通用 PATCH 请求
|
|
56
|
-
*/
|
|
57
|
-
export declare function patch<T = any>(url: string, data?: any, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
58
|
-
/**
|
|
59
|
-
* 文件上传
|
|
60
|
-
*/
|
|
61
|
-
export declare function upload<T = any>(url: string, file: File, onProgress?: (progress: number) => void, config?: RequestConfig): Promise<ApiResponse<T>>;
|
|
62
|
-
/**
|
|
63
|
-
* 下载文件
|
|
64
|
-
*/
|
|
65
|
-
export declare function download(url: string, filename?: string, config?: RequestConfig): Promise<void>;
|
|
66
|
-
export declare const request: AxiosInstance;
|
|
67
|
-
declare const _default: {
|
|
68
|
-
createRequest: typeof createRequest;
|
|
69
|
-
get: typeof get;
|
|
70
|
-
post: typeof post;
|
|
71
|
-
put: typeof put;
|
|
72
|
-
del: typeof del;
|
|
73
|
-
patch: typeof patch;
|
|
74
|
-
upload: typeof upload;
|
|
75
|
-
download: typeof download;
|
|
76
|
-
request: AxiosInstance;
|
|
77
|
-
};
|
|
78
|
-
export default _default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
declare function getUserInfo(userId: string): Promise<{
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
email: string;
|
|
5
|
-
} | undefined>;
|
|
6
|
-
declare function createUser(userData: {
|
|
7
|
-
name: string;
|
|
8
|
-
email: string;
|
|
9
|
-
password: string;
|
|
10
|
-
}): Promise<{
|
|
11
|
-
id: string;
|
|
12
|
-
name: string;
|
|
13
|
-
email: string;
|
|
14
|
-
} | undefined>;
|
|
15
|
-
declare function updateUser(userId: string, userData: {
|
|
16
|
-
name?: string;
|
|
17
|
-
email?: string;
|
|
18
|
-
}): Promise<{
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
email: string;
|
|
22
|
-
} | undefined>;
|
|
23
|
-
declare function deleteUser(userId: string): Promise<true | undefined>;
|
|
24
|
-
declare function updateUserProfile(userId: string, profileData: {
|
|
25
|
-
avatar?: string;
|
|
26
|
-
bio?: string;
|
|
27
|
-
}): Promise<{
|
|
28
|
-
id: string;
|
|
29
|
-
avatar: string;
|
|
30
|
-
bio: string;
|
|
31
|
-
} | undefined>;
|
|
32
|
-
declare function uploadAvatar(userId: string, file: File): Promise<{
|
|
33
|
-
url: string;
|
|
34
|
-
} | undefined>;
|
|
35
|
-
declare function downloadReport(reportId: string, filename?: string): Promise<void>;
|
|
36
|
-
declare function getProtectedData(): Promise<any>;
|
|
37
|
-
declare function handleErrors(): Promise<import("./request").ApiResponse<any> | undefined>;
|
|
38
|
-
declare function batchRequests(): Promise<import("./request").ApiResponse<any>[] | undefined>;
|
|
39
|
-
export { getUserInfo, createUser, updateUser, deleteUser, updateUserProfile, uploadAvatar, downloadReport, getProtectedData, handleErrors, batchRequests, };
|