@ai-group/chat-sdk 1.0.9 → 1.0.12

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.
Files changed (133) hide show
  1. package/dist/cjs/components/DislikeFeedback.js +79 -0
  2. package/dist/cjs/components/DislikeFeedback.js.map +7 -0
  3. package/dist/cjs/components/FeedbackTags.js +62 -0
  4. package/dist/cjs/components/FeedbackTags.js.map +7 -0
  5. package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.js +0 -16
  6. package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.js.map +2 -2
  7. package/dist/cjs/components/XAiChatbot/index.js +9 -9
  8. package/dist/cjs/components/XAiChatbot/index.js.map +2 -2
  9. package/dist/cjs/components/XAiChatbot/styles.js +1 -0
  10. package/dist/cjs/components/XAiChatbot/styles.js.map +2 -2
  11. package/dist/cjs/components/XAiProvider/XAiProvider.stories.js +2 -2
  12. package/dist/cjs/components/XAiProvider/XAiProvider.stories.js.map +1 -1
  13. package/dist/cjs/components/XAiProvider/index.js +142 -45
  14. package/dist/cjs/components/XAiProvider/index.js.map +3 -3
  15. package/dist/cjs/hooks/useAgentGenerator.js +378 -265
  16. package/dist/cjs/hooks/useAgentGenerator.js.map +3 -3
  17. package/dist/cjs/services/api.js +15 -0
  18. package/dist/cjs/services/api.js.map +2 -2
  19. package/dist/cjs/types/XAiChatbot.js.map +1 -1
  20. package/dist/cjs/types/XAiMessage.js.map +2 -2
  21. package/dist/cjs/types/node.js +18 -0
  22. package/dist/cjs/types/node.js.map +7 -0
  23. package/dist/cjs/utils/workflowNode.js +169 -0
  24. package/dist/cjs/utils/workflowNode.js.map +7 -0
  25. package/dist/esm/components/DislikeFeedback.js +97 -0
  26. package/dist/esm/components/DislikeFeedback.js.map +1 -0
  27. package/dist/esm/components/FeedbackTags.js +34 -0
  28. package/dist/esm/components/FeedbackTags.js.map +1 -0
  29. package/dist/esm/components/XAiChatbot/XAiChatbot.stories.js +0 -15
  30. package/dist/esm/components/XAiChatbot/XAiChatbot.stories.js.map +1 -1
  31. package/dist/esm/components/XAiChatbot/index.js +6 -22
  32. package/dist/esm/components/XAiChatbot/index.js.map +1 -1
  33. package/dist/esm/components/XAiChatbot/styles.js +1 -1
  34. package/dist/esm/components/XAiChatbot/styles.js.map +1 -1
  35. package/dist/esm/components/XAiProvider/XAiProvider.stories.js +2 -2
  36. package/dist/esm/components/XAiProvider/XAiProvider.stories.js.map +1 -1
  37. package/dist/esm/components/XAiProvider/index.js +215 -84
  38. package/dist/esm/components/XAiProvider/index.js.map +1 -1
  39. package/dist/esm/hooks/useAgentGenerator.js +543 -339
  40. package/dist/esm/hooks/useAgentGenerator.js.map +1 -1
  41. package/dist/esm/services/api.js +32 -0
  42. package/dist/esm/services/api.js.map +1 -1
  43. package/dist/esm/types/XAiChatbot.js.map +1 -1
  44. package/dist/esm/types/XAiMessage.js +0 -4
  45. package/dist/esm/types/XAiMessage.js.map +1 -1
  46. package/dist/esm/types/node.js +2 -0
  47. package/dist/esm/types/node.js.map +1 -0
  48. package/dist/esm/utils/workflowNode.js +141 -0
  49. package/dist/esm/utils/workflowNode.js.map +1 -0
  50. package/dist/umd/chat-sdk.min.js +1 -1
  51. package/package.json +16 -13
  52. package/dist/cjs/assets/svg/AddChatIcon.d.ts +0 -3
  53. package/dist/cjs/client/base.d.ts +0 -9
  54. package/dist/cjs/client/restClient.d.ts +0 -0
  55. package/dist/cjs/client/wsClient.d.ts +0 -0
  56. package/dist/cjs/components/XAiChatbot/XAiChatbot.stories.d.ts +0 -10
  57. package/dist/cjs/components/XAiChatbot/index.d.ts +0 -9
  58. package/dist/cjs/components/XAiChatbot/styles.d.ts +0 -67
  59. package/dist/cjs/components/XAiConversations/XAiConversations.stories.d.ts +0 -6
  60. package/dist/cjs/components/XAiConversations/index.d.ts +0 -4
  61. package/dist/cjs/components/XAiConversations/styles.d.ts +0 -49
  62. package/dist/cjs/components/XAiProvider/XAiProvider.stories.d.ts +0 -8
  63. package/dist/cjs/components/XAiProvider/demo.styles.d.ts +0 -37
  64. package/dist/cjs/components/XAiProvider/index.d.ts +0 -4
  65. package/dist/cjs/components/XAiSDK.d.ts +0 -10
  66. package/dist/cjs/components/XAiSender/XAiSender.stories.d.ts +0 -6
  67. package/dist/cjs/components/XAiSender/index.d.ts +0 -4
  68. package/dist/cjs/components/XAiSender/styles.d.ts +0 -47
  69. package/dist/cjs/components/XAiWebSDKWrapper.d.ts +0 -9
  70. package/dist/cjs/constants/index.d.ts +0 -2
  71. package/dist/cjs/context/AiProviderContext.d.ts +0 -14
  72. package/dist/cjs/context/ThemeContext.d.ts +0 -20
  73. package/dist/cjs/hooks/useAgentGenerator.d.ts +0 -89
  74. package/dist/cjs/hooks/useEventStreamRequest.d.ts +0 -30
  75. package/dist/cjs/hooks/useProviderContext.d.ts +0 -33
  76. package/dist/cjs/hooks/useXAiSDK.d.ts +0 -14
  77. package/dist/cjs/index.d.ts +0 -10
  78. package/dist/cjs/services/api.d.ts +0 -130
  79. package/dist/cjs/styles/common.d.ts +0 -73
  80. package/dist/cjs/styles/markdown.d.ts +0 -3
  81. package/dist/cjs/types/XAiChatbot.d.ts +0 -155
  82. package/dist/cjs/types/XAiConversations.d.ts +0 -20
  83. package/dist/cjs/types/XAiMessage.d.ts +0 -122
  84. package/dist/cjs/types/XAiProvider.d.ts +0 -347
  85. package/dist/cjs/types/XAiSender.d.ts +0 -13
  86. package/dist/cjs/types/index.d.ts +0 -5
  87. package/dist/cjs/utils/chat.d.ts +0 -34
  88. package/dist/cjs/utils/index.d.ts +0 -2
  89. package/dist/cjs/utils/providerManager.d.ts +0 -22
  90. package/dist/cjs/utils/request.d.ts +0 -78
  91. package/dist/cjs/utils/request.example.d.ts +0 -39
  92. package/dist/cjs/utils/umdEntry.d.ts +0 -26
  93. package/dist/esm/assets/svg/AddChatIcon.d.ts +0 -3
  94. package/dist/esm/client/base.d.ts +0 -9
  95. package/dist/esm/client/restClient.d.ts +0 -0
  96. package/dist/esm/client/wsClient.d.ts +0 -0
  97. package/dist/esm/components/XAiChatbot/XAiChatbot.stories.d.ts +0 -10
  98. package/dist/esm/components/XAiChatbot/index.d.ts +0 -9
  99. package/dist/esm/components/XAiChatbot/styles.d.ts +0 -67
  100. package/dist/esm/components/XAiConversations/XAiConversations.stories.d.ts +0 -6
  101. package/dist/esm/components/XAiConversations/index.d.ts +0 -4
  102. package/dist/esm/components/XAiConversations/styles.d.ts +0 -49
  103. package/dist/esm/components/XAiProvider/XAiProvider.stories.d.ts +0 -8
  104. package/dist/esm/components/XAiProvider/demo.styles.d.ts +0 -37
  105. package/dist/esm/components/XAiProvider/index.d.ts +0 -4
  106. package/dist/esm/components/XAiSDK.d.ts +0 -10
  107. package/dist/esm/components/XAiSender/XAiSender.stories.d.ts +0 -6
  108. package/dist/esm/components/XAiSender/index.d.ts +0 -4
  109. package/dist/esm/components/XAiSender/styles.d.ts +0 -47
  110. package/dist/esm/components/XAiWebSDKWrapper.d.ts +0 -9
  111. package/dist/esm/constants/index.d.ts +0 -2
  112. package/dist/esm/context/AiProviderContext.d.ts +0 -14
  113. package/dist/esm/context/ThemeContext.d.ts +0 -20
  114. package/dist/esm/hooks/useAgentGenerator.d.ts +0 -89
  115. package/dist/esm/hooks/useEventStreamRequest.d.ts +0 -30
  116. package/dist/esm/hooks/useProviderContext.d.ts +0 -33
  117. package/dist/esm/hooks/useXAiSDK.d.ts +0 -14
  118. package/dist/esm/index.d.ts +0 -10
  119. package/dist/esm/services/api.d.ts +0 -130
  120. package/dist/esm/styles/common.d.ts +0 -73
  121. package/dist/esm/styles/markdown.d.ts +0 -3
  122. package/dist/esm/types/XAiChatbot.d.ts +0 -155
  123. package/dist/esm/types/XAiConversations.d.ts +0 -20
  124. package/dist/esm/types/XAiMessage.d.ts +0 -122
  125. package/dist/esm/types/XAiProvider.d.ts +0 -347
  126. package/dist/esm/types/XAiSender.d.ts +0 -13
  127. package/dist/esm/types/index.d.ts +0 -5
  128. package/dist/esm/utils/chat.d.ts +0 -34
  129. package/dist/esm/utils/index.d.ts +0 -2
  130. package/dist/esm/utils/providerManager.d.ts +0 -22
  131. package/dist/esm/utils/request.d.ts +0 -78
  132. package/dist/esm/utils/request.example.d.ts +0 -39
  133. package/dist/esm/utils/umdEntry.d.ts +0 -26
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { type XAiConversationsProps } from "../../types/XAiConversations";
3
- declare const XAiConversations: React.FC<XAiConversationsProps>;
4
- export default XAiConversations;
@@ -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,8 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import XAiProvider from './index';
3
- declare const meta: Meta<typeof XAiProvider>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const 单聊天窗口实例: Story;
7
- export declare const 多容器示例: Story;
8
- export declare const 携带历史记录示例: Story;
@@ -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,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { XAiProviderProps, XAiProviderHandle } from "../../types/XAiProvider";
3
- declare const XAiProvider: import("react").ForwardRefExoticComponent<XAiProviderProps & import("react").RefAttributes<XAiProviderHandle>>;
4
- export default XAiProvider;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { XAiProviderProps } from "../types/XAiProvider";
3
- export interface XAiSDKProps extends XAiProviderProps {
4
- width?: string | number;
5
- height?: string | number;
6
- className?: string;
7
- style?: React.CSSProperties;
8
- }
9
- declare const XAiSDK: React.FC<XAiSDKProps>;
10
- export default XAiSDK;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import XAiSender from '.';
3
- declare const meta: Meta<typeof XAiSender>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const 基础用法: Story;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { XAiSenderProps } from "../../types";
3
- declare const XAiSender: React.FC<XAiSenderProps>;
4
- export default XAiSender;
@@ -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,9 +0,0 @@
1
- import React from 'react';
2
- import { XAiSDKProps } from "../types/XAiProvider";
3
- import XAiWebSDK from "../utils/umdEntry";
4
- export interface XAiWebSDKWrapperProps extends XAiSDKProps {
5
- onInit?: (sdk: XAiWebSDK) => void;
6
- onDestroy?: () => void;
7
- }
8
- declare const XAiWebSDKWrapper: React.FC<XAiWebSDKWrapperProps>;
9
- export default XAiWebSDKWrapper;
@@ -1,2 +0,0 @@
1
- export declare const SESSION_PAGE_SIZE = 50;
2
- export declare const MOBILE_MAX_WIDTH = 760;
@@ -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,89 +0,0 @@
1
- /// <reference types="react" />
2
- import { Messages } from "../types/XAiMessage";
3
- import { Error, Success, sessionData } from "../types";
4
- export type ContentType = 'TEXT' | 'IMAGE' | 'FILE';
5
- export interface ImageUrl {
6
- url: string;
7
- name: string;
8
- }
9
- export interface FileUrl {
10
- url: string;
11
- fileName: string;
12
- suffix: string;
13
- }
14
- export interface Content {
15
- text?: string;
16
- imageUrl?: ImageUrl;
17
- fileUrl?: FileUrl;
18
- }
19
- export interface ContentDef {
20
- description: string;
21
- contentType: ContentType;
22
- content: Content;
23
- }
24
- export type Contents = ContentDef[];
25
- export declare enum ActionType {
26
- recallKnowledgeStart = "RECALL_KNOWLEDGE_START",// 知识库召回开始
27
- recallKnowledgeEnd = "RECALL_KNOWLEDGE_END",// 知识库召回结束
28
- invokeToolStart = "INVOKE_AGENT_TOOL_START",// 开始调用工具
29
- invokeToolEnd = "INVOKE_AGENT_TOOL_END",// 调用工具完成
30
- reasoning = "REASONING",// 思考过程
31
- reasoningEnd = "REASONING_END",// 思考结束
32
- suggest = "FOLLOW_UP",// 用户提示
33
- response = "RESPONSE",// 响应
34
- finish = "FINISHED"
35
- }
36
- export declare enum ProcessStatus {
37
- start = "START",
38
- end = "END"
39
- }
40
- export declare enum ActionAvailability {
41
- disabled = "disabled",// 不可用
42
- enabled = "enabled",// 可用
43
- remote = "remote"
44
- }
45
- export type ThinkStep = any;
46
- /**
47
- * 工具/动作定义
48
- */
49
- export interface Action {
50
- name: string;
51
- description: string;
52
- jsonSchema: string;
53
- available?: ActionAvailability;
54
- error?: Error;
55
- }
56
- export interface UseAgentGeneratorProps {
57
- url: string;
58
- token: string;
59
- config: any;
60
- onError?: (error: Error) => void;
61
- onSuccess?: (data: Success) => void;
62
- onMessage?: (content: string, data: Messages) => void;
63
- }
64
- declare const useAgentGenerator: ({ url, token, config, onError, onMessage, onSuccess, }: UseAgentGeneratorProps) => {
65
- appInfo: any;
66
- messages: Messages[];
67
- loading: boolean;
68
- content: any;
69
- sessionList: sessionData[];
70
- currentSessionId: string;
71
- sessionPagination: {
72
- total: number;
73
- pageNum: number;
74
- pageSize: number;
75
- };
76
- initAppConversations: (fetchDetail?: boolean) => Promise<void>;
77
- reChat: () => void;
78
- chat: (content: any) => Promise<void>;
79
- createNewChat: () => void;
80
- setCurrentSessionId: import("react").Dispatch<import("react").SetStateAction<string>>;
81
- setCurrentSessionDetail: (sessionId: string) => Promise<void>;
82
- updateSession: (sessionId: string, title: string) => Promise<void>;
83
- deleteSession: (sessionId: string) => Promise<void>;
84
- setMessage: (messageType: string, content: any) => Promise<void>;
85
- setMessages: import("react").Dispatch<import("react").SetStateAction<Messages[]>>;
86
- stopChat: () => void;
87
- initPrologue: () => Promise<void>;
88
- };
89
- export default useAgentGenerator;
@@ -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,14 +0,0 @@
1
- import React from 'react';
2
- import { XAiProviderProps } from "../types/XAiProvider";
3
- export interface UseXAiSDKOptions extends XAiProviderProps {
4
- containerId?: string;
5
- width?: string | number;
6
- height?: string | number;
7
- className?: string;
8
- style?: React.CSSProperties;
9
- }
10
- export declare const useXAiSDK: (options: UseXAiSDKOptions) => {
11
- containerRef: React.RefObject<HTMLDivElement | null>;
12
- render: () => import("react/jsx-runtime").JSX.Element;
13
- };
14
- export default useXAiSDK;
@@ -1,10 +0,0 @@
1
- import { useXAi } from './context/AiProviderContext';
2
- import XAiProvider from './components/XAiProvider';
3
- import XAiChatbot from './components/XAiChatbot';
4
- import XAiSDK from './components/XAiSDK';
5
- import XAiWebSDKWrapper from './components/XAiWebSDKWrapper';
6
- import XAiSender from './components/XAiSender';
7
- import useXAiSDK from './hooks/useXAiSDK';
8
- import request from './utils/request';
9
- export * from './types';
10
- export { useXAi, XAiProvider, XAiChatbot, XAiSDK, XAiWebSDKWrapper, XAiSender, useXAiSDK, request, };
@@ -1,130 +0,0 @@
1
- export interface ServerApiResponse<T = unknown> {
2
- data: T;
3
- code: string;
4
- success: boolean;
5
- message: string;
6
- serverTime: number;
7
- traceId: string;
8
- }
9
- export interface ApiResponse<T> {
10
- success: boolean;
11
- data: T;
12
- message?: string;
13
- code: string;
14
- }
15
- export interface ChatConfig {
16
- botNo: string;
17
- appNo: string;
18
- appName: string;
19
- appTheme: string;
20
- description: string;
21
- icon: string;
22
- onboardingInfo: {
23
- prologue: string;
24
- suggested_questions: string[];
25
- };
26
- appVersionNo: string;
27
- publishDTO: {
28
- id: number;
29
- tenantId: string;
30
- botNo: string;
31
- publishNo: string;
32
- publishTime: string;
33
- publishVersionNo: string;
34
- publishVersionDesc: string;
35
- publishAppType: string;
36
- platformConfigInfo: string;
37
- appNo: string;
38
- appVersionNo: string;
39
- gmtCreated: string;
40
- enableFlag: number;
41
- gmtModified: string;
42
- creator: string;
43
- modifier: string;
44
- isDeleted: string;
45
- authLoginInfoDTO: Record<string, unknown>;
46
- shareLink: string;
47
- };
48
- }
49
- export interface sessionData {
50
- data: {
51
- sessionId: string;
52
- gmtCreated: string;
53
- userId: string;
54
- title: string;
55
- botNo: string;
56
- appNo: string;
57
- }[];
58
- pageNum: number;
59
- pageSize: number;
60
- totalCount: number;
61
- }
62
- /**
63
- * 获取聊天配置
64
- * 使用request,会自动添加token
65
- */
66
- export declare const fetchAppConfig: ({ url, appNo, pt, tc }: {
67
- url: string;
68
- appNo: string;
69
- pt: string;
70
- tc: string;
71
- }) => Promise<ApiResponse<ChatConfig>>;
72
- /**
73
- * 发送消息
74
- * 使用request,会自动添加token
75
- */
76
- export declare const sendMessage: ({ url, appNo, pt, tc, msg }: {
77
- url: string;
78
- appNo: string;
79
- pt: string;
80
- tc: string;
81
- msg: string;
82
- }) => Promise<ApiResponse<ChatConfig>>;
83
- /**
84
- * 获取会话列表
85
- */
86
- export declare const fetchSessionList: ({ url, appNo, pt, tc, pageSize, pageNum, token }: {
87
- url: string;
88
- appNo: string;
89
- pt: string;
90
- tc: string;
91
- pageSize?: number | undefined;
92
- pageNum?: number | undefined;
93
- token: string;
94
- }) => Promise<ApiResponse<sessionData>>;
95
- /**
96
- * 获取会话明细
97
- */
98
- export declare const fetchSessionDetail: ({ url, appNo, pt, tc, sessionId, pageSize, pageNum, token }: {
99
- url: string;
100
- appNo: string;
101
- pt: string;
102
- tc: string;
103
- sessionId: string;
104
- pageSize?: number | undefined;
105
- pageNum?: number | undefined;
106
- token: string;
107
- }) => Promise<ApiResponse<sessionData[]>>;
108
- /**
109
- * 删除会话
110
- */
111
- export declare const delSessionId: ({ url, appNo, pt, tc, sessionId, token }: {
112
- url: string;
113
- appNo: string;
114
- pt: string;
115
- tc: string;
116
- sessionId: string;
117
- token: string;
118
- }) => Promise<ApiResponse<boolean>>;
119
- /**
120
- * 修改会话标题
121
- */
122
- export declare const updateSessionTitle: ({ url, appNo, pt, tc, sessionId, title, token }: {
123
- url: string;
124
- appNo: string;
125
- pt: string;
126
- tc: string;
127
- sessionId: string;
128
- title: string;
129
- token: string;
130
- }) => Promise<ApiResponse<boolean>>;
@@ -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,3 +0,0 @@
1
- import React from 'react';
2
- declare const MarkdownGlobalStyle: React.FC;
3
- export default MarkdownGlobalStyle;