@ibiz-template-plugin/ai-chat 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1648 -1384
- package/dist/index.legacy.js +1 -1
- package/dist/polyfills.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/components/chat-back-bottom/chat-back-bottom.d.ts +28 -0
- package/dist/types/components/chat-container/chat-container.d.ts +59 -2
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +43 -1
- package/dist/types/controller/chat/chat.controller.d.ts +11 -4
- package/dist/types/entity/chat-message/chat-message.d.ts +1 -0
- package/dist/types/icons/arrow-down-outline-svg.d.ts +3 -0
- package/dist/types/icons/index.d.ts +2 -0
- package/dist/types/icons/send-svg.d.ts +3 -1
- package/dist/types/icons/stop-circle-svg.d.ts +3 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +8 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +8 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +19 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signal } from '@preact/signals';
|
|
2
2
|
import { ChatMessage } from '../../entity';
|
|
3
|
-
import { IChatMessage, IChatOptions, IMaterial } from '../../interface';
|
|
3
|
+
import { IChatMessage, IChatOptions, IMaterial, ITopic } from '../../interface';
|
|
4
4
|
/**
|
|
5
5
|
* 聊天逻辑控制器
|
|
6
6
|
*
|
|
@@ -35,6 +35,14 @@ export declare class AiChatController {
|
|
|
35
35
|
* @type {Signal<string>}
|
|
36
36
|
*/
|
|
37
37
|
readonly input: Signal<string>;
|
|
38
|
+
/**
|
|
39
|
+
* 是否加载中
|
|
40
|
+
*
|
|
41
|
+
* @author tony001
|
|
42
|
+
* @date 2025-03-10 18:03:42
|
|
43
|
+
* @type {Signal<boolean>}
|
|
44
|
+
*/
|
|
45
|
+
readonly isLoading: Signal<boolean>;
|
|
38
46
|
/**
|
|
39
47
|
* 视图参数
|
|
40
48
|
*
|
|
@@ -67,6 +75,25 @@ export declare class AiChatController {
|
|
|
67
75
|
* @type {(string | undefined)}
|
|
68
76
|
*/
|
|
69
77
|
readonly topicId: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* 话题数据
|
|
80
|
+
*
|
|
81
|
+
* @author tony001
|
|
82
|
+
* @date 2025-03-10 16:03:26
|
|
83
|
+
* @type {(ITopic | undefined)}
|
|
84
|
+
*/
|
|
85
|
+
readonly topic: ITopic | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* 聊天窗触发提问回调
|
|
88
|
+
*
|
|
89
|
+
* @author tony001
|
|
90
|
+
* @date 2025-02-24 14:02:51
|
|
91
|
+
* @param {object} context
|
|
92
|
+
* @param {object} params
|
|
93
|
+
* @param {object} otherParams
|
|
94
|
+
* @param {IChatMessage[]} question 提问历史内容(包含当前提问)
|
|
95
|
+
* @return {*} {Promise<boolean>} 等待回答
|
|
96
|
+
|
|
70
97
|
/**
|
|
71
98
|
* Creates an instance of AiChatController.
|
|
72
99
|
*
|
|
@@ -124,6 +151,14 @@ export declare class AiChatController {
|
|
|
124
151
|
* @param {IChatMessage} data
|
|
125
152
|
*/
|
|
126
153
|
replaceMessage(data: IChatMessage): void;
|
|
154
|
+
/**
|
|
155
|
+
* 终止消息
|
|
156
|
+
*
|
|
157
|
+
* @author tony001
|
|
158
|
+
* @date 2025-03-10 14:03:17
|
|
159
|
+
* @param {IChatMessage} data
|
|
160
|
+
*/
|
|
161
|
+
stopMessage(data: IChatMessage): void;
|
|
127
162
|
/**
|
|
128
163
|
* 数据对象转 XML 字符串
|
|
129
164
|
*
|
|
@@ -140,6 +175,13 @@ export declare class AiChatController {
|
|
|
140
175
|
* @return {*} {Promise<void>}
|
|
141
176
|
*/
|
|
142
177
|
question(input: string): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* 中断请求
|
|
180
|
+
*
|
|
181
|
+
* @author tony001
|
|
182
|
+
* @date 2025-03-10 14:03:48
|
|
183
|
+
*/
|
|
184
|
+
abortQuestion(): void;
|
|
143
185
|
/**
|
|
144
186
|
* 回填选中的消息
|
|
145
187
|
*
|
|
@@ -59,12 +59,19 @@ export declare class ChatController {
|
|
|
59
59
|
/**
|
|
60
60
|
* 聊天控制器
|
|
61
61
|
*
|
|
62
|
-
* @
|
|
63
|
-
* @date 2025-02-23 16:02:09
|
|
64
|
-
* @public
|
|
62
|
+
* @readonly
|
|
65
63
|
* @type {(AiChatController | undefined)}
|
|
64
|
+
* @memberof ChatController
|
|
65
|
+
*/
|
|
66
|
+
get aiChat(): AiChatController | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* 话题map
|
|
69
|
+
*
|
|
70
|
+
* @private
|
|
71
|
+
* @type {Map<string, AiChatController>}
|
|
72
|
+
* @memberof ChatController
|
|
66
73
|
*/
|
|
67
|
-
|
|
74
|
+
private aiTopicMap;
|
|
68
75
|
/**
|
|
69
76
|
* Creates an instance of ChatController.
|
|
70
77
|
* @author tony001
|
|
@@ -14,6 +14,7 @@ export declare class ChatMessage implements IChatMessage {
|
|
|
14
14
|
get state(): IChatMessage['state'];
|
|
15
15
|
get role(): IChatMessage['role'];
|
|
16
16
|
get type(): IChatMessage['type'];
|
|
17
|
+
get realcontent(): IChatMessage['realcontent'];
|
|
17
18
|
get content(): IChatMessage['content'];
|
|
18
19
|
get completed(): IChatMessage['completed'];
|
|
19
20
|
get _origin(): IChatMessage;
|
|
@@ -21,3 +21,5 @@ export { PaperclipSvg } from './paperclip-svg';
|
|
|
21
21
|
export { FileSvg } from './upload-svg';
|
|
22
22
|
export { MaterialRemoveSvg } from './material-remove-svg';
|
|
23
23
|
export { DefaultMaterialSvg } from './default-material-svg';
|
|
24
|
+
export { StopCircleSvg } from './stop-circle-svg';
|
|
25
|
+
export { ArrowDownOutlineSvg } from './arrow-down-outline-svg';
|
|
@@ -64,6 +64,14 @@ export interface IChatMessage {
|
|
|
64
64
|
* @type {string}
|
|
65
65
|
*/
|
|
66
66
|
content: string;
|
|
67
|
+
/**
|
|
68
|
+
* 内容(排除排除think、resources、suggesions内容)
|
|
69
|
+
*
|
|
70
|
+
* @author tony001
|
|
71
|
+
* @date 2025-03-10 16:03:12
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
realcontent?: string;
|
|
67
75
|
/**
|
|
68
76
|
* 消息数据
|
|
69
77
|
*
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { AiChatController } from '../../controller';
|
|
1
2
|
import { IChatMessage } from '../i-chat-message/i-chat-message';
|
|
2
3
|
import { IChatToolbarItem } from '../i-chat-toolbar-item/i-chat-toolbar-item';
|
|
3
4
|
import { FileUploaderOptions } from '../i-file-uploader-options/i-file-uploader-options';
|
|
5
|
+
import { ITopic } from '../i-topic-options/i-topic-options';
|
|
4
6
|
/**
|
|
5
7
|
* 聊天数据
|
|
6
8
|
*
|
|
@@ -89,6 +91,14 @@ export interface IChatOptions extends IChat {
|
|
|
89
91
|
* @type {string}
|
|
90
92
|
*/
|
|
91
93
|
topicId?: string;
|
|
94
|
+
/**
|
|
95
|
+
*话题数据
|
|
96
|
+
*
|
|
97
|
+
* @author tony001
|
|
98
|
+
* @date 2025-03-10 16:03:46
|
|
99
|
+
* @type {ITopic}
|
|
100
|
+
*/
|
|
101
|
+
topic?: ITopic;
|
|
92
102
|
/**
|
|
93
103
|
* 聊天窗触发提问回调
|
|
94
104
|
*
|
|
@@ -100,7 +110,15 @@ export interface IChatOptions extends IChat {
|
|
|
100
110
|
* @param {IChatMessage[]} question 提问历史内容(包含当前提问)
|
|
101
111
|
* @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
|
|
102
112
|
*/
|
|
103
|
-
question(context: object, params: object, otherParams: object, question: IChatMessage[]): Promise<boolean>;
|
|
113
|
+
question(aiChat: AiChatController, context: object, params: object, otherParams: object, question: IChatMessage[]): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* 中断消息
|
|
116
|
+
*
|
|
117
|
+
* @author tony001
|
|
118
|
+
* @date 2025-03-10 14:03:37
|
|
119
|
+
* @param {AiChatController} aiChat
|
|
120
|
+
*/
|
|
121
|
+
abortQuestion(aiChat: AiChatController): void;
|
|
104
122
|
/**
|
|
105
123
|
* 聊天窗历史记录获取
|
|
106
124
|
*
|