@ibiz-template-plugin/ai-chat 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1915 -1282
- package/dist/index.legacy.js +1 -1
- package/dist/polyfills.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/app.d.ts +1 -0
- package/dist/types/components/chat-container/chat-container.d.ts +213 -0
- package/dist/types/components/chat-input/chat-input.d.ts +22 -0
- package/dist/types/components/chat-input-material/chat-input-material.d.ts +12 -0
- package/dist/types/components/chat-input-material-item/chat-input-material-item.d.ts +30 -0
- package/dist/types/components/chat-input-material-item/common-material/common-material.d.ts +8 -0
- package/dist/types/components/chat-input-material-item/ossfile-material/ossfile-material.d.ts +7 -0
- package/dist/types/components/chat-message-item/chat-message-item.d.ts +30 -0
- package/dist/types/components/chat-message-item/error-message/error-message.d.ts +30 -0
- package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +30 -0
- package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +13 -0
- package/dist/types/components/chat-message-item/user-message/user-message.d.ts +23 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +20 -0
- package/dist/types/components/chat-thought-chain/chat-thought-chain.d.ts +10 -0
- package/dist/types/components/chat-toolbar/chat-toolbar.d.ts +41 -0
- package/dist/types/components/chat-topic-item/chat-topic-item.d.ts +9 -0
- package/dist/types/components/chat-topics/chat-topics.d.ts +12 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/popup/popup.d.ts +16 -0
- package/dist/types/constants/index.d.ts +22 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +203 -0
- package/dist/types/controller/ai-material/ai-material-factory.d.ts +6 -0
- package/dist/types/controller/ai-material/common-helper.d.ts +12 -0
- package/dist/types/controller/ai-material/file-helper.d.ts +21 -0
- package/dist/types/controller/ai-material/material-helper.d.ts +15 -0
- package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +96 -0
- package/dist/types/controller/chat/chat.controller.d.ts +122 -0
- package/dist/types/controller/index.d.ts +4 -0
- package/dist/types/entity/chart-material/chart-material.d.ts +9 -0
- package/dist/types/entity/chart-topic/chart-topic.d.ts +20 -0
- package/dist/types/entity/chat-message/chat-message.d.ts +37 -0
- package/dist/types/entity/index.d.ts +3 -0
- package/dist/types/global.d.ts +2 -0
- package/dist/types/icons/ai-svg.d.ts +1 -0
- package/dist/types/icons/audio-svg.d.ts +1 -0
- package/dist/types/icons/checkmark-circle-svg.d.ts +3 -0
- package/dist/types/icons/chevron-down-svg.d.ts +3 -0
- package/dist/types/icons/close-full-screen-svg.d.ts +1 -0
- package/dist/types/icons/close-svg.d.ts +1 -0
- package/dist/types/icons/copy-svg.d.ts +1 -0
- package/dist/types/icons/default-material-svg.d.ts +1 -0
- package/dist/types/icons/delete-svg.d.ts +1 -0
- package/dist/types/icons/fill-svg.d.ts +1 -0
- package/dist/types/icons/full-screen-svg.d.ts +1 -0
- package/dist/types/icons/index.d.ts +23 -0
- package/dist/types/icons/link-svg.d.ts +3 -0
- package/dist/types/icons/loading-svg.d.ts +3 -0
- package/dist/types/icons/material-remove-svg.d.ts +1 -0
- package/dist/types/icons/minimize-svg.d.ts +1 -0
- package/dist/types/icons/more-svg.d.ts +4 -0
- package/dist/types/icons/new-dialogue.d.ts +1 -0
- package/dist/types/icons/paperclip-svg.d.ts +1 -0
- package/dist/types/icons/recording-svg.d.ts +1 -0
- package/dist/types/icons/refresh-svg.d.ts +1 -0
- package/dist/types/icons/remove-svg.d.ts +1 -0
- package/dist/types/icons/send-svg.d.ts +1 -0
- package/dist/types/icons/upload-svg.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +66 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +91 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +156 -0
- package/dist/types/interface/i-chat-thought-chain/i-chat-thought-chain.d.ts +35 -0
- package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +62 -0
- package/dist/types/interface/i-config-service/i-config-service.d.ts +27 -0
- package/dist/types/interface/i-container-options/i-container-options.d.ts +45 -0
- package/dist/types/interface/i-file-uploader-options/i-file-uploader-options.d.ts +27 -0
- package/dist/types/interface/i-material/i-material.d.ts +34 -0
- package/dist/types/interface/i-message-item-provider/i-message-item-provider.d.ts +18 -0
- package/dist/types/interface/i-portal-async-action/i-portal-async-action.d.ts +90 -0
- package/dist/types/interface/i-topic-options/i-topic-options.d.ts +102 -0
- package/dist/types/interface/index.d.ts +11 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
- package/dist/types/utils/util/file-uploader.d.ts +36 -0
- package/dist/types/utils/util/indexdb-util.d.ts +91 -0
- package/dist/types/utils/util/material-resource-parser.d.ts +66 -0
- package/dist/types/utils/util/util.d.ts +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Component } from 'preact';
|
|
2
|
+
import { Namespace } from '../../utils';
|
|
3
|
+
import { AiChatController, AiTopicController } from '../../controller';
|
|
4
|
+
import { IChatToolbarItem, IChatContainerOptions } from '../../interface';
|
|
5
|
+
export interface ChatContainerProps {
|
|
6
|
+
/**
|
|
7
|
+
* 呈现模式
|
|
8
|
+
*
|
|
9
|
+
* @author tony001
|
|
10
|
+
* @date 2025-02-23 16:02:00
|
|
11
|
+
* @type {('DEFAULT' | 'TOPIC')}
|
|
12
|
+
*/
|
|
13
|
+
mode: 'DEFAULT' | 'TOPIC';
|
|
14
|
+
/**
|
|
15
|
+
* ai话题控制器
|
|
16
|
+
*
|
|
17
|
+
* @author tony001
|
|
18
|
+
* @date 2025-02-23 16:02:38
|
|
19
|
+
* @type {AiTopicController}
|
|
20
|
+
*/
|
|
21
|
+
aiTopic: AiTopicController;
|
|
22
|
+
/**
|
|
23
|
+
* 聊天控制器
|
|
24
|
+
*
|
|
25
|
+
* @author tony001
|
|
26
|
+
* @date 2025-02-23 16:02:24
|
|
27
|
+
* @type {AiChatController}
|
|
28
|
+
*/
|
|
29
|
+
aiChat: AiChatController;
|
|
30
|
+
/**
|
|
31
|
+
* 关闭聊天窗口
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2023-10-15 19:10:35
|
|
35
|
+
*/
|
|
36
|
+
close: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* 全屏行为
|
|
39
|
+
*
|
|
40
|
+
* @memberof ChatContainerProps
|
|
41
|
+
*/
|
|
42
|
+
fullscreen: (target: boolean) => void;
|
|
43
|
+
/**
|
|
44
|
+
* 最小化行为
|
|
45
|
+
*
|
|
46
|
+
* @memberof ChatContainerProps
|
|
47
|
+
*/
|
|
48
|
+
minimize: (target: boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* 标题
|
|
51
|
+
*
|
|
52
|
+
* @type {string}
|
|
53
|
+
* @memberof ChatContainerProps
|
|
54
|
+
*/
|
|
55
|
+
caption?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 内容工具项
|
|
58
|
+
*
|
|
59
|
+
* @type {IChatToolbarItem[]}
|
|
60
|
+
* @memberof ChatContainerProps
|
|
61
|
+
*/
|
|
62
|
+
contentToolbarItems?: IChatToolbarItem[];
|
|
63
|
+
/**
|
|
64
|
+
* 底部工具项
|
|
65
|
+
*
|
|
66
|
+
* @type {IChatToolbarItem[]}
|
|
67
|
+
* @memberof ChatContainerProps
|
|
68
|
+
*/
|
|
69
|
+
footerToolbarItems?: IChatToolbarItem[];
|
|
70
|
+
/**
|
|
71
|
+
* 提问区工具栏
|
|
72
|
+
*
|
|
73
|
+
* @author tony001
|
|
74
|
+
* @date 2025-02-28 16:02:51
|
|
75
|
+
* @type {IChatToolbarItem[]}
|
|
76
|
+
*/
|
|
77
|
+
questionToolbarItems?: IChatToolbarItem[];
|
|
78
|
+
/**
|
|
79
|
+
* AI容器呈现
|
|
80
|
+
*
|
|
81
|
+
* @author tony001
|
|
82
|
+
* @date 2025-03-03 16:03:06
|
|
83
|
+
* @type {IChatContainerOptions}
|
|
84
|
+
*/
|
|
85
|
+
containerOptions?: IChatContainerOptions;
|
|
86
|
+
}
|
|
87
|
+
interface ChatContainerState {
|
|
88
|
+
/**
|
|
89
|
+
* 全屏状态
|
|
90
|
+
*
|
|
91
|
+
* @author ljx
|
|
92
|
+
* @date 2024-05-07 15:10:31
|
|
93
|
+
*/
|
|
94
|
+
isFullScreen: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* 最小化
|
|
97
|
+
*
|
|
98
|
+
* @type {boolean}
|
|
99
|
+
* @memberof ChatContainerState
|
|
100
|
+
*/
|
|
101
|
+
isMinimize: boolean;
|
|
102
|
+
}
|
|
103
|
+
interface ContainerContext {
|
|
104
|
+
zIndex: number;
|
|
105
|
+
}
|
|
106
|
+
export declare const ContainerContext: import("preact").Context<ContainerContext>;
|
|
107
|
+
/**
|
|
108
|
+
* 聊天窗口容器,可拖拽,可缩放
|
|
109
|
+
*
|
|
110
|
+
* @author chitanda
|
|
111
|
+
* @date 2023-10-13 17:10:37
|
|
112
|
+
* @export
|
|
113
|
+
* @class ChatContainer
|
|
114
|
+
* @extends {Component<ChatContainerProps>}
|
|
115
|
+
*/
|
|
116
|
+
export declare class ChatContainer extends Component<ChatContainerProps, ChatContainerState> {
|
|
117
|
+
constructor(props: ChatContainerProps | undefined);
|
|
118
|
+
ns: Namespace;
|
|
119
|
+
containerRef: import("preact").RefObject<HTMLDivElement>;
|
|
120
|
+
dragHandle: import("preact").RefObject<HTMLDivElement>;
|
|
121
|
+
minimizeRef: import("preact").RefObject<HTMLDivElement>;
|
|
122
|
+
data: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
minWidth: number;
|
|
128
|
+
minHeight: number;
|
|
129
|
+
};
|
|
130
|
+
minimizeData: {
|
|
131
|
+
x: number;
|
|
132
|
+
y: number;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 是否禁止拖动
|
|
136
|
+
* - 拖拽边时应禁止拖动
|
|
137
|
+
* @type {boolean}
|
|
138
|
+
* @memberof ChatContainer
|
|
139
|
+
*/
|
|
140
|
+
disabled: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* 最小化是否在拖拽中
|
|
143
|
+
* - 在拖拽时不应触发点击事件
|
|
144
|
+
* @type {boolean}
|
|
145
|
+
* @memberof ChatContainer
|
|
146
|
+
*/
|
|
147
|
+
isDragging: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* 容器上下文
|
|
150
|
+
*
|
|
151
|
+
* @author tony001
|
|
152
|
+
* @date 2025-03-03 16:03:44
|
|
153
|
+
* @type {ContainerContext}
|
|
154
|
+
*/
|
|
155
|
+
containerContext: ContainerContext;
|
|
156
|
+
calcWindowStyle(): {
|
|
157
|
+
left: string;
|
|
158
|
+
top: string;
|
|
159
|
+
height: string;
|
|
160
|
+
width: string;
|
|
161
|
+
'z-index': string;
|
|
162
|
+
};
|
|
163
|
+
calcMinimizeStyle(): {
|
|
164
|
+
left: string;
|
|
165
|
+
top: string;
|
|
166
|
+
'z-index': string;
|
|
167
|
+
};
|
|
168
|
+
setStyle(): void;
|
|
169
|
+
componentDidMount(): void;
|
|
170
|
+
componentWillUnmount(): void;
|
|
171
|
+
/**
|
|
172
|
+
* 关闭聊天窗口
|
|
173
|
+
*
|
|
174
|
+
* @author chitanda
|
|
175
|
+
* @date 2023-10-15 19:10:31
|
|
176
|
+
*/
|
|
177
|
+
close(): void;
|
|
178
|
+
/**
|
|
179
|
+
* 全屏
|
|
180
|
+
*
|
|
181
|
+
* @author ljx
|
|
182
|
+
* @date 2024-05-07 15:10:31
|
|
183
|
+
*/
|
|
184
|
+
fullScreen(): void;
|
|
185
|
+
/**
|
|
186
|
+
* 关闭全屏
|
|
187
|
+
*
|
|
188
|
+
* @author ljx
|
|
189
|
+
* @date 2024-05-07 15:10:31
|
|
190
|
+
*/
|
|
191
|
+
closeFullScreen(): void;
|
|
192
|
+
/**
|
|
193
|
+
* 最小化
|
|
194
|
+
*
|
|
195
|
+
* @memberof ChatContainer
|
|
196
|
+
*/
|
|
197
|
+
minimize(): void;
|
|
198
|
+
/**
|
|
199
|
+
* 退出最小化
|
|
200
|
+
*
|
|
201
|
+
* @memberof ChatContainer
|
|
202
|
+
*/
|
|
203
|
+
exitMinimize(): void;
|
|
204
|
+
/**
|
|
205
|
+
* 阻止冒泡
|
|
206
|
+
* - 防止点击头部行为时误触发拖动监听
|
|
207
|
+
* @param {MouseEvent} evt
|
|
208
|
+
* @memberof ChatContainer
|
|
209
|
+
*/
|
|
210
|
+
stopPropagation(evt: MouseEvent): void;
|
|
211
|
+
render(): import("preact").JSX.Element;
|
|
212
|
+
}
|
|
213
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { AiChatController } from '../../controller';
|
|
3
|
+
import { IChatToolbarItem } from '../../interface';
|
|
4
|
+
export interface ChatInputProps {
|
|
5
|
+
/**
|
|
6
|
+
* 单实例聊天总控
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-10-13 17:10:43
|
|
10
|
+
* @type {AiChatController}
|
|
11
|
+
*/
|
|
12
|
+
controller: AiChatController;
|
|
13
|
+
/**
|
|
14
|
+
* 提问区交互工具栏
|
|
15
|
+
*
|
|
16
|
+
* @author tony001
|
|
17
|
+
* @date 2025-02-28 16:02:58
|
|
18
|
+
* @type {IChatToolbarItem[]}
|
|
19
|
+
*/
|
|
20
|
+
questionToolbarItems?: IChatToolbarItem[];
|
|
21
|
+
}
|
|
22
|
+
export declare const ChatInput: (props: ChatInputProps) => h.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiChatController } from '../../controller';
|
|
2
|
+
export interface ChatInputMaterialProps {
|
|
3
|
+
/**
|
|
4
|
+
* 聊天实例
|
|
5
|
+
*
|
|
6
|
+
* @author tony001
|
|
7
|
+
* @date 2025-02-27 17:02:50
|
|
8
|
+
* @type {AiChatController}
|
|
9
|
+
*/
|
|
10
|
+
controller: AiChatController;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChatInputMaterial: (props: ChatInputMaterialProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { AiChatController } from '../../controller';
|
|
3
|
+
import { IMaterial } from '../../interface';
|
|
4
|
+
export interface ChatInputMaterialtemProps {
|
|
5
|
+
/**
|
|
6
|
+
* 聊天控制器
|
|
7
|
+
*
|
|
8
|
+
* @author tony001
|
|
9
|
+
* @date 2025-02-28 15:02:04
|
|
10
|
+
* @type {AiChatController}
|
|
11
|
+
*/
|
|
12
|
+
controller: AiChatController;
|
|
13
|
+
/**
|
|
14
|
+
* 素材对象
|
|
15
|
+
*
|
|
16
|
+
* @author tony001
|
|
17
|
+
* @date 2025-02-28 15:02:45
|
|
18
|
+
* @type {IMaterial}
|
|
19
|
+
*/
|
|
20
|
+
material: IMaterial;
|
|
21
|
+
/**
|
|
22
|
+
* 禁用状态
|
|
23
|
+
*
|
|
24
|
+
* @author tony001
|
|
25
|
+
* @date 2025-03-03 14:03:26
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
*/
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const ChatInputMaterialtem: (props: ChatInputMaterialtemProps) => h.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { AiChatController } from '../../../controller';
|
|
3
|
+
import { IMaterial } from '../../../interface';
|
|
4
|
+
export interface CommonMaterialProps {
|
|
5
|
+
controller: AiChatController;
|
|
6
|
+
material: IMaterial;
|
|
7
|
+
}
|
|
8
|
+
export declare const CommonMaterial: (props: CommonMaterialProps) => h.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AiChatController } from '../../../controller';
|
|
2
|
+
import { IMaterial } from '../../../interface';
|
|
3
|
+
export interface OssfileMaterialProps {
|
|
4
|
+
controller: AiChatController;
|
|
5
|
+
material: IMaterial;
|
|
6
|
+
}
|
|
7
|
+
export declare const OssfileMaterial: (props: OssfileMaterialProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { VNode, h } from 'preact';
|
|
2
|
+
import { IChatMessage } from '../../interface';
|
|
3
|
+
import { AiChatController } from '../../controller';
|
|
4
|
+
export interface ChatMessageItemProps {
|
|
5
|
+
/**
|
|
6
|
+
* 单实例聊天总控
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-10-13 17:10:43
|
|
10
|
+
* @type {AiChatController}
|
|
11
|
+
*/
|
|
12
|
+
controller: AiChatController;
|
|
13
|
+
message: IChatMessage;
|
|
14
|
+
/**
|
|
15
|
+
* 内容大小,用于更新绘制
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-10-15 21:10:22
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
size: number;
|
|
22
|
+
/**
|
|
23
|
+
* 插槽
|
|
24
|
+
*
|
|
25
|
+
* @type {VNode}
|
|
26
|
+
* @memberof ChatMessageItemProps
|
|
27
|
+
*/
|
|
28
|
+
children: VNode;
|
|
29
|
+
}
|
|
30
|
+
export declare const ChatMessageItem: (props: ChatMessageItemProps) => h.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
import { IChatMessage } from '../../../interface';
|
|
3
|
+
import { AiChatController } from '../../../controller';
|
|
4
|
+
export interface ErrorMessageProps {
|
|
5
|
+
/**
|
|
6
|
+
* 单实例聊天总控
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-10-13 17:10:43
|
|
10
|
+
* @type {AiChatController}
|
|
11
|
+
*/
|
|
12
|
+
controller: AiChatController;
|
|
13
|
+
message: IChatMessage;
|
|
14
|
+
/**
|
|
15
|
+
* 内容大小,用于更新绘制
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-10-15 21:10:22
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
size: number;
|
|
22
|
+
/**
|
|
23
|
+
* 工具栏
|
|
24
|
+
*
|
|
25
|
+
* @type {VNode[]}
|
|
26
|
+
* @memberof ErrorMessageProps
|
|
27
|
+
*/
|
|
28
|
+
children: VNode;
|
|
29
|
+
}
|
|
30
|
+
export declare const ErrorMessage: (props: ErrorMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
import { IChatMessage } from '../../../interface';
|
|
3
|
+
import { AiChatController } from '../../../controller';
|
|
4
|
+
export interface MarkdownMessageProps {
|
|
5
|
+
/**
|
|
6
|
+
* 单实例聊天总控
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-10-13 17:10:43
|
|
10
|
+
* @type {AiChatController}
|
|
11
|
+
*/
|
|
12
|
+
controller: AiChatController;
|
|
13
|
+
message: IChatMessage;
|
|
14
|
+
/**
|
|
15
|
+
* 内容大小,用于更新绘制
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-10-15 21:10:22
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
size: number;
|
|
22
|
+
/**
|
|
23
|
+
* 工具栏
|
|
24
|
+
*
|
|
25
|
+
* @type {VNode}
|
|
26
|
+
* @memberof MarkdownMessageProps
|
|
27
|
+
*/
|
|
28
|
+
children: VNode;
|
|
29
|
+
}
|
|
30
|
+
export declare const MarkdownMessage: (props: MarkdownMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IChatMessage } from '../../../interface';
|
|
2
|
+
export interface UnknownMessageProps {
|
|
3
|
+
message: IChatMessage;
|
|
4
|
+
/**
|
|
5
|
+
* 内容大小,用于更新绘制
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-10-15 21:10:22
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const UnknownMessage: (props: UnknownMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
import { IChatMessage } from '../../../interface';
|
|
3
|
+
import { AiChatController } from '../../../controller';
|
|
4
|
+
export interface UserMessageProps {
|
|
5
|
+
controller: AiChatController;
|
|
6
|
+
message: IChatMessage;
|
|
7
|
+
/**
|
|
8
|
+
* 内容大小,用于更新绘制
|
|
9
|
+
*
|
|
10
|
+
* @author chitanda
|
|
11
|
+
* @date 2023-10-15 21:10:22
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
size: number;
|
|
15
|
+
/**
|
|
16
|
+
* 工具栏
|
|
17
|
+
*
|
|
18
|
+
* @type {VNode}
|
|
19
|
+
* @memberof UserMessageProps
|
|
20
|
+
*/
|
|
21
|
+
children: VNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const UserMessage: (props: UserMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AiChatController } from '../../controller';
|
|
2
|
+
import { IChatToolbarItem } from '../../interface';
|
|
3
|
+
export interface ChatMessageProps {
|
|
4
|
+
/**
|
|
5
|
+
* 单实例聊天总控
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-10-13 17:10:43
|
|
9
|
+
* @type {AiChatController}
|
|
10
|
+
*/
|
|
11
|
+
controller: AiChatController;
|
|
12
|
+
/**
|
|
13
|
+
* 工具项集合
|
|
14
|
+
*
|
|
15
|
+
* @type {IChatToolbarItem[]}
|
|
16
|
+
* @memberof ChatMessageProps
|
|
17
|
+
*/
|
|
18
|
+
toolbarItems?: IChatToolbarItem[];
|
|
19
|
+
}
|
|
20
|
+
export declare const ChatMessages: (props: ChatMessageProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IChatThoughtChain } from '../../interface';
|
|
2
|
+
export interface ChatThoughtChainProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description AI聊天思维链
|
|
5
|
+
* @type {IChatThoughtChain[]}
|
|
6
|
+
* @memberof ChatThoughtChainProps
|
|
7
|
+
*/
|
|
8
|
+
items: IChatThoughtChain[];
|
|
9
|
+
}
|
|
10
|
+
export declare const ChatThoughtChain: (props: ChatThoughtChainProps) => import("preact").JSX.Element | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { IChatToolbarItem } from '../../interface';
|
|
3
|
+
import { AiChatController } from '../../controller';
|
|
4
|
+
export interface ChatToolbarProps {
|
|
5
|
+
/**
|
|
6
|
+
* 单实例聊天总控
|
|
7
|
+
*
|
|
8
|
+
* @type {AiChatController}
|
|
9
|
+
* @memberof ChatToolbarProps
|
|
10
|
+
*/
|
|
11
|
+
controller: AiChatController;
|
|
12
|
+
/**
|
|
13
|
+
* 用户自定义工具项集合
|
|
14
|
+
*
|
|
15
|
+
* @type {IChatToolbarItem}
|
|
16
|
+
* @memberof ChatToolbarProps
|
|
17
|
+
*/
|
|
18
|
+
items?: IChatToolbarItem[];
|
|
19
|
+
/**
|
|
20
|
+
* 业务数据
|
|
21
|
+
*
|
|
22
|
+
* @type {*}
|
|
23
|
+
* @memberof ChatToolbarProps
|
|
24
|
+
*/
|
|
25
|
+
data: any;
|
|
26
|
+
/**
|
|
27
|
+
* 工具栏类型
|
|
28
|
+
*
|
|
29
|
+
* @type {('content' | 'footer')}
|
|
30
|
+
* @memberof ChatToolbarProps
|
|
31
|
+
*/
|
|
32
|
+
type: 'content' | 'footer';
|
|
33
|
+
/**
|
|
34
|
+
* 类名
|
|
35
|
+
*
|
|
36
|
+
* @type {string}
|
|
37
|
+
* @memberof ChatToolbarProps
|
|
38
|
+
*/
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const ChatToolbar: (props: ChatToolbarProps) => h.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChatTopic } from '../../entity';
|
|
2
|
+
export interface ChatTopicItemProps {
|
|
3
|
+
current: boolean;
|
|
4
|
+
active: boolean;
|
|
5
|
+
topic: ChatTopic;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
onAction: (action: string, event: MouseEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ChatTopicItem: (props: ChatTopicItemProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiTopicController } from '../../controller';
|
|
2
|
+
export interface ChatTopicProps {
|
|
3
|
+
/**
|
|
4
|
+
* 话题控制器
|
|
5
|
+
*
|
|
6
|
+
* @author tony001
|
|
7
|
+
* @date 2025-02-20 17:02:49
|
|
8
|
+
* @type {AiTopicController}
|
|
9
|
+
*/
|
|
10
|
+
controller: AiTopicController;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChatTopics: (props: ChatTopicProps) => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatContainer } from './chat-container/chat-container';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type Position = 'top' | 'bottom' | 'left' | 'right' | 'top-left';
|
|
2
|
+
interface ActionItem {
|
|
3
|
+
id: string;
|
|
4
|
+
caption: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Popup: ({ children, actions, content, position, isOpen: isOpenProp, onToggleOpen, onAction, }: {
|
|
8
|
+
children: import('preact').ComponentChildren;
|
|
9
|
+
actions?: ActionItem[] | undefined;
|
|
10
|
+
content?: import('preact').ComponentChildren;
|
|
11
|
+
position?: Position | undefined;
|
|
12
|
+
isOpen?: boolean | undefined;
|
|
13
|
+
onToggleOpen?: ((isOpen: boolean) => void) | undefined;
|
|
14
|
+
onAction?: ((actionId: string, event: MouseEvent) => void) | undefined;
|
|
15
|
+
}) => import("preact").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum AIChatConst {
|
|
2
|
+
/**
|
|
3
|
+
* 聊天窗口样式缓存
|
|
4
|
+
*/
|
|
5
|
+
STYLE_CACHE = "ai-chat-style-cache",
|
|
6
|
+
/**
|
|
7
|
+
* 最小化样式缓存
|
|
8
|
+
*/
|
|
9
|
+
MINIMIZE_STYLY_CHCHE = "ai-chat-minimize-style-cache",
|
|
10
|
+
/**
|
|
11
|
+
* 数据库名称
|
|
12
|
+
*/
|
|
13
|
+
DATA_BASE_NAME = "ibiz-chat",
|
|
14
|
+
/**
|
|
15
|
+
* 数据表名称
|
|
16
|
+
*/
|
|
17
|
+
DATA_TABLE_NAME = "history-message",
|
|
18
|
+
/**
|
|
19
|
+
* 数据表主键
|
|
20
|
+
*/
|
|
21
|
+
DATA_TABLE_KEY_NAME = "id"
|
|
22
|
+
}
|