inl-ui 0.1.2 → 0.1.4
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/dist/components/index.cjs +328 -68
- package/dist/components/index.js +329 -69
- package/dist/index.cjs +329 -69
- package/dist/index.d.ts +1 -1
- package/dist/index.js +330 -70
- package/dist/style.css +1 -1
- package/dist/video/index.cjs +5 -28
- package/dist/video/index.js +5 -28
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
|
43
43
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
44
44
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
45
45
|
|
|
46
|
-
var version = "0.1.
|
|
46
|
+
var version = "0.1.3";
|
|
47
47
|
|
|
48
48
|
const setTheme = theme => {
|
|
49
49
|
if (theme === "dark") {
|
|
@@ -8997,6 +8997,9 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
8997
8997
|
token: sessionStorage.getItem("token")
|
|
8998
8998
|
}
|
|
8999
8999
|
});
|
|
9000
|
+
setTimeout(() => {
|
|
9001
|
+
getThingValue();
|
|
9002
|
+
}, 3e3);
|
|
9000
9003
|
infos.value.forEach(info => {
|
|
9001
9004
|
if (info.thingDeviceId) {
|
|
9002
9005
|
const obj = res.data.data?.shift();
|
|
@@ -9057,12 +9060,7 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
9057
9060
|
clearInterval(interval);
|
|
9058
9061
|
clearInterval(intervalSet);
|
|
9059
9062
|
getVideoParams(val);
|
|
9060
|
-
intervalSet = setInterval(() => {
|
|
9061
|
-
getVideoParams(val);
|
|
9062
|
-
}, 1800 * 1e3);
|
|
9063
|
-
interval = setInterval(() => {
|
|
9064
|
-
getThingValue();
|
|
9065
|
-
}, 3e3);
|
|
9063
|
+
intervalSet = setInterval(() => {}, 1800 * 1e3);
|
|
9066
9064
|
getVideoDetail(val);
|
|
9067
9065
|
const fillVal = localStorage.getItem(val);
|
|
9068
9066
|
if (fillVal) {
|
|
@@ -9343,28 +9341,7 @@ const PollingPlay = vue.defineComponent({
|
|
|
9343
9341
|
});
|
|
9344
9342
|
const alarmList = vue.ref([]);
|
|
9345
9343
|
const getAlarm = async () => {
|
|
9346
|
-
|
|
9347
|
-
instanceCodeList: data.pointList,
|
|
9348
|
-
relationCodeList: ["DEVICE_MT"],
|
|
9349
|
-
targetProperetyCodeList: ["ALARM"]
|
|
9350
|
-
}, {
|
|
9351
|
-
headers: {
|
|
9352
|
-
token: sessionStorage.getItem("token") || ""
|
|
9353
|
-
}
|
|
9354
|
-
});
|
|
9355
|
-
data.pointList.forEach((uuid, index) => {
|
|
9356
|
-
const alarmConfig = res.data?.data?.[uuid];
|
|
9357
|
-
if (alarmConfig?.length && alarmConfig?.length !== 0) {
|
|
9358
|
-
const have = alarmConfig.find(element => element.alarmDTO?.alarmId);
|
|
9359
|
-
if (have) {
|
|
9360
|
-
alarmList.value[index] = true;
|
|
9361
|
-
} else {
|
|
9362
|
-
alarmList.value[index] = false;
|
|
9363
|
-
}
|
|
9364
|
-
} else {
|
|
9365
|
-
alarmList.value[index] = false;
|
|
9366
|
-
}
|
|
9367
|
-
});
|
|
9344
|
+
return;
|
|
9368
9345
|
};
|
|
9369
9346
|
return () => vue.createVNode("div", {
|
|
9370
9347
|
"class": "playVideos"
|
|
@@ -12259,6 +12236,105 @@ const SszComment = vue.defineComponent({
|
|
|
12259
12236
|
});
|
|
12260
12237
|
var index$1 = installComponent(SszComment, "ssz-comment");
|
|
12261
12238
|
|
|
12239
|
+
function formatDataString(str) {
|
|
12240
|
+
const lines = str.split("\n");
|
|
12241
|
+
const result = lines.filter(line => !!line.trim()).map(line => {
|
|
12242
|
+
const data = JSON.parse(line.replace("data: ", ""));
|
|
12243
|
+
return data.text;
|
|
12244
|
+
}).filter(line => line !== void 0).join("");
|
|
12245
|
+
return result;
|
|
12246
|
+
}
|
|
12247
|
+
function request(question, streamCallback, doneCallback) {
|
|
12248
|
+
fetch("/mt_cpp_gpt/chat", {
|
|
12249
|
+
method: "POST",
|
|
12250
|
+
headers: {
|
|
12251
|
+
"Content-Type": "application/json"
|
|
12252
|
+
},
|
|
12253
|
+
body: JSON.stringify({
|
|
12254
|
+
query: question,
|
|
12255
|
+
conversation_id: ""
|
|
12256
|
+
})
|
|
12257
|
+
}).then(res => res.body).then(stream => {
|
|
12258
|
+
const decoder = new TextDecoder();
|
|
12259
|
+
const reader = stream.getReader();
|
|
12260
|
+
let result = "";
|
|
12261
|
+
function processText() {
|
|
12262
|
+
return reader.read().then(({
|
|
12263
|
+
done,
|
|
12264
|
+
value
|
|
12265
|
+
}) => {
|
|
12266
|
+
if (done) {
|
|
12267
|
+
doneCallback();
|
|
12268
|
+
return;
|
|
12269
|
+
}
|
|
12270
|
+
const dataString = decoder.decode(value, {
|
|
12271
|
+
stream: true
|
|
12272
|
+
});
|
|
12273
|
+
const str = formatDataString(dataString);
|
|
12274
|
+
result += str;
|
|
12275
|
+
streamCallback(result);
|
|
12276
|
+
return processText();
|
|
12277
|
+
});
|
|
12278
|
+
}
|
|
12279
|
+
return processText();
|
|
12280
|
+
});
|
|
12281
|
+
}
|
|
12282
|
+
function useQA() {
|
|
12283
|
+
const context = vue.ref([]);
|
|
12284
|
+
const answerLoading = vue.ref(false);
|
|
12285
|
+
const answer = vue.ref("");
|
|
12286
|
+
setTimeout(() => {
|
|
12287
|
+
const questionItem = {
|
|
12288
|
+
type: "answer",
|
|
12289
|
+
content: "",
|
|
12290
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12291
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12292
|
+
answers: [{
|
|
12293
|
+
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",
|
|
12294
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12295
|
+
hideOperates: true,
|
|
12296
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12297
|
+
}]
|
|
12298
|
+
};
|
|
12299
|
+
context.value.push(questionItem);
|
|
12300
|
+
}, 1e3);
|
|
12301
|
+
function sendQuestion(question, questionId) {
|
|
12302
|
+
if (answerLoading.value) return;
|
|
12303
|
+
answerLoading.value = true;
|
|
12304
|
+
let questionItem = context.value.find(item => item.id === questionId);
|
|
12305
|
+
question = questionItem?.content || question;
|
|
12306
|
+
if (!questionId) {
|
|
12307
|
+
questionItem = {
|
|
12308
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12309
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12310
|
+
content: question,
|
|
12311
|
+
answers: []
|
|
12312
|
+
};
|
|
12313
|
+
context.value.push(questionItem);
|
|
12314
|
+
}
|
|
12315
|
+
const answerItem = vue.ref({
|
|
12316
|
+
content: "\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
12317
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12318
|
+
parentId: questionItem.id,
|
|
12319
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12320
|
+
});
|
|
12321
|
+
questionItem.answers.push(answerItem.value);
|
|
12322
|
+
request(question, data => {
|
|
12323
|
+
answer.value = data;
|
|
12324
|
+
answerItem.value.content = data;
|
|
12325
|
+
}, () => {
|
|
12326
|
+
answerLoading.value = false;
|
|
12327
|
+
answerItem.value.loadEnd = true;
|
|
12328
|
+
});
|
|
12329
|
+
}
|
|
12330
|
+
return {
|
|
12331
|
+
context,
|
|
12332
|
+
answerLoading,
|
|
12333
|
+
answer,
|
|
12334
|
+
sendQuestion
|
|
12335
|
+
};
|
|
12336
|
+
}
|
|
12337
|
+
|
|
12262
12338
|
const Input = vue.defineComponent({
|
|
12263
12339
|
emits: ["send"],
|
|
12264
12340
|
setup(props, {
|
|
@@ -12267,7 +12343,13 @@ const Input = vue.defineComponent({
|
|
|
12267
12343
|
}) {
|
|
12268
12344
|
const value = vue.ref("");
|
|
12269
12345
|
const isFocus = vue.ref(false);
|
|
12346
|
+
const loading = vue.inject("answerLoading");
|
|
12270
12347
|
const send = () => {
|
|
12348
|
+
if (loading.value) return;
|
|
12349
|
+
if (value.value.length === 0) {
|
|
12350
|
+
antDesignVue.message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
|
|
12351
|
+
return;
|
|
12352
|
+
}
|
|
12271
12353
|
emit("send", value.value);
|
|
12272
12354
|
value.value = "";
|
|
12273
12355
|
};
|
|
@@ -12279,14 +12361,24 @@ const Input = vue.defineComponent({
|
|
|
12279
12361
|
"class": ["chat-box-input", {
|
|
12280
12362
|
focus: isFocus.value
|
|
12281
12363
|
}]
|
|
12282
|
-
}, [vue.createVNode(
|
|
12364
|
+
}, [vue.createVNode("img", {
|
|
12365
|
+
"class": "img img-mic",
|
|
12366
|
+
"src": "/micro-assets/largeLanguageModel/mic.png",
|
|
12367
|
+
"alt": ""
|
|
12368
|
+
}, null), vue.createVNode(vue.resolveComponent("a-input"), {
|
|
12283
12369
|
"value": value.value,
|
|
12284
12370
|
"onUpdate:value": $event => value.value = $event,
|
|
12285
12371
|
"bordered": false,
|
|
12286
12372
|
"placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
|
|
12287
12373
|
"onFocus": () => isFocus.value = true,
|
|
12288
|
-
"onBlur": () => isFocus.value = false
|
|
12289
|
-
|
|
12374
|
+
"onBlur": () => isFocus.value = false,
|
|
12375
|
+
"onPressEnter": send
|
|
12376
|
+
}, null), loading.value ? vue.createVNode(iconsVue.BorderOutlined, {
|
|
12377
|
+
"class": "btn-abord",
|
|
12378
|
+
"title": "\u4E2D\u6B62\u56DE\u7B54"
|
|
12379
|
+
}, null) : vue.createVNode("img", {
|
|
12380
|
+
"class": "img img-send",
|
|
12381
|
+
"src": "/micro-assets/largeLanguageModel/send.png",
|
|
12290
12382
|
"onClick": send
|
|
12291
12383
|
}, null)]);
|
|
12292
12384
|
}
|
|
@@ -12294,15 +12386,19 @@ const Input = vue.defineComponent({
|
|
|
12294
12386
|
|
|
12295
12387
|
const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
|
|
12296
12388
|
const Bottom = vue.defineComponent({
|
|
12297
|
-
|
|
12389
|
+
emits: ["send"],
|
|
12390
|
+
setup(props, {
|
|
12391
|
+
emit
|
|
12392
|
+
}) {
|
|
12298
12393
|
const inputRef = vue.ref();
|
|
12299
12394
|
const handleSend = msg => {
|
|
12300
12395
|
inputRef.value.clear();
|
|
12396
|
+
emit("send", msg);
|
|
12301
12397
|
};
|
|
12302
12398
|
return () => {
|
|
12303
12399
|
const tipsDom = tips.map(tip => vue.createVNode("div", {
|
|
12304
12400
|
"class": "tip",
|
|
12305
|
-
"onClick": () => handleSend()
|
|
12401
|
+
"onClick": () => handleSend(tip)
|
|
12306
12402
|
}, [tip]));
|
|
12307
12403
|
return vue.createVNode("div", {
|
|
12308
12404
|
"class": "bottom"
|
|
@@ -12347,6 +12443,28 @@ const Avatar = vue.defineComponent({
|
|
|
12347
12443
|
}
|
|
12348
12444
|
});
|
|
12349
12445
|
|
|
12446
|
+
const QuestionBubble = vue.defineComponent({
|
|
12447
|
+
props: {
|
|
12448
|
+
content: {
|
|
12449
|
+
type: String,
|
|
12450
|
+
default: ""
|
|
12451
|
+
}
|
|
12452
|
+
},
|
|
12453
|
+
setup(props) {
|
|
12454
|
+
return () => vue.createVNode("div", {
|
|
12455
|
+
"class": "question-bubble chat-bubble"
|
|
12456
|
+
}, [vue.createVNode(Avatar, {
|
|
12457
|
+
"reverse": true,
|
|
12458
|
+
"avatar": "/micro-assets/platform_app/avatar.png",
|
|
12459
|
+
"name": "\u5F20\u660E\u5FD7"
|
|
12460
|
+
}, null), vue.createVNode("div", {
|
|
12461
|
+
"class": "bubble question"
|
|
12462
|
+
}, [props.content]), vue.createVNode("div", {
|
|
12463
|
+
"class": "operates"
|
|
12464
|
+
}, null)]);
|
|
12465
|
+
}
|
|
12466
|
+
});
|
|
12467
|
+
|
|
12350
12468
|
const styleDark = `
|
|
12351
12469
|
<style>
|
|
12352
12470
|
:host > p {
|
|
@@ -12374,25 +12492,26 @@ const styleLight = `
|
|
|
12374
12492
|
|
|
12375
12493
|
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"];
|
|
12376
12494
|
const AnswerBubble = vue.defineComponent({
|
|
12495
|
+
emits: ["send", "render", "delete"],
|
|
12496
|
+
props: {
|
|
12497
|
+
content: {
|
|
12498
|
+
type: Array,
|
|
12499
|
+
default: () => []
|
|
12500
|
+
}
|
|
12501
|
+
},
|
|
12377
12502
|
setup(props, {
|
|
12378
12503
|
emit
|
|
12379
12504
|
}) {
|
|
12380
12505
|
const chatTheme = vue.inject("chat-theme");
|
|
12506
|
+
const {
|
|
12507
|
+
copy
|
|
12508
|
+
} = core.useClipboard({
|
|
12509
|
+
legacy: true
|
|
12510
|
+
});
|
|
12381
12511
|
const bubbleRef = vue.ref();
|
|
12512
|
+
const activeAnswerIndex = vue.ref(0);
|
|
12513
|
+
const activeAnswer = vue.computed(() => props.content[activeAnswerIndex.value]);
|
|
12382
12514
|
let shadowRoot;
|
|
12383
|
-
const mdText = vue.ref(`\u4ECA\u5929\u7684\u7CBE\u7164\u4EA7\u91CF**18830.0**\u5428\uFF0C\u672B\u7164\u4EA7\u91CF**15900.0**\u5428\uFF0C\u7164\u6CE5**539.0**\u5428
|
|
12384
|
-
|
|
12385
|
-
#### \u4F60\u597D\u554A
|
|
12386
|
-
|
|
12387
|
-
1. \u4F60\u597D\u554A
|
|
12388
|
-
|
|
12389
|
-
2. \u4E09\u5929\u4E4B\u5185\u6740\u4E86\u4F60
|
|
12390
|
-
|
|
12391
|
-
3. \u4F60\u662F\u771F\u6CA1\u89C1\u8FC7\u9ED1\u793E\u4F1A\u554A
|
|
12392
|
-
|
|
12393
|
-
4. \u6562\u4E0D\u6562\u8DDF\u6211\u6BD4\u5212\u6BD4\u5212
|
|
12394
|
-
|
|
12395
|
-
5. \u8BA9\u4F60\u89C1\u8BC6\u89C1\u8BC6\u4EC0\u4E48\u53EB\u9ED1\u624B`);
|
|
12396
12515
|
const trasformMd = mdString => {
|
|
12397
12516
|
return marked.marked(mdString);
|
|
12398
12517
|
};
|
|
@@ -12400,49 +12519,177 @@ const AnswerBubble = vue.defineComponent({
|
|
|
12400
12519
|
shadowRoot = bubbleRef.value.attachShadow({
|
|
12401
12520
|
mode: "open"
|
|
12402
12521
|
});
|
|
12522
|
+
renderText();
|
|
12523
|
+
});
|
|
12524
|
+
const renderText = () => {
|
|
12525
|
+
if (!shadowRoot) return;
|
|
12526
|
+
emit("render", activeAnswer.value.content);
|
|
12403
12527
|
const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
|
|
12404
12528
|
const html = `
|
|
12405
|
-
${trasformMd(
|
|
12529
|
+
${trasformMd(activeAnswer.value.content)}
|
|
12406
12530
|
|
|
12407
12531
|
${themeStyle}
|
|
12408
12532
|
`;
|
|
12409
12533
|
shadowRoot.innerHTML = html;
|
|
12534
|
+
};
|
|
12535
|
+
vue.watch([() => props.content, activeAnswerIndex], renderText, {
|
|
12536
|
+
deep: true
|
|
12410
12537
|
});
|
|
12538
|
+
const operateList = vue.reactive([{
|
|
12539
|
+
title: "\u590D\u5236",
|
|
12540
|
+
key: "copy",
|
|
12541
|
+
isActive: false
|
|
12542
|
+
}, {
|
|
12543
|
+
title: "\u6709\u7528",
|
|
12544
|
+
key: "like",
|
|
12545
|
+
isActive: vue.computed(() => activeAnswer.value.isLike)
|
|
12546
|
+
}, {
|
|
12547
|
+
title: "\u65E0\u7528",
|
|
12548
|
+
key: "dislike",
|
|
12549
|
+
isActive: vue.computed(() => activeAnswer.value.isDislike)
|
|
12550
|
+
}, {
|
|
12551
|
+
title: "\u8BC4\u8BBA",
|
|
12552
|
+
key: "comment",
|
|
12553
|
+
isActive: false
|
|
12554
|
+
}, {
|
|
12555
|
+
title: "\u91CD\u65B0\u751F\u6210",
|
|
12556
|
+
key: "regenerate",
|
|
12557
|
+
isActive: false
|
|
12558
|
+
}, {
|
|
12559
|
+
ttile: "\u5220\u9664",
|
|
12560
|
+
key: "delete",
|
|
12561
|
+
isActive: false
|
|
12562
|
+
}]);
|
|
12563
|
+
const handleOperate = key => {
|
|
12564
|
+
switch (key) {
|
|
12565
|
+
case "like":
|
|
12566
|
+
if (!activeAnswer.value.isDislike && !activeAnswer.value.isDislike) {
|
|
12567
|
+
activeAnswer.value.isLike = !activeAnswer.value.isLike;
|
|
12568
|
+
}
|
|
12569
|
+
break;
|
|
12570
|
+
case "dislike":
|
|
12571
|
+
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
12572
|
+
activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
|
|
12573
|
+
}
|
|
12574
|
+
break;
|
|
12575
|
+
case "copy":
|
|
12576
|
+
copy(activeAnswer.value.content);
|
|
12577
|
+
antDesignVue.message.success("\u590D\u5236\u6210\u529F");
|
|
12578
|
+
break;
|
|
12579
|
+
case "delete":
|
|
12580
|
+
antDesignVue.Modal.confirm({
|
|
12581
|
+
title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
|
|
12582
|
+
onOk: () => {
|
|
12583
|
+
emit("delete", activeAnswer.value.id);
|
|
12584
|
+
}
|
|
12585
|
+
});
|
|
12586
|
+
break;
|
|
12587
|
+
case "comment":
|
|
12588
|
+
antDesignVue.message.info("\u6682\u672A\u5F00\u653E");
|
|
12589
|
+
break;
|
|
12590
|
+
}
|
|
12591
|
+
};
|
|
12411
12592
|
return () => {
|
|
12412
|
-
|
|
12593
|
+
suggestionList.map(item => vue.createVNode("div", {
|
|
12413
12594
|
"class": "suggestion-item",
|
|
12414
12595
|
"onClick": () => emit("send", item)
|
|
12415
12596
|
}, [item]));
|
|
12597
|
+
const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
|
|
12598
|
+
const operateDom = operateList.map(item => {
|
|
12599
|
+
return vue.createVNode(vue.resolveComponent("a-tooltip"), {
|
|
12600
|
+
"title": item.title
|
|
12601
|
+
}, {
|
|
12602
|
+
default: () => [vue.createVNode("div", {
|
|
12603
|
+
"class": ["operate-item", item.key, {
|
|
12604
|
+
active: item.isActive
|
|
12605
|
+
}],
|
|
12606
|
+
"onClick": () => handleOperate(item.key)
|
|
12607
|
+
}, null)]
|
|
12608
|
+
});
|
|
12609
|
+
});
|
|
12610
|
+
const prevDisabled = activeAnswerIndex.value === 0;
|
|
12611
|
+
const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
|
|
12612
|
+
const answerNav = vue.createVNode("div", {
|
|
12613
|
+
"class": "operate-item"
|
|
12614
|
+
}, [vue.createVNode("span", {
|
|
12615
|
+
"class": ["nav", {
|
|
12616
|
+
disalbed: prevDisabled
|
|
12617
|
+
}]
|
|
12618
|
+
}, ["<"]), activeAnswerIndex.value + 1, "/ ", props.content.length, vue.createVNode("span", {
|
|
12619
|
+
"class": ["nav", {
|
|
12620
|
+
disalbed: nextDisabled
|
|
12621
|
+
}]
|
|
12622
|
+
}, [">"])]);
|
|
12416
12623
|
return vue.createVNode("div", {
|
|
12417
12624
|
"class": "answer-bubble chat-bubble"
|
|
12418
12625
|
}, [vue.createVNode(Avatar, {
|
|
12419
|
-
"avatar": "",
|
|
12626
|
+
"avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
|
|
12420
12627
|
"name": "\u7F8E\u5C0F\u817E"
|
|
12421
12628
|
}, null), vue.createVNode("div", {
|
|
12422
12629
|
"ref": bubbleRef,
|
|
12423
12630
|
"class": "bubble answer"
|
|
12424
|
-
}, null), vue.createVNode("div", {
|
|
12631
|
+
}, null), showOperates && vue.createVNode("div", {
|
|
12425
12632
|
"class": "operates"
|
|
12426
|
-
},
|
|
12427
|
-
"class": "suggestion-list"
|
|
12428
|
-
}, [suggestionListDom])]);
|
|
12633
|
+
}, [props.content.length > 1 && answerNav, operateDom])]);
|
|
12429
12634
|
};
|
|
12430
12635
|
}
|
|
12431
12636
|
});
|
|
12432
12637
|
|
|
12433
|
-
const
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12440
|
-
|
|
12441
|
-
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12638
|
+
const QaContext = vue.defineComponent({
|
|
12639
|
+
props: {
|
|
12640
|
+
list: {
|
|
12641
|
+
type: Array,
|
|
12642
|
+
default: () => []
|
|
12643
|
+
}
|
|
12644
|
+
},
|
|
12645
|
+
setup(props) {
|
|
12646
|
+
const containerRef = vue.ref();
|
|
12647
|
+
const onAnswerRender = text => {
|
|
12648
|
+
containerRef.value.scrollTo({
|
|
12649
|
+
top: containerRef.value.scrollHeight,
|
|
12650
|
+
behavior: "smooth"
|
|
12651
|
+
});
|
|
12652
|
+
};
|
|
12653
|
+
const handleDeleteAnswer = (questionId, answerId) => {
|
|
12654
|
+
const question = props.list.find(item => item.id === questionId);
|
|
12655
|
+
if (question) {
|
|
12656
|
+
question.answers = question.answers.filter(item => item.id !== answerId);
|
|
12657
|
+
}
|
|
12658
|
+
};
|
|
12659
|
+
return () => {
|
|
12660
|
+
const contextList = [];
|
|
12661
|
+
for (let i = 0; i < props.list.length; i++) {
|
|
12662
|
+
const questionItem = props.list[i];
|
|
12663
|
+
const prevItem = props.list[i - 1];
|
|
12664
|
+
const currentTime = questionItem.timestamp;
|
|
12665
|
+
let timeDiff = 0;
|
|
12666
|
+
if (prevItem) {
|
|
12667
|
+
const prevTime = prevItem.timestamp;
|
|
12668
|
+
timeDiff = currentTime - prevTime;
|
|
12669
|
+
}
|
|
12670
|
+
if (!prevItem || timeDiff > 1e3 * 60 * 5) {
|
|
12671
|
+
contextList.push(vue.createVNode("div", {
|
|
12672
|
+
"class": "time-line"
|
|
12673
|
+
}, [dayjs__default["default"](currentTime).format("MM/DD HH:mm")]));
|
|
12674
|
+
}
|
|
12675
|
+
if (questionItem.content) {
|
|
12676
|
+
contextList.push(vue.createVNode(QuestionBubble, {
|
|
12677
|
+
"content": questionItem.content
|
|
12678
|
+
}, null));
|
|
12679
|
+
}
|
|
12680
|
+
if (questionItem.answers.length > 0) {
|
|
12681
|
+
contextList.push(vue.createVNode(AnswerBubble, {
|
|
12682
|
+
"onRender": onAnswerRender,
|
|
12683
|
+
"content": questionItem.answers,
|
|
12684
|
+
"onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId)
|
|
12685
|
+
}, null));
|
|
12686
|
+
}
|
|
12687
|
+
}
|
|
12688
|
+
return vue.createVNode("div", {
|
|
12689
|
+
"class": "qa-context",
|
|
12690
|
+
"ref": containerRef
|
|
12691
|
+
}, [contextList]);
|
|
12692
|
+
};
|
|
12446
12693
|
}
|
|
12447
12694
|
});
|
|
12448
12695
|
|
|
@@ -12462,11 +12709,24 @@ const ChatBox = vue.defineComponent({
|
|
|
12462
12709
|
emit
|
|
12463
12710
|
}) {
|
|
12464
12711
|
vue.provide("chat-theme", props.theme);
|
|
12465
|
-
|
|
12712
|
+
const {
|
|
12713
|
+
context,
|
|
12714
|
+
answerLoading,
|
|
12715
|
+
sendQuestion,
|
|
12716
|
+
answer
|
|
12717
|
+
} = useQA();
|
|
12718
|
+
vue.provide("answerLoading", answerLoading);
|
|
12719
|
+
const handleSend = msg => {
|
|
12720
|
+
sendQuestion(msg);
|
|
12721
|
+
};
|
|
12466
12722
|
return () => {
|
|
12467
12723
|
return vue.createVNode("div", {
|
|
12468
12724
|
"class": ["inl-chat-box", `inl-chat-box-${props.theme}`]
|
|
12469
|
-
}, [vue.createVNode(
|
|
12725
|
+
}, [vue.createVNode(QaContext, {
|
|
12726
|
+
"list": context.value
|
|
12727
|
+
}, null), vue.createVNode(Bottom, {
|
|
12728
|
+
"onSend": handleSend
|
|
12729
|
+
}, null)]);
|
|
12470
12730
|
};
|
|
12471
12731
|
}
|
|
12472
12732
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Key } from 'ant-design-vue/lib/table/interface';
|
|
|
11
11
|
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
12
12
|
import * as _ant_design_icons_vue_lib_components_IconFont from '@ant-design/icons-vue/lib/components/IconFont';
|
|
13
13
|
|
|
14
|
-
var version = "0.1.
|
|
14
|
+
var version = "0.1.3";
|
|
15
15
|
|
|
16
16
|
declare const _default$o: {
|
|
17
17
|
set(theme: string): void;
|