@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.
Files changed (62) hide show
  1. package/dist/types/app.d.ts +1 -0
  2. package/dist/types/components/chat-container/chat-container.d.ts +185 -0
  3. package/dist/types/components/chat-input/chat-input.d.ts +12 -0
  4. package/dist/types/components/chat-message-item/chat-message-item.d.ts +30 -0
  5. package/dist/types/components/chat-message-item/error-message/error-message.d.ts +30 -0
  6. package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +30 -0
  7. package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +13 -0
  8. package/dist/types/components/chat-message-item/user-message/user-message.d.ts +23 -0
  9. package/dist/types/components/chat-messages/chat-messages.d.ts +20 -0
  10. package/dist/types/components/chat-thought-chain/chat-thought-chain.d.ts +10 -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/index.d.ts +1 -0
  15. package/dist/types/components/popup/popup.d.ts +15 -0
  16. package/dist/types/constants/index.d.ts +22 -0
  17. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +162 -0
  18. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +96 -0
  19. package/dist/types/controller/chat/chat.controller.d.ts +122 -0
  20. package/dist/types/controller/index.d.ts +3 -0
  21. package/dist/types/entity/chart-topic/chart-topic.d.ts +20 -0
  22. package/dist/types/entity/chat-message/chat-message.d.ts +37 -0
  23. package/dist/types/entity/index.d.ts +2 -0
  24. package/dist/types/global.d.ts +2 -0
  25. package/dist/types/icons/ai-svg.d.ts +1 -0
  26. package/dist/types/icons/audio-svg.d.ts +1 -0
  27. package/dist/types/icons/checkmark-circle-svg.d.ts +3 -0
  28. package/dist/types/icons/chevron-down-svg.d.ts +3 -0
  29. package/dist/types/icons/close-full-screen-svg.d.ts +1 -0
  30. package/dist/types/icons/close-svg.d.ts +1 -0
  31. package/dist/types/icons/copy-svg.d.ts +1 -0
  32. package/dist/types/icons/delete-svg.d.ts +1 -0
  33. package/dist/types/icons/fill-svg.d.ts +1 -0
  34. package/dist/types/icons/full-screen-svg.d.ts +1 -0
  35. package/dist/types/icons/index.d.ts +19 -0
  36. package/dist/types/icons/link-svg.d.ts +3 -0
  37. package/dist/types/icons/loading-svg.d.ts +3 -0
  38. package/dist/types/icons/minimize-svg.d.ts +1 -0
  39. package/dist/types/icons/more-svg.d.ts +4 -0
  40. package/dist/types/icons/new-dialogue.d.ts +1 -0
  41. package/dist/types/icons/recording-svg.d.ts +1 -0
  42. package/dist/types/icons/refresh-svg.d.ts +1 -0
  43. package/dist/types/icons/remove-svg.d.ts +1 -0
  44. package/dist/types/icons/send-svg.d.ts +1 -0
  45. package/dist/types/index.d.ts +3 -0
  46. package/dist/types/interface/i-chat-container/i-chat-container.d.ts +58 -0
  47. package/dist/types/interface/i-chat-message/i-chat-message.d.ts +91 -0
  48. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +139 -0
  49. package/dist/types/interface/i-chat-thought-chain/i-chat-thought-chain.d.ts +35 -0
  50. package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +53 -0
  51. package/dist/types/interface/i-config-service/i-config-service.d.ts +27 -0
  52. package/dist/types/interface/i-container-options/i-container-options.d.ts +45 -0
  53. package/dist/types/interface/i-message-item-provider/i-message-item-provider.d.ts +18 -0
  54. package/dist/types/interface/i-portal-async-action/i-portal-async-action.d.ts +90 -0
  55. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +102 -0
  56. package/dist/types/interface/index.d.ts +8 -0
  57. package/dist/types/main.d.ts +1 -0
  58. package/dist/types/utils/index.d.ts +4 -0
  59. package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
  60. package/dist/types/utils/util/indexdb-util.d.ts +91 -0
  61. package/dist/types/utils/util/util.d.ts +29 -0
  62. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description AI聊天思维链
3
+ * @export
4
+ * @interface IChatThoughtChain
5
+ */
6
+ export interface IChatThoughtChain {
7
+ /**
8
+ * 消息标识
9
+ *
10
+ * @author chitanda
11
+ * @date 2023-09-05 15:09:43
12
+ * @type {string}
13
+ */
14
+ title: string;
15
+ /**
16
+ * 消息名称
17
+ *
18
+ * @author chitanda
19
+ * @date 2023-09-05 15:09:49
20
+ * @type {string}
21
+ */
22
+ description: string;
23
+ /**
24
+ * @description 图标
25
+ * @type {React.ReactNode}
26
+ * @memberof IChatThoughtChain
27
+ */
28
+ icon?: React.ReactNode;
29
+ /**
30
+ * @description 是否完成
31
+ * @type {boolean}
32
+ * @memberof IChatThoughtChain
33
+ */
34
+ done?: boolean;
35
+ }
@@ -0,0 +1,53 @@
1
+ import { VNode } from 'preact';
2
+ /**
3
+ * 聊天自定义工具栏项接口
4
+ *
5
+ * @export
6
+ * @interface IChatToolbarItem
7
+ */
8
+ export interface IChatToolbarItem {
9
+ /**
10
+ * 标题
11
+ *
12
+ * @memberof IChatToolbarItem
13
+ */
14
+ label?: string | VNode | ((h: Function) => VNode);
15
+ /**
16
+ * 提示信息
17
+ *
18
+ * @type {string}
19
+ * @memberof IChatToolbarItem
20
+ */
21
+ title?: string;
22
+ /**
23
+ * 图标
24
+ *
25
+ * @memberof IChatToolbarItem
26
+ */
27
+ icon?: string | VNode | ((h: Function) => VNode);
28
+ /**
29
+ * 是否禁用
30
+ *
31
+ * @memberof IChatToolbarItem
32
+ */
33
+ disabled?: boolean | ((data: object) => boolean);
34
+ /**
35
+ * 是否隐藏
36
+ *
37
+ * @memberof IChatToolbarItem
38
+ */
39
+ hidden?: boolean | ((data: object) => boolean);
40
+ /**
41
+ * 自定义类名
42
+ *
43
+ * @type {string}
44
+ * @memberof IChatToolbarItem
45
+ */
46
+ customClass?: string;
47
+ /**
48
+ * 行为项点击
49
+ *
50
+ * @memberof IChatToolbarItem
51
+ */
52
+ onClick?: (e: MouseEvent, context: object, params: object, data?: object) => void;
53
+ }
@@ -0,0 +1,27 @@
1
+ export interface IConfigService {
2
+ /**
3
+ * 保存配置
4
+ *
5
+ * @author tony001
6
+ * @date 2025-02-23 16:02:33
7
+ * @param {object} data
8
+ * @return {*} {Promise<boolean>}
9
+ */
10
+ save(data: object): Promise<boolean>;
11
+ /**
12
+ * 重置配置
13
+ *
14
+ * @author tony001
15
+ * @date 2025-02-23 16:02:48
16
+ * @return {*} {Promise<boolean>}
17
+ */
18
+ reset(): Promise<boolean>;
19
+ /**
20
+ * 加载配置
21
+ *
22
+ * @author tony001
23
+ * @date 2025-02-23 16:02:57
24
+ * @return {*} {Promise<object>}
25
+ */
26
+ load(): Promise<object>;
27
+ }
@@ -0,0 +1,45 @@
1
+ import { IChatContainerOptions } from '../i-chat-container/i-chat-container';
2
+ import { IChatOptions } from '../i-chat-options/i-chat-options';
3
+ import { ITopicOptions } from '../i-topic-options/i-topic-options';
4
+ /**
5
+ * ai容器配置参数
6
+ *
7
+ * @author tony001
8
+ * @date 2025-02-24 11:02:46
9
+ * @export
10
+ * @interface IContainerOptions
11
+ */
12
+ export interface IContainerOptions {
13
+ /**
14
+ * 模式,细分为默认模式(聊天框)和话题模式(支持多话题切换),聊天框为默认模式
15
+ *
16
+ * @author tony001
17
+ * @date 2025-02-20 14:02:36
18
+ * @type {('DEFAULT' | 'TOPIC')}
19
+ */
20
+ mode?: 'DEFAULT' | 'TOPIC';
21
+ /**
22
+ * 话题参数(话题模式必填)
23
+ *
24
+ * @author tony001
25
+ * @date 2025-02-20 15:02:02
26
+ * @type {ITopicOptions}
27
+ */
28
+ topicOptions?: ITopicOptions;
29
+ /**
30
+ * 聊天窗口配置参数
31
+ *
32
+ * @author tony001
33
+ * @date 2025-02-24 11:02:53
34
+ * @type {IChatOptions}
35
+ */
36
+ chatOptions: IChatOptions;
37
+ /**
38
+ * ai容器呈现
39
+ *
40
+ * @author chitanda
41
+ * @date 2023-10-15 19:10:44
42
+ * @type {IChatContainerOptions}
43
+ */
44
+ containerOptions?: IChatContainerOptions;
45
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 项消息绘制适配器
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-10-09 16:10:11
6
+ * @export
7
+ * @interface IMessageItemProvider
8
+ */
9
+ export interface IMessageItemProvider {
10
+ /**
11
+ * 绘制的组件
12
+ *
13
+ * @author chitanda
14
+ * @date 2023-10-09 16:10:38
15
+ * @type {*}
16
+ */
17
+ component: any;
18
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * 异步作业信息
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-09-05 15:09:59
6
+ * @export
7
+ * @interface IPortalAsyncAction
8
+ */
9
+ export interface IPortalAsyncAction {
10
+ /**
11
+ * 会话标识
12
+ *
13
+ * @author chitanda
14
+ * @date 2023-09-05 15:09:57
15
+ * @type {string}
16
+ */
17
+ fulltopictag: string;
18
+ /**
19
+ * 异步作业类型
20
+ *
21
+ * @author chitanda
22
+ * @date 2023-09-05 15:09:09
23
+ * @type {string}
24
+ */
25
+ actiontype: string;
26
+ /**
27
+ * 作业状态
28
+ *
29
+ * @author chitanda
30
+ * @date 2023-10-10 15:10:59
31
+ * @type {(10 | 20 | 30 | 40)} 未开始 | 执行中 | 已执行 | 执行失败
32
+ */
33
+ actionstate: 10 | 20 | 30 | 40;
34
+ /**
35
+ * 异步作业执行结果
36
+ *
37
+ * @author chitanda
38
+ * @date 2023-09-05 15:09:33
39
+ * @type {unknown}
40
+ */
41
+ actionresult?: unknown;
42
+ /**
43
+ * 步骤信息
44
+ *
45
+ * @author chitanda
46
+ * @date 2023-09-05 15:09:55
47
+ * @type {string}
48
+ */
49
+ stepinfo?: string;
50
+ /**
51
+ * 异步结果下载路径,目前是留给导出数据使用
52
+ *
53
+ * @author chitanda
54
+ * @date 2023-09-05 15:09:03
55
+ * @type {string}
56
+ */
57
+ asyncresultdownloadurl?: string;
58
+ /**
59
+ * 预留参数
60
+ *
61
+ * @author chitanda
62
+ * @date 2023-09-05 15:09:32
63
+ * @type {unknown}
64
+ */
65
+ actionparam?: unknown;
66
+ /**
67
+ *预留参数2
68
+ *
69
+ * @author chitanda
70
+ * @date 2023-09-05 15:09:41
71
+ * @type {unknown}
72
+ */
73
+ actionparam2?: unknown;
74
+ /**
75
+ *预留参数3
76
+ *
77
+ * @author chitanda
78
+ * @date 2023-09-05 15:09:43
79
+ * @type {unknown}
80
+ */
81
+ actionparam3?: unknown;
82
+ /**
83
+ *预留参数4
84
+ *
85
+ * @author chitanda
86
+ * @date 2023-09-05 15:09:45
87
+ * @type {unknown}
88
+ */
89
+ actionparam4?: unknown;
90
+ }
@@ -0,0 +1,102 @@
1
+ import { IChat } from '../i-chat-options/i-chat-options';
2
+ import { IConfigService } from '../i-config-service/i-config-service';
3
+ /**
4
+ * 话题数据
5
+ *
6
+ * @author tony001
7
+ * @date 2025-02-23 17:02:34
8
+ * @export
9
+ * @interface ITopic
10
+ */
11
+ export interface ITopic {
12
+ /**
13
+ * 应用标识
14
+ *
15
+ * @author tony001
16
+ * @date 2025-02-20 18:02:07
17
+ * @type {string}
18
+ */
19
+ appid: string;
20
+ /**
21
+ * 话题标识
22
+ *
23
+ * @author tony001
24
+ * @date 2025-02-20 15:02:01
25
+ * @type {string}
26
+ */
27
+ id: string;
28
+ /**
29
+ * 话题类型
30
+ *
31
+ * @author tony001
32
+ * @date 2025-02-20 18:02:00
33
+ * @type {string}
34
+ */
35
+ type: string;
36
+ /**
37
+ * 话题标题
38
+ *
39
+ * @author tony001
40
+ * @date 2025-02-20 15:02:57
41
+ * @type {string}
42
+ */
43
+ caption?: string;
44
+ /**
45
+ * 话题主数据url,用于跳转主数据界面
46
+ *
47
+ * @author tony001
48
+ * @date 2025-02-20 15:02:08
49
+ * @type {string}
50
+ */
51
+ url?: string;
52
+ /**
53
+ * 上下文
54
+ *
55
+ * @author tony001
56
+ * @date 2025-02-24 11:02:59
57
+ * @type {IChat}
58
+ */
59
+ aiChat?: IChat;
60
+ }
61
+ /**
62
+ * 话题参数
63
+ *
64
+ * @author tony001
65
+ * @date 2025-02-20 15:02:46
66
+ * @export
67
+ * @interface ITopicOptions
68
+ */
69
+ export interface ITopicOptions extends ITopic {
70
+ /**
71
+ * 删除之前
72
+ *
73
+ * @author tony001
74
+ * @date 2025-02-24 16:02:35
75
+ * @param {object} context
76
+ * @param {object} params
77
+ * @param {ITopic} data
78
+ * @param {MouseEvent} event
79
+ * @return {*} {Promise<boolean>}
80
+ */
81
+ beforeDelete?(context: object, params: object, data: ITopic, event: MouseEvent): Promise<boolean>;
82
+ /**
83
+ * 话题行为
84
+ *
85
+ * @author tony001
86
+ * @date 2025-02-24 16:02:04
87
+ * @param { string} action
88
+ * @param {object} context
89
+ * @param {object} params
90
+ * @param {ITopic} data
91
+ * @param {MouseEvent} event
92
+ * @return {*} {Promise<boolean>}
93
+ */
94
+ action?(action: string, context: object, params: object, data: ITopic, event: MouseEvent): Promise<boolean>;
95
+ /**
96
+ * 存储服务构造器
97
+ *
98
+ * @author tony001
99
+ * @date 2025-02-23 16:02:46
100
+ */
101
+ configService: (appid: string, storageType: string, subType: string) => IConfigService;
102
+ }
@@ -0,0 +1,8 @@
1
+ export type { IChatMessage } from './i-chat-message/i-chat-message';
2
+ export type { IChat, IChatOptions } from './i-chat-options/i-chat-options';
3
+ export type { IMessageItemProvider } from './i-message-item-provider/i-message-item-provider';
4
+ export type { IPortalAsyncAction } from './i-portal-async-action/i-portal-async-action';
5
+ export type { IChatToolbarItem } from './i-chat-toolbar-item/i-chat-toolbar-item';
6
+ export type { ITopic, ITopicOptions } from './i-topic-options/i-topic-options';
7
+ export type { IContainerOptions } from './i-container-options/i-container-options';
8
+ export type { IChatThoughtChain } from './i-chat-thought-chain/i-chat-thought-chain';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { Namespace } from '@ibiz-template/scss-utils';
2
+ export { PluginStaticResource } from './plugin-static-resource/plugin-static-resource';
3
+ export { createUUID } from './util/util';
4
+ export { IndexedDBUtil } from './util/indexdb-util';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * 插件静态资源工具类
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-11-03 10:11:08
6
+ * @export
7
+ * @class PluginStaticResource
8
+ */
9
+ export declare class PluginStaticResource {
10
+ /**
11
+ * 计算出的静态资源跟路径
12
+ *
13
+ * @author chitanda
14
+ * @date 2022-11-03 10:11:08
15
+ * @protected
16
+ * @type {string}
17
+ */
18
+ protected baseDir: string;
19
+ /**
20
+ * 已经输出过路径的 style 标签
21
+ *
22
+ * @author chitanda
23
+ * @date 2023-03-23 10:03:38
24
+ * @protected
25
+ * @type {Map<string, null>}
26
+ */
27
+ protected styleElementMap: Map<string, null>;
28
+ /**
29
+ * mete 路径解析对象
30
+ *
31
+ * @author chitanda
32
+ * @date 2023-07-06 20:07:36
33
+ * @protected
34
+ * @type {URL}
35
+ */
36
+ protected url: URL;
37
+ /**
38
+ * 插件静态资源工具类.
39
+ *
40
+ * @author chitanda
41
+ * @date 2022-11-03 10:11:41
42
+ * @param {string} mateUrl import.mate.url
43
+ */
44
+ constructor(mateUrl: string);
45
+ /**
46
+ * 合并输出静态资源目录
47
+ *
48
+ * @author chitanda
49
+ * @date 2022-11-03 10:11:39
50
+ * @param {string} pathStr
51
+ * @return {*} {string}
52
+ */
53
+ dir(pathStr: string): string;
54
+ /**
55
+ * 加载样式静态资源
56
+ *
57
+ * @author chitanda
58
+ * @date 2023-03-23 10:03:49
59
+ * @param {string[]} urls
60
+ * @return {*} {Promise<void>}
61
+ */
62
+ loadStyle(urls: string[]): Promise<void>;
63
+ }
@@ -0,0 +1,91 @@
1
+ export declare class IndexedDBUtil {
2
+ static version: number;
3
+ static db: IDBDatabase | null;
4
+ static lastLink: IDBDatabase;
5
+ /**
6
+ * 检查数据库是否存在
7
+ *
8
+ * @param {string} storeName
9
+ * @return {*} {Promise<boolean>}
10
+ * @memberof IndexedDBUtil
11
+ */
12
+ static checkDataBaseExists(storeName: string): Promise<boolean>;
13
+ /**
14
+ * 删除数据库
15
+ *
16
+ * @return {*} {Promise<void>}
17
+ * @memberof IndexedDBUtil
18
+ */
19
+ static deleteDatabase(storeName: string): Promise<boolean>;
20
+ /**
21
+ * 检查是否存在某个库以及库内是否存在某个表
22
+ *
23
+ * @param {string} storeName
24
+ * @param {string} tableName
25
+ * @return {*}
26
+ * @memberof IndexedDBUtil
27
+ */
28
+ static checkTableExists(storeName: string, tableName: string): Promise<boolean>;
29
+ /**
30
+ * 创建表
31
+ *
32
+ * @param {string} storeName 库名称
33
+ * @param {(string | null)} keyPath 表主键
34
+ * @param {boolean} [useAutoIncrement=false] 是否使用自增
35
+ * @return {*} {Promise<void>}
36
+ * @memberof IndexedDBUtil
37
+ */
38
+ static createTable(storeName: string, tableName: string, keyPath: string | null, useAutoIncrement?: boolean): Promise<boolean>;
39
+ /**
40
+ * 删除表
41
+ *
42
+ * @param {string} storeName 表名称
43
+ * @return {*} {Promise<void>}
44
+ * @memberof IndexedDBUtil
45
+ */
46
+ static deleteTable(storeName: string, tableName: string): Promise<boolean>;
47
+ /**
48
+ * 新增数据
49
+ *
50
+ * @param {string} storeName 表名称
51
+ * @param {*} data 新增数据
52
+ * @return {*} {Promise<void>}
53
+ * @memberof IndexedDBUtil
54
+ */
55
+ static addData(storeName: string, tableName: string, data: object): Promise<object | null>;
56
+ /**
57
+ * 删除数据
58
+ *
59
+ * @param {string} storeName 表名称
60
+ * @param {IDBValidKey} key 数据键
61
+ * @return {*} {Promise<void>}
62
+ * @memberof IndexedDBUtil
63
+ */
64
+ static deleteData(storeName: string, tableName: string, key: IDBValidKey): Promise<boolean>;
65
+ /**
66
+ * 修改数据
67
+ *
68
+ * @param {string} storeName 表名称
69
+ * @param {*} data 需要修改的数据
70
+ * @return {*} {Promise<void>}
71
+ * @memberof IndexedDBUtil
72
+ */
73
+ static updateData(storeName: string, tableName: string, data: object): Promise<object>;
74
+ /**
75
+ * 读取单条数据
76
+ *
77
+ * @param {string} storeName 表名称
78
+ * @param {IDBValidKey} key 数据主键
79
+ * @return {*} {Promise<any>}
80
+ * @memberof IndexedDBUtil
81
+ */
82
+ static getData(storeName: string, tableName: string, key: IDBValidKey): Promise<object>;
83
+ /**
84
+ * 读取所有数据
85
+ *
86
+ * @param {string} storeName 表名称
87
+ * @return {*} {Promise<any[]>}
88
+ * @memberof IndexedDBUtil
89
+ */
90
+ static getAllData(storeName: string, tableName: string): Promise<object[]>;
91
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * 创建UUID
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-10-13 16:10:17
6
+ * @export
7
+ * @return {*} {string}
8
+ */
9
+ export declare function createUUID(): string;
10
+ export declare class TextUtil {
11
+ /**
12
+ * input元素,用于存储拷贝的文本
13
+ *
14
+ * @author zhanghengfeng
15
+ * @date 2023-08-31 20:08:06
16
+ * @private
17
+ * @type {(HTMLInputElement | null)}
18
+ */
19
+ static inputElement: HTMLInputElement | null;
20
+ /**
21
+ * 拷贝文本
22
+ *
23
+ * @author zhanghengfeng
24
+ * @date 2023-08-31 11:08:51
25
+ * @param {string} value
26
+ * @return {*} {boolean}
27
+ */
28
+ static copy(value: string): boolean;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template-plugin/ai-chat",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "使用 rollup 编译 vue 组件或者 jsx",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",