@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.
@@ -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
- * @author tony001
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
- aiChat: AiChatController | undefined;
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;
@@ -0,0 +1,3 @@
1
+ export declare const ArrowDownOutlineSvg: (props: {
2
+ className?: string;
3
+ }) => import("preact").JSX.Element;
@@ -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';
@@ -1 +1,3 @@
1
- export declare const SendSvg: () => import("preact").JSX.Element;
1
+ export declare const SendSvg: (props: {
2
+ className?: string;
3
+ }) => import("preact").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const StopCircleSvg: (props: {
2
+ className?: string;
3
+ }) => import("preact").JSX.Element;
@@ -63,4 +63,12 @@ export interface IChatContainerOptions {
63
63
  * @type {number}
64
64
  */
65
65
  zIndex?: number;
66
+ /**
67
+ * 是否允许回填
68
+ *
69
+ * @author tony001
70
+ * @date 2025-03-10 15:03:16
71
+ * @type {boolean}
72
+ */
73
+ enableBackFill?: boolean;
66
74
  }
@@ -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
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "使用 rollup 编译 vue 组件或者 jsx",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",