@ibiz-template-plugin/ai-chat 0.0.5 → 0.0.8

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 (40) hide show
  1. package/dist/index.es.js +2084 -1026
  2. package/dist/index.legacy.js +1 -1
  3. package/dist/polyfills.legacy.js +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/types/components/chat-container/chat-container.d.ts +94 -7
  6. package/dist/types/components/chat-message-item/chat-message-item.d.ts +8 -1
  7. package/dist/types/components/chat-message-item/error-message/error-message.d.ts +8 -0
  8. package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +8 -0
  9. package/dist/types/components/chat-message-item/user-message/user-message.d.ts +8 -0
  10. package/dist/types/components/chat-messages/chat-messages.d.ts +8 -0
  11. package/dist/types/components/chat-toolbar/chat-toolbar.d.ts +41 -0
  12. package/dist/types/components/chat-topic-item/chat-topic-item.d.ts +9 -0
  13. package/dist/types/components/chat-topics/chat-topics.d.ts +12 -0
  14. package/dist/types/components/popup/popup.d.ts +15 -0
  15. package/dist/types/constants/index.d.ts +17 -1
  16. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +48 -0
  17. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +96 -0
  18. package/dist/types/controller/chat/chat.controller.d.ts +76 -5
  19. package/dist/types/controller/index.d.ts +1 -0
  20. package/dist/types/entity/chart-topic/chart-topic.d.ts +20 -0
  21. package/dist/types/entity/index.d.ts +1 -0
  22. package/dist/types/icons/ai-svg.d.ts +1 -0
  23. package/dist/types/icons/audio-svg.d.ts +1 -0
  24. package/dist/types/icons/index.d.ts +8 -0
  25. package/dist/types/icons/link-svg.d.ts +3 -0
  26. package/dist/types/icons/minimize-svg.d.ts +1 -0
  27. package/dist/types/icons/more-svg.d.ts +4 -0
  28. package/dist/types/icons/new-dialogue.d.ts +1 -0
  29. package/dist/types/icons/recording-svg.d.ts +1 -0
  30. package/dist/types/icons/remove-svg.d.ts +1 -0
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +104 -25
  33. package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +53 -0
  34. package/dist/types/interface/i-config-service/i-config-service.d.ts +27 -0
  35. package/dist/types/interface/i-container-options/i-container-options.d.ts +45 -0
  36. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +102 -0
  37. package/dist/types/interface/index.d.ts +4 -1
  38. package/dist/types/utils/index.d.ts +1 -0
  39. package/dist/types/utils/util/indexdb-util.d.ts +91 -0
  40. package/package.json +5 -3
@@ -1,3 +1,4 @@
1
+ import { VNode } from 'preact';
1
2
  import { IChatMessage } from '../../../interface';
2
3
  import { AiChatController } from '../../../controller';
3
4
  export interface ErrorMessageProps {
@@ -18,5 +19,12 @@ export interface ErrorMessageProps {
18
19
  * @type {number}
19
20
  */
20
21
  size: number;
22
+ /**
23
+ * 工具栏
24
+ *
25
+ * @type {VNode[]}
26
+ * @memberof ErrorMessageProps
27
+ */
28
+ children: VNode;
21
29
  }
22
30
  export declare const ErrorMessage: (props: ErrorMessageProps) => import("preact").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { VNode } from 'preact';
1
2
  import { IChatMessage } from '../../../interface';
2
3
  import { AiChatController } from '../../../controller';
3
4
  export interface MarkdownMessageProps {
@@ -18,5 +19,12 @@ export interface MarkdownMessageProps {
18
19
  * @type {number}
19
20
  */
20
21
  size: number;
22
+ /**
23
+ * 工具栏
24
+ *
25
+ * @type {VNode}
26
+ * @memberof MarkdownMessageProps
27
+ */
28
+ children: VNode;
21
29
  }
22
30
  export declare const MarkdownMessage: (props: MarkdownMessageProps) => import("preact").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { VNode } from 'preact';
1
2
  import { IChatMessage } from '../../../interface';
2
3
  import { AiChatController } from '../../../controller';
3
4
  export interface UserMessageProps {
@@ -11,5 +12,12 @@ export interface UserMessageProps {
11
12
  * @type {number}
12
13
  */
13
14
  size: number;
15
+ /**
16
+ * 工具栏
17
+ *
18
+ * @type {VNode}
19
+ * @memberof UserMessageProps
20
+ */
21
+ children: VNode;
14
22
  }
15
23
  export declare const UserMessage: (props: UserMessageProps) => import("preact").JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { AiChatController } from '../../controller';
2
+ import { IChatToolbarItem } from '../../interface';
2
3
  export interface ChatMessageProps {
3
4
  /**
4
5
  * 单实例聊天总控
@@ -8,5 +9,12 @@ export interface ChatMessageProps {
8
9
  * @type {AiChatController}
9
10
  */
10
11
  controller: AiChatController;
12
+ /**
13
+ * 工具项集合
14
+ *
15
+ * @type {IChatToolbarItem[]}
16
+ * @memberof ChatMessageProps
17
+ */
18
+ toolbarItems?: IChatToolbarItem[];
11
19
  }
12
20
  export declare const ChatMessages: (props: ChatMessageProps) => import("preact").JSX.Element;
@@ -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,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 {};
@@ -2,5 +2,21 @@ export declare enum AIChatConst {
2
2
  /**
3
3
  * 聊天窗口样式缓存
4
4
  */
5
- STYLE_CACHE = "ai-chat-style-cache"
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"
6
22
  }
@@ -27,6 +27,38 @@ export declare class AiChatController {
27
27
  * @type {Signal<string>}
28
28
  */
29
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;
30
62
  /**
31
63
  * Creates an instance of AiChatController.
32
64
  *
@@ -35,6 +67,22 @@ export declare class AiChatController {
35
67
  * @param {IChatOptions} opts 聊天配置
36
68
  */
37
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(action: 'ADD' | 'UPDATE'): Promise<void>;
38
86
  /**
39
87
  * 设置聊天框值
40
88
  *
@@ -0,0 +1,96 @@
1
+ import { Signal } from '@preact/signals';
2
+ import { ChatTopic } from '../../entity';
3
+ import { ITopic, ITopicOptions } from '../../interface';
4
+ import { ChatController } from '../chat/chat.controller';
5
+ /**
6
+ * ai话题控制器
7
+ *
8
+ * @author tony001
9
+ * @date 2025-02-20 16:02:01
10
+ * @export
11
+ * @class AiTopicController
12
+ */
13
+ export declare class AiTopicController {
14
+ private chat;
15
+ /**
16
+ * 话题清单
17
+ *
18
+ * @author tony001
19
+ * @date 2025-02-20 16:02:38
20
+ * @type {Signal<ChatTopic[]>}
21
+ */
22
+ readonly topics: Signal<ChatTopic[]>;
23
+ /**
24
+ * 激活话题
25
+ *
26
+ * @author tony001
27
+ * @date 2025-02-24 16:02:44
28
+ * @type {(Signal<ITopic | null>)}
29
+ */
30
+ readonly activedTopic: Signal<ITopic | null>;
31
+ /**
32
+ * 当前话题配置备份
33
+ *
34
+ * @author tony001
35
+ * @date 2025-02-24 16:02:28
36
+ * @public
37
+ * @type {(ITopicOptions | undefined)}
38
+ */
39
+ currentTopicOptions: ITopicOptions | undefined;
40
+ /**
41
+ * Creates an instance of AiTopicController.
42
+ * @author tony001
43
+ * @date 2025-02-24 11:02:26
44
+ * @param {ChatController} chat
45
+ */
46
+ constructor(chat: ChatController);
47
+ /**
48
+ * 获取历史话题
49
+ *
50
+ * @author tony001
51
+ * @date 2025-02-23 16:02:37
52
+ * @return {*} {Promise<void>}
53
+ */
54
+ fetchHistory(options: ITopicOptions): Promise<void>;
55
+ /**
56
+ * 更新当前话题
57
+ *
58
+ * @author tony001
59
+ * @date 2025-02-23 17:02:43
60
+ * @param {ITopicOptions} options
61
+ * @return {*} {Promise<void>}
62
+ */
63
+ updateCurrentTopic(options: ITopicOptions): Promise<void>;
64
+ /**
65
+ * 删除话题
66
+ *
67
+ * @author tony001
68
+ * @date 2025-02-24 16:02:03
69
+ * @param {ITopicOptions} options
70
+ * @param {object} context
71
+ * @param {object} params
72
+ * @param {ITopic} data
73
+ * @param {MouseEvent} event
74
+ * @return {*} {Promise<void>}
75
+ */
76
+ removeTopic(options: ITopicOptions, context: object, params: object, data: ITopic, event: MouseEvent): Promise<void>;
77
+ /**
78
+ * 处理选中变化
79
+ *
80
+ * @author tony001
81
+ * @date 2025-02-20 19:02:27
82
+ * @param {ChatTopic} item
83
+ */
84
+ handleTopicChange(item: ChatTopic): void;
85
+ /**
86
+ * 处理话题行为
87
+ *
88
+ * @author tony001
89
+ * @date 2025-02-24 16:02:58
90
+ * @param {string} action
91
+ * @param {ChatTopic} topic
92
+ * @param {MouseEvent} event
93
+ * @return {*} {Promise<void>}
94
+ */
95
+ handleTopicAction(action: string, topic: ChatTopic, event: MouseEvent): Promise<void>;
96
+ }
@@ -1,5 +1,7 @@
1
- import { AiChatController } from '..';
2
- import { IChatOptions } from '../../interface';
1
+ import { IContainerOptions } from '../../interface';
2
+ import { AiTopicController } from '../ai-topic/ai-topic.controller';
3
+ import { AiChatController } from '../ai-chat/ai-chat.controller';
4
+ import { ChatTopic } from '../../entity';
3
5
  /**
4
6
  * 聊天器控制器
5
7
  *
@@ -18,13 +20,82 @@ export declare class ChatController {
18
20
  * @type {HTMLDivElement}
19
21
  */
20
22
  protected container?: HTMLDivElement;
23
+ /**
24
+ * 默认模式(聊天框)和话题模式(支持多话题切换),聊天框为默认模式
25
+ *
26
+ * @author tony001
27
+ * @date 2025-02-20 16:02:50
28
+ * @protected
29
+ * @type {('DEFAULT' | 'TOPIC')}
30
+ */
31
+ protected mode: 'DEFAULT' | 'TOPIC';
32
+ /**
33
+ * 是否挂载ai话题
34
+ *
35
+ * @author tony001
36
+ * @date 2025-02-23 16:02:54
37
+ * @protected
38
+ * @type {boolean}
39
+ */
40
+ protected isMountedAiTopic: boolean;
41
+ /**
42
+ * 容器配置备份
43
+ *
44
+ * @author tony001
45
+ * @date 2025-02-24 11:02:49
46
+ * @protected
47
+ * @type {(IContainerOptions | undefined)}
48
+ */
49
+ protected backupChatOptions: IContainerOptions | undefined;
50
+ /**
51
+ * 话题控制器
52
+ *
53
+ * @author tony001
54
+ * @date 2025-02-23 16:02:56
55
+ * @public
56
+ * @type {AiTopicController}
57
+ */
58
+ aiTopic: AiTopicController;
59
+ /**
60
+ * 聊天控制器
61
+ *
62
+ * @author tony001
63
+ * @date 2025-02-23 16:02:09
64
+ * @public
65
+ * @type {(AiChatController | undefined)}
66
+ */
67
+ aiChat: AiChatController | undefined;
68
+ /**
69
+ * Creates an instance of ChatController.
70
+ * @author tony001
71
+ * @date 2025-02-24 11:02:20
72
+ */
73
+ constructor();
74
+ /**
75
+ * 初始化IndexDB
76
+ *
77
+ * @author tony001
78
+ * @date 2025-02-24 18:02:50
79
+ * @return {*} {Promise<void>}
80
+ */
81
+ initIndexDB(): Promise<void>;
21
82
  /**
22
83
  * 创建聊天窗口(会同时显示出来)
23
84
  *
24
- * @author chitanda
25
- * @date 2023-10-13 17:10:22
85
+ * @author tony001
86
+ * @date 2025-02-24 12:02:58
87
+ * @param {IContainerOptions} opts
88
+ * @return {*} {Promise<AiChatController>}
89
+ */
90
+ create(opts: IContainerOptions): Promise<AiChatController>;
91
+ /**
92
+ * 切换聊天控制器
93
+ *
94
+ * @author tony001
95
+ * @date 2025-02-24 11:02:24
96
+ * @param {ChatTopic} topic
26
97
  */
27
- create(opts: IChatOptions): AiChatController;
98
+ switchAiChatController(topic: ChatTopic): void;
28
99
  /**
29
100
  * 隐藏聊天窗口(必须先创建)
30
101
  *
@@ -1,2 +1,3 @@
1
1
  export { AiChatController } from './ai-chat/ai-chat.controller';
2
+ export { AiTopicController } from './ai-topic/ai-topic.controller';
2
3
  export { ChatController, chat } from './chat/chat.controller';
@@ -0,0 +1,20 @@
1
+ import { ITopic } from '../../interface';
2
+ /**
3
+ * 话题实体
4
+ *
5
+ * @author tony001
6
+ * @date 2025-02-20 16:02:29
7
+ * @export
8
+ * @class ChatTopic
9
+ * @implements {ITopic}
10
+ */
11
+ export declare class ChatTopic implements ITopic {
12
+ data: ITopic;
13
+ get appid(): ITopic['appid'];
14
+ get id(): ITopic['id'];
15
+ get type(): ITopic['type'];
16
+ get caption(): ITopic['caption'];
17
+ get url(): ITopic['url'];
18
+ get aiChat(): ITopic['aiChat'];
19
+ constructor(data: ITopic);
20
+ }
@@ -1 +1,2 @@
1
1
  export { ChatMessage } from './chat-message/chat-message';
2
+ export { ChatTopic } from './chart-topic/chart-topic';
@@ -0,0 +1 @@
1
+ export declare const AISvg: () => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const AudioSvg: () => import("preact").JSX.Element;
@@ -6,3 +6,11 @@ export { RefreshSvg } from './refresh-svg';
6
6
  export { CopySvg } from './copy-svg';
7
7
  export { FullScreenSvg } from './full-screen-svg';
8
8
  export { CloseFullScreenSvg } from './close-full-screen-svg';
9
+ export { MinimizeSvg } from './minimize-svg';
10
+ export { AISvg } from './ai-svg';
11
+ export { NewDialogue } from './new-dialogue';
12
+ export { AudioSvg } from './audio-svg';
13
+ export { RecordingSvg } from './recording-svg';
14
+ export { MoreSvg } from './more-svg';
15
+ export { LinkSvg } from './link-svg';
16
+ export { RemoveSvg } from './remove-svg';
@@ -0,0 +1,3 @@
1
+ export declare const LinkSvg: (props: {
2
+ className?: string;
3
+ }) => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const MinimizeSvg: () => import("preact").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export declare const MoreSvg: (props: {
2
+ className?: string | undefined;
3
+ onClick?: ((event: MouseEvent) => void) | undefined;
4
+ }) => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const NewDialogue: () => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const RecordingSvg: () => import("preact").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const RemoveSvg: () => import("preact").JSX.Element;
@@ -1,2 +1,3 @@
1
1
  export { ChatContainer } from './components';
2
2
  export { chat } from './controller';
3
+ export type { IChatToolbarItem } from './interface';
@@ -1,30 +1,113 @@
1
- import { IChatMessage } from '..';
2
- import { IChatContainerOptions } from '../i-chat-container/i-chat-container';
1
+ import { IChatMessage } from '../i-chat-message/i-chat-message';
2
+ import { IChatToolbarItem } from '../i-chat-toolbar-item/i-chat-toolbar-item';
3
3
  /**
4
- * 聊天窗口配置参数
4
+ * 聊天数据
5
+ *
6
+ * @author tony001
7
+ * @date 2025-02-24 11:02:52
8
+ * @export
9
+ * @interface IChat
10
+ */
11
+ export interface IChat {
12
+ /**
13
+ * 聊天窗口标题
14
+ *
15
+ * @type {string}
16
+ * @memberof IChatOptions
17
+ */
18
+ caption?: string;
19
+ /**
20
+ * 上下文
21
+ *
22
+ * @author tony001
23
+ * @date 2025-02-23 17:02:33
24
+ * @type {object}
25
+ */
26
+ context: object;
27
+ /**
28
+ * 视图参数
29
+ *
30
+ * @author tony001
31
+ * @date 2025-02-23 17:02:48
32
+ * @type {object}
33
+ */
34
+ params: object;
35
+ /**
36
+ * 实体标识
37
+ *
38
+ * @author tony001
39
+ * @date 2025-02-24 14:02:40
40
+ * @type {string}
41
+ */
42
+ appDataEntityId: string;
43
+ /**
44
+ * 内容工具项
45
+ *
46
+ * @type {IChatToolbarItem[]}
47
+ * @memberof IChatOptions
48
+ */
49
+ contentToolbarItems?: IChatToolbarItem[];
50
+ /**
51
+ * 底部工具项
52
+ *
53
+ * @type {IChatToolbarItem[]}
54
+ * @memberof IChatOptions
55
+ */
56
+ footerToolbarItems?: IChatToolbarItem[];
57
+ }
58
+ /**
59
+ * 聊天区配置参数
5
60
  *
6
61
  * @author chitanda
7
62
  * @date 2023-10-13 17:10:57
8
63
  * @export
9
64
  * @interface IChatOptions
10
65
  */
11
- export interface IChatOptions {
66
+ export interface IChatOptions extends IChat {
67
+ /**
68
+ * 模式,细分为默认模式(聊天框)和话题模式(支持多话题切换),聊天框为默认模式
69
+ *
70
+ * @author tony001
71
+ * @date 2025-02-20 14:02:36
72
+ * @type {('DEFAULT' | 'TOPIC')}
73
+ */
74
+ mode?: 'DEFAULT' | 'TOPIC';
75
+ /**
76
+ * 话题标识
77
+ *
78
+ * @author tony001
79
+ * @date 2025-02-24 18:02:26
80
+ * @type {string}
81
+ */
82
+ topicId?: string;
12
83
  /**
13
84
  * 聊天窗触发提问回调
14
85
  *
15
- * @author chitanda
16
- * @date 2023-10-16 14:10:06
86
+ * @author tony001
87
+ * @date 2025-02-24 14:02:51
88
+ * @param {object} context
89
+ * @param {object} params
90
+ * @param {object} otherParams
17
91
  * @param {IChatMessage[]} question 提问历史内容(包含当前提问)
18
92
  * @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
19
93
  */
20
- question(question: IChatMessage[]): Promise<boolean>;
94
+ question(context: object, params: object, otherParams: object, question: IChatMessage[]): Promise<boolean>;
21
95
  /**
22
- * 窗口关闭后回调
96
+ * 聊天窗历史记录获取
23
97
  *
24
- * @author chitanda
25
- * @date 2023-10-15 19:10:25
98
+ * @author tony001
99
+ * @date 2025-02-24 13:02:56
100
+ * @return {*} {Promise<boolean>}
101
+ */
102
+ history(context: object, params: object, otherParams: object): Promise<boolean>;
103
+ /**
104
+ * 窗口关闭
105
+ *
106
+ * @param {object} context
107
+ * @param {object} params
108
+ * @memberof IChatOptions
26
109
  */
27
- closed?(): void;
110
+ closed?(context: object, params: object): void;
28
111
  /**
29
112
  * 聊天窗任意位置点击操作
30
113
  *
@@ -34,27 +117,23 @@ export interface IChatOptions {
34
117
  * @param {T} [params] 传递的参数
35
118
  * @return {*} {Promise<boolean>} 等待操作,用于显示 loading 并获取最终成功与否
36
119
  */
37
- action?<T = unknown>(action: 'backfill' | 'question' | 'deletemsg' | 'refreshmsg', params?: T): Promise<boolean>;
120
+ action?<T = unknown>(action: 'backfill' | 'question' | 'deletemsg' | 'refreshmsg' | 'copymsg', params?: T): Promise<boolean>;
38
121
  /**
39
122
  * 全屏操作
40
123
  *
41
- * @param {boolean} target true为打开,false为关闭
124
+ * @param {boolean} target
125
+ * @param {object} context
126
+ * @param {object} params
42
127
  * @memberof IChatOptions
43
128
  */
44
- fullscreen?(target: boolean): void;
45
- /**
46
- * 聊天窗口呈现
47
- *
48
- * @author chitanda
49
- * @date 2023-10-15 19:10:44
50
- * @type {IChatContainerOptions}
51
- */
52
- containerOptions?: IChatContainerOptions;
129
+ fullscreen?(target: boolean, context: object, params: object): void;
53
130
  /**
54
- * 聊天窗口标题
131
+ * 最小化操作
55
132
  *
56
- * @type {string}
133
+ * @param {boolean} target
134
+ * @param {object} context
135
+ * @param {object} params
57
136
  * @memberof IChatOptions
58
137
  */
59
- caption?: string;
138
+ minimize?(target: boolean, context: object, params: object): void;
60
139
  }