@ibiz-template-plugin/ai-chat 0.0.9 → 0.0.10
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/types/app.d.ts +1 -0
- package/dist/types/components/chat-container/chat-container.d.ts +185 -0
- package/dist/types/components/chat-input/chat-input.d.ts +12 -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 +15 -0
- package/dist/types/constants/index.d.ts +22 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +162 -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 +3 -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 +2 -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/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 +19 -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/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/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/index.d.ts +3 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +58 -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 +139 -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 +53 -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-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 +8 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
- package/dist/types/utils/util/indexdb-util.d.ts +91 -0
- package/dist/types/utils/util/util.d.ts +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function App(): import("preact").JSX.Element;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { Component } from 'preact';
|
|
2
|
+
import { Namespace } from '../../utils';
|
|
3
|
+
import { AiChatController, AiTopicController } from '../../controller';
|
|
4
|
+
import { IChatToolbarItem } 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
|
+
interface ChatContainerState {
|
|
72
|
+
/**
|
|
73
|
+
* 全屏状态
|
|
74
|
+
*
|
|
75
|
+
* @author ljx
|
|
76
|
+
* @date 2024-05-07 15:10:31
|
|
77
|
+
*/
|
|
78
|
+
isFullScreen: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 最小化
|
|
81
|
+
*
|
|
82
|
+
* @type {boolean}
|
|
83
|
+
* @memberof ChatContainerState
|
|
84
|
+
*/
|
|
85
|
+
isMinimize: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 聊天窗口容器,可拖拽,可缩放
|
|
89
|
+
*
|
|
90
|
+
* @author chitanda
|
|
91
|
+
* @date 2023-10-13 17:10:37
|
|
92
|
+
* @export
|
|
93
|
+
* @class ChatContainer
|
|
94
|
+
* @extends {Component<ChatContainerProps>}
|
|
95
|
+
*/
|
|
96
|
+
export declare class ChatContainer extends Component<ChatContainerProps, ChatContainerState> {
|
|
97
|
+
constructor(props: ChatContainerProps | undefined);
|
|
98
|
+
ns: Namespace;
|
|
99
|
+
containerRef: import("preact").RefObject<HTMLDivElement>;
|
|
100
|
+
dragHandle: import("preact").RefObject<HTMLDivElement>;
|
|
101
|
+
minimizeRef: import("preact").RefObject<HTMLDivElement>;
|
|
102
|
+
data: {
|
|
103
|
+
x: number;
|
|
104
|
+
y: number;
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
minWidth: number;
|
|
108
|
+
minHeight: number;
|
|
109
|
+
};
|
|
110
|
+
minimizeData: {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* 是否禁止拖动
|
|
116
|
+
* - 拖拽边时应禁止拖动
|
|
117
|
+
* @type {boolean}
|
|
118
|
+
* @memberof ChatContainer
|
|
119
|
+
*/
|
|
120
|
+
disabled: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* 最小化是否在拖拽中
|
|
123
|
+
* - 在拖拽时不应触发点击事件
|
|
124
|
+
* @type {boolean}
|
|
125
|
+
* @memberof ChatContainer
|
|
126
|
+
*/
|
|
127
|
+
isDragging: boolean;
|
|
128
|
+
calcWindowStyle(): {
|
|
129
|
+
left: string;
|
|
130
|
+
top: string;
|
|
131
|
+
height: string;
|
|
132
|
+
width: string;
|
|
133
|
+
'z-index': string;
|
|
134
|
+
};
|
|
135
|
+
calcMinimizeStyle(): {
|
|
136
|
+
left: string;
|
|
137
|
+
top: string;
|
|
138
|
+
'z-index': string;
|
|
139
|
+
};
|
|
140
|
+
setStyle(): void;
|
|
141
|
+
componentDidMount(): void;
|
|
142
|
+
componentWillUnmount(): void;
|
|
143
|
+
/**
|
|
144
|
+
* 关闭聊天窗口
|
|
145
|
+
*
|
|
146
|
+
* @author chitanda
|
|
147
|
+
* @date 2023-10-15 19:10:31
|
|
148
|
+
*/
|
|
149
|
+
close(): void;
|
|
150
|
+
/**
|
|
151
|
+
* 全屏
|
|
152
|
+
*
|
|
153
|
+
* @author ljx
|
|
154
|
+
* @date 2024-05-07 15:10:31
|
|
155
|
+
*/
|
|
156
|
+
fullScreen(): void;
|
|
157
|
+
/**
|
|
158
|
+
* 关闭全屏
|
|
159
|
+
*
|
|
160
|
+
* @author ljx
|
|
161
|
+
* @date 2024-05-07 15:10:31
|
|
162
|
+
*/
|
|
163
|
+
closeFullScreen(): void;
|
|
164
|
+
/**
|
|
165
|
+
* 最小化
|
|
166
|
+
*
|
|
167
|
+
* @memberof ChatContainer
|
|
168
|
+
*/
|
|
169
|
+
minimize(): void;
|
|
170
|
+
/**
|
|
171
|
+
* 退出最小化
|
|
172
|
+
*
|
|
173
|
+
* @memberof ChatContainer
|
|
174
|
+
*/
|
|
175
|
+
exitMinimize(): void;
|
|
176
|
+
/**
|
|
177
|
+
* 阻止冒泡
|
|
178
|
+
* - 防止点击头部行为时误触发拖动监听
|
|
179
|
+
* @param {MouseEvent} evt
|
|
180
|
+
* @memberof ChatContainer
|
|
181
|
+
*/
|
|
182
|
+
stopPropagation(evt: MouseEvent): void;
|
|
183
|
+
render(): import("preact").JSX.Element;
|
|
184
|
+
}
|
|
185
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AiChatController } from '../../controller';
|
|
2
|
+
export interface ChatInputProps {
|
|
3
|
+
/**
|
|
4
|
+
* 单实例聊天总控
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-10-13 17:10:43
|
|
8
|
+
* @type {AiChatController}
|
|
9
|
+
*/
|
|
10
|
+
controller: AiChatController;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChatInput: (props: ChatInputProps) => import("preact/compat").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,15 @@
|
|
|
1
|
+
type Position = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
+
interface ActionItem {
|
|
3
|
+
id: string;
|
|
4
|
+
caption: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const Popup: ({ children, actions, position, isOpen: isOpenProp, onToggleOpen, onAction, }: {
|
|
8
|
+
children: import('preact').ComponentChildren;
|
|
9
|
+
actions?: ActionItem[] | undefined;
|
|
10
|
+
position?: Position | undefined;
|
|
11
|
+
isOpen?: boolean | undefined;
|
|
12
|
+
onToggleOpen?: ((isOpen: boolean) => void) | undefined;
|
|
13
|
+
onAction?: ((actionId: string, event: MouseEvent) => void) | undefined;
|
|
14
|
+
}) => import("preact").JSX.Element;
|
|
15
|
+
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
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Signal } from '@preact/signals';
|
|
2
|
+
import { ChatMessage } from '../../entity';
|
|
3
|
+
import { IChatMessage, IChatOptions } from '../../interface';
|
|
4
|
+
/**
|
|
5
|
+
* 聊天逻辑控制器
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-10-09 15:10:51
|
|
9
|
+
* @export
|
|
10
|
+
* @class AiChatController
|
|
11
|
+
*/
|
|
12
|
+
export declare class AiChatController {
|
|
13
|
+
readonly opts: IChatOptions;
|
|
14
|
+
/**
|
|
15
|
+
* 聊天记录
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-10-16 16:10:29
|
|
19
|
+
* @type {Signal<ChatMessage[]>}
|
|
20
|
+
*/
|
|
21
|
+
readonly messages: Signal<ChatMessage[]>;
|
|
22
|
+
/**
|
|
23
|
+
* 聊天框输入值
|
|
24
|
+
*
|
|
25
|
+
* @author chitanda
|
|
26
|
+
* @date 2023-10-16 15:10:43
|
|
27
|
+
* @type {Signal<string>}
|
|
28
|
+
*/
|
|
29
|
+
readonly input: Signal<string>;
|
|
30
|
+
/**
|
|
31
|
+
* 视图参数
|
|
32
|
+
*
|
|
33
|
+
* @author tony001
|
|
34
|
+
* @date 2025-02-24 14:02:23
|
|
35
|
+
* @type {object}
|
|
36
|
+
*/
|
|
37
|
+
readonly context: object;
|
|
38
|
+
/**
|
|
39
|
+
* 视图参数
|
|
40
|
+
*
|
|
41
|
+
* @author tony001
|
|
42
|
+
* @date 2025-02-24 14:02:32
|
|
43
|
+
* @type {object}
|
|
44
|
+
*/
|
|
45
|
+
readonly params: object;
|
|
46
|
+
/**
|
|
47
|
+
* 应用实体标记
|
|
48
|
+
*
|
|
49
|
+
* @author tony001
|
|
50
|
+
* @date 2025-02-24 14:02:10
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
readonly appDataEntityId: string;
|
|
54
|
+
/**
|
|
55
|
+
* 话题标识
|
|
56
|
+
*
|
|
57
|
+
* @author tony001
|
|
58
|
+
* @date 2025-02-24 18:02:02
|
|
59
|
+
* @type {(string | undefined)}
|
|
60
|
+
*/
|
|
61
|
+
readonly topicId: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Creates an instance of AiChatController.
|
|
64
|
+
*
|
|
65
|
+
* @author chitanda
|
|
66
|
+
* @date 2023-10-15 19:10:34
|
|
67
|
+
* @param {IChatOptions} opts 聊天配置
|
|
68
|
+
*/
|
|
69
|
+
constructor(opts: IChatOptions);
|
|
70
|
+
/**
|
|
71
|
+
* 获取历史记录
|
|
72
|
+
*
|
|
73
|
+
* @author tony001
|
|
74
|
+
* @date 2025-02-24 13:02:52
|
|
75
|
+
* @return {*} {Promise<boolean>}
|
|
76
|
+
*/
|
|
77
|
+
fecthHistory(): Promise<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* 更新数据到indexdb
|
|
80
|
+
*
|
|
81
|
+
* @author tony001
|
|
82
|
+
* @date 2025-02-24 18:02:41
|
|
83
|
+
* @return {*} {Promise<void>}
|
|
84
|
+
*/
|
|
85
|
+
asyncToIndexDB(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* 设置聊天框值
|
|
88
|
+
*
|
|
89
|
+
* @author chitanda
|
|
90
|
+
* @date 2023-10-16 16:10:21
|
|
91
|
+
* @param {string} input
|
|
92
|
+
*/
|
|
93
|
+
setInput(input: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* 新增聊天记录
|
|
96
|
+
*
|
|
97
|
+
* @author chitanda
|
|
98
|
+
* @date 2023-10-09 15:10:15
|
|
99
|
+
* @param {IMessage} data
|
|
100
|
+
*/
|
|
101
|
+
addMessage(data: IChatMessage): void;
|
|
102
|
+
/**
|
|
103
|
+
* 更新消息完成状态
|
|
104
|
+
*
|
|
105
|
+
* @author tony001
|
|
106
|
+
* @date 2025-02-25 17:02:19
|
|
107
|
+
* @param {string} id
|
|
108
|
+
* @param {boolean} completed
|
|
109
|
+
*/
|
|
110
|
+
completeMessage(id: string, completed: boolean): void;
|
|
111
|
+
/**
|
|
112
|
+
* 替换已经存在的聊天消息
|
|
113
|
+
*
|
|
114
|
+
* @author chitanda
|
|
115
|
+
* @date 2023-10-16 22:10:49
|
|
116
|
+
* @param {IChatMessage} data
|
|
117
|
+
*/
|
|
118
|
+
replaceMessage(data: IChatMessage): void;
|
|
119
|
+
/**
|
|
120
|
+
* 提问
|
|
121
|
+
*
|
|
122
|
+
* @author chitanda
|
|
123
|
+
* @date 2023-10-09 20:10:43
|
|
124
|
+
* @return {*} {Promise<void>}
|
|
125
|
+
*/
|
|
126
|
+
question(input: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* 回填选中的消息
|
|
129
|
+
*
|
|
130
|
+
* @author chitanda
|
|
131
|
+
* @date 2023-10-16 18:10:19
|
|
132
|
+
* @param {IChatMessage} message
|
|
133
|
+
*/
|
|
134
|
+
backfill(message: IChatMessage): void;
|
|
135
|
+
/**
|
|
136
|
+
*
|
|
137
|
+
* 删除指定消息,如果是用户提问的刷新调用的删除,则需要删除从问题开始到最后的所有记录
|
|
138
|
+
* @param {IChatMessage} message
|
|
139
|
+
* @param {boolean} [isuser=false]
|
|
140
|
+
* @memberof AiChatController
|
|
141
|
+
*/
|
|
142
|
+
deleteMessage(message: IChatMessage): void;
|
|
143
|
+
/**
|
|
144
|
+
* 刷新当前消息
|
|
145
|
+
*
|
|
146
|
+
* @memberof AiChatController
|
|
147
|
+
*/
|
|
148
|
+
refreshMessage(message: IChatMessage, isuser?: boolean): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* 复制消息
|
|
151
|
+
*
|
|
152
|
+
* @param {IChatMessage} message
|
|
153
|
+
* @memberof AiChatController
|
|
154
|
+
*/
|
|
155
|
+
copyMessage(message: IChatMessage): void;
|
|
156
|
+
/**
|
|
157
|
+
* 新建对话
|
|
158
|
+
*
|
|
159
|
+
* @memberof AiChatController
|
|
160
|
+
*/
|
|
161
|
+
newDialogue(): Promise<void>;
|
|
162
|
+
}
|