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.js
CHANGED
|
@@ -7,13 +7,13 @@ import _, { isPlainObject, omit, cloneDeep, differenceBy, isObject as isObject$1
|
|
|
7
7
|
import { useIntervalFn, useEventBus, resolveRef, useEventListener, useMounted, useThrottleFn, useVModel, useMagicKeys, whenever, watchArray, useSessionStorage, useFullscreen, useLocalStorage, useToggle, useElementBounding, useMemory, useWindowSize, useClipboard, useBreakpoints, breakpointsAntDesign } from '@vueuse/core';
|
|
8
8
|
import dayjs from 'dayjs';
|
|
9
9
|
import { useRouter, useRoute } from 'vue-router';
|
|
10
|
-
import { createFromIconfontCN, SearchOutlined, DownOutlined, PoweroffOutlined, MenuUnfoldOutlined, MenuFoldOutlined, SkinFilled, FullscreenOutlined, CaretUpOutlined, CaretRightOutlined, CaretDownOutlined, FileExcelTwoTone, InboxOutlined, MessageOutlined,
|
|
10
|
+
import { createFromIconfontCN, SearchOutlined, DownOutlined, PoweroffOutlined, MenuUnfoldOutlined, MenuFoldOutlined, SkinFilled, FullscreenOutlined, CaretUpOutlined, CaretRightOutlined, CaretDownOutlined, FileExcelTwoTone, InboxOutlined, MessageOutlined, BorderOutlined } from '@ant-design/icons-vue';
|
|
11
11
|
import { loadMicroApp } from 'qiankun';
|
|
12
12
|
import { XPopup, CommentBlock, setAxiosOption } from '@sszj-temp/mobile';
|
|
13
13
|
import { marked } from 'marked';
|
|
14
14
|
import '@sszj-temp/mobile/style.css';
|
|
15
15
|
|
|
16
|
-
var version = "0.1.
|
|
16
|
+
var version = "0.1.3";
|
|
17
17
|
|
|
18
18
|
const setTheme = theme => {
|
|
19
19
|
if (theme === "dark") {
|
|
@@ -8967,6 +8967,9 @@ const VideoBoxV2 = defineComponent({
|
|
|
8967
8967
|
token: sessionStorage.getItem("token")
|
|
8968
8968
|
}
|
|
8969
8969
|
});
|
|
8970
|
+
setTimeout(() => {
|
|
8971
|
+
getThingValue();
|
|
8972
|
+
}, 3e3);
|
|
8970
8973
|
infos.value.forEach(info => {
|
|
8971
8974
|
if (info.thingDeviceId) {
|
|
8972
8975
|
const obj = res.data.data?.shift();
|
|
@@ -9027,12 +9030,7 @@ const VideoBoxV2 = defineComponent({
|
|
|
9027
9030
|
clearInterval(interval);
|
|
9028
9031
|
clearInterval(intervalSet);
|
|
9029
9032
|
getVideoParams(val);
|
|
9030
|
-
intervalSet = setInterval(() => {
|
|
9031
|
-
getVideoParams(val);
|
|
9032
|
-
}, 1800 * 1e3);
|
|
9033
|
-
interval = setInterval(() => {
|
|
9034
|
-
getThingValue();
|
|
9035
|
-
}, 3e3);
|
|
9033
|
+
intervalSet = setInterval(() => {}, 1800 * 1e3);
|
|
9036
9034
|
getVideoDetail(val);
|
|
9037
9035
|
const fillVal = localStorage.getItem(val);
|
|
9038
9036
|
if (fillVal) {
|
|
@@ -9313,28 +9311,7 @@ const PollingPlay = defineComponent({
|
|
|
9313
9311
|
});
|
|
9314
9312
|
const alarmList = ref([]);
|
|
9315
9313
|
const getAlarm = async () => {
|
|
9316
|
-
|
|
9317
|
-
instanceCodeList: data.pointList,
|
|
9318
|
-
relationCodeList: ["DEVICE_MT"],
|
|
9319
|
-
targetProperetyCodeList: ["ALARM"]
|
|
9320
|
-
}, {
|
|
9321
|
-
headers: {
|
|
9322
|
-
token: sessionStorage.getItem("token") || ""
|
|
9323
|
-
}
|
|
9324
|
-
});
|
|
9325
|
-
data.pointList.forEach((uuid, index) => {
|
|
9326
|
-
const alarmConfig = res.data?.data?.[uuid];
|
|
9327
|
-
if (alarmConfig?.length && alarmConfig?.length !== 0) {
|
|
9328
|
-
const have = alarmConfig.find(element => element.alarmDTO?.alarmId);
|
|
9329
|
-
if (have) {
|
|
9330
|
-
alarmList.value[index] = true;
|
|
9331
|
-
} else {
|
|
9332
|
-
alarmList.value[index] = false;
|
|
9333
|
-
}
|
|
9334
|
-
} else {
|
|
9335
|
-
alarmList.value[index] = false;
|
|
9336
|
-
}
|
|
9337
|
-
});
|
|
9314
|
+
return;
|
|
9338
9315
|
};
|
|
9339
9316
|
return () => createVNode("div", {
|
|
9340
9317
|
"class": "playVideos"
|
|
@@ -12229,6 +12206,105 @@ const SszComment = defineComponent({
|
|
|
12229
12206
|
});
|
|
12230
12207
|
var index$1 = installComponent(SszComment, "ssz-comment");
|
|
12231
12208
|
|
|
12209
|
+
function formatDataString(str) {
|
|
12210
|
+
const lines = str.split("\n");
|
|
12211
|
+
const result = lines.filter(line => !!line.trim()).map(line => {
|
|
12212
|
+
const data = JSON.parse(line.replace("data: ", ""));
|
|
12213
|
+
return data.text;
|
|
12214
|
+
}).filter(line => line !== void 0).join("");
|
|
12215
|
+
return result;
|
|
12216
|
+
}
|
|
12217
|
+
function request(question, streamCallback, doneCallback) {
|
|
12218
|
+
fetch("/mt_cpp_gpt/chat", {
|
|
12219
|
+
method: "POST",
|
|
12220
|
+
headers: {
|
|
12221
|
+
"Content-Type": "application/json"
|
|
12222
|
+
},
|
|
12223
|
+
body: JSON.stringify({
|
|
12224
|
+
query: question,
|
|
12225
|
+
conversation_id: ""
|
|
12226
|
+
})
|
|
12227
|
+
}).then(res => res.body).then(stream => {
|
|
12228
|
+
const decoder = new TextDecoder();
|
|
12229
|
+
const reader = stream.getReader();
|
|
12230
|
+
let result = "";
|
|
12231
|
+
function processText() {
|
|
12232
|
+
return reader.read().then(({
|
|
12233
|
+
done,
|
|
12234
|
+
value
|
|
12235
|
+
}) => {
|
|
12236
|
+
if (done) {
|
|
12237
|
+
doneCallback();
|
|
12238
|
+
return;
|
|
12239
|
+
}
|
|
12240
|
+
const dataString = decoder.decode(value, {
|
|
12241
|
+
stream: true
|
|
12242
|
+
});
|
|
12243
|
+
const str = formatDataString(dataString);
|
|
12244
|
+
result += str;
|
|
12245
|
+
streamCallback(result);
|
|
12246
|
+
return processText();
|
|
12247
|
+
});
|
|
12248
|
+
}
|
|
12249
|
+
return processText();
|
|
12250
|
+
});
|
|
12251
|
+
}
|
|
12252
|
+
function useQA() {
|
|
12253
|
+
const context = ref([]);
|
|
12254
|
+
const answerLoading = ref(false);
|
|
12255
|
+
const answer = ref("");
|
|
12256
|
+
setTimeout(() => {
|
|
12257
|
+
const questionItem = {
|
|
12258
|
+
type: "answer",
|
|
12259
|
+
content: "",
|
|
12260
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12261
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12262
|
+
answers: [{
|
|
12263
|
+
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",
|
|
12264
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12265
|
+
hideOperates: true,
|
|
12266
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12267
|
+
}]
|
|
12268
|
+
};
|
|
12269
|
+
context.value.push(questionItem);
|
|
12270
|
+
}, 1e3);
|
|
12271
|
+
function sendQuestion(question, questionId) {
|
|
12272
|
+
if (answerLoading.value) return;
|
|
12273
|
+
answerLoading.value = true;
|
|
12274
|
+
let questionItem = context.value.find(item => item.id === questionId);
|
|
12275
|
+
question = questionItem?.content || question;
|
|
12276
|
+
if (!questionId) {
|
|
12277
|
+
questionItem = {
|
|
12278
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12279
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12280
|
+
content: question,
|
|
12281
|
+
answers: []
|
|
12282
|
+
};
|
|
12283
|
+
context.value.push(questionItem);
|
|
12284
|
+
}
|
|
12285
|
+
const answerItem = ref({
|
|
12286
|
+
content: "\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
12287
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12288
|
+
parentId: questionItem.id,
|
|
12289
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12290
|
+
});
|
|
12291
|
+
questionItem.answers.push(answerItem.value);
|
|
12292
|
+
request(question, data => {
|
|
12293
|
+
answer.value = data;
|
|
12294
|
+
answerItem.value.content = data;
|
|
12295
|
+
}, () => {
|
|
12296
|
+
answerLoading.value = false;
|
|
12297
|
+
answerItem.value.loadEnd = true;
|
|
12298
|
+
});
|
|
12299
|
+
}
|
|
12300
|
+
return {
|
|
12301
|
+
context,
|
|
12302
|
+
answerLoading,
|
|
12303
|
+
answer,
|
|
12304
|
+
sendQuestion
|
|
12305
|
+
};
|
|
12306
|
+
}
|
|
12307
|
+
|
|
12232
12308
|
const Input = defineComponent({
|
|
12233
12309
|
emits: ["send"],
|
|
12234
12310
|
setup(props, {
|
|
@@ -12237,7 +12313,13 @@ const Input = defineComponent({
|
|
|
12237
12313
|
}) {
|
|
12238
12314
|
const value = ref("");
|
|
12239
12315
|
const isFocus = ref(false);
|
|
12316
|
+
const loading = inject("answerLoading");
|
|
12240
12317
|
const send = () => {
|
|
12318
|
+
if (loading.value) return;
|
|
12319
|
+
if (value.value.length === 0) {
|
|
12320
|
+
message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
|
|
12321
|
+
return;
|
|
12322
|
+
}
|
|
12241
12323
|
emit("send", value.value);
|
|
12242
12324
|
value.value = "";
|
|
12243
12325
|
};
|
|
@@ -12249,14 +12331,24 @@ const Input = defineComponent({
|
|
|
12249
12331
|
"class": ["chat-box-input", {
|
|
12250
12332
|
focus: isFocus.value
|
|
12251
12333
|
}]
|
|
12252
|
-
}, [createVNode(
|
|
12334
|
+
}, [createVNode("img", {
|
|
12335
|
+
"class": "img img-mic",
|
|
12336
|
+
"src": "/micro-assets/largeLanguageModel/mic.png",
|
|
12337
|
+
"alt": ""
|
|
12338
|
+
}, null), createVNode(resolveComponent("a-input"), {
|
|
12253
12339
|
"value": value.value,
|
|
12254
12340
|
"onUpdate:value": $event => value.value = $event,
|
|
12255
12341
|
"bordered": false,
|
|
12256
12342
|
"placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
|
|
12257
12343
|
"onFocus": () => isFocus.value = true,
|
|
12258
|
-
"onBlur": () => isFocus.value = false
|
|
12259
|
-
|
|
12344
|
+
"onBlur": () => isFocus.value = false,
|
|
12345
|
+
"onPressEnter": send
|
|
12346
|
+
}, null), loading.value ? createVNode(BorderOutlined, {
|
|
12347
|
+
"class": "btn-abord",
|
|
12348
|
+
"title": "\u4E2D\u6B62\u56DE\u7B54"
|
|
12349
|
+
}, null) : createVNode("img", {
|
|
12350
|
+
"class": "img img-send",
|
|
12351
|
+
"src": "/micro-assets/largeLanguageModel/send.png",
|
|
12260
12352
|
"onClick": send
|
|
12261
12353
|
}, null)]);
|
|
12262
12354
|
}
|
|
@@ -12264,15 +12356,19 @@ const Input = defineComponent({
|
|
|
12264
12356
|
|
|
12265
12357
|
const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
|
|
12266
12358
|
const Bottom = defineComponent({
|
|
12267
|
-
|
|
12359
|
+
emits: ["send"],
|
|
12360
|
+
setup(props, {
|
|
12361
|
+
emit
|
|
12362
|
+
}) {
|
|
12268
12363
|
const inputRef = ref();
|
|
12269
12364
|
const handleSend = msg => {
|
|
12270
12365
|
inputRef.value.clear();
|
|
12366
|
+
emit("send", msg);
|
|
12271
12367
|
};
|
|
12272
12368
|
return () => {
|
|
12273
12369
|
const tipsDom = tips.map(tip => createVNode("div", {
|
|
12274
12370
|
"class": "tip",
|
|
12275
|
-
"onClick": () => handleSend()
|
|
12371
|
+
"onClick": () => handleSend(tip)
|
|
12276
12372
|
}, [tip]));
|
|
12277
12373
|
return createVNode("div", {
|
|
12278
12374
|
"class": "bottom"
|
|
@@ -12317,6 +12413,28 @@ const Avatar = defineComponent({
|
|
|
12317
12413
|
}
|
|
12318
12414
|
});
|
|
12319
12415
|
|
|
12416
|
+
const QuestionBubble = defineComponent({
|
|
12417
|
+
props: {
|
|
12418
|
+
content: {
|
|
12419
|
+
type: String,
|
|
12420
|
+
default: ""
|
|
12421
|
+
}
|
|
12422
|
+
},
|
|
12423
|
+
setup(props) {
|
|
12424
|
+
return () => createVNode("div", {
|
|
12425
|
+
"class": "question-bubble chat-bubble"
|
|
12426
|
+
}, [createVNode(Avatar, {
|
|
12427
|
+
"reverse": true,
|
|
12428
|
+
"avatar": "/micro-assets/platform_app/avatar.png",
|
|
12429
|
+
"name": "\u5F20\u660E\u5FD7"
|
|
12430
|
+
}, null), createVNode("div", {
|
|
12431
|
+
"class": "bubble question"
|
|
12432
|
+
}, [props.content]), createVNode("div", {
|
|
12433
|
+
"class": "operates"
|
|
12434
|
+
}, null)]);
|
|
12435
|
+
}
|
|
12436
|
+
});
|
|
12437
|
+
|
|
12320
12438
|
const styleDark = `
|
|
12321
12439
|
<style>
|
|
12322
12440
|
:host > p {
|
|
@@ -12344,25 +12462,26 @@ const styleLight = `
|
|
|
12344
12462
|
|
|
12345
12463
|
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"];
|
|
12346
12464
|
const AnswerBubble = defineComponent({
|
|
12465
|
+
emits: ["send", "render", "delete"],
|
|
12466
|
+
props: {
|
|
12467
|
+
content: {
|
|
12468
|
+
type: Array,
|
|
12469
|
+
default: () => []
|
|
12470
|
+
}
|
|
12471
|
+
},
|
|
12347
12472
|
setup(props, {
|
|
12348
12473
|
emit
|
|
12349
12474
|
}) {
|
|
12350
12475
|
const chatTheme = inject("chat-theme");
|
|
12476
|
+
const {
|
|
12477
|
+
copy
|
|
12478
|
+
} = useClipboard({
|
|
12479
|
+
legacy: true
|
|
12480
|
+
});
|
|
12351
12481
|
const bubbleRef = ref();
|
|
12482
|
+
const activeAnswerIndex = ref(0);
|
|
12483
|
+
const activeAnswer = computed(() => props.content[activeAnswerIndex.value]);
|
|
12352
12484
|
let shadowRoot;
|
|
12353
|
-
const mdText = 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
|
|
12354
|
-
|
|
12355
|
-
#### \u4F60\u597D\u554A
|
|
12356
|
-
|
|
12357
|
-
1. \u4F60\u597D\u554A
|
|
12358
|
-
|
|
12359
|
-
2. \u4E09\u5929\u4E4B\u5185\u6740\u4E86\u4F60
|
|
12360
|
-
|
|
12361
|
-
3. \u4F60\u662F\u771F\u6CA1\u89C1\u8FC7\u9ED1\u793E\u4F1A\u554A
|
|
12362
|
-
|
|
12363
|
-
4. \u6562\u4E0D\u6562\u8DDF\u6211\u6BD4\u5212\u6BD4\u5212
|
|
12364
|
-
|
|
12365
|
-
5. \u8BA9\u4F60\u89C1\u8BC6\u89C1\u8BC6\u4EC0\u4E48\u53EB\u9ED1\u624B`);
|
|
12366
12485
|
const trasformMd = mdString => {
|
|
12367
12486
|
return marked(mdString);
|
|
12368
12487
|
};
|
|
@@ -12370,49 +12489,177 @@ const AnswerBubble = defineComponent({
|
|
|
12370
12489
|
shadowRoot = bubbleRef.value.attachShadow({
|
|
12371
12490
|
mode: "open"
|
|
12372
12491
|
});
|
|
12492
|
+
renderText();
|
|
12493
|
+
});
|
|
12494
|
+
const renderText = () => {
|
|
12495
|
+
if (!shadowRoot) return;
|
|
12496
|
+
emit("render", activeAnswer.value.content);
|
|
12373
12497
|
const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
|
|
12374
12498
|
const html = `
|
|
12375
|
-
${trasformMd(
|
|
12499
|
+
${trasformMd(activeAnswer.value.content)}
|
|
12376
12500
|
|
|
12377
12501
|
${themeStyle}
|
|
12378
12502
|
`;
|
|
12379
12503
|
shadowRoot.innerHTML = html;
|
|
12504
|
+
};
|
|
12505
|
+
watch([() => props.content, activeAnswerIndex], renderText, {
|
|
12506
|
+
deep: true
|
|
12380
12507
|
});
|
|
12508
|
+
const operateList = reactive([{
|
|
12509
|
+
title: "\u590D\u5236",
|
|
12510
|
+
key: "copy",
|
|
12511
|
+
isActive: false
|
|
12512
|
+
}, {
|
|
12513
|
+
title: "\u6709\u7528",
|
|
12514
|
+
key: "like",
|
|
12515
|
+
isActive: computed(() => activeAnswer.value.isLike)
|
|
12516
|
+
}, {
|
|
12517
|
+
title: "\u65E0\u7528",
|
|
12518
|
+
key: "dislike",
|
|
12519
|
+
isActive: computed(() => activeAnswer.value.isDislike)
|
|
12520
|
+
}, {
|
|
12521
|
+
title: "\u8BC4\u8BBA",
|
|
12522
|
+
key: "comment",
|
|
12523
|
+
isActive: false
|
|
12524
|
+
}, {
|
|
12525
|
+
title: "\u91CD\u65B0\u751F\u6210",
|
|
12526
|
+
key: "regenerate",
|
|
12527
|
+
isActive: false
|
|
12528
|
+
}, {
|
|
12529
|
+
ttile: "\u5220\u9664",
|
|
12530
|
+
key: "delete",
|
|
12531
|
+
isActive: false
|
|
12532
|
+
}]);
|
|
12533
|
+
const handleOperate = key => {
|
|
12534
|
+
switch (key) {
|
|
12535
|
+
case "like":
|
|
12536
|
+
if (!activeAnswer.value.isDislike && !activeAnswer.value.isDislike) {
|
|
12537
|
+
activeAnswer.value.isLike = !activeAnswer.value.isLike;
|
|
12538
|
+
}
|
|
12539
|
+
break;
|
|
12540
|
+
case "dislike":
|
|
12541
|
+
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
12542
|
+
activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
|
|
12543
|
+
}
|
|
12544
|
+
break;
|
|
12545
|
+
case "copy":
|
|
12546
|
+
copy(activeAnswer.value.content);
|
|
12547
|
+
message.success("\u590D\u5236\u6210\u529F");
|
|
12548
|
+
break;
|
|
12549
|
+
case "delete":
|
|
12550
|
+
Modal.confirm({
|
|
12551
|
+
title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
|
|
12552
|
+
onOk: () => {
|
|
12553
|
+
emit("delete", activeAnswer.value.id);
|
|
12554
|
+
}
|
|
12555
|
+
});
|
|
12556
|
+
break;
|
|
12557
|
+
case "comment":
|
|
12558
|
+
message.info("\u6682\u672A\u5F00\u653E");
|
|
12559
|
+
break;
|
|
12560
|
+
}
|
|
12561
|
+
};
|
|
12381
12562
|
return () => {
|
|
12382
|
-
|
|
12563
|
+
suggestionList.map(item => createVNode("div", {
|
|
12383
12564
|
"class": "suggestion-item",
|
|
12384
12565
|
"onClick": () => emit("send", item)
|
|
12385
12566
|
}, [item]));
|
|
12567
|
+
const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
|
|
12568
|
+
const operateDom = operateList.map(item => {
|
|
12569
|
+
return createVNode(resolveComponent("a-tooltip"), {
|
|
12570
|
+
"title": item.title
|
|
12571
|
+
}, {
|
|
12572
|
+
default: () => [createVNode("div", {
|
|
12573
|
+
"class": ["operate-item", item.key, {
|
|
12574
|
+
active: item.isActive
|
|
12575
|
+
}],
|
|
12576
|
+
"onClick": () => handleOperate(item.key)
|
|
12577
|
+
}, null)]
|
|
12578
|
+
});
|
|
12579
|
+
});
|
|
12580
|
+
const prevDisabled = activeAnswerIndex.value === 0;
|
|
12581
|
+
const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
|
|
12582
|
+
const answerNav = createVNode("div", {
|
|
12583
|
+
"class": "operate-item"
|
|
12584
|
+
}, [createVNode("span", {
|
|
12585
|
+
"class": ["nav", {
|
|
12586
|
+
disalbed: prevDisabled
|
|
12587
|
+
}]
|
|
12588
|
+
}, ["<"]), activeAnswerIndex.value + 1, "/ ", props.content.length, createVNode("span", {
|
|
12589
|
+
"class": ["nav", {
|
|
12590
|
+
disalbed: nextDisabled
|
|
12591
|
+
}]
|
|
12592
|
+
}, [">"])]);
|
|
12386
12593
|
return createVNode("div", {
|
|
12387
12594
|
"class": "answer-bubble chat-bubble"
|
|
12388
12595
|
}, [createVNode(Avatar, {
|
|
12389
|
-
"avatar": "",
|
|
12596
|
+
"avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
|
|
12390
12597
|
"name": "\u7F8E\u5C0F\u817E"
|
|
12391
12598
|
}, null), createVNode("div", {
|
|
12392
12599
|
"ref": bubbleRef,
|
|
12393
12600
|
"class": "bubble answer"
|
|
12394
|
-
}, null), createVNode("div", {
|
|
12601
|
+
}, null), showOperates && createVNode("div", {
|
|
12395
12602
|
"class": "operates"
|
|
12396
|
-
},
|
|
12397
|
-
"class": "suggestion-list"
|
|
12398
|
-
}, [suggestionListDom])]);
|
|
12603
|
+
}, [props.content.length > 1 && answerNav, operateDom])]);
|
|
12399
12604
|
};
|
|
12400
12605
|
}
|
|
12401
12606
|
});
|
|
12402
12607
|
|
|
12403
|
-
const
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12608
|
+
const QaContext = defineComponent({
|
|
12609
|
+
props: {
|
|
12610
|
+
list: {
|
|
12611
|
+
type: Array,
|
|
12612
|
+
default: () => []
|
|
12613
|
+
}
|
|
12614
|
+
},
|
|
12615
|
+
setup(props) {
|
|
12616
|
+
const containerRef = ref();
|
|
12617
|
+
const onAnswerRender = text => {
|
|
12618
|
+
containerRef.value.scrollTo({
|
|
12619
|
+
top: containerRef.value.scrollHeight,
|
|
12620
|
+
behavior: "smooth"
|
|
12621
|
+
});
|
|
12622
|
+
};
|
|
12623
|
+
const handleDeleteAnswer = (questionId, answerId) => {
|
|
12624
|
+
const question = props.list.find(item => item.id === questionId);
|
|
12625
|
+
if (question) {
|
|
12626
|
+
question.answers = question.answers.filter(item => item.id !== answerId);
|
|
12627
|
+
}
|
|
12628
|
+
};
|
|
12629
|
+
return () => {
|
|
12630
|
+
const contextList = [];
|
|
12631
|
+
for (let i = 0; i < props.list.length; i++) {
|
|
12632
|
+
const questionItem = props.list[i];
|
|
12633
|
+
const prevItem = props.list[i - 1];
|
|
12634
|
+
const currentTime = questionItem.timestamp;
|
|
12635
|
+
let timeDiff = 0;
|
|
12636
|
+
if (prevItem) {
|
|
12637
|
+
const prevTime = prevItem.timestamp;
|
|
12638
|
+
timeDiff = currentTime - prevTime;
|
|
12639
|
+
}
|
|
12640
|
+
if (!prevItem || timeDiff > 1e3 * 60 * 5) {
|
|
12641
|
+
contextList.push(createVNode("div", {
|
|
12642
|
+
"class": "time-line"
|
|
12643
|
+
}, [dayjs(currentTime).format("MM/DD HH:mm")]));
|
|
12644
|
+
}
|
|
12645
|
+
if (questionItem.content) {
|
|
12646
|
+
contextList.push(createVNode(QuestionBubble, {
|
|
12647
|
+
"content": questionItem.content
|
|
12648
|
+
}, null));
|
|
12649
|
+
}
|
|
12650
|
+
if (questionItem.answers.length > 0) {
|
|
12651
|
+
contextList.push(createVNode(AnswerBubble, {
|
|
12652
|
+
"onRender": onAnswerRender,
|
|
12653
|
+
"content": questionItem.answers,
|
|
12654
|
+
"onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId)
|
|
12655
|
+
}, null));
|
|
12656
|
+
}
|
|
12657
|
+
}
|
|
12658
|
+
return createVNode("div", {
|
|
12659
|
+
"class": "qa-context",
|
|
12660
|
+
"ref": containerRef
|
|
12661
|
+
}, [contextList]);
|
|
12662
|
+
};
|
|
12416
12663
|
}
|
|
12417
12664
|
});
|
|
12418
12665
|
|
|
@@ -12432,11 +12679,24 @@ const ChatBox = defineComponent({
|
|
|
12432
12679
|
emit
|
|
12433
12680
|
}) {
|
|
12434
12681
|
provide("chat-theme", props.theme);
|
|
12435
|
-
|
|
12682
|
+
const {
|
|
12683
|
+
context,
|
|
12684
|
+
answerLoading,
|
|
12685
|
+
sendQuestion,
|
|
12686
|
+
answer
|
|
12687
|
+
} = useQA();
|
|
12688
|
+
provide("answerLoading", answerLoading);
|
|
12689
|
+
const handleSend = msg => {
|
|
12690
|
+
sendQuestion(msg);
|
|
12691
|
+
};
|
|
12436
12692
|
return () => {
|
|
12437
12693
|
return createVNode("div", {
|
|
12438
12694
|
"class": ["inl-chat-box", `inl-chat-box-${props.theme}`]
|
|
12439
|
-
}, [createVNode(
|
|
12695
|
+
}, [createVNode(QaContext, {
|
|
12696
|
+
"list": context.value
|
|
12697
|
+
}, null), createVNode(Bottom, {
|
|
12698
|
+
"onSend": handleSend
|
|
12699
|
+
}, null)]);
|
|
12440
12700
|
};
|
|
12441
12701
|
}
|
|
12442
12702
|
});
|