@ibiz-template-plugin/ibiz-mob-ai-chat 0.0.1
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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/assets/gif/halo.gif +0 -0
- package/dist/assets/svg/AIChat.svg +1 -0
- package/dist/index.es.js +4425 -0
- package/dist/index.legacy.js +1 -0
- package/dist/polyfills.legacy.js +1 -0
- package/dist/style.css +1 -0
- package/dist/types/components/back-bottom/back-bottom.d.ts +57 -0
- package/dist/types/components/chart-material/chart-material-item/chart-material-item.d.ts +36 -0
- package/dist/types/components/chart-material/chart-material.d.ts +32 -0
- package/dist/types/components/chart-suggestion/chart-suggestion.d.ts +22 -0
- package/dist/types/components/chart-thought-chain/chart-thought-chain.d.ts +21 -0
- package/dist/types/components/chart-tool-call/chart-tool-call-item/chart-tool-call-item.d.ts +21 -0
- package/dist/types/components/chart-tool-call/chart-tool-call.d.ts +21 -0
- package/dist/types/components/chat-container/chat-container.d.ts +91 -0
- package/dist/types/components/chat-input/chat-input.d.ts +37 -0
- package/dist/types/components/chat-messages/chat-message-hook.d.ts +14 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +45 -0
- package/dist/types/components/chat-messages/common/error-message/error-message.d.ts +17 -0
- package/dist/types/components/chat-messages/common/index.d.ts +4 -0
- package/dist/types/components/chat-messages/common/markdown-message/markdown-message.d.ts +27 -0
- package/dist/types/components/chat-messages/common/unknown-message/unknown-message.d.ts +17 -0
- package/dist/types/components/chat-messages/common/user-message/user-message.d.ts +33 -0
- package/dist/types/components/chat-toolbar/chat-input-toolbar/chat-input-toolbar.d.ts +36 -0
- package/dist/types/components/chat-toolbar/chat-message-toolbar/chat-message-toolbar.d.ts +77 -0
- package/dist/types/components/chat-toolbar/chat-toolbar-hook.d.ts +14 -0
- package/dist/types/components/chat-toolbar/chat-toolbar-item/chat-toolbar-item.d.ts +44 -0
- package/dist/types/components/chat-toolbar/index.d.ts +3 -0
- package/dist/types/components/custom-modal/custom-modal.d.ts +10 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/constants/index.d.ts +14 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +372 -0
- package/dist/types/controller/ai-material/ai-material-factory.d.ts +7 -0
- package/dist/types/controller/ai-material/common-helper.d.ts +13 -0
- package/dist/types/controller/ai-material/file-helper.d.ts +22 -0
- package/dist/types/controller/ai-material/material-helper.d.ts +16 -0
- package/dist/types/controller/ai-topic/ai-topic.controller.d.ts +165 -0
- package/dist/types/controller/chat/chat.controller.d.ts +138 -0
- package/dist/types/controller/index.d.ts +4 -0
- package/dist/types/entity/ai-agent/ai-agent.d.ts +12 -0
- package/dist/types/entity/chart-material/chart-material.d.ts +10 -0
- package/dist/types/entity/chart-topic/chart-topic.d.ts +28 -0
- package/dist/types/entity/chat-message/chat-message.d.ts +64 -0
- package/dist/types/entity/chat-suggestion/chat-suggestion.d.ts +9 -0
- package/dist/types/entity/index.d.ts +5 -0
- package/dist/types/global.d.ts +3 -0
- package/dist/types/icon/index.d.ts +1 -0
- package/dist/types/icon/svg.d.ts +101 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interface/i-ai-agent/i-ai-agent.d.ts +21 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +107 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +150 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +263 -0
- package/dist/types/interface/i-chat-suggestion/i-chat-suggestion.d.ts +26 -0
- package/dist/types/interface/i-chat-tool-call/i-chat-tool-call.d.ts +39 -0
- package/dist/types/interface/i-chat-toolbar-item/i-chat-toolbar-item.d.ts +75 -0
- package/dist/types/interface/i-config-service/i-config-service.d.ts +27 -0
- package/dist/types/interface/i-container-options/i-container-options.d.ts +51 -0
- package/dist/types/interface/i-file-uploader-options/i-file-uploader-options.d.ts +27 -0
- package/dist/types/interface/i-material/i-material.d.ts +34 -0
- package/dist/types/interface/i-message-item-provider/i-message-item-provider.d.ts +18 -0
- package/dist/types/interface/i-portal-async-action/i-portal-async-action.d.ts +90 -0
- package/dist/types/interface/i-remote-resource/i-remote-resource.d.ts +68 -0
- package/dist/types/interface/i-resource-options/i-resource-options.d.ts +61 -0
- package/dist/types/interface/i-topic-options/i-topic-options.d.ts +147 -0
- package/dist/types/interface/index.d.ts +15 -0
- package/dist/types/utils/index.d.ts +10 -0
- package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
- package/dist/types/utils/util/chat-suggestion-parser.d.ts +67 -0
- package/dist/types/utils/util/chat-tool-call-parser.d.ts +17 -0
- package/dist/types/utils/util/drag-util.d.ts +28 -0
- package/dist/types/utils/util/file-uploader.d.ts +37 -0
- package/dist/types/utils/util/indexdb-util.d.ts +91 -0
- package/dist/types/utils/util/material-resource-parser.d.ts +67 -0
- package/dist/types/utils/util/remote-resource-util.d.ts +26 -0
- package/dist/types/utils/util/text-hash-util.d.ts +8 -0
- package/dist/types/utils/util/util.d.ts +50 -0
- package/package.json +89 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IChatMessage, IRemoteMessage } from '../../interface';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 基于远程类型角色转换
|
|
5
|
+
* @param type
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function getMsgRoleByRemoteType(type: string): 'USER' | 'ASSISTANT' | 'SYSTEM';
|
|
9
|
+
/**
|
|
10
|
+
* 基于远程状态转换至消息状态
|
|
11
|
+
* @param state
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function getMsgStateByRemoteState(state: 'pending' | 'sent' | 'failed' | 'canceled'): 10 | 20 | 30 | 40;
|
|
15
|
+
/**
|
|
16
|
+
* 基于远程状态转换至消息类型
|
|
17
|
+
* @param state
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare function getMsgTypeByRemoteState(state: 'pending' | 'sent' | 'failed' | 'canceled'): string | 'DEFAULT' | 'ERROR';
|
|
21
|
+
/**
|
|
22
|
+
* 基于远程消息转换至本地消息
|
|
23
|
+
* @param remoteMsg
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
export declare function getMsgByRemoteMsg(remoteMsg: IRemoteMessage): IChatMessage;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
/**
|
|
11
|
+
* 截取最后一个@符号之前的字符串,如果没有@符号,返回原字符串
|
|
12
|
+
* @param str
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function getStringBeforeLastAt(str: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* 判断字符串是否是svg的格式
|
|
18
|
+
*
|
|
19
|
+
* @author tony001
|
|
20
|
+
* @date 2025-03-12 17:03:40
|
|
21
|
+
* @export
|
|
22
|
+
* @param {string} str
|
|
23
|
+
* @return {*} {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export declare function isSvg(str: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* 获取会话标识(TOPIC:适用于多话题场景;INLINE:适用于ai行内会话场景;TEMP:适用于传统ai编辑器会话场景)
|
|
28
|
+
* @param sessionID
|
|
29
|
+
*/
|
|
30
|
+
export declare function getChatSessionId(type: 'TOPIC' | 'INLINE' | 'TEMP', sessionID?: string): string;
|
|
31
|
+
export declare class TextUtil {
|
|
32
|
+
/**
|
|
33
|
+
* input元素,用于存储拷贝的文本
|
|
34
|
+
*
|
|
35
|
+
* @author zhanghengfeng
|
|
36
|
+
* @date 2023-08-31 20:08:06
|
|
37
|
+
* @private
|
|
38
|
+
* @type {(HTMLInputElement | null)}
|
|
39
|
+
*/
|
|
40
|
+
static inputElement: HTMLInputElement | null;
|
|
41
|
+
/**
|
|
42
|
+
* 拷贝文本
|
|
43
|
+
*
|
|
44
|
+
* @author zhanghengfeng
|
|
45
|
+
* @date 2023-08-31 11:08:51
|
|
46
|
+
* @param {string} value
|
|
47
|
+
* @return {*} {boolean}
|
|
48
|
+
*/
|
|
49
|
+
static copy(value: string): boolean;
|
|
50
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ibiz-template-plugin/ibiz-mob-ai-chat",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "iBiz 移动端AI交互框插件",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.es.js",
|
|
7
|
+
"module": "dist/index.es.js",
|
|
8
|
+
"types": "dist/types/index.d.ts",
|
|
9
|
+
"system": "dist/index.legacy.js",
|
|
10
|
+
"styles": [
|
|
11
|
+
"dist/index.min.css"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"author": "iBiz",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"build:watch": "vite build --watch",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"publish:next": "npm run build && npm publish --access public --tag=next --registry=https://registry.npmjs.org/",
|
|
24
|
+
"publish:dev": "npm run build && npm publish --access public --tag=dev --registry=https://registry.npmjs.org/",
|
|
25
|
+
"publish:beta": "npm run build && npm publish --access public --tag=beta --registry=https://registry.npmjs.org/",
|
|
26
|
+
"publish:npm": "npm run build && npm publish --access public --registry=https://registry.npmjs.org/",
|
|
27
|
+
"publish:local": "npm run build && npm publish --access public --registry=http://172.16.240.221:8081/repository/local/"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@ibiz-template/scss-utils": "^0.0.2",
|
|
31
|
+
"autosize": "^6.0.1",
|
|
32
|
+
"interactjs": "^1.10.19",
|
|
33
|
+
"qx-util": "^0.4.8",
|
|
34
|
+
"path-browserify": "^1.0.1",
|
|
35
|
+
"cherry-markdown": "^0.8.26",
|
|
36
|
+
"vite-plugin-libcss": "^1.1.1",
|
|
37
|
+
"vant": "^4.7.2",
|
|
38
|
+
"vue": "^3.3.8"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@commitlint/cli": "^18.2.0",
|
|
42
|
+
"@commitlint/config-conventional": "^18.1.0",
|
|
43
|
+
"@vitejs/plugin-vue": "^4.6.2",
|
|
44
|
+
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
45
|
+
"@qx-chitanda/vite-plugin-lib-legacy": "^4.1.1",
|
|
46
|
+
"@types/autosize": "^4.0.2",
|
|
47
|
+
"@types/lodash-es": "^4.17.10",
|
|
48
|
+
"@types/node": "^20.8.10",
|
|
49
|
+
"@types/path-browserify": "^1.0.1",
|
|
50
|
+
"@types/qs": "^6.9.9",
|
|
51
|
+
"@types/ramda": "^0.29.7",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
53
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
54
|
+
"eslint": "^8.52.0",
|
|
55
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
56
|
+
"eslint-config-prettier": "^9.0.0",
|
|
57
|
+
"eslint-plugin-import": "^2.29.0",
|
|
58
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
59
|
+
"eslint-plugin-react": "^7.33.2",
|
|
60
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
61
|
+
"husky": "^8.0.3",
|
|
62
|
+
"lint-staged": "^15.0.2",
|
|
63
|
+
"prettier": "^3.0.3",
|
|
64
|
+
"sass": "^1.69.5",
|
|
65
|
+
"stylelint": "^15.11.0",
|
|
66
|
+
"stylelint-config-ali": "^1.1.0",
|
|
67
|
+
"stylelint-config-prettier": "^9.0.5",
|
|
68
|
+
"stylelint-config-recess-order": "^4.3.0",
|
|
69
|
+
"stylelint-config-standard": "^34.0.0",
|
|
70
|
+
"stylelint-config-standard-scss": "^11.1.0",
|
|
71
|
+
"stylelint-scss": "^5.3.0",
|
|
72
|
+
"typescript": "^5.2.2",
|
|
73
|
+
"vite": "^4.5.0",
|
|
74
|
+
"vite-plugin-dts": "^3.6.3",
|
|
75
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
76
|
+
"vue-tsc": "^1.8.22"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"vue": "^3.3.8",
|
|
80
|
+
"vant": "^4.7.2",
|
|
81
|
+
"cherry-markdown": "^0.8.26",
|
|
82
|
+
"interactjs": "^1.10.19",
|
|
83
|
+
"qx-util": "^0.4.8"
|
|
84
|
+
},
|
|
85
|
+
"lint-staged": {
|
|
86
|
+
"*.ts": "eslint --fix",
|
|
87
|
+
"*.scss": "stylelint --custom-syntax=postcss-scss"
|
|
88
|
+
}
|
|
89
|
+
}
|