@ibiz-template-plugin/ai-chat 0.0.9 → 0.0.11

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 (83) hide show
  1. package/dist/index.es.js +1915 -1282
  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/app.d.ts +1 -0
  6. package/dist/types/components/chat-container/chat-container.d.ts +213 -0
  7. package/dist/types/components/chat-input/chat-input.d.ts +22 -0
  8. package/dist/types/components/chat-input-material/chat-input-material.d.ts +12 -0
  9. package/dist/types/components/chat-input-material-item/chat-input-material-item.d.ts +30 -0
  10. package/dist/types/components/chat-input-material-item/common-material/common-material.d.ts +8 -0
  11. package/dist/types/components/chat-input-material-item/ossfile-material/ossfile-material.d.ts +7 -0
  12. package/dist/types/components/chat-message-item/chat-message-item.d.ts +30 -0
  13. package/dist/types/components/chat-message-item/error-message/error-message.d.ts +30 -0
  14. package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +30 -0
  15. package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +13 -0
  16. package/dist/types/components/chat-message-item/user-message/user-message.d.ts +23 -0
  17. package/dist/types/components/chat-messages/chat-messages.d.ts +20 -0
  18. package/dist/types/components/chat-thought-chain/chat-thought-chain.d.ts +10 -0
  19. package/dist/types/components/chat-toolbar/chat-toolbar.d.ts +41 -0
  20. package/dist/types/components/chat-topic-item/chat-topic-item.d.ts +9 -0
  21. package/dist/types/components/chat-topics/chat-topics.d.ts +12 -0
  22. package/dist/types/components/index.d.ts +1 -0
  23. package/dist/types/components/popup/popup.d.ts +16 -0
  24. package/dist/types/constants/index.d.ts +22 -0
  25. package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +203 -0
  26. package/dist/types/controller/ai-material/ai-material-factory.d.ts +6 -0
  27. package/dist/types/controller/ai-material/common-helper.d.ts +12 -0
  28. package/dist/types/controller/ai-material/file-helper.d.ts +21 -0
  29. package/dist/types/controller/ai-material/material-helper.d.ts +15 -0
  30. package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +96 -0
  31. package/dist/types/controller/chat/chat.controller.d.ts +122 -0
  32. package/dist/types/controller/index.d.ts +4 -0
  33. package/dist/types/entity/chart-material/chart-material.d.ts +9 -0
  34. package/dist/types/entity/chart-topic/chart-topic.d.ts +20 -0
  35. package/dist/types/entity/chat-message/chat-message.d.ts +37 -0
  36. package/dist/types/entity/index.d.ts +3 -0
  37. package/dist/types/global.d.ts +2 -0
  38. package/dist/types/icons/ai-svg.d.ts +1 -0
  39. package/dist/types/icons/audio-svg.d.ts +1 -0
  40. package/dist/types/icons/checkmark-circle-svg.d.ts +3 -0
  41. package/dist/types/icons/chevron-down-svg.d.ts +3 -0
  42. package/dist/types/icons/close-full-screen-svg.d.ts +1 -0
  43. package/dist/types/icons/close-svg.d.ts +1 -0
  44. package/dist/types/icons/copy-svg.d.ts +1 -0
  45. package/dist/types/icons/default-material-svg.d.ts +1 -0
  46. package/dist/types/icons/delete-svg.d.ts +1 -0
  47. package/dist/types/icons/fill-svg.d.ts +1 -0
  48. package/dist/types/icons/full-screen-svg.d.ts +1 -0
  49. package/dist/types/icons/index.d.ts +23 -0
  50. package/dist/types/icons/link-svg.d.ts +3 -0
  51. package/dist/types/icons/loading-svg.d.ts +3 -0
  52. package/dist/types/icons/material-remove-svg.d.ts +1 -0
  53. package/dist/types/icons/minimize-svg.d.ts +1 -0
  54. package/dist/types/icons/more-svg.d.ts +4 -0
  55. package/dist/types/icons/new-dialogue.d.ts +1 -0
  56. package/dist/types/icons/paperclip-svg.d.ts +1 -0
  57. package/dist/types/icons/recording-svg.d.ts +1 -0
  58. package/dist/types/icons/refresh-svg.d.ts +1 -0
  59. package/dist/types/icons/remove-svg.d.ts +1 -0
  60. package/dist/types/icons/send-svg.d.ts +1 -0
  61. package/dist/types/icons/upload-svg.d.ts +1 -0
  62. package/dist/types/index.d.ts +3 -0
  63. package/dist/types/interface/i-chat-container/i-chat-container.d.ts +66 -0
  64. package/dist/types/interface/i-chat-message/i-chat-message.d.ts +91 -0
  65. package/dist/types/interface/i-chat-options/i-chat-options.d.ts +156 -0
  66. package/dist/types/interface/i-chat-thought-chain/i-chat-thought-chain.d.ts +35 -0
  67. package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +62 -0
  68. package/dist/types/interface/i-config-service/i-config-service.d.ts +27 -0
  69. package/dist/types/interface/i-container-options/i-container-options.d.ts +45 -0
  70. package/dist/types/interface/i-file-uploader-options/i-file-uploader-options.d.ts +27 -0
  71. package/dist/types/interface/i-material/i-material.d.ts +34 -0
  72. package/dist/types/interface/i-message-item-provider/i-message-item-provider.d.ts +18 -0
  73. package/dist/types/interface/i-portal-async-action/i-portal-async-action.d.ts +90 -0
  74. package/dist/types/interface/i-topic-options/i-topic-options.d.ts +102 -0
  75. package/dist/types/interface/index.d.ts +11 -0
  76. package/dist/types/main.d.ts +1 -0
  77. package/dist/types/utils/index.d.ts +6 -0
  78. package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
  79. package/dist/types/utils/util/file-uploader.d.ts +36 -0
  80. package/dist/types/utils/util/indexdb-util.d.ts +91 -0
  81. package/dist/types/utils/util/material-resource-parser.d.ts +66 -0
  82. package/dist/types/utils/util/util.d.ts +29 -0
  83. package/package.json +1 -1
@@ -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,11 @@
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';
9
+ export type { IMaterial } from './i-material/i-material';
10
+ export type { FileUploaderOptions } from './i-file-uploader-options/i-file-uploader-options';
11
+ export type { IChatContainerOptions } from './i-chat-container/i-chat-container';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
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';
5
+ export { FileUploader } from './util/file-uploader';
6
+ export { MaterialResourceParser } from './util/material-resource-parser';
@@ -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,36 @@
1
+ import { FileUploaderOptions } from '../../interface';
2
+ /**
3
+ * 文件上传器
4
+ *
5
+ * @author tony001
6
+ * @date 2025-02-28 10:02:14
7
+ * @export
8
+ * @class FileUploader
9
+ * @template T
10
+ */
11
+ export declare class FileUploader<T> {
12
+ private options;
13
+ /**
14
+ * Creates an instance of FileUploader.
15
+ * @author tony001
16
+ * @date 2025-02-28 15:02:15
17
+ * @param {FileUploaderOptions<T>} options
18
+ */
19
+ constructor(options: FileUploaderOptions<T>);
20
+ /**
21
+ * 打开文件选择对话框
22
+ */
23
+ openFilePicker(): void;
24
+ /**
25
+ * 处理选择的文件
26
+ */
27
+ private handleFiles;
28
+ /**
29
+ * 处理单个文件上传
30
+ */
31
+ private processFile;
32
+ /**
33
+ * 格式化文件大小
34
+ */
35
+ private formatSize;
36
+ }
@@ -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,66 @@
1
+ import { IMaterial } from '../../interface';
2
+ /**
3
+ * 素材资源解析器
4
+ *
5
+ * @author tony001
6
+ * @date 2025-03-03 11:03:59
7
+ * @export
8
+ * @class MaterialResourceParser
9
+ */
10
+ export declare class MaterialResourceParser {
11
+ /**
12
+ * 从XML元素中提取CDATA内容
13
+ *
14
+ * @author tony001
15
+ * @date 2025-03-03 15:03:43
16
+ * @private
17
+ * @static
18
+ * @param {(Element | null)} element
19
+ * @return {*} {(string | null)}
20
+ */
21
+ private static getCdataContent;
22
+ /**
23
+ * XML 字符串转数据对象
24
+ *
25
+ * @author tony001
26
+ * @date 2025-03-03 11:03:17
27
+ * @static
28
+ * @param {string} xmlString
29
+ * @return {*} {IMaterial[]}
30
+ */
31
+ static parse(xmlString: string): IMaterial[];
32
+ /**
33
+ * 混合内容解析
34
+ *
35
+ * @author tony001
36
+ * @date 2025-03-03 13:03:35
37
+ * @static
38
+ * @param {string} input 包含 XML 和其他文本的混合字符串
39
+ * @return {*} {{
40
+ * resources: IMaterial[];
41
+ * remainingText: string;
42
+ * hasResources: boolean;
43
+ * error?: string;
44
+ * }}
45
+ */
46
+ static parseMixedContent(input: string): {
47
+ /** 解析出的资源对象数组 */
48
+ resources: IMaterial[];
49
+ /** 去除 XML 后的剩余文本 */
50
+ remainingText: string;
51
+ /** 是否存在有效资源标签 */
52
+ hasResources: boolean;
53
+ /** 解析错误信息 (可选) */
54
+ error?: string;
55
+ };
56
+ /**
57
+ * 数据对象转 XML 字符串
58
+ *
59
+ * @author tony001
60
+ * @date 2025-03-03 11:03:51
61
+ * @static
62
+ * @param {IMaterial[]} resources
63
+ * @return {*} {string}
64
+ */
65
+ static stringify(resources: IMaterial[]): string;
66
+ }
@@ -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.11",
4
4
  "description": "使用 rollup 编译 vue 组件或者 jsx",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",