@kg-ui/kg-ui-plus 0.0.9 → 0.0.11

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.
Files changed (57) hide show
  1. package/README.md +3 -3
  2. package/dist/es/KgCopilot/CopiContent/AnswerHead.vue.mjs +3 -12
  3. package/dist/es/KgCopilot/CopiContent/AnswerHead.vue2.mjs +25 -2
  4. package/dist/es/KgCopilot/CopiContent/AnswerHead.vue3.mjs +4 -0
  5. package/dist/es/KgCopilot/CopiContent/UserHead.vue.mjs +2 -2
  6. package/dist/es/KgCopilot/CopiContent/UserHead.vue2.mjs +2 -2
  7. package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue.mjs +1 -1
  8. package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue2.mjs +3 -1
  9. package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue3.mjs +2 -2
  10. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue.mjs +1 -1
  11. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue2.mjs +116 -42
  12. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue3.mjs +2 -2
  13. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPluginByKey.vue.mjs +1 -1
  14. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPluginByKey.vue2.mjs +45 -38
  15. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPluginByKey.vue3.mjs +2 -2
  16. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue.mjs +1 -1
  17. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue3.mjs +2 -2
  18. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue.mjs +1 -1
  19. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue2.mjs +1 -1
  20. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue3.mjs +2 -2
  21. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue.mjs +1 -1
  22. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue2.mjs +33 -42
  23. package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue3.mjs +2 -2
  24. package/dist/es/KgCopilot/CopiFooter/index.vue.mjs +1 -1
  25. package/dist/es/KgCopilot/CopiFooter/index.vue3.mjs +2 -2
  26. package/dist/es/KgCopilot/dialogue/index.vue.mjs +1 -1
  27. package/dist/es/KgCopilot/dialogue/index.vue2.mjs +62 -49
  28. package/dist/es/KgCopilot/dialogue/index.vue3.mjs +2 -2
  29. package/dist/es/KgCopilot/dialogue/readMd.vue.mjs +1 -1
  30. package/dist/es/KgCopilot/dialogue/readMd.vue2.mjs +19 -19
  31. package/dist/es/KgCopilot/dialogue/readMd.vue3.mjs +2 -2
  32. package/dist/es/KgCopilot/index.vue.mjs +1 -1
  33. package/dist/es/KgCopilot/index.vue2.mjs +24 -5
  34. package/dist/es/KgCopilot/index.vue3.mjs +2 -2
  35. package/dist/es/api/copilot.mjs +25 -4
  36. package/dist/es/directives/heighlight/index.mjs +1 -1
  37. package/dist/es/home/LFilter/FilterArea.vue.mjs +1 -1
  38. package/dist/es/home/LFilter/FilterArea.vue2.mjs +1 -1
  39. package/dist/es/home/LFilter/FilterArea.vue3.mjs +2 -2
  40. package/dist/es/home/LFilter/FilterItem.vue.mjs +1 -1
  41. package/dist/es/home/LFilter/FilterItem.vue2.mjs +1 -1
  42. package/dist/es/home/LFilter/FilterItem.vue3.mjs +2 -2
  43. package/dist/es/home/LFilter/FilterItemIcon.vue.mjs +1 -1
  44. package/dist/es/home/LFilter/FilterItemIcon.vue2.mjs +1 -1
  45. package/dist/es/home/LFilter/FilterItemIcon.vue3.mjs +2 -2
  46. package/dist/es/home/LProject/index.vue.mjs +1 -1
  47. package/dist/es/home/LProject/index.vue3.mjs +2 -2
  48. package/dist/es/home/index.vue.mjs +1 -1
  49. package/dist/es/home/index.vue3.mjs +2 -2
  50. package/dist/es/node_modules/.pnpm/@microsoft_fetch-event-source@2.0.1/node_modules/@microsoft/fetch-event-source/lib/esm/fetch.mjs +90 -0
  51. package/dist/es/node_modules/.pnpm/@microsoft_fetch-event-source@2.0.1/node_modules/@microsoft/fetch-event-source/lib/esm/parse.mjs +109 -0
  52. package/dist/es/store/modules/copilot.mjs +70 -38
  53. package/dist/es/style.css +1 -1
  54. package/dist/es/utils/home.mjs +10 -0
  55. package/dist/es/utils/http/index.mjs +9 -0
  56. package/package.json +122 -121
  57. package/dist/es/node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/circle-plus.mjs +0 -8
@@ -1,13 +1,12 @@
1
- import { defineComponent, ref, onMounted, computed, watch, resolveComponent, openBlock, createElementBlock, unref, createTextVNode, toDisplayString, createElementVNode, createVNode, createCommentVNode, withKeys, normalizeStyle, pushScopeId, popScopeId } from "vue";
1
+ import { defineComponent, ref, onMounted, computed, watch, resolveComponent, openBlock, createElementBlock, unref, toDisplayString, createCommentVNode, createVNode, createElementVNode, withKeys, createTextVNode, normalizeStyle, pushScopeId, popScopeId } from "vue";
2
2
  import Upload from "./Upload.vue.mjs";
3
- import data$1 from "../../../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs";
4
- import data from "../../../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/close.mjs";
3
+ import data from "../../../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs";
5
4
  import SpeechControl from "./SpeechControl.vue.mjs";
6
5
  import SelectPlugin from "./SelectPlugin.vue.mjs";
7
6
  import SelectPluginByKey from "./SelectPluginByKey.vue.mjs";
8
7
  import { useCopilotStoreHook } from "../../../../store/modules/copilot.mjs";
9
8
  import { storeToRefs } from "pinia";
10
- const _withScopeId = (n) => (pushScopeId("data-v-9b43417d"), n = n(), popScopeId(), n);
9
+ const _withScopeId = (n) => (pushScopeId("data-v-2337064c"), n = n(), popScopeId(), n);
11
10
  const _hoisted_1 = { class: "input-container" };
12
11
  const _hoisted_2 = {
13
12
  key: 0,
@@ -19,7 +18,10 @@ const _hoisted_5 = [
19
18
  _hoisted_3,
20
19
  _hoisted_4
21
20
  ];
22
- const _hoisted_6 = { class: "input-row" };
21
+ const _hoisted_6 = {
22
+ class: "input-row",
23
+ id: "copiFooter"
24
+ };
23
25
  const _hoisted_7 = ["onKeydown"];
24
26
  const _hoisted_8 = { class: "bottom-controls" };
25
27
  const _hoisted_9 = { class: "bottom-left-controls" };
@@ -39,15 +41,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
41
  isInitCopilot,
40
42
  sendLonding,
41
43
  stopDialogue,
42
- checkedPluginBykey
44
+ checkedPluginByBtn
43
45
  } = storeToRefs(CopilotStore);
44
- const {
45
- setSearchText,
46
- sendMsg,
47
- setShowNewTheme,
48
- cancelRequest,
49
- setPluginByKey
50
- } = CopilotStore;
46
+ const { setSearchText, sendMsg, setShowNewTheme, cancelRequest } = CopilotStore;
51
47
  const coptInput = ref();
52
48
  onMounted(() => {
53
49
  coptInput.value.focus();
@@ -59,7 +55,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
59
55
  }
60
56
  return num;
61
57
  });
62
- const myInput = (e) => {
58
+ const root = document.documentElement;
59
+ const inputChange = (e) => {
60
+ if (e.target.offsetHeight < 200) {
61
+ root.style.setProperty(
62
+ "--input-bottom-height",
63
+ `${e.target.offsetHeight + 70}px`
64
+ );
65
+ } else {
66
+ root.style.setProperty("--font-size", `270px`);
67
+ }
63
68
  if (e.target.innerText.length >= 2e3) {
64
69
  e.target.innerText = e.target.innerText.substring(0, 2e3);
65
70
  const range = document.createRange();
@@ -77,9 +82,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
77
82
  selectPluginByKey();
78
83
  }
79
84
  };
80
- const deletePlugin = () => {
81
- setPluginByKey({});
82
- };
83
85
  const closeSelection = () => {
84
86
  isShowSelect.value = false;
85
87
  };
@@ -90,11 +92,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
90
92
  const initInput = () => {
91
93
  coptInput.value.innerText = "";
92
94
  setSearchText("");
95
+ root.style.setProperty("--input-bottom-height", `110px`);
93
96
  };
94
97
  let cursorPos = "";
95
98
  const deleteText = () => {
96
99
  const textArr = coptInput.value.innerText.split("");
97
- textArr.splice(cursorPos, 1);
100
+ textArr.splice(parseInt(cursorPos) - 1, 1);
98
101
  searchText.value = textArr.join("");
99
102
  };
100
103
  const getCursorPosition = () => {
@@ -102,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
102
105
  const range = selection.getRangeAt(0);
103
106
  cursorPos = range.startOffset.toString();
104
107
  };
105
- const send = (event) => {
108
+ const handlerSendMsg = (event) => {
106
109
  if (event.key === "Enter") {
107
110
  event.preventDefault();
108
111
  }
@@ -112,6 +115,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
112
115
  if (sendLonding.value)
113
116
  return;
114
117
  sendMsg(sendText);
118
+ initInput();
119
+ };
120
+ const handleClickStopBtn = () => {
121
+ cancelRequest();
115
122
  };
116
123
  watch(isInitCopilot, (newVal) => {
117
124
  if (newVal) {
@@ -119,24 +126,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
119
126
  isInitCopilot.value = false;
120
127
  }
121
128
  });
122
- const handleClickStopBtn = () => {
123
- cancelRequest();
124
- };
125
129
  return (_ctx, _cache) => {
126
130
  const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
127
131
  return openBlock(), createElementBlock("div", _hoisted_1, [
128
- unref(checkedPluginBykey).name ? (openBlock(), createElementBlock("div", _hoisted_2, [
129
- createTextVNode(toDisplayString(unref(checkedPluginBykey).name) + " ", 1),
130
- createElementVNode("div", {
131
- class: "close-plugin",
132
- onClick: deletePlugin
133
- }, [
134
- createVNode(_component_IconifyIconOffline, {
135
- class: "icon",
136
- icon: unref(data)
137
- }, null, 8, ["icon"])
138
- ])
139
- ])) : createCommentVNode("", true),
132
+ unref(checkedPluginByBtn).length !== 0 ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(unref(checkedPluginByBtn).map((item) => item.name).join(" ")) + " ", 1)) : createCommentVNode("", true),
140
133
  createVNode(SelectPluginByKey, {
141
134
  isShowSelect: isShowSelect.value,
142
135
  onClose: closeSelection,
@@ -153,13 +146,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
153
146
  ref_key: "coptInput",
154
147
  ref: coptInput,
155
148
  class: "text-area",
156
- contenteditable: true,
149
+ contenteditable: "plaintext-only",
157
150
  placeholder: "有问题请尽管问我。。。",
158
- onInput: myInput,
159
- onKeydown: [
160
- withKeys(send, ["enter"]),
161
- handleKeyDown
162
- ]
151
+ onInput: inputChange,
152
+ onKeydown: withKeys(handlerSendMsg, ["enter"]),
153
+ onKeyup: handleKeyDown
163
154
  }, toDisplayString(unref(searchText)), 41, _hoisted_7),
164
155
  createVNode(SpeechControl)
165
156
  ]),
@@ -174,11 +165,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
174
165
  ]),
175
166
  createElementVNode("button", {
176
167
  class: "send-button",
177
- onClick: send
168
+ onClick: handlerSendMsg
178
169
  }, [
179
170
  createVNode(_component_IconifyIconOffline, {
180
171
  class: "icon",
181
- icon: unref(data$1),
172
+ icon: unref(data),
182
173
  style: normalizeStyle({
183
174
  color: unref(textLength) && !unref(sendLonding) ? "#1e56ea" : "#dbdbdb"
184
175
  })
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_9b43417d_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_2337064c_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_9b43417d_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_2337064c_lang as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./index.vue2.mjs";
2
2
  import "./index.vue3.mjs";
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const CopiFooter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f807cdbd"]]);
4
+ const CopiFooter = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ba045a5d"]]);
5
5
  export {
6
6
  CopiFooter as default
7
7
  };
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_f807cdbd_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_ba045a5d_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_f807cdbd_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_ba045a5d_lang as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./index.vue2.mjs";
2
2
  import "./index.vue3.mjs";
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const dialogue = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-47d13b19"]]);
4
+ const dialogue = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-507ab62a"]]);
5
5
  export {
6
6
  dialogue as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createElementVNode, createBlock, normalizeClass, createVNode, createCommentVNode, withDirectives, createTextVNode, vShow, pushScopeId, popScopeId } from "vue";
1
+ import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createElementVNode, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, withDirectives, vShow, normalizeClass, pushScopeId, popScopeId } from "vue";
2
2
  import readMd from "./readMd.vue.mjs";
3
3
  import UserHead from "../CopiContent/UserHead.vue.mjs";
4
4
  import AnswerHead from "../CopiContent/AnswerHead.vue.mjs";
@@ -10,36 +10,43 @@ import data$3 from "../../node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_module
10
10
  import data$5 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/warning-bold.mjs";
11
11
  import { useCopilotStoreHook } from "../../store/modules/copilot.mjs";
12
12
  import { storeToRefs } from "pinia";
13
- const _withScopeId = (n) => (pushScopeId("data-v-47d13b19"), n = n(), popScopeId(), n);
13
+ const _withScopeId = (n) => (pushScopeId("data-v-507ab62a"), n = n(), popScopeId(), n);
14
14
  const _hoisted_1 = { class: "msg-head" };
15
15
  const _hoisted_2 = {
16
16
  key: 0,
17
- class: "icon-operates"
17
+ class: "msg-plus mb-1"
18
18
  };
19
19
  const _hoisted_3 = {
20
+ class: /* @__PURE__ */ normalizeClass({ "msg-content": true })
21
+ };
22
+ const _hoisted_4 = {
23
+ key: 0,
24
+ class: "icon-operates"
25
+ };
26
+ const _hoisted_5 = {
20
27
  class: "icon-item",
21
28
  title: "点赞"
22
29
  };
23
- const _hoisted_4 = {
30
+ const _hoisted_6 = {
24
31
  class: "icon-item",
25
32
  title: "不喜欢"
26
33
  };
27
- const _hoisted_5 = {
34
+ const _hoisted_7 = {
28
35
  class: "icon-item",
29
36
  title: "复制"
30
37
  };
31
- const _hoisted_6 = {
38
+ const _hoisted_8 = {
32
39
  class: "icon-item",
33
40
  title: "导出"
34
41
  };
35
- const _hoisted_7 = {
42
+ const _hoisted_9 = {
36
43
  class: "icon-item",
37
44
  title: "播放"
38
45
  };
39
- const _hoisted_8 = { class: "stop-dialogue" };
40
- const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
41
- const _hoisted_10 = { class: "title" };
46
+ const _hoisted_10 = { class: "stop-dialogue" };
42
47
  const _hoisted_11 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
48
+ const _hoisted_12 = { class: "title" };
49
+ const _hoisted_13 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
43
50
  const _sfc_main = /* @__PURE__ */ defineComponent({
44
51
  __name: "index",
45
52
  setup(__props) {
@@ -52,6 +59,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
52
59
  };
53
60
  const messageBox = ref();
54
61
  const scrollToBottom = (force = false) => {
62
+ if (!messageBox.value)
63
+ return;
55
64
  if (force) {
56
65
  messageBox.value.scrollTop = messageBox.value.scrollHeight;
57
66
  return;
@@ -67,58 +76,62 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
67
76
  ref_key: "messageBox",
68
77
  ref: messageBox
69
78
  }, [
70
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(msgList), (item, index) => {
79
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(msgList), (item) => {
71
80
  return openBlock(), createElementBlock("div", {
72
81
  class: "message-group",
73
- key: index
82
+ key: item.uuid
74
83
  }, [
75
84
  createElementVNode("div", _hoisted_1, [
76
- item.isSend ? (openBlock(), createBlock(UserHead, { key: 0 })) : (openBlock(), createBlock(AnswerHead, { key: 1 }))
85
+ item.isSend ? (openBlock(), createBlock(UserHead, { key: 0 })) : (openBlock(), createBlock(AnswerHead, { key: 1 }, {
86
+ avatar: withCtx(() => [
87
+ renderSlot(_ctx.$slots, "avatar", {}, void 0, true)
88
+ ]),
89
+ _: 3
90
+ }))
77
91
  ]),
78
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.msg, (msg, index2) => {
79
- return openBlock(), createElementBlock("div", {
80
- class: normalizeClass({ "msg-content": true }),
81
- key: index2
82
- }, [
83
- createVNode(readMd, {
84
- text: msg,
85
- onPrintOk: printOk,
86
- isPrinting: item.needPrinting,
87
- "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
88
- showCursor: !item.isSend,
89
- scrollToBottom
90
- }, null, 8, ["text", "isPrinting", "onUpdate:isPrinting", "showCursor"]),
91
- !item.isSend ? (openBlock(), createElementBlock("div", _hoisted_2, [
92
- createElementVNode("div", _hoisted_3, [
93
- createVNode(_component_IconifyIconOffline, { icon: unref(data) }, null, 8, ["icon"])
94
- ]),
95
- createElementVNode("div", _hoisted_4, [
96
- createVNode(_component_IconifyIconOffline, { icon: unref(data$1) }, null, 8, ["icon"])
97
- ]),
98
- createElementVNode("div", _hoisted_5, [
99
- createVNode(_component_IconifyIconOffline, { icon: unref(data$2) }, null, 8, ["icon"])
100
- ]),
101
- createElementVNode("div", _hoisted_6, [
102
- createVNode(_component_IconifyIconOffline, { icon: unref(data$3) }, null, 8, ["icon"])
103
- ]),
104
- createElementVNode("div", _hoisted_7, [
105
- createVNode(_component_IconifyIconOffline, { icon: unref(data$4) }, null, 8, ["icon"])
106
- ])
107
- ])) : createCommentVNode("", true)
108
- ]);
109
- }), 128))
92
+ !item.isSend && item.plusName ? (openBlock(), createElementBlock("div", _hoisted_2, [
93
+ createTextVNode(" 使用: "),
94
+ createElementVNode("span", null, toDisplayString(item.plusName.replace(/,/g, " ")), 1)
95
+ ])) : createCommentVNode("", true),
96
+ createElementVNode("div", _hoisted_3, [
97
+ createVNode(readMd, {
98
+ text: item.msg.join(" <br/> "),
99
+ onPrintOk: printOk,
100
+ isPrinting: item.needPrinting,
101
+ "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
102
+ showCursor: !item.isSend,
103
+ scrollToBottom
104
+ }, null, 8, ["text", "isPrinting", "onUpdate:isPrinting", "showCursor"]),
105
+ !item.isSend && !item.needPrinting && item.showOpt ? (openBlock(), createElementBlock("div", _hoisted_4, [
106
+ createElementVNode("div", _hoisted_5, [
107
+ createVNode(_component_IconifyIconOffline, { icon: unref(data) }, null, 8, ["icon"])
108
+ ]),
109
+ createElementVNode("div", _hoisted_6, [
110
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$1) }, null, 8, ["icon"])
111
+ ]),
112
+ createElementVNode("div", _hoisted_7, [
113
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$2) }, null, 8, ["icon"])
114
+ ]),
115
+ createElementVNode("div", _hoisted_8, [
116
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$3) }, null, 8, ["icon"])
117
+ ]),
118
+ createElementVNode("div", _hoisted_9, [
119
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$4) }, null, 8, ["icon"])
120
+ ])
121
+ ])) : createCommentVNode("", true)
122
+ ])
110
123
  ]);
111
124
  }), 128)),
112
- withDirectives(createElementVNode("div", _hoisted_8, [
113
- _hoisted_9,
114
- createElementVNode("div", _hoisted_10, [
125
+ withDirectives(createElementVNode("div", _hoisted_10, [
126
+ _hoisted_11,
127
+ createElementVNode("div", _hoisted_12, [
115
128
  createVNode(_component_IconifyIconOffline, {
116
129
  icon: unref(data$5),
117
130
  class: "stop-icon"
118
131
  }, null, 8, ["icon"]),
119
132
  createTextVNode(" 很抱歉,此对话已达到其限制。让我们开始新的聊天。 ")
120
133
  ]),
121
- _hoisted_11
134
+ _hoisted_13
122
135
  ], 512), [
123
136
  [vShow, unref(stopDialogue)]
124
137
  ])
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_47d13b19_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_507ab62a_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_47d13b19_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_507ab62a_lang as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./readMd.vue2.mjs";
2
2
  import "./readMd.vue3.mjs";
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const readMd = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a3df75f1"]]);
4
+ const readMd = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5f669a5d"]]);
5
5
  export {
6
6
  readMd as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, resolveDirective, openBlock, createElementBlock, withDirectives, createElementVNode } from "vue";
1
+ import { defineComponent, ref, computed, onMounted, resolveDirective, openBlock, createElementBlock, withDirectives, createElementVNode, unref } from "vue";
2
2
  import purify from "../../node_modules/.pnpm/dompurify@3.0.10/node_modules/dompurify/dist/purify.es.mjs";
3
3
  import { marked } from "../../node_modules/.pnpm/marked@12.0.1/node_modules/marked/lib/marked.esm.mjs";
4
4
  import isInCode from "./mdInCode.mjs";
@@ -14,13 +14,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
14
14
  default: ""
15
15
  },
16
16
  // 是否需要显示光标?比如在消息流结束后是不需要显示光标的
17
- showCursor: {
18
- type: Boolean,
19
- default: false
20
- },
21
17
  speed: {
22
18
  type: Number,
23
- default: 100
19
+ default: 50
24
20
  },
25
21
  isPrinting: {
26
22
  type: Boolean,
@@ -36,44 +32,48 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
32
  setup(__props, { emit: emits }) {
37
33
  const props = __props;
38
34
  const CopilotStore = useCopilotStoreHook();
39
- const { sendLonding } = storeToRefs(CopilotStore);
35
+ const { sendLonding, requestSseing } = storeToRefs(CopilotStore);
40
36
  const { setSendLonding } = CopilotStore;
41
37
  const vHtml = ref("");
42
- const isShowCursor = ref(false);
43
38
  let printInterval = null;
44
- const printMessage = (message) => {
39
+ const cursor = '<span class="cursor"></span>';
40
+ const printMessage = () => {
45
41
  let index = 0;
46
42
  printInterval = setInterval(() => {
47
- vHtml.value += message[index];
48
- isShowCursor.value = props.showCursor && !isInCode(vHtml.value);
49
- index++;
50
- props.scrollToBottom();
51
- if (index === message.length || sendLonding.value === false) {
43
+ if (index === getHtml.value.length && requestSseing.value === false || sendLonding.value === false) {
52
44
  clearInterval(printInterval);
53
45
  printInterval = null;
54
46
  emits("update:isPrinting", false);
55
47
  emits("printOk");
56
48
  setSendLonding(false);
57
49
  }
50
+ if (index === getHtml.value.length) {
51
+ return;
52
+ }
53
+ vHtml.value += getHtml.value[index++];
54
+ props.scrollToBottom();
58
55
  }, props.speed);
59
56
  };
60
- const getHtml = () => {
57
+ const getHtml = computed(() => {
61
58
  return purify.sanitize(marked.parse(props.text));
62
- };
59
+ });
63
60
  if (props.isPrinting) {
64
- printMessage(getHtml());
61
+ printMessage();
65
62
  } else {
66
- vHtml.value = getHtml();
63
+ vHtml.value = getHtml.value;
67
64
  emits("printOk");
68
65
  }
69
66
  onMounted(() => {
70
67
  props.scrollToBottom(true);
71
68
  });
69
+ const resultHtml = computed(() => {
70
+ return vHtml.value + (props.isPrinting && !isInCode(vHtml.value) ? cursor : "");
71
+ });
72
72
  return (_ctx, _cache) => {
73
73
  const _directive_highlight = resolveDirective("highlight");
74
74
  return openBlock(), createElementBlock("div", null, [
75
75
  withDirectives(createElementVNode("div", {
76
- innerHTML: vHtml.value,
76
+ innerHTML: unref(resultHtml),
77
77
  class: "markdown"
78
78
  }, null, 8, _hoisted_1), [
79
79
  [_directive_highlight]
@@ -1,4 +1,4 @@
1
- const readMd_vue_vue_type_style_index_0_scoped_a3df75f1_lang = "";
1
+ const readMd_vue_vue_type_style_index_0_scoped_5f669a5d_lang = "";
2
2
  export {
3
- readMd_vue_vue_type_style_index_0_scoped_a3df75f1_lang as default
3
+ readMd_vue_vue_type_style_index_0_scoped_5f669a5d_lang as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./index.vue2.mjs";
2
2
  import "./index.vue3.mjs";
3
3
  import _export_sfc from "../_virtual/_plugin-vue_export-helper.mjs";
4
- const KgCopilot = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-256bc514"]]);
4
+ const KgCopilot = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d9ea3e4c"]]);
5
5
  export {
6
6
  KgCopilot as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, toRefs, onMounted, openBlock, createElementBlock, createElementVNode, createVNode, toRaw } from "vue";
1
+ import { defineComponent, toRefs, onMounted, useSlots, openBlock, createElementBlock, createElementVNode, createVNode, createSlots, renderList, unref, withCtx, renderSlot, toRaw } from "vue";
2
2
  import dialogue from "./dialogue/index.vue.mjs";
3
3
  import "../style/tailwind.css.mjs";
4
4
  import "../style/index.scss.mjs";
@@ -20,16 +20,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  sendUrl: null,
21
21
  getkitsUrl: null,
22
22
  token: null,
23
- plugins: null
23
+ plugins: null,
24
+ initText: { default: "你好,我是AI智能助手" },
25
+ aiName: { default: "Copilot" }
24
26
  },
25
27
  setup(__props, { expose }) {
26
28
  const props = __props;
27
29
  const CopilotStore = useCopilotStoreHook();
28
30
  const { searchText, msgList } = storeToRefs(CopilotStore);
29
31
  const { initCopilot, setSearchText, setMsgList } = CopilotStore;
30
- const { sendUrl, getkitsUrl, token, plugins } = toRefs(props);
32
+ const { sendUrl, getkitsUrl, token, plugins, initText, aiName } = toRefs(props);
31
33
  onMounted(() => {
32
- initCopilot(sendUrl.value, getkitsUrl.value, token.value, plugins.value);
34
+ initCopilot(
35
+ sendUrl.value,
36
+ getkitsUrl.value,
37
+ token.value,
38
+ plugins.value,
39
+ initText.value,
40
+ aiName.value
41
+ );
33
42
  });
34
43
  const getSearchText = () => {
35
44
  return searchText.value;
@@ -43,10 +52,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
52
  getMsgList,
44
53
  setMsgList
45
54
  });
55
+ const slots = useSlots();
46
56
  return (_ctx, _cache) => {
47
57
  return openBlock(), createElementBlock("div", _hoisted_1, [
48
58
  createElementVNode("div", _hoisted_2, [
49
- createVNode(dialogue),
59
+ createVNode(dialogue, null, createSlots({ _: 2 }, [
60
+ renderList(unref(slots), (item, key) => {
61
+ return {
62
+ name: key,
63
+ fn: withCtx(() => [
64
+ renderSlot(_ctx.$slots, key, {}, void 0, true)
65
+ ])
66
+ };
67
+ })
68
+ ]), 1024),
50
69
  createElementVNode("div", _hoisted_3, [
51
70
  createVNode(CopiFooter)
52
71
  ])
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_256bc514_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_d9ea3e4c_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_256bc514_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_d9ea3e4c_lang as default
4
4
  };
@@ -1,16 +1,37 @@
1
1
  import { http } from "../utils/http/index.mjs";
2
2
  import { baseUrlApi } from "./project.mjs";
3
+ import { fetchEventSource } from "../node_modules/.pnpm/@microsoft_fetch-event-source@2.0.1/node_modules/@microsoft/fetch-event-source/lib/esm/fetch.mjs";
3
4
  const sendMsgApi = (sendUrl, data) => {
4
5
  return http.request("post", baseUrlApi(sendUrl), {
5
6
  data,
6
7
  timeout: 6e4
7
8
  });
8
9
  };
9
- const getReport = (sendUrl, data) => {
10
- return http.request("post", baseUrlApi(sendUrl), {
11
- data,
12
- timeout: 6e4
10
+ const getReport = (param) => {
11
+ const controller = new AbortController();
12
+ fetchEventSource(baseUrlApi(param.sendUrl), {
13
+ method: "POST",
14
+ body: JSON.stringify(param.data),
15
+ signal: controller.signal,
16
+ openWhenHidden: true,
17
+ headers: {
18
+ accessToken: window["kg_token"],
19
+ "Content-Type": "application/json"
20
+ },
21
+ onmessage(msg) {
22
+ param.onmessage(JSON.parse(msg.data));
23
+ },
24
+ onclose() {
25
+ controller.abort();
26
+ },
27
+ onerror(err) {
28
+ param.onerror(err);
29
+ throw err;
30
+ }
13
31
  });
32
+ return () => {
33
+ controller.abort();
34
+ };
14
35
  };
15
36
  export {
16
37
  getReport,
@@ -51,7 +51,7 @@ HighlightJS.registerLanguage("basic", basic);
51
51
  HighlightJS.registerLanguage("xml", xml);
52
52
  HighlightJS.registerLanguage("apache", apache);
53
53
  const highlightByEl = (e) => {
54
- const blocks = e.querySelectorAll("code");
54
+ const blocks = e.querySelectorAll("pre code");
55
55
  blocks.forEach((block) => {
56
56
  HighlightJS.highlightBlock(block);
57
57
  });
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FilterArea.vue2.mjs";
2
2
  import "./FilterArea.vue3.mjs";
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FilterArea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4e04c24d"]]);
4
+ const FilterArea = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-996410e5"]]);
5
5
  export {
6
6
  FilterArea as default
7
7
  };
@@ -9,7 +9,7 @@ import data$2 from "../../node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_module
9
9
  import { checkFilterShow_xinyuan, checkFilterShow, checkFilterShow_letter } from "../../utils/home.mjs";
10
10
  import FilterItem from "./FilterItem.vue.mjs";
11
11
  import FilterItemIcon from "./FilterItemIcon.vue.mjs";
12
- const _withScopeId = (n) => (pushScopeId("data-v-4e04c24d"), n = n(), popScopeId(), n);
12
+ const _withScopeId = (n) => (pushScopeId("data-v-996410e5"), n = n(), popScopeId(), n);
13
13
  const _hoisted_1 = { id: "filterWrap" };
14
14
  const _hoisted_2 = { key: 0 };
15
15
  const _hoisted_3 = { class: "flex flex-1 align-middle justify-items-start flex-wrap" };
@@ -1,4 +1,4 @@
1
- const FilterArea_vue_vue_type_style_index_0_scoped_4e04c24d_lang = "";
1
+ const FilterArea_vue_vue_type_style_index_0_scoped_996410e5_lang = "";
2
2
  export {
3
- FilterArea_vue_vue_type_style_index_0_scoped_4e04c24d_lang as default
3
+ FilterArea_vue_vue_type_style_index_0_scoped_996410e5_lang as default
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import _sfc_main from "./FilterItem.vue2.mjs";
2
2
  import "./FilterItem.vue3.mjs";
3
3
  import _export_sfc from "../../_virtual/_plugin-vue_export-helper.mjs";
4
- const FilterItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-be1d5ffc"]]);
4
+ const FilterItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-10722fd5"]]);
5
5
  export {
6
6
  FilterItem as default
7
7
  };