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
|
@@ -7992,6 +7992,9 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
7992
7992
|
token: sessionStorage.getItem("token")
|
|
7993
7993
|
}
|
|
7994
7994
|
});
|
|
7995
|
+
setTimeout(() => {
|
|
7996
|
+
getThingValue();
|
|
7997
|
+
}, 3e3);
|
|
7995
7998
|
infos.value.forEach(info => {
|
|
7996
7999
|
if (info.thingDeviceId) {
|
|
7997
8000
|
const obj = res.data.data?.shift();
|
|
@@ -8052,12 +8055,7 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
8052
8055
|
clearInterval(interval);
|
|
8053
8056
|
clearInterval(intervalSet);
|
|
8054
8057
|
getVideoParams(val);
|
|
8055
|
-
intervalSet = setInterval(() => {
|
|
8056
|
-
getVideoParams(val);
|
|
8057
|
-
}, 1800 * 1e3);
|
|
8058
|
-
interval = setInterval(() => {
|
|
8059
|
-
getThingValue();
|
|
8060
|
-
}, 3e3);
|
|
8058
|
+
intervalSet = setInterval(() => {}, 1800 * 1e3);
|
|
8061
8059
|
getVideoDetail(val);
|
|
8062
8060
|
const fillVal = localStorage.getItem(val);
|
|
8063
8061
|
if (fillVal) {
|
|
@@ -8338,28 +8336,7 @@ const PollingPlay = vue.defineComponent({
|
|
|
8338
8336
|
});
|
|
8339
8337
|
const alarmList = vue.ref([]);
|
|
8340
8338
|
const getAlarm = async () => {
|
|
8341
|
-
|
|
8342
|
-
instanceCodeList: data.pointList,
|
|
8343
|
-
relationCodeList: ["DEVICE_MT"],
|
|
8344
|
-
targetProperetyCodeList: ["ALARM"]
|
|
8345
|
-
}, {
|
|
8346
|
-
headers: {
|
|
8347
|
-
token: sessionStorage.getItem("token") || ""
|
|
8348
|
-
}
|
|
8349
|
-
});
|
|
8350
|
-
data.pointList.forEach((uuid, index) => {
|
|
8351
|
-
const alarmConfig = res.data?.data?.[uuid];
|
|
8352
|
-
if (alarmConfig?.length && alarmConfig?.length !== 0) {
|
|
8353
|
-
const have = alarmConfig.find(element => element.alarmDTO?.alarmId);
|
|
8354
|
-
if (have) {
|
|
8355
|
-
alarmList.value[index] = true;
|
|
8356
|
-
} else {
|
|
8357
|
-
alarmList.value[index] = false;
|
|
8358
|
-
}
|
|
8359
|
-
} else {
|
|
8360
|
-
alarmList.value[index] = false;
|
|
8361
|
-
}
|
|
8362
|
-
});
|
|
8339
|
+
return;
|
|
8363
8340
|
};
|
|
8364
8341
|
return () => vue.createVNode("div", {
|
|
8365
8342
|
"class": "playVideos"
|
|
@@ -11254,6 +11231,105 @@ const SszComment = vue.defineComponent({
|
|
|
11254
11231
|
});
|
|
11255
11232
|
var index = installComponent(SszComment, "ssz-comment");
|
|
11256
11233
|
|
|
11234
|
+
function formatDataString(str) {
|
|
11235
|
+
const lines = str.split("\n");
|
|
11236
|
+
const result = lines.filter(line => !!line.trim()).map(line => {
|
|
11237
|
+
const data = JSON.parse(line.replace("data: ", ""));
|
|
11238
|
+
return data.text;
|
|
11239
|
+
}).filter(line => line !== void 0).join("");
|
|
11240
|
+
return result;
|
|
11241
|
+
}
|
|
11242
|
+
function request(question, streamCallback, doneCallback) {
|
|
11243
|
+
fetch("/mt_cpp_gpt/chat", {
|
|
11244
|
+
method: "POST",
|
|
11245
|
+
headers: {
|
|
11246
|
+
"Content-Type": "application/json"
|
|
11247
|
+
},
|
|
11248
|
+
body: JSON.stringify({
|
|
11249
|
+
query: question,
|
|
11250
|
+
conversation_id: ""
|
|
11251
|
+
})
|
|
11252
|
+
}).then(res => res.body).then(stream => {
|
|
11253
|
+
const decoder = new TextDecoder();
|
|
11254
|
+
const reader = stream.getReader();
|
|
11255
|
+
let result = "";
|
|
11256
|
+
function processText() {
|
|
11257
|
+
return reader.read().then(({
|
|
11258
|
+
done,
|
|
11259
|
+
value
|
|
11260
|
+
}) => {
|
|
11261
|
+
if (done) {
|
|
11262
|
+
doneCallback();
|
|
11263
|
+
return;
|
|
11264
|
+
}
|
|
11265
|
+
const dataString = decoder.decode(value, {
|
|
11266
|
+
stream: true
|
|
11267
|
+
});
|
|
11268
|
+
const str = formatDataString(dataString);
|
|
11269
|
+
result += str;
|
|
11270
|
+
streamCallback(result);
|
|
11271
|
+
return processText();
|
|
11272
|
+
});
|
|
11273
|
+
}
|
|
11274
|
+
return processText();
|
|
11275
|
+
});
|
|
11276
|
+
}
|
|
11277
|
+
function useQA() {
|
|
11278
|
+
const context = vue.ref([]);
|
|
11279
|
+
const answerLoading = vue.ref(false);
|
|
11280
|
+
const answer = vue.ref("");
|
|
11281
|
+
setTimeout(() => {
|
|
11282
|
+
const questionItem = {
|
|
11283
|
+
type: "answer",
|
|
11284
|
+
content: "",
|
|
11285
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
11286
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11287
|
+
answers: [{
|
|
11288
|
+
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",
|
|
11289
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11290
|
+
hideOperates: true,
|
|
11291
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
11292
|
+
}]
|
|
11293
|
+
};
|
|
11294
|
+
context.value.push(questionItem);
|
|
11295
|
+
}, 1e3);
|
|
11296
|
+
function sendQuestion(question, questionId) {
|
|
11297
|
+
if (answerLoading.value) return;
|
|
11298
|
+
answerLoading.value = true;
|
|
11299
|
+
let questionItem = context.value.find(item => item.id === questionId);
|
|
11300
|
+
question = questionItem?.content || question;
|
|
11301
|
+
if (!questionId) {
|
|
11302
|
+
questionItem = {
|
|
11303
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
11304
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11305
|
+
content: question,
|
|
11306
|
+
answers: []
|
|
11307
|
+
};
|
|
11308
|
+
context.value.push(questionItem);
|
|
11309
|
+
}
|
|
11310
|
+
const answerItem = vue.ref({
|
|
11311
|
+
content: "\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
11312
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
11313
|
+
parentId: questionItem.id,
|
|
11314
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
11315
|
+
});
|
|
11316
|
+
questionItem.answers.push(answerItem.value);
|
|
11317
|
+
request(question, data => {
|
|
11318
|
+
answer.value = data;
|
|
11319
|
+
answerItem.value.content = data;
|
|
11320
|
+
}, () => {
|
|
11321
|
+
answerLoading.value = false;
|
|
11322
|
+
answerItem.value.loadEnd = true;
|
|
11323
|
+
});
|
|
11324
|
+
}
|
|
11325
|
+
return {
|
|
11326
|
+
context,
|
|
11327
|
+
answerLoading,
|
|
11328
|
+
answer,
|
|
11329
|
+
sendQuestion
|
|
11330
|
+
};
|
|
11331
|
+
}
|
|
11332
|
+
|
|
11257
11333
|
const Input = vue.defineComponent({
|
|
11258
11334
|
emits: ["send"],
|
|
11259
11335
|
setup(props, {
|
|
@@ -11262,7 +11338,13 @@ const Input = vue.defineComponent({
|
|
|
11262
11338
|
}) {
|
|
11263
11339
|
const value = vue.ref("");
|
|
11264
11340
|
const isFocus = vue.ref(false);
|
|
11341
|
+
const loading = vue.inject("answerLoading");
|
|
11265
11342
|
const send = () => {
|
|
11343
|
+
if (loading.value) return;
|
|
11344
|
+
if (value.value.length === 0) {
|
|
11345
|
+
antDesignVue.message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
|
|
11346
|
+
return;
|
|
11347
|
+
}
|
|
11266
11348
|
emit("send", value.value);
|
|
11267
11349
|
value.value = "";
|
|
11268
11350
|
};
|
|
@@ -11274,14 +11356,24 @@ const Input = vue.defineComponent({
|
|
|
11274
11356
|
"class": ["chat-box-input", {
|
|
11275
11357
|
focus: isFocus.value
|
|
11276
11358
|
}]
|
|
11277
|
-
}, [vue.createVNode(
|
|
11359
|
+
}, [vue.createVNode("img", {
|
|
11360
|
+
"class": "img img-mic",
|
|
11361
|
+
"src": "/micro-assets/largeLanguageModel/mic.png",
|
|
11362
|
+
"alt": ""
|
|
11363
|
+
}, null), vue.createVNode(vue.resolveComponent("a-input"), {
|
|
11278
11364
|
"value": value.value,
|
|
11279
11365
|
"onUpdate:value": $event => value.value = $event,
|
|
11280
11366
|
"bordered": false,
|
|
11281
11367
|
"placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
|
|
11282
11368
|
"onFocus": () => isFocus.value = true,
|
|
11283
|
-
"onBlur": () => isFocus.value = false
|
|
11284
|
-
|
|
11369
|
+
"onBlur": () => isFocus.value = false,
|
|
11370
|
+
"onPressEnter": send
|
|
11371
|
+
}, null), loading.value ? vue.createVNode(iconsVue.BorderOutlined, {
|
|
11372
|
+
"class": "btn-abord",
|
|
11373
|
+
"title": "\u4E2D\u6B62\u56DE\u7B54"
|
|
11374
|
+
}, null) : vue.createVNode("img", {
|
|
11375
|
+
"class": "img img-send",
|
|
11376
|
+
"src": "/micro-assets/largeLanguageModel/send.png",
|
|
11285
11377
|
"onClick": send
|
|
11286
11378
|
}, null)]);
|
|
11287
11379
|
}
|
|
@@ -11289,15 +11381,19 @@ const Input = vue.defineComponent({
|
|
|
11289
11381
|
|
|
11290
11382
|
const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
|
|
11291
11383
|
const Bottom = vue.defineComponent({
|
|
11292
|
-
|
|
11384
|
+
emits: ["send"],
|
|
11385
|
+
setup(props, {
|
|
11386
|
+
emit
|
|
11387
|
+
}) {
|
|
11293
11388
|
const inputRef = vue.ref();
|
|
11294
11389
|
const handleSend = msg => {
|
|
11295
11390
|
inputRef.value.clear();
|
|
11391
|
+
emit("send", msg);
|
|
11296
11392
|
};
|
|
11297
11393
|
return () => {
|
|
11298
11394
|
const tipsDom = tips.map(tip => vue.createVNode("div", {
|
|
11299
11395
|
"class": "tip",
|
|
11300
|
-
"onClick": () => handleSend()
|
|
11396
|
+
"onClick": () => handleSend(tip)
|
|
11301
11397
|
}, [tip]));
|
|
11302
11398
|
return vue.createVNode("div", {
|
|
11303
11399
|
"class": "bottom"
|
|
@@ -11342,6 +11438,28 @@ const Avatar = vue.defineComponent({
|
|
|
11342
11438
|
}
|
|
11343
11439
|
});
|
|
11344
11440
|
|
|
11441
|
+
const QuestionBubble = vue.defineComponent({
|
|
11442
|
+
props: {
|
|
11443
|
+
content: {
|
|
11444
|
+
type: String,
|
|
11445
|
+
default: ""
|
|
11446
|
+
}
|
|
11447
|
+
},
|
|
11448
|
+
setup(props) {
|
|
11449
|
+
return () => vue.createVNode("div", {
|
|
11450
|
+
"class": "question-bubble chat-bubble"
|
|
11451
|
+
}, [vue.createVNode(Avatar, {
|
|
11452
|
+
"reverse": true,
|
|
11453
|
+
"avatar": "/micro-assets/platform_app/avatar.png",
|
|
11454
|
+
"name": "\u5F20\u660E\u5FD7"
|
|
11455
|
+
}, null), vue.createVNode("div", {
|
|
11456
|
+
"class": "bubble question"
|
|
11457
|
+
}, [props.content]), vue.createVNode("div", {
|
|
11458
|
+
"class": "operates"
|
|
11459
|
+
}, null)]);
|
|
11460
|
+
}
|
|
11461
|
+
});
|
|
11462
|
+
|
|
11345
11463
|
const styleDark = `
|
|
11346
11464
|
<style>
|
|
11347
11465
|
:host > p {
|
|
@@ -11369,25 +11487,26 @@ const styleLight = `
|
|
|
11369
11487
|
|
|
11370
11488
|
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"];
|
|
11371
11489
|
const AnswerBubble = vue.defineComponent({
|
|
11490
|
+
emits: ["send", "render", "delete"],
|
|
11491
|
+
props: {
|
|
11492
|
+
content: {
|
|
11493
|
+
type: Array,
|
|
11494
|
+
default: () => []
|
|
11495
|
+
}
|
|
11496
|
+
},
|
|
11372
11497
|
setup(props, {
|
|
11373
11498
|
emit
|
|
11374
11499
|
}) {
|
|
11375
11500
|
const chatTheme = vue.inject("chat-theme");
|
|
11501
|
+
const {
|
|
11502
|
+
copy
|
|
11503
|
+
} = core.useClipboard({
|
|
11504
|
+
legacy: true
|
|
11505
|
+
});
|
|
11376
11506
|
const bubbleRef = vue.ref();
|
|
11507
|
+
const activeAnswerIndex = vue.ref(0);
|
|
11508
|
+
const activeAnswer = vue.computed(() => props.content[activeAnswerIndex.value]);
|
|
11377
11509
|
let shadowRoot;
|
|
11378
|
-
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
|
|
11379
|
-
|
|
11380
|
-
#### \u4F60\u597D\u554A
|
|
11381
|
-
|
|
11382
|
-
1. \u4F60\u597D\u554A
|
|
11383
|
-
|
|
11384
|
-
2. \u4E09\u5929\u4E4B\u5185\u6740\u4E86\u4F60
|
|
11385
|
-
|
|
11386
|
-
3. \u4F60\u662F\u771F\u6CA1\u89C1\u8FC7\u9ED1\u793E\u4F1A\u554A
|
|
11387
|
-
|
|
11388
|
-
4. \u6562\u4E0D\u6562\u8DDF\u6211\u6BD4\u5212\u6BD4\u5212
|
|
11389
|
-
|
|
11390
|
-
5. \u8BA9\u4F60\u89C1\u8BC6\u89C1\u8BC6\u4EC0\u4E48\u53EB\u9ED1\u624B`);
|
|
11391
11510
|
const trasformMd = mdString => {
|
|
11392
11511
|
return marked.marked(mdString);
|
|
11393
11512
|
};
|
|
@@ -11395,49 +11514,177 @@ const AnswerBubble = vue.defineComponent({
|
|
|
11395
11514
|
shadowRoot = bubbleRef.value.attachShadow({
|
|
11396
11515
|
mode: "open"
|
|
11397
11516
|
});
|
|
11517
|
+
renderText();
|
|
11518
|
+
});
|
|
11519
|
+
const renderText = () => {
|
|
11520
|
+
if (!shadowRoot) return;
|
|
11521
|
+
emit("render", activeAnswer.value.content);
|
|
11398
11522
|
const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
|
|
11399
11523
|
const html = `
|
|
11400
|
-
${trasformMd(
|
|
11524
|
+
${trasformMd(activeAnswer.value.content)}
|
|
11401
11525
|
|
|
11402
11526
|
${themeStyle}
|
|
11403
11527
|
`;
|
|
11404
11528
|
shadowRoot.innerHTML = html;
|
|
11529
|
+
};
|
|
11530
|
+
vue.watch([() => props.content, activeAnswerIndex], renderText, {
|
|
11531
|
+
deep: true
|
|
11405
11532
|
});
|
|
11533
|
+
const operateList = vue.reactive([{
|
|
11534
|
+
title: "\u590D\u5236",
|
|
11535
|
+
key: "copy",
|
|
11536
|
+
isActive: false
|
|
11537
|
+
}, {
|
|
11538
|
+
title: "\u6709\u7528",
|
|
11539
|
+
key: "like",
|
|
11540
|
+
isActive: vue.computed(() => activeAnswer.value.isLike)
|
|
11541
|
+
}, {
|
|
11542
|
+
title: "\u65E0\u7528",
|
|
11543
|
+
key: "dislike",
|
|
11544
|
+
isActive: vue.computed(() => activeAnswer.value.isDislike)
|
|
11545
|
+
}, {
|
|
11546
|
+
title: "\u8BC4\u8BBA",
|
|
11547
|
+
key: "comment",
|
|
11548
|
+
isActive: false
|
|
11549
|
+
}, {
|
|
11550
|
+
title: "\u91CD\u65B0\u751F\u6210",
|
|
11551
|
+
key: "regenerate",
|
|
11552
|
+
isActive: false
|
|
11553
|
+
}, {
|
|
11554
|
+
ttile: "\u5220\u9664",
|
|
11555
|
+
key: "delete",
|
|
11556
|
+
isActive: false
|
|
11557
|
+
}]);
|
|
11558
|
+
const handleOperate = key => {
|
|
11559
|
+
switch (key) {
|
|
11560
|
+
case "like":
|
|
11561
|
+
if (!activeAnswer.value.isDislike && !activeAnswer.value.isDislike) {
|
|
11562
|
+
activeAnswer.value.isLike = !activeAnswer.value.isLike;
|
|
11563
|
+
}
|
|
11564
|
+
break;
|
|
11565
|
+
case "dislike":
|
|
11566
|
+
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
11567
|
+
activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
|
|
11568
|
+
}
|
|
11569
|
+
break;
|
|
11570
|
+
case "copy":
|
|
11571
|
+
copy(activeAnswer.value.content);
|
|
11572
|
+
antDesignVue.message.success("\u590D\u5236\u6210\u529F");
|
|
11573
|
+
break;
|
|
11574
|
+
case "delete":
|
|
11575
|
+
antDesignVue.Modal.confirm({
|
|
11576
|
+
title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
|
|
11577
|
+
onOk: () => {
|
|
11578
|
+
emit("delete", activeAnswer.value.id);
|
|
11579
|
+
}
|
|
11580
|
+
});
|
|
11581
|
+
break;
|
|
11582
|
+
case "comment":
|
|
11583
|
+
antDesignVue.message.info("\u6682\u672A\u5F00\u653E");
|
|
11584
|
+
break;
|
|
11585
|
+
}
|
|
11586
|
+
};
|
|
11406
11587
|
return () => {
|
|
11407
|
-
|
|
11588
|
+
suggestionList.map(item => vue.createVNode("div", {
|
|
11408
11589
|
"class": "suggestion-item",
|
|
11409
11590
|
"onClick": () => emit("send", item)
|
|
11410
11591
|
}, [item]));
|
|
11592
|
+
const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
|
|
11593
|
+
const operateDom = operateList.map(item => {
|
|
11594
|
+
return vue.createVNode(vue.resolveComponent("a-tooltip"), {
|
|
11595
|
+
"title": item.title
|
|
11596
|
+
}, {
|
|
11597
|
+
default: () => [vue.createVNode("div", {
|
|
11598
|
+
"class": ["operate-item", item.key, {
|
|
11599
|
+
active: item.isActive
|
|
11600
|
+
}],
|
|
11601
|
+
"onClick": () => handleOperate(item.key)
|
|
11602
|
+
}, null)]
|
|
11603
|
+
});
|
|
11604
|
+
});
|
|
11605
|
+
const prevDisabled = activeAnswerIndex.value === 0;
|
|
11606
|
+
const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
|
|
11607
|
+
const answerNav = vue.createVNode("div", {
|
|
11608
|
+
"class": "operate-item"
|
|
11609
|
+
}, [vue.createVNode("span", {
|
|
11610
|
+
"class": ["nav", {
|
|
11611
|
+
disalbed: prevDisabled
|
|
11612
|
+
}]
|
|
11613
|
+
}, ["<"]), activeAnswerIndex.value + 1, "/ ", props.content.length, vue.createVNode("span", {
|
|
11614
|
+
"class": ["nav", {
|
|
11615
|
+
disalbed: nextDisabled
|
|
11616
|
+
}]
|
|
11617
|
+
}, [">"])]);
|
|
11411
11618
|
return vue.createVNode("div", {
|
|
11412
11619
|
"class": "answer-bubble chat-bubble"
|
|
11413
11620
|
}, [vue.createVNode(Avatar, {
|
|
11414
|
-
"avatar": "",
|
|
11621
|
+
"avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
|
|
11415
11622
|
"name": "\u7F8E\u5C0F\u817E"
|
|
11416
11623
|
}, null), vue.createVNode("div", {
|
|
11417
11624
|
"ref": bubbleRef,
|
|
11418
11625
|
"class": "bubble answer"
|
|
11419
|
-
}, null), vue.createVNode("div", {
|
|
11626
|
+
}, null), showOperates && vue.createVNode("div", {
|
|
11420
11627
|
"class": "operates"
|
|
11421
|
-
},
|
|
11422
|
-
"class": "suggestion-list"
|
|
11423
|
-
}, [suggestionListDom])]);
|
|
11628
|
+
}, [props.content.length > 1 && answerNav, operateDom])]);
|
|
11424
11629
|
};
|
|
11425
11630
|
}
|
|
11426
11631
|
});
|
|
11427
11632
|
|
|
11428
|
-
const
|
|
11429
|
-
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
11439
|
-
|
|
11440
|
-
|
|
11633
|
+
const QaContext = vue.defineComponent({
|
|
11634
|
+
props: {
|
|
11635
|
+
list: {
|
|
11636
|
+
type: Array,
|
|
11637
|
+
default: () => []
|
|
11638
|
+
}
|
|
11639
|
+
},
|
|
11640
|
+
setup(props) {
|
|
11641
|
+
const containerRef = vue.ref();
|
|
11642
|
+
const onAnswerRender = text => {
|
|
11643
|
+
containerRef.value.scrollTo({
|
|
11644
|
+
top: containerRef.value.scrollHeight,
|
|
11645
|
+
behavior: "smooth"
|
|
11646
|
+
});
|
|
11647
|
+
};
|
|
11648
|
+
const handleDeleteAnswer = (questionId, answerId) => {
|
|
11649
|
+
const question = props.list.find(item => item.id === questionId);
|
|
11650
|
+
if (question) {
|
|
11651
|
+
question.answers = question.answers.filter(item => item.id !== answerId);
|
|
11652
|
+
}
|
|
11653
|
+
};
|
|
11654
|
+
return () => {
|
|
11655
|
+
const contextList = [];
|
|
11656
|
+
for (let i = 0; i < props.list.length; i++) {
|
|
11657
|
+
const questionItem = props.list[i];
|
|
11658
|
+
const prevItem = props.list[i - 1];
|
|
11659
|
+
const currentTime = questionItem.timestamp;
|
|
11660
|
+
let timeDiff = 0;
|
|
11661
|
+
if (prevItem) {
|
|
11662
|
+
const prevTime = prevItem.timestamp;
|
|
11663
|
+
timeDiff = currentTime - prevTime;
|
|
11664
|
+
}
|
|
11665
|
+
if (!prevItem || timeDiff > 1e3 * 60 * 5) {
|
|
11666
|
+
contextList.push(vue.createVNode("div", {
|
|
11667
|
+
"class": "time-line"
|
|
11668
|
+
}, [dayjs__default["default"](currentTime).format("MM/DD HH:mm")]));
|
|
11669
|
+
}
|
|
11670
|
+
if (questionItem.content) {
|
|
11671
|
+
contextList.push(vue.createVNode(QuestionBubble, {
|
|
11672
|
+
"content": questionItem.content
|
|
11673
|
+
}, null));
|
|
11674
|
+
}
|
|
11675
|
+
if (questionItem.answers.length > 0) {
|
|
11676
|
+
contextList.push(vue.createVNode(AnswerBubble, {
|
|
11677
|
+
"onRender": onAnswerRender,
|
|
11678
|
+
"content": questionItem.answers,
|
|
11679
|
+
"onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId)
|
|
11680
|
+
}, null));
|
|
11681
|
+
}
|
|
11682
|
+
}
|
|
11683
|
+
return vue.createVNode("div", {
|
|
11684
|
+
"class": "qa-context",
|
|
11685
|
+
"ref": containerRef
|
|
11686
|
+
}, [contextList]);
|
|
11687
|
+
};
|
|
11441
11688
|
}
|
|
11442
11689
|
});
|
|
11443
11690
|
|
|
@@ -11457,11 +11704,24 @@ const ChatBox = vue.defineComponent({
|
|
|
11457
11704
|
emit
|
|
11458
11705
|
}) {
|
|
11459
11706
|
vue.provide("chat-theme", props.theme);
|
|
11460
|
-
|
|
11707
|
+
const {
|
|
11708
|
+
context,
|
|
11709
|
+
answerLoading,
|
|
11710
|
+
sendQuestion,
|
|
11711
|
+
answer
|
|
11712
|
+
} = useQA();
|
|
11713
|
+
vue.provide("answerLoading", answerLoading);
|
|
11714
|
+
const handleSend = msg => {
|
|
11715
|
+
sendQuestion(msg);
|
|
11716
|
+
};
|
|
11461
11717
|
return () => {
|
|
11462
11718
|
return vue.createVNode("div", {
|
|
11463
11719
|
"class": ["inl-chat-box", `inl-chat-box-${props.theme}`]
|
|
11464
|
-
}, [vue.createVNode(
|
|
11720
|
+
}, [vue.createVNode(QaContext, {
|
|
11721
|
+
"list": context.value
|
|
11722
|
+
}, null), vue.createVNode(Bottom, {
|
|
11723
|
+
"onSend": handleSend
|
|
11724
|
+
}, null)]);
|
|
11465
11725
|
};
|
|
11466
11726
|
}
|
|
11467
11727
|
});
|