inl-ui 0.1.13 → 0.1.15
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/README.md +49 -49
- package/dist/components/index.cjs +6 -564
- package/dist/components/index.d.ts +1 -27
- package/dist/components/index.js +12 -569
- package/dist/iconfont.js +69 -69
- package/dist/index.cjs +8 -566
- package/dist/index.d.ts +1 -29
- package/dist/index.js +13 -571
- package/dist/style.css +1 -1
- package/dist/theme/index.js +70 -70
- package/dist/theme/scripts/dark-vars.js +21 -21
- package/dist/theme/scripts/default-vars.js +25 -25
- package/dist/theme/scripts/light-vars.js +22 -22
- package/dist/theme/style/color/bezierEasing.less +110 -110
- package/dist/theme/style/color/colorPalette.less +81 -81
- package/dist/theme/style/color/colors.less +162 -162
- package/dist/theme/style/color/tinyColor.less +1184 -1184
- package/dist/theme/style/compact.less +4 -4
- package/dist/theme/style/dark.less +4 -4
- package/dist/theme/style/default.less +4 -4
- package/dist/theme/style/index.less +2 -2
- package/dist/theme/style/index.tsx +2 -2
- package/dist/theme/style/themes/compact.less +295 -295
- package/dist/theme/style/themes/dark.less +790 -790
- package/dist/theme/style/themes/default.less +1067 -1067
- package/dist/theme/style/themes/index.less +7 -7
- package/dist/theme/style/themes/var-dark.less +343 -343
- package/dist/theme/style/themes/var-default.less +184 -184
- package/dist/theme/style/themes/variable.less +1122 -1122
- package/dist/theme/style/variable.less +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# 工业PC ui库
|
|
2
|
-
|
|
3
|
-
前端通用库,包括组件、hooks、utils等。
|
|
4
|
-
|
|
5
|
-
### 运行
|
|
6
|
-
|
|
7
|
-
+ 开发模式 yarn dev
|
|
8
|
-
+ 生产打包 yarn build
|
|
9
|
-
+ 生成文档 yarn build:docs
|
|
10
|
-
+ 打包图扑工具 yarn buildtp
|
|
11
|
-
|
|
12
|
-
### 使用方法
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
import inl from 'inl-ui';
|
|
16
|
-
import 'inl-ui/dist/style.css';
|
|
17
|
-
|
|
18
|
-
vue.use(inl)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### 激活主题
|
|
24
|
-
|
|
25
|
-
**vite.config.ts**
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
-
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
css: {
|
|
33
|
-
preprocessorOptions: {
|
|
34
|
-
less: {
|
|
35
|
-
javascriptEnabled: true,
|
|
36
|
-
additionalData,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 文档链接
|
|
43
|
-
|
|
44
|
-
##### [组件文档](./src/components/README.md)
|
|
45
|
-
|
|
46
|
-
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
-
|
|
48
|
-
##### [Utils文档](./src/utils/README.md)
|
|
49
|
-
|
|
1
|
+
# 工业PC ui库
|
|
2
|
+
|
|
3
|
+
前端通用库,包括组件、hooks、utils等。
|
|
4
|
+
|
|
5
|
+
### 运行
|
|
6
|
+
|
|
7
|
+
+ 开发模式 yarn dev
|
|
8
|
+
+ 生产打包 yarn build
|
|
9
|
+
+ 生成文档 yarn build:docs
|
|
10
|
+
+ 打包图扑工具 yarn buildtp
|
|
11
|
+
|
|
12
|
+
### 使用方法
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import inl from 'inl-ui';
|
|
16
|
+
import 'inl-ui/dist/style.css';
|
|
17
|
+
|
|
18
|
+
vue.use(inl)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 激活主题
|
|
24
|
+
|
|
25
|
+
**vite.config.ts**
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
+
|
|
30
|
+
...
|
|
31
|
+
|
|
32
|
+
css: {
|
|
33
|
+
preprocessorOptions: {
|
|
34
|
+
less: {
|
|
35
|
+
javascriptEnabled: true,
|
|
36
|
+
additionalData,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 文档链接
|
|
43
|
+
|
|
44
|
+
##### [组件文档](./src/components/README.md)
|
|
45
|
+
|
|
46
|
+
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
+
|
|
48
|
+
##### [Utils文档](./src/utils/README.md)
|
|
49
|
+
|
|
@@ -14,7 +14,6 @@ var qiankun = require('qiankun');
|
|
|
14
14
|
require('vite-plugin-qiankun');
|
|
15
15
|
var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
|
|
16
16
|
var mobile = require('@sszj-temp/mobile');
|
|
17
|
-
var marked = require('marked');
|
|
18
17
|
|
|
19
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
19
|
|
|
@@ -11007,6 +11006,12 @@ const getMenuDetail = () => vue.defineComponent({
|
|
|
11007
11006
|
});
|
|
11008
11007
|
|
|
11009
11008
|
const fonts = [{
|
|
11009
|
+
label: "\u9ED8\u8BA4",
|
|
11010
|
+
value: ""
|
|
11011
|
+
}, {
|
|
11012
|
+
label: "Arial",
|
|
11013
|
+
value: "Arial"
|
|
11014
|
+
}, {
|
|
11010
11015
|
label: "\u5FAE\u8F6F\u96C5\u9ED1",
|
|
11011
11016
|
value: "Microsoft YaHei"
|
|
11012
11017
|
}, {
|
|
@@ -11232,568 +11237,6 @@ const SszComment = vue.defineComponent({
|
|
|
11232
11237
|
});
|
|
11233
11238
|
var index = installComponent(SszComment, "ssz-comment");
|
|
11234
11239
|
|
|
11235
|
-
function formatDataString(str) {
|
|
11236
|
-
const lines = str.split("\n");
|
|
11237
|
-
const result = lines.filter(line => !!line.trim()).map(line => {
|
|
11238
|
-
const data = JSON.parse(line.replace(/^data: /, ""));
|
|
11239
|
-
return data.text;
|
|
11240
|
-
}).filter(line => line !== void 0).join("");
|
|
11241
|
-
return result;
|
|
11242
|
-
}
|
|
11243
|
-
function request(question, streamCallback, doneCallback) {
|
|
11244
|
-
const controller = new AbortController();
|
|
11245
|
-
const signal = controller.signal;
|
|
11246
|
-
fetch("/mt_cpp_gpt/chat", {
|
|
11247
|
-
signal,
|
|
11248
|
-
method: "POST",
|
|
11249
|
-
headers: {
|
|
11250
|
-
"Content-Type": "application/json"
|
|
11251
|
-
},
|
|
11252
|
-
body: JSON.stringify({
|
|
11253
|
-
query: question,
|
|
11254
|
-
conversation_id: ""
|
|
11255
|
-
})
|
|
11256
|
-
}).then(res => {
|
|
11257
|
-
const stream = res.body;
|
|
11258
|
-
const decoder = new TextDecoder();
|
|
11259
|
-
const reader = stream.getReader();
|
|
11260
|
-
let result = "";
|
|
11261
|
-
function processText() {
|
|
11262
|
-
return reader.read().then(({
|
|
11263
|
-
done,
|
|
11264
|
-
value
|
|
11265
|
-
}) => {
|
|
11266
|
-
if (done) {
|
|
11267
|
-
doneCallback();
|
|
11268
|
-
return;
|
|
11269
|
-
}
|
|
11270
|
-
try {
|
|
11271
|
-
const dataString = decoder.decode(value, {
|
|
11272
|
-
stream: true
|
|
11273
|
-
});
|
|
11274
|
-
const str = formatDataString(dataString);
|
|
11275
|
-
result += str;
|
|
11276
|
-
streamCallback(result);
|
|
11277
|
-
} catch (e) {}
|
|
11278
|
-
return processText();
|
|
11279
|
-
}).catch(() => {
|
|
11280
|
-
doneCallback();
|
|
11281
|
-
});
|
|
11282
|
-
}
|
|
11283
|
-
return processText();
|
|
11284
|
-
}).catch(() => {
|
|
11285
|
-
doneCallback();
|
|
11286
|
-
});
|
|
11287
|
-
return function stop() {
|
|
11288
|
-
controller.abort();
|
|
11289
|
-
};
|
|
11290
|
-
}
|
|
11291
|
-
function useQA() {
|
|
11292
|
-
const context = vue.ref([]);
|
|
11293
|
-
const answerLoading = vue.ref(false);
|
|
11294
|
-
const answer = vue.ref("");
|
|
11295
|
-
let abort = null;
|
|
11296
|
-
setTimeout(() => {
|
|
11297
|
-
const questionItem = {
|
|
11298
|
-
type: "answer",
|
|
11299
|
-
content: "",
|
|
11300
|
-
id: /* @__PURE__ */new Date().getTime(),
|
|
11301
|
-
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11302
|
-
answers: [{
|
|
11303
|
-
content: "\u4F60\u597D\uFF0C\u6211\u662F\u4F60\u7684\u5DE5\u4F5C\u4F19\u4F34 \u7F8E\u5C0F\u817E! \u6211\u53EF\u4EE5\u8F85\u52A9\u4F60\u5FEB\u901F\u83B7\u53D6\u4FE1\u606F\uFF0C\u76D1\u63A7\u3001\u67E5\u770B\u751F\u4EA7\u6307\u6807\uFF0C\u56DE\u7B54\u60A8\u7684\u9009\u7164\u4E13\u4E1A\u95EE\u9898\uFF0C\u5FEB\u8BD5\u8BD5\u4E0B\u9762\u5BF9\u8BDD\u5427\u3002",
|
|
11304
|
-
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11305
|
-
hideOperates: true,
|
|
11306
|
-
id: /* @__PURE__ */new Date().getTime()
|
|
11307
|
-
}]
|
|
11308
|
-
};
|
|
11309
|
-
context.value.push(questionItem);
|
|
11310
|
-
}, 1e3);
|
|
11311
|
-
function sendQuestion(question, questionId) {
|
|
11312
|
-
if (answerLoading.value) return;
|
|
11313
|
-
answerLoading.value = true;
|
|
11314
|
-
let questionItem = context.value.find(item => item.id === questionId);
|
|
11315
|
-
question = questionItem?.content || question;
|
|
11316
|
-
if (!questionId) {
|
|
11317
|
-
questionItem = {
|
|
11318
|
-
id: /* @__PURE__ */new Date().getTime(),
|
|
11319
|
-
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11320
|
-
content: question,
|
|
11321
|
-
answers: []
|
|
11322
|
-
};
|
|
11323
|
-
context.value.push(questionItem);
|
|
11324
|
-
}
|
|
11325
|
-
const answerItem = vue.ref({
|
|
11326
|
-
content: "\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
11327
|
-
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11328
|
-
parentId: questionItem.id,
|
|
11329
|
-
id: /* @__PURE__ */new Date().getTime()
|
|
11330
|
-
});
|
|
11331
|
-
questionItem.answers.push(answerItem.value);
|
|
11332
|
-
abort = request(question, data => {
|
|
11333
|
-
answer.value = data;
|
|
11334
|
-
answerItem.value.content = data;
|
|
11335
|
-
}, () => {
|
|
11336
|
-
answerLoading.value = false;
|
|
11337
|
-
answerItem.value.loadEnd = true;
|
|
11338
|
-
abort = null;
|
|
11339
|
-
});
|
|
11340
|
-
}
|
|
11341
|
-
function abortRequest() {
|
|
11342
|
-
if (abort) {
|
|
11343
|
-
abort();
|
|
11344
|
-
abort = null;
|
|
11345
|
-
}
|
|
11346
|
-
}
|
|
11347
|
-
return {
|
|
11348
|
-
context,
|
|
11349
|
-
answerLoading,
|
|
11350
|
-
answer,
|
|
11351
|
-
sendQuestion,
|
|
11352
|
-
abortRequest
|
|
11353
|
-
};
|
|
11354
|
-
}
|
|
11355
|
-
|
|
11356
|
-
const Input = vue.defineComponent({
|
|
11357
|
-
emits: ["send"],
|
|
11358
|
-
setup(props, {
|
|
11359
|
-
emit,
|
|
11360
|
-
expose
|
|
11361
|
-
}) {
|
|
11362
|
-
const abortRequest = vue.inject("abortRequest");
|
|
11363
|
-
const loading = vue.inject("answerLoading");
|
|
11364
|
-
const value = vue.ref("");
|
|
11365
|
-
const isFocus = vue.ref(false);
|
|
11366
|
-
const send = () => {
|
|
11367
|
-
if (loading.value) return;
|
|
11368
|
-
if (value.value.length === 0) {
|
|
11369
|
-
antDesignVue.message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
|
|
11370
|
-
return;
|
|
11371
|
-
}
|
|
11372
|
-
emit("send", value.value);
|
|
11373
|
-
value.value = "";
|
|
11374
|
-
};
|
|
11375
|
-
const handleAbord = () => {
|
|
11376
|
-
abortRequest();
|
|
11377
|
-
};
|
|
11378
|
-
const handleMicClick = () => {
|
|
11379
|
-
antDesignVue.message.info("\u6682\u4E0D\u652F\u6301\u8BED\u97F3\u8F93\u5165");
|
|
11380
|
-
};
|
|
11381
|
-
const clear = () => value.value = "";
|
|
11382
|
-
expose({
|
|
11383
|
-
clear
|
|
11384
|
-
});
|
|
11385
|
-
return () => vue.createVNode("div", {
|
|
11386
|
-
"class": ["chat-box-input", {
|
|
11387
|
-
focus: isFocus.value
|
|
11388
|
-
}]
|
|
11389
|
-
}, [vue.createVNode("img", {
|
|
11390
|
-
"class": "img img-mic",
|
|
11391
|
-
"src": "/micro-assets/largeLanguageModel/mic.png",
|
|
11392
|
-
"alt": "",
|
|
11393
|
-
"onClick": handleMicClick
|
|
11394
|
-
}, null), vue.createVNode(vue.resolveComponent("a-input"), {
|
|
11395
|
-
"value": value.value,
|
|
11396
|
-
"onUpdate:value": $event => value.value = $event,
|
|
11397
|
-
"bordered": false,
|
|
11398
|
-
"placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
|
|
11399
|
-
"onFocus": () => isFocus.value = true,
|
|
11400
|
-
"onBlur": () => isFocus.value = false,
|
|
11401
|
-
"onPressEnter": send
|
|
11402
|
-
}, null), loading.value ? vue.createVNode("img", {
|
|
11403
|
-
"class": "btn-abort",
|
|
11404
|
-
"title": "\u4E2D\u6B62\u56DE\u7B54",
|
|
11405
|
-
"src": "/micro-assets/largeLanguageModel/btn-abort.png",
|
|
11406
|
-
"onClick": handleAbord
|
|
11407
|
-
}, null) : vue.createVNode("img", {
|
|
11408
|
-
"class": "img img-send",
|
|
11409
|
-
"src": "/micro-assets/largeLanguageModel/send.png",
|
|
11410
|
-
"onClick": send
|
|
11411
|
-
}, null)]);
|
|
11412
|
-
}
|
|
11413
|
-
});
|
|
11414
|
-
|
|
11415
|
-
const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
|
|
11416
|
-
const Bottom = vue.defineComponent({
|
|
11417
|
-
emits: ["send"],
|
|
11418
|
-
setup(props, {
|
|
11419
|
-
emit
|
|
11420
|
-
}) {
|
|
11421
|
-
const inputRef = vue.ref();
|
|
11422
|
-
const handleSend = msg => {
|
|
11423
|
-
inputRef.value.clear();
|
|
11424
|
-
emit("send", msg);
|
|
11425
|
-
};
|
|
11426
|
-
return () => {
|
|
11427
|
-
tips.map(tip => vue.createVNode("div", {
|
|
11428
|
-
"class": "tip",
|
|
11429
|
-
"onClick": () => handleSend(tip)
|
|
11430
|
-
}, [tip]));
|
|
11431
|
-
return vue.createVNode("div", {
|
|
11432
|
-
"class": "bottom"
|
|
11433
|
-
}, [vue.createVNode(Input, {
|
|
11434
|
-
"ref": inputRef,
|
|
11435
|
-
"onSend": handleSend
|
|
11436
|
-
}, null), vue.createVNode("div", {
|
|
11437
|
-
"class": "exemption"
|
|
11438
|
-
}, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"])]);
|
|
11439
|
-
};
|
|
11440
|
-
}
|
|
11441
|
-
});
|
|
11442
|
-
|
|
11443
|
-
const Avatar = vue.defineComponent({
|
|
11444
|
-
props: {
|
|
11445
|
-
avatar: {
|
|
11446
|
-
type: String,
|
|
11447
|
-
required: true
|
|
11448
|
-
},
|
|
11449
|
-
name: {
|
|
11450
|
-
type: String,
|
|
11451
|
-
required: true
|
|
11452
|
-
},
|
|
11453
|
-
reverse: Boolean
|
|
11454
|
-
},
|
|
11455
|
-
setup(props, {
|
|
11456
|
-
emit
|
|
11457
|
-
}) {
|
|
11458
|
-
return () => vue.createVNode("div", {
|
|
11459
|
-
"class": ["chat-avatar", {
|
|
11460
|
-
"chat-avatar-reverse": props.reverse
|
|
11461
|
-
}]
|
|
11462
|
-
}, [vue.createVNode(vue.resolveComponent("a-avatar"), {
|
|
11463
|
-
"class": "avatar",
|
|
11464
|
-
"alt": "\u5934\u50CF",
|
|
11465
|
-
"src": props.avatar
|
|
11466
|
-
}, null), vue.createVNode("div", {
|
|
11467
|
-
"class": "chat-avatar-name"
|
|
11468
|
-
}, [props.name])]);
|
|
11469
|
-
}
|
|
11470
|
-
});
|
|
11471
|
-
|
|
11472
|
-
const QuestionBubble = vue.defineComponent({
|
|
11473
|
-
props: {
|
|
11474
|
-
content: {
|
|
11475
|
-
type: String,
|
|
11476
|
-
default: ""
|
|
11477
|
-
}
|
|
11478
|
-
},
|
|
11479
|
-
setup(props) {
|
|
11480
|
-
const userinfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
|
|
11481
|
-
const avatar = userinfo.photo || "/micro-assets/platform_app/avatar.png";
|
|
11482
|
-
const name = userinfo.employeeName || userinfo.userName || "\u7528\u6237";
|
|
11483
|
-
return () => vue.createVNode("div", {
|
|
11484
|
-
"class": "question-bubble chat-bubble"
|
|
11485
|
-
}, [vue.createVNode(Avatar, {
|
|
11486
|
-
"reverse": true,
|
|
11487
|
-
"avatar": avatar,
|
|
11488
|
-
"name": name
|
|
11489
|
-
}, null), vue.createVNode("div", {
|
|
11490
|
-
"class": "bubble question"
|
|
11491
|
-
}, [props.content]), vue.createVNode("div", {
|
|
11492
|
-
"class": "operates"
|
|
11493
|
-
}, null)]);
|
|
11494
|
-
}
|
|
11495
|
-
});
|
|
11496
|
-
|
|
11497
|
-
const commonStyle = `
|
|
11498
|
-
:host > p {
|
|
11499
|
-
margin: 0;
|
|
11500
|
-
}
|
|
11501
|
-
:host {
|
|
11502
|
-
font-size: 14px;
|
|
11503
|
-
}
|
|
11504
|
-
`;
|
|
11505
|
-
const styleDark = `
|
|
11506
|
-
<style>
|
|
11507
|
-
${commonStyle}
|
|
11508
|
-
|
|
11509
|
-
* {
|
|
11510
|
-
color: #fff;
|
|
11511
|
-
}
|
|
11512
|
-
strong {
|
|
11513
|
-
color: #f3c142;
|
|
11514
|
-
}
|
|
11515
|
-
</style>
|
|
11516
|
-
`;
|
|
11517
|
-
const styleLight = `
|
|
11518
|
-
<style>
|
|
11519
|
-
${commonStyle}
|
|
11520
|
-
|
|
11521
|
-
* {
|
|
11522
|
-
color: #20242B;
|
|
11523
|
-
}
|
|
11524
|
-
strong {
|
|
11525
|
-
color: #4b7ff7;
|
|
11526
|
-
}
|
|
11527
|
-
</style>
|
|
11528
|
-
`;
|
|
11529
|
-
|
|
11530
|
-
const suggestionList = ["\u7F8E\u5C0F\u817E\u80FD\u5E2E\u6211\u505A\u4EC0\u4E48\uFF1F", "\u8FD1\u4E00\u4E2A\u6708\u7684\u4ECB\u8017\u60C5\u51B5\u5982\u4F55\uFF1F", "\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\uFF1F\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B\u5C3E\u77FF\u8DD1\u7C97\u7684\u6392\u67E5\u5904\u7406\u65B9\u6CD5\u6709\u54EA\u4E9B"];
|
|
11531
|
-
const AnswerBubble = vue.defineComponent({
|
|
11532
|
-
emits: ["send", "render", "delete", "regenerate"],
|
|
11533
|
-
props: {
|
|
11534
|
-
content: {
|
|
11535
|
-
type: Array,
|
|
11536
|
-
default: () => []
|
|
11537
|
-
}
|
|
11538
|
-
},
|
|
11539
|
-
setup(props, {
|
|
11540
|
-
emit
|
|
11541
|
-
}) {
|
|
11542
|
-
const chatTheme = vue.inject("chat-theme");
|
|
11543
|
-
const {
|
|
11544
|
-
copy
|
|
11545
|
-
} = core.useClipboard({
|
|
11546
|
-
legacy: true
|
|
11547
|
-
});
|
|
11548
|
-
const bubbleRef = vue.ref();
|
|
11549
|
-
const activeAnswerIndex = vue.ref(0);
|
|
11550
|
-
const activeAnswer = vue.computed(() => props.content[activeAnswerIndex.value]);
|
|
11551
|
-
let shadowRoot;
|
|
11552
|
-
const trasformMd = mdString => {
|
|
11553
|
-
return marked.marked(mdString);
|
|
11554
|
-
};
|
|
11555
|
-
vue.onMounted(() => {
|
|
11556
|
-
shadowRoot = bubbleRef.value.attachShadow({
|
|
11557
|
-
mode: "open"
|
|
11558
|
-
});
|
|
11559
|
-
renderText();
|
|
11560
|
-
});
|
|
11561
|
-
const renderText = () => {
|
|
11562
|
-
if (!shadowRoot) return;
|
|
11563
|
-
vue.nextTick(() => {
|
|
11564
|
-
emit("render", activeAnswer.value.content);
|
|
11565
|
-
});
|
|
11566
|
-
const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
|
|
11567
|
-
const html = `
|
|
11568
|
-
${trasformMd(activeAnswer.value.content)}
|
|
11569
|
-
|
|
11570
|
-
${themeStyle}
|
|
11571
|
-
`;
|
|
11572
|
-
shadowRoot.innerHTML = html;
|
|
11573
|
-
};
|
|
11574
|
-
vue.watch([activeAnswer, activeAnswerIndex], renderText, {
|
|
11575
|
-
deep: true
|
|
11576
|
-
});
|
|
11577
|
-
const switchAnswer = step => {
|
|
11578
|
-
activeAnswerIndex.value += step;
|
|
11579
|
-
};
|
|
11580
|
-
const operateList = vue.reactive([{
|
|
11581
|
-
title: "\u590D\u5236",
|
|
11582
|
-
key: "copy",
|
|
11583
|
-
isActive: false
|
|
11584
|
-
}, {
|
|
11585
|
-
title: "\u6709\u7528",
|
|
11586
|
-
key: "like",
|
|
11587
|
-
isActive: vue.computed(() => activeAnswer.value.isLike)
|
|
11588
|
-
}, {
|
|
11589
|
-
title: "\u65E0\u7528",
|
|
11590
|
-
key: "dislike",
|
|
11591
|
-
isActive: vue.computed(() => activeAnswer.value.isDislike)
|
|
11592
|
-
}, {
|
|
11593
|
-
title: "\u8BC4\u8BBA",
|
|
11594
|
-
key: "comment",
|
|
11595
|
-
isActive: false
|
|
11596
|
-
}, {
|
|
11597
|
-
title: "\u91CD\u65B0\u751F\u6210",
|
|
11598
|
-
key: "regenerate",
|
|
11599
|
-
isActive: false
|
|
11600
|
-
}, {
|
|
11601
|
-
ttile: "\u5220\u9664",
|
|
11602
|
-
key: "delete",
|
|
11603
|
-
isActive: false
|
|
11604
|
-
}]);
|
|
11605
|
-
const handleOperate = key => {
|
|
11606
|
-
switch (key) {
|
|
11607
|
-
case "like":
|
|
11608
|
-
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
11609
|
-
activeAnswer.value.isLike = !activeAnswer.value.isLike;
|
|
11610
|
-
}
|
|
11611
|
-
break;
|
|
11612
|
-
case "dislike":
|
|
11613
|
-
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
11614
|
-
activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
|
|
11615
|
-
}
|
|
11616
|
-
break;
|
|
11617
|
-
case "copy":
|
|
11618
|
-
copy(activeAnswer.value.content);
|
|
11619
|
-
antDesignVue.message.success("\u590D\u5236\u6210\u529F");
|
|
11620
|
-
break;
|
|
11621
|
-
case "delete":
|
|
11622
|
-
antDesignVue.Modal.confirm({
|
|
11623
|
-
title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
|
|
11624
|
-
onOk: () => {
|
|
11625
|
-
emit("delete", activeAnswer.value.id);
|
|
11626
|
-
if (activeAnswerIndex.value > 0 && activeAnswerIndex.value === props.content.length - 1) {
|
|
11627
|
-
activeAnswerIndex.value--;
|
|
11628
|
-
}
|
|
11629
|
-
}
|
|
11630
|
-
});
|
|
11631
|
-
break;
|
|
11632
|
-
case "comment":
|
|
11633
|
-
antDesignVue.message.info("\u6682\u672A\u5F00\u653E");
|
|
11634
|
-
break;
|
|
11635
|
-
case "regenerate":
|
|
11636
|
-
if (props.content.length >= 5) {
|
|
11637
|
-
antDesignVue.message.info("\u6700\u591A\u652F\u6301\u751F\u62105\u6761\u56DE\u7B54");
|
|
11638
|
-
return;
|
|
11639
|
-
}
|
|
11640
|
-
emit("regenerate", activeAnswer.value.id);
|
|
11641
|
-
vue.nextTick(() => {
|
|
11642
|
-
activeAnswerIndex.value = props.content.length - 1;
|
|
11643
|
-
});
|
|
11644
|
-
break;
|
|
11645
|
-
}
|
|
11646
|
-
};
|
|
11647
|
-
return () => {
|
|
11648
|
-
suggestionList.map(item => vue.createVNode("div", {
|
|
11649
|
-
"class": "suggestion-item",
|
|
11650
|
-
"onClick": () => emit("send", item)
|
|
11651
|
-
}, [item]));
|
|
11652
|
-
const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
|
|
11653
|
-
const operateDom = operateList.map(item => vue.createVNode(vue.resolveComponent("a-tooltip"), {
|
|
11654
|
-
"title": item.title
|
|
11655
|
-
}, {
|
|
11656
|
-
default: () => [vue.createVNode("div", {
|
|
11657
|
-
"class": ["operate-item", item.key, {
|
|
11658
|
-
active: item.isActive
|
|
11659
|
-
}],
|
|
11660
|
-
"onClick": () => handleOperate(item.key)
|
|
11661
|
-
}, null)]
|
|
11662
|
-
}));
|
|
11663
|
-
const prevDisabled = activeAnswerIndex.value === 0;
|
|
11664
|
-
const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
|
|
11665
|
-
const answerNav = vue.createVNode("div", {
|
|
11666
|
-
"class": "operate-item operate-nav"
|
|
11667
|
-
}, [vue.createVNode("span", {
|
|
11668
|
-
"class": ["nav", {
|
|
11669
|
-
disabled: prevDisabled
|
|
11670
|
-
}],
|
|
11671
|
-
"onClick": () => switchAnswer(-1)
|
|
11672
|
-
}, ["<"]), vue.createVNode("span", null, [activeAnswerIndex.value + 1]), " ", vue.createVNode("span", null, [vue.createTextVNode("/")]), vue.createVNode("span", null, [props.content.length]), vue.createVNode("span", {
|
|
11673
|
-
"class": ["nav", {
|
|
11674
|
-
disabled: nextDisabled
|
|
11675
|
-
}],
|
|
11676
|
-
"onClick": () => switchAnswer(1)
|
|
11677
|
-
}, [">"])]);
|
|
11678
|
-
return vue.createVNode("div", {
|
|
11679
|
-
"class": "answer-bubble chat-bubble"
|
|
11680
|
-
}, [vue.createVNode(Avatar, {
|
|
11681
|
-
"avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
|
|
11682
|
-
"name": "\u7F8E\u5C0F\u817E"
|
|
11683
|
-
}, null), vue.createVNode("div", {
|
|
11684
|
-
"ref": bubbleRef,
|
|
11685
|
-
"class": "bubble answer"
|
|
11686
|
-
}, null), vue.createVNode("div", {
|
|
11687
|
-
"class": "operates"
|
|
11688
|
-
}, [props.content.length > 1 && answerNav, showOperates && operateDom])]);
|
|
11689
|
-
};
|
|
11690
|
-
}
|
|
11691
|
-
});
|
|
11692
|
-
|
|
11693
|
-
const QaContext = vue.defineComponent({
|
|
11694
|
-
emits: ["regenerate"],
|
|
11695
|
-
props: {
|
|
11696
|
-
list: {
|
|
11697
|
-
type: Array,
|
|
11698
|
-
default: () => []
|
|
11699
|
-
}
|
|
11700
|
-
},
|
|
11701
|
-
setup(props, {
|
|
11702
|
-
emit
|
|
11703
|
-
}) {
|
|
11704
|
-
const containerRef = vue.ref();
|
|
11705
|
-
const onAnswerRender = text => {
|
|
11706
|
-
containerRef.value.scrollTo({
|
|
11707
|
-
top: containerRef.value.scrollHeight,
|
|
11708
|
-
behavior: "smooth"
|
|
11709
|
-
});
|
|
11710
|
-
};
|
|
11711
|
-
const handleDeleteAnswer = (questionId, answerId) => {
|
|
11712
|
-
const question = props.list.find(item => item.id === questionId);
|
|
11713
|
-
if (question) {
|
|
11714
|
-
question.answers = question.answers.filter(item => item.id !== answerId);
|
|
11715
|
-
}
|
|
11716
|
-
};
|
|
11717
|
-
return () => {
|
|
11718
|
-
const contextList = [];
|
|
11719
|
-
for (let i = 0; i < props.list.length; i++) {
|
|
11720
|
-
const questionItem = props.list[i];
|
|
11721
|
-
const prevItem = props.list[i - 1];
|
|
11722
|
-
const currentTime = questionItem.timestamp;
|
|
11723
|
-
let timeDiff = 0;
|
|
11724
|
-
if (prevItem) {
|
|
11725
|
-
const prevTime = prevItem.timestamp;
|
|
11726
|
-
timeDiff = currentTime - prevTime;
|
|
11727
|
-
}
|
|
11728
|
-
if (!prevItem || timeDiff > 1e3 * 60 * 5) {
|
|
11729
|
-
contextList.push(vue.createVNode("div", {
|
|
11730
|
-
"class": "time-line"
|
|
11731
|
-
}, [dayjs__default["default"](currentTime).format("MM/DD HH:mm")]));
|
|
11732
|
-
}
|
|
11733
|
-
if (questionItem.content) {
|
|
11734
|
-
contextList.push(vue.createVNode(QuestionBubble, {
|
|
11735
|
-
"content": questionItem.content
|
|
11736
|
-
}, null));
|
|
11737
|
-
}
|
|
11738
|
-
if (questionItem.answers.length > 0) {
|
|
11739
|
-
contextList.push(vue.createVNode(AnswerBubble, {
|
|
11740
|
-
"onRender": onAnswerRender,
|
|
11741
|
-
"content": questionItem.answers,
|
|
11742
|
-
"onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId),
|
|
11743
|
-
"onRegenerate": () => emit("regenerate", questionItem.id)
|
|
11744
|
-
}, null));
|
|
11745
|
-
}
|
|
11746
|
-
}
|
|
11747
|
-
return vue.createVNode("div", {
|
|
11748
|
-
"class": "qa-context",
|
|
11749
|
-
"ref": containerRef
|
|
11750
|
-
}, [contextList]);
|
|
11751
|
-
};
|
|
11752
|
-
}
|
|
11753
|
-
});
|
|
11754
|
-
|
|
11755
|
-
const ChatBox = vue.defineComponent({
|
|
11756
|
-
props: {
|
|
11757
|
-
theme: {
|
|
11758
|
-
type: String,
|
|
11759
|
-
default: "light"
|
|
11760
|
-
},
|
|
11761
|
-
// 语音输入 TODO
|
|
11762
|
-
withSpeech: {
|
|
11763
|
-
type: Boolean,
|
|
11764
|
-
default: false
|
|
11765
|
-
}
|
|
11766
|
-
},
|
|
11767
|
-
setup(props, {
|
|
11768
|
-
emit
|
|
11769
|
-
}) {
|
|
11770
|
-
vue.provide("chat-theme", props.theme);
|
|
11771
|
-
const {
|
|
11772
|
-
context,
|
|
11773
|
-
answerLoading,
|
|
11774
|
-
sendQuestion,
|
|
11775
|
-
abortRequest
|
|
11776
|
-
} = useQA();
|
|
11777
|
-
vue.provide("answerLoading", answerLoading);
|
|
11778
|
-
vue.provide("abortRequest", abortRequest);
|
|
11779
|
-
const handleSend = (msg, questionId) => {
|
|
11780
|
-
sendQuestion(msg, questionId);
|
|
11781
|
-
};
|
|
11782
|
-
return () => {
|
|
11783
|
-
return vue.createVNode("div", {
|
|
11784
|
-
"class": ["inl-chat-box", `inl-chat-box-${props.theme}`]
|
|
11785
|
-
}, [vue.createVNode(QaContext, {
|
|
11786
|
-
"list": context.value,
|
|
11787
|
-
"onRegenerate": qId => handleSend("", qId)
|
|
11788
|
-
}, null), vue.createVNode(Bottom, {
|
|
11789
|
-
"onSend": handleSend
|
|
11790
|
-
}, null)]);
|
|
11791
|
-
};
|
|
11792
|
-
}
|
|
11793
|
-
});
|
|
11794
|
-
|
|
11795
|
-
const LlmChatBox = installComponent(ChatBox, "llm-chat-box");
|
|
11796
|
-
|
|
11797
11240
|
exports.AlarmVideo = alarmVideo;
|
|
11798
11241
|
exports.ChangeThemeSelect = index$6;
|
|
11799
11242
|
exports.ChildLayout = childLayout;
|
|
@@ -11805,7 +11248,6 @@ exports.IconSelect = icons;
|
|
|
11805
11248
|
exports.ImportModal = ImportModal;
|
|
11806
11249
|
exports.Layout = index$8;
|
|
11807
11250
|
exports.LayoutTable = table;
|
|
11808
|
-
exports.LlmChatBox = LlmChatBox;
|
|
11809
11251
|
exports.Login = index$7;
|
|
11810
11252
|
exports.ParamManager = index$2;
|
|
11811
11253
|
exports.ParamManagerV2 = ParamManagerV2;
|