@kg-ui/kg-ui-plus 0.0.16 → 0.0.18

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 (39) hide show
  1. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue.mjs +1 -1
  2. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue2.mjs +83 -47
  3. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue3.mjs +2 -2
  4. package/dist/es/KgCopilot/CopiFooter/SearchInput/index.vue.mjs +1 -1
  5. package/dist/es/KgCopilot/CopiFooter/SearchInput/index.vue2.mjs +217 -76
  6. package/dist/es/KgCopilot/CopiFooter/SearchInput/index.vue3.mjs +2 -2
  7. package/dist/es/KgCopilot/CopiFooter/index.vue.mjs +1 -1
  8. package/dist/es/KgCopilot/CopiFooter/index.vue3.mjs +2 -2
  9. package/dist/es/KgCopilot/dialogue/index.vue.mjs +1 -1
  10. package/dist/es/KgCopilot/dialogue/index.vue2.mjs +78 -63
  11. package/dist/es/KgCopilot/dialogue/index.vue3.mjs +2 -2
  12. package/dist/es/KgCopilot/dialogue/messageParse/edit.vue.mjs +7 -0
  13. package/dist/es/KgCopilot/dialogue/messageParse/edit.vue2.mjs +153 -0
  14. package/dist/es/KgCopilot/dialogue/messageParse/edit.vue3.mjs +4 -0
  15. package/dist/es/KgCopilot/dialogue/messageParse/index.vue.mjs +7 -0
  16. package/dist/es/KgCopilot/dialogue/messageParse/index.vue2.mjs +105 -0
  17. package/dist/es/KgCopilot/dialogue/messageParse/index.vue3.mjs +4 -0
  18. package/dist/es/KgCopilot/dialogue/messageParse/readMd.vue.mjs +7 -0
  19. package/dist/es/KgCopilot/dialogue/{readMd.vue2.mjs → messageParse/readMd.vue2.mjs} +14 -9
  20. package/dist/es/KgCopilot/dialogue/messageParse/readMd.vue3.mjs +4 -0
  21. package/dist/es/KgCopilot/index.vue.mjs +1 -1
  22. package/dist/es/KgCopilot/index.vue2.mjs +1 -1
  23. package/dist/es/KgCopilot/index.vue3.mjs +2 -2
  24. package/dist/es/api/copilot.mjs +13 -0
  25. package/dist/es/directives/heighlight/index.mjs +4 -0
  26. package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/caret-down-fill.mjs +8 -0
  27. package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/note-pencil-bold.mjs +8 -0
  28. package/dist/es/node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.2.45/node_modules/@vueuse/core/index.mjs +111 -0
  29. package/dist/es/node_modules/.pnpm/@vueuse_shared@9.13.0_vue@3.2.45/node_modules/@vueuse/shared/index.mjs +15 -0
  30. package/dist/es/store/modules/copilot.mjs +144 -61
  31. package/dist/es/style.css +1 -1
  32. package/dist/es/utils/home.mjs +9 -10
  33. package/package.json +2 -1
  34. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue.mjs +0 -7
  35. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue2.mjs +0 -113
  36. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue3.mjs +0 -4
  37. package/dist/es/KgCopilot/dialogue/readMd.vue.mjs +0 -7
  38. package/dist/es/KgCopilot/dialogue/readMd.vue3.mjs +0 -4
  39. /package/dist/es/KgCopilot/dialogue/{mdInCode.mjs → messageParse/mdInCode.mjs} +0 -0
@@ -1,49 +1,51 @@
1
- import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createElementVNode, createBlock, withCtx, renderSlot, normalizeClass, createTextVNode, toDisplayString, createCommentVNode, createVNode, withDirectives, vShow, pushScopeId, popScopeId } from "vue";
2
- import readMd from "./readMd.vue.mjs";
1
+ import { defineComponent, ref, resolveComponent, openBlock, createElementBlock, Fragment, renderList, unref, createElementVNode, createBlock, withCtx, renderSlot, normalizeClass, createTextVNode, toDisplayString, createVNode, createCommentVNode, withDirectives, vShow, nextTick, pushScopeId, popScopeId } from "vue";
2
+ import MessageParse from "./messageParse/index.vue.mjs";
3
3
  import UserHead from "../CopiContent/UserHead.vue.mjs";
4
4
  import AnswerHead from "../CopiContent/AnswerHead.vue.mjs";
5
- import data$2 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/copy-simple.mjs";
6
- import data$4 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/speaker-high-light.mjs";
7
- import data from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-up-thin.mjs";
8
- import data$1 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-down-thin.mjs";
9
- import data$3 from "../../node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/download-line.mjs";
10
- import data$5 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/warning-bold.mjs";
5
+ import data$3 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/copy-simple.mjs";
6
+ import data$5 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/speaker-high-light.mjs";
7
+ import data$1 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-up-thin.mjs";
8
+ import data$2 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/thumbs-down-thin.mjs";
9
+ import data$4 from "../../node_modules/.pnpm/@iconify-icons_ri@1.2.3/node_modules/@iconify-icons/ri/download-line.mjs";
10
+ import data$6 from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/warning-bold.mjs";
11
+ import data from "../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/caret-down-fill.mjs";
11
12
  import { useCopilotStoreHook } from "../../store/modules/copilot.mjs";
12
13
  import { storeToRefs } from "pinia";
13
- const _withScopeId = (n) => (pushScopeId("data-v-bea9de75"), n = n(), popScopeId(), n);
14
+ const _withScopeId = (n) => (pushScopeId("data-v-318d9fe4"), n = n(), popScopeId(), n);
14
15
  const _hoisted_1 = { class: "msg-head" };
15
16
  const _hoisted_2 = {
16
17
  key: 0,
17
18
  class: "msg-plus mb-1"
18
19
  };
19
- const _hoisted_3 = {
20
- key: 1,
20
+ const _hoisted_3 = { style: { "cursor": "pointer" } };
21
+ const _hoisted_4 = {
22
+ key: 0,
21
23
  class: "icon-operates"
22
24
  };
23
- const _hoisted_4 = {
25
+ const _hoisted_5 = {
24
26
  class: "icon-item",
25
27
  title: "点赞"
26
28
  };
27
- const _hoisted_5 = {
29
+ const _hoisted_6 = {
28
30
  class: "icon-item",
29
31
  title: "不喜欢"
30
32
  };
31
- const _hoisted_6 = {
33
+ const _hoisted_7 = {
32
34
  class: "icon-item",
33
35
  title: "复制"
34
36
  };
35
- const _hoisted_7 = {
37
+ const _hoisted_8 = {
36
38
  class: "icon-item",
37
39
  title: "导出"
38
40
  };
39
- const _hoisted_8 = {
41
+ const _hoisted_9 = {
40
42
  class: "icon-item",
41
43
  title: "播放"
42
44
  };
43
- const _hoisted_9 = { class: "stop-dialogue" };
44
- const _hoisted_10 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
45
- const _hoisted_11 = { class: "title" };
46
- const _hoisted_12 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
45
+ const _hoisted_10 = { class: "stop-dialogue" };
46
+ const _hoisted_11 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
47
+ const _hoisted_12 = { class: "title" };
48
+ const _hoisted_13 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "gray-line" }, null, -1));
47
49
  const _sfc_main = /* @__PURE__ */ defineComponent({
48
50
  __name: "index",
49
51
  setup(__props) {
@@ -56,15 +58,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
56
58
  };
57
59
  const messageBox = ref();
58
60
  const scrollToBottom = (force = false) => {
59
- if (!messageBox.value)
60
- return;
61
- if (force) {
62
- messageBox.value.scrollTop = messageBox.value.scrollHeight;
63
- return;
64
- }
65
- if (messageBox.value.scrollHeight - messageBox.value.scrollTop - messageBox.value.clientHeight < 60) {
66
- messageBox.value.scrollTop = messageBox.value.scrollHeight - messageBox.value.clientHeight;
67
- }
61
+ nextTick(() => {
62
+ if (!messageBox.value)
63
+ return;
64
+ if (force) {
65
+ messageBox.value.scrollTop = messageBox.value.scrollHeight;
66
+ return;
67
+ }
68
+ if (messageBox.value.scrollHeight - messageBox.value.scrollTop - messageBox.value.clientHeight < 70) {
69
+ messageBox.value.scrollTop = messageBox.value.scrollHeight - messageBox.value.clientHeight;
70
+ }
71
+ });
68
72
  };
69
73
  return (_ctx, _cache) => {
70
74
  const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
@@ -73,10 +77,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
73
77
  ref_key: "messageBox",
74
78
  ref: messageBox
75
79
  }, [
76
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(msgList), (item) => {
80
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(msgList), (item, index) => {
77
81
  return openBlock(), createElementBlock("div", {
78
82
  class: "message-group",
79
- key: item.uuid
83
+ key: index
80
84
  }, [
81
85
  createElementVNode("div", _hoisted_1, [
82
86
  item.isSend ? (openBlock(), createBlock(UserHead, { key: 0 })) : (openBlock(), createBlock(AnswerHead, { key: 1 }, {
@@ -90,48 +94,59 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
90
94
  class: normalizeClass({ "msg-content": true, "response-content": !item.isSend })
91
95
  }, [
92
96
  !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
- createVNode(readMd, {
97
- text: item.msg.join(" <br/> "),
98
- allSteps: item.msg.length,
99
- onPrintOk: printOk,
100
- isPrinting: item.needPrinting,
101
- "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
102
- showCursor: !item.isSend,
103
- scrollToBottom
104
- }, null, 8, ["text", "allSteps", "isPrinting", "onUpdate:isPrinting", "showCursor"]),
105
- !item.isSend && !item.needPrinting && item.showOpt ? (openBlock(), createElementBlock("div", _hoisted_3, [
106
- createElementVNode("div", _hoisted_4, [
107
- createVNode(_component_IconifyIconOffline, { icon: unref(data) }, null, 8, ["icon"])
97
+ createElementVNode("div", null, [
98
+ createTextVNode(" 使用: "),
99
+ createElementVNode("span", null, toDisplayString(item.plusName.replace(/,/g, " ")), 1)
108
100
  ]),
109
- createElementVNode("div", _hoisted_5, [
110
- createVNode(_component_IconifyIconOffline, { icon: unref(data$1) }, null, 8, ["icon"])
111
- ]),
112
- createElementVNode("div", _hoisted_6, [
113
- createVNode(_component_IconifyIconOffline, { icon: unref(data$2) }, null, 8, ["icon"])
114
- ]),
115
- createElementVNode("div", _hoisted_7, [
116
- createVNode(_component_IconifyIconOffline, { icon: unref(data$3) }, null, 8, ["icon"])
117
- ]),
118
- createElementVNode("div", _hoisted_8, [
119
- createVNode(_component_IconifyIconOffline, { icon: unref(data$4) }, null, 8, ["icon"])
101
+ createElementVNode("div", _hoisted_3, [
102
+ createVNode(_component_IconifyIconOffline, {
103
+ icon: unref(data),
104
+ onClick: ($event) => item.isShrink = !item.isShrink,
105
+ class: normalizeClass({ "arrow-icon": true, "rotate-up": item.isShrink })
106
+ }, null, 8, ["icon", "onClick", "class"])
120
107
  ])
121
- ])) : createCommentVNode("", true)
108
+ ])) : createCommentVNode("", true),
109
+ createElementVNode("div", {
110
+ class: normalizeClass({ "plugs-answer": true, "is-shrink": item.isShrink })
111
+ }, [
112
+ createVNode(MessageParse, {
113
+ msgs: item.msgs,
114
+ onPrintOk: printOk,
115
+ isPrinting: item.needPrinting,
116
+ "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
117
+ scrollToBottom
118
+ }, null, 8, ["msgs", "isPrinting", "onUpdate:isPrinting"]),
119
+ !item.isSend && !item.needPrinting && item.showOpt ? (openBlock(), createElementBlock("div", _hoisted_4, [
120
+ createElementVNode("div", _hoisted_5, [
121
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$1) }, null, 8, ["icon"])
122
+ ]),
123
+ createElementVNode("div", _hoisted_6, [
124
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$2) }, null, 8, ["icon"])
125
+ ]),
126
+ createElementVNode("div", _hoisted_7, [
127
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$3) }, null, 8, ["icon"])
128
+ ]),
129
+ createElementVNode("div", _hoisted_8, [
130
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$4) }, null, 8, ["icon"])
131
+ ]),
132
+ createElementVNode("div", _hoisted_9, [
133
+ createVNode(_component_IconifyIconOffline, { icon: unref(data$5) }, null, 8, ["icon"])
134
+ ])
135
+ ])) : createCommentVNode("", true)
136
+ ], 2)
122
137
  ], 2)
123
138
  ]);
124
139
  }), 128)),
125
- withDirectives(createElementVNode("div", _hoisted_9, [
126
- _hoisted_10,
127
- createElementVNode("div", _hoisted_11, [
140
+ withDirectives(createElementVNode("div", _hoisted_10, [
141
+ _hoisted_11,
142
+ createElementVNode("div", _hoisted_12, [
128
143
  createVNode(_component_IconifyIconOffline, {
129
- icon: unref(data$5),
144
+ icon: unref(data$6),
130
145
  class: "stop-icon"
131
146
  }, null, 8, ["icon"]),
132
147
  createTextVNode(" 很抱歉,此对话已达到其限制。让我们开始新的聊天。 ")
133
148
  ]),
134
- _hoisted_12
149
+ _hoisted_13
135
150
  ], 512), [
136
151
  [vShow, unref(stopDialogue)]
137
152
  ])
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_bea9de75_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_318d9fe4_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_bea9de75_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_318d9fe4_lang as default
4
4
  };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./edit.vue2.mjs";
2
+ import "./edit.vue3.mjs";
3
+ import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const Edit = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cbf4d716"]]);
5
+ export {
6
+ Edit as default
7
+ };
@@ -0,0 +1,153 @@
1
+ import { defineComponent, ref, watch, reactive, toRaw, resolveComponent, openBlock, createElementBlock, withDirectives, createElementVNode, createVNode, normalizeClass, unref, createCommentVNode, toDisplayString, vShow, withKeys, vModelText, createTextVNode } from "vue";
2
+ import data from "../../../node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/note-pencil-bold.mjs";
3
+ import ReadMd from "./readMd.vue.mjs";
4
+ import { useVModel } from "../../../node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.2.45/node_modules/@vueuse/core/index.mjs";
5
+ import { useCopilotStoreHook } from "../../../store/modules/copilot.mjs";
6
+ import { storeToRefs } from "pinia";
7
+ const _hoisted_1 = { class: "read-flex" };
8
+ const _hoisted_2 = {
9
+ key: 0,
10
+ class: "read-flex"
11
+ };
12
+ const _hoisted_3 = { class: "input-box" };
13
+ const _hoisted_4 = ["onKeydown"];
14
+ const _sfc_main = /* @__PURE__ */ defineComponent({
15
+ __name: "edit",
16
+ props: {
17
+ // 输入的 markdown 文本
18
+ content: {
19
+ type: Object,
20
+ default: () => {
21
+ }
22
+ },
23
+ isPrinting: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ scrollToBottom: {
28
+ type: Function,
29
+ default: () => {
30
+ }
31
+ }
32
+ },
33
+ emits: ["update:isPrinting", "printOk", "update:content"],
34
+ setup(__props, { emit: emits }) {
35
+ const props = __props;
36
+ const isPrinting = ref(true);
37
+ const CopilotStore = useCopilotStoreHook();
38
+ const { onlyCancelRequest, sendPluginMsg } = CopilotStore;
39
+ const { currentPluginParams, sendLonding } = storeToRefs(CopilotStore);
40
+ const showButton = ref(false);
41
+ const countDown = ref(5);
42
+ let interval = null;
43
+ const isEditing = ref(false);
44
+ watch(
45
+ () => sendLonding.value,
46
+ (newValue) => {
47
+ if (!newValue) {
48
+ emits("update:isPrinting", false);
49
+ }
50
+ }
51
+ );
52
+ const updateObj = reactive({
53
+ userLogic: {
54
+ title: "提取的关键词信息:",
55
+ type: "text",
56
+ value: ""
57
+ }
58
+ });
59
+ const props_content = useVModel(props, "content", emits);
60
+ const oldUserLogic = toRaw(props.content.updateInfo.userLogic);
61
+ updateObj.userLogic.value = oldUserLogic;
62
+ const confirm = () => {
63
+ clearInterval(interval);
64
+ showButton.value = false;
65
+ isEditing.value = false;
66
+ if (updateObj.userLogic.value != oldUserLogic) {
67
+ props_content.value.message = updateObj.userLogic.title + updateObj.userLogic.value;
68
+ onlyCancelRequest();
69
+ finalComm(true);
70
+ currentPluginParams.value.userLogic = updateObj.userLogic.value;
71
+ sendPluginMsg();
72
+ return;
73
+ }
74
+ finalComm(false);
75
+ };
76
+ const finalComm = (isEdit = false) => {
77
+ emits("update:isPrinting", false);
78
+ emits("printOk", isEdit);
79
+ };
80
+ const printOk = () => {
81
+ showButton.value = true;
82
+ props.scrollToBottom();
83
+ interval = setInterval(() => {
84
+ countDown.value--;
85
+ if (countDown.value <= 0) {
86
+ clearInterval(interval);
87
+ showButton.value = false;
88
+ finalComm(false);
89
+ }
90
+ }, 1e3);
91
+ };
92
+ const toEdit = () => {
93
+ interval = clearInterval(interval);
94
+ if (sendLonding.value)
95
+ isEditing.value = true;
96
+ };
97
+ return (_ctx, _cache) => {
98
+ const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
99
+ return openBlock(), createElementBlock("div", null, [
100
+ withDirectives(createElementVNode("div", _hoisted_1, [
101
+ createVNode(ReadMd, {
102
+ text: props.content.message,
103
+ isPrinting: isPrinting.value,
104
+ "onUpdate:isPrinting": _cache[0] || (_cache[0] = ($event) => isPrinting.value = $event),
105
+ onPrintOk: printOk
106
+ }, null, 8, ["text", "isPrinting"]),
107
+ showButton.value && props.isPrinting ? (openBlock(), createElementBlock("div", {
108
+ key: 0,
109
+ class: normalizeClass({
110
+ "icon-item": true,
111
+ "cursor-default": !unref(sendLonding)
112
+ }),
113
+ title: "编辑",
114
+ onClick: toEdit
115
+ }, [
116
+ createVNode(_component_IconifyIconOffline, { icon: unref(data) }, null, 8, ["icon"])
117
+ ], 2)) : createCommentVNode("", true),
118
+ withDirectives(createElementVNode("span", { class: "time" }, " (" + toDisplayString(countDown.value) + "s)", 513), [
119
+ [vShow, !isEditing.value && props.isPrinting && showButton.value]
120
+ ])
121
+ ], 512), [
122
+ [vShow, !isEditing.value]
123
+ ]),
124
+ isEditing.value && props.isPrinting ? (openBlock(), createElementBlock("div", _hoisted_2, [
125
+ createElementVNode("span", null, toDisplayString(updateObj.userLogic.title), 1),
126
+ createElementVNode("div", _hoisted_3, [
127
+ withDirectives(createElementVNode("input", {
128
+ type: "text",
129
+ class: "keyword-input",
130
+ autofocus: "",
131
+ onKeydown: withKeys(confirm, ["enter"]),
132
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => updateObj.userLogic.value = $event)
133
+ }, null, 40, _hoisted_4), [
134
+ [vModelText, updateObj.userLogic.value]
135
+ ]),
136
+ showButton.value && props.isPrinting ? (openBlock(), createElementBlock("button", {
137
+ key: 0,
138
+ onClick: confirm
139
+ }, [
140
+ createTextVNode(" 确认"),
141
+ withDirectives(createElementVNode("span", null, " (" + toDisplayString(countDown.value) + "s)", 513), [
142
+ [vShow, !isEditing.value]
143
+ ])
144
+ ])) : createCommentVNode("", true)
145
+ ])
146
+ ])) : createCommentVNode("", true)
147
+ ]);
148
+ };
149
+ }
150
+ });
151
+ export {
152
+ _sfc_main as default
153
+ };
@@ -0,0 +1,4 @@
1
+ const edit_vue_vue_type_style_index_0_scoped_cbf4d716_lang = "";
2
+ export {
3
+ edit_vue_vue_type_style_index_0_scoped_cbf4d716_lang as default
4
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./index.vue2.mjs";
2
+ import "./index.vue3.mjs";
3
+ import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const MessageParse = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8cf9b160"]]);
5
+ export {
6
+ MessageParse as default
7
+ };
@@ -0,0 +1,105 @@
1
+ import { defineComponent, watch, ref, openBlock, createElementBlock, Fragment, renderList, unref, createBlock, createCommentVNode } from "vue";
2
+ import { useCopilotStoreHook, DataType } from "../../../store/modules/copilot.mjs";
3
+ import ReadMd from "./readMd.vue.mjs";
4
+ import Edit from "./edit.vue.mjs";
5
+ import { storeToRefs } from "pinia";
6
+ import { useVModel } from "../../../node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.2.45/node_modules/@vueuse/core/index.mjs";
7
+ const _hoisted_1 = {
8
+ key: 2,
9
+ class: "cursor"
10
+ };
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "index",
13
+ props: {
14
+ // 输入的 markdown 文本
15
+ msgs: {
16
+ type: Array,
17
+ default: () => []
18
+ },
19
+ isPrinting: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ scrollToBottom: {
24
+ type: Function,
25
+ default: () => {
26
+ }
27
+ }
28
+ },
29
+ emits: ["update:isPrinting", "printOk", "update:msgs"],
30
+ setup(__props, { emit: emits }) {
31
+ const props = __props;
32
+ const CopilotStore = useCopilotStoreHook();
33
+ const { setSendLonding } = CopilotStore;
34
+ const { sendLonding, requestSseing } = storeToRefs(CopilotStore);
35
+ watch(
36
+ () => sendLonding.value,
37
+ (newValue) => {
38
+ if (!newValue) {
39
+ emits("update:isPrinting", false);
40
+ }
41
+ }
42
+ );
43
+ const current = ref(1);
44
+ watch(
45
+ () => props.msgs.length,
46
+ () => {
47
+ if (current.value === props.msgs.length - 1 && !props.msgs[current.value - 1].needPrinting) {
48
+ current.value++;
49
+ }
50
+ }
51
+ );
52
+ const msgsVmodel = useVModel(props, "msgs", emits);
53
+ const printOk = (isEdit) => {
54
+ if (!sendLonding.value) {
55
+ emits("update:isPrinting", false);
56
+ emits("printOk");
57
+ return;
58
+ }
59
+ if (isEdit) {
60
+ msgsVmodel.value.splice(0);
61
+ current.value = 1;
62
+ return;
63
+ }
64
+ if (current.value < props.msgs.length) {
65
+ current.value++;
66
+ return;
67
+ }
68
+ if (current.value >= props.msgs.length && !requestSseing.value) {
69
+ if (props.isPrinting) {
70
+ setSendLonding(false);
71
+ }
72
+ emits("update:isPrinting", false);
73
+ emits("printOk");
74
+ }
75
+ };
76
+ return (_ctx, _cache) => {
77
+ return openBlock(true), createElementBlock(Fragment, null, renderList(props.msgs, (item, index) => {
78
+ return openBlock(), createElementBlock(Fragment, {
79
+ key: item.uuid
80
+ }, [
81
+ index < current.value && item.type === unref(DataType)[unref(DataType).text] ? (openBlock(), createBlock(ReadMd, {
82
+ key: 0,
83
+ text: item.content,
84
+ scrollToBottom: props.scrollToBottom,
85
+ isPrinting: item.needPrinting,
86
+ "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
87
+ onPrintOk: printOk
88
+ }, null, 8, ["text", "scrollToBottom", "isPrinting", "onUpdate:isPrinting"])) : createCommentVNode("", true),
89
+ index < current.value && item.type === unref(DataType)[unref(DataType).edit] ? (openBlock(), createBlock(Edit, {
90
+ key: 1,
91
+ content: item.content,
92
+ scrollToBottom: props.scrollToBottom,
93
+ isPrinting: item.needPrinting,
94
+ "onUpdate:isPrinting": ($event) => item.needPrinting = $event,
95
+ onPrintOk: printOk
96
+ }, null, 8, ["content", "scrollToBottom", "isPrinting", "onUpdate:isPrinting"])) : createCommentVNode("", true),
97
+ props.isPrinting && index === current.value - 1 && !item.needPrinting ? (openBlock(), createElementBlock("span", _hoisted_1)) : createCommentVNode("", true)
98
+ ], 64);
99
+ }), 128);
100
+ };
101
+ }
102
+ });
103
+ export {
104
+ _sfc_main as default
105
+ };
@@ -0,0 +1,4 @@
1
+ const index_vue_vue_type_style_index_0_scoped_8cf9b160_lang = "";
2
+ export {
3
+ index_vue_vue_type_style_index_0_scoped_8cf9b160_lang as default
4
+ };
@@ -0,0 +1,7 @@
1
+ import _sfc_main from "./readMd.vue2.mjs";
2
+ import "./readMd.vue3.mjs";
3
+ import _export_sfc from "../../../_virtual/_plugin-vue_export-helper.mjs";
4
+ const ReadMd = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6f0b4aca"]]);
5
+ export {
6
+ ReadMd as default
7
+ };
@@ -1,8 +1,8 @@
1
- import { defineComponent, ref, computed, onMounted, resolveDirective, openBlock, createElementBlock, withDirectives, createElementVNode, unref } from "vue";
2
- import purify from "../../node_modules/.pnpm/dompurify@3.0.10/node_modules/dompurify/dist/purify.es.mjs";
3
- import { marked } from "../../node_modules/.pnpm/marked@12.0.1/node_modules/marked/lib/marked.esm.mjs";
1
+ import { defineComponent, ref, computed, watch, onMounted, resolveDirective, openBlock, createElementBlock, withDirectives, createElementVNode, unref } from "vue";
2
+ import purify from "../../../node_modules/.pnpm/dompurify@3.0.10/node_modules/dompurify/dist/purify.es.mjs";
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";
5
- import { useCopilotStoreHook } from "../../store/modules/copilot.mjs";
5
+ import { useCopilotStoreHook } from "../../../store/modules/copilot.mjs";
6
6
  import { storeToRefs } from "pinia";
7
7
  const _hoisted_1 = ["innerHTML"];
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -27,8 +27,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
27
  setup(__props, { emit: emits }) {
28
28
  const props = __props;
29
29
  const CopilotStore = useCopilotStoreHook();
30
- const { sendLonding, requestSseing } = storeToRefs(CopilotStore);
31
- const { setSendLonding } = CopilotStore;
30
+ const { sendLonding } = storeToRefs(CopilotStore);
32
31
  const vHtml = ref("");
33
32
  let printTimeout = null;
34
33
  const cursor = '<span class="cursor"></span>';
@@ -42,12 +41,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
42
41
  let speed = slowly;
43
42
  const printCore = () => {
44
43
  printTimeout = setTimeout(() => {
45
- if (index === getHtml.value.length && requestSseing.value === false || sendLonding.value === false) {
44
+ if (index === getHtml.value.length || sendLonding.value === false) {
46
45
  clearTimeout(printTimeout);
47
46
  printTimeout = null;
48
47
  emits("update:isPrinting", false);
49
- emits("printOk");
50
- setSendLonding(false);
48
+ emits("printOk", !sendLonding.value);
51
49
  return;
52
50
  }
53
51
  if (index === getHtml.value.length) {
@@ -79,6 +77,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
77
  vHtml.value = getHtml.value;
80
78
  emits("printOk");
81
79
  }
80
+ watch(
81
+ () => getHtml.value,
82
+ () => {
83
+ if (!props.isPrinting)
84
+ vHtml.value = getHtml.value;
85
+ }
86
+ );
82
87
  onMounted(() => {
83
88
  props.scrollToBottom(true);
84
89
  });
@@ -0,0 +1,4 @@
1
+ const readMd_vue_vue_type_style_index_0_scoped_6f0b4aca_lang = "";
2
+ export {
3
+ readMd_vue_vue_type_style_index_0_scoped_6f0b4aca_lang as default
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-0b8e1b50"]]);
4
+ const KgCopilot = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5140ed8f"]]);
5
5
  export {
6
6
  KgCopilot as default
7
7
  };
@@ -21,7 +21,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21
21
  getkitsUrl: null,
22
22
  token: null,
23
23
  plugins: null,
24
- initText: { default: "你好,我是AI智能助手" },
24
+ initText: { default: "你好,我是AI智能助手,如有任何需要,请随时告诉我,我会尽力为您提供帮助。" },
25
25
  aiName: { default: "Copilot" }
26
26
  },
27
27
  setup(__props, { expose }) {
@@ -1,4 +1,4 @@
1
- const index_vue_vue_type_style_index_0_scoped_0b8e1b50_lang = "";
1
+ const index_vue_vue_type_style_index_0_scoped_5140ed8f_lang = "";
2
2
  export {
3
- index_vue_vue_type_style_index_0_scoped_0b8e1b50_lang as default
3
+ index_vue_vue_type_style_index_0_scoped_5140ed8f_lang as default
4
4
  };
@@ -7,6 +7,18 @@ const sendMsgApi = (sendUrl, data) => {
7
7
  timeout: 6e4
8
8
  });
9
9
  };
10
+ const analysisMessage = (message) => {
11
+ return http.request(
12
+ "post",
13
+ baseUrlApi("chat/analysis/message"),
14
+ {
15
+ data: {
16
+ message
17
+ },
18
+ timeout: 6e4
19
+ }
20
+ );
21
+ };
10
22
  const getReport = (param) => {
11
23
  const controller = new AbortController();
12
24
  fetchEventSource(baseUrlApi(param.sendUrl), {
@@ -34,6 +46,7 @@ const getReport = (param) => {
34
46
  };
35
47
  };
36
48
  export {
49
+ analysisMessage,
37
50
  getReport,
38
51
  sendMsgApi
39
52
  };
@@ -55,6 +55,10 @@ const highlightByEl = (e) => {
55
55
  blocks.forEach((block) => {
56
56
  HighlightJS.highlightBlock(block);
57
57
  });
58
+ const a = e.querySelectorAll("a");
59
+ a.forEach((block) => {
60
+ block.target = "_blank";
61
+ });
58
62
  };
59
63
  const highlight = {
60
64
  updated(el) {
@@ -0,0 +1,8 @@
1
+ const data = {
2
+ "width": 256,
3
+ "height": 256,
4
+ "body": '<path fill="currentColor" d="m213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80A8 8 0 0 1 48 88h160a8 8 0 0 1 5.66 13.66Z"/>'
5
+ };
6
+ export {
7
+ data as default
8
+ };
@@ -0,0 +1,8 @@
1
+ const data = {
2
+ "width": 256,
3
+ "height": 256,
4
+ "body": '<path fill="currentColor" d="m232.49 55.51l-32-32a12 12 0 0 0-17 0l-96 96A12 12 0 0 0 84 128v32a12 12 0 0 0 12 12h32a12 12 0 0 0 8.49-3.51l96-96a12 12 0 0 0 0-16.98ZM192 49l15 15l-11 11l-15-15Zm-69 99h-15v-15l56-56l15 15Zm105-15.43V208a20 20 0 0 1-20 20H48a20 20 0 0 1-20-20V48a20 20 0 0 1 20-20h75.43a12 12 0 0 1 0 24H52v152h152v-71.43a12 12 0 0 1 24 0Z"/>'
5
+ };
6
+ export {
7
+ data as default
8
+ };