@kg-ui/kg-ui-plus 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue.mjs +1 -1
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue2.mjs +1 -1
- package/dist/es/KgCopilot/CopiContent/AnswerHead.vue3.mjs +2 -2
- package/dist/es/KgCopilot/CopiContent/UserHead.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiContent/UserHead.vue2.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/{components → SearchInput}/NewTheme.vue.mjs +1 -1
- package/dist/es/KgCopilot/CopiFooter/{components → SearchInput}/NewTheme.vue2.mjs +6 -6
- package/dist/es/KgCopilot/CopiFooter/SearchInput/NewTheme.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SelectPlugin.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SelectPlugin.vue2.mjs +13 -61
- package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPlugin.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SelectPluginByKey.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SelectPluginByKey.vue2.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/SearchInput/SelectPluginByKey.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SpeechControl.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/SpeechControl.vue2.mjs +1 -1
- package/dist/es/KgCopilot/CopiFooter/SearchInput/SpeechControl.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/Upload.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/Upload.vue2.mjs +3 -3
- package/dist/es/KgCopilot/CopiFooter/SearchInput/Upload.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/{components/SearchInput → SearchInput}/index.vue.mjs +2 -2
- package/dist/es/KgCopilot/CopiFooter/SearchInput/index.vue2.mjs +258 -0
- package/dist/es/KgCopilot/CopiFooter/SearchInput/index.vue3.mjs +4 -0
- package/dist/es/KgCopilot/CopiFooter/index.vue.mjs +1 -1
- package/dist/es/KgCopilot/CopiFooter/index.vue2.mjs +3 -8
- package/dist/es/KgCopilot/CopiFooter/index.vue3.mjs +2 -2
- package/dist/es/KgCopilot/dialogue/index.vue.mjs +1 -1
- package/dist/es/KgCopilot/dialogue/index.vue2.mjs +31 -32
- package/dist/es/KgCopilot/dialogue/index.vue3.mjs +2 -2
- package/dist/es/KgCopilot/dialogue/readMd.vue.mjs +1 -1
- package/dist/es/KgCopilot/dialogue/readMd.vue2.mjs +3 -2
- package/dist/es/KgCopilot/dialogue/readMd.vue3.mjs +2 -2
- package/dist/es/KgCopilot/index.vue.mjs +1 -1
- package/dist/es/KgCopilot/index.vue3.mjs +2 -2
- package/dist/es/directives/heighlight/index.mjs +1 -1
- package/dist/es/home/LFilter/FilterArea.vue.mjs +1 -1
- package/dist/es/home/LFilter/FilterArea.vue2.mjs +1 -1
- package/dist/es/home/LFilter/FilterArea.vue3.mjs +2 -2
- package/dist/es/home/LFilter/FilterItem.vue.mjs +1 -1
- package/dist/es/home/LFilter/FilterItem.vue2.mjs +1 -1
- package/dist/es/home/LFilter/FilterItem.vue3.mjs +2 -2
- package/dist/es/home/LFilter/FilterItemIcon.vue.mjs +1 -1
- package/dist/es/home/LFilter/FilterItemIcon.vue2.mjs +1 -1
- package/dist/es/home/LFilter/FilterItemIcon.vue3.mjs +2 -2
- package/dist/es/home/LProject/index.vue.mjs +1 -1
- package/dist/es/home/LProject/index.vue3.mjs +2 -2
- package/dist/es/home/index.vue.mjs +1 -1
- package/dist/es/home/index.vue3.mjs +2 -2
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/styles/sunburst.css.mjs +4 -0
- package/dist/es/store/modules/copilot.mjs +1 -0
- package/dist/es/style.css +1 -1
- package/package.json +2 -2
- package/dist/es/KgCopilot/CopiFooter/components/NewTheme.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPlugin.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SelectPluginByKey.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/SpeechControl.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/Upload.vue3.mjs +0 -4
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue2.mjs +0 -187
- package/dist/es/KgCopilot/CopiFooter/components/SearchInput/index.vue3.mjs +0 -4
- package/dist/es/node_modules/.pnpm/highlight.js@11.9.0/node_modules/highlight.js/styles/paraiso-light.css.mjs +0 -4
@@ -1,187 +0,0 @@
|
|
1
|
-
import { defineComponent, ref, onMounted, computed, watch, resolveComponent, openBlock, createElementBlock, unref, toDisplayString, createCommentVNode, createVNode, createElementVNode, withKeys, createTextVNode, normalizeStyle, pushScopeId, popScopeId } from "vue";
|
2
|
-
import Upload from "./Upload.vue.mjs";
|
3
|
-
import data from "../../../../node_modules/.pnpm/@iconify-icons_ep@1.2.7/node_modules/@iconify-icons/ep/promotion.mjs";
|
4
|
-
import SpeechControl from "./SpeechControl.vue.mjs";
|
5
|
-
import SelectPlugin from "./SelectPlugin.vue.mjs";
|
6
|
-
import SelectPluginByKey from "./SelectPluginByKey.vue.mjs";
|
7
|
-
import { useCopilotStoreHook } from "../../../../store/modules/copilot.mjs";
|
8
|
-
import { storeToRefs } from "pinia";
|
9
|
-
const _withScopeId = (n) => (pushScopeId("data-v-2337064c"), n = n(), popScopeId(), n);
|
10
|
-
const _hoisted_1 = { class: "input-container" };
|
11
|
-
const _hoisted_2 = {
|
12
|
-
key: 0,
|
13
|
-
class: "plugin-town"
|
14
|
-
};
|
15
|
-
const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "stop-icon" }, null, -1));
|
16
|
-
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", null, "停止响应", -1));
|
17
|
-
const _hoisted_5 = [
|
18
|
-
_hoisted_3,
|
19
|
-
_hoisted_4
|
20
|
-
];
|
21
|
-
const _hoisted_6 = {
|
22
|
-
class: "input-row",
|
23
|
-
id: "copiFooter"
|
24
|
-
};
|
25
|
-
const _hoisted_7 = ["onKeydown"];
|
26
|
-
const _hoisted_8 = { class: "bottom-controls" };
|
27
|
-
const _hoisted_9 = { class: "bottom-left-controls" };
|
28
|
-
const _hoisted_10 = { class: "bottom-right-controls" };
|
29
|
-
const _hoisted_11 = { class: "text-sum" };
|
30
|
-
const _hoisted_12 = {
|
31
|
-
key: 2,
|
32
|
-
class: "disable",
|
33
|
-
"click.stop": ""
|
34
|
-
};
|
35
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
36
|
-
__name: "index",
|
37
|
-
setup(__props) {
|
38
|
-
const CopilotStore = useCopilotStoreHook();
|
39
|
-
const {
|
40
|
-
searchText,
|
41
|
-
isInitCopilot,
|
42
|
-
sendLonding,
|
43
|
-
stopDialogue,
|
44
|
-
checkedPluginByBtn
|
45
|
-
} = storeToRefs(CopilotStore);
|
46
|
-
const { setSearchText, sendMsg, setShowNewTheme, cancelRequest } = CopilotStore;
|
47
|
-
const coptInput = ref();
|
48
|
-
onMounted(() => {
|
49
|
-
coptInput.value.focus();
|
50
|
-
});
|
51
|
-
const textLength = computed(() => {
|
52
|
-
const num = searchText.value.length;
|
53
|
-
if (num === 0) {
|
54
|
-
setShowNewTheme(false);
|
55
|
-
}
|
56
|
-
return num;
|
57
|
-
});
|
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
|
-
}
|
68
|
-
if (e.target.innerText.length >= 2e3) {
|
69
|
-
e.target.innerText = e.target.innerText.substring(0, 2e3);
|
70
|
-
const range = document.createRange();
|
71
|
-
range.selectNodeContents(e.target);
|
72
|
-
range.collapse(false);
|
73
|
-
const sel = window.getSelection();
|
74
|
-
sel.removeAllRanges();
|
75
|
-
sel.addRange(range);
|
76
|
-
}
|
77
|
-
setSearchText(e.target.innerText);
|
78
|
-
};
|
79
|
-
const isShowSelect = ref(false);
|
80
|
-
const handleKeyDown = (e) => {
|
81
|
-
if (e.key === "@") {
|
82
|
-
selectPluginByKey();
|
83
|
-
}
|
84
|
-
};
|
85
|
-
const closeSelection = () => {
|
86
|
-
isShowSelect.value = false;
|
87
|
-
};
|
88
|
-
const selectPluginByKey = () => {
|
89
|
-
isShowSelect.value = true;
|
90
|
-
getCursorPosition();
|
91
|
-
};
|
92
|
-
const initInput = () => {
|
93
|
-
coptInput.value.innerText = "";
|
94
|
-
setSearchText("");
|
95
|
-
root.style.setProperty("--input-bottom-height", `110px`);
|
96
|
-
};
|
97
|
-
let cursorPos = "";
|
98
|
-
const deleteText = () => {
|
99
|
-
const textArr = coptInput.value.innerText.split("");
|
100
|
-
textArr.splice(parseInt(cursorPos) - 1, 1);
|
101
|
-
searchText.value = textArr.join("");
|
102
|
-
};
|
103
|
-
const getCursorPosition = () => {
|
104
|
-
const selection = window.getSelection();
|
105
|
-
const range = selection.getRangeAt(0);
|
106
|
-
cursorPos = range.startOffset.toString();
|
107
|
-
};
|
108
|
-
const handlerSendMsg = (event) => {
|
109
|
-
if (event.key === "Enter") {
|
110
|
-
event.preventDefault();
|
111
|
-
}
|
112
|
-
const sendText = searchText.value;
|
113
|
-
if (!sendText)
|
114
|
-
return;
|
115
|
-
if (sendLonding.value)
|
116
|
-
return;
|
117
|
-
sendMsg(sendText);
|
118
|
-
initInput();
|
119
|
-
};
|
120
|
-
const handleClickStopBtn = () => {
|
121
|
-
cancelRequest();
|
122
|
-
};
|
123
|
-
watch(isInitCopilot, (newVal) => {
|
124
|
-
if (newVal) {
|
125
|
-
initInput();
|
126
|
-
isInitCopilot.value = false;
|
127
|
-
}
|
128
|
-
});
|
129
|
-
return (_ctx, _cache) => {
|
130
|
-
const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
|
131
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
132
|
-
unref(checkedPluginByBtn).length !== 0 ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(unref(checkedPluginByBtn).map((item) => item.name).join(" ")) + " ", 1)) : createCommentVNode("", true),
|
133
|
-
createVNode(SelectPluginByKey, {
|
134
|
-
isShowSelect: isShowSelect.value,
|
135
|
-
onClose: closeSelection,
|
136
|
-
onDeleteText: deleteText
|
137
|
-
}, null, 8, ["isShowSelect"]),
|
138
|
-
createVNode(SelectPlugin),
|
139
|
-
unref(sendLonding) ? (openBlock(), createElementBlock("button", {
|
140
|
-
key: 1,
|
141
|
-
class: "stop-responding-button",
|
142
|
-
onClick: handleClickStopBtn
|
143
|
-
}, _hoisted_5)) : createCommentVNode("", true),
|
144
|
-
createElementVNode("div", _hoisted_6, [
|
145
|
-
createElementVNode("div", {
|
146
|
-
ref_key: "coptInput",
|
147
|
-
ref: coptInput,
|
148
|
-
class: "text-area",
|
149
|
-
contenteditable: "plaintext-only",
|
150
|
-
placeholder: "有问题请尽管问我。。。",
|
151
|
-
onInput: inputChange,
|
152
|
-
onKeydown: withKeys(handlerSendMsg, ["enter"]),
|
153
|
-
onKeyup: handleKeyDown
|
154
|
-
}, toDisplayString(unref(searchText)), 41, _hoisted_7),
|
155
|
-
createVNode(SpeechControl)
|
156
|
-
]),
|
157
|
-
createElementVNode("div", _hoisted_8, [
|
158
|
-
createElementVNode("div", _hoisted_9, [
|
159
|
-
createVNode(Upload, { type: "pic" })
|
160
|
-
]),
|
161
|
-
createElementVNode("div", _hoisted_10, [
|
162
|
-
createElementVNode("span", _hoisted_11, [
|
163
|
-
createElementVNode("span", null, toDisplayString(unref(textLength)), 1),
|
164
|
-
createTextVNode("/2000")
|
165
|
-
]),
|
166
|
-
createElementVNode("button", {
|
167
|
-
class: "send-button",
|
168
|
-
onClick: handlerSendMsg
|
169
|
-
}, [
|
170
|
-
createVNode(_component_IconifyIconOffline, {
|
171
|
-
class: "icon",
|
172
|
-
icon: unref(data),
|
173
|
-
style: normalizeStyle({
|
174
|
-
color: unref(textLength) && !unref(sendLonding) ? "#1e56ea" : "#dbdbdb"
|
175
|
-
})
|
176
|
-
}, null, 8, ["icon", "style"])
|
177
|
-
])
|
178
|
-
])
|
179
|
-
]),
|
180
|
-
unref(stopDialogue) ? (openBlock(), createElementBlock("div", _hoisted_12)) : createCommentVNode("", true)
|
181
|
-
]);
|
182
|
-
};
|
183
|
-
}
|
184
|
-
});
|
185
|
-
export {
|
186
|
-
_sfc_main as default
|
187
|
-
};
|