@kg-ui/kg-ui-plus 0.0.15 → 0.0.17

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 (38) hide show
  1. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue.mjs +1 -1
  2. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue2.mjs +79 -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 +212 -77
  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 +148 -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} +15 -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.vue3.mjs +2 -2
  23. package/dist/es/api/copilot.mjs +13 -0
  24. package/dist/es/directives/heighlight/index.mjs +4 -0
  25. package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/caret-down-fill.mjs +8 -0
  26. package/dist/es/node_modules/.pnpm/@iconify-icons_ph@1.2.5/node_modules/@iconify-icons/ph/note-pencil-bold.mjs +8 -0
  27. package/dist/es/node_modules/.pnpm/@vueuse_core@9.13.0_vue@3.2.45/node_modules/@vueuse/core/index.mjs +111 -0
  28. package/dist/es/node_modules/.pnpm/@vueuse_shared@9.13.0_vue@3.2.45/node_modules/@vueuse/shared/index.mjs +15 -0
  29. package/dist/es/store/modules/copilot.mjs +144 -61
  30. package/dist/es/style.css +1 -1
  31. package/dist/es/utils/home.mjs +9 -10
  32. package/package.json +2 -1
  33. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue.mjs +0 -7
  34. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue2.mjs +0 -113
  35. package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue3.mjs +0 -4
  36. package/dist/es/KgCopilot/dialogue/readMd.vue.mjs +0 -7
  37. package/dist/es/KgCopilot/dialogue/readMd.vue3.mjs +0 -4
  38. /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-dff5947b"), 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_dff5947b_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_dff5947b_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-1f3321ce"]]);
5
+ export {
6
+ Edit as default
7
+ };
@@ -0,0 +1,148 @@
1
+ import { defineComponent, ref, watch, reactive, toRaw, resolveComponent, openBlock, createElementBlock, withDirectives, createElementVNode, createVNode, normalizeClass, unref, createCommentVNode, vShow, toDisplayString, 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: "flex" };
8
+ const _hoisted_2 = { key: 0 };
9
+ const _hoisted_3 = ["onKeydown"];
10
+ const _hoisted_4 = {
11
+ key: 1,
12
+ class: "text-center",
13
+ style: { "padding-top": "12px" }
14
+ };
15
+ const _sfc_main = /* @__PURE__ */ defineComponent({
16
+ __name: "edit",
17
+ props: {
18
+ // 输入的 markdown 文本
19
+ content: {
20
+ type: Object,
21
+ default: () => {
22
+ }
23
+ },
24
+ isPrinting: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ scrollToBottom: {
29
+ type: Function,
30
+ default: () => {
31
+ }
32
+ }
33
+ },
34
+ emits: ["update:isPrinting", "printOk", "update:content"],
35
+ setup(__props, { emit: emits }) {
36
+ const props = __props;
37
+ const isPrinting = ref(true);
38
+ const CopilotStore = useCopilotStoreHook();
39
+ const { onlyCancelRequest, sendPluginMsg } = CopilotStore;
40
+ const { currentPluginParams, sendLonding } = storeToRefs(CopilotStore);
41
+ const showButton = ref(false);
42
+ const countDown = ref(5);
43
+ let interval = null;
44
+ const isEditing = ref(false);
45
+ watch(
46
+ () => sendLonding.value,
47
+ (newValue) => {
48
+ if (!newValue) {
49
+ emits("update:isPrinting", false);
50
+ }
51
+ }
52
+ );
53
+ const updateObj = reactive({
54
+ userLogic: {
55
+ title: "提取的关键词信息:",
56
+ type: "text",
57
+ value: ""
58
+ }
59
+ });
60
+ const props_content = useVModel(props, "content", emits);
61
+ const oldUserLogic = toRaw(props.content.updateInfo.userLogic);
62
+ updateObj.userLogic.value = oldUserLogic;
63
+ const confirm = () => {
64
+ clearInterval(interval);
65
+ showButton.value = false;
66
+ isEditing.value = false;
67
+ if (updateObj.userLogic.value != oldUserLogic) {
68
+ props_content.value.message = updateObj.userLogic.title + updateObj.userLogic.value;
69
+ onlyCancelRequest();
70
+ finalComm(true);
71
+ currentPluginParams.value.userLogic = updateObj.userLogic.value;
72
+ sendPluginMsg();
73
+ return;
74
+ }
75
+ finalComm(false);
76
+ };
77
+ const finalComm = (isEdit = false) => {
78
+ emits("update:isPrinting", false);
79
+ emits("printOk", isEdit);
80
+ };
81
+ const printOk = () => {
82
+ showButton.value = true;
83
+ props.scrollToBottom();
84
+ interval = setInterval(() => {
85
+ countDown.value--;
86
+ if (countDown.value <= 0) {
87
+ clearInterval(interval);
88
+ showButton.value = false;
89
+ finalComm(false);
90
+ }
91
+ }, 1e3);
92
+ };
93
+ const toEdit = () => {
94
+ interval = clearInterval(interval);
95
+ if (sendLonding.value)
96
+ isEditing.value = true;
97
+ };
98
+ return (_ctx, _cache) => {
99
+ const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
100
+ return openBlock(), createElementBlock("div", null, [
101
+ withDirectives(createElementVNode("div", _hoisted_1, [
102
+ createVNode(ReadMd, {
103
+ text: props.content.message,
104
+ isPrinting: isPrinting.value,
105
+ "onUpdate:isPrinting": _cache[0] || (_cache[0] = ($event) => isPrinting.value = $event),
106
+ onPrintOk: printOk
107
+ }, null, 8, ["text", "isPrinting"]),
108
+ showButton.value && props.isPrinting ? (openBlock(), createElementBlock("div", {
109
+ key: 0,
110
+ class: normalizeClass({
111
+ "icon-item": true,
112
+ "cursor-default": !unref(sendLonding)
113
+ }),
114
+ title: "编辑",
115
+ onClick: toEdit
116
+ }, [
117
+ createVNode(_component_IconifyIconOffline, { icon: unref(data) }, null, 8, ["icon"])
118
+ ], 2)) : createCommentVNode("", true)
119
+ ], 512), [
120
+ [vShow, !isEditing.value]
121
+ ]),
122
+ isEditing.value && props.isPrinting ? (openBlock(), createElementBlock("div", _hoisted_2, [
123
+ createElementVNode("span", null, toDisplayString(updateObj.userLogic.title), 1),
124
+ withDirectives(createElementVNode("input", {
125
+ type: "text",
126
+ class: "keyword-input",
127
+ autofocus: "",
128
+ onKeydown: withKeys(confirm, ["enter"]),
129
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => updateObj.userLogic.value = $event)
130
+ }, null, 40, _hoisted_3), [
131
+ [vModelText, updateObj.userLogic.value]
132
+ ])
133
+ ])) : createCommentVNode("", true),
134
+ showButton.value && props.isPrinting ? (openBlock(), createElementBlock("div", _hoisted_4, [
135
+ createElementVNode("button", { onClick: confirm }, [
136
+ createTextVNode(" 确认 "),
137
+ withDirectives(createElementVNode("span", null, "(" + toDisplayString(countDown.value) + "s)", 513), [
138
+ [vShow, !isEditing.value]
139
+ ])
140
+ ])
141
+ ])) : createCommentVNode("", true)
142
+ ]);
143
+ };
144
+ }
145
+ });
146
+ export {
147
+ _sfc_main as default
148
+ };
@@ -0,0 +1,4 @@
1
+ const edit_vue_vue_type_style_index_0_scoped_1f3321ce_lang = "";
2
+ export {
3
+ edit_vue_vue_type_style_index_0_scoped_1f3321ce_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,12 @@ 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);
49
+ return;
51
50
  }
52
51
  if (index === getHtml.value.length) {
53
52
  printCore();
@@ -78,6 +77,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
77
  vHtml.value = getHtml.value;
79
78
  emits("printOk");
80
79
  }
80
+ watch(
81
+ () => getHtml.value,
82
+ () => {
83
+ if (!props.isPrinting)
84
+ vHtml.value = getHtml.value;
85
+ }
86
+ );
81
87
  onMounted(() => {
82
88
  props.scrollToBottom(true);
83
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-6b99eed4"]]);
5
5
  export {
6
6
  KgCopilot as default
7
7
  };
@@ -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_6b99eed4_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_6b99eed4_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
+ };