@ibiz-template-plugin/ai-chat 0.0.40 → 0.0.42
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/dist/index.es.js +199 -187
- package/dist/index.legacy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/entity/chat-message/chat-message.d.ts +1 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +4 -0
- package/dist/types/interface/i-remote-resource/i-remote-resource.d.ts +1 -1
- package/dist/types/utils/util/remote-resource-util.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -151,29 +151,29 @@ function vs(n) {
|
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function zr(n, e, t, i, r, s, o, l, a, c) {
|
|
154
|
-
var d, u, h, f, p, m, y, v, b, w,
|
|
154
|
+
var d, u, h, f, p, m, y, v, b, w, S, k, _, M, O, I, ue, me = e.type;
|
|
155
155
|
if (e.constructor != null)
|
|
156
156
|
return null;
|
|
157
157
|
128 & t.__u && (a = !!(32 & t.__u), s = [l = e.__e = t.__e]), (d = D.__b) && d(e);
|
|
158
158
|
e:
|
|
159
159
|
if (typeof me == "function")
|
|
160
160
|
try {
|
|
161
|
-
if (v = e.props, b = "prototype" in me && me.prototype.render, w = (d = me.contextType) && i[d.__c],
|
|
161
|
+
if (v = e.props, b = "prototype" in me && me.prototype.render, w = (d = me.contextType) && i[d.__c], S = d ? w ? w.props.value : d.__ : i, t.__c ? y = (u = e.__c = t.__c).__ = u.__E : (b ? e.__c = u = new me(v, S) : (e.__c = u = new De(v, S), u.constructor = me, u.render = id), w && w.sub(u), u.props = v, u.state || (u.state = {}), u.context = S, u.__n = i, h = u.__d = !0, u.__h = [], u._sb = []), b && u.__s == null && (u.__s = u.state), b && me.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = je({}, u.__s)), je(u.__s, me.getDerivedStateFromProps(v, u.__s))), f = u.props, p = u.state, u.__v = e, h)
|
|
162
162
|
b && me.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), b && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
163
163
|
else {
|
|
164
|
-
if (b && me.getDerivedStateFromProps == null && v !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v,
|
|
164
|
+
if (b && me.getDerivedStateFromProps == null && v !== f && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v, S), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(v, u.__s, S) === !1 || e.__v == t.__v) {
|
|
165
165
|
for (e.__v != t.__v && (u.props = v, u.state = u.__s, u.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.some(function(Ne) {
|
|
166
166
|
Ne && (Ne.__ = e);
|
|
167
|
-
}),
|
|
168
|
-
u.__h.push(u._sb[
|
|
167
|
+
}), k = 0; k < u._sb.length; k++)
|
|
168
|
+
u.__h.push(u._sb[k]);
|
|
169
169
|
u._sb = [], u.__h.length && o.push(u);
|
|
170
170
|
break e;
|
|
171
171
|
}
|
|
172
|
-
u.componentWillUpdate != null && u.componentWillUpdate(v, u.__s,
|
|
172
|
+
u.componentWillUpdate != null && u.componentWillUpdate(v, u.__s, S), b && u.componentDidUpdate != null && u.__h.push(function() {
|
|
173
173
|
u.componentDidUpdate(f, p, m);
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
if (u.context =
|
|
176
|
+
if (u.context = S, u.props = v, u.__P = n, u.__e = !1, _ = D.__r, M = 0, b) {
|
|
177
177
|
for (u.state = u.__s, u.__d = !1, _ && _(e), d = u.render(u.props, u.state, u.context), O = 0; O < u._sb.length; O++)
|
|
178
178
|
u.__h.push(u._sb[O]);
|
|
179
179
|
u._sb = [];
|
|
@@ -1889,7 +1889,7 @@ function F(n) {
|
|
|
1889
1889
|
return We(n);
|
|
1890
1890
|
}, []);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1892
|
+
function Ce(n) {
|
|
1893
1893
|
var e = se(n);
|
|
1894
1894
|
return e.current = n, mi.__$f |= 4, Ee(function() {
|
|
1895
1895
|
return Pl(function() {
|
|
@@ -2402,8 +2402,8 @@ const nu = (n) => {
|
|
|
2402
2402
|
c(f, p).forEach((v, b) => {
|
|
2403
2403
|
const w = document.createElement("div");
|
|
2404
2404
|
w.className = "code-line";
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2405
|
+
const S = document.createElement("span");
|
|
2406
|
+
S && (S.className = "line-number", S.textContent = (b + 1).toString(), w.appendChild(S), w.innerHTML += v, m.appendChild(w));
|
|
2407
2407
|
});
|
|
2408
2408
|
}, c = (h, f = 0) => {
|
|
2409
2409
|
const p = " ".repeat(f), m = [];
|
|
@@ -2419,13 +2419,13 @@ const nu = (n) => {
|
|
|
2419
2419
|
if (y.length === 0)
|
|
2420
2420
|
return ["".concat(p, '<span class="property">{}</span>')];
|
|
2421
2421
|
m.push("".concat(p, '<span class="property">{</span>')), y.forEach((v, b) => {
|
|
2422
|
-
const w = h[v],
|
|
2422
|
+
const w = h[v], S = b < y.length - 1 ? "," : "", k = '<span class="json-key">"'.concat(v, '":</span>');
|
|
2423
2423
|
if (typeof w == "object" && w !== null) {
|
|
2424
2424
|
const _ = c(w, f + 1);
|
|
2425
|
-
m.push("".concat(p, " ").concat(
|
|
2425
|
+
m.push("".concat(p, " ").concat(k, " ").concat(_[0].trim())), _.length > 1 && (m.push(..._.slice(1, -1)), m.push("".concat(_[_.length - 1]).concat(S)));
|
|
2426
2426
|
} else {
|
|
2427
2427
|
const _ = d(w);
|
|
2428
|
-
m.push("".concat(p, " ").concat(
|
|
2428
|
+
m.push("".concat(p, " ").concat(k, " ").concat(_).concat(S));
|
|
2429
2429
|
}
|
|
2430
2430
|
}), m.push("".concat(p, '<span class="property">}</span>'));
|
|
2431
2431
|
} else
|
|
@@ -2530,7 +2530,7 @@ const iu = (n) => {
|
|
|
2530
2530
|
K(() => {
|
|
2531
2531
|
i.value = e.filter((a) => a), s.value = e.length > 4;
|
|
2532
2532
|
}, [e]);
|
|
2533
|
-
const o =
|
|
2533
|
+
const o = Ce(() => s.value && !r.value ? i.value.slice(0, 4) : i.value), l = () => {
|
|
2534
2534
|
r.value = !r.value;
|
|
2535
2535
|
};
|
|
2536
2536
|
return /* @__PURE__ */ g("div", { className: "".concat(t.b()), children: [
|
|
@@ -2538,8 +2538,8 @@ const iu = (n) => {
|
|
|
2538
2538
|
s.value && /* @__PURE__ */ g("div", { className: t.e("toggle"), onClick: l, children: r.value ? "收起工具调用" : "展开全部 ".concat(i.value.length, " 个工具调用") })
|
|
2539
2539
|
] });
|
|
2540
2540
|
};
|
|
2541
|
-
const
|
|
2542
|
-
var
|
|
2541
|
+
const ve = new L("chat-select"), ru = (n) => {
|
|
2542
|
+
var v;
|
|
2543
2543
|
const {
|
|
2544
2544
|
options: e,
|
|
2545
2545
|
value: t,
|
|
@@ -2554,45 +2554,45 @@ const Ce = new L("chat-select"), ru = (n) => {
|
|
|
2554
2554
|
K(() => {
|
|
2555
2555
|
t !== void 0 && u(t);
|
|
2556
2556
|
}, [t]);
|
|
2557
|
-
const p = (
|
|
2558
|
-
u(
|
|
2557
|
+
const p = (b) => {
|
|
2558
|
+
u(b.value), o == null || o(b.value), f(!1);
|
|
2559
2559
|
};
|
|
2560
2560
|
K(() => {
|
|
2561
|
-
const
|
|
2562
|
-
var
|
|
2563
|
-
l || (
|
|
2561
|
+
const b = (w) => {
|
|
2562
|
+
var S, k;
|
|
2563
|
+
l || (S = c.current) != null && S.contains(w.target) || ((k = a.current) != null && k.contains(w.target) ? f((_) => !_) : f(!1));
|
|
2564
2564
|
};
|
|
2565
|
-
return document.addEventListener("mousedown",
|
|
2566
|
-
document.removeEventListener("mousedown",
|
|
2565
|
+
return document.addEventListener("mousedown", b), () => {
|
|
2566
|
+
document.removeEventListener("mousedown", b);
|
|
2567
2567
|
};
|
|
2568
2568
|
}, []);
|
|
2569
|
-
const m = ((
|
|
2569
|
+
const m = ((v = e == null ? void 0 : e.find((b) => b.value === d)) == null ? void 0 : v.label) || s, y = !!(e != null && e.length);
|
|
2570
2570
|
return /* @__PURE__ */ g(
|
|
2571
2571
|
"div",
|
|
2572
2572
|
{
|
|
2573
|
-
className: "".concat(
|
|
2573
|
+
className: "".concat(ve.b(), " ").concat(r || "", " ").concat(ve.is("visble", h), " ").concat(ve.is("disabled", l), " ").concat(ve.is("no-options", !y)),
|
|
2574
2574
|
children: [
|
|
2575
|
-
/* @__PURE__ */ g("div", { className:
|
|
2576
|
-
/* @__PURE__ */ g("span", { className:
|
|
2577
|
-
/* @__PURE__ */ g("span", { className:
|
|
2578
|
-
/* @__PURE__ */ g(
|
|
2575
|
+
/* @__PURE__ */ g("div", { className: ve.e("header"), ref: a, children: [
|
|
2576
|
+
/* @__PURE__ */ g("span", { className: ve.em("header", "prefix"), title: "智能体", children: Yd() }),
|
|
2577
|
+
/* @__PURE__ */ g("span", { className: ve.em("header", "display-value"), title: m, children: m }),
|
|
2578
|
+
y ? /* @__PURE__ */ g(
|
|
2579
2579
|
"span",
|
|
2580
2580
|
{
|
|
2581
|
-
className: "".concat(
|
|
2581
|
+
className: "".concat(ve.em("header", "suffix"), " ").concat(ve.is("disabled", l)),
|
|
2582
2582
|
children: Xd()
|
|
2583
2583
|
}
|
|
2584
|
-
)
|
|
2584
|
+
) : null
|
|
2585
2585
|
] }),
|
|
2586
|
-
/* @__PURE__ */ g("div", { className:
|
|
2586
|
+
y ? /* @__PURE__ */ g("div", { className: ve.e("dropdown"), ref: c, children: /* @__PURE__ */ g("ul", { className: ve.em("dropdown", "list"), children: e == null ? void 0 : e.map((b) => /* @__PURE__ */ g(
|
|
2587
2587
|
"li",
|
|
2588
2588
|
{
|
|
2589
|
-
className: "".concat(
|
|
2590
|
-
title:
|
|
2591
|
-
onClick: () => p(
|
|
2592
|
-
children:
|
|
2589
|
+
className: "".concat(ve.em("dropdown", "item"), " ").concat(ve.is("active", b.value === d)),
|
|
2590
|
+
title: b.label,
|
|
2591
|
+
onClick: () => p(b),
|
|
2592
|
+
children: b.label
|
|
2593
2593
|
},
|
|
2594
|
-
|
|
2595
|
-
)) }) })
|
|
2594
|
+
b.value
|
|
2595
|
+
)) }) }) : null
|
|
2596
2596
|
]
|
|
2597
2597
|
}
|
|
2598
2598
|
);
|
|
@@ -2750,10 +2750,10 @@ const ht = new L("markdown-message"), ou = (n) => {
|
|
|
2750
2750
|
] });
|
|
2751
2751
|
};
|
|
2752
2752
|
const en = new L("ossfile-material"), lu = (n) => {
|
|
2753
|
-
const e =
|
|
2753
|
+
const e = Ce(() => n.material.data.name), t = Ce(() => n.material.metadata.size), i = Ce(() => {
|
|
2754
2754
|
const s = n.material.metadata.state;
|
|
2755
2755
|
return s === "successed" ? "上传成功" : s === "uploading" ? "上传中" : s === "failed" ? "上传失败" : "未知状态";
|
|
2756
|
-
}), r =
|
|
2756
|
+
}), r = Ce(() => {
|
|
2757
2757
|
switch (n.material.metadata.state) {
|
|
2758
2758
|
case "successed":
|
|
2759
2759
|
return "#1890ff";
|
|
@@ -2783,7 +2783,7 @@ const tn = new L("common-material"), au = (n) => {
|
|
|
2783
2783
|
var i, r, s, o;
|
|
2784
2784
|
const e = (i = n.controller.opts.questionToolbarItems) == null ? void 0 : i.find(
|
|
2785
2785
|
(l) => l.id === n.material.metadata.actionId
|
|
2786
|
-
), t =
|
|
2786
|
+
), t = Ce(() => n.material.metadata.name);
|
|
2787
2787
|
return /* @__PURE__ */ g("div", { className: tn.b(), children: [
|
|
2788
2788
|
/* @__PURE__ */ g("div", { className: tn.b("left"), children: e && e.icon ? typeof e.icon == "function" ? e.icon() : ((r = e.icon) == null ? void 0 : r.showIcon) && /* @__PURE__ */ g(ze, { children: (s = e.icon) != null && s.cssClass ? /* @__PURE__ */ g("i", { className: e.icon.cssClass }) : (o = e.icon) != null && o.imagePath ? fi(e.icon.imagePath) ? /* @__PURE__ */ g(
|
|
2789
2789
|
"div",
|
|
@@ -2821,7 +2821,7 @@ const $i = new L("chat-input-material-item"), Fl = (n) => {
|
|
|
2821
2821
|
] });
|
|
2822
2822
|
};
|
|
2823
2823
|
const Re = new L("user-message-question"), cu = (n) => {
|
|
2824
|
-
const e = F(He()), t = F(null), i = F(135), r = F(!0), s = F(!1), o = se(null), l =
|
|
2824
|
+
const e = F(He()), t = F(null), i = F(135), r = F(!0), s = F(!1), o = se(null), l = Ce(() => n.message.content), a = Ce(() => dr.parseMixedContent(l.value));
|
|
2825
2825
|
return K(() => {
|
|
2826
2826
|
t.value = new dl({
|
|
2827
2827
|
id: e,
|
|
@@ -2913,7 +2913,7 @@ const Re = new L("user-message-question"), cu = (n) => {
|
|
|
2913
2913
|
] });
|
|
2914
2914
|
};
|
|
2915
2915
|
const On = new L("error-message"), du = (n) => {
|
|
2916
|
-
const e =
|
|
2916
|
+
const e = Ce(() => n.message.content);
|
|
2917
2917
|
return /* @__PURE__ */ g("div", { className: On.b(), children: [
|
|
2918
2918
|
/* @__PURE__ */ g("div", { className: On.b("header"), children: [
|
|
2919
2919
|
/* @__PURE__ */ g("div", { className: On.be("header", "caption"), children: "AI " }),
|
|
@@ -2970,6 +2970,9 @@ class ft {
|
|
|
2970
2970
|
get type() {
|
|
2971
2971
|
return this.msg.type;
|
|
2972
2972
|
}
|
|
2973
|
+
get status() {
|
|
2974
|
+
return this.msg.status;
|
|
2975
|
+
}
|
|
2973
2976
|
get realcontent() {
|
|
2974
2977
|
let e = this.msg.content;
|
|
2975
2978
|
if (e.indexOf("<think>") !== -1 && e.indexOf("</think>") === -1 || (e = e.replace(new RegExp("\\<think\\>[^]*?\\<\\/think\\>", "gs"), "").trim(), e.indexOf("<tool_call>") !== -1 && e.indexOf("</tool_call>") === -1) || (e = e.replace(new RegExp("\\<tool_call\\>[^]*?\\<\\/tool_call\\>", "gs"), "").trim(), e.indexOf("<resources>") !== -1 && e.indexOf("</resources>") === -1))
|
|
@@ -3135,12 +3138,12 @@ const ge = new L("chat-toolbar-item"), mu = (n) => {
|
|
|
3135
3138
|
if (d(e))
|
|
3136
3139
|
return /* @__PURE__ */ g(ze, {});
|
|
3137
3140
|
const u = (b) => r ? !0 : typeof b.disabled == "function" ? b.disabled(t) : b.disabled === !0, h = (b) => {
|
|
3138
|
-
var w,
|
|
3141
|
+
var w, S, k, _;
|
|
3139
3142
|
if (typeof b.icon == "function")
|
|
3140
3143
|
return b.icon();
|
|
3141
|
-
if ((w = b.icon) != null && w.showIcon && ((
|
|
3144
|
+
if ((w = b.icon) != null && w.showIcon && ((S = b.icon) != null && S.cssClass))
|
|
3142
3145
|
return /* @__PURE__ */ g("i", { className: b.icon.cssClass });
|
|
3143
|
-
if ((
|
|
3146
|
+
if ((k = b.icon) != null && k.showIcon && ((_ = b.icon) != null && _.imagePath))
|
|
3144
3147
|
return fi(b.icon.imagePath) ? /* @__PURE__ */ g(
|
|
3145
3148
|
"div",
|
|
3146
3149
|
{
|
|
@@ -3194,7 +3197,7 @@ const ge = new L("chat-toolbar-item"), mu = (n) => {
|
|
|
3194
3197
|
"div",
|
|
3195
3198
|
{
|
|
3196
3199
|
title: b.title,
|
|
3197
|
-
onClick: (
|
|
3200
|
+
onClick: (S) => p(S, b),
|
|
3198
3201
|
className: "".concat(ge.be("dropdown", "item"), " ").concat(b.customClass || "", " ").concat(ge.is("disabled", u(b))),
|
|
3199
3202
|
children: [
|
|
3200
3203
|
/* @__PURE__ */ g("div", { className: ge.bem("dropdown", "item", "icon"), children: h(b) }),
|
|
@@ -3400,19 +3403,19 @@ const Ds = new L("chat-messages"), Is = (n) => {
|
|
|
3400
3403
|
return;
|
|
3401
3404
|
const { scrollTop: v, scrollHeight: b, clientHeight: w } = y;
|
|
3402
3405
|
v < 100 && !s && h && (o(!0), setTimeout(() => {
|
|
3403
|
-
const
|
|
3406
|
+
const k = Math.min(
|
|
3404
3407
|
i + t,
|
|
3405
3408
|
d.value.length
|
|
3406
3409
|
);
|
|
3407
|
-
r(
|
|
3410
|
+
r(k);
|
|
3408
3411
|
const _ = y.scrollHeight;
|
|
3409
3412
|
setTimeout(() => {
|
|
3410
3413
|
const M = y.scrollHeight;
|
|
3411
3414
|
y.scrollTop = M - _ + y.scrollTop, o(!1);
|
|
3412
3415
|
}, 0);
|
|
3413
3416
|
}, 300));
|
|
3414
|
-
const
|
|
3415
|
-
a(
|
|
3417
|
+
const S = b - (v + w) < 50;
|
|
3418
|
+
a(S);
|
|
3416
3419
|
}, m = () => {
|
|
3417
3420
|
c.current = !0, a(!0);
|
|
3418
3421
|
};
|
|
@@ -3673,7 +3676,7 @@ function Pu(n) {
|
|
|
3673
3676
|
return 30;
|
|
3674
3677
|
case "failed":
|
|
3675
3678
|
return 40;
|
|
3676
|
-
case "
|
|
3679
|
+
case "canceled":
|
|
3677
3680
|
return 30;
|
|
3678
3681
|
default:
|
|
3679
3682
|
return 30;
|
|
@@ -3683,7 +3686,7 @@ function zu(n) {
|
|
|
3683
3686
|
switch (n) {
|
|
3684
3687
|
case "pending":
|
|
3685
3688
|
case "sent":
|
|
3686
|
-
case "
|
|
3689
|
+
case "canceled":
|
|
3687
3690
|
return "DEFAULT";
|
|
3688
3691
|
case "failed":
|
|
3689
3692
|
return "ERROR";
|
|
@@ -3702,7 +3705,8 @@ function $u(n) {
|
|
|
3702
3705
|
islike: n.is_like,
|
|
3703
3706
|
isdislike: n.is_dislike,
|
|
3704
3707
|
feedbackcontent: n.feedback_content,
|
|
3705
|
-
realmessageid: n.id
|
|
3708
|
+
realmessageid: n.id,
|
|
3709
|
+
status: n.status
|
|
3706
3710
|
};
|
|
3707
3711
|
}
|
|
3708
3712
|
class Ws {
|
|
@@ -3907,7 +3911,8 @@ class Ws {
|
|
|
3907
3911
|
suggestions: i.suggestions,
|
|
3908
3912
|
completed: !0,
|
|
3909
3913
|
toolcalls: i.toolcalls,
|
|
3910
|
-
realmessageid: i.realmessageid
|
|
3914
|
+
realmessageid: i.realmessageid,
|
|
3915
|
+
status: i.status
|
|
3911
3916
|
};
|
|
3912
3917
|
this.addMessage(r);
|
|
3913
3918
|
}), await this.afterFecthHistory(), !0;
|
|
@@ -3930,7 +3935,8 @@ class Ws {
|
|
|
3930
3935
|
role: "USER",
|
|
3931
3936
|
type: "DEFAULT",
|
|
3932
3937
|
content: this.opts.appendCurContent,
|
|
3933
|
-
completed: !0
|
|
3938
|
+
completed: !0,
|
|
3939
|
+
status: "sent"
|
|
3934
3940
|
}), this.opts.appendCurResource) {
|
|
3935
3941
|
const { hasResources: e, resources: t } = dr.parseMixedContent(this.opts.appendCurResource);
|
|
3936
3942
|
e && t && t.length > 0 && t.forEach((i) => {
|
|
@@ -4063,12 +4069,7 @@ class Ws {
|
|
|
4063
4069
|
const t = this.messages.value.findIndex(
|
|
4064
4070
|
(i) => i.messageid === e.messageid
|
|
4065
4071
|
);
|
|
4066
|
-
|
|
4067
|
-
const i = this.messages.value[t];
|
|
4068
|
-
e.content = i.content, this.messages.value[t].replace(e), this.messages.value = [...this.messages.value];
|
|
4069
|
-
} else
|
|
4070
|
-
this.messages.value = [...this.messages.value, new ft(e)];
|
|
4071
|
-
await this.asyncToIndexDB();
|
|
4072
|
+
e.content = e.content || "用户中断", t !== -1 ? (this.messages.value[t].replace(e), this.messages.value = [...this.messages.value]) : this.messages.value = [...this.messages.value, new ft(e)], await this.asyncToIndexDB();
|
|
4072
4073
|
}
|
|
4073
4074
|
/**
|
|
4074
4075
|
* 数据对象转 XML 字符串
|
|
@@ -4095,7 +4096,7 @@ class Ws {
|
|
|
4095
4096
|
* @memberof AiChatController
|
|
4096
4097
|
*/
|
|
4097
4098
|
getMessages() {
|
|
4098
|
-
const e = this.messages.value.filter((t) => t.type !== "ERROR").map((t) => t._origin);
|
|
4099
|
+
const e = this.messages.value.filter((t) => t.type !== "ERROR" && t.status !== "canceled").map((t) => t._origin);
|
|
4099
4100
|
return e.forEach((t) => {
|
|
4100
4101
|
t.content = t.content.replace(new RegExp("\\<tool_call\\>[^]*?\\<\\/tool_call\\>", "gs"), "").trim();
|
|
4101
4102
|
}), e;
|
|
@@ -4126,7 +4127,8 @@ class Ws {
|
|
|
4126
4127
|
messageid: He(),
|
|
4127
4128
|
role: "USER",
|
|
4128
4129
|
type: "DEFAULT",
|
|
4129
|
-
content: t
|
|
4130
|
+
content: t,
|
|
4131
|
+
status: "sent"
|
|
4130
4132
|
}), await this.opts.question(
|
|
4131
4133
|
this,
|
|
4132
4134
|
this.context,
|
|
@@ -4346,7 +4348,7 @@ class Ws {
|
|
|
4346
4348
|
switch (s) {
|
|
4347
4349
|
case "action":
|
|
4348
4350
|
if (this.opts.extendToolbarClick) {
|
|
4349
|
-
const a = t.data.actionid;
|
|
4351
|
+
const a = t.data.actionid, c = t.data.appid;
|
|
4350
4352
|
if (!a)
|
|
4351
4353
|
throw new Error("actionid不能为空");
|
|
4352
4354
|
this.addMessage({
|
|
@@ -4354,23 +4356,30 @@ class Ws {
|
|
|
4354
4356
|
state: 30,
|
|
4355
4357
|
type: "DEFAULT",
|
|
4356
4358
|
role: "USER",
|
|
4357
|
-
content: o.content_name
|
|
4359
|
+
content: o.content_name,
|
|
4360
|
+
status: "sent"
|
|
4358
4361
|
});
|
|
4359
|
-
const
|
|
4360
|
-
Object.assign(
|
|
4361
|
-
const
|
|
4362
|
+
const d = { ...e };
|
|
4363
|
+
Object.assign(d, { topic: this.topic }), d.msg.realcontent = e.realcontent;
|
|
4364
|
+
const u = await this.opts.extendToolbarClick(
|
|
4362
4365
|
i,
|
|
4363
|
-
{
|
|
4366
|
+
{
|
|
4367
|
+
id: a,
|
|
4368
|
+
// 是否是插件应用(建议里面定义appid认为是插件应用的界面行为)
|
|
4369
|
+
isPluginApp: !!c,
|
|
4370
|
+
appId: c || this.context.srfappid
|
|
4371
|
+
},
|
|
4364
4372
|
this.context,
|
|
4365
4373
|
this.params,
|
|
4366
|
-
|
|
4367
|
-
),
|
|
4368
|
-
|
|
4374
|
+
d
|
|
4375
|
+
), h = (l = u == null ? void 0 : u.data) == null ? void 0 : l[0];
|
|
4376
|
+
h.content && this.addMessage({
|
|
4369
4377
|
messageid: He(),
|
|
4370
4378
|
state: 30,
|
|
4371
|
-
type:
|
|
4372
|
-
role:
|
|
4373
|
-
content:
|
|
4379
|
+
type: h.type || "DEFAULT",
|
|
4380
|
+
role: h.role || "ASSISTANT",
|
|
4381
|
+
content: h.content,
|
|
4382
|
+
status: "sent"
|
|
4374
4383
|
});
|
|
4375
4384
|
}
|
|
4376
4385
|
break;
|
|
@@ -5188,7 +5197,7 @@ class Vu {
|
|
|
5188
5197
|
const r = this.aiTopic.getCurrentTopicByID(
|
|
5189
5198
|
e.id
|
|
5190
5199
|
);
|
|
5191
|
-
if (e.sequence = r.sequence, e.isTop = r.isTop, r && r.aiChat && r.aiChat.activeAIAgentID)
|
|
5200
|
+
if (r && (e.sequence = r.sequence, e.isTop = r.isTop), r && r.aiChat && r.aiChat.activeAIAgentID)
|
|
5192
5201
|
t.activeAIAgentID = r.aiChat.activeAIAgentID, e.aiChat.activeAIAgentID = r.aiChat.activeAIAgentID;
|
|
5193
5202
|
else if (t.aiAgentlist && t.aiAgentlist.length > 0 && !t.activeAIAgentID) {
|
|
5194
5203
|
const o = t.aiAgentlist.find(
|
|
@@ -5235,8 +5244,11 @@ class Vu {
|
|
|
5235
5244
|
extendToolbarClick: this.backupChatOptions.chatOptions.extendToolbarClick,
|
|
5236
5245
|
recommendPrompt: this.backupChatOptions.chatOptions.recommendPrompt
|
|
5237
5246
|
});
|
|
5238
|
-
|
|
5239
|
-
|
|
5247
|
+
const i = new Ws(
|
|
5248
|
+
t,
|
|
5249
|
+
this.resourceOptions
|
|
5250
|
+
);
|
|
5251
|
+
this.aiTopicMap.set("".concat(e.id), i), this.container && (Lt(null, this.container), Lt(
|
|
5240
5252
|
Ke(sl, {
|
|
5241
5253
|
aiChat: i,
|
|
5242
5254
|
aiTopic: this.aiTopic,
|
|
@@ -8270,15 +8282,15 @@ class wr {
|
|
|
8270
8282
|
return (this.delInfo & qn) > 0;
|
|
8271
8283
|
}
|
|
8272
8284
|
}
|
|
8273
|
-
class
|
|
8285
|
+
class we {
|
|
8274
8286
|
/**
|
|
8275
8287
|
Create a position map. The modifications to the document are
|
|
8276
8288
|
represented as an array of numbers, in which each group of three
|
|
8277
8289
|
represents a modified chunk as `[start, oldSize, newSize]`.
|
|
8278
8290
|
*/
|
|
8279
8291
|
constructor(e, t = !1) {
|
|
8280
|
-
if (this.ranges = e, this.inverted = t, !e.length &&
|
|
8281
|
-
return
|
|
8292
|
+
if (this.ranges = e, this.inverted = t, !e.length && we.empty)
|
|
8293
|
+
return we.empty;
|
|
8282
8294
|
}
|
|
8283
8295
|
/**
|
|
8284
8296
|
@internal
|
|
@@ -8349,7 +8361,7 @@ class be {
|
|
|
8349
8361
|
map positions in the post-step document to the pre-step document.
|
|
8350
8362
|
*/
|
|
8351
8363
|
invert() {
|
|
8352
|
-
return new
|
|
8364
|
+
return new we(this.ranges, !this.inverted);
|
|
8353
8365
|
}
|
|
8354
8366
|
/**
|
|
8355
8367
|
@internal
|
|
@@ -8363,10 +8375,10 @@ class be {
|
|
|
8363
8375
|
sub-document to a larger document, or vice-versa.
|
|
8364
8376
|
*/
|
|
8365
8377
|
static offset(e) {
|
|
8366
|
-
return e == 0 ?
|
|
8378
|
+
return e == 0 ? we.empty : new we(e < 0 ? [0, -e, 0] : [0, 0, e]);
|
|
8367
8379
|
}
|
|
8368
8380
|
}
|
|
8369
|
-
|
|
8381
|
+
we.empty = new we([]);
|
|
8370
8382
|
class bn {
|
|
8371
8383
|
/**
|
|
8372
8384
|
Create a new mapping with the given position maps.
|
|
@@ -8482,7 +8494,7 @@ class de {
|
|
|
8482
8494
|
and the new document.
|
|
8483
8495
|
*/
|
|
8484
8496
|
getMap() {
|
|
8485
|
-
return
|
|
8497
|
+
return we.empty;
|
|
8486
8498
|
}
|
|
8487
8499
|
/**
|
|
8488
8500
|
Try to merge this step with another one, to be applied directly
|
|
@@ -8732,7 +8744,7 @@ class G extends de {
|
|
|
8732
8744
|
return this.structure && Cr(e, this.from, this.to) ? J.fail("Structure replace would overwrite content") : J.fromReplace(e, this.from, this.to, this.slice);
|
|
8733
8745
|
}
|
|
8734
8746
|
getMap() {
|
|
8735
|
-
return new
|
|
8747
|
+
return new we([this.from, this.to - this.from, this.slice.size]);
|
|
8736
8748
|
}
|
|
8737
8749
|
invert(e) {
|
|
8738
8750
|
return new G(this.from, this.from + this.slice.size, e.slice(this.from, this.to));
|
|
@@ -8787,7 +8799,7 @@ class Q extends de {
|
|
|
8787
8799
|
return i ? J.fromReplace(e, this.from, this.to, i) : J.fail("Content does not fit in gap");
|
|
8788
8800
|
}
|
|
8789
8801
|
getMap() {
|
|
8790
|
-
return new
|
|
8802
|
+
return new we([
|
|
8791
8803
|
this.from,
|
|
8792
8804
|
this.gapFrom - this.from,
|
|
8793
8805
|
this.insert,
|
|
@@ -9431,7 +9443,7 @@ class Ht extends de {
|
|
|
9431
9443
|
return J.fromReplace(e, this.pos, this.pos + 1, new x(C.from(r), 0, t.isLeaf ? 0 : 1));
|
|
9432
9444
|
}
|
|
9433
9445
|
getMap() {
|
|
9434
|
-
return
|
|
9446
|
+
return we.empty;
|
|
9435
9447
|
}
|
|
9436
9448
|
invert(e) {
|
|
9437
9449
|
return new Ht(this.pos, this.attr, e.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -9466,7 +9478,7 @@ class wn extends de {
|
|
|
9466
9478
|
return J.ok(i);
|
|
9467
9479
|
}
|
|
9468
9480
|
getMap() {
|
|
9469
|
-
return
|
|
9481
|
+
return we.empty;
|
|
9470
9482
|
}
|
|
9471
9483
|
invert(e) {
|
|
9472
9484
|
return new wn(this.attr, e.attrs[this.attr]);
|
|
@@ -14213,32 +14225,32 @@ function Vp(n, e, t, i, r) {
|
|
|
14213
14225
|
return M(n, mt(13, "Enter"));
|
|
14214
14226
|
});
|
|
14215
14227
|
}, 20));
|
|
14216
|
-
let w = p.start,
|
|
14217
|
-
let O = M || n.state.tr.replace(w,
|
|
14228
|
+
let w = p.start, S = p.endA, k = (M) => {
|
|
14229
|
+
let O = M || n.state.tr.replace(w, S, c.doc.slice(p.start - c.from, p.endB - c.from));
|
|
14218
14230
|
if (c.sel) {
|
|
14219
14231
|
let I = Lo(n, O.doc, c.sel);
|
|
14220
|
-
I && !(Z && n.composing && I.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (I.head == w || I.head == O.mapping.map(
|
|
14232
|
+
I && !(Z && n.composing && I.empty && (p.start != p.endB || n.input.lastChromeDelete < Date.now() - 100) && (I.head == w || I.head == O.mapping.map(S) - 1) || ye && I.empty && I.head == w) && O.setSelection(I);
|
|
14221
14233
|
}
|
|
14222
14234
|
return s && O.setMeta("composition", s), O.scrollIntoView();
|
|
14223
14235
|
}, _;
|
|
14224
14236
|
if (b)
|
|
14225
14237
|
if (m.pos == y.pos) {
|
|
14226
14238
|
ye && ot <= 11 && m.parentOffset == 0 && (n.domObserver.suppressSelectionUpdates(), setTimeout(() => Je(n), 20));
|
|
14227
|
-
let M =
|
|
14239
|
+
let M = k(n.state.tr.delete(w, S)), O = d.resolve(p.start).marksAcross(d.resolve(p.endA));
|
|
14228
14240
|
O && M.ensureMarks(O), n.dispatch(M);
|
|
14229
14241
|
} else if (
|
|
14230
14242
|
// Adding or removing a mark
|
|
14231
14243
|
p.endA == p.endB && (_ = Hp(m.parent.content.cut(m.parentOffset, y.parentOffset), v.parent.content.cut(v.parentOffset, p.endA - v.start())))
|
|
14232
14244
|
) {
|
|
14233
|
-
let M =
|
|
14234
|
-
_.type == "add" ? M.addMark(w,
|
|
14245
|
+
let M = k(n.state.tr);
|
|
14246
|
+
_.type == "add" ? M.addMark(w, S, _.mark) : M.removeMark(w, S, _.mark), n.dispatch(M);
|
|
14235
14247
|
} else if (m.parent.child(m.index()).isText && m.index() == y.index() - (y.textOffset ? 0 : 1)) {
|
|
14236
|
-
let M = m.parent.textBetween(m.parentOffset, y.parentOffset), O = () =>
|
|
14237
|
-
n.someProp("handleTextInput", (I) => I(n, w,
|
|
14248
|
+
let M = m.parent.textBetween(m.parentOffset, y.parentOffset), O = () => k(n.state.tr.insertText(M, w, S));
|
|
14249
|
+
n.someProp("handleTextInput", (I) => I(n, w, S, M, O)) || n.dispatch(O());
|
|
14238
14250
|
} else
|
|
14239
|
-
n.dispatch(
|
|
14251
|
+
n.dispatch(k());
|
|
14240
14252
|
else
|
|
14241
|
-
n.dispatch(
|
|
14253
|
+
n.dispatch(k());
|
|
14242
14254
|
}
|
|
14243
14255
|
function Lo(n, e, t) {
|
|
14244
14256
|
return Math.max(t.anchor, t.head) > e.content.size ? null : Yr(n, e.resolve(t.anchor), e.resolve(t.head));
|
|
@@ -15302,8 +15314,8 @@ var Cm = (n) => !("type" in n), km = (n, e, t) => ({ tr: i, dispatch: r, editor:
|
|
|
15302
15314
|
i.insertText(m, d, u);
|
|
15303
15315
|
} else {
|
|
15304
15316
|
m = l;
|
|
15305
|
-
const y = i.doc.resolve(d), v = y.node(), b = y.parentOffset === 0, w = v.isText || v.isTextblock,
|
|
15306
|
-
b && w &&
|
|
15317
|
+
const y = i.doc.resolve(d), v = y.node(), b = y.parentOffset === 0, w = v.isText || v.isTextblock, S = v.content.size > 0;
|
|
15318
|
+
b && w && S && (d = Math.max(0, d - 1)), i.replaceWith(d, u, m);
|
|
15307
15319
|
}
|
|
15308
15320
|
t.updateSelection && wm(i, i.steps.length - 1, -1), t.applyInputRules && i.setMeta("applyInputRules", { from: d, text: m }), t.applyPasteRules && i.setMeta("applyPasteRules", { from: d, text: m });
|
|
15309
15321
|
}
|
|
@@ -15860,8 +15872,8 @@ function Ir(n, e, t = {}) {
|
|
|
15860
15872
|
return;
|
|
15861
15873
|
const v = Math.max(f, y), b = Math.min(p, y + m.nodeSize), w = b - v;
|
|
15862
15874
|
o += w, l.push(
|
|
15863
|
-
...m.marks.map((
|
|
15864
|
-
mark:
|
|
15875
|
+
...m.marks.map((S) => ({
|
|
15876
|
+
mark: S,
|
|
15865
15877
|
from: v,
|
|
15866
15878
|
to: b
|
|
15867
15879
|
}))
|
|
@@ -16082,11 +16094,11 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16082
16094
|
const w = (
|
|
16083
16095
|
// eslint-disable-next-line no-nested-ternary
|
|
16084
16096
|
a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3
|
|
16085
|
-
),
|
|
16097
|
+
), S = {
|
|
16086
16098
|
...Un(h, a.node().type.name, a.node().attrs),
|
|
16087
16099
|
...e
|
|
16088
|
-
},
|
|
16089
|
-
v = v.append(C.from(l.createAndFill(null,
|
|
16100
|
+
}, k = ((o = l.contentMatch.defaultType) == null ? void 0 : o.createAndFill(S)) || void 0;
|
|
16101
|
+
v = v.append(C.from(l.createAndFill(null, k) || void 0));
|
|
16090
16102
|
const _ = a.before(a.depth - (b - 1));
|
|
16091
16103
|
t.replace(_, a.after(-w), new x(v, 4 - b, 0));
|
|
16092
16104
|
let M = -1;
|
|
@@ -16113,11 +16125,11 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16113
16125
|
if (!Vt(t.doc, a.pos, 2))
|
|
16114
16126
|
return !1;
|
|
16115
16127
|
if (r) {
|
|
16116
|
-
const { selection: v, storedMarks: b } = i, { splittableMarks: w } = s.extensionManager,
|
|
16117
|
-
if (t.split(a.pos, 2, y).scrollIntoView(), !
|
|
16128
|
+
const { selection: v, storedMarks: b } = i, { splittableMarks: w } = s.extensionManager, S = b || v.$to.parentOffset && v.$from.marks();
|
|
16129
|
+
if (t.split(a.pos, 2, y).scrollIntoView(), !S || !r)
|
|
16118
16130
|
return !0;
|
|
16119
|
-
const
|
|
16120
|
-
t.ensureMarks(
|
|
16131
|
+
const k = S.filter((_) => w.includes(_.type.name));
|
|
16132
|
+
t.ensureMarks(k);
|
|
16121
16133
|
}
|
|
16122
16134
|
return !0;
|
|
16123
16135
|
}, nr = (n, e) => {
|
|
@@ -16139,18 +16151,18 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16139
16151
|
const r = n.doc.nodeAt(i);
|
|
16140
16152
|
return t.node.type === (r == null ? void 0 : r.type) && At(n.doc, i) && n.join(i), !0;
|
|
16141
16153
|
}, w0 = (n, e, t, i = {}) => ({ editor: r, tr: s, state: o, dispatch: l, chain: a, commands: c, can: d }) => {
|
|
16142
|
-
const { extensions: u, splittableMarks: h } = r.extensionManager, f = te(n, o.schema), p = te(e, o.schema), { selection: m, storedMarks: y } = o, { $from: v, $to: b } = m, w = v.blockRange(b),
|
|
16154
|
+
const { extensions: u, splittableMarks: h } = r.extensionManager, f = te(n, o.schema), p = te(e, o.schema), { selection: m, storedMarks: y } = o, { $from: v, $to: b } = m, w = v.blockRange(b), S = y || m.$to.parentOffset && m.$from.marks();
|
|
16143
16155
|
if (!w)
|
|
16144
16156
|
return !1;
|
|
16145
|
-
const
|
|
16146
|
-
if (w.depth >= 1 &&
|
|
16147
|
-
if (
|
|
16157
|
+
const k = ss((_) => Go(_.type.name, u))(m);
|
|
16158
|
+
if (w.depth >= 1 && k && w.depth - k.depth <= 1) {
|
|
16159
|
+
if (k.node.type === f)
|
|
16148
16160
|
return c.liftListItem(p);
|
|
16149
|
-
if (Go(
|
|
16150
|
-
return a().command(() => (s.setNodeMarkup(
|
|
16161
|
+
if (Go(k.node.type.name, u) && f.validContent(k.node.content) && l)
|
|
16162
|
+
return a().command(() => (s.setNodeMarkup(k.pos, f), !0)).command(() => nr(s, f)).command(() => ir(s, f)).run();
|
|
16151
16163
|
}
|
|
16152
|
-
return !t || !
|
|
16153
|
-
const _ = d().wrapInList(f, i), M =
|
|
16164
|
+
return !t || !S || !l ? a().command(() => d().wrapInList(f, i) ? !0 : c.clearNodes()).wrapInList(f, i).command(() => nr(s, f)).command(() => ir(s, f)).run() : a().command(() => {
|
|
16165
|
+
const _ = d().wrapInList(f, i), M = S.filter((O) => h.includes(O.type.name));
|
|
16154
16166
|
return s.ensureMarks(M), _ ? !0 : c.clearNodes();
|
|
16155
16167
|
}).wrapInList(f, i).command(() => nr(s, f)).command(() => ir(s, f)).run();
|
|
16156
16168
|
}, C0 = (n, e = {}, t = {}) => ({ state: i, commands: r }) => {
|
|
@@ -16232,10 +16244,10 @@ var v0 = ({ keepMarks: n = !0 } = {}) => ({ tr: e, state: t, dispatch: i, editor
|
|
|
16232
16244
|
...e
|
|
16233
16245
|
})), o && y.marks.length && y.marks.forEach((b) => {
|
|
16234
16246
|
if (o === b.type && (a = !0, r)) {
|
|
16235
|
-
const w = Math.max(v, d),
|
|
16247
|
+
const w = Math.max(v, d), S = Math.min(v + y.nodeSize, u);
|
|
16236
16248
|
t.addMark(
|
|
16237
16249
|
w,
|
|
16238
|
-
|
|
16250
|
+
S,
|
|
16239
16251
|
o.create({
|
|
16240
16252
|
...b.attrs,
|
|
16241
16253
|
...e
|
|
@@ -16519,14 +16531,14 @@ function B0(n) {
|
|
|
16519
16531
|
var m, y, v, b, w;
|
|
16520
16532
|
if ((y = (m = f.type) == null ? void 0 : m.spec) != null && y.code || !(f.isText || f.isTextblock || f.isInline))
|
|
16521
16533
|
return;
|
|
16522
|
-
const
|
|
16523
|
-
if (
|
|
16534
|
+
const S = (w = (b = (v = f.content) == null ? void 0 : v.size) != null ? b : f.nodeSize) != null ? w : 0, k = Math.max(i, p), _ = Math.min(r, p + S);
|
|
16535
|
+
if (k >= _)
|
|
16524
16536
|
return;
|
|
16525
|
-
const M = f.isText ? f.text || "" : f.textBetween(
|
|
16537
|
+
const M = f.isText ? f.text || "" : f.textBetween(k - p, _ - p, void 0, "");
|
|
16526
16538
|
L0(M, s.find, o).forEach((I) => {
|
|
16527
16539
|
if (I.index === void 0)
|
|
16528
16540
|
return;
|
|
16529
|
-
const ue =
|
|
16541
|
+
const ue = k + I.index + 1, me = ue + I[0].length, Ne = {
|
|
16530
16542
|
from: t.tr.mapping.map(ue),
|
|
16531
16543
|
to: t.tr.mapping.map(me)
|
|
16532
16544
|
}, Ai = s.handler({
|
|
@@ -16625,9 +16637,9 @@ function V0(n) {
|
|
|
16625
16637
|
if (!m && !y && !b)
|
|
16626
16638
|
return;
|
|
16627
16639
|
if (b) {
|
|
16628
|
-
let { text:
|
|
16629
|
-
typeof
|
|
16630
|
-
const { from: _ } = v, M = _ +
|
|
16640
|
+
let { text: k } = v;
|
|
16641
|
+
typeof k == "string" ? k = k : k = as(C.from(k), f.schema);
|
|
16642
|
+
const { from: _ } = v, M = _ + k.length, O = F0(k);
|
|
16631
16643
|
return a({
|
|
16632
16644
|
rule: d,
|
|
16633
16645
|
state: f,
|
|
@@ -16636,13 +16648,13 @@ function V0(n) {
|
|
|
16636
16648
|
pasteEvt: O
|
|
16637
16649
|
});
|
|
16638
16650
|
}
|
|
16639
|
-
const w = h.doc.content.findDiffStart(f.doc.content),
|
|
16640
|
-
if (!(!$0(w) || !
|
|
16651
|
+
const w = h.doc.content.findDiffStart(f.doc.content), S = h.doc.content.findDiffEnd(f.doc.content);
|
|
16652
|
+
if (!(!$0(w) || !S || w === S.b))
|
|
16641
16653
|
return a({
|
|
16642
16654
|
rule: d,
|
|
16643
16655
|
state: f,
|
|
16644
16656
|
from: w,
|
|
16645
|
-
to:
|
|
16657
|
+
to: S,
|
|
16646
16658
|
pasteEvt: o
|
|
16647
16659
|
});
|
|
16648
16660
|
}
|
|
@@ -16933,7 +16945,7 @@ var X = class Dc extends us {
|
|
|
16933
16945
|
d.steps.forEach((f, p) => {
|
|
16934
16946
|
var m, y;
|
|
16935
16947
|
if (f instanceof Oe) {
|
|
16936
|
-
const v = h.slice(p).map(f.from, -1), b = h.slice(p).map(f.to), w = h.invert().map(v, -1),
|
|
16948
|
+
const v = h.slice(p).map(f.from, -1), b = h.slice(p).map(f.to), w = h.invert().map(v, -1), S = h.invert().map(b), k = (m = d.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((M) => M.eq(f.mark)), _ = (y = d.doc.nodeAt(b)) == null ? void 0 : y.marks.some((M) => M.eq(f.mark));
|
|
16937
16949
|
this.editor.emit("delete", {
|
|
16938
16950
|
type: "mark",
|
|
16939
16951
|
mark: f.mark,
|
|
@@ -16941,13 +16953,13 @@ var X = class Dc extends us {
|
|
|
16941
16953
|
to: f.to,
|
|
16942
16954
|
deletedRange: {
|
|
16943
16955
|
from: w,
|
|
16944
|
-
to:
|
|
16956
|
+
to: S
|
|
16945
16957
|
},
|
|
16946
16958
|
newRange: {
|
|
16947
16959
|
from: v,
|
|
16948
16960
|
to: b
|
|
16949
16961
|
},
|
|
16950
|
-
partial: !!(_ ||
|
|
16962
|
+
partial: !!(_ || k),
|
|
16951
16963
|
editor: this.editor,
|
|
16952
16964
|
transaction: n,
|
|
16953
16965
|
combinedTransform: d
|
|
@@ -18127,10 +18139,10 @@ function Z0(n) {
|
|
|
18127
18139
|
if (!y)
|
|
18128
18140
|
return;
|
|
18129
18141
|
const [v, b = ""] = y, w = r(b);
|
|
18130
|
-
let
|
|
18131
|
-
const
|
|
18142
|
+
let S = 1;
|
|
18143
|
+
const k = v.length;
|
|
18132
18144
|
let _ = "";
|
|
18133
|
-
const M = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(
|
|
18145
|
+
const M = /^:::([\w-]*)(\s.*)?/gm, O = u.slice(k);
|
|
18134
18146
|
for (M.lastIndex = 0; ; ) {
|
|
18135
18147
|
const I = M.exec(O);
|
|
18136
18148
|
if (I === null)
|
|
@@ -18138,11 +18150,11 @@ function Z0(n) {
|
|
|
18138
18150
|
const ue = I.index, me = I[1];
|
|
18139
18151
|
if (!((p = I[2]) != null && p.endsWith(":::"))) {
|
|
18140
18152
|
if (me)
|
|
18141
|
-
|
|
18142
|
-
else if (
|
|
18153
|
+
S += 1;
|
|
18154
|
+
else if (S -= 1, S === 0) {
|
|
18143
18155
|
const Ne = O.slice(0, ue);
|
|
18144
18156
|
_ = Ne.trim();
|
|
18145
|
-
const Ai = u.slice(0,
|
|
18157
|
+
const Ai = u.slice(0, k + ue + I[0].length);
|
|
18146
18158
|
let Xe = [];
|
|
18147
18159
|
if (_)
|
|
18148
18160
|
if (l === "block")
|
|
@@ -18228,11 +18240,11 @@ function t1(n) {
|
|
|
18228
18240
|
return;
|
|
18229
18241
|
let v = "", b = "";
|
|
18230
18242
|
if (l) {
|
|
18231
|
-
const [,
|
|
18232
|
-
b =
|
|
18243
|
+
const [, S] = y;
|
|
18244
|
+
b = S;
|
|
18233
18245
|
} else {
|
|
18234
|
-
const [,
|
|
18235
|
-
b =
|
|
18246
|
+
const [, S, k] = y;
|
|
18247
|
+
b = S, v = k || "";
|
|
18236
18248
|
}
|
|
18237
18249
|
const w = r(b.trim());
|
|
18238
18250
|
return {
|
|
@@ -18271,30 +18283,30 @@ function n1(n, e, t) {
|
|
|
18271
18283
|
c = "".concat(c).concat(h, "\n");
|
|
18272
18284
|
const v = [y];
|
|
18273
18285
|
for (d += 1; d < l.length; ) {
|
|
18274
|
-
const
|
|
18275
|
-
if (
|
|
18286
|
+
const k = l[d];
|
|
18287
|
+
if (k.trim() === "") {
|
|
18276
18288
|
const M = l.slice(d + 1).findIndex((ue) => ue.trim() !== "");
|
|
18277
18289
|
if (M === -1)
|
|
18278
18290
|
break;
|
|
18279
18291
|
if ((((r = (i = l[d + 1 + M].match(/^(\s*)/)) == null ? void 0 : i[1]) == null ? void 0 : r.length) || 0) > m) {
|
|
18280
|
-
v.push(
|
|
18292
|
+
v.push(k), c = "".concat(c).concat(k, "\n"), d += 1;
|
|
18281
18293
|
continue;
|
|
18282
18294
|
} else
|
|
18283
18295
|
break;
|
|
18284
18296
|
}
|
|
18285
|
-
if ((((o = (s =
|
|
18286
|
-
v.push(
|
|
18297
|
+
if ((((o = (s = k.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : o.length) || 0) > m)
|
|
18298
|
+
v.push(k), c = "".concat(c).concat(k, "\n"), d += 1;
|
|
18287
18299
|
else
|
|
18288
18300
|
break;
|
|
18289
18301
|
}
|
|
18290
18302
|
let b;
|
|
18291
18303
|
const w = v.slice(1);
|
|
18292
18304
|
if (w.length > 0) {
|
|
18293
|
-
const
|
|
18294
|
-
|
|
18305
|
+
const k = w.map((_) => _.slice(m + u)).join("\n");
|
|
18306
|
+
k.trim() && (e.customNestedParser ? b = e.customNestedParser(k) : b = t.blockTokens(k));
|
|
18295
18307
|
}
|
|
18296
|
-
const
|
|
18297
|
-
a.push(
|
|
18308
|
+
const S = e.createToken(p, b);
|
|
18309
|
+
a.push(S);
|
|
18298
18310
|
}
|
|
18299
18311
|
if (a.length !== 0)
|
|
18300
18312
|
return {
|
|
@@ -19589,20 +19601,20 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19589
19601
|
}, s.current.onend = () => {
|
|
19590
19602
|
r.value = !1;
|
|
19591
19603
|
}, s.current.onresult = (v) => {
|
|
19592
|
-
var w,
|
|
19593
|
-
const b = (
|
|
19604
|
+
var w, S, k, _;
|
|
19605
|
+
const b = (k = (S = (w = v.results) == null ? void 0 : w[0]) == null ? void 0 : S[0]) == null ? void 0 : k.transcript;
|
|
19594
19606
|
b && ((_ = o.current) == null || _.commands.insertContent(b));
|
|
19595
19607
|
});
|
|
19596
19608
|
const l = () => {
|
|
19597
19609
|
s.current && !r.value && s.current.start();
|
|
19598
19610
|
}, a = (v) => {
|
|
19599
19611
|
const b = new DOMParser().parseFromString(v, "text/html");
|
|
19600
|
-
function w(
|
|
19601
|
-
if (
|
|
19602
|
-
return
|
|
19603
|
-
if (
|
|
19612
|
+
function w(k) {
|
|
19613
|
+
if (k.nodeType === Node.TEXT_NODE)
|
|
19614
|
+
return k.textContent || "";
|
|
19615
|
+
if (k.nodeType !== Node.ELEMENT_NODE)
|
|
19604
19616
|
return "";
|
|
19605
|
-
const _ =
|
|
19617
|
+
const _ = k, M = _.tagName.toLowerCase(), O = Array.from(_.childNodes).map((I) => w(I)).join("");
|
|
19606
19618
|
switch (M) {
|
|
19607
19619
|
case "p":
|
|
19608
19620
|
return "".concat(O, "\n");
|
|
@@ -19611,11 +19623,11 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19611
19623
|
return I ? "\n.concat(I, ")\n") : "";
|
|
19612
19624
|
}
|
|
19613
19625
|
default:
|
|
19614
|
-
return
|
|
19626
|
+
return k.textContent || "";
|
|
19615
19627
|
}
|
|
19616
19628
|
}
|
|
19617
19629
|
return Array.from(b.body.childNodes).map(w).join("").replace(/\n+/g, "\n").replace(/^\n|\n$/g, "");
|
|
19618
|
-
}, c =
|
|
19630
|
+
}, c = Ce(() => a(i.value).length <= 0), d = Ts(async () => {
|
|
19619
19631
|
var v;
|
|
19620
19632
|
try {
|
|
19621
19633
|
const b = a(i.value);
|
|
@@ -19705,16 +19717,16 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19705
19717
|
}
|
|
19706
19718
|
),
|
|
19707
19719
|
(y = n.questionToolbarItems) == null ? void 0 : y.map((v) => {
|
|
19708
|
-
var b, w,
|
|
19720
|
+
var b, w, S;
|
|
19709
19721
|
return /* @__PURE__ */ g(
|
|
19710
19722
|
"div",
|
|
19711
19723
|
{
|
|
19712
19724
|
className: j.b("pop-action-item"),
|
|
19713
|
-
onClick: (
|
|
19714
|
-
p(
|
|
19725
|
+
onClick: (k) => {
|
|
19726
|
+
p(k, v);
|
|
19715
19727
|
},
|
|
19716
19728
|
children: [
|
|
19717
|
-
/* @__PURE__ */ g("span", { className: j.b("pop-action-item-icon"), children: typeof v.icon == "function" ? v.icon() : ((b = v.icon) == null ? void 0 : b.showIcon) && /* @__PURE__ */ g(ze, { children: (w = v.icon) != null && w.cssClass ? /* @__PURE__ */ g("i", { className: v.icon.cssClass }) : (
|
|
19729
|
+
/* @__PURE__ */ g("span", { className: j.b("pop-action-item-icon"), children: typeof v.icon == "function" ? v.icon() : ((b = v.icon) == null ? void 0 : b.showIcon) && /* @__PURE__ */ g(ze, { children: (w = v.icon) != null && w.cssClass ? /* @__PURE__ */ g("i", { className: v.icon.cssClass }) : (S = v.icon) != null && S.imagePath ? fi(v.icon.imagePath) ? /* @__PURE__ */ g(
|
|
19718
19730
|
"div",
|
|
19719
19731
|
{
|
|
19720
19732
|
dangerouslySetInnerHTML: {
|
|
@@ -19774,8 +19786,8 @@ const j = new L("chat-input"), il = window.SpeechRecognition || window.webkitSpe
|
|
|
19774
19786
|
] })
|
|
19775
19787
|
] });
|
|
19776
19788
|
};
|
|
19777
|
-
const
|
|
19778
|
-
const { controller: e, topic: t, onClick: i, onAction: r } = n, s = se(null), o =
|
|
19789
|
+
const be = new L("chat-topic-item"), $1 = (n) => {
|
|
19790
|
+
const { controller: e, topic: t, onClick: i, onAction: r } = n, s = se(null), o = Ce(() => {
|
|
19779
19791
|
var y;
|
|
19780
19792
|
return ((y = e.activedTopic.value) == null ? void 0 : y.id) === t.id;
|
|
19781
19793
|
}), [l, a] = xe(!1), c = F(!1), d = (m) => {
|
|
@@ -19796,13 +19808,13 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19796
19808
|
return /* @__PURE__ */ g(
|
|
19797
19809
|
"div",
|
|
19798
19810
|
{
|
|
19799
|
-
className: "".concat(
|
|
19811
|
+
className: "".concat(be.b(), " ").concat(be.is("active", o.value), " ").concat(be.is(
|
|
19800
19812
|
"edit",
|
|
19801
19813
|
c.value
|
|
19802
19814
|
)),
|
|
19803
19815
|
onClick: i.bind(void 0),
|
|
19804
19816
|
children: [
|
|
19805
|
-
/* @__PURE__ */ g("div", { className:
|
|
19817
|
+
/* @__PURE__ */ g("div", { className: be.e("caption"), title: t.caption, children: c.value ? /* @__PURE__ */ g(
|
|
19806
19818
|
"input",
|
|
19807
19819
|
{
|
|
19808
19820
|
ref: s,
|
|
@@ -19811,20 +19823,20 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19811
19823
|
onKeyDown: p,
|
|
19812
19824
|
onClick: (m) => m.stopPropagation(),
|
|
19813
19825
|
onChange: (m) => h(m),
|
|
19814
|
-
className:
|
|
19826
|
+
className: be.em("caption", "editor")
|
|
19815
19827
|
}
|
|
19816
|
-
) : /* @__PURE__ */ g("div", { className:
|
|
19817
|
-
/* @__PURE__ */ g("span", { className:
|
|
19818
|
-
t.isTop ? /* @__PURE__ */ g("span", { className:
|
|
19828
|
+
) : /* @__PURE__ */ g("div", { className: be.em("caption", "readonly"), children: [
|
|
19829
|
+
/* @__PURE__ */ g("span", { className: be.em("caption", "text"), children: t.caption }),
|
|
19830
|
+
t.isTop ? /* @__PURE__ */ g("span", { className: be.em("caption", "icon"), children: /* @__PURE__ */ g(As, {}) }) : null
|
|
19819
19831
|
] }) }),
|
|
19820
|
-
!c.value && /* @__PURE__ */ g("div", { className:
|
|
19832
|
+
!c.value && /* @__PURE__ */ g("div", { className: be.e("icon"), children: [
|
|
19821
19833
|
/* @__PURE__ */ g(
|
|
19822
19834
|
"span",
|
|
19823
19835
|
{
|
|
19824
19836
|
title: "跳转主视图",
|
|
19825
|
-
className:
|
|
19837
|
+
className: be.em("icon", "item"),
|
|
19826
19838
|
onClick: d.bind(void 0),
|
|
19827
|
-
children: /* @__PURE__ */ g($d, { className:
|
|
19839
|
+
children: /* @__PURE__ */ g($d, { className: be.b("link-icon") })
|
|
19828
19840
|
}
|
|
19829
19841
|
),
|
|
19830
19842
|
o.value ? null : /* @__PURE__ */ g(
|
|
@@ -19843,7 +19855,7 @@ const ve = new L("chat-topic-item"), $1 = (n) => {
|
|
|
19843
19855
|
isOpen: l,
|
|
19844
19856
|
onToggleOpen: a,
|
|
19845
19857
|
onAction: u.bind(void 0),
|
|
19846
|
-
children: /* @__PURE__ */ g("span", { className:
|
|
19858
|
+
children: /* @__PURE__ */ g("span", { className: be.em("icon", "item"), title: "更多", children: /* @__PURE__ */ g(zd, { className: be.e("more-icon") }) })
|
|
19847
19859
|
}
|
|
19848
19860
|
)
|
|
19849
19861
|
] })
|
|
@@ -19945,14 +19957,14 @@ const Rt = new L("chat-minimize"), F1 = (n) => {
|
|
|
19945
19957
|
const e = se(null), [t, i] = xe(""), [r, s] = xe(0), o = se(!1), l = {
|
|
19946
19958
|
x: (window.innerWidth - 86) / window.innerWidth,
|
|
19947
19959
|
y: (window.innerHeight - 86) / window.innerHeight
|
|
19948
|
-
}, a =
|
|
19960
|
+
}, a = Ce(() => {
|
|
19949
19961
|
const p = n.controller.messages.value[n.controller.messages.value.length - 1];
|
|
19950
19962
|
return p ? p.role === "ASSISTANT" && p.state === 20 && p.completed !== !0 : !1;
|
|
19951
19963
|
}), c = (p) => {
|
|
19952
19964
|
const m = p.indexOf("<think>"), y = p.indexOf("</think>");
|
|
19953
19965
|
let v = "", b = "";
|
|
19954
19966
|
return y === -1 ? (v = p.slice(m + 7), b = "") : (v = p.slice(m + 7, y), b = p.slice(y + 8)), { thoughtContent: v, answerContent: b };
|
|
19955
|
-
}, d =
|
|
19967
|
+
}, d = Ce(() => {
|
|
19956
19968
|
let p = "";
|
|
19957
19969
|
if (!a.value)
|
|
19958
19970
|
return i(""), s(0), p;
|
|
@@ -19976,21 +19988,21 @@ const Rt = new L("chat-minimize"), F1 = (n) => {
|
|
|
19976
19988
|
const p = e.current;
|
|
19977
19989
|
p && (p.onmousedown = (m) => {
|
|
19978
19990
|
document.body.style.userSelect = "none";
|
|
19979
|
-
const y = m.clientX - p.offsetLeft, v = m.clientY - p.offsetTop, b = Date.now(), w = (
|
|
19991
|
+
const y = m.clientX - p.offsetLeft, v = m.clientY - p.offsetTop, b = Date.now(), w = (k) => {
|
|
19980
19992
|
const _ = 56 / window.innerWidth, M = 56 / window.innerHeight, { x: O, y: I } = _l(
|
|
19981
|
-
|
|
19982
|
-
|
|
19993
|
+
k.clientX - y,
|
|
19994
|
+
k.clientY - v,
|
|
19983
19995
|
_,
|
|
19984
19996
|
M
|
|
19985
19997
|
);
|
|
19986
19998
|
Object.assign(l, { x: O, y: I }), requestAnimationFrame(() => {
|
|
19987
19999
|
u();
|
|
19988
20000
|
});
|
|
19989
|
-
},
|
|
19990
|
-
const
|
|
19991
|
-
o.current =
|
|
20001
|
+
}, S = () => {
|
|
20002
|
+
const k = Date.now();
|
|
20003
|
+
o.current = k - b > 300, document.body.style.userSelect = "", document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", S);
|
|
19992
20004
|
};
|
|
19993
|
-
document.addEventListener("mousemove", w), document.addEventListener("mouseup",
|
|
20005
|
+
document.addEventListener("mousemove", w), document.addEventListener("mouseup", S);
|
|
19994
20006
|
});
|
|
19995
20007
|
}, f = () => {
|
|
19996
20008
|
o.current || n.onClick();
|