inl-ui 0.1.29 → 0.1.31

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.
@@ -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$b(s) {
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$b(_slot = props.menu.map(item => vue.createVNode(antDesignVue.MenuItem, {
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$a(s) {
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$a(_slot = props.menu.map(item => renderMenuItem(item))) ? _slot : {
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$9(s) {
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$9(_slot = menu.subList.map(item => renderMenu(item))) ? _slot : {
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$9(_slot2 = props.menuList.map(item => renderMenu(item))) ? _slot2 : {
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$8(s) {
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$8(_slot = filterIcons.value.map(icon => vue.createVNode(vue.resolveComponent("a-col"), {
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$7(s) {
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$7(formItem) ? formItem : {
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$6(s) {
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$6(_slot = breadList.value.map(item => vue.createVNode(vue.resolveComponent("a-breadcrumb-item"), {
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$5(s) {
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$5(_slot = props.renderNameTag(people)) ? _slot : {
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$4(s) {
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$4(_slot = formDescList.value.map((item, index) => vue.createVNode(vue.resolveComponent("a-col"), {
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$3(s) {
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$3(_slot = menus.value.map((item, index) => vue.createVNode(vue.resolveComponent("a-button"), {
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$3(_slot2 = tabs.value.map(item => vue.createVNode(vue.resolveComponent("a-tab-pane"), {
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$2(s) {
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$2(_slot = getInput(compareDefine.paramDefine, {
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$2(input) ? input : {
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$1(s) {
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$1(_slot = group.paramList.map((item, pIndex) => vue.createVNode(ParamItem, {
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$1(_slot2 = cell.paramList.map((item, pIndex) => vue.createVNode(ParamItem, {
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,713 @@ 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
+ const SpeechRecognition = vue.defineComponent({
12690
+ emits: ["change", "close"],
12691
+ setup(props, {
12692
+ emit
12693
+ }) {
12694
+ let mediaRecorder;
12695
+ const recording = vue.ref(false);
12696
+ const text = vue.ref("");
12697
+ const boxRef = vue.inject("boxRef");
12698
+ const startRecord = () => {
12699
+ if (!navigator.mediaDevices) {
12700
+ antDesignVue.message.error("\u4E0D\u652F\u6301mediaDevices");
12701
+ return;
12702
+ }
12703
+ navigator.mediaDevices.getUserMedia({
12704
+ audio: true
12705
+ }).then(stream => {
12706
+ if (!MediaRecorder) {
12707
+ antDesignVue.message.error("\u4E0D\u652F\u6301MediaRecorder");
12708
+ }
12709
+ text.value = "";
12710
+ mediaRecorder = new MediaRecorder(stream);
12711
+ mediaRecorder.start();
12712
+ recording.value = true;
12713
+ mediaRecorder.ondataavailable = e => {
12714
+ const blob = new Blob([e.data], {
12715
+ type: "audio/mp4"
12716
+ });
12717
+ const file = new File([blob], "recordedAudio.m4a", {
12718
+ type: blob.type
12719
+ });
12720
+ audioToText(file).then(str => {
12721
+ text.value = str;
12722
+ }).catch(() => {
12723
+ antDesignVue.message.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");
12724
+ });
12725
+ };
12726
+ mediaRecorder.onstop = () => {
12727
+ recording.value = false;
12728
+ stream.getTracks().forEach(track => track.stop());
12729
+ };
12730
+ }).catch(e => {
12731
+ antDesignVue.message.warn("\u8BF7\u5F00\u542F\u5F55\u97F3\u6743\u9650");
12732
+ });
12733
+ };
12734
+ vue.onMounted(startRecord);
12735
+ const handleStop = () => {
12736
+ if (mediaRecorder) {
12737
+ mediaRecorder.stop();
12738
+ recording.value = false;
12739
+ }
12740
+ };
12741
+ const onOk = () => {
12742
+ emit("change", text.value);
12743
+ };
12744
+ vue.onBeforeUnmount(() => {
12745
+ if (mediaRecorder) {
12746
+ mediaRecorder.stop();
12747
+ }
12748
+ });
12749
+ return () => {
12750
+ const textRender = vue.createVNode("div", {
12751
+ "class": "current-text"
12752
+ }, [text.value || "\u6211\u6B63\u5728\u542C\uFF0C\u8BF7\u8BF4\u8BDD"]);
12753
+ const btns = [recording.value && vue.createVNode("div", {
12754
+ "class": "btn btn-stop",
12755
+ "onClick": handleStop
12756
+ }, ["\u505C\u6B62\u8BC6\u522B"]), !recording.value && vue.createVNode("div", {
12757
+ "class": "btn",
12758
+ "onClick": startRecord
12759
+ }, ["\u91CD\u65B0\u751F\u6210"]), !recording.value && vue.createVNode("div", {
12760
+ "class": "btn btn-ok",
12761
+ "onClick": onOk
12762
+ }, ["\u786E\u5B9A"])];
12763
+ return vue.createVNode(vue.Teleport, {
12764
+ "to": boxRef.value
12765
+ }, {
12766
+ default: () => [vue.createVNode("div", {
12767
+ "class": "speech-recognition"
12768
+ }, [vue.createVNode("div", {
12769
+ "class": "speech-recognition-inner"
12770
+ }, [textRender, vue.createVNode(vue.resolveComponent("a-space"), {
12771
+ "class": "btn-container",
12772
+ "size": 24
12773
+ }, _isSlot(btns) ? btns : {
12774
+ default: () => [btns]
12775
+ }), vue.createVNode("div", {
12776
+ "class": "tips"
12777
+ }, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"]), vue.createVNode("img", {
12778
+ "class": "img-bot",
12779
+ "src": "/micro-assets/largeLanguageModel/llm-avatar-thinking.gif",
12780
+ "alt": ""
12781
+ }, null), vue.createVNode("span", {
12782
+ "class": "btn-close",
12783
+ "onClick": () => emit("close")
12784
+ }, [vue.createTextVNode("+")])])])]
12785
+ });
12786
+ };
12787
+ }
12788
+ });
12789
+
12790
+ const Input = vue.defineComponent({
12791
+ emits: ["send"],
12792
+ setup(props, {
12793
+ emit,
12794
+ expose
12795
+ }) {
12796
+ const abortRequest = vue.inject("abortRequest");
12797
+ const loading = vue.inject("answerLoading");
12798
+ const value = vue.ref("");
12799
+ const isFocus = vue.ref(false);
12800
+ const send = () => {
12801
+ if (loading.value) return;
12802
+ if (value.value.length === 0) {
12803
+ antDesignVue.message.warn("\u8BF7\u8F93\u5165\u95EE\u9898");
12804
+ return;
12805
+ }
12806
+ emit("send", value.value);
12807
+ value.value = "";
12808
+ };
12809
+ const handleAbord = () => {
12810
+ abortRequest();
12811
+ };
12812
+ const audioEnable = vue.ref(false);
12813
+ const handleAudioClick = () => {
12814
+ audioEnable.value = true;
12815
+ };
12816
+ const handleAudioText = text => {
12817
+ value.value = text;
12818
+ audioEnable.value = false;
12819
+ setTimeout(() => {
12820
+ send();
12821
+ }, 500);
12822
+ };
12823
+ const clear = () => value.value = "";
12824
+ expose({
12825
+ clear
12826
+ });
12827
+ return () => vue.createVNode("div", {
12828
+ "class": ["chat-box-input", {
12829
+ focus: isFocus.value
12830
+ }]
12831
+ }, [vue.createVNode("img", {
12832
+ "class": "img img-mic",
12833
+ "src": "/micro-assets/largeLanguageModel/mic.png",
12834
+ "alt": "",
12835
+ "onClick": handleAudioClick
12836
+ }, null), vue.createVNode(vue.resolveComponent("a-input"), {
12837
+ "value": value.value,
12838
+ "onUpdate:value": $event => value.value = $event,
12839
+ "bordered": false,
12840
+ "placeholder": "\u5982: \u67E5\u770BXXX\u76AE\u5E26\u673A\u5934\u7535\u6D41\u7B49",
12841
+ "onFocus": () => isFocus.value = true,
12842
+ "onBlur": () => isFocus.value = false,
12843
+ "onPressEnter": send
12844
+ }, null), loading.value ? vue.createVNode("img", {
12845
+ "class": "btn-abort",
12846
+ "title": "\u4E2D\u6B62\u56DE\u7B54",
12847
+ "src": "/micro-assets/largeLanguageModel/btn-abort.png",
12848
+ "onClick": handleAbord
12849
+ }, null) : vue.createVNode("img", {
12850
+ "class": "img img-send",
12851
+ "src": "/micro-assets/largeLanguageModel/send.png",
12852
+ "onClick": send
12853
+ }, null), audioEnable.value && vue.createVNode(SpeechRecognition, {
12854
+ "onChange": handleAudioText,
12855
+ "onClose": () => audioEnable.value = false
12856
+ }, null)]);
12857
+ }
12858
+ });
12859
+
12860
+ const tips = ["\u8BBE\u5907\u5DE5\u4F5C\u539F\u7406", "\u8BBE\u5907\u7EF4\u4FDD\u624B\u518C"];
12861
+ const Bottom = vue.defineComponent({
12862
+ emits: ["send"],
12863
+ setup(props, {
12864
+ emit
12865
+ }) {
12866
+ const inputRef = vue.ref();
12867
+ const handleSend = msg => {
12868
+ inputRef.value.clear();
12869
+ emit("send", msg);
12870
+ };
12871
+ return () => {
12872
+ tips.map(tip => vue.createVNode("div", {
12873
+ "class": "tip",
12874
+ "onClick": () => handleSend(tip)
12875
+ }, [tip]));
12876
+ return vue.createVNode("div", {
12877
+ "class": "bottom"
12878
+ }, [vue.createVNode(Input, {
12879
+ "ref": inputRef,
12880
+ "onSend": handleSend
12881
+ }, null), vue.createVNode("div", {
12882
+ "class": "exemption"
12883
+ }, ["\u5185\u5BB9\u7531\u7F8E\u817E\u5927\u6A21\u578B\u751F\u6210\uFF0C\u4EC5\u4F5C\u4E3A\u53C2\u8003"])]);
12884
+ };
12885
+ }
12886
+ });
12887
+
12888
+ const Avatar = vue.defineComponent({
12889
+ props: {
12890
+ avatar: {
12891
+ type: String,
12892
+ required: true
12893
+ },
12894
+ name: {
12895
+ type: String,
12896
+ required: true
12897
+ },
12898
+ reverse: Boolean
12899
+ },
12900
+ setup(props, {
12901
+ emit
12902
+ }) {
12903
+ return () => vue.createVNode("div", {
12904
+ "class": ["chat-avatar", {
12905
+ "chat-avatar-reverse": props.reverse
12906
+ }]
12907
+ }, [vue.createVNode(vue.resolveComponent("a-avatar"), {
12908
+ "class": "avatar",
12909
+ "alt": "\u5934\u50CF",
12910
+ "src": props.avatar
12911
+ }, null), vue.createVNode("div", {
12912
+ "class": "chat-avatar-name"
12913
+ }, [props.name])]);
12914
+ }
12915
+ });
12916
+
12917
+ const QuestionBubble = vue.defineComponent({
12918
+ props: {
12919
+ content: {
12920
+ type: String,
12921
+ default: ""
12922
+ }
12923
+ },
12924
+ setup(props) {
12925
+ const userinfo = JSON.parse(sessionStorage.getItem("userinfo") || "{}");
12926
+ const avatar = userinfo.photo || "/micro-assets/platform_app/avatar.png";
12927
+ const name = userinfo.employeeName || userinfo.userName || "\u7528\u6237";
12928
+ return () => vue.createVNode("div", {
12929
+ "class": "question-bubble chat-bubble"
12930
+ }, [vue.createVNode(Avatar, {
12931
+ "reverse": true,
12932
+ "avatar": avatar,
12933
+ "name": name
12934
+ }, null), vue.createVNode("div", {
12935
+ "class": "bubble question"
12936
+ }, [props.content]), vue.createVNode("div", {
12937
+ "class": "operates"
12938
+ }, null)]);
12939
+ }
12940
+ });
12941
+
12942
+ const commonStyle = `
12943
+ :host > p {
12944
+ margin: 0;
12945
+ }
12946
+ :host {
12947
+ font-size: 14px;
12948
+ }
12949
+ `;
12950
+ const styleDark = `
12951
+ <style>
12952
+ ${commonStyle}
12953
+
12954
+ * {
12955
+ color: #fff;
12956
+ }
12957
+ strong {
12958
+ color: #f3c142;
12959
+ }
12960
+ </style>
12961
+ `;
12962
+ const styleLight = `
12963
+ <style>
12964
+ ${commonStyle}
12965
+
12966
+ * {
12967
+ color: #20242B;
12968
+ }
12969
+ strong {
12970
+ color: #4b7ff7;
12971
+ }
12972
+ </style>
12973
+ `;
12974
+
12975
+ 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"];
12976
+ const AnswerBubble = vue.defineComponent({
12977
+ emits: ["send", "render", "delete", "regenerate"],
12978
+ props: {
12979
+ content: {
12980
+ type: Array,
12981
+ default: () => []
12982
+ }
12983
+ },
12984
+ setup(props, {
12985
+ emit
12986
+ }) {
12987
+ const chatTheme = vue.inject("chat-theme");
12988
+ const {
12989
+ copy
12990
+ } = core.useClipboard({
12991
+ legacy: true
12992
+ });
12993
+ const bubbleRef = vue.ref();
12994
+ const activeAnswerIndex = vue.ref(0);
12995
+ const activeAnswer = vue.computed(() => props.content[activeAnswerIndex.value]);
12996
+ let shadowRoot;
12997
+ const trasformMd = mdString => {
12998
+ return marked.marked(mdString);
12999
+ };
13000
+ vue.onMounted(() => {
13001
+ shadowRoot = bubbleRef.value.attachShadow({
13002
+ mode: "open"
13003
+ });
13004
+ renderText();
13005
+ });
13006
+ const renderText = () => {
13007
+ if (!shadowRoot) return;
13008
+ vue.nextTick(() => {
13009
+ emit("render", activeAnswer.value.content);
13010
+ });
13011
+ const themeStyle = chatTheme === "dark" ? styleDark : styleLight;
13012
+ const html = `
13013
+ ${trasformMd(activeAnswer.value.content)}
13014
+
13015
+ ${themeStyle}
13016
+ `;
13017
+ shadowRoot.innerHTML = html;
13018
+ };
13019
+ vue.watch([activeAnswer, activeAnswerIndex], renderText, {
13020
+ deep: true
13021
+ });
13022
+ const switchAnswer = step => {
13023
+ activeAnswerIndex.value += step;
13024
+ };
13025
+ const operateList = vue.reactive([{
13026
+ title: "\u590D\u5236",
13027
+ key: "copy",
13028
+ isActive: false
13029
+ }, {
13030
+ title: "\u6709\u7528",
13031
+ key: "like",
13032
+ isActive: vue.computed(() => activeAnswer.value.isLike)
13033
+ }, {
13034
+ title: "\u65E0\u7528",
13035
+ key: "dislike",
13036
+ isActive: vue.computed(() => activeAnswer.value.isDislike)
13037
+ }, {
13038
+ title: "\u8BC4\u8BBA",
13039
+ key: "comment",
13040
+ isActive: false
13041
+ }, {
13042
+ title: "\u91CD\u65B0\u751F\u6210",
13043
+ key: "regenerate",
13044
+ isActive: false
13045
+ }, {
13046
+ ttile: "\u5220\u9664",
13047
+ key: "delete",
13048
+ isActive: false
13049
+ }]);
13050
+ const handleOperate = key => {
13051
+ switch (key) {
13052
+ case "like":
13053
+ if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
13054
+ activeAnswer.value.isLike = !activeAnswer.value.isLike;
13055
+ }
13056
+ break;
13057
+ case "dislike":
13058
+ if (!activeAnswer.value.isLike && !activeAnswer.value.isDislike) {
13059
+ activeAnswer.value.isDislike = !activeAnswer.value.isDislike;
13060
+ }
13061
+ break;
13062
+ case "copy":
13063
+ copy(activeAnswer.value.content);
13064
+ antDesignVue.message.success("\u590D\u5236\u6210\u529F");
13065
+ break;
13066
+ case "delete":
13067
+ antDesignVue.Modal.confirm({
13068
+ title: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u56DE\u7B54\u5417\uFF1F",
13069
+ onOk: () => {
13070
+ emit("delete", activeAnswer.value.id);
13071
+ if (activeAnswerIndex.value > 0 && activeAnswerIndex.value === props.content.length - 1) {
13072
+ activeAnswerIndex.value--;
13073
+ }
13074
+ }
13075
+ });
13076
+ break;
13077
+ case "comment":
13078
+ antDesignVue.message.info("\u6682\u672A\u5F00\u653E");
13079
+ break;
13080
+ case "regenerate":
13081
+ if (props.content.length >= 5) {
13082
+ antDesignVue.message.info("\u6700\u591A\u652F\u6301\u751F\u62105\u6761\u56DE\u7B54");
13083
+ return;
13084
+ }
13085
+ emit("regenerate", activeAnswer.value.id);
13086
+ vue.nextTick(() => {
13087
+ activeAnswerIndex.value = props.content.length - 1;
13088
+ });
13089
+ break;
13090
+ }
13091
+ };
13092
+ return () => {
13093
+ suggestionList.map(item => vue.createVNode("div", {
13094
+ "class": "suggestion-item",
13095
+ "onClick": () => emit("send", item)
13096
+ }, [item]));
13097
+ const showOperates = !activeAnswer.value.hideOperates && activeAnswer.value.loadEnd;
13098
+ const operateDom = operateList.map(item => vue.createVNode(vue.resolveComponent("a-tooltip"), {
13099
+ "title": item.title
13100
+ }, {
13101
+ default: () => [vue.createVNode("div", {
13102
+ "class": ["operate-item", item.key, {
13103
+ active: item.isActive
13104
+ }],
13105
+ "onClick": () => handleOperate(item.key)
13106
+ }, null)]
13107
+ }));
13108
+ const prevDisabled = activeAnswerIndex.value === 0;
13109
+ const nextDisabled = activeAnswerIndex.value === props.content.length - 1;
13110
+ const answerNav = vue.createVNode("div", {
13111
+ "class": "operate-item operate-nav"
13112
+ }, [vue.createVNode("span", {
13113
+ "class": ["nav", {
13114
+ disabled: prevDisabled
13115
+ }],
13116
+ "onClick": () => switchAnswer(-1)
13117
+ }, ["<"]), vue.createVNode("span", null, [activeAnswerIndex.value + 1]), " ", vue.createVNode("span", null, [vue.createTextVNode("/")]), vue.createVNode("span", null, [props.content.length]), vue.createVNode("span", {
13118
+ "class": ["nav", {
13119
+ disabled: nextDisabled
13120
+ }],
13121
+ "onClick": () => switchAnswer(1)
13122
+ }, [">"])]);
13123
+ return vue.createVNode("div", {
13124
+ "class": "answer-bubble chat-bubble"
13125
+ }, [vue.createVNode(Avatar, {
13126
+ "avatar": "/micro-assets/largeLanguageModel/robot-avatar.png",
13127
+ "name": "\u7F8E\u5C0F\u817E"
13128
+ }, null), vue.createVNode("div", {
13129
+ "ref": bubbleRef,
13130
+ "class": "bubble answer"
13131
+ }, null), vue.createVNode("div", {
13132
+ "class": "operates"
13133
+ }, [props.content.length > 1 && answerNav, showOperates && operateDom])]);
13134
+ };
13135
+ }
13136
+ });
13137
+
13138
+ const QaContext = vue.defineComponent({
13139
+ emits: ["regenerate"],
13140
+ props: {
13141
+ list: {
13142
+ type: Array,
13143
+ default: () => []
13144
+ }
13145
+ },
13146
+ setup(props, {
13147
+ emit
13148
+ }) {
13149
+ const containerRef = vue.ref();
13150
+ const onAnswerRender = text => {
13151
+ containerRef.value.scrollTo({
13152
+ top: containerRef.value.scrollHeight,
13153
+ behavior: "smooth"
13154
+ });
13155
+ };
13156
+ const handleDeleteAnswer = (questionId, answerId) => {
13157
+ const question = props.list.find(item => item.id === questionId);
13158
+ if (question) {
13159
+ question.answers = question.answers.filter(item => item.id !== answerId);
13160
+ }
13161
+ };
13162
+ return () => {
13163
+ const contextList = [];
13164
+ for (let i = 0; i < props.list.length; i++) {
13165
+ const questionItem = props.list[i];
13166
+ const prevItem = props.list[i - 1];
13167
+ const currentTime = questionItem.timestamp;
13168
+ let timeDiff = 0;
13169
+ if (prevItem) {
13170
+ const prevTime = prevItem.timestamp;
13171
+ timeDiff = currentTime - prevTime;
13172
+ }
13173
+ if (!prevItem || timeDiff > 1e3 * 60 * 5) {
13174
+ contextList.push(vue.createVNode("div", {
13175
+ "class": "time-line"
13176
+ }, [dayjs__default["default"](currentTime).format("MM/DD HH:mm")]));
13177
+ }
13178
+ if (questionItem.content) {
13179
+ contextList.push(vue.createVNode(QuestionBubble, {
13180
+ "content": questionItem.content
13181
+ }, null));
13182
+ }
13183
+ if (questionItem.answers.length > 0) {
13184
+ contextList.push(vue.createVNode(AnswerBubble, {
13185
+ "onRender": onAnswerRender,
13186
+ "content": questionItem.answers,
13187
+ "onDelete": answerId => handleDeleteAnswer(questionItem.id, answerId),
13188
+ "onRegenerate": () => emit("regenerate", questionItem.id)
13189
+ }, null));
13190
+ }
13191
+ }
13192
+ return vue.createVNode("div", {
13193
+ "class": "qa-context",
13194
+ "ref": containerRef
13195
+ }, [contextList]);
13196
+ };
13197
+ }
13198
+ });
13199
+
13200
+ const ChatBox = vue.defineComponent({
13201
+ props: {
13202
+ theme: {
13203
+ type: String,
13204
+ default: "light"
13205
+ },
13206
+ // 语音输入 TODO
13207
+ withSpeech: {
13208
+ type: Boolean,
13209
+ default: false
13210
+ }
13211
+ },
13212
+ setup(props, {
13213
+ emit
13214
+ }) {
13215
+ const containerRef = vue.ref();
13216
+ vue.provide("boxRef", containerRef);
13217
+ vue.provide("chat-theme", props.theme);
13218
+ const {
13219
+ context,
13220
+ answerLoading,
13221
+ sendQuestion,
13222
+ abortRequest
13223
+ } = useQA();
13224
+ vue.provide("answerLoading", answerLoading);
13225
+ vue.provide("abortRequest", abortRequest);
13226
+ const handleSend = (msg, questionId) => {
13227
+ sendQuestion(msg, questionId);
13228
+ };
13229
+ return () => {
13230
+ return vue.createVNode("div", {
13231
+ "ref": containerRef,
13232
+ "class": ["inl-chat-box-origin", `inl-chat-box-origin-${props.theme}`]
13233
+ }, [vue.createVNode(QaContext, {
13234
+ "list": context.value,
13235
+ "onRegenerate": qId => handleSend("", qId)
13236
+ }, null), vue.createVNode(Bottom, {
13237
+ "onSend": handleSend
13238
+ }, null)]);
13239
+ };
13240
+ }
13241
+ });
13242
+
13243
+ const LlmChatBox = installComponent(ChatBox, "llm-chat-box");
13244
+
12537
13245
  exports.AlarmVideo = alarmVideo;
12538
13246
  exports.ChangeThemeSelect = index$6;
12539
13247
  exports.ChildLayout = childLayout;
@@ -12546,6 +13254,7 @@ exports.IconSelect = icons;
12546
13254
  exports.ImportModal = ImportModal;
12547
13255
  exports.Layout = index$8;
12548
13256
  exports.LayoutTable = table;
13257
+ exports.LlmChatBox = LlmChatBox;
12549
13258
  exports.Login = index$7;
12550
13259
  exports.ParamManager = index$2;
12551
13260
  exports.ParamManagerV2 = ParamManagerV2;