inl-ui 0.1.29 → 0.1.30
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 +737 -29
- package/dist/components/index.d.ts +27 -1
- package/dist/components/index.js +743 -36
- package/dist/index.cjs +739 -31
- package/dist/index.d.ts +29 -1
- package/dist/index.js +745 -37
- package/dist/style.css +1 -1
- package/package.json +3 -2
|
@@ -15,6 +15,7 @@ require('vite-plugin-qiankun');
|
|
|
15
15
|
var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
|
|
16
16
|
var EZUIKit = require('ezuikit-js');
|
|
17
17
|
var mobile = require('@sszj-temp/mobile');
|
|
18
|
+
var marked = require('marked');
|
|
18
19
|
|
|
19
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
21
|
|
|
@@ -266,7 +267,7 @@ function useActiveMenu(menuList, extraPages, isNav = false, watchOnce = false, i
|
|
|
266
267
|
return menu;
|
|
267
268
|
}
|
|
268
269
|
|
|
269
|
-
function _isSlot$
|
|
270
|
+
function _isSlot$c(s) {
|
|
270
271
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
271
272
|
}
|
|
272
273
|
const Header$1 = vue.defineComponent({
|
|
@@ -361,7 +362,7 @@ const Header$1 = vue.defineComponent({
|
|
|
361
362
|
"selectedKeys": acitveMenuKey.value,
|
|
362
363
|
"onUpdate:selectedKeys": $event => acitveMenuKey.value = $event,
|
|
363
364
|
"onSelect": handleMenuSelected
|
|
364
|
-
}, _isSlot$
|
|
365
|
+
}, _isSlot$c(_slot = props.menu.map(item => vue.createVNode(antDesignVue.MenuItem, {
|
|
365
366
|
"key": item.id,
|
|
366
367
|
"title": item.name
|
|
367
368
|
}, {
|
|
@@ -429,7 +430,7 @@ const Header$1 = vue.defineComponent({
|
|
|
429
430
|
}
|
|
430
431
|
});
|
|
431
432
|
|
|
432
|
-
function _isSlot$
|
|
433
|
+
function _isSlot$b(s) {
|
|
433
434
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
434
435
|
}
|
|
435
436
|
const renderMenuItem = item => {
|
|
@@ -511,7 +512,7 @@ const SideMenu$1 = vue.defineComponent({
|
|
|
511
512
|
"onUpdate:openKeys": $event => expandKeys.value = $event,
|
|
512
513
|
"selectedKeys": activeMenu.value,
|
|
513
514
|
"onSelect": handleMenuSelect
|
|
514
|
-
}, _isSlot$
|
|
515
|
+
}, _isSlot$b(_slot = props.menu.map(item => renderMenuItem(item))) ? _slot : {
|
|
515
516
|
default: () => [_slot]
|
|
516
517
|
});
|
|
517
518
|
};
|
|
@@ -7991,7 +7992,7 @@ const Header = vue.defineComponent({
|
|
|
7991
7992
|
});
|
|
7992
7993
|
var table = installComponent(Header, "layout-table");
|
|
7993
7994
|
|
|
7994
|
-
function _isSlot$
|
|
7995
|
+
function _isSlot$a(s) {
|
|
7995
7996
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
7996
7997
|
}
|
|
7997
7998
|
const SideMenu = vue.defineComponent({
|
|
@@ -8064,7 +8065,7 @@ const SideMenu = vue.defineComponent({
|
|
|
8064
8065
|
"icon": menu.icon && vue.createVNode(IconFont$1, {
|
|
8065
8066
|
"type": menu.icon
|
|
8066
8067
|
}, null)
|
|
8067
|
-
}, _isSlot$
|
|
8068
|
+
}, _isSlot$a(_slot = menu.subList.map(item => renderMenu(item))) ? _slot : {
|
|
8068
8069
|
default: () => [_slot]
|
|
8069
8070
|
});
|
|
8070
8071
|
}
|
|
@@ -8086,7 +8087,7 @@ const SideMenu = vue.defineComponent({
|
|
|
8086
8087
|
"mode": "inline",
|
|
8087
8088
|
"selectedKeys": activeMenu.value,
|
|
8088
8089
|
"onSelect": handleMenuSelect
|
|
8089
|
-
}, _isSlot$
|
|
8090
|
+
}, _isSlot$a(_slot2 = props.menuList.map(item => renderMenu(item))) ? _slot2 : {
|
|
8090
8091
|
default: () => [_slot2]
|
|
8091
8092
|
});
|
|
8092
8093
|
};
|
|
@@ -10414,7 +10415,7 @@ var getIconFonts = (() => {
|
|
|
10414
10415
|
return iconfonts;
|
|
10415
10416
|
});
|
|
10416
10417
|
|
|
10417
|
-
function _isSlot$
|
|
10418
|
+
function _isSlot$9(s) {
|
|
10418
10419
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
10419
10420
|
}
|
|
10420
10421
|
const IconSelect = vue.defineComponent({
|
|
@@ -10491,7 +10492,7 @@ const IconSelect = vue.defineComponent({
|
|
|
10491
10492
|
"onUpdate:value": $event => keyword.value = $event
|
|
10492
10493
|
}, null), vue.createVNode(vue.resolveComponent("a-row"), {
|
|
10493
10494
|
"gutter": [16, 30]
|
|
10494
|
-
}, _isSlot$
|
|
10495
|
+
}, _isSlot$9(_slot = filterIcons.value.map(icon => vue.createVNode(vue.resolveComponent("a-col"), {
|
|
10495
10496
|
"span": 3
|
|
10496
10497
|
}, {
|
|
10497
10498
|
default: () => [vue.createVNode("div", {
|
|
@@ -10514,7 +10515,7 @@ const IconSelect = vue.defineComponent({
|
|
|
10514
10515
|
});
|
|
10515
10516
|
var icons = installComponent(IconSelect, "icon-select");
|
|
10516
10517
|
|
|
10517
|
-
function _isSlot$
|
|
10518
|
+
function _isSlot$8(s) {
|
|
10518
10519
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
10519
10520
|
}
|
|
10520
10521
|
const QueryFormContainer = vue.defineComponent({
|
|
@@ -10548,7 +10549,7 @@ const QueryFormContainer = vue.defineComponent({
|
|
|
10548
10549
|
}, [vue.createVNode(antDesignVue.Row, null, {
|
|
10549
10550
|
default: () => [typeof slots.default === "function" && slots.default().map((formItem, index) => vue.createVNode(antDesignVue.Col, {
|
|
10550
10551
|
"span": responsiveLayout.value[index]
|
|
10551
|
-
}, _isSlot$
|
|
10552
|
+
}, _isSlot$8(formItem) ? formItem : {
|
|
10552
10553
|
default: () => [formItem]
|
|
10553
10554
|
}))]
|
|
10554
10555
|
})]);
|
|
@@ -10688,7 +10689,7 @@ const SearchPeopleInput = vue.defineComponent({
|
|
|
10688
10689
|
}
|
|
10689
10690
|
});
|
|
10690
10691
|
|
|
10691
|
-
function _isSlot$
|
|
10692
|
+
function _isSlot$7(s) {
|
|
10692
10693
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
10693
10694
|
}
|
|
10694
10695
|
const DepBreadcrumb = vue.defineComponent({
|
|
@@ -10723,7 +10724,7 @@ const DepBreadcrumb = vue.defineComponent({
|
|
|
10723
10724
|
let _slot;
|
|
10724
10725
|
return vue.createVNode("div", {
|
|
10725
10726
|
"class": "dep-breadcrumb"
|
|
10726
|
-
}, [vue.createVNode(vue.resolveComponent("a-breadcrumb"), null, _isSlot$
|
|
10727
|
+
}, [vue.createVNode(vue.resolveComponent("a-breadcrumb"), null, _isSlot$7(_slot = breadList.value.map(item => vue.createVNode(vue.resolveComponent("a-breadcrumb-item"), {
|
|
10727
10728
|
"key": item.id,
|
|
10728
10729
|
"onClick": () => handleClick(item)
|
|
10729
10730
|
}, {
|
|
@@ -10735,7 +10736,7 @@ const DepBreadcrumb = vue.defineComponent({
|
|
|
10735
10736
|
}
|
|
10736
10737
|
});
|
|
10737
10738
|
|
|
10738
|
-
function _isSlot$
|
|
10739
|
+
function _isSlot$6(s) {
|
|
10739
10740
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
10740
10741
|
}
|
|
10741
10742
|
const defaultPropNames = {
|
|
@@ -10939,7 +10940,7 @@ const PeopleSelect = vue.defineComponent({
|
|
|
10939
10940
|
"key": people.userId,
|
|
10940
10941
|
"closable": true,
|
|
10941
10942
|
"onClose": () => handleDelete(people)
|
|
10942
|
-
}, _isSlot$
|
|
10943
|
+
}, _isSlot$6(_slot = props.renderNameTag(people)) ? _slot : {
|
|
10943
10944
|
default: () => [_slot]
|
|
10944
10945
|
});
|
|
10945
10946
|
}) : vue.createVNode(vue.resolveComponent("a-empty"), {
|
|
@@ -11108,7 +11109,7 @@ const ProFormItem = vue.defineComponent({
|
|
|
11108
11109
|
}
|
|
11109
11110
|
});
|
|
11110
11111
|
|
|
11111
|
-
function _isSlot$
|
|
11112
|
+
function _isSlot$5(s) {
|
|
11112
11113
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11113
11114
|
}
|
|
11114
11115
|
const DynamicForm = vue.defineComponent({
|
|
@@ -11206,7 +11207,7 @@ const DynamicForm = vue.defineComponent({
|
|
|
11206
11207
|
}, {
|
|
11207
11208
|
default: () => [vue.createVNode(vue.resolveComponent("a-row"), {
|
|
11208
11209
|
"gutter": 16
|
|
11209
|
-
}, _isSlot$
|
|
11210
|
+
}, _isSlot$5(_slot = formDescList.value.map((item, index) => vue.createVNode(vue.resolveComponent("a-col"), {
|
|
11210
11211
|
"key": index,
|
|
11211
11212
|
"xl": 8,
|
|
11212
11213
|
"lg": 12,
|
|
@@ -11398,7 +11399,7 @@ const TabItem = vue.defineComponent({
|
|
|
11398
11399
|
}
|
|
11399
11400
|
});
|
|
11400
11401
|
|
|
11401
|
-
function _isSlot$
|
|
11402
|
+
function _isSlot$4(s) {
|
|
11402
11403
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11403
11404
|
}
|
|
11404
11405
|
const ParamManager = vue.defineComponent({
|
|
@@ -11478,7 +11479,7 @@ const ParamManager = vue.defineComponent({
|
|
|
11478
11479
|
let _slot, _slot2;
|
|
11479
11480
|
return vue.createVNode("div", {
|
|
11480
11481
|
"class": [`${config.prefix}-param-manager`, "flex"]
|
|
11481
|
-
}, [!props.menu && vue.createVNode(vue.resolveComponent("a-space"), null, _isSlot$
|
|
11482
|
+
}, [!props.menu && vue.createVNode(vue.resolveComponent("a-space"), null, _isSlot$4(_slot = menus.value.map((item, index) => vue.createVNode(vue.resolveComponent("a-button"), {
|
|
11482
11483
|
"type": currentMenu.value.id === item.id ? "primary" : "default",
|
|
11483
11484
|
"onClick": () => changeMenu(item)
|
|
11484
11485
|
}, {
|
|
@@ -11488,7 +11489,7 @@ const ParamManager = vue.defineComponent({
|
|
|
11488
11489
|
}), vue.createVNode(vue.resolveComponent("a-tabs"), {
|
|
11489
11490
|
"activeKey": activeTab.value,
|
|
11490
11491
|
"onUpdate:activeKey": $event => activeTab.value = $event
|
|
11491
|
-
}, _isSlot$
|
|
11492
|
+
}, _isSlot$4(_slot2 = tabs.value.map(item => vue.createVNode(vue.resolveComponent("a-tab-pane"), {
|
|
11492
11493
|
"key": item.id,
|
|
11493
11494
|
"tab": item.name
|
|
11494
11495
|
}, {
|
|
@@ -11559,7 +11560,7 @@ const CollapseTitle = vue.defineComponent({
|
|
|
11559
11560
|
}
|
|
11560
11561
|
});
|
|
11561
11562
|
|
|
11562
|
-
function _isSlot$
|
|
11563
|
+
function _isSlot$3(s) {
|
|
11563
11564
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11564
11565
|
}
|
|
11565
11566
|
function buildRules(define) {
|
|
@@ -11666,7 +11667,7 @@ function getInput(param = {}, inputProp) {
|
|
|
11666
11667
|
"style": {
|
|
11667
11668
|
marginBottom: "0"
|
|
11668
11669
|
}
|
|
11669
|
-
}, _isSlot$
|
|
11670
|
+
}, _isSlot$3(_slot = getInput(compareDefine.paramDefine, {
|
|
11670
11671
|
...inputPropComp,
|
|
11671
11672
|
value: compareDefine.paramDefineValue?.value
|
|
11672
11673
|
})) ? _slot : {
|
|
@@ -11755,7 +11756,7 @@ const ParamItem = vue.defineComponent({
|
|
|
11755
11756
|
"label": props.param.name,
|
|
11756
11757
|
"name": props.name,
|
|
11757
11758
|
"rules": rules
|
|
11758
|
-
}, _isSlot$
|
|
11759
|
+
}, _isSlot$3(input) ? input : {
|
|
11759
11760
|
default: () => [input]
|
|
11760
11761
|
})]
|
|
11761
11762
|
});
|
|
@@ -11790,7 +11791,7 @@ const batchSaveParamsValue = async form => {
|
|
|
11790
11791
|
return res.json();
|
|
11791
11792
|
};
|
|
11792
11793
|
|
|
11793
|
-
function _isSlot$
|
|
11794
|
+
function _isSlot$2(s) {
|
|
11794
11795
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11795
11796
|
}
|
|
11796
11797
|
async function getParamsDefine({
|
|
@@ -11963,7 +11964,7 @@ const TabLevel = vue.defineComponent({
|
|
|
11963
11964
|
"title": group.name,
|
|
11964
11965
|
"forceRender": true
|
|
11965
11966
|
}, {
|
|
11966
|
-
default: () => [vue.createVNode(vue.resolveComponent("a-row"), null, _isSlot$
|
|
11967
|
+
default: () => [vue.createVNode(vue.resolveComponent("a-row"), null, _isSlot$2(_slot = group.paramList.map((item, pIndex) => vue.createVNode(ParamItem, {
|
|
11967
11968
|
"name": [gIndex, "paramList", pIndex, "paramDefineValue", "value"],
|
|
11968
11969
|
"param": item.paramDefine,
|
|
11969
11970
|
"valueDefine": item.paramDefineValue
|
|
@@ -11977,7 +11978,7 @@ const TabLevel = vue.defineComponent({
|
|
|
11977
11978
|
"class": "cell-title"
|
|
11978
11979
|
}, [cell.name]), vue.createVNode(vue.resolveComponent("a-row"), {
|
|
11979
11980
|
"gutter": 16
|
|
11980
|
-
}, _isSlot$
|
|
11981
|
+
}, _isSlot$2(_slot2 = cell.paramList.map((item, pIndex) => vue.createVNode(ParamItem, {
|
|
11981
11982
|
"name": [gIndex, "cells", cIndex, "paramList", pIndex, "paramDefineValue", "value"],
|
|
11982
11983
|
"param": item.paramDefine,
|
|
11983
11984
|
"valueDefine": item.paramDefineValue
|
|
@@ -11993,7 +11994,7 @@ const TabLevel = vue.defineComponent({
|
|
|
11993
11994
|
}
|
|
11994
11995
|
});
|
|
11995
11996
|
|
|
11996
|
-
function _isSlot(s) {
|
|
11997
|
+
function _isSlot$1(s) {
|
|
11997
11998
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
11998
11999
|
}
|
|
11999
12000
|
const ParamManagerV2 = vue.defineComponent({
|
|
@@ -12076,7 +12077,7 @@ const ParamManagerV2 = vue.defineComponent({
|
|
|
12076
12077
|
}, [vue.createVNode(vue.resolveComponent("a-menu"), {
|
|
12077
12078
|
"mode": "inline",
|
|
12078
12079
|
"selectedKeys": activeMenu.value && [activeMenu.value.id]
|
|
12079
|
-
}, _isSlot(_slot = menuList.value.map(item => vue.createVNode(vue.resolveComponent("a-menu-item"), {
|
|
12080
|
+
}, _isSlot$1(_slot = menuList.value.map(item => vue.createVNode(vue.resolveComponent("a-menu-item"), {
|
|
12080
12081
|
"key": item.id,
|
|
12081
12082
|
"onClick": () => handleMenuChange(item)
|
|
12082
12083
|
}, {
|
|
@@ -12087,7 +12088,7 @@ const ParamManagerV2 = vue.defineComponent({
|
|
|
12087
12088
|
"class": "right"
|
|
12088
12089
|
}, [tabList.value.length > 0 ? vue.createVNode(vue.resolveComponent("a-tabs"), {
|
|
12089
12090
|
"onChange": handleTabChange
|
|
12090
|
-
}, _isSlot(_slot2 = tabList.value.map(tab => vue.createVNode(vue.resolveComponent("a-tab-pane"), {
|
|
12091
|
+
}, _isSlot$1(_slot2 = tabList.value.map(tab => vue.createVNode(vue.resolveComponent("a-tab-pane"), {
|
|
12091
12092
|
"key": tab.id,
|
|
12092
12093
|
"tab": tab.name
|
|
12093
12094
|
}, {
|
|
@@ -12534,6 +12535,712 @@ const SszComment = vue.defineComponent({
|
|
|
12534
12535
|
});
|
|
12535
12536
|
var index = installComponent(SszComment, "ssz-comment");
|
|
12536
12537
|
|
|
12538
|
+
function formatDataString(str) {
|
|
12539
|
+
const lines = str.split("\n");
|
|
12540
|
+
const result = lines.filter(line => !!line.trim()).map(line => {
|
|
12541
|
+
const data = JSON.parse(line.replace(/^data: /, ""));
|
|
12542
|
+
return data.text;
|
|
12543
|
+
}).filter(line => line !== void 0).join("");
|
|
12544
|
+
return result;
|
|
12545
|
+
}
|
|
12546
|
+
function request(question, streamCallback, doneCallback) {
|
|
12547
|
+
const controller = new AbortController();
|
|
12548
|
+
const signal = controller.signal;
|
|
12549
|
+
fetch("/api/chat/v1/chat/chat", {
|
|
12550
|
+
signal,
|
|
12551
|
+
method: "POST",
|
|
12552
|
+
headers: {
|
|
12553
|
+
"Content-Type": "application/json"
|
|
12554
|
+
},
|
|
12555
|
+
body: JSON.stringify({
|
|
12556
|
+
query: question,
|
|
12557
|
+
conversation_id: ""
|
|
12558
|
+
})
|
|
12559
|
+
}).then(res => {
|
|
12560
|
+
const stream = res.body;
|
|
12561
|
+
const decoder = new TextDecoder();
|
|
12562
|
+
const reader = stream.getReader();
|
|
12563
|
+
let result = "";
|
|
12564
|
+
function processText() {
|
|
12565
|
+
return reader.read().then(({
|
|
12566
|
+
done,
|
|
12567
|
+
value
|
|
12568
|
+
}) => {
|
|
12569
|
+
if (done) {
|
|
12570
|
+
doneCallback();
|
|
12571
|
+
return;
|
|
12572
|
+
}
|
|
12573
|
+
try {
|
|
12574
|
+
const dataString = decoder.decode(value, {
|
|
12575
|
+
stream: true
|
|
12576
|
+
});
|
|
12577
|
+
const str = formatDataString(dataString);
|
|
12578
|
+
result += str;
|
|
12579
|
+
streamCallback(result);
|
|
12580
|
+
} catch (e) {}
|
|
12581
|
+
return processText();
|
|
12582
|
+
}).catch(() => {
|
|
12583
|
+
doneCallback();
|
|
12584
|
+
});
|
|
12585
|
+
}
|
|
12586
|
+
return processText();
|
|
12587
|
+
}).catch(() => {
|
|
12588
|
+
doneCallback();
|
|
12589
|
+
});
|
|
12590
|
+
return function stop() {
|
|
12591
|
+
controller.abort();
|
|
12592
|
+
};
|
|
12593
|
+
}
|
|
12594
|
+
function useQA() {
|
|
12595
|
+
const context = vue.ref([]);
|
|
12596
|
+
const answerLoading = vue.ref(false);
|
|
12597
|
+
const answer = vue.ref("");
|
|
12598
|
+
let abort = null;
|
|
12599
|
+
setTimeout(() => {
|
|
12600
|
+
const questionItem = {
|
|
12601
|
+
type: "answer",
|
|
12602
|
+
content: "",
|
|
12603
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12604
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12605
|
+
answers: [{
|
|
12606
|
+
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",
|
|
12607
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12608
|
+
hideOperates: true,
|
|
12609
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12610
|
+
}]
|
|
12611
|
+
};
|
|
12612
|
+
context.value.push(questionItem);
|
|
12613
|
+
}, 1e3);
|
|
12614
|
+
function sendQuestion(question, questionId) {
|
|
12615
|
+
if (answerLoading.value) return;
|
|
12616
|
+
answerLoading.value = true;
|
|
12617
|
+
let questionItem = context.value.find(item => item.id === questionId);
|
|
12618
|
+
question = questionItem?.content || question;
|
|
12619
|
+
if (!questionId) {
|
|
12620
|
+
questionItem = {
|
|
12621
|
+
id: /* @__PURE__ */new Date().getTime(),
|
|
12622
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12623
|
+
content: question,
|
|
12624
|
+
answers: []
|
|
12625
|
+
};
|
|
12626
|
+
context.value.push(questionItem);
|
|
12627
|
+
}
|
|
12628
|
+
const answerItem = vue.ref({
|
|
12629
|
+
content: "\u6B63\u5728\u601D\u8003\u4E2D...",
|
|
12630
|
+
timestamp: /* @__PURE__ */new Date().getTime(),
|
|
12631
|
+
parentId: questionItem.id,
|
|
12632
|
+
id: /* @__PURE__ */new Date().getTime()
|
|
12633
|
+
});
|
|
12634
|
+
questionItem.answers.push(answerItem.value);
|
|
12635
|
+
abort = request(question, data => {
|
|
12636
|
+
answer.value = data;
|
|
12637
|
+
answerItem.value.content = data;
|
|
12638
|
+
}, () => {
|
|
12639
|
+
answerLoading.value = false;
|
|
12640
|
+
answerItem.value.loadEnd = true;
|
|
12641
|
+
abort = null;
|
|
12642
|
+
});
|
|
12643
|
+
}
|
|
12644
|
+
function abortRequest() {
|
|
12645
|
+
if (abort) {
|
|
12646
|
+
abort();
|
|
12647
|
+
abort = null;
|
|
12648
|
+
}
|
|
12649
|
+
}
|
|
12650
|
+
return {
|
|
12651
|
+
context,
|
|
12652
|
+
answerLoading,
|
|
12653
|
+
answer,
|
|
12654
|
+
sendQuestion,
|
|
12655
|
+
abortRequest
|
|
12656
|
+
};
|
|
12657
|
+
}
|
|
12658
|
+
|
|
12659
|
+
async function audioToText(file) {
|
|
12660
|
+
const headers = {
|
|
12661
|
+
"Content-Type": "application/json"
|
|
12662
|
+
};
|
|
12663
|
+
const formData = new FormData();
|
|
12664
|
+
formData.append("file", file);
|
|
12665
|
+
formData.append("upload_id", "1");
|
|
12666
|
+
const [path] = await fetch("/api/chat/v1/upload", {
|
|
12667
|
+
// headers,
|
|
12668
|
+
method: "POST",
|
|
12669
|
+
body: formData
|
|
12670
|
+
}).then(res => res.json());
|
|
12671
|
+
if (!path) {
|
|
12672
|
+
antDesignVue.message.error("\u4E0A\u4F20\u5F55\u97F3\u5931\u8D25");
|
|
12673
|
+
return;
|
|
12674
|
+
}
|
|
12675
|
+
const {
|
|
12676
|
+
result
|
|
12677
|
+
} = await fetch(`/api/chat/v1/translate/?path=${path}&session_hash=1`, {
|
|
12678
|
+
headers,
|
|
12679
|
+
method: "POST"
|
|
12680
|
+
}).then(res => res.json());
|
|
12681
|
+
if (result.length) {
|
|
12682
|
+
return result[0];
|
|
12683
|
+
}
|
|
12684
|
+
}
|
|
12685
|
+
|
|
12686
|
+
function _isSlot(s) {
|
|
12687
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
12688
|
+
}
|
|
12689
|
+
let stream;
|
|
12690
|
+
const SpeechRecognition = vue.defineComponent({
|
|
12691
|
+
emits: ["change", "close"],
|
|
12692
|
+
setup(props, {
|
|
12693
|
+
emit
|
|
12694
|
+
}) {
|
|
12695
|
+
let mediaRecorder;
|
|
12696
|
+
const recording = vue.ref(false);
|
|
12697
|
+
const text = vue.ref("");
|
|
12698
|
+
const boxRef = vue.inject("boxRef");
|
|
12699
|
+
const startRecord = () => {
|
|
12700
|
+
if (!stream) return;
|
|
12701
|
+
text.value = "";
|
|
12702
|
+
mediaRecorder = new MediaRecorder(stream);
|
|
12703
|
+
mediaRecorder.start();
|
|
12704
|
+
recording.value = true;
|
|
12705
|
+
mediaRecorder.ondataavailable = e => {
|
|
12706
|
+
const blob = new Blob([e.data], {
|
|
12707
|
+
type: "audio/mp4"
|
|
12708
|
+
});
|
|
12709
|
+
const file = new File([blob], "recordedAudio.m4a", {
|
|
12710
|
+
type: blob.type
|
|
12711
|
+
});
|
|
12712
|
+
audioToText(file).then(str => {
|
|
12713
|
+
text.value = str;
|
|
12714
|
+
}).catch(() => {
|
|
12715
|
+
antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
|
|
12716
|
+
});
|
|
12717
|
+
};
|
|
12718
|
+
mediaRecorder.onstop = () => recording.value = false;
|
|
12719
|
+
};
|
|
12720
|
+
vue.onMounted(() => {
|
|
12721
|
+
if (!stream) {
|
|
12722
|
+
navigator.mediaDevices.getUserMedia({
|
|
12723
|
+
audio: true
|
|
12724
|
+
}).then(s => {
|
|
12725
|
+
stream = s;
|
|
12726
|
+
startRecord();
|
|
12727
|
+
}).catch(() => {
|
|
12728
|
+
antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
|
|
12729
|
+
});
|
|
12730
|
+
} else {
|
|
12731
|
+
startRecord();
|
|
12732
|
+
}
|
|
12733
|
+
});
|
|
12734
|
+
const handleStop = () => {
|
|
12735
|
+
if (mediaRecorder) {
|
|
12736
|
+
mediaRecorder.stop();
|
|
12737
|
+
recording.value = false;
|
|
12738
|
+
}
|
|
12739
|
+
};
|
|
12740
|
+
const onOk = () => {
|
|
12741
|
+
emit("change", text.value);
|
|
12742
|
+
};
|
|
12743
|
+
vue.onBeforeUnmount(() => {
|
|
12744
|
+
if (mediaRecorder) {
|
|
12745
|
+
mediaRecorder.stop();
|
|
12746
|
+
}
|
|
12747
|
+
});
|
|
12748
|
+
return () => {
|
|
12749
|
+
const textRender = vue.createVNode("div", {
|
|
12750
|
+
"class": "current-text"
|
|
12751
|
+
}, [text.value || "\u6211\u6B63\u5728\u542C\uFF0C\u8BF7\u8BF4\u8BDD"]);
|
|
12752
|
+
const btns = [recording.value && vue.createVNode("div", {
|
|
12753
|
+
"class": "btn btn-stop",
|
|
12754
|
+
"onClick": handleStop
|
|
12755
|
+
}, ["\u505C\u6B62\u8BC6\u522B"]), !recording.value && vue.createVNode("div", {
|
|
12756
|
+
"class": "btn",
|
|
12757
|
+
"onClick": startRecord
|
|
12758
|
+
}, ["\u91CD\u65B0\u751F\u6210"]), !recording.value && vue.createVNode("div", {
|
|
12759
|
+
"class": "btn btn-ok",
|
|
12760
|
+
"onClick": onOk
|
|
12761
|
+
}, ["\u786E\u5B9A"])];
|
|
12762
|
+
return vue.createVNode(vue.Teleport, {
|
|
12763
|
+
"to": boxRef.value
|
|
12764
|
+
}, {
|
|
12765
|
+
default: () => [vue.createVNode("div", {
|
|
12766
|
+
"class": "speech-recognition"
|
|
12767
|
+
}, [vue.createVNode("div", {
|
|
12768
|
+
"class": "speech-recognition-inner"
|
|
12769
|
+
}, [textRender, vue.createVNode(vue.resolveComponent("a-space"), {
|
|
12770
|
+
"class": "btn-container",
|
|
12771
|
+
"size": 24
|
|
12772
|
+
}, _isSlot(btns) ? btns : {
|
|
12773
|
+
default: () => [btns]
|
|
12774
|
+
}), vue.createVNode("div", {
|
|
12775
|
+
"class": "tips"
|
|
12776
|
+
}, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"]), vue.createVNode("img", {
|
|
12777
|
+
"class": "img-bot",
|
|
12778
|
+
"src": "/micro-assets/largeLanguageModel/llm-avatar-thinking.gif",
|
|
12779
|
+
"alt": ""
|
|
12780
|
+
}, null), vue.createVNode("span", {
|
|
12781
|
+
"class": "btn-close",
|
|
12782
|
+
"onClick": () => emit("close")
|
|
12783
|
+
}, [vue.createTextVNode("+")])])])]
|
|
12784
|
+
});
|
|
12785
|
+
};
|
|
12786
|
+
}
|
|
12787
|
+
});
|
|
12788
|
+
|
|
12789
|
+
const Input = vue.defineComponent({
|
|
12790
|
+
emits: ["send"],
|
|
12791
|
+
setup(props, {
|
|
12792
|
+
emit,
|
|
12793
|
+
expose
|
|
12794
|
+
}) {
|
|
12795
|
+
const abortRequest = vue.inject("abortRequest");
|
|
12796
|
+
const loading = vue.inject("answerLoading");
|
|
12797
|
+
const value = vue.ref("");
|
|
12798
|
+
const isFocus = vue.ref(false);
|
|
12799
|
+
const send = () => {
|
|
12800
|
+
if (loading.value) return;
|
|
12801
|
+
if (value.value.length === 0) {
|
|
12802
|
+
antDesignVue.message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
|
|
12803
|
+
return;
|
|
12804
|
+
}
|
|
12805
|
+
emit("send", value.value);
|
|
12806
|
+
value.value = "";
|
|
12807
|
+
};
|
|
12808
|
+
const handleAbord = () => {
|
|
12809
|
+
abortRequest();
|
|
12810
|
+
};
|
|
12811
|
+
const audioEnable = vue.ref(false);
|
|
12812
|
+
const handleAudioClick = () => {
|
|
12813
|
+
audioEnable.value = true;
|
|
12814
|
+
};
|
|
12815
|
+
const handleAudioText = text => {
|
|
12816
|
+
value.value = text;
|
|
12817
|
+
audioEnable.value = false;
|
|
12818
|
+
setTimeout(() => {
|
|
12819
|
+
send();
|
|
12820
|
+
}, 500);
|
|
12821
|
+
};
|
|
12822
|
+
const clear = () => value.value = "";
|
|
12823
|
+
expose({
|
|
12824
|
+
clear
|
|
12825
|
+
});
|
|
12826
|
+
return () => vue.createVNode("div", {
|
|
12827
|
+
"class": ["chat-box-input", {
|
|
12828
|
+
focus: isFocus.value
|
|
12829
|
+
}]
|
|
12830
|
+
}, [vue.createVNode("img", {
|
|
12831
|
+
"class": "img img-mic",
|
|
12832
|
+
"src": "/micro-assets/largeLanguageModel/mic.png",
|
|
12833
|
+
"alt": "",
|
|
12834
|
+
"onClick": handleAudioClick
|
|
12835
|
+
}, null), vue.createVNode(vue.resolveComponent("a-input"), {
|
|
12836
|
+
"value": value.value,
|
|
12837
|
+
"onUpdate:value": $event => value.value = $event,
|
|
12838
|
+
"bordered": false,
|
|
12839
|
+
"placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
|
|
12840
|
+
"onFocus": () => isFocus.value = true,
|
|
12841
|
+
"onBlur": () => isFocus.value = false,
|
|
12842
|
+
"onPressEnter": send
|
|
12843
|
+
}, null), loading.value ? vue.createVNode("img", {
|
|
12844
|
+
"class": "btn-abort",
|
|
12845
|
+
"title": "\u4E2D\u6B62\u56DE\u7B54",
|
|
12846
|
+
"src": "/micro-assets/largeLanguageModel/btn-abort.png",
|
|
12847
|
+
"onClick": handleAbord
|
|
12848
|
+
}, null) : vue.createVNode("img", {
|
|
12849
|
+
"class": "img img-send",
|
|
12850
|
+
"src": "/micro-assets/largeLanguageModel/send.png",
|
|
12851
|
+
"onClick": send
|
|
12852
|
+
}, null), audioEnable.value && vue.createVNode(SpeechRecognition, {
|
|
12853
|
+
"onChange": handleAudioText,
|
|
12854
|
+
"onClose": () => audioEnable.value = false
|
|
12855
|
+
}, null)]);
|
|
12856
|
+
}
|
|
12857
|
+
});
|
|
12858
|
+
|
|
12859
|
+
const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
|
|
12860
|
+
const Bottom = vue.defineComponent({
|
|
12861
|
+
emits: ["send"],
|
|
12862
|
+
setup(props, {
|
|
12863
|
+
emit
|
|
12864
|
+
}) {
|
|
12865
|
+
const inputRef = vue.ref();
|
|
12866
|
+
const handleSend = msg => {
|
|
12867
|
+
inputRef.value.clear();
|
|
12868
|
+
emit("send", msg);
|
|
12869
|
+
};
|
|
12870
|
+
return () => {
|
|
12871
|
+
tips.map(tip => vue.createVNode("div", {
|
|
12872
|
+
"class": "tip",
|
|
12873
|
+
"onClick": () => handleSend(tip)
|
|
12874
|
+
}, [tip]));
|
|
12875
|
+
return vue.createVNode("div", {
|
|
12876
|
+
"class": "bottom"
|
|
12877
|
+
}, [vue.createVNode(Input, {
|
|
12878
|
+
"ref": inputRef,
|
|
12879
|
+
"onSend": handleSend
|
|
12880
|
+
}, null), vue.createVNode("div", {
|
|
12881
|
+
"class": "exemption"
|
|
12882
|
+
}, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"])]);
|
|
12883
|
+
};
|
|
12884
|
+
}
|
|
12885
|
+
});
|
|
12886
|
+
|
|
12887
|
+
const Avatar = vue.defineComponent({
|
|
12888
|
+
props: {
|
|
12889
|
+
avatar: {
|
|
12890
|
+
type: String,
|
|
12891
|
+
required: true
|
|
12892
|
+
},
|
|
12893
|
+
name: {
|
|
12894
|
+
type: String,
|
|
12895
|
+
required: true
|
|
12896
|
+
},
|
|
12897
|
+
reverse: Boolean
|
|
12898
|
+
},
|
|
12899
|
+
setup(props, {
|
|
12900
|
+
emit
|
|
12901
|
+
}) {
|
|
12902
|
+
return () => vue.createVNode("div", {
|
|
12903
|
+
"class": ["chat-avatar", {
|
|
12904
|
+
"chat-avatar-reverse": props.reverse
|
|
12905
|
+
}]
|
|
12906
|
+
}, [vue.createVNode(vue.resolveComponent("a-avatar"), {
|
|
12907
|
+
"class": "avatar",
|
|
12908
|
+
"alt": "\u5934\u50CF",
|
|
12909
|
+
"src": props.avatar
|
|
12910
|
+
}, null), vue.createVNode("div", {
|
|
12911
|
+
"class": "chat-avatar-name"
|
|
12912
|
+
}, [props.name])]);
|
|
12913
|
+
}
|
|
12914
|
+
});
|
|
12915
|
+
|
|
12916
|
+
const QuestionBubble = vue.defineComponent({
|
|
12917
|
+
props: {
|
|
12918
|
+
content: {
|
|
12919
|
+
type: String,
|
|
12920
|
+
default: ""
|
|
12921
|
+
}
|
|
12922
|
+
},
|
|
12923
|
+
setup(props) {
|
|
12924
|
+
const userinfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
|
|
12925
|
+
const avatar = userinfo.photo || "/micro-assets/platform_app/avatar.png";
|
|
12926
|
+
const name = userinfo.employeeName || userinfo.userName || "\u7528\u6237";
|
|
12927
|
+
return () => vue.createVNode("div", {
|
|
12928
|
+
"class": "question-bubble chat-bubble"
|
|
12929
|
+
}, [vue.createVNode(Avatar, {
|
|
12930
|
+
"reverse": true,
|
|
12931
|
+
"avatar": avatar,
|
|
12932
|
+
"name": name
|
|
12933
|
+
}, null), vue.createVNode("div", {
|
|
12934
|
+
"class": "bubble question"
|
|
12935
|
+
}, [props.content]), vue.createVNode("div", {
|
|
12936
|
+
"class": "operates"
|
|
12937
|
+
}, null)]);
|
|
12938
|
+
}
|
|
12939
|
+
});
|
|
12940
|
+
|
|
12941
|
+
const commonStyle = `
|
|
12942
|
+
:host > p {
|
|
12943
|
+
margin: 0;
|
|
12944
|
+
}
|
|
12945
|
+
:host {
|
|
12946
|
+
font-size: 14px;
|
|
12947
|
+
}
|
|
12948
|
+
`;
|
|
12949
|
+
const styleDark = `
|
|
12950
|
+
<style>
|
|
12951
|
+
${commonStyle}
|
|
12952
|
+
|
|
12953
|
+
* {
|
|
12954
|
+
color: #fff;
|
|
12955
|
+
}
|
|
12956
|
+
strong {
|
|
12957
|
+
color: #f3c142;
|
|
12958
|
+
}
|
|
12959
|
+
</style>
|
|
12960
|
+
`;
|
|
12961
|
+
const styleLight = `
|
|
12962
|
+
<style>
|
|
12963
|
+
${commonStyle}
|
|
12964
|
+
|
|
12965
|
+
* {
|
|
12966
|
+
color: #20242B;
|
|
12967
|
+
}
|
|
12968
|
+
strong {
|
|
12969
|
+
color: #4b7ff7;
|
|
12970
|
+
}
|
|
12971
|
+
</style>
|
|
12972
|
+
`;
|
|
12973
|
+
|
|
12974
|
+
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"];
|
|
12975
|
+
const AnswerBubble = vue.defineComponent({
|
|
12976
|
+
emits: ["send", "render", "delete", "regenerate"],
|
|
12977
|
+
props: {
|
|
12978
|
+
content: {
|
|
12979
|
+
type: Array,
|
|
12980
|
+
default: () => []
|
|
12981
|
+
}
|
|
12982
|
+
},
|
|
12983
|
+
setup(props, {
|
|
12984
|
+
emit
|
|
12985
|
+
}) {
|
|
12986
|
+
const chatTheme = vue.inject("chat-theme");
|
|
12987
|
+
const {
|
|
12988
|
+
copy
|
|
12989
|
+
} = core.useClipboard({
|
|
12990
|
+
legacy: true
|
|
12991
|
+
});
|
|
12992
|
+
const bubbleRef = vue.ref();
|
|
12993
|
+
const activeAnswerIndex = vue.ref(0);
|
|
12994
|
+
const activeAnswer = vue.computed(() => props.content[activeAnswerIndex.value]);
|
|
12995
|
+
let shadowRoot;
|
|
12996
|
+
const trasformMd = mdString => {
|
|
12997
|
+
return marked.marked(mdString);
|
|
12998
|
+
};
|
|
12999
|
+
vue.onMounted(() => {
|
|
13000
|
+
shadowRoot = bubbleRef.value.attachShadow({
|
|
13001
|
+
mode: "open"
|
|
13002
|
+
});
|
|
13003
|
+
renderText();
|
|
13004
|
+
});
|
|
13005
|
+
const renderText = () => {
|
|
13006
|
+
if (!shadowRoot) return;
|
|
13007
|
+
vue.nextTick(() => {
|
|
13008
|
+
emit("render", activeAnswer.value.content);
|
|
13009
|
+
});
|
|
13010
|
+
const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
|
|
13011
|
+
const html = `
|
|
13012
|
+
${trasformMd(activeAnswer.value.content)}
|
|
13013
|
+
|
|
13014
|
+
${themeStyle}
|
|
13015
|
+
`;
|
|
13016
|
+
shadowRoot.innerHTML = html;
|
|
13017
|
+
};
|
|
13018
|
+
vue.watch([activeAnswer, activeAnswerIndex], renderText, {
|
|
13019
|
+
deep: true
|
|
13020
|
+
});
|
|
13021
|
+
const switchAnswer = step => {
|
|
13022
|
+
activeAnswerIndex.value += step;
|
|
13023
|
+
};
|
|
13024
|
+
const operateList = vue.reactive([{
|
|
13025
|
+
title: "\u590D\u5236",
|
|
13026
|
+
key: "copy",
|
|
13027
|
+
isActive: false
|
|
13028
|
+
}, {
|
|
13029
|
+
title: "\u6709\u7528",
|
|
13030
|
+
key: "like",
|
|
13031
|
+
isActive: vue.computed(() => activeAnswer.value.isLike)
|
|
13032
|
+
}, {
|
|
13033
|
+
title: "\u65E0\u7528",
|
|
13034
|
+
key: "dislike",
|
|
13035
|
+
isActive: vue.computed(() => activeAnswer.value.isDislike)
|
|
13036
|
+
}, {
|
|
13037
|
+
title: "\u8BC4\u8BBA",
|
|
13038
|
+
key: "comment",
|
|
13039
|
+
isActive: false
|
|
13040
|
+
}, {
|
|
13041
|
+
title: "\u91CD\u65B0\u751F\u6210",
|
|
13042
|
+
key: "regenerate",
|
|
13043
|
+
isActive: false
|
|
13044
|
+
}, {
|
|
13045
|
+
ttile: "\u5220\u9664",
|
|
13046
|
+
key: "delete",
|
|
13047
|
+
isActive: false
|
|
13048
|
+
}]);
|
|
13049
|
+
const handleOperate = key => {
|
|
13050
|
+
switch (key) {
|
|
13051
|
+
case "like":
|
|
13052
|
+
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
13053
|
+
activeAnswer.value.isLike = !activeAnswer.value.isLike;
|
|
13054
|
+
}
|
|
13055
|
+
break;
|
|
13056
|
+
case "dislike":
|
|
13057
|
+
if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
|
|
13058
|
+
activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
|
|
13059
|
+
}
|
|
13060
|
+
break;
|
|
13061
|
+
case "copy":
|
|
13062
|
+
copy(activeAnswer.value.content);
|
|
13063
|
+
antDesignVue.message.success("\u590D\u5236\u6210\u529F");
|
|
13064
|
+
break;
|
|
13065
|
+
case "delete":
|
|
13066
|
+
antDesignVue.Modal.confirm({
|
|
13067
|
+
title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
|
|
13068
|
+
onOk: () => {
|
|
13069
|
+
emit("delete", activeAnswer.value.id);
|
|
13070
|
+
if (activeAnswerIndex.value > 0 && activeAnswerIndex.value === props.content.length - 1) {
|
|
13071
|
+
activeAnswerIndex.value--;
|
|
13072
|
+
}
|
|
13073
|
+
}
|
|
13074
|
+
});
|
|
13075
|
+
break;
|
|
13076
|
+
case "comment":
|
|
13077
|
+
antDesignVue.message.info("\u6682\u672A\u5F00\u653E");
|
|
13078
|
+
break;
|
|
13079
|
+
case "regenerate":
|
|
13080
|
+
if (props.content.length >= 5) {
|
|
13081
|
+
antDesignVue.message.info("\u6700\u591A\u652F\u6301\u751F\u62105\u6761\u56DE\u7B54");
|
|
13082
|
+
return;
|
|
13083
|
+
}
|
|
13084
|
+
emit("regenerate", activeAnswer.value.id);
|
|
13085
|
+
vue.nextTick(() => {
|
|
13086
|
+
activeAnswerIndex.value = props.content.length - 1;
|
|
13087
|
+
});
|
|
13088
|
+
break;
|
|
13089
|
+
}
|
|
13090
|
+
};
|
|
13091
|
+
return () => {
|
|
13092
|
+
suggestionList.map(item => vue.createVNode("div", {
|
|
13093
|
+
"class": "suggestion-item",
|
|
13094
|
+
"onClick": () => emit("send", item)
|
|
13095
|
+
}, [item]));
|
|
13096
|
+
const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
|
|
13097
|
+
const operateDom = operateList.map(item => vue.createVNode(vue.resolveComponent("a-tooltip"), {
|
|
13098
|
+
"title": item.title
|
|
13099
|
+
}, {
|
|
13100
|
+
default: () => [vue.createVNode("div", {
|
|
13101
|
+
"class": ["operate-item", item.key, {
|
|
13102
|
+
active: item.isActive
|
|
13103
|
+
}],
|
|
13104
|
+
"onClick": () => handleOperate(item.key)
|
|
13105
|
+
}, null)]
|
|
13106
|
+
}));
|
|
13107
|
+
const prevDisabled = activeAnswerIndex.value === 0;
|
|
13108
|
+
const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
|
|
13109
|
+
const answerNav = vue.createVNode("div", {
|
|
13110
|
+
"class": "operate-item operate-nav"
|
|
13111
|
+
}, [vue.createVNode("span", {
|
|
13112
|
+
"class": ["nav", {
|
|
13113
|
+
disabled: prevDisabled
|
|
13114
|
+
}],
|
|
13115
|
+
"onClick": () => switchAnswer(-1)
|
|
13116
|
+
}, ["<"]), vue.createVNode("span", null, [activeAnswerIndex.value + 1]), " ", vue.createVNode("span", null, [vue.createTextVNode("/")]), vue.createVNode("span", null, [props.content.length]), vue.createVNode("span", {
|
|
13117
|
+
"class": ["nav", {
|
|
13118
|
+
disabled: nextDisabled
|
|
13119
|
+
}],
|
|
13120
|
+
"onClick": () => switchAnswer(1)
|
|
13121
|
+
}, [">"])]);
|
|
13122
|
+
return vue.createVNode("div", {
|
|
13123
|
+
"class": "answer-bubble chat-bubble"
|
|
13124
|
+
}, [vue.createVNode(Avatar, {
|
|
13125
|
+
"avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
|
|
13126
|
+
"name": "\u7F8E\u5C0F\u817E"
|
|
13127
|
+
}, null), vue.createVNode("div", {
|
|
13128
|
+
"ref": bubbleRef,
|
|
13129
|
+
"class": "bubble answer"
|
|
13130
|
+
}, null), vue.createVNode("div", {
|
|
13131
|
+
"class": "operates"
|
|
13132
|
+
}, [props.content.length > 1 && answerNav, showOperates && operateDom])]);
|
|
13133
|
+
};
|
|
13134
|
+
}
|
|
13135
|
+
});
|
|
13136
|
+
|
|
13137
|
+
const QaContext = vue.defineComponent({
|
|
13138
|
+
emits: ["regenerate"],
|
|
13139
|
+
props: {
|
|
13140
|
+
list: {
|
|
13141
|
+
type: Array,
|
|
13142
|
+
default: () => []
|
|
13143
|
+
}
|
|
13144
|
+
},
|
|
13145
|
+
setup(props, {
|
|
13146
|
+
emit
|
|
13147
|
+
}) {
|
|
13148
|
+
const containerRef = vue.ref();
|
|
13149
|
+
const onAnswerRender = text => {
|
|
13150
|
+
containerRef.value.scrollTo({
|
|
13151
|
+
top: containerRef.value.scrollHeight,
|
|
13152
|
+
behavior: "smooth"
|
|
13153
|
+
});
|
|
13154
|
+
};
|
|
13155
|
+
const handleDeleteAnswer = (questionId, answerId) => {
|
|
13156
|
+
const question = props.list.find(item => item.id === questionId);
|
|
13157
|
+
if (question) {
|
|
13158
|
+
question.answers = question.answers.filter(item => item.id !== answerId);
|
|
13159
|
+
}
|
|
13160
|
+
};
|
|
13161
|
+
return () => {
|
|
13162
|
+
const contextList = [];
|
|
13163
|
+
for (let i = 0; i < props.list.length; i++) {
|
|
13164
|
+
const questionItem = props.list[i];
|
|
13165
|
+
const prevItem = props.list[i - 1];
|
|
13166
|
+
const currentTime = questionItem.timestamp;
|
|
13167
|
+
let timeDiff = 0;
|
|
13168
|
+
if (prevItem) {
|
|
13169
|
+
const prevTime = prevItem.timestamp;
|
|
13170
|
+
timeDiff = currentTime - prevTime;
|
|
13171
|
+
}
|
|
13172
|
+
if (!prevItem || timeDiff > 1e3 * 60 * 5) {
|
|
13173
|
+
contextList.push(vue.createVNode("div", {
|
|
13174
|
+
"class": "time-line"
|
|
13175
|
+
}, [dayjs__default["default"](currentTime).format("MM/DD HH:mm")]));
|
|
13176
|
+
}
|
|
13177
|
+
if (questionItem.content) {
|
|
13178
|
+
contextList.push(vue.createVNode(QuestionBubble, {
|
|
13179
|
+
"content": questionItem.content
|
|
13180
|
+
}, null));
|
|
13181
|
+
}
|
|
13182
|
+
if (questionItem.answers.length > 0) {
|
|
13183
|
+
contextList.push(vue.createVNode(AnswerBubble, {
|
|
13184
|
+
"onRender": onAnswerRender,
|
|
13185
|
+
"content": questionItem.answers,
|
|
13186
|
+
"onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId),
|
|
13187
|
+
"onRegenerate": () => emit("regenerate", questionItem.id)
|
|
13188
|
+
}, null));
|
|
13189
|
+
}
|
|
13190
|
+
}
|
|
13191
|
+
return vue.createVNode("div", {
|
|
13192
|
+
"class": "qa-context",
|
|
13193
|
+
"ref": containerRef
|
|
13194
|
+
}, [contextList]);
|
|
13195
|
+
};
|
|
13196
|
+
}
|
|
13197
|
+
});
|
|
13198
|
+
|
|
13199
|
+
const ChatBox = vue.defineComponent({
|
|
13200
|
+
props: {
|
|
13201
|
+
theme: {
|
|
13202
|
+
type: String,
|
|
13203
|
+
default: "light"
|
|
13204
|
+
},
|
|
13205
|
+
// 语音输入 TODO
|
|
13206
|
+
withSpeech: {
|
|
13207
|
+
type: Boolean,
|
|
13208
|
+
default: false
|
|
13209
|
+
}
|
|
13210
|
+
},
|
|
13211
|
+
setup(props, {
|
|
13212
|
+
emit
|
|
13213
|
+
}) {
|
|
13214
|
+
const containerRef = vue.ref();
|
|
13215
|
+
vue.provide("boxRef", containerRef);
|
|
13216
|
+
vue.provide("chat-theme", props.theme);
|
|
13217
|
+
const {
|
|
13218
|
+
context,
|
|
13219
|
+
answerLoading,
|
|
13220
|
+
sendQuestion,
|
|
13221
|
+
abortRequest
|
|
13222
|
+
} = useQA();
|
|
13223
|
+
vue.provide("answerLoading", answerLoading);
|
|
13224
|
+
vue.provide("abortRequest", abortRequest);
|
|
13225
|
+
const handleSend = (msg, questionId) => {
|
|
13226
|
+
sendQuestion(msg, questionId);
|
|
13227
|
+
};
|
|
13228
|
+
return () => {
|
|
13229
|
+
return vue.createVNode("div", {
|
|
13230
|
+
"ref": containerRef,
|
|
13231
|
+
"class": ["inl-chat-box-origin", `inl-chat-box-origin-${props.theme}`]
|
|
13232
|
+
}, [vue.createVNode(QaContext, {
|
|
13233
|
+
"list": context.value,
|
|
13234
|
+
"onRegenerate": qId => handleSend("", qId)
|
|
13235
|
+
}, null), vue.createVNode(Bottom, {
|
|
13236
|
+
"onSend": handleSend
|
|
13237
|
+
}, null)]);
|
|
13238
|
+
};
|
|
13239
|
+
}
|
|
13240
|
+
});
|
|
13241
|
+
|
|
13242
|
+
const LlmChatBox = installComponent(ChatBox, "llm-chat-box");
|
|
13243
|
+
|
|
12537
13244
|
exports.AlarmVideo = alarmVideo;
|
|
12538
13245
|
exports.ChangeThemeSelect = index$6;
|
|
12539
13246
|
exports.ChildLayout = childLayout;
|
|
@@ -12546,6 +13253,7 @@ exports.IconSelect = icons;
|
|
|
12546
13253
|
exports.ImportModal = ImportModal;
|
|
12547
13254
|
exports.Layout = index$8;
|
|
12548
13255
|
exports.LayoutTable = table;
|
|
13256
|
+
exports.LlmChatBox = LlmChatBox;
|
|
12549
13257
|
exports.Login = index$7;
|
|
12550
13258
|
exports.ParamManager = index$2;
|
|
12551
13259
|
exports.ParamManagerV2 = ParamManagerV2;
|