agilebuilder-ui 1.1.65-tmp4 → 1.1.65-tmp6
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/lib/chat-embed/src/index.vue2.js +24 -24
- package/lib/style.css +680 -680
- package/package.json +4 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as e, ref as t, watch as a, onMounted as n, onBeforeUnmount as o, onUnmounted as l, computed as i, nextTick as u, openBlock as s, createElementBlock as r, createElementVNode as c, normalizeStyle as v, unref as d, createVNode as m, Transition as h, withCtx as f, withDirectives as p, normalizeClass as g, Fragment as y, createBlock as w, createCommentVNode as b, toDisplayString as k, createTextVNode as S, renderList as C, vShow as
|
|
1
|
+
import { defineComponent as e, ref as t, watch as a, onMounted as n, onBeforeUnmount as o, onUnmounted as l, computed as i, nextTick as u, openBlock as s, createElementBlock as r, createElementVNode as c, normalizeStyle as v, unref as d, createVNode as m, Transition as h, withCtx as f, withDirectives as p, normalizeClass as g, Fragment as y, createBlock as w, createCommentVNode as b, toDisplayString as k, createTextVNode as S, renderList as C, vShow as A, pushScopeId as x, popScopeId as P } from "vue";
|
|
2
2
|
import { useI18n as _ } from "vue-i18n";
|
|
3
3
|
import { useXStream as E, BubbleList as j, Thinking as T, XMarkdown as N, Typewriter as D } from "vue-element-plus-x";
|
|
4
|
-
import { useDraggable as I } from "
|
|
4
|
+
import { useDraggable as I } from "@vueuse/core";
|
|
5
5
|
import { getToken as O } from "../../src/utils/auth.js";
|
|
6
6
|
import { defaultMessage as q, createUserMessage as M, createAiMessage as $, getMessageTemplate as R } from "./chat-embed-message.js";
|
|
7
7
|
import { AI_MODELS as H, MESSAGE_STATUS as z } from "./type.js";
|
|
@@ -25,9 +25,9 @@ import { downloadJsonFile as ee, generateFileName as te } from "./util/text-file
|
|
|
25
25
|
import { replaceAiTipTags as ae, parseAnswerContent as ne, extractFilenameFromUrl as oe } from "./util/chat-embed-util.js";
|
|
26
26
|
import le from "./util/mcp-utils.js";
|
|
27
27
|
import { useRoute as ie } from "vue-router";
|
|
28
|
-
const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { style: { display: "flex", "flex-direction": "row" } }, ve = { class: "chat-embed__main_content" }, de = ["href", "title"], me = ["href", "target"], he = { style: { "font-size": "10px", color: "#999", "text-align": "right" } }, fe = { key: 1, style: { "margin-top": "5px", width: "100%" } }, pe = ((e2) => (
|
|
28
|
+
const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { style: { display: "flex", "flex-direction": "row" } }, ve = { class: "chat-embed__main_content" }, de = ["href", "title"], me = ["href", "target"], he = { style: { "font-size": "10px", color: "#999", "text-align": "right" } }, fe = { key: 1, style: { "margin-top": "5px", width: "100%" } }, pe = ((e2) => (x("data-v-e25b360d"), e2 = e2(), P(), e2))(() => c("div", { class: "content-container-header" }, "引用文件", -1)), ge = ["onClick"], ye = { style: { display: "none" } }, we = e({ __name: "index", setup(e2) {
|
|
29
29
|
var _a, _b, _c;
|
|
30
|
-
const
|
|
30
|
+
const x2 = function() {
|
|
31
31
|
try {
|
|
32
32
|
const e3 = ie();
|
|
33
33
|
return e3.query.customSystem ? String(e3.query.customSystem) : null;
|
|
@@ -35,30 +35,30 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}();
|
|
38
|
-
const P2 = t(((_c = (_b = (_a = window.$vueApp) == null ? void 0 : _a.config) == null ? void 0 : _b.globalProperties) == null ? void 0 : _c.enableAiChat) || false), { startStream: we2, cancel: be, data: ke, error: Se, isLoading: Ce } = E(), { t:
|
|
38
|
+
const P2 = t(((_c = (_b = (_a = window.$vueApp) == null ? void 0 : _a.config) == null ? void 0 : _b.globalProperties) == null ? void 0 : _c.enableAiChat) || false), { startStream: we2, cancel: be, data: ke, error: Se, isLoading: Ce } = E(), { t: Ae } = _(), xe = t(), Pe = t(true), _e = t([]), Ee = t({}), je = t(false), Te = t(H.RAGFLOW), Ne = t({}), De = {}, Ie = t(true), Oe = t(null), qe = t(false), Me = t(false), $e = t(0), Re = t(""), He = t("500px"), ze = t(250), Je = t("https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"), Le = t(false), Ve = t({}), Ue = t(), Fe = t(), We = t(), Be = t(), Ge = t(), Ke = t(false);
|
|
39
39
|
let Qe = null;
|
|
40
|
-
const Xe = t(null), Ye = document.documentElement.clientWidth - 100, Ze = document.documentElement.clientHeight - 100, { x: et, y: tt, style: at } = I(
|
|
40
|
+
const Xe = t(null), Ye = document.documentElement.clientWidth - 100, Ze = document.documentElement.clientHeight - 100, { x: et, y: tt, style: at } = I(xe, { initialValue: { x: Ye, y: Ze }, preventDefault: true, onStart() {
|
|
41
41
|
Pe.value = true;
|
|
42
42
|
}, onMove(e3) {
|
|
43
43
|
Pe.value = false, function(e4) {
|
|
44
44
|
var _a2, _b2;
|
|
45
|
-
const t2 = window.innerWidth - (((_a2 =
|
|
45
|
+
const t2 = window.innerWidth - (((_a2 = xe.value) == null ? void 0 : _a2.offsetWidth) || 0), a2 = window.innerHeight - (((_b2 = xe.value) == null ? void 0 : _b2.offsetHeight) || 0);
|
|
46
46
|
e4.x = Math.max(0, Math.min(e4.x, t2)), e4.y = Math.max(0, Math.min(e4.y, a2));
|
|
47
47
|
}(e3);
|
|
48
48
|
}, onEnd() {
|
|
49
49
|
nt(), setTimeout(() => Pe.value = true, 50);
|
|
50
50
|
} });
|
|
51
51
|
function nt() {
|
|
52
|
-
if (!
|
|
52
|
+
if (!xe.value)
|
|
53
53
|
return;
|
|
54
|
-
const e3 = window.innerWidth -
|
|
54
|
+
const e3 = window.innerWidth - xe.value.offsetWidth, t2 = window.innerHeight - xe.value.offsetHeight;
|
|
55
55
|
et.value > e3 && (et.value = e3), tt.value > t2 && (tt.value = t2);
|
|
56
56
|
}
|
|
57
57
|
function ot(e3) {
|
|
58
58
|
var _a2;
|
|
59
59
|
Ie.value = true, Te.value = e3, _e.value = [], De[e3] && 0 !== De[e3].length ? (_e.value = De[e3], (_a2 = Ue.value) == null ? void 0 : _a2.scrollToBottom()) : _e.value.push(q);
|
|
60
60
|
}
|
|
61
|
-
function lt(e3 =
|
|
61
|
+
function lt(e3 = Ae("chatEmbed.requestFailed")) {
|
|
62
62
|
_e.value.push(R("ai", e3, false, false)), je.value = false;
|
|
63
63
|
}
|
|
64
64
|
function it() {
|
|
@@ -101,7 +101,7 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
101
101
|
return function() {
|
|
102
102
|
if (je.value = false, !Ee.value)
|
|
103
103
|
return;
|
|
104
|
-
Ee.value.content = ae(Ee.value.content),
|
|
104
|
+
Ee.value.content = ae(Ee.value.content), At();
|
|
105
105
|
}(t2.data.answer), "";
|
|
106
106
|
rt(t2);
|
|
107
107
|
}
|
|
@@ -137,7 +137,7 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
function mt(e3) {
|
|
140
|
-
switch (je.value && ct(), e3.systemCode =
|
|
140
|
+
switch (je.value && ct(), e3.systemCode = x2, Ke.value = false, e3.aiModel) {
|
|
141
141
|
case H.RAGFLOW:
|
|
142
142
|
!function(e4) {
|
|
143
143
|
if (!e4)
|
|
@@ -160,12 +160,12 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
160
160
|
_e.value.push(t2), Ee.value = $(e4, true), _e.value.push(Ee.value);
|
|
161
161
|
try {
|
|
162
162
|
le.sendMessageToMcp(e4, ut(Te.value)).then(({ answerMessage: e5, errorMessage: t3 }) => {
|
|
163
|
-
je.value = false, t3 ?
|
|
163
|
+
je.value = false, t3 ? xt(t3, true) : e5 && xt(e5);
|
|
164
164
|
}).catch((e5) => {
|
|
165
|
-
je.value = false,
|
|
165
|
+
je.value = false, xt("未能返回有效信息", true);
|
|
166
166
|
});
|
|
167
167
|
} catch (e5) {
|
|
168
|
-
je.value = false,
|
|
168
|
+
je.value = false, xt("未能返回有效信息", true);
|
|
169
169
|
}
|
|
170
170
|
}(e3);
|
|
171
171
|
break;
|
|
@@ -191,13 +191,13 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
191
191
|
const t2 = M(e4);
|
|
192
192
|
_e.value.push(t2), Ke.value = true, je.value = true, Ee.value = $(e4, true), _e.value.push(Ee.value);
|
|
193
193
|
const a2 = ut(Te.value);
|
|
194
|
-
window.$vueApp.config.globalProperties.$http.post(window.$vueApp.config.globalProperties.baseAPI + "/component/aippt/createPpt", { menuName: e4.menuName, menuCode: e4.menuCode, question: e4.question, additionalDataLabel: e4.additionalDataLabel, additionalData: JSON.stringify(e4.additionalData), fileId: e4.fileId, fileInfos: e4.fileInfos, systemCode:
|
|
194
|
+
window.$vueApp.config.globalProperties.$http.post(window.$vueApp.config.globalProperties.baseAPI + "/component/aippt/createPpt", { menuName: e4.menuName, menuCode: e4.menuCode, question: e4.question, additionalDataLabel: e4.additionalDataLabel, additionalData: JSON.stringify(e4.additionalData), fileId: e4.fileId, fileInfos: e4.fileInfos, systemCode: x2, messageId: a2 }).then((e5) => {
|
|
195
195
|
if (e5.fileUrl) {
|
|
196
196
|
const t3 = oe(e5.fileUrl) || "点击下载";
|
|
197
197
|
Ee.value.content = `PPT已生成:[${t3}](${e5.fileUrl})`;
|
|
198
198
|
} else
|
|
199
199
|
Ee.value.content = "PPT生成失败,请稍后重试";
|
|
200
|
-
|
|
200
|
+
At(), je.value = false, window.open(e5.fileUrl, "_blank");
|
|
201
201
|
}).finally(() => {
|
|
202
202
|
je.value = false;
|
|
203
203
|
});
|
|
@@ -242,7 +242,7 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
242
242
|
_e.value.push(t2), Ke.value = true, je.value = true;
|
|
243
243
|
const a2 = ut(Te.value);
|
|
244
244
|
Ee.value = $(e3, true), _e.value.push(Ee.value), Qe = new AbortController();
|
|
245
|
-
const n2 = O(), o2 = await fetch(window.$vueApp.config.globalProperties.baseAPI + "/component/ai/multiple-fuck", { method: "POST", headers: { "Content-Type": "application/json", authorization: n2 || "" }, body: JSON.stringify({ question: e3.question, messageId: a2, data: JSON.stringify(e3.additionalData), fileId: e3.fileId, systemCode:
|
|
245
|
+
const n2 = O(), o2 = await fetch(window.$vueApp.config.globalProperties.baseAPI + "/component/ai/multiple-fuck", { method: "POST", headers: { "Content-Type": "application/json", authorization: n2 || "" }, body: JSON.stringify({ question: e3.question, messageId: a2, data: JSON.stringify(e3.additionalData), fileId: e3.fileId, systemCode: x2 }), signal: Qe.signal });
|
|
246
246
|
if (!o2.body)
|
|
247
247
|
throw new Error("No response body");
|
|
248
248
|
await we2({ readableStream: o2.body });
|
|
@@ -253,7 +253,7 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
253
253
|
async function kt(e3) {
|
|
254
254
|
try {
|
|
255
255
|
Ke.value = true, Ee.value = $({ question: e3 }, true), Ee.value.messageType = "realtime", _e.value.push(Ee.value), Qe = new AbortController();
|
|
256
|
-
const t2 = O(), a2 = await fetch(window.$vueApp.config.globalProperties.baseAPI + "/mc/rag-flow/converse-with-chat-stream", { method: "POST", headers: { "Content-Type": "text/event-stream", authorization: t2 }, body: JSON.stringify({ question: e3, stream: true, systemCode:
|
|
256
|
+
const t2 = O(), a2 = await fetch(window.$vueApp.config.globalProperties.baseAPI + "/mc/rag-flow/converse-with-chat-stream", { method: "POST", headers: { "Content-Type": "text/event-stream", authorization: t2 }, body: JSON.stringify({ question: e3, stream: true, systemCode: x2, session_id: Ne.value[Te.value] }), signal: Qe.signal });
|
|
257
257
|
if (!a2.body)
|
|
258
258
|
throw new Error("No response body");
|
|
259
259
|
await we2({ readableStream: a2.body });
|
|
@@ -277,11 +277,11 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
277
277
|
Ee.value.content = e3.content;
|
|
278
278
|
Ee.value = {}, je.value = false;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function At(e3 = false) {
|
|
281
281
|
Ee.value.thinkingStatus = z.END, Ee.value.showThinkingContent = true, Ee.value.messageType = "history", Ee.value = {}, Ie.value && Ge.value.addCurrentToSessionHistory(Ne.value[Te.value], _e.value), e3 || (Ie.value = false);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
Ee.value.content = e3, t2 && (Ee.value.thinkingStatus = z.ERROR),
|
|
283
|
+
function xt(e3, t2 = false) {
|
|
284
|
+
Ee.value.content = e3, t2 && (Ee.value.thinkingStatus = z.ERROR), At(t2);
|
|
285
285
|
}
|
|
286
286
|
function Pt(e3, t2) {
|
|
287
287
|
Ie.value = false, Oe.value = e3, Ne.value[Te.value] = e3.sessionId, t2.length > 0 && (_e.value = []), u(() => {
|
|
@@ -291,12 +291,12 @@ const ue = { key: 0 }, se = ["src"], re = { class: "chat-content" }, ce = { styl
|
|
|
291
291
|
});
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
|
-
return (e3, t2) => P2.value ? (s(), r("div", ue, [c("div", { ref_key: "chatIcon", ref:
|
|
294
|
+
return (e3, t2) => P2.value ? (s(), r("div", ue, [c("div", { ref_key: "chatIcon", ref: xe, style: v([d(at), { position: "fixed", cursor: "pointer", "z-index": "100" }]) }, [c("img", { src: d(X), alt: "AI Avatar", onClick: it, style: { width: "50px", height: "50px" } }, null, 8, se)], 4), m(h, { name: "slide-up" }, { default: f(() => [p(c("div", { ref_key: "chatContainerRef", ref: We, class: g(["chat-container", Me.value ? "full-screen" : "small-window"]), style: { display: "flex", flexDirection: "row" } }, [m(Y, { ref_key: "sidebarItemRef", ref: Ge, style: v({ width: ze.value + "px" }), onSelectHistoryItem: Pt, onNewChatSession: pt, onUpdateAiHistory: t2[0] || (t2[0] = (e4) => {
|
|
295
295
|
Oe.value.value = e4;
|
|
296
296
|
}), dialogFullScreen: Me.value, aiModel: Te.value }, null, 8, ["style", "dialogFullScreen", "aiModel"]), c("div", re, [m(F, { aiAvatar: Je.value, aiModel: Te.value, chatSessionId: Ne.value, dialogFullScreen: Me.value, aiHistory: Oe.value, onExpandDialog: vt, onShowChatDialog: it, onNewChatSession: pt }, null, 8, ["aiAvatar", "aiModel", "chatSessionId", "dialogFullScreen", "aiHistory"]), c("div", ce, [(s(), r("div", { ref_key: "talkMainRef", ref: Be, class: "chat-embed__main", key: $e.value }, [c("div", ve, [m(d(j), { ref_key: "bubbleListRef", ref: Ue, list: _e.value, "max-height": He.value, "is-fog": true }, { avatar: f(({ item: e4 }) => []), content: f(({ item: e4 }) => {
|
|
297
297
|
var _a2;
|
|
298
298
|
return [e4.isRecommend || null === e4.thinkingContent ? b("", true) : (s(), r(y, { key: 0 }, ["failed" !== e4.messageStatus ? (s(), w(d(T), { key: 0, "button-width": "180px", style: { "margin-bottom": "5px" }, modelValue: e4.showThinkingContent, "onUpdate:modelValue": (t3) => e4.showThinkingContent = t3, status: e4.thinkingStatus, "auto-collapse": "", content: e4.thinkingContent, typing: { interval: 20 }, duration: ".3s" }, null, 8, ["modelValue", "onUpdate:modelValue", "status", "content"])) : b("", true)], 64)), e4.link ? (s(), r("a", { key: 1, href: e4.link, title: e4.linkTitle, target: "blank" }, k(e4.content), 9, de)) : e4.content ? (s(), r(y, { key: 2 }, [c("div", { class: g(["ai" === e4.role ? "content-container" : "content-borderless-container", "chat-content-font"]) }, ["ai" !== e4.role || e4.isRecommend ? "user" === e4.role ? (s(), r(y, { key: 1 }, [S(k(e4.content) + " ", 1), ((_a2 = e4.additionalData) == null ? void 0 : _a2.length) > 0 ? (s(), w(L, { key: 0, item: e4, onViewJson: yt, onDownloadJson: wt }, null, 8, ["item"])) : b("", true)], 64)) : (s(), r(y, { key: 2 }, [S(k(e4.content), 1)], 64)) : (s(), r(y, { key: 0 }, [e4.messageType && "history" !== e4.messageType ? (s(), w(d(D), { key: 1, allowHtml: "", content: e4.content, typing: true, "is-markdown": true, "is-fog": "" }, null, 8, ["content"])) : (s(), w(d(N), { key: 0, markdown: e4.content, allowHtml: true, content: e4.content, typing: { interval: 10 }, "is-markdown": true }, { "amb-ai-tip": f(({ ...t3 }) => [m(U, { item: e4, itemProps: t3, onClickDocAgg: St }, null, 8, ["item", "itemProps"])]), "amb-alink": f(({ ...e5 }) => [c("a", { href: e5.href, target: e5.target }, k(e5.text), 9, me)]), "amb-home-chart": f(({ ...e5 }) => [m(G, { chartProps: e5, class: "chat-chart-container" }, null, 8, ["chartProps"])]), "amb-interaction-data": f(({ ...e5 }) => [m(K, { chartProps: e5, class: "chat-chart-container" }, null, 8, ["chartProps"])]), "amb-auto-chart": f(({ ...e5 }) => [m(Q, { chartProps: e5, class: "chat-chart-container" }, null, 8, ["chartProps"])]), _: 2 }, 1032, ["markdown", "content"]))], 64)), c("div", he, [c("span", null, k(e4.sendTime), 1)])], 2), e4.recommendations && e4.recommendations.length > 0 ? (s(), w(J, { key: 0, item: e4, onClickRecommendation: ft }, null, 8, ["item"])) : b("", true), e4.docAggs && e4.docAggs.length > 0 ? (s(), r("div", fe, [pe, (s(true), r(y, null, C(e4.docAggs, (e5, t3) => (s(), r("div", { onClick: (t4) => St(e5), class: "doc-agg-item" }, k(e5.doc_name), 9, ge))), 256))])) : b("", true)], 64)) : b("", true)];
|
|
299
|
-
}), footer: f(({ item: e4 }) => [m(V, { item: e4, onRegenerate: ht }, null, 8, ["item"])]), _: 1 }, 8, ["list", "max-height"]), c("div", ye, k(st.value), 1)]), c("div", { ref_key: "talkInputRef", ref: Fe, class: "chat-embed__input_container" }, [m(W, { loading: je.value, ref_key: "chatSenderRef", ref: Xe, onSubmitQuestion: mt, onCommandAnswer: Ct, onHandleCancel: ct, onViewJson: yt, onChangeAiModel: gt }, null, 8, ["loading"])], 512)]))])])], 2), [[
|
|
299
|
+
}), footer: f(({ item: e4 }) => [m(V, { item: e4, onRegenerate: ht }, null, 8, ["item"])]), _: 1 }, 8, ["list", "max-height"]), c("div", ye, k(st.value), 1)]), c("div", { ref_key: "talkInputRef", ref: Fe, class: "chat-embed__input_container" }, [m(W, { loading: je.value, ref_key: "chatSenderRef", ref: Xe, onSubmitQuestion: mt, onCommandAnswer: Ct, onHandleCancel: ct, onViewJson: yt, onChangeAiModel: gt }, null, 8, ["loading"])], 512)]))])])], 2), [[A, qe.value]])]), _: 1 }), m(d(B), { modelValue: Le.value, "onUpdate:modelValue": t2[1] || (t2[1] = (e4) => Le.value = e4), "json-object": Ve.value, "append-to-body": true, title: "预览数据" }, null, 8, ["modelValue", "json-object"])])) : b("", true);
|
|
300
300
|
} });
|
|
301
301
|
export {
|
|
302
302
|
we as default
|