@freecallai/pro 0.0.1 → 0.0.3
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 +23 -17
- package/dist/FkpKnowledgeTypePicker.vue_vue_type_script_setup_true_lang-xR8ZhhdJ.js +187 -0
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-CaHRIHab.js +4864 -0
- package/dist/KnowledgeArea-_rsydhnt.js +1438 -0
- package/dist/{ToolForm-CWpUIVTl.js → ToolForm-Czg67cDT.js} +1 -1
- package/dist/{choice-DDg5gNtS.js → choice-Bt2xhoN_.js} +1 -1
- package/dist/edition-info/index.js +4 -0
- package/dist/filters/index.js +7 -0
- package/dist/guard-B7U3S4F1.js +1163 -0
- package/dist/{index-D8bcFtWR.js → index-9NM1SHoR.js} +1 -1
- package/dist/index-B4-2_sJI.js +10 -0
- package/dist/{index-DOEijEGU.js → index-BBv72oZe.js} +10 -10
- package/dist/index-BF6MRSMb.js +6 -0
- package/dist/index-BQrYBmwR.js +5 -0
- package/dist/index-CS2xQQ8W.js +168 -0
- package/dist/index-D0bJAQSN.js +327 -0
- package/dist/index-D9yqpH_4.js +57 -0
- package/dist/index-DCmHHi07.js +71 -0
- package/dist/index-DYeJRJY1.js +6 -0
- package/dist/{index-CJlAseSN.js → index-DnaEbb6l.js} +1 -1
- package/dist/{index-DSgEWJGP.js → index-Dy2Gy3bL.js} +1 -1
- package/dist/index-lNhA3N9x.js +379 -0
- package/dist/{index-5a9mHHzg.js → index-sjDmbR5o.js} +1 -1
- package/dist/index-trxE5T0w.js +6 -0
- package/dist/index-uCVrA6xK.js +5 -0
- package/dist/index.js +36 -11
- package/dist/inline-KPGqYMIR.js +19 -0
- package/dist/knowledge-CupkY2rK.js +6 -0
- package/dist/{knowledge-DnYGicjn.js → knowledge-DzwXQR-q.js} +1 -1
- package/dist/knowledge-type-picker/index.js +5 -0
- package/dist/media-extensions-DhRlLKYM.js +321 -0
- package/dist/{media-migration-CGOFwdYm.js → media-migration-CbMT2wS0.js} +1 -1
- package/dist/{media-upload-Dx45yv6a.js → media-upload-P9WeUHHr.js} +1 -1
- package/dist/navigation/index.js +4 -0
- package/dist/operations-D8pn-_iW.js +20 -0
- package/dist/{question-DGC6JHy5.js → question-C7akkjHn.js} +1 -1
- package/dist/{question-D1--acV8.js → question-DXZ8R-34.js} +1 -1
- package/dist/rich-text/index.js +57 -53
- package/dist/rich-text/legacy-converter/index.js +1271 -340
- package/dist/style.css +1 -1
- package/dist/switcher/index.js +4 -0
- package/dist/types/edition-info/FkpEditionInfo.vue.d.ts +5 -0
- package/dist/types/edition-info/index.d.ts +2 -0
- package/dist/types/edition-info/types.d.ts +5 -0
- package/dist/types/filters/FkpFilter.vue.d.ts +20 -0
- package/dist/types/filters/FkpFilterDateRange.vue.d.ts +13 -0
- package/dist/types/filters/FkpFilterPeriod.vue.d.ts +17 -0
- package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +44 -0
- package/dist/types/filters/index.d.ts +5 -0
- package/dist/types/filters/selection.d.ts +5 -0
- package/dist/types/filters/types.d.ts +30 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/knowledge-type-picker/index.d.ts +3 -0
- package/dist/types/navigation/FkpNavigation.vue.d.ts +51 -0
- package/dist/types/navigation/index.d.ts +2 -0
- package/dist/types/navigation/types.d.ts +15 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +31 -7
- package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +2 -2
- package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +11 -0
- package/dist/types/rich-text/config/descriptor.d.ts +25 -2
- package/dist/types/rich-text/config/resolve.d.ts +2 -0
- package/dist/types/rich-text/index.d.ts +3 -1
- package/dist/types/rich-text/legacy-converter/agent-prompt-preview.d.ts +2 -0
- package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +12 -0
- package/dist/types/rich-text/legacy-converter/index.d.ts +8 -0
- package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +1 -0
- package/dist/types/rich-text/model/guard.d.ts +2 -1
- package/dist/types/rich-text/model/node-contract.d.ts +3 -5
- package/dist/types/rich-text/model/node-identity.d.ts +7 -1
- package/dist/types/rich-text/model/question-text.d.ts +2 -4
- package/dist/types/rich-text/plugins/attribute/token.d.ts +9 -0
- package/dist/types/rich-text/plugins/operations.d.ts +9 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/defaults.d.ts +14 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/examples.d.ts +9 -0
- package/dist/types/rich-text/plugins/separator/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/tableKnowledge/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tableKnowledge/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/tableKnowledge/token.d.ts +9 -0
- package/dist/types/rich-text/plugins/ticket/protocol.d.ts +8 -0
- package/dist/types/rich-text/plugins/ticket/token.d.ts +9 -0
- package/dist/types/rich-text/plugins/todo/token.d.ts +3 -0
- package/dist/types/rich-text/plugins/token-catalog.d.ts +46 -0
- package/dist/types/rich-text/plugins/token-definition.d.ts +24 -0
- package/dist/types/rich-text/plugins/tool/presentation.d.ts +2 -1
- package/dist/types/rich-text/plugins/tool/protocol.d.ts +5 -0
- package/dist/types/rich-text/plugins/tool/rules.d.ts +35 -0
- package/dist/types/rich-text/plugins/tool/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/variable/token.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +73 -6
- package/dist/types/rich-text/runtime/action-ports.d.ts +6 -1
- package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
- package/dist/types/rich-text/runtime/knowledge-clipboard.d.ts +16 -0
- package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
- package/dist/types/rich-text/runtime/media-target.d.ts +3 -0
- package/dist/types/rich-text/runtime/media-upload-session.d.ts +5 -1
- package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
- package/dist/types/rich-text/runtime/schema-plan.d.ts +1 -0
- package/dist/types/rich-text/types.d.ts +3 -40
- package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +38 -0
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +12 -1
- package/dist/types/rich-text/ui/knowledge-type-picker-types.d.ts +14 -0
- package/dist/types/rich-text/ui/token-renderer.d.ts +5 -0
- package/dist/types/switcher/FkpSwitcher.vue.d.ts +52 -0
- package/dist/types/switcher/index.d.ts +2 -0
- package/dist/types/switcher/types.d.ts +7 -0
- package/package.json +26 -6
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +0 -4115
- package/dist/KnowledgeArea-OPR7smbt.js +0 -923
- package/dist/guard-BCatAeT4.js +0 -749
- package/dist/index-BsQLwz91.js +0 -5
- package/dist/index-CzpY61Qj.js +0 -6
- package/dist/index-DxxX09iY.js +0 -6
- package/dist/index-nnvfy5q0.js +0 -31
- package/dist/index-urNonkMH.js +0 -6
- package/dist/index-xAjlBylT.js +0 -5
- package/dist/inline-TT_dl8Y3.js +0 -17
- package/dist/knowledge-BZCmalF_.js +0 -6
- package/dist/media-extensions-ZoxmhIhH.js +0 -276
- package/dist/operations-JgnjGx3H.js +0 -19
|
@@ -1,4115 +0,0 @@
|
|
|
1
|
-
import { ref as Q, shallowRef as Ot, defineComponent as Cn, openBlock as E, createElementBlock as C, normalizeClass as Ke, createElementVNode as _, toDisplayString as Z, createBlock as le, unref as k, withCtx as K, createVNode as x, createTextVNode as ye, createCommentVNode as $, computed as te, watch as me, Fragment as Ae, renderList as Ge, defineAsyncComponent as ro, nextTick as ze, onMounted as fi, onBeforeUnmount as pi, withKeys as Sn, withModifiers as tn, normalizeStyle as uo, createSlots as An, isRef as gi } from "vue";
|
|
2
|
-
import { Button as ee, Popover as ft, Switch as co, Input as vi, Drawer as yi, Modal as fo, Textarea as ki } from "@freecallai/ui";
|
|
3
|
-
import de from "@freecallai/icons";
|
|
4
|
-
import { IconExclamationCircleFill as mi, IconClose as bi, IconDelete as hi } from "@freecallai/ui/es/icon/index.js";
|
|
5
|
-
import { c as Nt, o as ho, f as kt, i as wi, d as wo, h as _n, b as Ut, e as Si, g as Pn, j as po, k as Ai, l as Ti, m as Ii, M as Ei, B as Ni, n as Oi } from "./guard-BCatAeT4.js";
|
|
6
|
-
function Ft(n, o) {
|
|
7
|
-
if (!n || typeof n != "object" || Array.isArray(n)) return null;
|
|
8
|
-
const i = n;
|
|
9
|
-
return Object.keys(i).some((a) => !["maxBytes", "mimeTypes"].includes(a)) || i.maxBytes !== void 0 && (!Number.isSafeInteger(i.maxBytes) || i.maxBytes <= 0) || i.mimeTypes !== void 0 && (!Array.isArray(i.mimeTypes) || !i.mimeTypes.every(
|
|
10
|
-
(a) => typeof a == "string" && new RegExp(`^${o}/[a-z0-9.+-]+$`, "i").test(a)
|
|
11
|
-
)) ? null : {
|
|
12
|
-
...i.maxBytes !== void 0 ? { maxBytes: i.maxBytes } : {},
|
|
13
|
-
...i.mimeTypes !== void 0 ? {
|
|
14
|
-
mimeTypes: [...new Set(i.mimeTypes)].sort()
|
|
15
|
-
} : {}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function Ci(n, o) {
|
|
19
|
-
let i, a;
|
|
20
|
-
for (const c of n)
|
|
21
|
-
if (c && (c.maxBytes !== void 0 && (i !== void 0 && c.maxBytes > i && o(), i = Math.min(i ?? c.maxBytes, c.maxBytes)), c.mimeTypes !== void 0)) {
|
|
22
|
-
const p = a, v = c.mimeTypes;
|
|
23
|
-
p && v.some((m) => !p.includes(m)) && o(), a = p ? p.filter((m) => v.includes(m)) : v;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
...i !== void 0 ? { maxBytes: i } : {},
|
|
27
|
-
...a !== void 0 ? { mimeTypes: a } : {}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function On(n) {
|
|
31
|
-
if (!n || typeof n != "object" || Array.isArray(n)) return null;
|
|
32
|
-
const o = n;
|
|
33
|
-
return Object.keys(o).some((i) => i !== "pageSize") || o.pageSize !== void 0 && (!Number.isSafeInteger(o.pageSize) || o.pageSize < 1 || o.pageSize > 100) ? null : o.pageSize === void 0 ? {} : { pageSize: o.pageSize };
|
|
34
|
-
}
|
|
35
|
-
function _i(n, o) {
|
|
36
|
-
let i;
|
|
37
|
-
for (const a of n)
|
|
38
|
-
(a == null ? void 0 : a.pageSize) !== void 0 && (i !== void 0 && a.pageSize > i && o(), i = Math.min(i ?? a.pageSize, a.pageSize));
|
|
39
|
-
return { pageSize: i ?? 30 };
|
|
40
|
-
}
|
|
41
|
-
const fe = (n) => `${n.id}:${n.slot}`, gt = (n, o) => !!n && typeof n == "object" && !Array.isArray(n) && Object.keys(n).every((i) => o.includes(i)), Pi = (n) => {
|
|
42
|
-
if (!n || typeof n != "object") return !1;
|
|
43
|
-
const o = n;
|
|
44
|
-
return gt(o, [
|
|
45
|
-
"id",
|
|
46
|
-
"slot",
|
|
47
|
-
"enabled",
|
|
48
|
-
"visible",
|
|
49
|
-
"label",
|
|
50
|
-
"order",
|
|
51
|
-
"options"
|
|
52
|
-
]) && typeof o.id == "string" && typeof o.slot == "string" && (o.enabled === void 0 || typeof o.enabled == "boolean") && (o.visible === void 0 || typeof o.visible == "boolean") && (o.label === void 0 || typeof o.label == "string" && !!o.label.trim()) && (o.order === void 0 || typeof o.order == "number" && Number.isFinite(o.order)) && (o.options === void 0 || typeof o.options == "object");
|
|
53
|
-
};
|
|
54
|
-
function Bt(n, o, i = Date.now()) {
|
|
55
|
-
var Te, Ve, be, he, Pe, se, Ie, Je, xe, Qe, Re;
|
|
56
|
-
const a = [], c = Nt.filter((w) => w.types.includes(n)), p = (w) => w === void 0 ? null : !w || typeof w != "object" || Array.isArray(w) ? "snapshot" : kt(w), v = p(o.config), m = v === null && !!o.config && (!gt(o.config, ["remote", "page"]) || Object.prototype.hasOwnProperty.call(o.config, "page") && !gt(o.config.page, [
|
|
57
|
-
"schemaVersion",
|
|
58
|
-
"revision",
|
|
59
|
-
"rules"
|
|
60
|
-
]) || ((Te = o.config.page) == null ? void 0 : Te.revision) !== void 0 && typeof o.config.page.revision != "string" || Object.prototype.hasOwnProperty.call(o.config, "remote") && !gt(o.config.remote, [
|
|
61
|
-
"status",
|
|
62
|
-
"required",
|
|
63
|
-
"snapshot",
|
|
64
|
-
"expiresAt"
|
|
65
|
-
]) || ((Ve = o.config.remote) == null ? void 0 : Ve.status) === "unavailable" && (Object.prototype.hasOwnProperty.call(
|
|
66
|
-
o.config.remote,
|
|
67
|
-
"snapshot"
|
|
68
|
-
) || Object.prototype.hasOwnProperty.call(
|
|
69
|
-
o.config.remote,
|
|
70
|
-
"expiresAt"
|
|
71
|
-
)) || ((be = o.config.remote) == null ? void 0 : be.status) === "ready" && !!o.config.remote.snapshot && (!gt(o.config.remote.snapshot, [
|
|
72
|
-
"schemaVersion",
|
|
73
|
-
"revision",
|
|
74
|
-
"rules"
|
|
75
|
-
]) || o.config.remote.snapshot.revision !== void 0 && typeof o.config.remote.snapshot.revision != "string")), h = v !== null || m, A = p(o.policy) !== null;
|
|
76
|
-
if (h || A)
|
|
77
|
-
return h && a.push({
|
|
78
|
-
code: v != null && v.includes("rules") ? "CONFIG_RULES_INVALID" : "CONFIG_INVALID",
|
|
79
|
-
severity: "error",
|
|
80
|
-
source: "config",
|
|
81
|
-
message: "能力配置包含不可安全读取的数据,当前知识只能查看"
|
|
82
|
-
}), A && a.push({
|
|
83
|
-
code: "POLICY_INVALID",
|
|
84
|
-
severity: "error",
|
|
85
|
-
source: "config",
|
|
86
|
-
message: "权限快照无效,当前知识只能查看"
|
|
87
|
-
}), {
|
|
88
|
-
type: n,
|
|
89
|
-
mode: "readonly",
|
|
90
|
-
capabilities: c.map((w) => ({
|
|
91
|
-
...w,
|
|
92
|
-
canInsert: !1,
|
|
93
|
-
visible: !1
|
|
94
|
-
})),
|
|
95
|
-
diagnostics: a,
|
|
96
|
-
fingerprint: go({
|
|
97
|
-
type: n,
|
|
98
|
-
invalidConfigInput: h,
|
|
99
|
-
invalidPolicyInput: A
|
|
100
|
-
})
|
|
101
|
-
};
|
|
102
|
-
const { remote: g } = o.config || {}, O = new Set(Nt.map(fe)), { policy: l } = o, T = (w) => Nt.find((P) => fe(P) === fe(w)), y = (w) => {
|
|
103
|
-
if (w.options === void 0) return !0;
|
|
104
|
-
const P = T(w);
|
|
105
|
-
return (P == null ? void 0 : P.optionKind) === "media" ? Ft(w.options, P.id) !== null : (P == null ? void 0 : P.optionKind) === "selection" ? On(w.options) !== null : !1;
|
|
106
|
-
}, I = !!l && (!gt(l, ["revision", "expiresAt", "allowed"]) || typeof l.revision != "string" || !l.revision || !Number.isFinite(l.expiresAt) || !Array.isArray(l.allowed) || !l.allowed.every(
|
|
107
|
-
(w) => gt(w, ["id", "slot", "options"]) && typeof w.id == "string" && typeof w.slot == "string" && O.has(fe(w)) && y(w)
|
|
108
|
-
) || new Set(l.allowed.map(fe)).size !== l.allowed.length), N = l && !I ? l.allowed : [], u = !!g && (g.status !== "ready" && g.status !== "unavailable" || typeof g.required != "boolean" || g.status === "ready" && !Number.isFinite(g.expiresAt)), M = (g == null ? void 0 : g.status) === "ready" && ((he = g.snapshot) == null ? void 0 : he.schemaVersion) !== 1, D = !!((Pe = o.config) != null && Pe.page) && o.config.page.schemaVersion !== 1, F = (w) => Array.isArray(w) && w.every(
|
|
109
|
-
(P) => Pi(P) && O.has(fe(P)) && y(P)
|
|
110
|
-
), J = (g == null ? void 0 : g.status) === "ready" && !F((se = g.snapshot) == null ? void 0 : se.rules), q = !!((Ie = o.config) != null && Ie.page) && !F(o.config.page.rules), ne = (g == null ? void 0 : g.status) === "ready" && !J && !M ? g.snapshot.rules : [], L = (Je = o.config) != null && Je.page && !q && !D ? o.config.page.rules : [], G = (w) => new Set(w.map(fe)).size !== w.length, pe = G(ne) || G(L), oe = !!o.readonly || !!o.disabled || I || u || !!o.policy && o.policy.expiresAt <= i || M || D || J || q || pe || (g == null ? void 0 : g.status) === "ready" && g.expiresAt <= i || (g == null ? void 0 : g.status) === "unavailable";
|
|
111
|
-
o.policy && o.policy.expiresAt <= i && a.push({
|
|
112
|
-
code: "POLICY_EXPIRED",
|
|
113
|
-
severity: "error",
|
|
114
|
-
source: "config",
|
|
115
|
-
message: "权限已过期,当前知识只能查看"
|
|
116
|
-
}), I && a.push({
|
|
117
|
-
code: "POLICY_INVALID",
|
|
118
|
-
severity: "error",
|
|
119
|
-
source: "config",
|
|
120
|
-
message: "权限快照无效,当前知识只能查看"
|
|
121
|
-
}), u && a.push({
|
|
122
|
-
code: "CONFIG_INVALID",
|
|
123
|
-
severity: "error",
|
|
124
|
-
source: "config",
|
|
125
|
-
message: "远端配置快照无效,当前知识只能查看"
|
|
126
|
-
}), M && a.push({
|
|
127
|
-
code: "CONFIG_VERSION_INVALID",
|
|
128
|
-
severity: "error",
|
|
129
|
-
source: "config",
|
|
130
|
-
message: "配置版本不兼容,当前知识只能查看"
|
|
131
|
-
}), D && a.push({
|
|
132
|
-
code: "CONFIG_VERSION_INVALID",
|
|
133
|
-
severity: "error",
|
|
134
|
-
source: "config",
|
|
135
|
-
message: "页面配置版本不兼容,当前知识只能查看"
|
|
136
|
-
}), (J || q) && a.push({
|
|
137
|
-
code: "CONFIG_RULES_INVALID",
|
|
138
|
-
severity: "error",
|
|
139
|
-
source: "config",
|
|
140
|
-
message: "能力配置无效,当前知识只能查看"
|
|
141
|
-
}), (g == null ? void 0 : g.status) === "unavailable" && a.push({
|
|
142
|
-
code: "CONFIG_UNAVAILABLE",
|
|
143
|
-
severity: "error",
|
|
144
|
-
source: "config",
|
|
145
|
-
message: "配置不可用,当前知识只能查看"
|
|
146
|
-
}), (g == null ? void 0 : g.status) === "ready" && g.expiresAt <= i && a.push({
|
|
147
|
-
code: "CONFIG_EXPIRED",
|
|
148
|
-
severity: "error",
|
|
149
|
-
source: "config",
|
|
150
|
-
message: "配置已过期,当前知识只能查看"
|
|
151
|
-
});
|
|
152
|
-
for (const [w, P] of [
|
|
153
|
-
["remote", ne],
|
|
154
|
-
["page", L]
|
|
155
|
-
]) {
|
|
156
|
-
const j = /* @__PURE__ */ new Set();
|
|
157
|
-
for (const ce of P)
|
|
158
|
-
j.has(fe(ce)) && a.push({
|
|
159
|
-
code: "DUPLICATE_RULE",
|
|
160
|
-
severity: "error",
|
|
161
|
-
source: "config",
|
|
162
|
-
message: `${w} 配置重复:${fe(ce)}`,
|
|
163
|
-
capabilityId: ce.id
|
|
164
|
-
}), j.add(fe(ce));
|
|
165
|
-
}
|
|
166
|
-
const W = (w, P) => w == null ? void 0 : w.find((j) => fe(j) === fe(P)), ie = c.map((w) => {
|
|
167
|
-
var we;
|
|
168
|
-
const P = (g == null ? void 0 : g.status) === "ready" && g.expiresAt > i ? W(ne, w) : void 0, j = W(L, w), ce = !o.policy || N.some((Se) => fe(Se) === fe(w)), X = (we = w.actions) == null ? void 0 : we.find(
|
|
169
|
-
(Se) => Se.id === w.primaryActionId
|
|
170
|
-
), $e = [
|
|
171
|
-
...w.optionKind === "selection" && w.optionSource ? [] : (X == null ? void 0 : X.requiredPorts) || [],
|
|
172
|
-
...w.optionSource ? [ho[w.optionSource]] : [],
|
|
173
|
-
...w.uiPorts || []
|
|
174
|
-
], We = (() => {
|
|
175
|
-
if (w.primaryActionId && !X) return !1;
|
|
176
|
-
try {
|
|
177
|
-
return $e.every(
|
|
178
|
-
(Se) => {
|
|
179
|
-
var ke;
|
|
180
|
-
return typeof ((ke = o.ports) == null ? void 0 : ke[Se]) == "function";
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
} catch {
|
|
184
|
-
return a.push({
|
|
185
|
-
code: "PORT_INVALID",
|
|
186
|
-
severity: "warning",
|
|
187
|
-
source: "config",
|
|
188
|
-
message: `${w.id} 的宿主接口不可安全读取,该能力已禁用`,
|
|
189
|
-
capabilityId: w.id
|
|
190
|
-
}), !1;
|
|
191
|
-
}
|
|
192
|
-
})(), Ee = N.find(
|
|
193
|
-
(Se) => fe(Se) === fe(w)
|
|
194
|
-
), Be = w.optionKind === "media" ? Ci(
|
|
195
|
-
[
|
|
196
|
-
Ft(
|
|
197
|
-
Ee == null ? void 0 : Ee.options,
|
|
198
|
-
w.id
|
|
199
|
-
) || void 0,
|
|
200
|
-
Ft(
|
|
201
|
-
P == null ? void 0 : P.options,
|
|
202
|
-
w.id
|
|
203
|
-
) || void 0,
|
|
204
|
-
Ft(
|
|
205
|
-
j == null ? void 0 : j.options,
|
|
206
|
-
w.id
|
|
207
|
-
) || void 0
|
|
208
|
-
],
|
|
209
|
-
() => a.push({
|
|
210
|
-
code: "OPTION_WIDEN_ATTEMPT",
|
|
211
|
-
severity: "warning",
|
|
212
|
-
source: "config",
|
|
213
|
-
message: `${w.id} 的后续配置试图放宽媒体限制,已按较严格值处理`,
|
|
214
|
-
capabilityId: w.id
|
|
215
|
-
})
|
|
216
|
-
) : void 0, He = w.optionKind === "selection" ? _i(
|
|
217
|
-
[Ee == null ? void 0 : Ee.options, P == null ? void 0 : P.options, j == null ? void 0 : j.options].map(
|
|
218
|
-
(Se) => Se === void 0 ? void 0 : On(Se) || void 0
|
|
219
|
-
),
|
|
220
|
-
() => a.push({
|
|
221
|
-
code: "OPTION_WIDEN_ATTEMPT",
|
|
222
|
-
severity: "warning",
|
|
223
|
-
source: "config",
|
|
224
|
-
message: `${w.id} 的后续配置试图放宽查询分页限制,已按较严格值处理`,
|
|
225
|
-
capabilityId: w.id
|
|
226
|
-
})
|
|
227
|
-
) : void 0, zt = Be || He, at = !!(Be != null && Be.mimeTypes) && !Be.mimeTypes.length;
|
|
228
|
-
at && a.push({
|
|
229
|
-
code: "OPTION_SET_EMPTY",
|
|
230
|
-
severity: "warning",
|
|
231
|
-
source: "config",
|
|
232
|
-
message: `${w.id} 的可用媒体类型交集为空`,
|
|
233
|
-
capabilityId: w.id
|
|
234
|
-
});
|
|
235
|
-
const H = !oe && ce && We && !at && (P == null ? void 0 : P.enabled) !== !1 && (j == null ? void 0 : j.enabled) !== !1;
|
|
236
|
-
return {
|
|
237
|
-
...w,
|
|
238
|
-
label: (j == null ? void 0 : j.label) || (P == null ? void 0 : P.label) || w.label,
|
|
239
|
-
order: (j == null ? void 0 : j.order) ?? (P == null ? void 0 : P.order) ?? w.order,
|
|
240
|
-
canInsert: H,
|
|
241
|
-
options: zt,
|
|
242
|
-
visible: (P == null ? void 0 : P.visible) !== !1 && (j == null ? void 0 : j.visible) !== !1 && (H || !We)
|
|
243
|
-
};
|
|
244
|
-
}).sort(
|
|
245
|
-
(w, P) => w.order - P.order || w.id.localeCompare(P.id) || w.slot.localeCompare(P.slot)
|
|
246
|
-
);
|
|
247
|
-
return {
|
|
248
|
-
type: n,
|
|
249
|
-
mode: oe ? "readonly" : "editable",
|
|
250
|
-
capabilities: ie,
|
|
251
|
-
diagnostics: a,
|
|
252
|
-
fingerprint: go({
|
|
253
|
-
type: n,
|
|
254
|
-
mode: oe ? "readonly" : "editable",
|
|
255
|
-
policyRevision: l == null ? void 0 : l.revision,
|
|
256
|
-
remoteRevision: (g == null ? void 0 : g.status) === "ready" ? (xe = g.snapshot) == null ? void 0 : xe.revision : g == null ? void 0 : g.status,
|
|
257
|
-
pageRevision: (Re = (Qe = o.config) == null ? void 0 : Qe.page) == null ? void 0 : Re.revision,
|
|
258
|
-
policyAllowed: Tn(N),
|
|
259
|
-
remoteRules: Tn(ne),
|
|
260
|
-
pageRules: Tn(L),
|
|
261
|
-
options: ie.map((w) => ({
|
|
262
|
-
id: w.id,
|
|
263
|
-
slot: w.slot,
|
|
264
|
-
apiVersion: w.apiVersion,
|
|
265
|
-
dataVersion: w.dataVersion,
|
|
266
|
-
options: w.options
|
|
267
|
-
}))
|
|
268
|
-
})
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
function Tn(n) {
|
|
272
|
-
return n.map((o) => {
|
|
273
|
-
var i;
|
|
274
|
-
return {
|
|
275
|
-
id: o.id,
|
|
276
|
-
slot: o.slot,
|
|
277
|
-
enabled: o.enabled,
|
|
278
|
-
visible: o.visible,
|
|
279
|
-
label: o.label,
|
|
280
|
-
order: o.order,
|
|
281
|
-
options: o.options === void 0 ? void 0 : o.id === "image" || o.id === "video" ? Ft(o.options, o.id) : ((i = Nt.find((a) => fe(a) === fe(o))) == null ? void 0 : i.optionKind) === "selection" ? On(o.options) : o.options
|
|
282
|
-
};
|
|
283
|
-
}).sort((o, i) => fe(o).localeCompare(fe(i)));
|
|
284
|
-
}
|
|
285
|
-
function go(n) {
|
|
286
|
-
const o = (c) => Array.isArray(c) ? `[${c.map(o).join(",")}]` : c && typeof c == "object" ? `{${Object.entries(c).sort(([p], [v]) => p.localeCompare(v)).map(([p, v]) => `${JSON.stringify(p)}:${o(v)}`).join(",")}}` : JSON.stringify(c) ?? "null", i = o(n);
|
|
287
|
-
let a = 2166136261;
|
|
288
|
-
for (let c = 0; c < i.length; c++)
|
|
289
|
-
a = Math.imul(a ^ i.charCodeAt(c), 16777619);
|
|
290
|
-
return (a >>> 0).toString(16).padStart(8, "0");
|
|
291
|
-
}
|
|
292
|
-
function xi(n) {
|
|
293
|
-
const o = n.attrs || {};
|
|
294
|
-
return n.type === "businessToken" && ["todo", "ticket", "variable", "attribute", "tool", "separator"].includes(
|
|
295
|
-
String(o.kind)
|
|
296
|
-
) ? {
|
|
297
|
-
id: o.kind,
|
|
298
|
-
slot: "knowledgeInline",
|
|
299
|
-
identity: JSON.stringify([o.key, o.label, o.token])
|
|
300
|
-
} : n.type === "mediaBlock" && ["image", "video"].includes(String(o.kind)) ? {
|
|
301
|
-
id: o.kind,
|
|
302
|
-
slot: "knowledgeBlock",
|
|
303
|
-
identity: String(o.id || "")
|
|
304
|
-
} : n.type === "originalReply" ? { id: "originalReply", slot: "knowledgeBlock", identity: "block" } : n.type === "messageSeparator" ? { id: "separator", slot: "knowledgeBlock", identity: "block" } : null;
|
|
305
|
-
}
|
|
306
|
-
function vo(n) {
|
|
307
|
-
const o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakSet(), a = (c) => {
|
|
308
|
-
if (!c || typeof c != "object") return;
|
|
309
|
-
const p = c;
|
|
310
|
-
if (i.has(p)) return;
|
|
311
|
-
i.add(p);
|
|
312
|
-
const v = xi(p);
|
|
313
|
-
if (v) {
|
|
314
|
-
const m = `${v.id}:${v.slot}`, h = o.get(m) || {
|
|
315
|
-
use: { id: v.id, slot: v.slot },
|
|
316
|
-
instances: /* @__PURE__ */ new Map()
|
|
317
|
-
};
|
|
318
|
-
h.instances.set(
|
|
319
|
-
v.identity,
|
|
320
|
-
(h.instances.get(v.identity) || 0) + 1
|
|
321
|
-
), o.set(m, h);
|
|
322
|
-
}
|
|
323
|
-
Array.isArray(p.content) && p.content.forEach(a);
|
|
324
|
-
};
|
|
325
|
-
return n && a(n), o;
|
|
326
|
-
}
|
|
327
|
-
function yo(n, o, i) {
|
|
328
|
-
var p;
|
|
329
|
-
const a = vo(n), c = vo(o);
|
|
330
|
-
for (const [v, m] of c) {
|
|
331
|
-
if (i.some(
|
|
332
|
-
(A) => A.id === m.use.id && A.slot === m.use.slot && A.canInsert
|
|
333
|
-
))
|
|
334
|
-
continue;
|
|
335
|
-
const h = (p = a.get(v)) == null ? void 0 : p.instances;
|
|
336
|
-
for (const [A, g] of m.instances)
|
|
337
|
-
if (g > ((h == null ? void 0 : h.get(A)) || 0)) return m.use;
|
|
338
|
-
}
|
|
339
|
-
return null;
|
|
340
|
-
}
|
|
341
|
-
const vt = () => ({
|
|
342
|
-
type: "doc",
|
|
343
|
-
content: [{ type: "paragraph" }]
|
|
344
|
-
}), nn = (n = "normal") => ({
|
|
345
|
-
schemaVersion: 1,
|
|
346
|
-
type: n,
|
|
347
|
-
question: { text: "" },
|
|
348
|
-
knowledge: { doc: n === "agent" ? null : vt(), agentRef: null },
|
|
349
|
-
extensionState: {}
|
|
350
|
-
});
|
|
351
|
-
function Mi(n, o) {
|
|
352
|
-
const i = JSON.parse(JSON.stringify(n));
|
|
353
|
-
if (n.type === o) return { scene: i, removed: [] };
|
|
354
|
-
const a = /* @__PURE__ */ new Set(), c = {
|
|
355
|
-
todo: "待办",
|
|
356
|
-
originalReply: "原话复述",
|
|
357
|
-
attribute: "属性",
|
|
358
|
-
tool: "工具"
|
|
359
|
-
};
|
|
360
|
-
if (i.extensionState = Object.fromEntries(
|
|
361
|
-
Object.entries(i.extensionState).filter(([v]) => {
|
|
362
|
-
const m = c[v];
|
|
363
|
-
return m ? (a.add(m), !1) : !0;
|
|
364
|
-
})
|
|
365
|
-
), n.knowledge.agentRef && a.add("Agent 引用"), o === "agent") {
|
|
366
|
-
const v = n.knowledge.doc || n.knowledge.retainedDoc;
|
|
367
|
-
i.knowledge = {
|
|
368
|
-
doc: null,
|
|
369
|
-
...v ? {
|
|
370
|
-
retainedDoc: ko(
|
|
371
|
-
v,
|
|
372
|
-
n.type,
|
|
373
|
-
o,
|
|
374
|
-
a
|
|
375
|
-
)
|
|
376
|
-
} : {},
|
|
377
|
-
agentRef: null
|
|
378
|
-
};
|
|
379
|
-
} else
|
|
380
|
-
i.knowledge = {
|
|
381
|
-
doc: ko(
|
|
382
|
-
i.knowledge.doc || i.knowledge.retainedDoc || vt(),
|
|
383
|
-
n.type,
|
|
384
|
-
o,
|
|
385
|
-
a
|
|
386
|
-
),
|
|
387
|
-
agentRef: null
|
|
388
|
-
};
|
|
389
|
-
i.type = o;
|
|
390
|
-
const p = ["待办", "原话复述", "工单", "属性", "工具", "Agent 引用"];
|
|
391
|
-
return {
|
|
392
|
-
scene: i,
|
|
393
|
-
removed: [...a].sort((v, m) => p.indexOf(v) - p.indexOf(m))
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
function ko(n, o, i, a) {
|
|
397
|
-
const c = (p) => {
|
|
398
|
-
var v;
|
|
399
|
-
if (o === "reasoning" && i !== "reasoning") {
|
|
400
|
-
if (p.type === "originalReply")
|
|
401
|
-
return a.add("原话复述"), null;
|
|
402
|
-
if (p.type === "businessToken") {
|
|
403
|
-
const h = {
|
|
404
|
-
todo: "待办",
|
|
405
|
-
ticket: "工单",
|
|
406
|
-
attribute: "属性",
|
|
407
|
-
tool: "工具"
|
|
408
|
-
}[String((v = p.attrs) == null ? void 0 : v.kind)];
|
|
409
|
-
if (h)
|
|
410
|
-
return a.add(h), null;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
return p.content ? {
|
|
414
|
-
...p,
|
|
415
|
-
content: p.content.map(c).filter((m) => m !== null)
|
|
416
|
-
} : p;
|
|
417
|
-
};
|
|
418
|
-
return c(n) || vt();
|
|
419
|
-
}
|
|
420
|
-
function Ri(n) {
|
|
421
|
-
const o = [], i = /* @__PURE__ */ new WeakSet();
|
|
422
|
-
let a = 0;
|
|
423
|
-
const c = 2e4, p = (A) => {
|
|
424
|
-
if (a >= c) return;
|
|
425
|
-
const g = A.slice(0, c - a);
|
|
426
|
-
o.push(g), a += g.length;
|
|
427
|
-
}, v = (A, g) => {
|
|
428
|
-
if (!A || typeof A != "object" || g > 32) return;
|
|
429
|
-
const O = A;
|
|
430
|
-
if (i.has(O)) return;
|
|
431
|
-
i.add(O);
|
|
432
|
-
const l = typeof O.type == "string" ? O.type : "未知类型", T = O.attrs && typeof O.attrs == "object" ? O.attrs : {};
|
|
433
|
-
if (l === "text") {
|
|
434
|
-
typeof O.text == "string" && p(O.text);
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
if (l === "hardBreak") {
|
|
438
|
-
p(`
|
|
439
|
-
`);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
if (l === "businessToken") {
|
|
443
|
-
const y = T.token || T.label || T.key;
|
|
444
|
-
p(typeof y == "string" ? y : "[引用]");
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
if (l === "mediaBlock") {
|
|
448
|
-
const y = T.kind === "video" ? "视频" : "图片", I = typeof T.name == "string" && T.name ? `:${T.name}` : "";
|
|
449
|
-
p(`
|
|
450
|
-
[${y}${I}]
|
|
451
|
-
`);
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
if (l === "messageSeparator") {
|
|
455
|
-
p(`
|
|
456
|
-
────
|
|
457
|
-
`);
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
wi(l) || p(`
|
|
461
|
-
[未识别内容:${l.slice(0, 80)}]
|
|
462
|
-
`), typeof O.text == "string" && p(O.text), Array.isArray(O.content) && O.content.forEach((y) => v(y, g + 1)), ["paragraph", "listItem", "blockquote", "originalReply"].includes(l) && p(`
|
|
463
|
-
`);
|
|
464
|
-
};
|
|
465
|
-
let m = !1;
|
|
466
|
-
try {
|
|
467
|
-
v(n, 0);
|
|
468
|
-
} catch {
|
|
469
|
-
m = !0;
|
|
470
|
-
}
|
|
471
|
-
const h = o.join("").replace(/\n{3,}/g, `
|
|
472
|
-
|
|
473
|
-
`).trim();
|
|
474
|
-
return m ? h ? `${h}
|
|
475
|
-
部分内容无法读取,原始数据仍保留。` : "内容无法安全预览;原始数据仍保留。" : h ? `${h}${a >= c ? `
|
|
476
|
-
…内容已截断,原始数据仍保留` : ""}` : "没有可提取的文本;原始数据仍保留。";
|
|
477
|
-
}
|
|
478
|
-
function mt(n) {
|
|
479
|
-
const o = (i) => Array.isArray(i) ? `[${i.map((a) => o(a)).join(",")}]` : i && typeof i == "object" ? `{${Object.keys(i).filter((a) => i[a] !== void 0).sort().map(
|
|
480
|
-
(a) => `${JSON.stringify(a)}:${o(
|
|
481
|
-
i[a]
|
|
482
|
-
)}`
|
|
483
|
-
).join(",")}}` : JSON.stringify(i) ?? "null";
|
|
484
|
-
return o(n);
|
|
485
|
-
}
|
|
486
|
-
function pt(n) {
|
|
487
|
-
return mt(n);
|
|
488
|
-
}
|
|
489
|
-
const an = (n) => Array.from(n.replace(/\s/gu, "")).length;
|
|
490
|
-
function jt(n) {
|
|
491
|
-
let o = "", i = !1, a = !1, c = !1, p = !1;
|
|
492
|
-
const v = /* @__PURE__ */ new WeakSet(), m = (h) => {
|
|
493
|
-
var g, O, l, T, y;
|
|
494
|
-
if (!h || typeof h != "object") return;
|
|
495
|
-
const A = h;
|
|
496
|
-
if (!v.has(A)) {
|
|
497
|
-
if (v.add(A), typeof A.type == "string" && Si(A.type) && (typeof ((g = A.attrs) == null ? void 0 : g.id) != "string" || !A.attrs.id.trim() || !Number.isSafeInteger(A.attrs.nodeVersion) || A.attrs.nodeVersion < 0) && (p = !0), A.type === "mediaBlock") {
|
|
498
|
-
i = !0, (((O = A.attrs) == null ? void 0 : O.status) === "uploading" || ((l = A.attrs) == null ? void 0 : l.status) === "error") && (a = !0);
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
if (A.type === "businessToken") {
|
|
502
|
-
i = !0, ((T = A.attrs) == null ? void 0 : T.kind) === "tool" && ((y = A.attrs) == null ? void 0 : y.params) == null && (c = !0);
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
if (A.type === "text" && typeof A.text == "string" && (o += A.text, an(A.text) > 0 && (i = !0)), Array.isArray(A.content))
|
|
506
|
-
for (const I of A.content) m(I);
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
return n && m(n), {
|
|
510
|
-
text: o,
|
|
511
|
-
hasContent: i,
|
|
512
|
-
pendingMedia: a,
|
|
513
|
-
missingToolParams: c,
|
|
514
|
-
incompleteNodeIdentity: p
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
function ln(n) {
|
|
518
|
-
return jt(n.knowledge.doc).pendingMedia || jt(n.knowledge.retainedDoc || null).pendingMedia;
|
|
519
|
-
}
|
|
520
|
-
function Di(n) {
|
|
521
|
-
return jt(n).hasContent;
|
|
522
|
-
}
|
|
523
|
-
function gl(n, o = {}) {
|
|
524
|
-
if (!Array.isArray(n) || n.length === 0)
|
|
525
|
-
return {
|
|
526
|
-
ok: !1,
|
|
527
|
-
characterCount: 0,
|
|
528
|
-
issues: [
|
|
529
|
-
{
|
|
530
|
-
code: Array.isArray(n) ? "EMPTY_CONTENT" : "UNSUPPORTED_CONTENT",
|
|
531
|
-
sceneIndex: null,
|
|
532
|
-
message: Array.isArray(n) ? "请至少添加一条知识场景" : "知识场景列表格式不正确"
|
|
533
|
-
}
|
|
534
|
-
]
|
|
535
|
-
};
|
|
536
|
-
const i = o.maxCharacters, a = typeof i == "number" && Number.isSafeInteger(i) && i > 0 ? Math.min(i, 2e3) : 2e3, c = [], p = /* @__PURE__ */ new Set();
|
|
537
|
-
let v = 0;
|
|
538
|
-
return n.forEach((m, h) => {
|
|
539
|
-
var u, M;
|
|
540
|
-
let A;
|
|
541
|
-
try {
|
|
542
|
-
if (kt(m) !== null)
|
|
543
|
-
throw new Error("Non-JSON scene");
|
|
544
|
-
A = JSON.parse(JSON.stringify(m));
|
|
545
|
-
} catch {
|
|
546
|
-
c.push({
|
|
547
|
-
code: "UNSUPPORTED_CONTENT",
|
|
548
|
-
sceneIndex: h,
|
|
549
|
-
message: "知识包含当前版本不支持的内容"
|
|
550
|
-
});
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
if (!wo(A)) {
|
|
554
|
-
c.push({
|
|
555
|
-
code: "UNSUPPORTED_CONTENT",
|
|
556
|
-
sceneIndex: h,
|
|
557
|
-
message: "知识包含当前版本不支持的内容"
|
|
558
|
-
});
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
A.schemaVersion !== 1 && c.push({
|
|
562
|
-
code: "SCHEMA_VERSION",
|
|
563
|
-
sceneIndex: h,
|
|
564
|
-
message: "知识数据版本不兼容"
|
|
565
|
-
});
|
|
566
|
-
const g = ((u = A.question) == null ? void 0 : u.text) || "", O = jt(
|
|
567
|
-
A.type === "agent" ? null : A.knowledge.doc
|
|
568
|
-
), l = jt(A.knowledge.retainedDoc || null);
|
|
569
|
-
v += an(g) + an(O.text);
|
|
570
|
-
const T = an(g) > 0;
|
|
571
|
-
_n(g) && c.push({
|
|
572
|
-
code: "INVALID_INTENT_BRACKET",
|
|
573
|
-
sceneIndex: h,
|
|
574
|
-
message: "意图文字中不可填写方括号或换行,请修改"
|
|
575
|
-
});
|
|
576
|
-
const y = !!((M = A.knowledge.agentRef) != null && M.id);
|
|
577
|
-
A.type === "agent" && !y ? c.push({
|
|
578
|
-
code: T ? "AGENT_REQUIRED" : "EMPTY_CONTENT_AND_AGENT",
|
|
579
|
-
sceneIndex: h,
|
|
580
|
-
message: T ? "请选择Agent" : "请填写顾客意图或知识内容,并选择Agent"
|
|
581
|
-
}) : A.type !== "agent" && !T && !O.hasContent && c.push({
|
|
582
|
-
code: "EMPTY_CONTENT",
|
|
583
|
-
sceneIndex: h,
|
|
584
|
-
message: "请填写顾客意图或知识内容"
|
|
585
|
-
});
|
|
586
|
-
const I = g.split("/").map((D) => D.trim()).filter(Boolean);
|
|
587
|
-
I.some((D) => p.has(D)) && c.push({
|
|
588
|
-
code: "DUPLICATE_INTENT",
|
|
589
|
-
sceneIndex: h,
|
|
590
|
-
message: "已存在相同意图的知识场景"
|
|
591
|
-
}), I.forEach((D) => p.add(D)), ln(A) && c.push({
|
|
592
|
-
code: "MEDIA_PENDING",
|
|
593
|
-
sceneIndex: h,
|
|
594
|
-
message: "请等待媒体上传完成或移除失败的媒体"
|
|
595
|
-
}), O.missingToolParams && c.push({
|
|
596
|
-
code: "UNSUPPORTED_CONTENT",
|
|
597
|
-
sceneIndex: h,
|
|
598
|
-
message: "工具配置缺失,请迁移后保存"
|
|
599
|
-
});
|
|
600
|
-
const N = Ut(A);
|
|
601
|
-
!N && (O.incompleteNodeIdentity || l.incompleteNodeIdentity) && c.push({
|
|
602
|
-
code: "UNSUPPORTED_CONTENT",
|
|
603
|
-
sceneIndex: h,
|
|
604
|
-
message: "引用节点缺少稳定 ID 或版本,请迁移后保存"
|
|
605
|
-
}), N && c.push({
|
|
606
|
-
code: "UNSUPPORTED_CONTENT",
|
|
607
|
-
sceneIndex: h,
|
|
608
|
-
message: "知识包含当前版本不支持的内容"
|
|
609
|
-
});
|
|
610
|
-
}), v > a && c.push({
|
|
611
|
-
code: "TOO_LONG",
|
|
612
|
-
sceneIndex: null,
|
|
613
|
-
message: `内容不能超过${a}字`
|
|
614
|
-
}), { ok: c.length === 0, characterCount: v, issues: c };
|
|
615
|
-
}
|
|
616
|
-
const Li = {
|
|
617
|
-
"todo:questionAction": () => import("./question-DGC6JHy5.js"),
|
|
618
|
-
"todo:knowledgeInline": () => import("./knowledge-BZCmalF_.js"),
|
|
619
|
-
"ticket:knowledgeInline": () => import("./index-DxxX09iY.js"),
|
|
620
|
-
"originalReply:questionAction": () => import("./question-D1--acV8.js"),
|
|
621
|
-
"originalReply:knowledgeBlock": () => import("./knowledge-DnYGicjn.js"),
|
|
622
|
-
"memory:questionAction": () => import("./index-D8bcFtWR.js"),
|
|
623
|
-
"tagged:questionAction": () => import("./index-DSgEWJGP.js"),
|
|
624
|
-
"attribute:knowledgeInline": () => import("./index-CzpY61Qj.js"),
|
|
625
|
-
"tool:knowledgeInline": () => import("./index-nnvfy5q0.js"),
|
|
626
|
-
"variable:knowledgeInline": () => import("./index-urNonkMH.js"),
|
|
627
|
-
"separator:knowledgeInline": () => import("./index-CJlAseSN.js"),
|
|
628
|
-
"image:knowledgeBlock": () => import("./index-BsQLwz91.js"),
|
|
629
|
-
"video:knowledgeBlock": () => import("./index-xAjlBylT.js"),
|
|
630
|
-
"reasoningPolish:sceneAction": () => import("./index-5a9mHHzg.js"),
|
|
631
|
-
"reasoningTemplate:sceneAction": () => import("./index-DOEijEGU.js")
|
|
632
|
-
};
|
|
633
|
-
function Ki(n, o) {
|
|
634
|
-
if (!o || typeof o != "object") return !1;
|
|
635
|
-
const i = o, { actions: a } = n, c = i.actions;
|
|
636
|
-
if (n.implementation !== "plugin" || !(a != null && a.length) || new Set(a.map((v) => v.id)).size !== a.length || !c || typeof c != "object" || Array.isArray(c))
|
|
637
|
-
return !1;
|
|
638
|
-
const p = c;
|
|
639
|
-
return Object.keys(p).length !== a.length || a.some((v) => {
|
|
640
|
-
const m = p[v.id];
|
|
641
|
-
return !Object.prototype.hasOwnProperty.call(p, v.id) || !m || typeof m != "object" || typeof m.execute != "function";
|
|
642
|
-
}) ? !1 : i.id === n.id && i.slot === n.slot && i.apiVersion === n.apiVersion && i.dataVersion === n.dataVersion;
|
|
643
|
-
}
|
|
644
|
-
async function So(n) {
|
|
645
|
-
if (n.implementation !== "plugin")
|
|
646
|
-
return { ok: !1, reason: "NOT_REGISTERED" };
|
|
647
|
-
const o = Li[`${n.id}:${n.slot}`];
|
|
648
|
-
if (!o) return { ok: !1, reason: "NOT_REGISTERED" };
|
|
649
|
-
const i = await o();
|
|
650
|
-
return Ki(n, i.default) ? { ok: !0, module: i.default } : { ok: !1, reason: "VERSION_MISMATCH" };
|
|
651
|
-
}
|
|
652
|
-
function Ao(n, o) {
|
|
653
|
-
if (!Array.isArray(n) || new Set(n).size !== n.length)
|
|
654
|
-
return null;
|
|
655
|
-
const i = n, a = {};
|
|
656
|
-
try {
|
|
657
|
-
for (const c of i) {
|
|
658
|
-
const p = o == null ? void 0 : o[c];
|
|
659
|
-
if (typeof p != "function") return null;
|
|
660
|
-
a[c] = p;
|
|
661
|
-
}
|
|
662
|
-
} catch {
|
|
663
|
-
return null;
|
|
664
|
-
}
|
|
665
|
-
return a;
|
|
666
|
-
}
|
|
667
|
-
function xn(n, o, i) {
|
|
668
|
-
var c;
|
|
669
|
-
const a = (c = n.actions) == null ? void 0 : c.filter((p) => p.id === o);
|
|
670
|
-
return !a || a.length !== 1 ? null : Ao(a[0].requiredPorts, i);
|
|
671
|
-
}
|
|
672
|
-
function qi(n, o) {
|
|
673
|
-
return Ao(n.readPorts, o);
|
|
674
|
-
}
|
|
675
|
-
function Vi(n, o) {
|
|
676
|
-
const i = Nt.filter(
|
|
677
|
-
(a) => {
|
|
678
|
-
var c;
|
|
679
|
-
return (c = a.actions) == null ? void 0 : c.some((p) => p.id === n);
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
return i.length !== 1 ? null : xn(
|
|
683
|
-
i[0],
|
|
684
|
-
n,
|
|
685
|
-
o
|
|
686
|
-
);
|
|
687
|
-
}
|
|
688
|
-
const $i = /* @__PURE__ */ new Set([
|
|
689
|
-
"ABORTED",
|
|
690
|
-
"UNAVAILABLE",
|
|
691
|
-
"FORBIDDEN",
|
|
692
|
-
"INVALID_RESPONSE",
|
|
693
|
-
"CONFLICT",
|
|
694
|
-
"TIMEOUT",
|
|
695
|
-
"NETWORK",
|
|
696
|
-
"UNKNOWN"
|
|
697
|
-
]), it = () => ({
|
|
698
|
-
ok: !1,
|
|
699
|
-
error: {
|
|
700
|
-
code: "INVALID_RESPONSE",
|
|
701
|
-
message: "宿主接口返回格式不正确",
|
|
702
|
-
retryable: !1
|
|
703
|
-
}
|
|
704
|
-
}), ue = (n) => !!n && typeof n == "object" && !Array.isArray(n), Ct = (n) => typeof n == "string" && n.length > 0, qe = (n) => typeof n == "string" && n.trim().length > 0, on = (n, o) => Object.keys(n).every((i) => o.includes(i)), Bi = /* @__PURE__ */ new Set([
|
|
705
|
-
"config",
|
|
706
|
-
"plugin",
|
|
707
|
-
"port",
|
|
708
|
-
"validation",
|
|
709
|
-
"migration"
|
|
710
|
-
]), Ui = /* @__PURE__ */ new Set([
|
|
711
|
-
"info",
|
|
712
|
-
"warning",
|
|
713
|
-
"error"
|
|
714
|
-
]), Fi = new Set(Nt.map((n) => n.id)), ji = /* @__PURE__ */ new Set([
|
|
715
|
-
"questionAction",
|
|
716
|
-
"knowledgeInline",
|
|
717
|
-
"knowledgeBlock",
|
|
718
|
-
"sceneAction",
|
|
719
|
-
"toolbarOnly"
|
|
720
|
-
]);
|
|
721
|
-
function zi(n) {
|
|
722
|
-
return ue(n) ? Object.keys(n).every(
|
|
723
|
-
(o) => [
|
|
724
|
-
"code",
|
|
725
|
-
"severity",
|
|
726
|
-
"source",
|
|
727
|
-
"message",
|
|
728
|
-
"sceneKey",
|
|
729
|
-
"capabilityId",
|
|
730
|
-
"slot",
|
|
731
|
-
"path",
|
|
732
|
-
"retryable"
|
|
733
|
-
].includes(o)
|
|
734
|
-
) && Ct(n.code) && Ui.has(n.severity) && Bi.has(n.source) && typeof n.message == "string" && (n.sceneKey === void 0 || typeof n.sceneKey == "string") && (n.capabilityId === void 0 || Fi.has(n.capabilityId)) && (n.slot === void 0 || ji.has(n.slot)) && (n.path === void 0 || typeof n.path == "string") && (n.retryable === void 0 || typeof n.retryable == "boolean") : !1;
|
|
735
|
-
}
|
|
736
|
-
function yt(n, o) {
|
|
737
|
-
try {
|
|
738
|
-
if (!ue(n)) return it();
|
|
739
|
-
if (n.ok === !0) {
|
|
740
|
-
const h = n.data;
|
|
741
|
-
if (h !== void 0 && kt(h) !== null)
|
|
742
|
-
return it();
|
|
743
|
-
const A = h === void 0 ? void 0 : JSON.parse(JSON.stringify(h));
|
|
744
|
-
return o(A) ? { ok: !0, data: A } : it();
|
|
745
|
-
}
|
|
746
|
-
if (n.ok !== !1 || !ue(n.error)) return it();
|
|
747
|
-
const { code: i, message: a, retryable: c, traceId: p, issues: v } = n.error;
|
|
748
|
-
let m;
|
|
749
|
-
if (v !== void 0) {
|
|
750
|
-
if (kt(v) !== null) return it();
|
|
751
|
-
const h = JSON.parse(JSON.stringify(v));
|
|
752
|
-
if (!Array.isArray(h) || !h.every(zi))
|
|
753
|
-
return it();
|
|
754
|
-
m = h;
|
|
755
|
-
}
|
|
756
|
-
return $i.has(i) && Ct(a) && typeof c == "boolean" && (p === void 0 || typeof p == "string") ? {
|
|
757
|
-
ok: !1,
|
|
758
|
-
error: {
|
|
759
|
-
code: i,
|
|
760
|
-
message: a,
|
|
761
|
-
retryable: c,
|
|
762
|
-
...typeof p == "string" ? { traceId: p } : {},
|
|
763
|
-
...m ? { issues: m } : {}
|
|
764
|
-
}
|
|
765
|
-
} : it();
|
|
766
|
-
} catch {
|
|
767
|
-
return it();
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
function Mn(n, o) {
|
|
771
|
-
if (!ue(n) || !Array.isArray(n.items)) return !1;
|
|
772
|
-
const { items: i } = n;
|
|
773
|
-
return i.every(o) ? new Set(i.map((a) => a.id)).size === i.length && (n.nextCursor === void 0 || Ct(n.nextCursor)) : !1;
|
|
774
|
-
}
|
|
775
|
-
const Gi = (n) => Mn(
|
|
776
|
-
n,
|
|
777
|
-
(o) => ue(o) && qe(o.id) && qe(o.label) && qe(o.token) && (o.group === void 0 || typeof o.group == "string") && (o.disabled === void 0 || typeof o.disabled == "boolean")
|
|
778
|
-
), Ji = (n) => Mn(
|
|
779
|
-
n,
|
|
780
|
-
(o) => ue(o) && qe(o.id) && qe(o.name)
|
|
781
|
-
), To = (n) => Mn(
|
|
782
|
-
n,
|
|
783
|
-
(o) => ue(o) && qe(o.id) && qe(o.label) && (o.disabled === void 0 || typeof o.disabled == "boolean") && (o.hasChildren === void 0 || typeof o.hasChildren == "boolean") && (o.preview === void 0 || typeof o.preview == "string")
|
|
784
|
-
), Wi = (n) => To(n) && n.items.every(
|
|
785
|
-
(o) => !!o.label.trim() && !o.hasChildren && !Ai(o.label)
|
|
786
|
-
), mo = (n, o) => ue(o) && on(o, ["toolId", "permitted", "fields"]) && o.toolId === n && typeof o.permitted == "boolean" && Array.isArray(o.fields) && o.fields.length <= 20 && new Set(
|
|
787
|
-
o.fields.map((i) => ue(i) ? i.id : null)
|
|
788
|
-
).size === o.fields.length && o.fields.every(
|
|
789
|
-
(i) => ue(i) && on(i, [
|
|
790
|
-
"id",
|
|
791
|
-
"label",
|
|
792
|
-
"kind",
|
|
793
|
-
"required",
|
|
794
|
-
"placeholder",
|
|
795
|
-
"min",
|
|
796
|
-
"max",
|
|
797
|
-
"maxLength",
|
|
798
|
-
"options",
|
|
799
|
-
"defaultValue",
|
|
800
|
-
"hideLabel",
|
|
801
|
-
"appearance",
|
|
802
|
-
"visibleWhen"
|
|
803
|
-
]) && typeof i.id == "string" && /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(i.id) && !["constructor", "prototype"].includes(i.id) && qe(i.label) && ["text", "number", "switch", "textarea", "radio", "checkbox"].includes(
|
|
804
|
-
String(i.kind)
|
|
805
|
-
) && (i.required === void 0 || typeof i.required == "boolean") && (i.placeholder === void 0 || typeof i.placeholder == "string") && (i.hideLabel === void 0 || typeof i.hideLabel == "boolean") && (i.appearance === void 0 || i.kind === "radio" && i.appearance === "flag") && (i.maxLength === void 0 || (i.kind === "text" || i.kind === "textarea") && typeof i.maxLength == "number" && Number.isInteger(i.maxLength) && i.maxLength > 0) && (i.options === void 0 || i.kind === "radio" && Array.isArray(i.options) && i.options.length > 0 && i.options.every(
|
|
806
|
-
(a) => ue(a) && on(a, ["value", "label", "color"]) && Ct(a.value) && a.value.trim() === a.value && qe(a.label) && (a.color === void 0 || i.appearance === "flag" && typeof a.color == "string" && /^#[0-9a-fA-F]{6}$/.test(a.color))
|
|
807
|
-
)) && (i.kind !== "radio" || i.options !== void 0) && (i.defaultValue === void 0 || (["switch", "checkbox"].includes(String(i.kind)) ? typeof i.defaultValue == "boolean" : typeof i.defaultValue == "string" && i.defaultValue.trim() === i.defaultValue)) && (i.visibleWhen === void 0 || ue(i.visibleWhen) && on(i.visibleWhen, ["fieldId", "equals"]) && Ct(i.visibleWhen.fieldId) && (typeof i.visibleWhen.equals == "string" || typeof i.visibleWhen.equals == "boolean")) && (i.min === void 0 || typeof i.min == "number" && Number.isFinite(i.min)) && (i.max === void 0 || typeof i.max == "number" && Number.isFinite(i.max)) && (i.kind === "number" || i.min === void 0 && i.max === void 0) && (i.min === void 0 || i.max === void 0 || i.min <= i.max)
|
|
808
|
-
) && o.fields.every((i, a) => {
|
|
809
|
-
if (!ue(i)) return !1;
|
|
810
|
-
if (i.kind === "radio") {
|
|
811
|
-
const m = i.options.map((h) => h.value);
|
|
812
|
-
if (new Set(m).size !== m.length || i.defaultValue !== void 0 && !m.includes(i.defaultValue))
|
|
813
|
-
return !1;
|
|
814
|
-
}
|
|
815
|
-
if (i.visibleWhen === void 0) return !0;
|
|
816
|
-
const c = i.visibleWhen, p = o.fields.slice(0, a).find(
|
|
817
|
-
(v) => ue(v) ? v.id === c.fieldId : !1
|
|
818
|
-
);
|
|
819
|
-
return ue(p) ? p.kind === "radio" ? p.options.some(
|
|
820
|
-
(v) => v.value === c.equals
|
|
821
|
-
) : ["switch", "checkbox"].includes(String(p.kind)) ? typeof c.equals == "boolean" : typeof c.equals == "string" : !1;
|
|
822
|
-
}), vl = (n) => ue(n) && Object.keys(n).every(
|
|
823
|
-
(o) => ["proposedDoc", "explanation"].includes(o)
|
|
824
|
-
) && ue(n.proposedDoc) && n.proposedDoc.type === "doc" && !Pn(n.proposedDoc) && (n.explanation === void 0 || typeof n.explanation == "string"), yl = (n) => ue(n) && Object.keys(n).length === 2 && typeof n.question == "string" && !_n(n.question) && ue(n.doc) && n.doc.type === "doc" && !Pn(n.doc), Hi = (n, o) => ue(o) && qe(n) && o.id === n && qe(o.name) && typeof o.prompt == "string" && (o.revision === void 0 || typeof o.revision == "string"), kl = (n, o) => ue(o) && o.kind === n && po(o.url) && (o.id === void 0 || Ct(o.id)) && (o.posterUrl === void 0 || po(o.posterUrl)), Io = () => ({
|
|
825
|
-
ok: !1,
|
|
826
|
-
error: {
|
|
827
|
-
code: "INVALID_RESPONSE",
|
|
828
|
-
message: "选项页数量超过请求上限",
|
|
829
|
-
retryable: !1
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
function Yi(n, o) {
|
|
833
|
-
if (!n || typeof n != "object") return !1;
|
|
834
|
-
try {
|
|
835
|
-
const i = Object.getOwnPropertyDescriptor(n, "ok"), a = Object.getOwnPropertyDescriptor(n, "data");
|
|
836
|
-
if ((i == null ? void 0 : i.value) !== !0 || !a || !("value" in a) || !a.value || typeof a.value != "object")
|
|
837
|
-
return !1;
|
|
838
|
-
const c = Object.getOwnPropertyDescriptor(a.value, "items");
|
|
839
|
-
return !!c && "value" in c && Array.isArray(c.value) && c.value.length > o;
|
|
840
|
-
} catch {
|
|
841
|
-
return !1;
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
function Qi(n, o) {
|
|
845
|
-
return !n.ok || n.data.items.length <= o ? n : Io();
|
|
846
|
-
}
|
|
847
|
-
function In(n, o, i) {
|
|
848
|
-
return Yi(n, i) ? Io() : Qi(yt(n, o), i);
|
|
849
|
-
}
|
|
850
|
-
async function Xi(n, o, i, a) {
|
|
851
|
-
const { search: c, cursor: p, parentId: v, limit: m } = o;
|
|
852
|
-
if (n.optionKind !== "selection") return null;
|
|
853
|
-
if (n.optionSource === "agents") {
|
|
854
|
-
const h = i == null ? void 0 : i.searchAgents;
|
|
855
|
-
if (typeof h != "function") return null;
|
|
856
|
-
const A = In(
|
|
857
|
-
await h(
|
|
858
|
-
{
|
|
859
|
-
...c !== void 0 ? { search: c } : {},
|
|
860
|
-
...p !== void 0 ? { cursor: p } : {},
|
|
861
|
-
limit: m
|
|
862
|
-
},
|
|
863
|
-
a
|
|
864
|
-
),
|
|
865
|
-
Ji,
|
|
866
|
-
m
|
|
867
|
-
);
|
|
868
|
-
return A.ok ? {
|
|
869
|
-
ok: !0,
|
|
870
|
-
data: {
|
|
871
|
-
...A.data,
|
|
872
|
-
items: A.data.items.map(({ id: g, name: O }) => ({ id: g, label: O }))
|
|
873
|
-
}
|
|
874
|
-
} : A;
|
|
875
|
-
}
|
|
876
|
-
if (n.optionSource === "variables") {
|
|
877
|
-
const h = i == null ? void 0 : i.listVariables;
|
|
878
|
-
return typeof h != "function" ? null : In(
|
|
879
|
-
await h(
|
|
880
|
-
{
|
|
881
|
-
...c !== void 0 ? { search: c } : {},
|
|
882
|
-
...p !== void 0 ? { cursor: p } : {},
|
|
883
|
-
limit: m
|
|
884
|
-
},
|
|
885
|
-
a
|
|
886
|
-
),
|
|
887
|
-
Gi,
|
|
888
|
-
m
|
|
889
|
-
);
|
|
890
|
-
}
|
|
891
|
-
if (n.optionSource === "flatTags" || n.optionSource === "capabilities") {
|
|
892
|
-
const h = i == null ? void 0 : i.listCapabilityOptions;
|
|
893
|
-
if (typeof h != "function") return null;
|
|
894
|
-
const A = await h(
|
|
895
|
-
{
|
|
896
|
-
capabilityId: n.id,
|
|
897
|
-
...v !== void 0 ? { parentId: v } : {},
|
|
898
|
-
...c !== void 0 ? { search: c } : {},
|
|
899
|
-
...p !== void 0 ? { cursor: p } : {},
|
|
900
|
-
limit: m
|
|
901
|
-
},
|
|
902
|
-
a
|
|
903
|
-
), g = In(
|
|
904
|
-
A,
|
|
905
|
-
n.optionSource === "flatTags" ? Wi : To,
|
|
906
|
-
m
|
|
907
|
-
);
|
|
908
|
-
return g.ok && n.optionHierarchy !== "tree" && g.data.items.some((O) => O.hasChildren) ? {
|
|
909
|
-
ok: !1,
|
|
910
|
-
error: {
|
|
911
|
-
code: "INVALID_RESPONSE",
|
|
912
|
-
message: "当前能力不支持分类选项",
|
|
913
|
-
retryable: !1
|
|
914
|
-
}
|
|
915
|
-
} : g;
|
|
916
|
-
}
|
|
917
|
-
return null;
|
|
918
|
-
}
|
|
919
|
-
function Zi(n) {
|
|
920
|
-
const o = Q(""), i = Ot([]), a = Ot([]), c = Q(null), p = Q(!1), v = /* @__PURE__ */ new Set();
|
|
921
|
-
let m = null, h = 0;
|
|
922
|
-
function A() {
|
|
923
|
-
if (!m) return;
|
|
924
|
-
const y = m;
|
|
925
|
-
m = null, y.abort(), n.track(y, !1), p.value = !1;
|
|
926
|
-
}
|
|
927
|
-
function g() {
|
|
928
|
-
A(), o.value = "", i.value = [], a.value = [], c.value = null, v.clear();
|
|
929
|
-
}
|
|
930
|
-
function O(y) {
|
|
931
|
-
A(), a.value = [...a.value, y], o.value = "", i.value = [], c.value = null, v.clear();
|
|
932
|
-
}
|
|
933
|
-
function l() {
|
|
934
|
-
return a.value.length ? (A(), a.value = a.value.slice(0, -1), o.value = "", i.value = [], c.value = null, v.clear(), !0) : !1;
|
|
935
|
-
}
|
|
936
|
-
async function T(y, I = !1) {
|
|
937
|
-
var L;
|
|
938
|
-
const N = I ? c.value : null;
|
|
939
|
-
if (I && !N) return;
|
|
940
|
-
I || (i.value = [], c.value = null, v.clear()), A();
|
|
941
|
-
const u = new AbortController();
|
|
942
|
-
m = u;
|
|
943
|
-
const M = ++h, D = o.value, F = (L = a.value.at(-1)) == null ? void 0 : L.id, J = n.descriptor(y), q = J == null ? void 0 : J.options, ne = q && "pageSize" in q ? q.pageSize ?? 30 : 30;
|
|
944
|
-
n.track(u, !0), p.value = !0;
|
|
945
|
-
try {
|
|
946
|
-
const G = J ? await Xi(
|
|
947
|
-
J,
|
|
948
|
-
{
|
|
949
|
-
search: D,
|
|
950
|
-
...F ? { parentId: F } : {},
|
|
951
|
-
...N ? { cursor: N } : {},
|
|
952
|
-
limit: ne
|
|
953
|
-
},
|
|
954
|
-
n.ports(),
|
|
955
|
-
n.context(y, u)
|
|
956
|
-
) : null;
|
|
957
|
-
if (u.signal.aborted || M !== h || !n.isCurrent(y))
|
|
958
|
-
return;
|
|
959
|
-
if (!G) {
|
|
960
|
-
n.diagnostic("PORT_MISSING", "宿主未提供所需的数据接口", y);
|
|
961
|
-
return;
|
|
962
|
-
}
|
|
963
|
-
if (!G.ok) {
|
|
964
|
-
n.portDiagnostic(G.error, y);
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
const pe = G.data.items, oe = I ? i.value : [], W = new Set(oe.map((Te) => Te.id));
|
|
968
|
-
if (pe.some((Te) => W.has(Te.id))) {
|
|
969
|
-
c.value = null, n.diagnostic("INVALID_RESPONSE", "选项分页返回了重复的 ID", y);
|
|
970
|
-
return;
|
|
971
|
-
}
|
|
972
|
-
const ie = G.data.nextCursor || null;
|
|
973
|
-
if (ie && (ie === N || v.has(ie))) {
|
|
974
|
-
c.value = null, n.diagnostic("INVALID_RESPONSE", "选项分页游标未前进", y);
|
|
975
|
-
return;
|
|
976
|
-
}
|
|
977
|
-
N && v.add(N), i.value = [...oe, ...pe], c.value = ie;
|
|
978
|
-
} catch (G) {
|
|
979
|
-
u.signal.aborted || n.diagnostic(
|
|
980
|
-
"PORT_FAILED",
|
|
981
|
-
G instanceof Error ? G.message : "请求失败",
|
|
982
|
-
y
|
|
983
|
-
);
|
|
984
|
-
} finally {
|
|
985
|
-
n.track(u, !1), m === u && (m = null, p.value = !1);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
return {
|
|
989
|
-
query: o,
|
|
990
|
-
options: i,
|
|
991
|
-
path: a,
|
|
992
|
-
nextCursor: c,
|
|
993
|
-
loading: p,
|
|
994
|
-
abort: A,
|
|
995
|
-
reset: g,
|
|
996
|
-
enter: O,
|
|
997
|
-
back: l,
|
|
998
|
-
fetch: T
|
|
999
|
-
};
|
|
1000
|
-
}
|
|
1001
|
-
function bo(n) {
|
|
1002
|
-
return Number.isSafeInteger(n) && n >= 0 && n < Number.MAX_SAFE_INTEGER;
|
|
1003
|
-
}
|
|
1004
|
-
function ea(n) {
|
|
1005
|
-
const o = {
|
|
1006
|
-
type: "doc",
|
|
1007
|
-
content: n.type === "businessToken" ? [{ type: "paragraph", content: [n] }] : [n]
|
|
1008
|
-
};
|
|
1009
|
-
return !Pn(o);
|
|
1010
|
-
}
|
|
1011
|
-
function ta(n, o) {
|
|
1012
|
-
if (!n || typeof n != "object" || Array.isArray(n)) return null;
|
|
1013
|
-
try {
|
|
1014
|
-
if (kt(n) !== null) return null;
|
|
1015
|
-
const i = JSON.parse(JSON.stringify(n));
|
|
1016
|
-
return !o || typeof i.enabled == "boolean" ? i : null;
|
|
1017
|
-
} catch {
|
|
1018
|
-
return null;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
function Et(n, o) {
|
|
1022
|
-
return Object.keys(n).some((i) => !o.includes(i));
|
|
1023
|
-
}
|
|
1024
|
-
function Eo(n, o) {
|
|
1025
|
-
var A, g, O;
|
|
1026
|
-
if (!Array.isArray(o))
|
|
1027
|
-
return { ok: !1, reason: "扩展返回值不是操作列表" };
|
|
1028
|
-
if (!o.length) return { ok: !0, kind: "none" };
|
|
1029
|
-
if (kt(o) !== null)
|
|
1030
|
-
return { ok: !1, reason: "扩展操作包含不可序列化参数" };
|
|
1031
|
-
const i = [];
|
|
1032
|
-
let a = null, c = null, p;
|
|
1033
|
-
const v = [];
|
|
1034
|
-
let m = "";
|
|
1035
|
-
for (const l of o) {
|
|
1036
|
-
if (!l || l.capabilityId !== n.id)
|
|
1037
|
-
return { ok: !1, reason: "操作能力与扩展不匹配" };
|
|
1038
|
-
if (l.kind === "setOwnState") {
|
|
1039
|
-
if (n.implementation !== "plugin" || a || Et(l, ["kind", "capabilityId", "data"]))
|
|
1040
|
-
return { ok: !1, reason: "扩展状态操作无效" };
|
|
1041
|
-
const T = ta(
|
|
1042
|
-
l.data,
|
|
1043
|
-
n.slot === "questionAction"
|
|
1044
|
-
);
|
|
1045
|
-
if (!T) return { ok: !1, reason: "扩展状态操作无效" };
|
|
1046
|
-
a = T;
|
|
1047
|
-
} else if (l.kind === "insertOwnToken") {
|
|
1048
|
-
if (n.slot !== "knowledgeInline" || v.length || c || Et(l, [
|
|
1049
|
-
"kind",
|
|
1050
|
-
"capabilityId",
|
|
1051
|
-
"key",
|
|
1052
|
-
"label",
|
|
1053
|
-
"token",
|
|
1054
|
-
"params"
|
|
1055
|
-
]) || typeof l.key != "string" || !l.key || typeof l.label != "string" || l.token !== void 0 && (typeof l.token != "string" || !l.token) || l.params !== void 0 && (n.id !== "tool" || !l.params || typeof l.params != "object" || Array.isArray(l.params) || JSON.stringify(l.params).length > 8192) || n.id === "variable" && (typeof l.token != "string" || !l.token))
|
|
1056
|
-
return { ok: !1, reason: "扩展引用操作无效" };
|
|
1057
|
-
i.push(
|
|
1058
|
-
{
|
|
1059
|
-
type: "businessToken",
|
|
1060
|
-
attrs: {
|
|
1061
|
-
kind: n.id,
|
|
1062
|
-
key: l.key,
|
|
1063
|
-
label: l.label,
|
|
1064
|
-
...l.token ? { token: l.token } : {},
|
|
1065
|
-
...l.params ? { params: l.params } : {}
|
|
1066
|
-
}
|
|
1067
|
-
},
|
|
1068
|
-
{ type: "text", text: " " }
|
|
1069
|
-
);
|
|
1070
|
-
} else if (l.kind === "insertOwnBlock") {
|
|
1071
|
-
if (n.slot !== "knowledgeBlock" || l.block !== "originalReply" || v.length || c || Et(l, ["kind", "capabilityId", "block"]) || l.block !== n.id)
|
|
1072
|
-
return { ok: !1, reason: "扩展块操作无效" };
|
|
1073
|
-
i.push(
|
|
1074
|
-
{ type: "originalReply", content: [{ type: "paragraph" }] },
|
|
1075
|
-
{ type: "paragraph" }
|
|
1076
|
-
);
|
|
1077
|
-
} else if (l.kind === "replaceSceneDoc") {
|
|
1078
|
-
if (n.slot !== "sceneAction" || n.implementation !== "plugin" || i.length || v.length || c || Et(l, [
|
|
1079
|
-
"kind",
|
|
1080
|
-
"capabilityId",
|
|
1081
|
-
"doc",
|
|
1082
|
-
"question",
|
|
1083
|
-
"confirmation"
|
|
1084
|
-
]) || l.question !== void 0 && (typeof l.question != "string" || _n(l.question)) || typeof l.confirmation != "string" || !l.confirmation.trim() || l.confirmation.length > 160 || !l.doc || typeof l.doc != "object" || Array.isArray(l.doc) || l.doc.type !== "doc")
|
|
1085
|
-
return { ok: !1, reason: "扩展正文替换操作无效" };
|
|
1086
|
-
c = JSON.parse(JSON.stringify(l.doc)), p = l.question, m = l.confirmation;
|
|
1087
|
-
} else if (l.kind === "updateOwnNode") {
|
|
1088
|
-
const { node: T, nodeId: y, expectedNodeVersion: I } = l;
|
|
1089
|
-
if (!["knowledgeInline", "knowledgeBlock"].includes(n.slot) || ["image", "video"].includes(n.id) && o.length !== 1 || i.length || c || v.some((N) => N.nodeId === y) || Et(l, [
|
|
1090
|
-
"kind",
|
|
1091
|
-
"capabilityId",
|
|
1092
|
-
"nodeId",
|
|
1093
|
-
"expectedNodeVersion",
|
|
1094
|
-
"node"
|
|
1095
|
-
]) || typeof y != "string" || !y || !bo(I) || !T || typeof T != "object" || Array.isArray(T) || T.type !== "originalReply" && Object.keys(T).some((N) => !["type", "attrs"].includes(N)) || T.type === "originalReply" && Object.keys(T).some(
|
|
1096
|
-
(N) => !["type", "attrs", "content"].includes(N)
|
|
1097
|
-
) || Ti(T.type || "", T.attrs) !== n.id || n.slot === "knowledgeInline" != (T.type === "businessToken") || ((A = T.attrs) == null ? void 0 : A.id) !== y || ((g = T.attrs) == null ? void 0 : g.nodeVersion) !== I + 1 || T.type === "mediaBlock" && ((O = T.attrs) == null ? void 0 : O.status) !== "ready" || T.type === "originalReply" && Ii(T) || !ea(T))
|
|
1098
|
-
return { ok: !1, reason: "扩展节点更新操作无效" };
|
|
1099
|
-
v.push({
|
|
1100
|
-
ok: !0,
|
|
1101
|
-
kind: "updateNode",
|
|
1102
|
-
nodeId: y,
|
|
1103
|
-
expectedNodeVersion: I,
|
|
1104
|
-
node: JSON.parse(JSON.stringify(T))
|
|
1105
|
-
});
|
|
1106
|
-
} else if (l.kind === "removeOwnNode") {
|
|
1107
|
-
const { nodeId: T, expectedNodeVersion: y } = l;
|
|
1108
|
-
if (!["knowledgeInline", "knowledgeBlock"].includes(n.slot) || ["image", "video"].includes(n.id) && o.length !== 1 || i.length || c || v.some((I) => I.nodeId === T) || Et(l, [
|
|
1109
|
-
"kind",
|
|
1110
|
-
"capabilityId",
|
|
1111
|
-
"nodeId",
|
|
1112
|
-
"expectedNodeVersion"
|
|
1113
|
-
]) || typeof T != "string" || !T || !bo(y))
|
|
1114
|
-
return { ok: !1, reason: "扩展节点删除操作无效" };
|
|
1115
|
-
v.push({
|
|
1116
|
-
ok: !0,
|
|
1117
|
-
kind: "removeNode",
|
|
1118
|
-
nodeId: T,
|
|
1119
|
-
expectedNodeVersion: y
|
|
1120
|
-
});
|
|
1121
|
-
} else
|
|
1122
|
-
return { ok: !1, reason: "扩展操作类型无效" };
|
|
1123
|
-
}
|
|
1124
|
-
let h = null;
|
|
1125
|
-
if (v.length === 1) {
|
|
1126
|
-
const [l] = v;
|
|
1127
|
-
h = l;
|
|
1128
|
-
} else v.length > 1 ? h = { ok: !0, kind: "batchNodes", operations: v } : c ? h = {
|
|
1129
|
-
ok: !0,
|
|
1130
|
-
kind: "replaceDoc",
|
|
1131
|
-
doc: c,
|
|
1132
|
-
...p !== void 0 ? { question: p } : {},
|
|
1133
|
-
confirmation: m
|
|
1134
|
-
} : i.length && (h = { ok: !0, kind: "doc", content: i });
|
|
1135
|
-
return a && h ? { ok: !0, kind: "compound", data: a, document: h } : a ? { ok: !0, kind: "state", data: a } : h || { ok: !0, kind: "none" };
|
|
1136
|
-
}
|
|
1137
|
-
function na(n) {
|
|
1138
|
-
return n.type.startsWith("image/") ? "image" : n.type.startsWith("video/") ? "video" : null;
|
|
1139
|
-
}
|
|
1140
|
-
function En(n, o, i) {
|
|
1141
|
-
const a = i == null ? void 0 : i.options;
|
|
1142
|
-
return a && "mimeTypes" in a && a.mimeTypes && !a.mimeTypes.includes(n.type) ? {
|
|
1143
|
-
code: "INVALID_MEDIA",
|
|
1144
|
-
message: `文件类型不符合${o === "image" ? "图片" : "视频"}配置`
|
|
1145
|
-
} : a && "maxBytes" in a && a.maxBytes && n.size > a.maxBytes ? {
|
|
1146
|
-
code: "MEDIA_TOO_LARGE",
|
|
1147
|
-
message: `文件不能超过 ${a.maxBytes} 字节`
|
|
1148
|
-
} : null;
|
|
1149
|
-
}
|
|
1150
|
-
function oa(n) {
|
|
1151
|
-
const o = /* @__PURE__ */ new Map();
|
|
1152
|
-
let i = null;
|
|
1153
|
-
function a(y) {
|
|
1154
|
-
i == null || i.dispose(), i = y;
|
|
1155
|
-
}
|
|
1156
|
-
function c() {
|
|
1157
|
-
const y = i;
|
|
1158
|
-
return i = null, y;
|
|
1159
|
-
}
|
|
1160
|
-
function p() {
|
|
1161
|
-
a(null);
|
|
1162
|
-
}
|
|
1163
|
-
function v(y) {
|
|
1164
|
-
return o.has(y);
|
|
1165
|
-
}
|
|
1166
|
-
function m(y) {
|
|
1167
|
-
var I;
|
|
1168
|
-
for (const [N, u] of o)
|
|
1169
|
-
y.has(N) || ((I = u.controller) == null || I.abort(), o.delete(N));
|
|
1170
|
-
}
|
|
1171
|
-
function h(y, I) {
|
|
1172
|
-
var J, q, ne;
|
|
1173
|
-
const N = {
|
|
1174
|
-
active: /* @__PURE__ */ new Set(),
|
|
1175
|
-
files: /* @__PURE__ */ new Set(),
|
|
1176
|
-
markFailed: []
|
|
1177
|
-
};
|
|
1178
|
-
if (I.id !== y.id) return N;
|
|
1179
|
-
const u = new Set(o.keys()), M = (L) => {
|
|
1180
|
-
const G = /* @__PURE__ */ new Map(), pe = /* @__PURE__ */ new Set(), oe = (W) => {
|
|
1181
|
-
var Te, Ve;
|
|
1182
|
-
const ie = (Te = W.attrs) == null ? void 0 : Te.id;
|
|
1183
|
-
W.type === "mediaBlock" && typeof ie == "string" && u.has(ie) && (G.has(ie) ? pe.add(ie) : G.set(ie, W)), (Ve = W.content) == null || Ve.forEach(oe);
|
|
1184
|
-
};
|
|
1185
|
-
return L && oe(L), pe.forEach((W) => G.delete(W)), G;
|
|
1186
|
-
}, D = M(y.knowledge.doc), F = M(I.knowledge.doc);
|
|
1187
|
-
for (const [L, G] of o) {
|
|
1188
|
-
const pe = (J = n.editor()) == null ? void 0 : J.getMediaState(L), oe = D.get(L), W = F.get(L);
|
|
1189
|
-
!pe || !oe || !W || pe.kind !== G.kind || ((q = W.attrs) == null ? void 0 : q.kind) !== G.kind || !Number.isSafeInteger((ne = W.attrs) == null ? void 0 : ne.nodeVersion) || W.attrs.nodeVersion < 0 || W.attrs.status !== "uploading" && W.attrs.status !== "error" || (N.files.add(L), pe.status === W.attrs.status && mt(oe) === mt(W) ? N.active.add(L) : W.attrs.status === "uploading" && N.markFailed.push({
|
|
1190
|
-
id: L,
|
|
1191
|
-
nodeVersion: W.attrs.nodeVersion
|
|
1192
|
-
}));
|
|
1193
|
-
}
|
|
1194
|
-
return N;
|
|
1195
|
-
}
|
|
1196
|
-
function A(y) {
|
|
1197
|
-
return new Set(
|
|
1198
|
-
[...o].filter(([I]) => y.has(I)).map(([, I]) => I.controller).filter((I) => !!I)
|
|
1199
|
-
);
|
|
1200
|
-
}
|
|
1201
|
-
function g(y) {
|
|
1202
|
-
for (const [I, N] of o)
|
|
1203
|
-
y != null && y.files.has(I) ? y.active.has(I) || (N.controller = void 0) : o.delete(I);
|
|
1204
|
-
}
|
|
1205
|
-
async function O(y, I, N, u = !1) {
|
|
1206
|
-
var D, F;
|
|
1207
|
-
const M = [];
|
|
1208
|
-
try {
|
|
1209
|
-
for (const J of y) {
|
|
1210
|
-
const q = na(J);
|
|
1211
|
-
if (!q || N && q !== N) {
|
|
1212
|
-
n.diagnostic(
|
|
1213
|
-
"INVALID_MEDIA",
|
|
1214
|
-
"文件类型不符合当前媒体能力",
|
|
1215
|
-
"validation",
|
|
1216
|
-
N
|
|
1217
|
-
);
|
|
1218
|
-
continue;
|
|
1219
|
-
}
|
|
1220
|
-
if (!n.canUse(q)) {
|
|
1221
|
-
n.diagnostic(
|
|
1222
|
-
"CAPABILITY_REVOKED",
|
|
1223
|
-
"此媒体能力当前不可用",
|
|
1224
|
-
"config",
|
|
1225
|
-
q
|
|
1226
|
-
);
|
|
1227
|
-
continue;
|
|
1228
|
-
}
|
|
1229
|
-
const ne = En(J, q, n.capability(q));
|
|
1230
|
-
if (ne) {
|
|
1231
|
-
n.diagnostic(
|
|
1232
|
-
ne.code,
|
|
1233
|
-
ne.message,
|
|
1234
|
-
"validation",
|
|
1235
|
-
q
|
|
1236
|
-
);
|
|
1237
|
-
continue;
|
|
1238
|
-
}
|
|
1239
|
-
const L = (D = n.editor()) == null ? void 0 : D.insertPendingMedia(J, q, I);
|
|
1240
|
-
if (!L) {
|
|
1241
|
-
const G = I.status() !== "ready";
|
|
1242
|
-
n.diagnostic(
|
|
1243
|
-
G ? "INSERT_TARGET_LOST" : "INSERT_FAILED",
|
|
1244
|
-
G ? "原始插入位置已失效,媒体未写入" : "媒体未能插入知识区",
|
|
1245
|
-
"validation",
|
|
1246
|
-
q
|
|
1247
|
-
);
|
|
1248
|
-
continue;
|
|
1249
|
-
}
|
|
1250
|
-
o.set(L, { file: J, kind: q }), M.push(L);
|
|
1251
|
-
}
|
|
1252
|
-
} finally {
|
|
1253
|
-
I.dispose();
|
|
1254
|
-
}
|
|
1255
|
-
M.length && u && ((F = n.editor()) == null || F.focus()), await Promise.all(M.map(l));
|
|
1256
|
-
}
|
|
1257
|
-
async function l(y) {
|
|
1258
|
-
var G, pe, oe, W, ie, Te, Ve, be, he;
|
|
1259
|
-
const I = o.get(y), N = n.editor(), u = N == null ? void 0 : N.getMediaState(y);
|
|
1260
|
-
if (!I || I.controller || (u == null ? void 0 : u.status) !== "uploading" || u.kind !== I.kind)
|
|
1261
|
-
return;
|
|
1262
|
-
const { file: M, kind: D } = I, F = n.capability(D), J = F == null ? void 0 : F.primaryActionId, q = u.nodeVersion;
|
|
1263
|
-
if (!F || !J) {
|
|
1264
|
-
N != null && N.failMedia(y, "宿主未提供媒体上传接口", q) && n.diagnostic("PORT_MISSING", "宿主未提供媒体上传接口", "port", D);
|
|
1265
|
-
return;
|
|
1266
|
-
}
|
|
1267
|
-
const ne = n.sceneKey(), L = new AbortController();
|
|
1268
|
-
I.controller = L, n.track(L, !0);
|
|
1269
|
-
try {
|
|
1270
|
-
const Pe = await So(F);
|
|
1271
|
-
if (L.signal.aborted || ne !== n.sceneKey() || o.get(y) !== I)
|
|
1272
|
-
return;
|
|
1273
|
-
if (!n.canUse(D)) {
|
|
1274
|
-
(G = n.editor()) == null || G.failMedia(y, "媒体能力已失效,请删除后重试", q);
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
const se = n.capability(D), Ie = En(M, D, se);
|
|
1278
|
-
if (Ie) {
|
|
1279
|
-
(pe = n.editor()) != null && pe.failMedia(y, Ie.message, q) && n.diagnostic(
|
|
1280
|
-
Ie.code,
|
|
1281
|
-
Ie.message,
|
|
1282
|
-
"validation",
|
|
1283
|
-
D
|
|
1284
|
-
);
|
|
1285
|
-
return;
|
|
1286
|
-
}
|
|
1287
|
-
const Je = se ? xn(se, J, n.ports()) : null;
|
|
1288
|
-
if (!Je) {
|
|
1289
|
-
(oe = n.editor()) != null && oe.failMedia(y, "宿主未提供媒体上传接口", q) && n.diagnostic(
|
|
1290
|
-
"PORT_MISSING",
|
|
1291
|
-
"宿主未提供媒体上传接口",
|
|
1292
|
-
"port",
|
|
1293
|
-
D
|
|
1294
|
-
);
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
const xe = Pe.ok ? Pe.module.actions[J] : null;
|
|
1298
|
-
if (!xe) {
|
|
1299
|
-
(W = n.editor()) != null && W.failMedia(y, "媒体上传扩展不可用", q) && n.diagnostic(
|
|
1300
|
-
"PLUGIN_UNAVAILABLE",
|
|
1301
|
-
"媒体上传扩展不可用",
|
|
1302
|
-
"plugin",
|
|
1303
|
-
D
|
|
1304
|
-
);
|
|
1305
|
-
return;
|
|
1306
|
-
}
|
|
1307
|
-
const Qe = n.context(D, L);
|
|
1308
|
-
Qe.reportProgress = (X) => {
|
|
1309
|
-
var $e;
|
|
1310
|
-
!L.signal.aborted && ne === n.sceneKey() && o.get(y) === I && n.canUse(D) && (($e = n.editor()) == null || $e.reportMediaProgress(y, q, X));
|
|
1311
|
-
};
|
|
1312
|
-
const Re = n.scene(), w = await xe.execute(
|
|
1313
|
-
{ upload: { file: M, nodeId: y, expectedNodeVersion: q } },
|
|
1314
|
-
{
|
|
1315
|
-
scene: JSON.parse(JSON.stringify(Re.scene)),
|
|
1316
|
-
sceneKey: ne,
|
|
1317
|
-
revision: Re.revision,
|
|
1318
|
-
options: se == null ? void 0 : se.options,
|
|
1319
|
-
request: Qe,
|
|
1320
|
-
ports: Je
|
|
1321
|
-
}
|
|
1322
|
-
);
|
|
1323
|
-
if (L.signal.aborted || ne !== n.sceneKey() || o.get(y) !== I)
|
|
1324
|
-
return;
|
|
1325
|
-
if (!n.canUse(D)) {
|
|
1326
|
-
(ie = n.editor()) == null || ie.failMedia(y, "媒体能力已失效,请删除后重试", q);
|
|
1327
|
-
return;
|
|
1328
|
-
}
|
|
1329
|
-
const P = En(
|
|
1330
|
-
M,
|
|
1331
|
-
D,
|
|
1332
|
-
n.capability(D)
|
|
1333
|
-
);
|
|
1334
|
-
if (P) {
|
|
1335
|
-
(Te = n.editor()) != null && Te.failMedia(y, P.message, q) && n.diagnostic(
|
|
1336
|
-
P.code,
|
|
1337
|
-
P.message,
|
|
1338
|
-
"validation",
|
|
1339
|
-
D
|
|
1340
|
-
);
|
|
1341
|
-
return;
|
|
1342
|
-
}
|
|
1343
|
-
const j = yt(
|
|
1344
|
-
w,
|
|
1345
|
-
(X) => Array.isArray(X)
|
|
1346
|
-
);
|
|
1347
|
-
if (!j.ok) {
|
|
1348
|
-
(Ve = n.editor()) != null && Ve.failMedia(y, j.error.message, q) && n.portDiagnostic(j.error, D);
|
|
1349
|
-
return;
|
|
1350
|
-
}
|
|
1351
|
-
const ce = Eo(F, j.data);
|
|
1352
|
-
if (!ce.ok || ce.kind !== "updateNode") {
|
|
1353
|
-
(be = n.editor()) != null && be.failMedia(y, "媒体扩展返回的节点更新无效", q) && n.diagnostic(
|
|
1354
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
1355
|
-
ce.ok ? "媒体扩展未返回节点更新" : ce.reason,
|
|
1356
|
-
"plugin",
|
|
1357
|
-
D
|
|
1358
|
-
);
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
|
-
n.applyNodeUpdate(ce, D) && o.delete(y);
|
|
1362
|
-
} catch (Pe) {
|
|
1363
|
-
if (!L.signal.aborted) {
|
|
1364
|
-
const se = Pe instanceof Error ? Pe.message : "上传失败";
|
|
1365
|
-
(he = n.editor()) != null && he.failMedia(y, se, q) && n.diagnostic("PORT_FAILED", se, "port", D);
|
|
1366
|
-
}
|
|
1367
|
-
} finally {
|
|
1368
|
-
I.controller === L && (I.controller = void 0), n.track(L, !1);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
function T(y) {
|
|
1372
|
-
var u, M;
|
|
1373
|
-
const I = o.get(y), N = (u = n.editor()) == null ? void 0 : u.getMediaState(y);
|
|
1374
|
-
!I || I.controller || (N == null ? void 0 : N.status) !== "error" || N.kind !== I.kind || !n.canUse(I.kind) || (M = n.editor()) != null && M.retryMedia(y, N.nodeVersion) && l(y);
|
|
1375
|
-
}
|
|
1376
|
-
return {
|
|
1377
|
-
selectTarget: a,
|
|
1378
|
-
takeTarget: c,
|
|
1379
|
-
clearTarget: p,
|
|
1380
|
-
has: v,
|
|
1381
|
-
removeAbsent: m,
|
|
1382
|
-
classify: h,
|
|
1383
|
-
activeControllers: A,
|
|
1384
|
-
retain: g,
|
|
1385
|
-
enqueue: O,
|
|
1386
|
-
retry: T
|
|
1387
|
-
};
|
|
1388
|
-
}
|
|
1389
|
-
function ia(n, o) {
|
|
1390
|
-
var a, c, p;
|
|
1391
|
-
const i = Object.prototype.hasOwnProperty.call(o, n.id) ? o[n.id] : n.defaultValue;
|
|
1392
|
-
if (n.kind === "switch" || n.kind === "checkbox")
|
|
1393
|
-
return i === !0;
|
|
1394
|
-
if (n.kind === "radio") {
|
|
1395
|
-
const v = String(i ?? "");
|
|
1396
|
-
return (a = n.options) != null && a.some((m) => m.value === v) ? v : ((p = (c = n.options) == null ? void 0 : c[0]) == null ? void 0 : p.value) || "";
|
|
1397
|
-
}
|
|
1398
|
-
return String(i ?? "");
|
|
1399
|
-
}
|
|
1400
|
-
function aa(n, o) {
|
|
1401
|
-
var a;
|
|
1402
|
-
const i = new Map(o.fields.map((c) => [c.id, c]));
|
|
1403
|
-
for (const [c, p] of Object.entries(n)) {
|
|
1404
|
-
const v = i.get(c);
|
|
1405
|
-
if (!v) return c;
|
|
1406
|
-
if (v.visibleWhen) {
|
|
1407
|
-
const m = i.get(v.visibleWhen.fieldId);
|
|
1408
|
-
if (!m || ia(m, n) !== v.visibleWhen.equals)
|
|
1409
|
-
return c;
|
|
1410
|
-
}
|
|
1411
|
-
if (v.kind === "switch" || v.kind === "checkbox") {
|
|
1412
|
-
if (typeof p != "boolean") return c;
|
|
1413
|
-
continue;
|
|
1414
|
-
}
|
|
1415
|
-
if (typeof p != "string" || p.trim() !== p || v.kind === "radio" && !((a = v.options) != null && a.some((m) => m.value === p)))
|
|
1416
|
-
return c;
|
|
1417
|
-
}
|
|
1418
|
-
return null;
|
|
1419
|
-
}
|
|
1420
|
-
function la(n) {
|
|
1421
|
-
const o = Ot(null), i = Ot(null);
|
|
1422
|
-
let a = null;
|
|
1423
|
-
function c() {
|
|
1424
|
-
if (!a) return;
|
|
1425
|
-
const g = a;
|
|
1426
|
-
a = null, g.abort(), n.track(g, !1);
|
|
1427
|
-
}
|
|
1428
|
-
function p() {
|
|
1429
|
-
var g, O;
|
|
1430
|
-
c(), (O = (g = o.value) == null ? void 0 : g.target) == null || O.dispose(), o.value = null, i.value = null;
|
|
1431
|
-
}
|
|
1432
|
-
function v(g, O) {
|
|
1433
|
-
g === O || !o.value || (p(), n.diagnostic(
|
|
1434
|
-
"TOOL_FORM_CHANGED",
|
|
1435
|
-
"工具配置接口已更新,请重新打开",
|
|
1436
|
-
"port"
|
|
1437
|
-
));
|
|
1438
|
-
}
|
|
1439
|
-
async function m(g) {
|
|
1440
|
-
var T, y;
|
|
1441
|
-
if (p(), !n.canUse()) {
|
|
1442
|
-
(T = g.target) == null || T.dispose();
|
|
1443
|
-
return;
|
|
1444
|
-
}
|
|
1445
|
-
const O = n.getPort();
|
|
1446
|
-
if (typeof O != "function") {
|
|
1447
|
-
(y = g.target) == null || y.dispose(), n.diagnostic("PORT_MISSING", "宿主未提供工具配置接口", "port");
|
|
1448
|
-
return;
|
|
1449
|
-
}
|
|
1450
|
-
o.value = g;
|
|
1451
|
-
const l = new AbortController();
|
|
1452
|
-
a = l, n.track(l, !0);
|
|
1453
|
-
try {
|
|
1454
|
-
const I = await O({ toolId: g.key }, n.context(l)), N = n.getScene();
|
|
1455
|
-
if (l.signal.aborted || a !== l || g.sceneKey !== N.sceneKey || g.type !== N.type)
|
|
1456
|
-
return;
|
|
1457
|
-
const u = yt(
|
|
1458
|
-
I,
|
|
1459
|
-
(M) => mo(g.key, M)
|
|
1460
|
-
);
|
|
1461
|
-
if (!u.ok) {
|
|
1462
|
-
n.portDiagnostic(u.error), p();
|
|
1463
|
-
return;
|
|
1464
|
-
}
|
|
1465
|
-
if (!u.data.permitted) {
|
|
1466
|
-
n.diagnostic("CAPABILITY_REVOKED", "当前无权使用此工具", "config"), p();
|
|
1467
|
-
return;
|
|
1468
|
-
}
|
|
1469
|
-
if (g.nodeId) {
|
|
1470
|
-
const M = aa(
|
|
1471
|
-
g.params,
|
|
1472
|
-
u.data
|
|
1473
|
-
);
|
|
1474
|
-
if (M !== null) {
|
|
1475
|
-
n.diagnostic(
|
|
1476
|
-
"TOOL_PARAMS_UNSUPPORTED",
|
|
1477
|
-
`当前工具表单无法编辑旧参数:${M}`,
|
|
1478
|
-
"validation"
|
|
1479
|
-
), p();
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
i.value = u.data;
|
|
1484
|
-
} catch (I) {
|
|
1485
|
-
l.signal.aborted || (n.diagnostic(
|
|
1486
|
-
"PORT_FAILED",
|
|
1487
|
-
I instanceof Error ? I.message : "工具配置读取失败",
|
|
1488
|
-
"port"
|
|
1489
|
-
), p());
|
|
1490
|
-
} finally {
|
|
1491
|
-
n.track(l, !1), a === l && (a = null);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
async function h(g, O) {
|
|
1495
|
-
if (a || o.value !== g || i.value !== O)
|
|
1496
|
-
return !1;
|
|
1497
|
-
const l = n.getPort();
|
|
1498
|
-
if (typeof l != "function")
|
|
1499
|
-
return n.diagnostic("PORT_MISSING", "宿主未提供工具配置接口", "port"), p(), !1;
|
|
1500
|
-
const T = new AbortController();
|
|
1501
|
-
a = T, n.track(T, !0);
|
|
1502
|
-
try {
|
|
1503
|
-
const y = await l({ toolId: g.key }, n.context(T));
|
|
1504
|
-
if (T.signal.aborted || a !== T || o.value !== g || i.value !== O)
|
|
1505
|
-
return !1;
|
|
1506
|
-
const I = n.getScene();
|
|
1507
|
-
if (g.sceneKey !== I.sceneKey || g.type !== I.type || !n.canUse())
|
|
1508
|
-
return p(), !1;
|
|
1509
|
-
if (n.getPort() !== l)
|
|
1510
|
-
return n.diagnostic(
|
|
1511
|
-
"TOOL_FORM_CHANGED",
|
|
1512
|
-
"工具配置接口已更新,请重新打开",
|
|
1513
|
-
"port"
|
|
1514
|
-
), p(), !1;
|
|
1515
|
-
const N = yt(
|
|
1516
|
-
y,
|
|
1517
|
-
(u) => mo(g.key, u)
|
|
1518
|
-
);
|
|
1519
|
-
return N.ok ? N.data.permitted ? mt(N.data.fields) !== mt(O.fields) ? (n.diagnostic(
|
|
1520
|
-
"TOOL_FORM_CHANGED",
|
|
1521
|
-
"工具配置已更新,请重新打开",
|
|
1522
|
-
"port"
|
|
1523
|
-
), p(), !1) : !0 : (n.diagnostic("CAPABILITY_REVOKED", "当前无权使用此工具", "config"), p(), !1) : (n.portDiagnostic(N.error), !1);
|
|
1524
|
-
} catch (y) {
|
|
1525
|
-
return T.signal.aborted || n.diagnostic(
|
|
1526
|
-
"PORT_FAILED",
|
|
1527
|
-
y instanceof Error ? y.message : "工具配置读取失败",
|
|
1528
|
-
"port"
|
|
1529
|
-
), !1;
|
|
1530
|
-
} finally {
|
|
1531
|
-
n.track(T, !1), a === T && (a = null);
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
function A() {
|
|
1535
|
-
o.value = null, i.value = null;
|
|
1536
|
-
}
|
|
1537
|
-
return {
|
|
1538
|
-
edit: o,
|
|
1539
|
-
definition: i,
|
|
1540
|
-
cancel: p,
|
|
1541
|
-
portChanged: v,
|
|
1542
|
-
open: m,
|
|
1543
|
-
recheck: h,
|
|
1544
|
-
releaseForInsert: A
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
function sa(n, o) {
|
|
1548
|
-
const i = (m, h) => n.some(
|
|
1549
|
-
(A) => A.slot === h && A.canInsert && m.includes(A.id)
|
|
1550
|
-
), a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new WeakSet(), p = (m) => {
|
|
1551
|
-
if (!m || typeof m != "object") return;
|
|
1552
|
-
const h = m;
|
|
1553
|
-
c.has(h) || (c.add(h), typeof h.type == "string" && a.add(h.type), Array.isArray(h.content) && h.content.forEach(p));
|
|
1554
|
-
};
|
|
1555
|
-
p(o);
|
|
1556
|
-
const v = i(["originalReply"], "knowledgeBlock") || a.has("originalReply");
|
|
1557
|
-
return {
|
|
1558
|
-
businessToken: i(Ni, "knowledgeInline") || a.has("businessToken"),
|
|
1559
|
-
originalReply: v,
|
|
1560
|
-
// OriginalReply's content expression references both node types.
|
|
1561
|
-
separator: v || a.has("messageSeparator"),
|
|
1562
|
-
mediaBlock: v || i(Ei, "knowledgeBlock") || a.has("mediaBlock")
|
|
1563
|
-
};
|
|
1564
|
-
}
|
|
1565
|
-
function ra(n) {
|
|
1566
|
-
return [
|
|
1567
|
-
n.businessToken,
|
|
1568
|
-
n.originalReply,
|
|
1569
|
-
n.separator,
|
|
1570
|
-
n.mediaBlock
|
|
1571
|
-
].map((o) => o ? "1" : "0").join("");
|
|
1572
|
-
}
|
|
1573
|
-
const ua = { class: "fkp-capability-help-head" }, Nn = /* @__PURE__ */ Cn({
|
|
1574
|
-
__name: "CapabilityHelp",
|
|
1575
|
-
props: {
|
|
1576
|
-
capabilityId: {}
|
|
1577
|
-
},
|
|
1578
|
-
emits: ["help"],
|
|
1579
|
-
setup(n, { emit: o }) {
|
|
1580
|
-
const i = n, a = o, c = {
|
|
1581
|
-
originalReply: {
|
|
1582
|
-
title: "原话复述",
|
|
1583
|
-
description: "支持普通知识,开启此标签;或在推理知识的回复话术末尾双引号前添加此标签;各模态命中即自动发送配置的原话术;启用后若用户多次触发将重复发送,可能触发平台风控,请谨慎使用。"
|
|
1584
|
-
},
|
|
1585
|
-
memory: {
|
|
1586
|
-
title: "记忆触发点",
|
|
1587
|
-
description: "顾客消息命中此场景后,系统将刷新记忆画像,供后续AI回复参考"
|
|
1588
|
-
},
|
|
1589
|
-
separator: {
|
|
1590
|
-
title: "分隔符",
|
|
1591
|
-
description: "分隔符前后内容将被分成两条消息发出"
|
|
1592
|
-
}
|
|
1593
|
-
};
|
|
1594
|
-
return (p, v) => (E(), C("div", {
|
|
1595
|
-
class: Ke(["fkp-capability-help", {
|
|
1596
|
-
"fkp-memory-help": i.capabilityId === "memory",
|
|
1597
|
-
"fkp-original-help": i.capabilityId === "originalReply",
|
|
1598
|
-
"fkp-separator-help": i.capabilityId === "separator"
|
|
1599
|
-
}])
|
|
1600
|
-
}, [
|
|
1601
|
-
_("div", ua, [
|
|
1602
|
-
_("strong", null, Z(c[i.capabilityId].title), 1),
|
|
1603
|
-
i.capabilityId !== "separator" ? (E(), le(k(ee), {
|
|
1604
|
-
key: 0,
|
|
1605
|
-
class: "fkp-capability-help-link",
|
|
1606
|
-
type: "text",
|
|
1607
|
-
onClick: v[0] || (v[0] = (m) => a("help"))
|
|
1608
|
-
}, {
|
|
1609
|
-
default: K(() => [
|
|
1610
|
-
x(k(de), {
|
|
1611
|
-
name: "book",
|
|
1612
|
-
size: 14
|
|
1613
|
-
}),
|
|
1614
|
-
v[1] || (v[1] = ye("我该怎么配? "))
|
|
1615
|
-
]),
|
|
1616
|
-
_: 1
|
|
1617
|
-
})) : $("", !0)
|
|
1618
|
-
]),
|
|
1619
|
-
_("p", null, Z(c[i.capabilityId].description), 1)
|
|
1620
|
-
], 2));
|
|
1621
|
-
}
|
|
1622
|
-
}), ca = { class: "fkp-variable-columns" }, da = {
|
|
1623
|
-
class: "fkp-variable-root",
|
|
1624
|
-
"aria-label": "变量分类"
|
|
1625
|
-
}, fa = {
|
|
1626
|
-
key: 0,
|
|
1627
|
-
class: "fkp-menu-empty"
|
|
1628
|
-
}, pa = {
|
|
1629
|
-
key: 1,
|
|
1630
|
-
class: "fkp-menu-empty"
|
|
1631
|
-
}, ga = { class: "fkp-variable-label" }, va = { class: "fkp-variable-label" }, ya = {
|
|
1632
|
-
class: "fkp-variable-children",
|
|
1633
|
-
"aria-label": "分组变量"
|
|
1634
|
-
}, ka = { class: "fkp-variable-label" }, ma = /* @__PURE__ */ Cn({
|
|
1635
|
-
__name: "VariableOptionList",
|
|
1636
|
-
props: {
|
|
1637
|
-
options: {},
|
|
1638
|
-
loading: { type: Boolean },
|
|
1639
|
-
nextCursor: {},
|
|
1640
|
-
query: {}
|
|
1641
|
-
},
|
|
1642
|
-
emits: ["choose", "loadMore"],
|
|
1643
|
-
setup(n, { emit: o }) {
|
|
1644
|
-
const i = n, a = o;
|
|
1645
|
-
function c(g) {
|
|
1646
|
-
return "group" in g && typeof g.group == "string" ? g.group.trim() : "";
|
|
1647
|
-
}
|
|
1648
|
-
const p = te(() => {
|
|
1649
|
-
const g = [], O = /* @__PURE__ */ new Set();
|
|
1650
|
-
for (const l of i.options) {
|
|
1651
|
-
const T = c(l);
|
|
1652
|
-
T ? O.has(T) || (g.push({ kind: "group", label: T }), O.add(T)) : g.push({ kind: "option", option: l });
|
|
1653
|
-
}
|
|
1654
|
-
return g;
|
|
1655
|
-
}), v = Q(""), m = te(
|
|
1656
|
-
() => p.value.flatMap(
|
|
1657
|
-
(g) => g.kind === "group" ? [g.label] : []
|
|
1658
|
-
)
|
|
1659
|
-
), h = te(
|
|
1660
|
-
() => m.value.includes(v.value) ? v.value : m.value[0] || ""
|
|
1661
|
-
), A = te(
|
|
1662
|
-
() => h.value ? i.options.filter((g) => c(g) === h.value) : []
|
|
1663
|
-
);
|
|
1664
|
-
return me(
|
|
1665
|
-
() => i.query,
|
|
1666
|
-
() => {
|
|
1667
|
-
v.value = "";
|
|
1668
|
-
}
|
|
1669
|
-
), (g, O) => (E(), C("div", ca, [
|
|
1670
|
-
_("div", da, [
|
|
1671
|
-
g.loading && !p.value.length ? (E(), C("p", fa, [
|
|
1672
|
-
x(k(de), {
|
|
1673
|
-
name: "sync",
|
|
1674
|
-
size: 15,
|
|
1675
|
-
class: "fkp-spin"
|
|
1676
|
-
}),
|
|
1677
|
-
O[1] || (O[1] = ye("加载中… "))
|
|
1678
|
-
])) : !g.loading && !p.value.length ? (E(), C("p", pa, " 暂无可选项 ")) : $("", !0),
|
|
1679
|
-
(E(!0), C(Ae, null, Ge(p.value, (l) => (E(), C(Ae, {
|
|
1680
|
-
key: l.kind === "group" ? `group:${l.label}` : `option:${l.option.id}`
|
|
1681
|
-
}, [
|
|
1682
|
-
l.kind === "group" ? (E(), le(k(ee), {
|
|
1683
|
-
key: 0,
|
|
1684
|
-
class: "fkp-variable-group",
|
|
1685
|
-
type: "text",
|
|
1686
|
-
"aria-label": l.label,
|
|
1687
|
-
title: l.label,
|
|
1688
|
-
"aria-pressed": h.value === l.label,
|
|
1689
|
-
onMouseenter: (T) => v.value = l.label,
|
|
1690
|
-
onFocus: (T) => v.value = l.label,
|
|
1691
|
-
onClick: (T) => v.value = l.label
|
|
1692
|
-
}, {
|
|
1693
|
-
default: K(() => [
|
|
1694
|
-
_("span", ga, Z(l.label), 1),
|
|
1695
|
-
x(k(de), {
|
|
1696
|
-
class: "fkp-variable-group-arrow",
|
|
1697
|
-
name: "arrow-down",
|
|
1698
|
-
size: 14
|
|
1699
|
-
})
|
|
1700
|
-
]),
|
|
1701
|
-
_: 2
|
|
1702
|
-
}, 1032, ["aria-label", "title", "aria-pressed", "onMouseenter", "onFocus", "onClick"])) : (E(), le(k(ee), {
|
|
1703
|
-
key: 1,
|
|
1704
|
-
type: "text",
|
|
1705
|
-
"aria-label": l.option.label,
|
|
1706
|
-
title: l.option.label,
|
|
1707
|
-
disabled: l.option.disabled,
|
|
1708
|
-
onClick: (T) => a("choose", l.option, T)
|
|
1709
|
-
}, {
|
|
1710
|
-
default: K(() => [
|
|
1711
|
-
_("span", va, Z(l.option.label), 1)
|
|
1712
|
-
]),
|
|
1713
|
-
_: 2
|
|
1714
|
-
}, 1032, ["aria-label", "title", "disabled", "onClick"]))
|
|
1715
|
-
], 64))), 128)),
|
|
1716
|
-
g.nextCursor ? (E(), le(k(ee), {
|
|
1717
|
-
key: 2,
|
|
1718
|
-
class: "fkp-menu-more",
|
|
1719
|
-
type: "text",
|
|
1720
|
-
disabled: g.loading,
|
|
1721
|
-
onClick: O[0] || (O[0] = (l) => a("loadMore"))
|
|
1722
|
-
}, {
|
|
1723
|
-
default: K(() => O[2] || (O[2] = [
|
|
1724
|
-
ye("加载更多")
|
|
1725
|
-
])),
|
|
1726
|
-
_: 1
|
|
1727
|
-
}, 8, ["disabled"])) : $("", !0)
|
|
1728
|
-
]),
|
|
1729
|
-
_("div", ya, [
|
|
1730
|
-
(E(!0), C(Ae, null, Ge(A.value, (l) => (E(), le(k(ee), {
|
|
1731
|
-
key: l.id,
|
|
1732
|
-
type: "text",
|
|
1733
|
-
"aria-label": l.label,
|
|
1734
|
-
title: l.label,
|
|
1735
|
-
disabled: l.disabled,
|
|
1736
|
-
onClick: (T) => a("choose", l, T)
|
|
1737
|
-
}, {
|
|
1738
|
-
default: K(() => [
|
|
1739
|
-
_("span", ka, Z(l.label), 1)
|
|
1740
|
-
]),
|
|
1741
|
-
_: 2
|
|
1742
|
-
}, 1032, ["aria-label", "title", "disabled", "onClick"]))), 128))
|
|
1743
|
-
])
|
|
1744
|
-
]));
|
|
1745
|
-
}
|
|
1746
|
-
}), ba = {
|
|
1747
|
-
key: 0,
|
|
1748
|
-
class: "fkp-type-menu-arrow",
|
|
1749
|
-
"aria-hidden": "true"
|
|
1750
|
-
}, ha = {
|
|
1751
|
-
key: 1,
|
|
1752
|
-
class: "fkp-menu fkp-type-menu",
|
|
1753
|
-
"aria-label": "选择知识类型"
|
|
1754
|
-
}, wa = { class: "fkp-type-option-copy" }, Sa = { class: "fkp-type-confirm-message" }, Aa = { class: "fkp-type-confirm-actions" }, Ta = { class: "fkp-toolbar-group" }, Ia = ["data-fkp-menu-trigger", "onMouseenter", "onPointerdownCapture"], Ea = { key: 0 }, Na = {
|
|
1755
|
-
key: 0,
|
|
1756
|
-
class: "fkp-more-wrap"
|
|
1757
|
-
}, Oa = {
|
|
1758
|
-
key: 0,
|
|
1759
|
-
class: "fkp-menu fkp-more-menu"
|
|
1760
|
-
}, Ca = ["data-fkp-menu-trigger", "onMouseenter", "onPointerdownCapture"], _a = {
|
|
1761
|
-
key: 1,
|
|
1762
|
-
class: "fkp-toolbar-right"
|
|
1763
|
-
}, Pa = {
|
|
1764
|
-
key: 0,
|
|
1765
|
-
class: "fkp-agent-menu-arrow",
|
|
1766
|
-
"aria-hidden": "true"
|
|
1767
|
-
}, xa = { class: "fkp-menu-head" }, Ma = {
|
|
1768
|
-
key: 0,
|
|
1769
|
-
class: "fkp-ticket-heading"
|
|
1770
|
-
}, Ra = { key: 1 }, Da = {
|
|
1771
|
-
key: 1,
|
|
1772
|
-
class: "fkp-todo-guidance"
|
|
1773
|
-
}, La = {
|
|
1774
|
-
key: 2,
|
|
1775
|
-
class: "fkp-ticket-guidance"
|
|
1776
|
-
}, Ka = {
|
|
1777
|
-
key: 3,
|
|
1778
|
-
class: "fkp-reference-guidance"
|
|
1779
|
-
}, qa = {
|
|
1780
|
-
key: 4,
|
|
1781
|
-
class: "fkp-tagged-guidance"
|
|
1782
|
-
}, Va = {
|
|
1783
|
-
key: 5,
|
|
1784
|
-
class: "fkp-variable-guidance"
|
|
1785
|
-
}, $a = {
|
|
1786
|
-
key: 6,
|
|
1787
|
-
class: "fkp-agent-guidance"
|
|
1788
|
-
}, Ba = {
|
|
1789
|
-
key: 7,
|
|
1790
|
-
class: "fkp-menu-path"
|
|
1791
|
-
}, Ua = {
|
|
1792
|
-
key: 9,
|
|
1793
|
-
class: "fkp-option-list"
|
|
1794
|
-
}, Fa = {
|
|
1795
|
-
key: 0,
|
|
1796
|
-
class: "fkp-menu-empty"
|
|
1797
|
-
}, ja = {
|
|
1798
|
-
key: 1,
|
|
1799
|
-
class: "fkp-menu-empty"
|
|
1800
|
-
}, za = { class: "fkp-template-drawer" }, Ga = {
|
|
1801
|
-
key: 0,
|
|
1802
|
-
class: "fkp-menu-empty"
|
|
1803
|
-
}, Ja = {
|
|
1804
|
-
key: 1,
|
|
1805
|
-
class: "fkp-menu-empty"
|
|
1806
|
-
}, Wa = {
|
|
1807
|
-
key: 0,
|
|
1808
|
-
class: "fkp-template-example"
|
|
1809
|
-
}, Ha = { key: 0 }, Ya = { class: "fkp-question-row" }, Qa = {
|
|
1810
|
-
"aria-hidden": "true",
|
|
1811
|
-
class: "fkp-question-measure"
|
|
1812
|
-
}, Xa = {
|
|
1813
|
-
key: 0,
|
|
1814
|
-
class: "fkp-question-tags"
|
|
1815
|
-
}, Za = { class: "fkp-question-tag-label" }, el = { class: "fkp-knowledge-row" }, tl = {
|
|
1816
|
-
key: 0,
|
|
1817
|
-
class: "fkp-unsupported"
|
|
1818
|
-
}, nl = { class: "fkp-safe-preview" }, ol = { class: "fkp-safe-preview fkp-safe-state" }, il = {
|
|
1819
|
-
key: 2,
|
|
1820
|
-
class: "fkp-agent-preview"
|
|
1821
|
-
}, al = {
|
|
1822
|
-
key: 0,
|
|
1823
|
-
class: "fkp-agent-preview-name"
|
|
1824
|
-
}, ll = ["accept"], sl = 2147483647, ml = /* @__PURE__ */ Cn({
|
|
1825
|
-
name: "FkpRichText",
|
|
1826
|
-
__name: "FkpRichText",
|
|
1827
|
-
props: {
|
|
1828
|
-
sceneKey: { default: "default" },
|
|
1829
|
-
modelValue: { default: () => nn() },
|
|
1830
|
-
config: {},
|
|
1831
|
-
policy: {},
|
|
1832
|
-
ports: {},
|
|
1833
|
-
ackRevision: { default: 0 },
|
|
1834
|
-
readonly: { type: Boolean, default: !1 },
|
|
1835
|
-
disabled: { type: Boolean, default: !1 }
|
|
1836
|
-
},
|
|
1837
|
-
emits: ["change", "update:modelValue", "diagnostic", "busy-change", "delete", "help"],
|
|
1838
|
-
setup(n, { expose: o, emit: i }) {
|
|
1839
|
-
const a = n, c = (e) => JSON.parse(JSON.stringify(e));
|
|
1840
|
-
function p(e) {
|
|
1841
|
-
const t = kt(e);
|
|
1842
|
-
if (t !== null)
|
|
1843
|
-
return {
|
|
1844
|
-
scene: nn(),
|
|
1845
|
-
invalid: { path: t || "modelValue", raw: e }
|
|
1846
|
-
};
|
|
1847
|
-
try {
|
|
1848
|
-
const s = JSON.parse(JSON.stringify(e));
|
|
1849
|
-
if (wo(s)) return { scene: s, invalid: null };
|
|
1850
|
-
const d = Ut(s) || "modelValue";
|
|
1851
|
-
return { scene: nn(), invalid: { path: d, raw: s } };
|
|
1852
|
-
} catch {
|
|
1853
|
-
return { scene: nn(), invalid: { path: "modelValue", raw: e } };
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
function v(e) {
|
|
1857
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return e;
|
|
1858
|
-
try {
|
|
1859
|
-
const { knowledge: t } = e;
|
|
1860
|
-
if (!t || typeof t != "object" || Array.isArray(t))
|
|
1861
|
-
return e;
|
|
1862
|
-
const s = t;
|
|
1863
|
-
return s.doc ?? s.retainedDoc ?? e;
|
|
1864
|
-
} catch {
|
|
1865
|
-
return e;
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
const m = i, h = (e) => e === "originalReply" || e === "memory" || e === "separator", A = ro(
|
|
1869
|
-
() => import("./KnowledgeArea-OPR7smbt.js")
|
|
1870
|
-
), g = ro(() => import("./ToolForm-CWpUIVTl.js")), O = p(a.modelValue), l = Q(O.scene), T = Ot(O.invalid), y = Q(0), I = Q([]), N = /* @__PURE__ */ new Map(), u = Q(null), M = Ot(null), D = Q(0), F = Q(null), J = Q(null), q = Zi({
|
|
1871
|
-
descriptor: (e) => Y.value.capabilities.find(
|
|
1872
|
-
(t) => t.id === e && t.optionKind === "selection"
|
|
1873
|
-
),
|
|
1874
|
-
ports: () => a.ports,
|
|
1875
|
-
context: Tt,
|
|
1876
|
-
isCurrent: (e) => u.value === e && Ne(e, dt(e)),
|
|
1877
|
-
track: (e, t) => {
|
|
1878
|
-
(t || we.has(e)) && je(e, "requesting", t);
|
|
1879
|
-
},
|
|
1880
|
-
diagnostic: (e, t, s) => z(e, t, "port", s),
|
|
1881
|
-
portDiagnostic: (e, t) => St(e, t)
|
|
1882
|
-
}), {
|
|
1883
|
-
query: ne,
|
|
1884
|
-
options: L,
|
|
1885
|
-
path: G,
|
|
1886
|
-
nextCursor: pe,
|
|
1887
|
-
loading: oe,
|
|
1888
|
-
abort: W,
|
|
1889
|
-
reset: ie,
|
|
1890
|
-
enter: Te,
|
|
1891
|
-
back: Ve,
|
|
1892
|
-
fetch: be
|
|
1893
|
-
} = q, he = Q(!1), Pe = Q(""), se = Q("idle");
|
|
1894
|
-
function Ie() {
|
|
1895
|
-
Pe.value = "", se.value = "idle";
|
|
1896
|
-
}
|
|
1897
|
-
const Je = Q(!1), xe = Q({ uploading: 0, requesting: 0 }), Qe = Q(), Re = Q(), w = Q(), P = Q(), j = Q(), ce = Q(Number.MAX_SAFE_INTEGER), X = Q(!1), $e = Q(null), We = la({
|
|
1898
|
-
getPort: () => {
|
|
1899
|
-
var e;
|
|
1900
|
-
return (e = a.ports) == null ? void 0 : e.getToolForm;
|
|
1901
|
-
},
|
|
1902
|
-
getScene: () => ({ sceneKey: a.sceneKey, type: l.value.type }),
|
|
1903
|
-
canUse: () => Ne("tool", "knowledgeInline"),
|
|
1904
|
-
context: (e) => Tt("tool", e),
|
|
1905
|
-
track: (e, t) => {
|
|
1906
|
-
(t || we.has(e)) && je(e, "requesting", t);
|
|
1907
|
-
},
|
|
1908
|
-
diagnostic: (e, t, s) => z(e, t, s, "tool"),
|
|
1909
|
-
portDiagnostic: (e) => St(e, "tool")
|
|
1910
|
-
}), { edit: Ee, definition: Be } = We, He = We.cancel, zt = We.open, at = Q("image"), H = Q(), we = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Set(), ke = oa({
|
|
1911
|
-
editor: () => H.value,
|
|
1912
|
-
capability: (e) => Y.value.capabilities.find(
|
|
1913
|
-
(t) => t.id === e && t.slot === "knowledgeBlock"
|
|
1914
|
-
),
|
|
1915
|
-
canUse: (e) => Ne(e, "knowledgeBlock"),
|
|
1916
|
-
scene: () => ({
|
|
1917
|
-
scene: l.value,
|
|
1918
|
-
sceneKey: a.sceneKey,
|
|
1919
|
-
revision: y.value
|
|
1920
|
-
}),
|
|
1921
|
-
sceneKey: () => a.sceneKey,
|
|
1922
|
-
ports: () => a.ports,
|
|
1923
|
-
context: Tt,
|
|
1924
|
-
track: (e, t) => {
|
|
1925
|
-
(t || we.has(e)) && je(e, "uploading", t);
|
|
1926
|
-
},
|
|
1927
|
-
diagnostic: z,
|
|
1928
|
-
portDiagnostic: St,
|
|
1929
|
-
applyNodeUpdate: (e, t) => {
|
|
1930
|
-
var s;
|
|
1931
|
-
At = t;
|
|
1932
|
-
try {
|
|
1933
|
-
return ((s = H.value) == null ? void 0 : s.applyNodeUpdate(e, t)) || !1;
|
|
1934
|
-
} finally {
|
|
1935
|
-
At = null;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
let Ye = null, bt = null, Xe = null;
|
|
1940
|
-
const lt = /* @__PURE__ */ new Set(), ht = /* @__PURE__ */ new Set(), wt = /* @__PURE__ */ new Map();
|
|
1941
|
-
let No = 0, st = null, Ue, ae = !1, Ze = null, Me = null, et = null;
|
|
1942
|
-
const _t = {
|
|
1943
|
-
todo: "Followup",
|
|
1944
|
-
ticket: "AI-ticket",
|
|
1945
|
-
original: "quote",
|
|
1946
|
-
memory: "memory",
|
|
1947
|
-
tag: "tag",
|
|
1948
|
-
variable: "variate",
|
|
1949
|
-
image: "pic",
|
|
1950
|
-
video: "video2",
|
|
1951
|
-
separator: "sep",
|
|
1952
|
-
attribute: "data",
|
|
1953
|
-
tool: "tool",
|
|
1954
|
-
agent: "Agent",
|
|
1955
|
-
polish: "AI",
|
|
1956
|
-
template: "tabs"
|
|
1957
|
-
}, Rn = {
|
|
1958
|
-
normal: "常规知识",
|
|
1959
|
-
reasoning: "推理知识",
|
|
1960
|
-
agent: "Agent 知识"
|
|
1961
|
-
}, Oo = {
|
|
1962
|
-
normal: "填写可直接用于回复顾客的知识内容,命中后 AI 将参考内容生成回复。",
|
|
1963
|
-
reasoning: "填写不同情况的判断条件和处理规则,命中后 AI 将先判断,再按对应规则回复。",
|
|
1964
|
-
agent: "引用已配置的自定义 Agent,命中后 AI 将按照该 Agent 的提示词和步骤执行。"
|
|
1965
|
-
}, Dn = {
|
|
1966
|
-
normal: "regular",
|
|
1967
|
-
reasoning: "thinking",
|
|
1968
|
-
agent: "robot"
|
|
1969
|
-
}, Gt = Q(Date.now());
|
|
1970
|
-
let Pt;
|
|
1971
|
-
function Ln() {
|
|
1972
|
-
var t, s, d;
|
|
1973
|
-
Pt && clearTimeout(Pt), Gt.value = Date.now();
|
|
1974
|
-
const e = [
|
|
1975
|
-
(t = a.policy) == null ? void 0 : t.expiresAt,
|
|
1976
|
-
((d = (s = a.config) == null ? void 0 : s.remote) == null ? void 0 : d.status) === "ready" ? a.config.remote.expiresAt : void 0
|
|
1977
|
-
].filter(
|
|
1978
|
-
(b) => typeof b == "number" && b > Gt.value
|
|
1979
|
-
);
|
|
1980
|
-
e.length && (Pt = setTimeout(
|
|
1981
|
-
Ln,
|
|
1982
|
-
Math.min(Math.min(...e) - Gt.value + 1, sl)
|
|
1983
|
-
));
|
|
1984
|
-
}
|
|
1985
|
-
me(
|
|
1986
|
-
() => {
|
|
1987
|
-
var e, t, s;
|
|
1988
|
-
return [
|
|
1989
|
-
(e = a.policy) == null ? void 0 : e.expiresAt,
|
|
1990
|
-
((s = (t = a.config) == null ? void 0 : t.remote) == null ? void 0 : s.status) === "ready" ? a.config.remote.expiresAt : void 0
|
|
1991
|
-
];
|
|
1992
|
-
},
|
|
1993
|
-
Ln,
|
|
1994
|
-
{ immediate: !0 }
|
|
1995
|
-
);
|
|
1996
|
-
const Y = te(
|
|
1997
|
-
() => Bt(l.value.type, a, Gt.value)
|
|
1998
|
-
), Kn = te(
|
|
1999
|
-
() => sa(Y.value.capabilities, l.value.knowledge.doc)
|
|
2000
|
-
), qn = te(
|
|
2001
|
-
() => ra(Kn.value)
|
|
2002
|
-
);
|
|
2003
|
-
me(
|
|
2004
|
-
() => [a.sceneKey, l.value.type, qn.value],
|
|
2005
|
-
(e, t) => {
|
|
2006
|
-
var d;
|
|
2007
|
-
if (Je.value = !1, !t || e[0] !== t[0] || e[1] !== t[1] || e[2] === t[2])
|
|
2008
|
-
return;
|
|
2009
|
-
const s = (d = H.value) == null ? void 0 : d.captureSelection();
|
|
2010
|
-
qt(), Yt(), ke.clearTarget(), lt.forEach((b) => b.dispose()), lt.clear(), ht.forEach((b) => b.abort()), ht.clear(), wt.clear(), s && ze(() => {
|
|
2011
|
-
var b;
|
|
2012
|
-
return (b = H.value) == null ? void 0 : b.restoreSelection(s);
|
|
2013
|
-
});
|
|
2014
|
-
}
|
|
2015
|
-
);
|
|
2016
|
-
const xt = te(
|
|
2017
|
-
() => {
|
|
2018
|
-
var e;
|
|
2019
|
-
return ((e = T.value) == null ? void 0 : e.path) || Ut(l.value);
|
|
2020
|
-
}
|
|
2021
|
-
), Co = te(
|
|
2022
|
-
() => Ri(
|
|
2023
|
-
T.value ? v(T.value.raw) : l.value.knowledge.doc || l.value.knowledge.retainedDoc
|
|
2024
|
-
)
|
|
2025
|
-
), Vn = te(() => {
|
|
2026
|
-
var e;
|
|
2027
|
-
if (T.value || !((e = xt.value) != null && e.startsWith("extensionState")))
|
|
2028
|
-
return null;
|
|
2029
|
-
try {
|
|
2030
|
-
return JSON.stringify(l.value.extensionState, null, 2);
|
|
2031
|
-
} catch {
|
|
2032
|
-
return "扩展状态无法安全预览;原始数据仍保留。";
|
|
2033
|
-
}
|
|
2034
|
-
}), re = te(
|
|
2035
|
-
() => Y.value.mode === "readonly" || !!xt.value || Je.value
|
|
2036
|
-
), sn = te(
|
|
2037
|
-
() => Y.value.capabilities.filter(
|
|
2038
|
-
(e) => e.slot === "questionAction" && e.visible
|
|
2039
|
-
)
|
|
2040
|
-
), rn = te(
|
|
2041
|
-
() => Y.value.capabilities.filter(
|
|
2042
|
-
(e) => (e.slot === "knowledgeInline" || e.slot === "knowledgeBlock") && e.visible
|
|
2043
|
-
)
|
|
2044
|
-
), Jt = te(
|
|
2045
|
-
() => Y.value.capabilities.filter(
|
|
2046
|
-
(e) => e.slot === "sceneAction" && e.visible
|
|
2047
|
-
)
|
|
2048
|
-
), $n = te(() => {
|
|
2049
|
-
const e = [];
|
|
2050
|
-
let t = 0;
|
|
2051
|
-
const s = (d, b, r, f = !1) => {
|
|
2052
|
-
r.length && e.push({
|
|
2053
|
-
key: d,
|
|
2054
|
-
actions: r.map((S) => ({
|
|
2055
|
-
key: `${S.id}:${S.slot}`,
|
|
2056
|
-
kind: b,
|
|
2057
|
-
index: t++,
|
|
2058
|
-
item: S,
|
|
2059
|
-
showLabel: f
|
|
2060
|
-
}))
|
|
2061
|
-
});
|
|
2062
|
-
};
|
|
2063
|
-
return l.value.type === "normal" ? (s("questions", "question", sn.value), s("insert", "knowledge", rn.value)) : (l.value.type === "reasoning" && (s(
|
|
2064
|
-
"references",
|
|
2065
|
-
"knowledge",
|
|
2066
|
-
rn.value.filter((d) => d.order <= 40),
|
|
2067
|
-
!0
|
|
2068
|
-
), s(
|
|
2069
|
-
"media",
|
|
2070
|
-
"knowledge",
|
|
2071
|
-
rn.value.filter((d) => d.order > 40)
|
|
2072
|
-
)), s("questions", "question", sn.value)), e;
|
|
2073
|
-
}), un = te(() => l.value.type === "reasoning" ? Jt.value.map((e, t) => ({
|
|
2074
|
-
key: `${e.id}:${e.slot}`,
|
|
2075
|
-
kind: "scene",
|
|
2076
|
-
index: t,
|
|
2077
|
-
item: e
|
|
2078
|
-
})) : l.value.type === "agent" ? [{ key: "agentOpen", kind: "agentOpen", index: 0 }] : []), cn = te(
|
|
2079
|
-
() => $n.value.flatMap((e) => e.actions)
|
|
2080
|
-
), dn = te(
|
|
2081
|
-
() => cn.value.slice(ce.value)
|
|
2082
|
-
);
|
|
2083
|
-
let Mt, Bn = 0;
|
|
2084
|
-
function Un() {
|
|
2085
|
-
Wt(), Fn();
|
|
2086
|
-
}
|
|
2087
|
-
function Fn() {
|
|
2088
|
-
var s;
|
|
2089
|
-
const e = (s = Re.value) == null ? void 0 : s.getBoundingClientRect();
|
|
2090
|
-
if (!e) return;
|
|
2091
|
-
const t = Math.min(320, window.innerWidth - 24);
|
|
2092
|
-
D.value = Math.max(
|
|
2093
|
-
12 - e.left,
|
|
2094
|
-
Math.min(0, window.innerWidth - 12 - e.left - t)
|
|
2095
|
-
);
|
|
2096
|
-
}
|
|
2097
|
-
async function Wt() {
|
|
2098
|
-
const e = ++Bn;
|
|
2099
|
-
ce.value = cn.value.length, await ze();
|
|
2100
|
-
const t = P.value;
|
|
2101
|
-
if (t) {
|
|
2102
|
-
for (; e === Bn && (t.scrollWidth > t.clientWidth || j.value !== void 0 && j.value.scrollWidth > j.value.clientWidth) && ce.value > 0; )
|
|
2103
|
-
ce.value--, await ze();
|
|
2104
|
-
dn.value.length || (X.value = !1);
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
fi(() => {
|
|
2108
|
-
window.addEventListener("resize", Un), document.addEventListener("click", Qn), typeof ResizeObserver < "u" && (Mt = new ResizeObserver(() => void Wt()), P.value && Mt.observe(P.value)), Wt();
|
|
2109
|
-
}), me(
|
|
2110
|
-
() => {
|
|
2111
|
-
var e;
|
|
2112
|
-
return [...cn.value, ...un.value].map((t) => {
|
|
2113
|
-
var s;
|
|
2114
|
-
return `${t.key}:${((s = t.item) == null ? void 0 : s.label) || ""}`;
|
|
2115
|
-
}).concat(((e = l.value.knowledge.agentRef) == null ? void 0 : e.name) || "").join("|");
|
|
2116
|
-
},
|
|
2117
|
-
() => void Wt()
|
|
2118
|
-
);
|
|
2119
|
-
function Rt(e, t) {
|
|
2120
|
-
e.kind === "knowledge" && e.item && (t == null ? void 0 : t.currentTarget) instanceof Element && t.currentTarget.closest(".fkp-more-menu") && Qt(e.item), X.value = !1, e.kind === "agentOpen" ? ri() : e.item && (e.kind === "question" ? rt(e.item.id) ? Vt(e.item, t) : vn(e.item) : Vt(e.item, t));
|
|
2121
|
-
}
|
|
2122
|
-
function jn(e) {
|
|
2123
|
-
De(e) && Qt(e);
|
|
2124
|
-
}
|
|
2125
|
-
function _o(e, t) {
|
|
2126
|
-
e.item && (e.kind === "question" ? pn(e.item, t) : e.kind === "knowledge" && jn(e.item));
|
|
2127
|
-
}
|
|
2128
|
-
function zn(e, t, s) {
|
|
2129
|
-
const d = Y.value.capabilities.find(
|
|
2130
|
-
(b) => b.id === e && b.slot === "questionAction"
|
|
2131
|
-
);
|
|
2132
|
-
d && (s ? $t(d, t) : Vt(d, t));
|
|
2133
|
-
}
|
|
2134
|
-
function Po(e, t) {
|
|
2135
|
-
const s = Y.value.capabilities.find(
|
|
2136
|
-
(d) => d.id === e && d.slot === "questionAction"
|
|
2137
|
-
);
|
|
2138
|
-
s && pn(s, t);
|
|
2139
|
-
}
|
|
2140
|
-
const Fe = te(() => l.value.knowledge.agentRef), Ht = te(
|
|
2141
|
-
() => Di(l.value.knowledge.doc)
|
|
2142
|
-
);
|
|
2143
|
-
function rt(e) {
|
|
2144
|
-
return e === "todo" || e === "tagged";
|
|
2145
|
-
}
|
|
2146
|
-
function Dt(e) {
|
|
2147
|
-
return Y.value.capabilities.some(
|
|
2148
|
-
(t) => t.id === e && t.optionKind === "selection" && t.optionTrigger === "hover"
|
|
2149
|
-
);
|
|
2150
|
-
}
|
|
2151
|
-
const fn = (e) => Oi(l.value, e), Gn = te(() => {
|
|
2152
|
-
const e = [], t = Y.value.capabilities.filter((s) => s.slot === "questionAction").sort((s, d) => s.order - d.order);
|
|
2153
|
-
for (const s of t) {
|
|
2154
|
-
const d = s.questionTag;
|
|
2155
|
-
if (!d || !ct(s.id) || !rt(s.id)) continue;
|
|
2156
|
-
const b = fn(s.id);
|
|
2157
|
-
b && e.push({
|
|
2158
|
-
id: s.id,
|
|
2159
|
-
kind: d.kind,
|
|
2160
|
-
label: b.label,
|
|
2161
|
-
icon: s.icon
|
|
2162
|
-
});
|
|
2163
|
-
}
|
|
2164
|
-
return e;
|
|
2165
|
-
}), Jn = te(
|
|
2166
|
-
() => {
|
|
2167
|
-
var e;
|
|
2168
|
-
return (u.value === "todo" ? "待办标签" : u.value === "tagged" ? "顾客标签" : u.value === "agentSelect" ? "自定义Agent" : void 0) || ((e = Y.value.capabilities.find((t) => t.id === u.value)) == null ? void 0 : e.label) || "选择内容";
|
|
2169
|
-
}
|
|
2170
|
-
), xo = te(() => {
|
|
2171
|
-
var t, s;
|
|
2172
|
-
const e = (t = Y.value.capabilities.find(
|
|
2173
|
-
(d) => d.id === at.value && d.slot === "knowledgeBlock"
|
|
2174
|
-
)) == null ? void 0 : t.options;
|
|
2175
|
-
return e && "mimeTypes" in e && ((s = e.mimeTypes) != null && s.length) ? e.mimeTypes.join(",") : `${at.value}/*`;
|
|
2176
|
-
});
|
|
2177
|
-
me(
|
|
2178
|
-
() => a.sceneKey,
|
|
2179
|
-
() => {
|
|
2180
|
-
M.value = null, nt();
|
|
2181
|
-
const e = p(a.modelValue);
|
|
2182
|
-
l.value = e.scene, T.value = e.invalid, y.value = 0, N.clear(), I.value = [], Ie(), he.value = !1;
|
|
2183
|
-
}
|
|
2184
|
-
), me(
|
|
2185
|
-
() => p(a.modelValue),
|
|
2186
|
-
(e) => {
|
|
2187
|
-
if (e.invalid) {
|
|
2188
|
-
M.value = null, nt(), T.value = e.invalid, N.clear(), I.value = [];
|
|
2189
|
-
return;
|
|
2190
|
-
}
|
|
2191
|
-
const t = pt(e.scene);
|
|
2192
|
-
if (T.value) {
|
|
2193
|
-
nt(), l.value = e.scene, T.value = null, N.clear(), I.value = [], Ie(), he.value = !1;
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
|
-
if (t === pt(l.value) || a.ackRevision > 0 && N.get(a.ackRevision) === t)
|
|
2197
|
-
return;
|
|
2198
|
-
if (a.ackRevision < y.value && y.value > 0) {
|
|
2199
|
-
z(
|
|
2200
|
-
"STALE_EXTERNAL_VALUE",
|
|
2201
|
-
"外部更新与当前编辑冲突,已保留当前草稿",
|
|
2202
|
-
"validation"
|
|
2203
|
-
);
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
const s = l.value.type !== e.scene.type, d = s ? void 0 : Yo(e.scene);
|
|
2207
|
-
if (nt(d), M.value = null, l.value = e.scene, N.clear(), I.value = [], Ie(), s && (he.value = !1), d != null && d.markFailed.length) {
|
|
2208
|
-
const { sceneKey: b } = a;
|
|
2209
|
-
ze(() => {
|
|
2210
|
-
var r, f, S;
|
|
2211
|
-
if (!(b !== a.sceneKey || l.value.id !== e.scene.id || l.value.type !== e.scene.type))
|
|
2212
|
-
for (const { id: R, nodeVersion: B } of d.markFailed)
|
|
2213
|
-
ke.has(R) && ((f = (r = H.value) == null ? void 0 : r.getMediaState(R)) == null ? void 0 : f.status) === "uploading" && ((S = H.value) == null || S.failMedia(
|
|
2214
|
-
R,
|
|
2215
|
-
"媒体占位已被外部更新,请重试上传",
|
|
2216
|
-
B
|
|
2217
|
-
));
|
|
2218
|
-
});
|
|
2219
|
-
}
|
|
2220
|
-
}
|
|
2221
|
-
), me(
|
|
2222
|
-
() => Y.value.diagnostics,
|
|
2223
|
-
(e) => e.forEach(
|
|
2224
|
-
(t) => m("diagnostic", { ...t, sceneKey: a.sceneKey })
|
|
2225
|
-
),
|
|
2226
|
-
{ immediate: !0 }
|
|
2227
|
-
), me(
|
|
2228
|
-
xt,
|
|
2229
|
-
(e) => {
|
|
2230
|
-
e && m("diagnostic", {
|
|
2231
|
-
code: "UNSUPPORTED_CONTENT",
|
|
2232
|
-
severity: "error",
|
|
2233
|
-
source: "migration",
|
|
2234
|
-
message: "文档包含当前版本不认识的内容,已进入只读保护",
|
|
2235
|
-
sceneKey: a.sceneKey,
|
|
2236
|
-
path: e
|
|
2237
|
-
});
|
|
2238
|
-
},
|
|
2239
|
-
{ immediate: !0 }
|
|
2240
|
-
);
|
|
2241
|
-
function z(e, t, s, d) {
|
|
2242
|
-
m("diagnostic", {
|
|
2243
|
-
code: e,
|
|
2244
|
-
message: t,
|
|
2245
|
-
source: s,
|
|
2246
|
-
capabilityId: d,
|
|
2247
|
-
sceneKey: a.sceneKey,
|
|
2248
|
-
severity: "warning"
|
|
2249
|
-
});
|
|
2250
|
-
}
|
|
2251
|
-
function St(e, t, s = "port") {
|
|
2252
|
-
if (e.code !== "ABORTED") {
|
|
2253
|
-
m("diagnostic", {
|
|
2254
|
-
code: e.code,
|
|
2255
|
-
message: e.message,
|
|
2256
|
-
source: s,
|
|
2257
|
-
severity: "warning",
|
|
2258
|
-
capabilityId: t,
|
|
2259
|
-
sceneKey: a.sceneKey,
|
|
2260
|
-
retryable: e.retryable
|
|
2261
|
-
});
|
|
2262
|
-
for (const d of e.issues || [])
|
|
2263
|
-
m("diagnostic", {
|
|
2264
|
-
...d,
|
|
2265
|
-
sceneKey: a.sceneKey,
|
|
2266
|
-
capabilityId: d.capabilityId || t,
|
|
2267
|
-
retryable: d.retryable ?? e.retryable
|
|
2268
|
-
});
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
function ut(e, t, s) {
|
|
2272
|
-
if (re.value || Bt(l.value.type, a).mode === "readonly" || Ut(e))
|
|
2273
|
-
return !1;
|
|
2274
|
-
M.value = null;
|
|
2275
|
-
const d = t === "typeSwitch" ? c(l.value) : null;
|
|
2276
|
-
l.value = e, d ? I.value = [
|
|
2277
|
-
...I.value.slice(-19),
|
|
2278
|
-
d
|
|
2279
|
-
] : t !== "undo" && (I.value = []);
|
|
2280
|
-
const b = {
|
|
2281
|
-
sceneKey: a.sceneKey,
|
|
2282
|
-
revision: ++y.value,
|
|
2283
|
-
origin: t,
|
|
2284
|
-
capabilityId: s
|
|
2285
|
-
};
|
|
2286
|
-
return N.set(b.revision, pt(e)), N.size > 32 && N.delete(N.keys().next().value), m("change", e, b), m("update:modelValue", e), !0;
|
|
2287
|
-
}
|
|
2288
|
-
function Wn(e, t) {
|
|
2289
|
-
const { sceneKey: s } = a, d = pt(l.value), b = fo.confirm({
|
|
2290
|
-
title: "确认操作",
|
|
2291
|
-
content: e,
|
|
2292
|
-
onOk: () => {
|
|
2293
|
-
Se.delete(b), !(a.sceneKey !== s || pt(l.value) !== d || re.value) && t();
|
|
2294
|
-
},
|
|
2295
|
-
onClose: () => Se.delete(b)
|
|
2296
|
-
});
|
|
2297
|
-
Se.add(b);
|
|
2298
|
-
}
|
|
2299
|
-
function Mo(e) {
|
|
2300
|
-
ut(
|
|
2301
|
-
{ ...l.value, question: { text: e.replace(/[\r\n]+/g, " ") } },
|
|
2302
|
-
"user"
|
|
2303
|
-
);
|
|
2304
|
-
}
|
|
2305
|
-
function Ro() {
|
|
2306
|
-
he.value = !1, Yn(), Ze = null, et = null;
|
|
2307
|
-
}
|
|
2308
|
-
function Do(e) {
|
|
2309
|
-
var d;
|
|
2310
|
-
if (re.value || e.target instanceof HTMLTextAreaElement) return;
|
|
2311
|
-
const t = (d = w.value) == null ? void 0 : d.querySelector(
|
|
2312
|
-
'[aria-label="顾客问法"]'
|
|
2313
|
-
);
|
|
2314
|
-
if (!t) return;
|
|
2315
|
-
t.focus();
|
|
2316
|
-
const s = t.value.length;
|
|
2317
|
-
t.setSelectionRange(s, s);
|
|
2318
|
-
}
|
|
2319
|
-
function Lo(e) {
|
|
2320
|
-
const t = e.target;
|
|
2321
|
-
t instanceof HTMLTextAreaElement && (Ze = {
|
|
2322
|
-
sceneKey: a.sceneKey,
|
|
2323
|
-
from: t.selectionStart,
|
|
2324
|
-
to: t.selectionEnd,
|
|
2325
|
-
next: e.relatedTarget
|
|
2326
|
-
});
|
|
2327
|
-
}
|
|
2328
|
-
function pn(e, t) {
|
|
2329
|
-
var d;
|
|
2330
|
-
const s = (d = w.value) == null ? void 0 : d.querySelector(
|
|
2331
|
-
'[aria-label="顾客问法"]'
|
|
2332
|
-
);
|
|
2333
|
-
s && document.activeElement === s && gn(e, t);
|
|
2334
|
-
}
|
|
2335
|
-
function Ko() {
|
|
2336
|
-
var t, s;
|
|
2337
|
-
Yt(), he.value && (Xe = ((t = H.value) == null ? void 0 : t.captureMediaTarget()) || null);
|
|
2338
|
-
const e = (s = w.value) == null ? void 0 : s.querySelector(
|
|
2339
|
-
'[aria-label="顾客问法"]'
|
|
2340
|
-
);
|
|
2341
|
-
e && document.activeElement === e && (et = {
|
|
2342
|
-
sceneKey: a.sceneKey,
|
|
2343
|
-
from: e.selectionStart,
|
|
2344
|
-
to: e.selectionEnd
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
|
-
function gn(e, t) {
|
|
2348
|
-
var r;
|
|
2349
|
-
if (e.slot !== "questionAction" || !rt(e.id)) {
|
|
2350
|
-
Me = null;
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
const s = (r = w.value) == null ? void 0 : r.querySelector(
|
|
2354
|
-
'[aria-label="顾客问法"]'
|
|
2355
|
-
), d = (t == null ? void 0 : t.currentTarget) instanceof Element ? !!t.currentTarget.closest(".fkp-more-menu") : !!(Me != null && Me.fromMore);
|
|
2356
|
-
let b = null;
|
|
2357
|
-
if (s && document.activeElement === s)
|
|
2358
|
-
b = {
|
|
2359
|
-
sceneKey: a.sceneKey,
|
|
2360
|
-
from: s.selectionStart,
|
|
2361
|
-
to: s.selectionEnd
|
|
2362
|
-
};
|
|
2363
|
-
else if ((Ze == null ? void 0 : Ze.sceneKey) === a.sceneKey) {
|
|
2364
|
-
const { next: f } = Ze, S = t == null ? void 0 : t.currentTarget;
|
|
2365
|
-
f instanceof Element && (S instanceof Node ? S === f || S.contains(f) || f.contains(S) || d && f.closest('[data-fkp-menu-trigger="more"]') : f.closest(`[data-fkp-menu-trigger="${e.id}"]`)) && (b = Ze);
|
|
2366
|
-
}
|
|
2367
|
-
!b && (t == null ? void 0 : t.currentTarget) instanceof Element && t.currentTarget.closest(".fkp-more-menu") && (et == null ? void 0 : et.sceneKey) === a.sceneKey && (b = et), !b && (Me == null ? void 0 : Me.sceneKey) === a.sceneKey && Me.capabilityId === e.id && (b = Me), Me = b ? { ...b, capabilityId: e.id, fromMore: d } : null, Ze = null, et = null;
|
|
2368
|
-
}
|
|
2369
|
-
me(u, (e) => {
|
|
2370
|
-
var t;
|
|
2371
|
-
e || (Me = null), e !== ((t = F.value) == null ? void 0 : t.kind) && (F.value = null);
|
|
2372
|
-
}), me(X, (e) => {
|
|
2373
|
-
e || (et = null, Yt());
|
|
2374
|
-
});
|
|
2375
|
-
async function qo(e, t) {
|
|
2376
|
-
var b;
|
|
2377
|
-
if (!e || e.capabilityId !== t || e.sceneKey !== a.sceneKey)
|
|
2378
|
-
return;
|
|
2379
|
-
await ze();
|
|
2380
|
-
const s = (b = w.value) == null ? void 0 : b.querySelector(
|
|
2381
|
-
'[aria-label="顾客问法"]'
|
|
2382
|
-
);
|
|
2383
|
-
if (!s || s.disabled) return;
|
|
2384
|
-
const d = document.activeElement;
|
|
2385
|
-
d !== s && d !== document.body && !(d instanceof Element && (d.closest(".fkp-option-menu") || d.closest(`[data-fkp-menu-trigger="${t}"]`) || e.fromMore && d.closest('[data-fkp-menu-trigger="more"]'))) || (s.focus(), s.setSelectionRange(e.from, e.to));
|
|
2386
|
-
}
|
|
2387
|
-
function Lt(e, t = "user", s, d = l.value.extensionState, b) {
|
|
2388
|
-
var B, U;
|
|
2389
|
-
const r = yo(
|
|
2390
|
-
l.value.knowledge.doc,
|
|
2391
|
-
e,
|
|
2392
|
-
Y.value.capabilities
|
|
2393
|
-
);
|
|
2394
|
-
if (r) {
|
|
2395
|
-
z(
|
|
2396
|
-
"CAPABILITY_REVOKED",
|
|
2397
|
-
"此能力当前不可插入新内容",
|
|
2398
|
-
"config",
|
|
2399
|
-
r.id
|
|
2400
|
-
), (B = H.value) == null || B.restoreDoc(l.value.knowledge.doc || vt());
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2403
|
-
if (!ut(
|
|
2404
|
-
{
|
|
2405
|
-
...l.value,
|
|
2406
|
-
question: b === void 0 ? l.value.question : { text: b },
|
|
2407
|
-
knowledge: { ...l.value.knowledge, doc: e },
|
|
2408
|
-
extensionState: d
|
|
2409
|
-
},
|
|
2410
|
-
t,
|
|
2411
|
-
s
|
|
2412
|
-
)) {
|
|
2413
|
-
(U = H.value) == null || U.restoreDoc(l.value.knowledge.doc || vt());
|
|
2414
|
-
return;
|
|
2415
|
-
}
|
|
2416
|
-
const S = /* @__PURE__ */ new Set(), R = (V) => {
|
|
2417
|
-
var ge, Oe;
|
|
2418
|
-
V.type === "mediaBlock" && typeof ((ge = V.attrs) == null ? void 0 : ge.id) == "string" && S.add(V.attrs.id), (Oe = V.content) == null || Oe.forEach(R);
|
|
2419
|
-
};
|
|
2420
|
-
R(e), ke.removeAbsent(S);
|
|
2421
|
-
}
|
|
2422
|
-
let At = null;
|
|
2423
|
-
function Vo(e) {
|
|
2424
|
-
Lt(
|
|
2425
|
-
e,
|
|
2426
|
-
At ? "plugin" : "user",
|
|
2427
|
-
At || void 0
|
|
2428
|
-
);
|
|
2429
|
-
}
|
|
2430
|
-
function Hn(e, t, s = l.value.extensionState, d) {
|
|
2431
|
-
const b = {
|
|
2432
|
-
...l.value,
|
|
2433
|
-
question: d === void 0 ? l.value.question : { text: d },
|
|
2434
|
-
knowledge: { ...l.value.knowledge, doc: e },
|
|
2435
|
-
extensionState: s
|
|
2436
|
-
};
|
|
2437
|
-
return Ut(b) || yo(
|
|
2438
|
-
l.value.knowledge.doc,
|
|
2439
|
-
e,
|
|
2440
|
-
Y.value.capabilities
|
|
2441
|
-
) ? (z(
|
|
2442
|
-
"INVALID_RESPONSE",
|
|
2443
|
-
"接口返回的文档包含当前场景不可用的内容",
|
|
2444
|
-
"port",
|
|
2445
|
-
t
|
|
2446
|
-
), !1) : !0;
|
|
2447
|
-
}
|
|
2448
|
-
function ct(e) {
|
|
2449
|
-
var t, s;
|
|
2450
|
-
return !!((s = (t = l.value.extensionState[e]) == null ? void 0 : t.data) != null && s.enabled);
|
|
2451
|
-
}
|
|
2452
|
-
function vn(e) {
|
|
2453
|
-
if (rt(e.id) && !ct(e.id) && !fn(e.id)) {
|
|
2454
|
-
Vt(e);
|
|
2455
|
-
return;
|
|
2456
|
-
}
|
|
2457
|
-
tt(e);
|
|
2458
|
-
}
|
|
2459
|
-
function dt(e) {
|
|
2460
|
-
const t = Y.value.capabilities.find(
|
|
2461
|
-
(s) => s.id === e && s.optionKind === "selection"
|
|
2462
|
-
);
|
|
2463
|
-
return t ? t.slot : "knowledgeInline";
|
|
2464
|
-
}
|
|
2465
|
-
function Ne(e, t) {
|
|
2466
|
-
return !re.value && Bt(l.value.type, a).capabilities.some(
|
|
2467
|
-
(s) => s.id === e && s.slot === t && s.canInsert
|
|
2468
|
-
);
|
|
2469
|
-
}
|
|
2470
|
-
me(
|
|
2471
|
-
() => Ne("tool", "knowledgeInline"),
|
|
2472
|
-
(e) => {
|
|
2473
|
-
!e && Ee.value && He();
|
|
2474
|
-
}
|
|
2475
|
-
), me(
|
|
2476
|
-
() => {
|
|
2477
|
-
const e = u.value;
|
|
2478
|
-
return {
|
|
2479
|
-
opened: e,
|
|
2480
|
-
locked: re.value,
|
|
2481
|
-
usable: !e || e === "type" || Y.value.capabilities.some(
|
|
2482
|
-
(t) => t.id === e && t.slot === dt(e) && t.canInsert
|
|
2483
|
-
)
|
|
2484
|
-
};
|
|
2485
|
-
},
|
|
2486
|
-
({ opened: e, locked: t, usable: s }) => {
|
|
2487
|
-
!e || !t && s || (ae = !1, Le(), u.value = null);
|
|
2488
|
-
},
|
|
2489
|
-
{ flush: "sync" }
|
|
2490
|
-
);
|
|
2491
|
-
function De(e) {
|
|
2492
|
-
var t;
|
|
2493
|
-
return !re.value && e.canInsert && (e.id !== "reasoningPolish" || Ht.value) && (e.id !== "attribute" || !((t = H.value) != null && t.isSelectionInsideOriginalReply())) && (e.slot !== "knowledgeInline" && e.slot !== "knowledgeBlock" || he.value && !!H.value);
|
|
2494
|
-
}
|
|
2495
|
-
function $o(e) {
|
|
2496
|
-
const { target: t } = e;
|
|
2497
|
-
t instanceof Element && t.closest('.fkp-knowledge-document[contenteditable="true"]') && (he.value = !0);
|
|
2498
|
-
}
|
|
2499
|
-
function Bo(e) {
|
|
2500
|
-
Je.value = !0, z("MEDIA_EXTENSION_UNAVAILABLE", e, "plugin");
|
|
2501
|
-
}
|
|
2502
|
-
function Uo(e) {
|
|
2503
|
-
const t = e.relatedTarget;
|
|
2504
|
-
(!(t instanceof Node) || !e.currentTarget.contains(t)) && (he.value = !1, t instanceof HTMLElement && t !== document.body && Yn());
|
|
2505
|
-
}
|
|
2506
|
-
function Yn() {
|
|
2507
|
-
if (!u.value) return;
|
|
2508
|
-
const e = u.value;
|
|
2509
|
-
Y.value.capabilities.some(
|
|
2510
|
-
(t) => t.id === e && (t.slot === "knowledgeInline" || t.slot === "knowledgeBlock")
|
|
2511
|
-
) && (Le(), ae = !1, u.value = null);
|
|
2512
|
-
}
|
|
2513
|
-
async function tt(e, t = {}, s, d, b) {
|
|
2514
|
-
var to, no, oo, io, ao;
|
|
2515
|
-
const r = !!t.edit;
|
|
2516
|
-
let f = De(e);
|
|
2517
|
-
if (r ? f = Ne(e.id, e.slot) : s && (f = Ne(e.id, e.slot) && (e.id !== "attribute" || !((to = H.value) != null && to.isSelectionInsideOriginalReply()))), !f || re.value || !Bt(l.value.type, a).capabilities.some(
|
|
2518
|
-
(ve) => ve.id === e.id && ve.slot === e.slot && ve.canInsert
|
|
2519
|
-
)) {
|
|
2520
|
-
s == null || s.dispose();
|
|
2521
|
-
return;
|
|
2522
|
-
}
|
|
2523
|
-
const S = e.slot === "knowledgeInline" || e.slot === "knowledgeBlock", R = S && !r, B = R ? s || ((no = H.value) == null ? void 0 : no.captureMediaTarget()) : null;
|
|
2524
|
-
if (R && !B) {
|
|
2525
|
-
z(
|
|
2526
|
-
"INSERT_TARGET_LOST",
|
|
2527
|
-
"原始插入位置已失效,扩展内容未写入",
|
|
2528
|
-
"plugin",
|
|
2529
|
-
e.id
|
|
2530
|
-
);
|
|
2531
|
-
return;
|
|
2532
|
-
}
|
|
2533
|
-
B && lt.add(B);
|
|
2534
|
-
const U = S ? null : `${e.id}:${e.slot}`;
|
|
2535
|
-
U && ((oo = wt.get(U)) == null || oo.abort());
|
|
2536
|
-
const V = new AbortController();
|
|
2537
|
-
ht.add(V), U && wt.set(U, V);
|
|
2538
|
-
const ge = y.value, Oe = a.sceneKey, { type: Ce } = l.value, _e = c(l.value), Zt = document.activeElement, eo = d instanceof HTMLElement ? d : Zt;
|
|
2539
|
-
let en = !1;
|
|
2540
|
-
const bn = () => !V.signal.aborted && (!b || b()) && Oe === a.sceneKey && Ce === l.value.type && (!B || lt.has(B)) && (S || ge === y.value) && Y.value.capabilities.some(
|
|
2541
|
-
(ve) => ve.id === e.id && ve.slot === e.slot && ve.canInsert
|
|
2542
|
-
) && Bt(l.value.type, a).capabilities.some(
|
|
2543
|
-
(ve) => ve.id === e.id && ve.slot === e.slot && ve.canInsert
|
|
2544
|
-
);
|
|
2545
|
-
try {
|
|
2546
|
-
const ve = await So(e);
|
|
2547
|
-
if (!bn()) return;
|
|
2548
|
-
if (!ve.ok) {
|
|
2549
|
-
z(
|
|
2550
|
-
"PLUGIN_UNAVAILABLE",
|
|
2551
|
-
ve.reason === "VERSION_MISMATCH" ? "扩展身份或版本不匹配" : "扩展未安装",
|
|
2552
|
-
"plugin",
|
|
2553
|
-
e.id
|
|
2554
|
-
);
|
|
2555
|
-
return;
|
|
2556
|
-
}
|
|
2557
|
-
const It = (io = e.actions) == null ? void 0 : io.find(
|
|
2558
|
-
(wn) => wn.id === (e.primaryActionId || `${e.id}.${e.slot}.apply`)
|
|
2559
|
-
), lo = It && ve.module.actions[It.id];
|
|
2560
|
-
if (!It || !lo) {
|
|
2561
|
-
z("PLUGIN_UNAVAILABLE", "扩展动作不可用", "plugin", e.id);
|
|
2562
|
-
return;
|
|
2563
|
-
}
|
|
2564
|
-
const so = xn(e, It.id, a.ports);
|
|
2565
|
-
if (!so) {
|
|
2566
|
-
z("PORT_MISSING", "宿主未提供扩展所需的接口", "port", e.id);
|
|
2567
|
-
return;
|
|
2568
|
-
}
|
|
2569
|
-
It.requiredPorts.length && (je(V, "requesting", !0), en = !0);
|
|
2570
|
-
const ci = await lo.execute(t, {
|
|
2571
|
-
scene: _e,
|
|
2572
|
-
sceneKey: Oe,
|
|
2573
|
-
revision: ge,
|
|
2574
|
-
options: e.options,
|
|
2575
|
-
request: Tt(e.id, V),
|
|
2576
|
-
ports: so
|
|
2577
|
-
});
|
|
2578
|
-
if (!bn()) return;
|
|
2579
|
-
const hn = yt(
|
|
2580
|
-
ci,
|
|
2581
|
-
(wn) => Array.isArray(wn)
|
|
2582
|
-
);
|
|
2583
|
-
if (!hn.ok) {
|
|
2584
|
-
St(
|
|
2585
|
-
hn.error,
|
|
2586
|
-
e.id,
|
|
2587
|
-
It.requiredPorts.length ? "port" : "plugin"
|
|
2588
|
-
);
|
|
2589
|
-
return;
|
|
2590
|
-
}
|
|
2591
|
-
const di = Eo(e, hn.data);
|
|
2592
|
-
Fo(
|
|
2593
|
-
e,
|
|
2594
|
-
di,
|
|
2595
|
-
B,
|
|
2596
|
-
!r && eo instanceof HTMLElement && (document.activeElement === eo || document.activeElement instanceof Element && !!((ao = w.value) != null && ao.contains(document.activeElement)) && !!document.activeElement.closest('[role="toolbar"]') || document.activeElement === document.body),
|
|
2597
|
-
_e.extensionState[e.id]
|
|
2598
|
-
);
|
|
2599
|
-
} catch (ve) {
|
|
2600
|
-
bn() && z(
|
|
2601
|
-
en ? "PORT_FAILED" : "PLUGIN_FAILED",
|
|
2602
|
-
ve instanceof Error ? ve.message : "扩展执行失败",
|
|
2603
|
-
en ? "port" : "plugin",
|
|
2604
|
-
e.id
|
|
2605
|
-
);
|
|
2606
|
-
} finally {
|
|
2607
|
-
en && we.has(V) && je(V, "requesting", !1), V.abort(), ht.delete(V), U && wt.get(U) === V && wt.delete(U), B == null || B.dispose(), B && lt.delete(B);
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
function Fo(e, t, s, d, b) {
|
|
2611
|
-
var r, f, S, R, B;
|
|
2612
|
-
if (!t.ok) {
|
|
2613
|
-
z("PLUGIN_OPERATION_REJECTED", t.reason, "plugin", e.id);
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2616
|
-
if (t.kind !== "none") {
|
|
2617
|
-
if (!Ne(e.id, e.slot)) {
|
|
2618
|
-
z(
|
|
2619
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
2620
|
-
"扩展操作未通过权限校验",
|
|
2621
|
-
"plugin",
|
|
2622
|
-
e.id
|
|
2623
|
-
);
|
|
2624
|
-
return;
|
|
2625
|
-
}
|
|
2626
|
-
if ((t.kind === "state" || t.kind === "compound") && mt(b ?? null) !== mt(l.value.extensionState[e.id] ?? null)) {
|
|
2627
|
-
z(
|
|
2628
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
2629
|
-
"扩展状态已变化,本次过期操作未写入",
|
|
2630
|
-
"plugin",
|
|
2631
|
-
e.id
|
|
2632
|
-
);
|
|
2633
|
-
return;
|
|
2634
|
-
}
|
|
2635
|
-
if (t.kind === "compound") {
|
|
2636
|
-
const U = {
|
|
2637
|
-
...l.value.extensionState,
|
|
2638
|
-
[e.id]: { version: e.dataVersion, data: t.data }
|
|
2639
|
-
}, { document: V } = t;
|
|
2640
|
-
if (V.kind === "replaceDoc") {
|
|
2641
|
-
if (!Hn(
|
|
2642
|
-
V.doc,
|
|
2643
|
-
e.id,
|
|
2644
|
-
U,
|
|
2645
|
-
V.question
|
|
2646
|
-
))
|
|
2647
|
-
return;
|
|
2648
|
-
const Ce = () => {
|
|
2649
|
-
Ne(e.id, e.slot) && Lt(
|
|
2650
|
-
V.doc,
|
|
2651
|
-
"plugin",
|
|
2652
|
-
e.id,
|
|
2653
|
-
U,
|
|
2654
|
-
V.question
|
|
2655
|
-
);
|
|
2656
|
-
};
|
|
2657
|
-
e.id === "reasoningTemplate" && !l.value.question.text.trim() && !Ht.value ? Ce() : Wn(V.confirmation, Ce);
|
|
2658
|
-
return;
|
|
2659
|
-
}
|
|
2660
|
-
if (V.kind === "doc") {
|
|
2661
|
-
const Ce = s ? (r = H.value) == null ? void 0 : r.insertBatch(V.content, s, d) : null;
|
|
2662
|
-
if (!Ce) {
|
|
2663
|
-
z(
|
|
2664
|
-
s && s.status() !== "ready" ? "INSERT_TARGET_LOST" : "INSERT_FAILED",
|
|
2665
|
-
"扩展内容未能插入知识区",
|
|
2666
|
-
"plugin",
|
|
2667
|
-
e.id
|
|
2668
|
-
);
|
|
2669
|
-
return;
|
|
2670
|
-
}
|
|
2671
|
-
Lt(Ce, "plugin", e.id, U);
|
|
2672
|
-
return;
|
|
2673
|
-
}
|
|
2674
|
-
const ge = V.kind === "batchNodes" ? V.operations : [V], Oe = (f = H.value) == null ? void 0 : f.previewPluginNodeOperations(ge, e.id);
|
|
2675
|
-
if (!Oe) {
|
|
2676
|
-
z(
|
|
2677
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
2678
|
-
"目标节点不存在、归属不符或版本已变化",
|
|
2679
|
-
"plugin",
|
|
2680
|
-
e.id
|
|
2681
|
-
);
|
|
2682
|
-
return;
|
|
2683
|
-
}
|
|
2684
|
-
Lt(Oe, "plugin", e.id, U);
|
|
2685
|
-
return;
|
|
2686
|
-
}
|
|
2687
|
-
if (t.kind === "replaceDoc") {
|
|
2688
|
-
if (!Hn(
|
|
2689
|
-
t.doc,
|
|
2690
|
-
e.id,
|
|
2691
|
-
l.value.extensionState,
|
|
2692
|
-
t.question
|
|
2693
|
-
))
|
|
2694
|
-
return;
|
|
2695
|
-
const U = () => {
|
|
2696
|
-
Ne(e.id, e.slot) && Lt(
|
|
2697
|
-
t.doc,
|
|
2698
|
-
"plugin",
|
|
2699
|
-
e.id,
|
|
2700
|
-
l.value.extensionState,
|
|
2701
|
-
t.question
|
|
2702
|
-
);
|
|
2703
|
-
};
|
|
2704
|
-
e.id === "reasoningTemplate" && !l.value.question.text.trim() && !Ht.value ? U() : Wn(t.confirmation, U);
|
|
2705
|
-
return;
|
|
2706
|
-
}
|
|
2707
|
-
if (t.kind === "updateNode" || t.kind === "removeNode" || t.kind === "batchNodes") {
|
|
2708
|
-
const U = t.kind === "batchNodes" ? t.operations : [t];
|
|
2709
|
-
if (["image", "video"].includes(e.id) && U.some((ge) => ge.kind === "updateNode")) {
|
|
2710
|
-
z(
|
|
2711
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
2712
|
-
"媒体节点更新只能由对应节点的异步生命周期提交",
|
|
2713
|
-
"plugin",
|
|
2714
|
-
e.id
|
|
2715
|
-
);
|
|
2716
|
-
return;
|
|
2717
|
-
}
|
|
2718
|
-
At = e.id;
|
|
2719
|
-
let V = !1;
|
|
2720
|
-
try {
|
|
2721
|
-
V = ((S = H.value) == null ? void 0 : S.applyPluginNodeOperations(U, e.id)) || !1;
|
|
2722
|
-
} finally {
|
|
2723
|
-
At = null;
|
|
2724
|
-
}
|
|
2725
|
-
V || z(
|
|
2726
|
-
"PLUGIN_OPERATION_REJECTED",
|
|
2727
|
-
"目标节点不存在、归属不符或版本已变化",
|
|
2728
|
-
"plugin",
|
|
2729
|
-
e.id
|
|
2730
|
-
);
|
|
2731
|
-
return;
|
|
2732
|
-
}
|
|
2733
|
-
if (t.kind === "state")
|
|
2734
|
-
ut(
|
|
2735
|
-
{
|
|
2736
|
-
...l.value,
|
|
2737
|
-
extensionState: {
|
|
2738
|
-
...l.value.extensionState,
|
|
2739
|
-
[e.id]: { version: e.dataVersion, data: t.data }
|
|
2740
|
-
}
|
|
2741
|
-
},
|
|
2742
|
-
"plugin",
|
|
2743
|
-
e.id
|
|
2744
|
-
);
|
|
2745
|
-
else {
|
|
2746
|
-
const U = s ? (R = H.value) == null ? void 0 : R.insertBatch(t.content, s, d) : null;
|
|
2747
|
-
if (!U) {
|
|
2748
|
-
const ge = !!s && s.status() !== "ready";
|
|
2749
|
-
z(
|
|
2750
|
-
ge ? "INSERT_TARGET_LOST" : "INSERT_FAILED",
|
|
2751
|
-
ge ? "原始插入位置已失效,扩展内容未写入" : "扩展内容未能插入知识区",
|
|
2752
|
-
"plugin",
|
|
2753
|
-
e.id
|
|
2754
|
-
);
|
|
2755
|
-
return;
|
|
2756
|
-
}
|
|
2757
|
-
ut(
|
|
2758
|
-
{ ...l.value, knowledge: { ...l.value.knowledge, doc: U } },
|
|
2759
|
-
"plugin",
|
|
2760
|
-
e.id
|
|
2761
|
-
) || (B = H.value) == null || B.restoreDoc(l.value.knowledge.doc || vt());
|
|
2762
|
-
}
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
function jo(e) {
|
|
2766
|
-
if (u.value = null, ae = !1, Le(), e === l.value.type || re.value) return;
|
|
2767
|
-
if (xe.value.uploading > 0 || ln(l.value)) {
|
|
2768
|
-
z(
|
|
2769
|
-
"UPLOAD_PENDING",
|
|
2770
|
-
"请先完成或移除未成功的媒体后切换知识类型",
|
|
2771
|
-
"validation"
|
|
2772
|
-
);
|
|
2773
|
-
return;
|
|
2774
|
-
}
|
|
2775
|
-
const { scene: t } = Mi(l.value, e);
|
|
2776
|
-
M.value = {
|
|
2777
|
-
sceneKey: a.sceneKey,
|
|
2778
|
-
snapshot: pt(l.value),
|
|
2779
|
-
scene: t
|
|
2780
|
-
}, Fn(), ze(
|
|
2781
|
-
() => {
|
|
2782
|
-
var s, d;
|
|
2783
|
-
return (d = (s = Re.value) == null ? void 0 : s.querySelector(".fkp-type-confirm-cancel")) == null ? void 0 : d.focus();
|
|
2784
|
-
}
|
|
2785
|
-
);
|
|
2786
|
-
}
|
|
2787
|
-
function zo(e) {
|
|
2788
|
-
nt(), Ie(), he.value = !1, ut(e, "typeSwitch") && ze(() => {
|
|
2789
|
-
var t, s;
|
|
2790
|
-
return (s = (t = Re.value) == null ? void 0 : t.querySelector("button")) == null ? void 0 : s.focus();
|
|
2791
|
-
});
|
|
2792
|
-
}
|
|
2793
|
-
function yn(e = !1) {
|
|
2794
|
-
M.value = null, e && ze(() => {
|
|
2795
|
-
var t, s;
|
|
2796
|
-
return (s = (t = Re.value) == null ? void 0 : t.querySelector("button")) == null ? void 0 : s.focus();
|
|
2797
|
-
});
|
|
2798
|
-
}
|
|
2799
|
-
function Go() {
|
|
2800
|
-
const e = M.value;
|
|
2801
|
-
M.value = null, !(!e || e.sceneKey !== a.sceneKey || e.snapshot !== pt(l.value) || re.value || xe.value.uploading > 0 || ln(l.value)) && zo(e.scene);
|
|
2802
|
-
}
|
|
2803
|
-
function Jo() {
|
|
2804
|
-
re.value || M.value || u.value === "type" || (Le(), X.value = !1, ae = !0, u.value = "type");
|
|
2805
|
-
}
|
|
2806
|
-
function Wo() {
|
|
2807
|
-
if (M.value = null, X.value = !1, Le(), u.value === "type" && ae) {
|
|
2808
|
-
ae = !1;
|
|
2809
|
-
return;
|
|
2810
|
-
}
|
|
2811
|
-
ae = !1, u.value = u.value === "type" ? null : "type";
|
|
2812
|
-
}
|
|
2813
|
-
function Qn(e) {
|
|
2814
|
-
const t = w.value;
|
|
2815
|
-
if (!t || !u.value && !X.value && !M.value)
|
|
2816
|
-
return;
|
|
2817
|
-
const s = e.composedPath(), d = s.includes(t), b = (f) => d && s.some((S) => S instanceof Element && S.matches(f)), r = d ? s.find(
|
|
2818
|
-
(f) => f instanceof HTMLElement && f.hasAttribute("data-fkp-menu-trigger")
|
|
2819
|
-
) : void 0;
|
|
2820
|
-
u.value && u.value !== "reasoningTemplate" && !b(".fkp-type-menu, .fkp-option-menu") && (r == null ? void 0 : r.dataset.fkpMenuTrigger) !== u.value && (u.value = null, ae = !1, Le()), X.value && !b(".fkp-more-menu") && (r == null ? void 0 : r.dataset.fkpMenuTrigger) !== "more" && (X.value = !1), M.value && !b(".fkp-type-menu, .fkp-type-confirm") && (r == null ? void 0 : r.dataset.fkpMenuTrigger) !== "type" && yn();
|
|
2821
|
-
}
|
|
2822
|
-
function Xn() {
|
|
2823
|
-
const e = I.value.at(-1);
|
|
2824
|
-
return !e || re.value || xe.value.uploading > 0 || ln(l.value) || !ut(c(e), "undo") ? !1 : (I.value = I.value.slice(0, -1), nt(), Ie(), he.value = !1, u.value = null, ze(() => {
|
|
2825
|
-
var t, s;
|
|
2826
|
-
return (s = (t = Re.value) == null ? void 0 : t.querySelector("button")) == null ? void 0 : s.focus();
|
|
2827
|
-
}), !0);
|
|
2828
|
-
}
|
|
2829
|
-
function Ho(e) {
|
|
2830
|
-
e.key.toLowerCase() !== "z" || !(e.ctrlKey || e.metaKey) || e.altKey || e.shiftKey || e.target instanceof Element && e.target.closest('input, textarea, [contenteditable="true"]') || Xn() && e.preventDefault();
|
|
2831
|
-
}
|
|
2832
|
-
o({ undoTypeSwitch: Xn });
|
|
2833
|
-
function Tt(e, t) {
|
|
2834
|
-
return {
|
|
2835
|
-
sceneKey: a.sceneKey,
|
|
2836
|
-
capabilityId: e,
|
|
2837
|
-
requestId: `${a.sceneKey}:${++No}`,
|
|
2838
|
-
signal: t.signal
|
|
2839
|
-
};
|
|
2840
|
-
}
|
|
2841
|
-
function je(e, t, s) {
|
|
2842
|
-
s ? we.set(e, t) : we.delete(e), xe.value = {
|
|
2843
|
-
requesting: [...we.values()].filter(
|
|
2844
|
-
(d) => d === "requesting"
|
|
2845
|
-
).length,
|
|
2846
|
-
uploading: [...we.values()].filter(
|
|
2847
|
-
(d) => d === "uploading"
|
|
2848
|
-
).length
|
|
2849
|
-
}, m("busy-change", xe.value);
|
|
2850
|
-
}
|
|
2851
|
-
me(
|
|
2852
|
-
u,
|
|
2853
|
-
(e, t) => {
|
|
2854
|
-
e !== t && t && t !== "type" && W();
|
|
2855
|
-
},
|
|
2856
|
-
{ flush: "sync" }
|
|
2857
|
-
);
|
|
2858
|
-
function Yo(e) {
|
|
2859
|
-
return ke.classify(l.value, e);
|
|
2860
|
-
}
|
|
2861
|
-
function nt(e) {
|
|
2862
|
-
He(), qt(), Yt(), Ue && clearTimeout(Ue), ae = !1, ht.forEach((s) => s.abort()), ht.clear(), wt.clear();
|
|
2863
|
-
const t = ke.activeControllers(
|
|
2864
|
-
(e == null ? void 0 : e.active) || /* @__PURE__ */ new Set()
|
|
2865
|
-
);
|
|
2866
|
-
we.forEach((s, d) => {
|
|
2867
|
-
s === "uploading" && t.has(d) || (d.abort(), we.delete(d));
|
|
2868
|
-
}), xe.value = {
|
|
2869
|
-
requesting: 0,
|
|
2870
|
-
uploading: [...we.values()].filter((s) => s === "uploading").length
|
|
2871
|
-
}, m("busy-change", xe.value), ke.clearTarget(), lt.forEach((s) => s.dispose()), lt.clear(), ke.retain(e), u.value = null, ie(), st = null;
|
|
2872
|
-
}
|
|
2873
|
-
function Kt(e, t = "start", s, d = "scene") {
|
|
2874
|
-
var Zt;
|
|
2875
|
-
if (!(e instanceof HTMLElement) || !w.value) {
|
|
2876
|
-
J.value = null;
|
|
2877
|
-
return;
|
|
2878
|
-
}
|
|
2879
|
-
const b = s === "todo" || s === "tagged" ? e.closest(".fkp-action-toggle") : null, r = e.closest(".fkp-more-menu") ? w.value.querySelector(".fkp-more-button") || e : b || e, f = w.value.getBoundingClientRect(), S = r.getBoundingClientRect(), R = s === "variable" ? 426 : s === "tagged" ? 336 : s === "todo" ? 296 : t === "center" ? 320 : 296, B = d === "viewport" ? Math.min(
|
|
2880
|
-
R,
|
|
2881
|
-
Math.max(0, f.width - 32),
|
|
2882
|
-
Math.max(0, window.innerWidth - 32)
|
|
2883
|
-
) : R, U = S.left - f.left + S.width / 2, V = t === "center" ? U - B / 2 : S.left - f.left, ge = d === "viewport" ? 8 - f.left : 8, Oe = d === "viewport" ? window.innerWidth - f.left - B - 8 : f.width - B - 8, Ce = Math.max(
|
|
2884
|
-
ge,
|
|
2885
|
-
Math.min(V, Math.max(ge, Oe))
|
|
2886
|
-
), _e = (Zt = r.closest(".fkp-scene-toolbar")) == null ? void 0 : Zt.getBoundingClientRect().bottom;
|
|
2887
|
-
J.value = {
|
|
2888
|
-
left: `${Ce}px`,
|
|
2889
|
-
top: `${Math.max(S.bottom, _e ?? S.bottom) - f.top + 4}px`,
|
|
2890
|
-
...t === "center" ? { "--fkp-agent-arrow-left": `${U - Ce}px` } : {},
|
|
2891
|
-
...s === "variable" || s === "ticket" || s === "attribute" || s === "tool" || s === "todo" || s === "tagged" ? { "--fkp-choice-arrow-left": `${U - Ce}px` } : {}
|
|
2892
|
-
};
|
|
2893
|
-
}
|
|
2894
|
-
function qt() {
|
|
2895
|
-
Ye == null || Ye.dispose(), Ye = null, bt = null;
|
|
2896
|
-
}
|
|
2897
|
-
function Yt() {
|
|
2898
|
-
Xe == null || Xe.dispose(), Xe = null;
|
|
2899
|
-
}
|
|
2900
|
-
function Qt(e) {
|
|
2901
|
-
var t;
|
|
2902
|
-
e.slot !== "knowledgeInline" && e.slot !== "knowledgeBlock" || bt === e.id && Ye || (qt(), Ye = X.value && Xe || ((t = H.value) == null ? void 0 : t.captureMediaTarget()) || null, Ye === Xe && (Xe = null), bt = e.id);
|
|
2903
|
-
}
|
|
2904
|
-
function Xt(e) {
|
|
2905
|
-
if (bt !== e) return null;
|
|
2906
|
-
const t = Ye;
|
|
2907
|
-
return Ye = null, bt = null, t;
|
|
2908
|
-
}
|
|
2909
|
-
me(
|
|
2910
|
-
u,
|
|
2911
|
-
(e) => {
|
|
2912
|
-
e !== bt && qt();
|
|
2913
|
-
},
|
|
2914
|
-
{ flush: "sync" }
|
|
2915
|
-
);
|
|
2916
|
-
async function Vt(e, t) {
|
|
2917
|
-
var s, d, b;
|
|
2918
|
-
if (e.id === ((s = F.value) == null ? void 0 : s.kind) && (F.value = null, u.value = null, ae = !1), !!De(e)) {
|
|
2919
|
-
if (u.value !== e.id && gn(e, t), e.id === "image" || e.id === "video") {
|
|
2920
|
-
ke.clearTarget();
|
|
2921
|
-
const r = Xt(e.id) || ((d = H.value) == null ? void 0 : d.captureMediaTarget()) || null;
|
|
2922
|
-
if (!r) {
|
|
2923
|
-
z(
|
|
2924
|
-
"EDITOR_UNAVAILABLE",
|
|
2925
|
-
"知识区尚未就绪,无法选择媒体",
|
|
2926
|
-
"validation",
|
|
2927
|
-
e.id
|
|
2928
|
-
);
|
|
2929
|
-
return;
|
|
2930
|
-
}
|
|
2931
|
-
ke.selectTarget(r), at.value = e.id, (b = Qe.value) == null || b.click();
|
|
2932
|
-
return;
|
|
2933
|
-
}
|
|
2934
|
-
if (e.id === "separator" || e.id === "originalReply" && e.slot === "knowledgeBlock") {
|
|
2935
|
-
await tt(
|
|
2936
|
-
e,
|
|
2937
|
-
{},
|
|
2938
|
-
Xt(e.id) || void 0,
|
|
2939
|
-
t == null ? void 0 : t.currentTarget
|
|
2940
|
-
);
|
|
2941
|
-
return;
|
|
2942
|
-
}
|
|
2943
|
-
if (e.id === "reasoningPolish") {
|
|
2944
|
-
await tt(e);
|
|
2945
|
-
return;
|
|
2946
|
-
}
|
|
2947
|
-
if (u.value !== e.id && Qt(e), Ue && clearTimeout(Ue), e.id === "agentSelect" ? Kt(t == null ? void 0 : t.currentTarget, "center") : e.id === "variable" || e.id === "ticket" || e.id === "attribute" || e.id === "tool" ? Kt(t == null ? void 0 : t.currentTarget, "center", e.id) : Dt(e.id) ? t != null && t.currentTarget ? Kt(t.currentTarget, "center", e.id) : (u.value !== e.id || !ae) && (J.value = null) : J.value = null, u.value === e.id && ae) {
|
|
2948
|
-
ae = !1;
|
|
2949
|
-
return;
|
|
2950
|
-
}
|
|
2951
|
-
ae = !1, u.value = u.value === e.id ? null : e.id, $e.value = null, ie(), u.value && await be(e.id);
|
|
2952
|
-
}
|
|
2953
|
-
}
|
|
2954
|
-
function $t(e, t) {
|
|
2955
|
-
var s;
|
|
2956
|
-
e.id === ((s = F.value) == null ? void 0 : s.kind) && (F.value = null, u.value = null, ae = !1), !(!Dt(e.id) || !De(e) || u.value === e.id) && (gn(e, t), Qt(e), Ue && clearTimeout(Ue), Kt(t.currentTarget, "center", e.id), (!(t.currentTarget instanceof Element) || !t.currentTarget.closest(".fkp-more-menu")) && (X.value = !1), ae = !0, u.value = e.id, ie(), be(e.id));
|
|
2957
|
-
}
|
|
2958
|
-
function Qo(e) {
|
|
2959
|
-
var s;
|
|
2960
|
-
if (re.value || !Ne(e.kind, "knowledgeInline"))
|
|
2961
|
-
return;
|
|
2962
|
-
const t = u.value === e.kind && ((s = F.value) == null ? void 0 : s.nodeId) === e.nodeId && F.value.sceneKey === a.sceneKey;
|
|
2963
|
-
Le(), qt(), X.value = !1, Kt(e.anchor, "center", e.kind, "viewport"), ae = !0, !t && (F.value = {
|
|
2964
|
-
nodeId: e.nodeId,
|
|
2965
|
-
nodeVersion: e.nodeVersion,
|
|
2966
|
-
key: e.key,
|
|
2967
|
-
kind: e.kind,
|
|
2968
|
-
sceneKey: a.sceneKey,
|
|
2969
|
-
type: l.value.type
|
|
2970
|
-
}, u.value = e.kind, ie(), be(e.kind));
|
|
2971
|
-
}
|
|
2972
|
-
function Le() {
|
|
2973
|
-
Ue && clearTimeout(Ue), Ue = void 0;
|
|
2974
|
-
}
|
|
2975
|
-
function ot() {
|
|
2976
|
-
ae && (Le(), Ue = setTimeout(() => {
|
|
2977
|
-
ae && (u.value === "type" || Dt(u.value)) && (u.value = null), ae = !1;
|
|
2978
|
-
}, 180));
|
|
2979
|
-
}
|
|
2980
|
-
me(
|
|
2981
|
-
() => {
|
|
2982
|
-
var b, r;
|
|
2983
|
-
const e = u.value, t = Y.value, s = (b = t.capabilities.find(
|
|
2984
|
-
(f) => f.id === e && f.optionKind === "selection"
|
|
2985
|
-
)) == null ? void 0 : b.optionSource, d = s ? (r = a.ports) == null ? void 0 : r[ho[s]] : void 0;
|
|
2986
|
-
return [e, d, t.fingerprint];
|
|
2987
|
-
},
|
|
2988
|
-
([e, t, s], [d, b, r]) => {
|
|
2989
|
-
!e || e === "type" || e !== d || t === b && s === r || (ie(), Ne(e, dt(e)) && be(e));
|
|
2990
|
-
},
|
|
2991
|
-
{ flush: "sync" }
|
|
2992
|
-
);
|
|
2993
|
-
function Xo(e) {
|
|
2994
|
-
Ve() && be(e);
|
|
2995
|
-
}
|
|
2996
|
-
async function kn(e, t, s) {
|
|
2997
|
-
var f;
|
|
2998
|
-
if (t.disabled) return;
|
|
2999
|
-
if (!Ne(e, dt(e))) {
|
|
3000
|
-
z("CAPABILITY_REVOKED", "此能力当前不可用", "config", e);
|
|
3001
|
-
return;
|
|
3002
|
-
}
|
|
3003
|
-
const d = Y.value.capabilities.find(
|
|
3004
|
-
(S) => S.id === e && S.optionKind === "selection"
|
|
3005
|
-
);
|
|
3006
|
-
if ((d == null ? void 0 : d.optionHierarchy) === "tree" && t.hasChildren) {
|
|
3007
|
-
Te(t), await be(e);
|
|
3008
|
-
return;
|
|
3009
|
-
}
|
|
3010
|
-
if (e === "tool") {
|
|
3011
|
-
const S = Xt(e);
|
|
3012
|
-
if (!S) {
|
|
3013
|
-
z("INSERT_TARGET_LOST", "工具插入位置已失效", "plugin", "tool");
|
|
3014
|
-
return;
|
|
3015
|
-
}
|
|
3016
|
-
u.value = null, await zt({
|
|
3017
|
-
key: t.id,
|
|
3018
|
-
label: t.label,
|
|
3019
|
-
params: {},
|
|
3020
|
-
target: S,
|
|
3021
|
-
sceneKey: a.sceneKey,
|
|
3022
|
-
type: l.value.type
|
|
3023
|
-
});
|
|
3024
|
-
return;
|
|
3025
|
-
}
|
|
3026
|
-
if (e === ((f = F.value) == null ? void 0 : f.kind)) {
|
|
3027
|
-
const S = F.value;
|
|
3028
|
-
if (u.value = null, F.value = null, ae = !1, Le(), S.sceneKey !== a.sceneKey || S.type !== l.value.type) {
|
|
3029
|
-
z("INSERT_TARGET_LOST", "引用标签所属场景已变化", "plugin", e);
|
|
3030
|
-
return;
|
|
3031
|
-
}
|
|
3032
|
-
const R = Y.value.capabilities.find(
|
|
3033
|
-
(B) => B.id === e && B.slot === "knowledgeInline"
|
|
3034
|
-
);
|
|
3035
|
-
if (!R) return;
|
|
3036
|
-
await tt(R, {
|
|
3037
|
-
option: t,
|
|
3038
|
-
edit: { nodeId: S.nodeId, nodeVersion: S.nodeVersion }
|
|
3039
|
-
});
|
|
3040
|
-
return;
|
|
3041
|
-
}
|
|
3042
|
-
const b = dt(e) === "knowledgeInline" ? Xt(e) : null;
|
|
3043
|
-
u.value = null, ae = !1, Le();
|
|
3044
|
-
const r = Me;
|
|
3045
|
-
if (Me = null, rt(e) && dt(e) === "questionAction") {
|
|
3046
|
-
const S = Y.value.capabilities.find(
|
|
3047
|
-
(R) => R.id === e && R.slot === "questionAction"
|
|
3048
|
-
);
|
|
3049
|
-
S && await tt(S, { option: t }), await qo(r, e);
|
|
3050
|
-
} else if (e === "agentSelect")
|
|
3051
|
-
ut(
|
|
3052
|
-
{
|
|
3053
|
-
...l.value,
|
|
3054
|
-
knowledge: {
|
|
3055
|
-
...l.value.knowledge,
|
|
3056
|
-
agentRef: { id: t.id, name: t.label }
|
|
3057
|
-
}
|
|
3058
|
-
},
|
|
3059
|
-
"plugin",
|
|
3060
|
-
e
|
|
3061
|
-
);
|
|
3062
|
-
else {
|
|
3063
|
-
const S = Y.value.capabilities.find(
|
|
3064
|
-
(R) => R.id === e && (R.slot === "knowledgeInline" || R.slot === "sceneAction")
|
|
3065
|
-
);
|
|
3066
|
-
if (S) {
|
|
3067
|
-
if (S.slot === "knowledgeInline" && !b) {
|
|
3068
|
-
z("INSERT_TARGET_LOST", "原始插入位置已失效", "plugin", e);
|
|
3069
|
-
return;
|
|
3070
|
-
}
|
|
3071
|
-
S.slot !== "knowledgeInline" && (b == null || b.dispose()), await tt(
|
|
3072
|
-
S,
|
|
3073
|
-
{ option: t },
|
|
3074
|
-
b || void 0,
|
|
3075
|
-
s == null ? void 0 : s.currentTarget
|
|
3076
|
-
);
|
|
3077
|
-
} else b == null || b.dispose();
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
me(
|
|
3081
|
-
() => {
|
|
3082
|
-
var e;
|
|
3083
|
-
try {
|
|
3084
|
-
return (e = a.ports) == null ? void 0 : e.getToolForm;
|
|
3085
|
-
} catch {
|
|
3086
|
-
return;
|
|
3087
|
-
}
|
|
3088
|
-
},
|
|
3089
|
-
(e, t) => We.portChanged(e, t),
|
|
3090
|
-
{ flush: "sync" }
|
|
3091
|
-
);
|
|
3092
|
-
function Zo(e) {
|
|
3093
|
-
if (!Ne("tool", "knowledgeInline")) return;
|
|
3094
|
-
const { params: t } = e;
|
|
3095
|
-
if (t === null) {
|
|
3096
|
-
z(
|
|
3097
|
-
"TOOL_PARAMS_UNSUPPORTED",
|
|
3098
|
-
"当前工具标签缺少配置参数,请先迁移旧数据",
|
|
3099
|
-
"validation",
|
|
3100
|
-
"tool"
|
|
3101
|
-
);
|
|
3102
|
-
return;
|
|
3103
|
-
}
|
|
3104
|
-
zt({
|
|
3105
|
-
...e,
|
|
3106
|
-
params: t,
|
|
3107
|
-
sceneKey: a.sceneKey,
|
|
3108
|
-
type: l.value.type
|
|
3109
|
-
});
|
|
3110
|
-
}
|
|
3111
|
-
async function ei(e, t) {
|
|
3112
|
-
var S;
|
|
3113
|
-
const s = document.activeElement, d = Ee.value, b = Be.value;
|
|
3114
|
-
if (!d || !b || !Ne("tool", "knowledgeInline"))
|
|
3115
|
-
return;
|
|
3116
|
-
if (d.sceneKey !== a.sceneKey || d.type !== l.value.type) {
|
|
3117
|
-
He();
|
|
3118
|
-
return;
|
|
3119
|
-
}
|
|
3120
|
-
if (!await We.recheck(d, b)) return;
|
|
3121
|
-
const r = Y.value.capabilities.find(
|
|
3122
|
-
(R) => R.id === "tool" && R.slot === "knowledgeInline"
|
|
3123
|
-
);
|
|
3124
|
-
if (!r) return;
|
|
3125
|
-
if (d.nodeId !== void 0 && d.nodeVersion !== void 0) {
|
|
3126
|
-
const R = document.activeElement, B = R === document.body || R instanceof Element && !!R.closest(".fkp-tool-modal") && (R === s || R === t);
|
|
3127
|
-
if (await tt(
|
|
3128
|
-
r,
|
|
3129
|
-
{
|
|
3130
|
-
option: { id: d.key, label: d.label, params: e },
|
|
3131
|
-
edit: { nodeId: d.nodeId, nodeVersion: d.nodeVersion }
|
|
3132
|
-
},
|
|
3133
|
-
void 0,
|
|
3134
|
-
t,
|
|
3135
|
-
() => Ee.value === d && Be.value === b
|
|
3136
|
-
), Ee.value !== d) return;
|
|
3137
|
-
He(), await ze();
|
|
3138
|
-
const U = document.activeElement;
|
|
3139
|
-
B && d.sceneKey === a.sceneKey && d.type === l.value.type && (U === document.body || U === s || U === t) && ((S = H.value) == null || S.focus());
|
|
3140
|
-
return;
|
|
3141
|
-
}
|
|
3142
|
-
const { target: f } = d;
|
|
3143
|
-
if (!f || f.status() !== "ready") {
|
|
3144
|
-
z("INSERT_TARGET_LOST", "工具插入位置已失效", "plugin", "tool"), He();
|
|
3145
|
-
return;
|
|
3146
|
-
}
|
|
3147
|
-
We.releaseForInsert(), await tt(
|
|
3148
|
-
r,
|
|
3149
|
-
{ option: { id: d.key, label: d.label, params: e } },
|
|
3150
|
-
f,
|
|
3151
|
-
t
|
|
3152
|
-
);
|
|
3153
|
-
}
|
|
3154
|
-
function ti() {
|
|
3155
|
-
const e = st;
|
|
3156
|
-
e && (st = null, e.abort(), we.has(e) && je(e, "requesting", !1));
|
|
3157
|
-
}
|
|
3158
|
-
async function ni(e) {
|
|
3159
|
-
const t = mn.value;
|
|
3160
|
-
if (!t) return;
|
|
3161
|
-
const s = new AbortController();
|
|
3162
|
-
st = s;
|
|
3163
|
-
const { sceneKey: d } = a, b = () => {
|
|
3164
|
-
var r;
|
|
3165
|
-
return !s.signal.aborted && st === s && d === a.sceneKey && ((r = l.value.knowledge.agentRef) == null ? void 0 : r.id) === e;
|
|
3166
|
-
};
|
|
3167
|
-
se.value = "loading", je(s, "requesting", !0);
|
|
3168
|
-
try {
|
|
3169
|
-
const r = await t({ agentId: e }, Tt("agentSelect", s));
|
|
3170
|
-
if (!b()) return;
|
|
3171
|
-
const f = yt(
|
|
3172
|
-
r,
|
|
3173
|
-
(S) => Hi(e, S)
|
|
3174
|
-
);
|
|
3175
|
-
f.ok ? (Pe.value = f.data.prompt, se.value = "ready") : (se.value = "error", St(f.error, "agentSelect"));
|
|
3176
|
-
} catch (r) {
|
|
3177
|
-
b() && (se.value = "error", z(
|
|
3178
|
-
"PORT_FAILED",
|
|
3179
|
-
r instanceof Error ? r.message : "读取 Agent 失败",
|
|
3180
|
-
"port",
|
|
3181
|
-
"agentSelect"
|
|
3182
|
-
));
|
|
3183
|
-
} finally {
|
|
3184
|
-
st === s && (st = null), we.has(s) && je(s, "requesting", !1);
|
|
3185
|
-
}
|
|
3186
|
-
}
|
|
3187
|
-
const mn = te(() => {
|
|
3188
|
-
var t;
|
|
3189
|
-
const e = Y.value.capabilities.find(
|
|
3190
|
-
(s) => s.id === "agentSelect" && s.slot === "sceneAction"
|
|
3191
|
-
);
|
|
3192
|
-
return e ? (t = qi(e, a.ports)) == null ? void 0 : t.getAgentPrompt : void 0;
|
|
3193
|
-
}), Zn = te(() => Fe.value ? mn.value ? se.value === "error" ? "Agent 提示词读取失败" : se.value === "ready" ? Pe.value || "Agent 提示词为空" : "正在读取 Agent 提示词…" : "" : "选择 Agent");
|
|
3194
|
-
me(
|
|
3195
|
-
() => {
|
|
3196
|
-
var e;
|
|
3197
|
-
return [a.sceneKey, (e = Fe.value) == null ? void 0 : e.id, mn.value];
|
|
3198
|
-
},
|
|
3199
|
-
([, e]) => {
|
|
3200
|
-
ti(), Ie(), e && ni(e);
|
|
3201
|
-
},
|
|
3202
|
-
{ immediate: !0 }
|
|
3203
|
-
);
|
|
3204
|
-
async function oi(e) {
|
|
3205
|
-
const t = e.target, s = Array.from(t.files || []);
|
|
3206
|
-
t.value = "";
|
|
3207
|
-
const d = ke.takeTarget(), b = document.activeElement, r = b === document.body || b === t || b instanceof Element && !!b.closest(
|
|
3208
|
-
'[data-fkp-menu-trigger="image"], [data-fkp-menu-trigger="video"]'
|
|
3209
|
-
);
|
|
3210
|
-
d && await ke.enqueue(
|
|
3211
|
-
s,
|
|
3212
|
-
d,
|
|
3213
|
-
at.value,
|
|
3214
|
-
r
|
|
3215
|
-
);
|
|
3216
|
-
}
|
|
3217
|
-
function ii(e) {
|
|
3218
|
-
var d, b;
|
|
3219
|
-
const t = Array.from(((d = e.clipboardData) == null ? void 0 : d.files) || []);
|
|
3220
|
-
if (!t.length) return;
|
|
3221
|
-
e.preventDefault();
|
|
3222
|
-
const s = (b = H.value) == null ? void 0 : b.captureMediaTarget();
|
|
3223
|
-
if (!s) {
|
|
3224
|
-
z(
|
|
3225
|
-
"EDITOR_UNAVAILABLE",
|
|
3226
|
-
"知识区尚未就绪,无法粘贴媒体",
|
|
3227
|
-
"validation"
|
|
3228
|
-
);
|
|
3229
|
-
return;
|
|
3230
|
-
}
|
|
3231
|
-
ke.enqueue(t, s);
|
|
3232
|
-
}
|
|
3233
|
-
function ai(e) {
|
|
3234
|
-
var t;
|
|
3235
|
-
Array.from(((t = e.dataTransfer) == null ? void 0 : t.types) || []).includes("Files") && (e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = re.value ? "none" : "copy"));
|
|
3236
|
-
}
|
|
3237
|
-
function li(e) {
|
|
3238
|
-
var d, b;
|
|
3239
|
-
const t = Array.from(((d = e.dataTransfer) == null ? void 0 : d.files) || []);
|
|
3240
|
-
if (!t.length) return;
|
|
3241
|
-
e.preventDefault();
|
|
3242
|
-
const s = (b = H.value) == null ? void 0 : b.captureMediaTargetAt(e.clientX, e.clientY);
|
|
3243
|
-
if (!s) {
|
|
3244
|
-
z("INSERT_TARGET_LOST", "拖放位置无效,媒体未写入", "validation");
|
|
3245
|
-
return;
|
|
3246
|
-
}
|
|
3247
|
-
ke.enqueue(t, s);
|
|
3248
|
-
}
|
|
3249
|
-
const si = ke.retry;
|
|
3250
|
-
async function ri() {
|
|
3251
|
-
var r, f;
|
|
3252
|
-
const e = (r = Fe.value) == null ? void 0 : r.id, t = (f = Vi(
|
|
3253
|
-
"agentSelect.openConfig",
|
|
3254
|
-
a.ports
|
|
3255
|
-
)) == null ? void 0 : f.openAgentConfig;
|
|
3256
|
-
if (!e || !t) return;
|
|
3257
|
-
const s = new AbortController(), { sceneKey: d } = a, b = () => {
|
|
3258
|
-
var S;
|
|
3259
|
-
return !s.signal.aborted && d === a.sceneKey && ((S = Fe.value) == null ? void 0 : S.id) === e;
|
|
3260
|
-
};
|
|
3261
|
-
je(s, "requesting", !0);
|
|
3262
|
-
try {
|
|
3263
|
-
const S = await t(
|
|
3264
|
-
{ agentId: e, target: "_blank" },
|
|
3265
|
-
Tt("agentSelect", s)
|
|
3266
|
-
);
|
|
3267
|
-
if (!b()) return;
|
|
3268
|
-
const R = yt(
|
|
3269
|
-
S,
|
|
3270
|
-
(B) => B === void 0
|
|
3271
|
-
);
|
|
3272
|
-
R.ok || St(R.error, "agentSelect");
|
|
3273
|
-
} catch (S) {
|
|
3274
|
-
b() && z(
|
|
3275
|
-
"PORT_FAILED",
|
|
3276
|
-
S instanceof Error ? S.message : "打开 Agent 失败",
|
|
3277
|
-
"port",
|
|
3278
|
-
"agentSelect"
|
|
3279
|
-
);
|
|
3280
|
-
} finally {
|
|
3281
|
-
je(s, "requesting", !1);
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
function ui() {
|
|
3285
|
-
re.value || (nt(), m("delete"));
|
|
3286
|
-
}
|
|
3287
|
-
return pi(() => {
|
|
3288
|
-
Mt == null || Mt.disconnect(), window.removeEventListener("resize", Un), document.removeEventListener("click", Qn), Se.forEach((e) => e.close()), Se.clear(), nt(), Pt && clearTimeout(Pt);
|
|
3289
|
-
}), (e, t) => {
|
|
3290
|
-
var s, d, b;
|
|
3291
|
-
return E(), C("section", {
|
|
3292
|
-
ref_key: "sceneRoot",
|
|
3293
|
-
ref: w,
|
|
3294
|
-
class: Ke(["fkp-rich-text", [
|
|
3295
|
-
`fkp-type-${l.value.type}`,
|
|
3296
|
-
{
|
|
3297
|
-
"is-readonly": re.value,
|
|
3298
|
-
"has-open-menu": !!u.value || X.value || !!M.value
|
|
3299
|
-
}
|
|
3300
|
-
]]),
|
|
3301
|
-
onKeydown: [
|
|
3302
|
-
t[18] || (t[18] = Sn((r) => {
|
|
3303
|
-
u.value = null, X.value = !1, M.value = null;
|
|
3304
|
-
}, ["esc"])),
|
|
3305
|
-
Ho
|
|
3306
|
-
],
|
|
3307
|
-
onFocusout: Uo
|
|
3308
|
-
}, [
|
|
3309
|
-
_("div", {
|
|
3310
|
-
ref_key: "toolbar",
|
|
3311
|
-
ref: P,
|
|
3312
|
-
class: "fkp-scene-toolbar",
|
|
3313
|
-
role: "toolbar",
|
|
3314
|
-
"aria-label": "知识编辑工具栏"
|
|
3315
|
-
}, [
|
|
3316
|
-
_("div", {
|
|
3317
|
-
ref_key: "typeWrap",
|
|
3318
|
-
ref: Re,
|
|
3319
|
-
class: "fkp-type-wrap",
|
|
3320
|
-
onMouseenter: Le,
|
|
3321
|
-
onMouseleave: ot
|
|
3322
|
-
}, [
|
|
3323
|
-
x(k(ee), {
|
|
3324
|
-
class: "fkp-type-button",
|
|
3325
|
-
type: "text",
|
|
3326
|
-
"data-fkp-menu-trigger": "type",
|
|
3327
|
-
disabled: re.value,
|
|
3328
|
-
"aria-label": "选择知识类型",
|
|
3329
|
-
"aria-keyshortcuts": I.value.length ? "Control+Z Meta+Z" : void 0,
|
|
3330
|
-
onMouseenter: Jo,
|
|
3331
|
-
onClick: Wo
|
|
3332
|
-
}, {
|
|
3333
|
-
default: K(() => [
|
|
3334
|
-
x(k(de), {
|
|
3335
|
-
name: Dn[l.value.type],
|
|
3336
|
-
size: 16
|
|
3337
|
-
}, null, 8, ["name"]),
|
|
3338
|
-
_("strong", null, Z(Rn[l.value.type]), 1),
|
|
3339
|
-
x(k(de), {
|
|
3340
|
-
name: "arrow-down",
|
|
3341
|
-
size: 12
|
|
3342
|
-
})
|
|
3343
|
-
]),
|
|
3344
|
-
_: 1
|
|
3345
|
-
}, 8, ["disabled", "aria-keyshortcuts"]),
|
|
3346
|
-
u.value === "type" ? (E(), C("span", ba)) : $("", !0),
|
|
3347
|
-
u.value === "type" ? (E(), C("div", ha, [
|
|
3348
|
-
t[19] || (t[19] = _("strong", { class: "fkp-type-menu-title" }, "选择要添加的知识类型:", -1)),
|
|
3349
|
-
(E(), C(Ae, null, Ge(["normal", "reasoning", "agent"], (r) => x(k(ee), {
|
|
3350
|
-
key: r,
|
|
3351
|
-
class: "fkp-type-option",
|
|
3352
|
-
type: "text",
|
|
3353
|
-
"aria-pressed": l.value.type === r,
|
|
3354
|
-
onClick: (f) => jo(r)
|
|
3355
|
-
}, {
|
|
3356
|
-
default: K(() => [
|
|
3357
|
-
_("span", {
|
|
3358
|
-
class: Ke(["fkp-type-option-icon", `is-${r}`])
|
|
3359
|
-
}, [
|
|
3360
|
-
x(k(de), {
|
|
3361
|
-
name: Dn[r],
|
|
3362
|
-
size: 16
|
|
3363
|
-
}, null, 8, ["name"])
|
|
3364
|
-
], 2),
|
|
3365
|
-
_("span", wa, [
|
|
3366
|
-
_("strong", null, Z(Rn[r]), 1),
|
|
3367
|
-
_("span", null, Z(Oo[r]), 1)
|
|
3368
|
-
])
|
|
3369
|
-
]),
|
|
3370
|
-
_: 2
|
|
3371
|
-
}, 1032, ["aria-pressed", "onClick"])), 64))
|
|
3372
|
-
])) : $("", !0),
|
|
3373
|
-
M.value ? (E(), C("div", {
|
|
3374
|
-
key: 2,
|
|
3375
|
-
class: "fkp-type-confirm",
|
|
3376
|
-
role: "alertdialog",
|
|
3377
|
-
"aria-label": "确认切换知识类型",
|
|
3378
|
-
style: uo({
|
|
3379
|
-
left: `${D.value}px`,
|
|
3380
|
-
"--fkp-type-confirm-arrow-left": `${48 - D.value}px`
|
|
3381
|
-
}),
|
|
3382
|
-
onKeydown: t[1] || (t[1] = Sn(tn((r) => yn(!0), ["stop", "prevent"]), ["esc"]))
|
|
3383
|
-
}, [
|
|
3384
|
-
t[23] || (t[23] = _("span", {
|
|
3385
|
-
class: "fkp-type-confirm-arrow",
|
|
3386
|
-
"aria-hidden": "true"
|
|
3387
|
-
}, null, -1)),
|
|
3388
|
-
_("div", Sa, [
|
|
3389
|
-
x(k(mi), { "aria-hidden": "true" }),
|
|
3390
|
-
t[20] || (t[20] = _("span", null, "切换后将移除不适配标签,其余知识内容不变,是否确认切换?", -1))
|
|
3391
|
-
]),
|
|
3392
|
-
_("div", Aa, [
|
|
3393
|
-
x(k(ee), {
|
|
3394
|
-
class: "fkp-type-confirm-cancel",
|
|
3395
|
-
onClick: t[0] || (t[0] = (r) => yn(!0))
|
|
3396
|
-
}, {
|
|
3397
|
-
default: K(() => t[21] || (t[21] = [
|
|
3398
|
-
ye("取消")
|
|
3399
|
-
])),
|
|
3400
|
-
_: 1
|
|
3401
|
-
}),
|
|
3402
|
-
x(k(ee), {
|
|
3403
|
-
type: "primary",
|
|
3404
|
-
onClick: Go
|
|
3405
|
-
}, {
|
|
3406
|
-
default: K(() => t[22] || (t[22] = [
|
|
3407
|
-
ye("确认")
|
|
3408
|
-
])),
|
|
3409
|
-
_: 1
|
|
3410
|
-
})
|
|
3411
|
-
])
|
|
3412
|
-
], 36)) : $("", !0)
|
|
3413
|
-
], 544),
|
|
3414
|
-
t[27] || (t[27] = _("span", { class: "fkp-toolbar-divider" }, null, -1)),
|
|
3415
|
-
l.value.type === "agent" ? (E(), le(k(ft), {
|
|
3416
|
-
key: 0,
|
|
3417
|
-
trigger: "hover",
|
|
3418
|
-
position: "bottom",
|
|
3419
|
-
content: "选择 Agent",
|
|
3420
|
-
"popup-visible": !1
|
|
3421
|
-
}, {
|
|
3422
|
-
default: K(() => {
|
|
3423
|
-
var r;
|
|
3424
|
-
return [
|
|
3425
|
-
x(k(ee), {
|
|
3426
|
-
class: "fkp-agent-picker",
|
|
3427
|
-
type: "text",
|
|
3428
|
-
"data-fkp-menu-trigger": "agentSelect",
|
|
3429
|
-
disabled: re.value || !((r = Jt.value.find((f) => f.id === "agentSelect")) != null && r.canInsert),
|
|
3430
|
-
onMouseenter: t[2] || (t[2] = (f) => $t(
|
|
3431
|
-
Jt.value.find((S) => S.id === "agentSelect"),
|
|
3432
|
-
f
|
|
3433
|
-
)),
|
|
3434
|
-
onMouseleave: ot,
|
|
3435
|
-
onClick: t[3] || (t[3] = (f) => Vt(
|
|
3436
|
-
Jt.value.find((S) => S.id === "agentSelect"),
|
|
3437
|
-
f
|
|
3438
|
-
))
|
|
3439
|
-
}, {
|
|
3440
|
-
default: K(() => {
|
|
3441
|
-
var f;
|
|
3442
|
-
return [
|
|
3443
|
-
ye(Z(((f = Fe.value) == null ? void 0 : f.name) || "选择 Agent") + " ", 1),
|
|
3444
|
-
x(k(de), {
|
|
3445
|
-
name: "arrow-down",
|
|
3446
|
-
size: 12
|
|
3447
|
-
})
|
|
3448
|
-
];
|
|
3449
|
-
}),
|
|
3450
|
-
_: 1
|
|
3451
|
-
}, 8, ["disabled"])
|
|
3452
|
-
];
|
|
3453
|
-
}),
|
|
3454
|
-
_: 1
|
|
3455
|
-
})) : $("", !0),
|
|
3456
|
-
_("div", {
|
|
3457
|
-
ref_key: "toolbarLeft",
|
|
3458
|
-
ref: j,
|
|
3459
|
-
class: "fkp-toolbar-groups"
|
|
3460
|
-
}, [
|
|
3461
|
-
(E(!0), C(Ae, null, Ge($n.value, (r) => (E(), C(Ae, {
|
|
3462
|
-
key: r.key
|
|
3463
|
-
}, [
|
|
3464
|
-
r.actions.some((f) => f.index < ce.value) ? (E(), C(Ae, { key: 0 }, [
|
|
3465
|
-
t[24] || (t[24] = _("span", { class: "fkp-toolbar-divider" }, null, -1)),
|
|
3466
|
-
_("div", Ta, [
|
|
3467
|
-
(E(!0), C(Ae, null, Ge(r.actions, (f) => (E(), C(Ae, {
|
|
3468
|
-
key: f.key
|
|
3469
|
-
}, [
|
|
3470
|
-
f.index < ce.value && f.kind === "question" && f.item ? (E(), le(k(ft), {
|
|
3471
|
-
key: 0,
|
|
3472
|
-
trigger: "hover",
|
|
3473
|
-
position: "bottom",
|
|
3474
|
-
content: h(f.item.id) ? void 0 : `${f.item.label}开关`,
|
|
3475
|
-
"content-class": h(f.item.id) ? "fkp-capability-help-popover" : void 0,
|
|
3476
|
-
"popup-visible": rt(f.item.id) ? !1 : void 0
|
|
3477
|
-
}, An({
|
|
3478
|
-
default: K(() => [
|
|
3479
|
-
_("div", {
|
|
3480
|
-
class: Ke(["fkp-action-toggle", {
|
|
3481
|
-
"is-disabled": !De(f.item),
|
|
3482
|
-
"is-todo-active": f.item.id === "todo" && ct("todo"),
|
|
3483
|
-
"is-question-active": f.item.id !== "todo" && ct(f.item.id)
|
|
3484
|
-
}]),
|
|
3485
|
-
"data-fkp-menu-trigger": rt(f.item.id) ? f.item.id : void 0,
|
|
3486
|
-
onMouseenter: (S) => $t(f.item, S),
|
|
3487
|
-
onPointerdownCapture: (S) => pn(f.item, S),
|
|
3488
|
-
onMouseleave: ot
|
|
3489
|
-
}, [
|
|
3490
|
-
x(k(ee), {
|
|
3491
|
-
class: "fkp-action-label",
|
|
3492
|
-
type: "text",
|
|
3493
|
-
disabled: !De(f.item),
|
|
3494
|
-
"aria-label": f.item.label,
|
|
3495
|
-
"aria-pressed": ct(f.item.id),
|
|
3496
|
-
onClick: (S) => Rt(f, S)
|
|
3497
|
-
}, {
|
|
3498
|
-
default: K(() => [
|
|
3499
|
-
x(k(de), {
|
|
3500
|
-
name: _t[f.item.icon] || "book",
|
|
3501
|
-
size: 16
|
|
3502
|
-
}, null, 8, ["name"]),
|
|
3503
|
-
ye(Z(f.item.label), 1)
|
|
3504
|
-
]),
|
|
3505
|
-
_: 2
|
|
3506
|
-
}, 1032, ["disabled", "aria-label", "aria-pressed", "onClick"]),
|
|
3507
|
-
x(k(co), {
|
|
3508
|
-
class: "fkp-action-switch",
|
|
3509
|
-
size: "small",
|
|
3510
|
-
"model-value": ct(f.item.id),
|
|
3511
|
-
disabled: !De(f.item),
|
|
3512
|
-
"aria-label": `${f.item.label}开关`,
|
|
3513
|
-
onMousedown: t[4] || (t[4] = tn(() => {
|
|
3514
|
-
}, ["prevent"])),
|
|
3515
|
-
onChange: (S) => vn(f.item)
|
|
3516
|
-
}, null, 8, ["model-value", "disabled", "aria-label", "onChange"])
|
|
3517
|
-
], 42, Ia)
|
|
3518
|
-
]),
|
|
3519
|
-
_: 2
|
|
3520
|
-
}, [
|
|
3521
|
-
h(f.item.id) ? {
|
|
3522
|
-
name: "content",
|
|
3523
|
-
fn: K(() => [
|
|
3524
|
-
x(Nn, {
|
|
3525
|
-
"capability-id": f.item.id,
|
|
3526
|
-
onHelp: (S) => m("help", { capabilityId: f.item.id })
|
|
3527
|
-
}, null, 8, ["capability-id", "onHelp"])
|
|
3528
|
-
]),
|
|
3529
|
-
key: "0"
|
|
3530
|
-
} : void 0
|
|
3531
|
-
]), 1032, ["content", "content-class", "popup-visible"])) : f.index < ce.value && f.kind === "knowledge" && f.item ? (E(), le(k(ft), {
|
|
3532
|
-
key: 1,
|
|
3533
|
-
trigger: "hover",
|
|
3534
|
-
position: "bottom",
|
|
3535
|
-
content: h(f.item.id) ? void 0 : `${f.item.label}:在知识区光标处插入`,
|
|
3536
|
-
"content-class": h(f.item.id) ? "fkp-capability-help-popover" : void 0,
|
|
3537
|
-
"popup-visible": Dt(f.item.id) || u.value === f.item.id ? !1 : void 0
|
|
3538
|
-
}, An({
|
|
3539
|
-
default: K(() => [
|
|
3540
|
-
x(k(ee), {
|
|
3541
|
-
class: "fkp-tool-button",
|
|
3542
|
-
type: "text",
|
|
3543
|
-
"data-fkp-menu-trigger": f.item.id,
|
|
3544
|
-
disabled: !De(f.item),
|
|
3545
|
-
"aria-label": f.item.label,
|
|
3546
|
-
onMouseenter: (S) => $t(f.item, S),
|
|
3547
|
-
onPointerdownCapture: (S) => jn(f.item),
|
|
3548
|
-
onMouseleave: ot,
|
|
3549
|
-
onClick: (S) => Rt(f, S)
|
|
3550
|
-
}, {
|
|
3551
|
-
default: K(() => [
|
|
3552
|
-
x(k(de), {
|
|
3553
|
-
name: _t[f.item.icon] || "book",
|
|
3554
|
-
size: 16
|
|
3555
|
-
}, null, 8, ["name"]),
|
|
3556
|
-
f.showLabel ? (E(), C("span", Ea, Z(f.item.label), 1)) : $("", !0)
|
|
3557
|
-
]),
|
|
3558
|
-
_: 2
|
|
3559
|
-
}, 1032, ["data-fkp-menu-trigger", "disabled", "aria-label", "onMouseenter", "onPointerdownCapture", "onClick"])
|
|
3560
|
-
]),
|
|
3561
|
-
_: 2
|
|
3562
|
-
}, [
|
|
3563
|
-
h(f.item.id) ? {
|
|
3564
|
-
name: "content",
|
|
3565
|
-
fn: K(() => [
|
|
3566
|
-
x(Nn, {
|
|
3567
|
-
"capability-id": f.item.id,
|
|
3568
|
-
onHelp: (S) => m("help", { capabilityId: f.item.id })
|
|
3569
|
-
}, null, 8, ["capability-id", "onHelp"])
|
|
3570
|
-
]),
|
|
3571
|
-
key: "0"
|
|
3572
|
-
} : void 0
|
|
3573
|
-
]), 1032, ["content", "content-class", "popup-visible"])) : $("", !0)
|
|
3574
|
-
], 64))), 128))
|
|
3575
|
-
])
|
|
3576
|
-
], 64)) : $("", !0)
|
|
3577
|
-
], 64))), 128)),
|
|
3578
|
-
dn.value.length ? (E(), C("div", Na, [
|
|
3579
|
-
x(k(ft), {
|
|
3580
|
-
trigger: "hover",
|
|
3581
|
-
position: "bottom",
|
|
3582
|
-
content: "更多操作"
|
|
3583
|
-
}, {
|
|
3584
|
-
default: K(() => [
|
|
3585
|
-
x(k(ee), {
|
|
3586
|
-
class: "fkp-more-button",
|
|
3587
|
-
type: "text",
|
|
3588
|
-
"data-fkp-menu-trigger": "more",
|
|
3589
|
-
"aria-label": "更多操作",
|
|
3590
|
-
"aria-expanded": X.value,
|
|
3591
|
-
onPointerdownCapture: Ko,
|
|
3592
|
-
onClick: t[5] || (t[5] = (r) => {
|
|
3593
|
-
X.value = !X.value, u.value = null;
|
|
3594
|
-
})
|
|
3595
|
-
}, {
|
|
3596
|
-
default: K(() => [
|
|
3597
|
-
x(k(de), {
|
|
3598
|
-
name: "more",
|
|
3599
|
-
size: 16
|
|
3600
|
-
})
|
|
3601
|
-
]),
|
|
3602
|
-
_: 1
|
|
3603
|
-
}, 8, ["aria-expanded"])
|
|
3604
|
-
]),
|
|
3605
|
-
_: 1
|
|
3606
|
-
}),
|
|
3607
|
-
X.value ? (E(), C("div", Oa, [
|
|
3608
|
-
(E(!0), C(Ae, null, Ge(dn.value, (r) => {
|
|
3609
|
-
var f, S, R, B, U, V, ge;
|
|
3610
|
-
return E(), le(k(ft), {
|
|
3611
|
-
key: r.key,
|
|
3612
|
-
class: "fkp-more-popover",
|
|
3613
|
-
trigger: "hover",
|
|
3614
|
-
position: h((f = r.item) == null ? void 0 : f.id) ? "bottom" : "right",
|
|
3615
|
-
content: h((S = r.item) == null ? void 0 : S.id) ? void 0 : r.kind === "knowledge" ? `${(R = r.item) == null ? void 0 : R.label}:在知识区光标处插入` : r.kind === "question" ? `${(B = r.item) == null ? void 0 : B.label}开关` : ((U = r.item) == null ? void 0 : U.label) || "前往编辑 Agent",
|
|
3616
|
-
"content-class": h((V = r.item) == null ? void 0 : V.id) ? "fkp-capability-help-popover fkp-capability-help-popover--more" : void 0,
|
|
3617
|
-
"popup-visible": r.item && Dt(r.item.id) ? !1 : void 0
|
|
3618
|
-
}, An({
|
|
3619
|
-
default: K(() => {
|
|
3620
|
-
var Oe, Ce;
|
|
3621
|
-
return [
|
|
3622
|
-
_("div", {
|
|
3623
|
-
class: Ke(["fkp-more-row", {
|
|
3624
|
-
"fkp-more-row--question": r.kind === "question",
|
|
3625
|
-
"is-disabled": r.item && !De(r.item)
|
|
3626
|
-
}]),
|
|
3627
|
-
"data-fkp-menu-trigger": (Oe = r.item) == null ? void 0 : Oe.id,
|
|
3628
|
-
onMouseenter: (_e) => r.item && $t(r.item, _e),
|
|
3629
|
-
onPointerdownCapture: (_e) => _o(r, _e),
|
|
3630
|
-
onMouseleave: ot
|
|
3631
|
-
}, [
|
|
3632
|
-
x(k(ee), {
|
|
3633
|
-
type: "text",
|
|
3634
|
-
disabled: r.kind === "agentOpen" ? !Fe.value || !((Ce = e.ports) != null && Ce.openAgentConfig) : !r.item || !De(r.item),
|
|
3635
|
-
onClick: (_e) => Rt(r, _e)
|
|
3636
|
-
}, {
|
|
3637
|
-
default: K(() => {
|
|
3638
|
-
var _e;
|
|
3639
|
-
return [
|
|
3640
|
-
x(k(de), {
|
|
3641
|
-
name: r.item ? _t[r.item.icon] || "book" : "open",
|
|
3642
|
-
size: 16
|
|
3643
|
-
}, null, 8, ["name"]),
|
|
3644
|
-
ye(Z(((_e = r.item) == null ? void 0 : _e.label) || "前往编辑 Agent"), 1)
|
|
3645
|
-
];
|
|
3646
|
-
}),
|
|
3647
|
-
_: 2
|
|
3648
|
-
}, 1032, ["disabled", "onClick"]),
|
|
3649
|
-
r.kind === "question" && r.item ? (E(), le(k(co), {
|
|
3650
|
-
key: 0,
|
|
3651
|
-
class: "fkp-action-switch",
|
|
3652
|
-
size: "small",
|
|
3653
|
-
"model-value": ct(r.item.id),
|
|
3654
|
-
disabled: !De(r.item),
|
|
3655
|
-
"aria-label": `${r.item.label}开关`,
|
|
3656
|
-
onMousedown: t[6] || (t[6] = tn(() => {
|
|
3657
|
-
}, ["prevent"])),
|
|
3658
|
-
onChange: (_e) => vn(r.item)
|
|
3659
|
-
}, null, 8, ["model-value", "disabled", "aria-label", "onChange"])) : $("", !0)
|
|
3660
|
-
], 42, Ca)
|
|
3661
|
-
];
|
|
3662
|
-
}),
|
|
3663
|
-
_: 2
|
|
3664
|
-
}, [
|
|
3665
|
-
h((ge = r.item) == null ? void 0 : ge.id) ? {
|
|
3666
|
-
name: "content",
|
|
3667
|
-
fn: K(() => [
|
|
3668
|
-
x(Nn, {
|
|
3669
|
-
"capability-id": r.item.id,
|
|
3670
|
-
onHelp: (Oe) => m("help", { capabilityId: r.item.id })
|
|
3671
|
-
}, null, 8, ["capability-id", "onHelp"])
|
|
3672
|
-
]),
|
|
3673
|
-
key: "0"
|
|
3674
|
-
} : void 0
|
|
3675
|
-
]), 1032, ["position", "content", "content-class", "popup-visible"]);
|
|
3676
|
-
}), 128))
|
|
3677
|
-
])) : $("", !0)
|
|
3678
|
-
])) : $("", !0)
|
|
3679
|
-
], 512),
|
|
3680
|
-
un.value.length ? (E(), C("div", _a, [
|
|
3681
|
-
t[26] || (t[26] = _("span", { class: "fkp-toolbar-divider" }, null, -1)),
|
|
3682
|
-
(E(!0), C(Ae, null, Ge(un.value, (r) => (E(), C(Ae, {
|
|
3683
|
-
key: r.key
|
|
3684
|
-
}, [
|
|
3685
|
-
r.kind === "scene" && r.item ? (E(), le(k(ft), {
|
|
3686
|
-
key: 0,
|
|
3687
|
-
trigger: "hover",
|
|
3688
|
-
position: "bottom",
|
|
3689
|
-
content: r.item.label
|
|
3690
|
-
}, {
|
|
3691
|
-
default: K(() => [
|
|
3692
|
-
x(k(ee), {
|
|
3693
|
-
class: "fkp-scene-action",
|
|
3694
|
-
type: "text",
|
|
3695
|
-
"data-fkp-menu-trigger": r.item.id === "reasoningTemplate" ? "reasoningTemplate" : void 0,
|
|
3696
|
-
disabled: !De(r.item),
|
|
3697
|
-
onClick: (f) => Rt(r)
|
|
3698
|
-
}, {
|
|
3699
|
-
default: K(() => [
|
|
3700
|
-
x(k(de), {
|
|
3701
|
-
name: _t[r.item.icon] || "book",
|
|
3702
|
-
size: 12
|
|
3703
|
-
}, null, 8, ["name"]),
|
|
3704
|
-
ye(Z(r.item.label), 1)
|
|
3705
|
-
]),
|
|
3706
|
-
_: 2
|
|
3707
|
-
}, 1032, ["data-fkp-menu-trigger", "disabled", "onClick"])
|
|
3708
|
-
]),
|
|
3709
|
-
_: 2
|
|
3710
|
-
}, 1032, ["content"])) : r.kind === "agentOpen" ? (E(), le(k(ft), {
|
|
3711
|
-
key: 1,
|
|
3712
|
-
trigger: "hover",
|
|
3713
|
-
position: "bottom",
|
|
3714
|
-
content: "前往编辑 Agent"
|
|
3715
|
-
}, {
|
|
3716
|
-
default: K(() => {
|
|
3717
|
-
var f;
|
|
3718
|
-
return [
|
|
3719
|
-
x(k(ee), {
|
|
3720
|
-
class: "fkp-open-agent",
|
|
3721
|
-
type: "text",
|
|
3722
|
-
disabled: !Fe.value || !((f = e.ports) != null && f.openAgentConfig),
|
|
3723
|
-
onClick: (S) => Rt(r)
|
|
3724
|
-
}, {
|
|
3725
|
-
default: K(() => [
|
|
3726
|
-
x(k(de), {
|
|
3727
|
-
name: "open",
|
|
3728
|
-
size: 12
|
|
3729
|
-
}),
|
|
3730
|
-
t[25] || (t[25] = ye("前往编辑 Agent "))
|
|
3731
|
-
]),
|
|
3732
|
-
_: 2
|
|
3733
|
-
}, 1032, ["disabled", "onClick"])
|
|
3734
|
-
];
|
|
3735
|
-
}),
|
|
3736
|
-
_: 2
|
|
3737
|
-
}, 1024)) : $("", !0)
|
|
3738
|
-
], 64))), 128))
|
|
3739
|
-
])) : $("", !0)
|
|
3740
|
-
], 512),
|
|
3741
|
-
u.value && u.value !== "type" && u.value !== "reasoningTemplate" ? (E(), C("div", {
|
|
3742
|
-
key: 0,
|
|
3743
|
-
class: Ke(["fkp-menu fkp-option-menu", {
|
|
3744
|
-
"is-choice-menu": u.value === "todo" || u.value === "ticket" || u.value === "tagged" || u.value === "variable" || u.value === "attribute" || u.value === "tool",
|
|
3745
|
-
"is-todo-menu": u.value === "todo" || u.value === "tagged",
|
|
3746
|
-
"is-ticket-menu": u.value === "ticket",
|
|
3747
|
-
"is-attribute-menu": u.value === "attribute",
|
|
3748
|
-
"is-tool-menu": u.value === "tool",
|
|
3749
|
-
"is-tagged-menu": u.value === "tagged",
|
|
3750
|
-
"is-variable-menu": u.value === "variable",
|
|
3751
|
-
"is-agent-menu": u.value === "agentSelect",
|
|
3752
|
-
"fkp-agent-menu": u.value === "agentSelect"
|
|
3753
|
-
}]),
|
|
3754
|
-
style: uo(J.value || void 0),
|
|
3755
|
-
onMouseenter: Le,
|
|
3756
|
-
onMouseleave: ot
|
|
3757
|
-
}, [
|
|
3758
|
-
u.value === "agentSelect" ? (E(), C("span", Pa)) : $("", !0),
|
|
3759
|
-
_("div", xa, [
|
|
3760
|
-
u.value === "ticket" ? (E(), C("span", Ma, [
|
|
3761
|
-
_("strong", null, Z(Jn.value), 1),
|
|
3762
|
-
t[28] || (t[28] = _("span", { class: "fkp-ticket-badge" }, "限免", -1)),
|
|
3763
|
-
t[29] || (t[29] = _("span", {
|
|
3764
|
-
class: "fkp-ticket-dot",
|
|
3765
|
-
"aria-hidden": "true"
|
|
3766
|
-
}, null, -1))
|
|
3767
|
-
])) : (E(), C("strong", Ra, Z(Jn.value), 1)),
|
|
3768
|
-
u.value === "todo" || u.value === "ticket" || u.value === "tagged" || u.value === "variable" || u.value === "attribute" || u.value === "tool" || u.value === "agentSelect" ? (E(), le(k(ee), {
|
|
3769
|
-
key: 2,
|
|
3770
|
-
class: Ke(
|
|
3771
|
-
u.value === "agentSelect" ? "fkp-agent-help" : u.value === "variable" ? "fkp-variable-help" : u.value === "ticket" ? "fkp-ticket-help" : u.value === "attribute" || u.value === "tool" ? "fkp-reference-help" : "fkp-todo-help"
|
|
3772
|
-
),
|
|
3773
|
-
type: "text",
|
|
3774
|
-
onClick: t[7] || (t[7] = (r) => m("help", { capabilityId: u.value }))
|
|
3775
|
-
}, {
|
|
3776
|
-
default: K(() => [
|
|
3777
|
-
x(k(de), {
|
|
3778
|
-
name: "book",
|
|
3779
|
-
size: 14
|
|
3780
|
-
}),
|
|
3781
|
-
t[30] || (t[30] = ye("我该怎么配?"))
|
|
3782
|
-
]),
|
|
3783
|
-
_: 1
|
|
3784
|
-
}, 8, ["class"])) : (E(), le(k(ee), {
|
|
3785
|
-
key: 3,
|
|
3786
|
-
type: "text",
|
|
3787
|
-
"aria-label": "关闭菜单",
|
|
3788
|
-
onClick: t[8] || (t[8] = (r) => u.value = null)
|
|
3789
|
-
}, {
|
|
3790
|
-
default: K(() => [
|
|
3791
|
-
x(k(bi), { size: 15 })
|
|
3792
|
-
]),
|
|
3793
|
-
_: 1
|
|
3794
|
-
}))
|
|
3795
|
-
]),
|
|
3796
|
-
u.value === "todo" ? (E(), C("div", Da, t[31] || (t[31] = [
|
|
3797
|
-
_("p", null, "普通知识可直接开启待办标签;", -1),
|
|
3798
|
-
_("p", null, "推理知识需在回复话术末尾双引号前添加该标签;", -1),
|
|
3799
|
-
_("p", null, "触发后,「人机协同」「仅提示/夜间值守」会进入待办,「智能转接」会按所选方案转接", -1)
|
|
3800
|
-
]))) : $("", !0),
|
|
3801
|
-
u.value === "ticket" ? (E(), C("p", La, "可将工单场景添加至目标客服回复话术的引号“”内,命中后将自动创建工单")) : $("", !0),
|
|
3802
|
-
u.value === "attribute" || u.value === "tool" ? (E(), C("p", Ka, "支持在推理知识下,引用以下工具辅助 AI 回复")) : $("", !0),
|
|
3803
|
-
u.value === "tagged" ? (E(), C("p", qa, "顾客问题命中此知识内容时,当前顾客打上对应顾客标签")) : $("", !0),
|
|
3804
|
-
u.value === "variable" ? (E(), C("p", Va, "可插入客服昵称,或您在变量管理中配置的变量")) : $("", !0),
|
|
3805
|
-
u.value === "agentSelect" ? (E(), C("p", $a, "若顾客消息命中此场景,AI将根据对话进行多轮推理,给出贴合场景逻辑、有效解决问题的回复")) : $("", !0),
|
|
3806
|
-
k(G).length && u.value !== "variable" ? (E(), C("div", Ba, [
|
|
3807
|
-
x(k(ee), {
|
|
3808
|
-
type: "text",
|
|
3809
|
-
onClick: t[9] || (t[9] = (r) => Xo(u.value))
|
|
3810
|
-
}, {
|
|
3811
|
-
default: K(() => t[32] || (t[32] = [
|
|
3812
|
-
ye("返回")
|
|
3813
|
-
])),
|
|
3814
|
-
_: 1
|
|
3815
|
-
}),
|
|
3816
|
-
_("span", null, Z(k(G).map((r) => r.label).join(" / ")), 1)
|
|
3817
|
-
])) : $("", !0),
|
|
3818
|
-
_("div", {
|
|
3819
|
-
class: Ke(["fkp-menu-search", {
|
|
3820
|
-
"is-todo-search": u.value === "todo" || u.value === "ticket" || u.value === "tagged" || u.value === "variable" || u.value === "attribute" || u.value === "tool",
|
|
3821
|
-
"is-agent-search": u.value === "agentSelect"
|
|
3822
|
-
}])
|
|
3823
|
-
}, [
|
|
3824
|
-
x(k(de), {
|
|
3825
|
-
name: "search",
|
|
3826
|
-
size: 15
|
|
3827
|
-
}),
|
|
3828
|
-
x(k(vi), {
|
|
3829
|
-
modelValue: k(ne),
|
|
3830
|
-
"onUpdate:modelValue": t[10] || (t[10] = (r) => gi(ne) ? ne.value = r : null),
|
|
3831
|
-
"input-attrs": {
|
|
3832
|
-
"aria-label": u.value === "variable" ? "搜索变量名称" : u.value === "ticket" ? "搜索工单名称" : u.value === "attribute" ? "搜索属性名称" : u.value === "tool" ? "搜索工具名称" : u.value === "todo" || u.value === "tagged" || u.value === "agentSelect" ? "搜索标签名称" : "搜索选项"
|
|
3833
|
-
},
|
|
3834
|
-
placeholder: u.value === "variable" ? "搜索变量名称" : u.value === "ticket" ? "搜索工单名称" : u.value === "attribute" ? "搜索属性名称" : u.value === "tool" ? "搜索工具名称" : u.value === "todo" || u.value === "tagged" || u.value === "agentSelect" ? "搜索标签名称" : "搜索选项",
|
|
3835
|
-
onInput: t[11] || (t[11] = (r) => k(be)(u.value))
|
|
3836
|
-
}, null, 8, ["modelValue", "input-attrs", "placeholder"])
|
|
3837
|
-
], 2),
|
|
3838
|
-
u.value === "variable" ? (E(), le(ma, {
|
|
3839
|
-
key: 8,
|
|
3840
|
-
options: k(L),
|
|
3841
|
-
loading: k(oe),
|
|
3842
|
-
"next-cursor": k(pe),
|
|
3843
|
-
query: k(ne),
|
|
3844
|
-
onChoose: t[12] || (t[12] = (r, f) => kn("variable", r, f)),
|
|
3845
|
-
onLoadMore: t[13] || (t[13] = (r) => k(be)("variable", !0))
|
|
3846
|
-
}, null, 8, ["options", "loading", "next-cursor", "query"])) : (E(), C("div", Ua, [
|
|
3847
|
-
k(oe) && !k(L).length ? (E(), C("p", Fa, [
|
|
3848
|
-
x(k(de), {
|
|
3849
|
-
name: "sync",
|
|
3850
|
-
size: 15,
|
|
3851
|
-
class: "fkp-spin"
|
|
3852
|
-
}),
|
|
3853
|
-
t[33] || (t[33] = ye("加载中…"))
|
|
3854
|
-
])) : !k(oe) && !k(L).length ? (E(), C("p", ja, "暂无可选项")) : $("", !0),
|
|
3855
|
-
(E(!0), C(Ae, null, Ge(k(L), (r) => {
|
|
3856
|
-
var f, S, R;
|
|
3857
|
-
return E(), le(k(ee), {
|
|
3858
|
-
key: r.id,
|
|
3859
|
-
type: "text",
|
|
3860
|
-
"aria-label": r.label,
|
|
3861
|
-
"aria-pressed": u.value === ((f = F.value) == null ? void 0 : f.kind) ? F.value.key === r.id : u.value === "agentSelect" ? ((S = Fe.value) == null ? void 0 : S.id) === r.id : (u.value === "todo" || u.value === "tagged") && dt(u.value) === "questionAction" ? ((R = fn(u.value)) == null ? void 0 : R.id) === r.id : void 0,
|
|
3862
|
-
disabled: r.disabled,
|
|
3863
|
-
onClick: (B) => kn(u.value, r, B)
|
|
3864
|
-
}, {
|
|
3865
|
-
default: K(() => [
|
|
3866
|
-
ye(Z(r.label), 1),
|
|
3867
|
-
r.hasChildren ? (E(), le(k(de), {
|
|
3868
|
-
key: 0,
|
|
3869
|
-
class: "fkp-option-child-icon",
|
|
3870
|
-
name: "arrow-down",
|
|
3871
|
-
size: 14
|
|
3872
|
-
})) : $("", !0)
|
|
3873
|
-
]),
|
|
3874
|
-
_: 2
|
|
3875
|
-
}, 1032, ["aria-label", "aria-pressed", "disabled", "onClick"]);
|
|
3876
|
-
}), 128)),
|
|
3877
|
-
k(pe) ? (E(), le(k(ee), {
|
|
3878
|
-
key: 2,
|
|
3879
|
-
type: "text",
|
|
3880
|
-
class: "fkp-menu-more",
|
|
3881
|
-
disabled: k(oe),
|
|
3882
|
-
onClick: t[14] || (t[14] = (r) => k(be)(u.value, !0))
|
|
3883
|
-
}, {
|
|
3884
|
-
default: K(() => t[34] || (t[34] = [
|
|
3885
|
-
ye("加载更多")
|
|
3886
|
-
])),
|
|
3887
|
-
_: 1
|
|
3888
|
-
}, 8, ["disabled"])) : $("", !0)
|
|
3889
|
-
]))
|
|
3890
|
-
], 38)) : $("", !0),
|
|
3891
|
-
x(k(yi), {
|
|
3892
|
-
visible: u.value === "reasoningTemplate",
|
|
3893
|
-
title: "推理模板",
|
|
3894
|
-
width: 480,
|
|
3895
|
-
footer: !1,
|
|
3896
|
-
onCancel: t[16] || (t[16] = (r) => u.value = null)
|
|
3897
|
-
}, {
|
|
3898
|
-
default: K(() => [
|
|
3899
|
-
_("div", za, [
|
|
3900
|
-
t[37] || (t[37] = _("p", { class: "fkp-template-intro" }, " 推理适用于需要根据不同情况判断条件和对应处理规则的业务场景,AI 命中知识后会选择对应流程并结合实际信息进行回复或执行动作。您可以参考以下示例进行推理内容的配置: ", -1)),
|
|
3901
|
-
k(oe) ? (E(), C("p", Ga, "加载中…")) : k(L).length ? $("", !0) : (E(), C("p", Ja, "暂无可用模板")),
|
|
3902
|
-
(E(!0), C(Ae, null, Ge(k(L), (r) => (E(), C("div", {
|
|
3903
|
-
key: r.id,
|
|
3904
|
-
class: "fkp-template-card"
|
|
3905
|
-
}, [
|
|
3906
|
-
x(k(ee), {
|
|
3907
|
-
type: "text",
|
|
3908
|
-
class: "fkp-template-title",
|
|
3909
|
-
"aria-label": r.label,
|
|
3910
|
-
"aria-expanded": $e.value === r.id,
|
|
3911
|
-
disabled: r.disabled,
|
|
3912
|
-
onClick: (f) => $e.value = $e.value === r.id ? null : r.id
|
|
3913
|
-
}, {
|
|
3914
|
-
default: K(() => [
|
|
3915
|
-
ye(Z(r.label), 1),
|
|
3916
|
-
x(k(de), {
|
|
3917
|
-
name: "arrow-down",
|
|
3918
|
-
size: 14
|
|
3919
|
-
})
|
|
3920
|
-
]),
|
|
3921
|
-
_: 2
|
|
3922
|
-
}, 1032, ["aria-label", "aria-expanded", "disabled", "onClick"]),
|
|
3923
|
-
$e.value === r.id ? (E(), C("div", Wa, [
|
|
3924
|
-
r.preview ? (E(), C("p", Ha, Z(r.preview), 1)) : $("", !0),
|
|
3925
|
-
x(k(ee), {
|
|
3926
|
-
type: "primary",
|
|
3927
|
-
disabled: r.disabled,
|
|
3928
|
-
onClick: (f) => kn("reasoningTemplate", r)
|
|
3929
|
-
}, {
|
|
3930
|
-
default: K(() => t[35] || (t[35] = [
|
|
3931
|
-
ye("使用模板")
|
|
3932
|
-
])),
|
|
3933
|
-
_: 2
|
|
3934
|
-
}, 1032, ["disabled", "onClick"])
|
|
3935
|
-
])) : $("", !0)
|
|
3936
|
-
]))), 128)),
|
|
3937
|
-
k(pe) ? (E(), le(k(ee), {
|
|
3938
|
-
key: 2,
|
|
3939
|
-
type: "text",
|
|
3940
|
-
disabled: k(oe),
|
|
3941
|
-
onClick: t[15] || (t[15] = (r) => k(be)("reasoningTemplate", !0))
|
|
3942
|
-
}, {
|
|
3943
|
-
default: K(() => t[36] || (t[36] = [
|
|
3944
|
-
ye("加载更多")
|
|
3945
|
-
])),
|
|
3946
|
-
_: 1
|
|
3947
|
-
}, 8, ["disabled"])) : $("", !0)
|
|
3948
|
-
])
|
|
3949
|
-
]),
|
|
3950
|
-
_: 1
|
|
3951
|
-
}, 8, ["visible"]),
|
|
3952
|
-
k(Be) ? (E(), le(k(fo), {
|
|
3953
|
-
key: 1,
|
|
3954
|
-
visible: !0,
|
|
3955
|
-
title: ((s = k(Ee)) == null ? void 0 : s.label) || "工具配置",
|
|
3956
|
-
width: 500,
|
|
3957
|
-
"modal-class": "fkp-tool-modal",
|
|
3958
|
-
footer: !1,
|
|
3959
|
-
onCancel: k(He)
|
|
3960
|
-
}, {
|
|
3961
|
-
default: K(() => {
|
|
3962
|
-
var r, f;
|
|
3963
|
-
return [
|
|
3964
|
-
x(k(g), {
|
|
3965
|
-
definition: k(Be),
|
|
3966
|
-
"initial-params": ((r = k(Ee)) == null ? void 0 : r.params) || {},
|
|
3967
|
-
"submit-label": (f = k(Ee)) != null && f.nodeId ? "保存" : "插入",
|
|
3968
|
-
onSubmit: ei,
|
|
3969
|
-
onCancel: k(He)
|
|
3970
|
-
}, null, 8, ["definition", "initial-params", "submit-label", "onCancel"])
|
|
3971
|
-
];
|
|
3972
|
-
}),
|
|
3973
|
-
_: 1
|
|
3974
|
-
}, 8, ["title", "onCancel"])) : $("", !0),
|
|
3975
|
-
_("div", {
|
|
3976
|
-
class: Ke(["fkp-scene-body", { "has-knowledge-content": Ht.value }])
|
|
3977
|
-
}, [
|
|
3978
|
-
_("div", Ya, [
|
|
3979
|
-
_("span", {
|
|
3980
|
-
class: "fkp-question-prompt",
|
|
3981
|
-
onClick: Do
|
|
3982
|
-
}, [
|
|
3983
|
-
t[38] || (t[38] = _("span", { "aria-hidden": "true" }, "[", -1)),
|
|
3984
|
-
_("span", {
|
|
3985
|
-
class: Ke(["fkp-question-field", { "is-filled": !!l.value.question.text }])
|
|
3986
|
-
}, [
|
|
3987
|
-
_("span", Qa, Z(l.value.question.text || "填写顾客咨询意图,多种意图使用 / 分隔"), 1),
|
|
3988
|
-
x(k(ki), {
|
|
3989
|
-
"model-value": l.value.question.text,
|
|
3990
|
-
disabled: re.value,
|
|
3991
|
-
"textarea-attrs": { "aria-label": "顾客问法", rows: 1 },
|
|
3992
|
-
placeholder: "填写顾客咨询意图,多种意图使用 / 分隔",
|
|
3993
|
-
onFocus: Ro,
|
|
3994
|
-
onBlur: Lo,
|
|
3995
|
-
onKeydown: t[17] || (t[17] = Sn(tn(() => {
|
|
3996
|
-
}, ["prevent"]), ["enter"])),
|
|
3997
|
-
onInput: Mo
|
|
3998
|
-
}, null, 8, ["model-value", "disabled"])
|
|
3999
|
-
], 2),
|
|
4000
|
-
t[39] || (t[39] = _("span", {
|
|
4001
|
-
"aria-hidden": "true",
|
|
4002
|
-
class: "fkp-question-close"
|
|
4003
|
-
}, "]", -1))
|
|
4004
|
-
]),
|
|
4005
|
-
Gn.value.length ? (E(), C("span", Xa, [
|
|
4006
|
-
(E(!0), C(Ae, null, Ge(Gn.value, (r) => (E(), le(k(ee), {
|
|
4007
|
-
key: r.id,
|
|
4008
|
-
class: Ke(["fkp-question-tag", `fkp-question-tag--${r.kind}`]),
|
|
4009
|
-
"data-fkp-menu-trigger": r.id,
|
|
4010
|
-
type: "text",
|
|
4011
|
-
disabled: re.value,
|
|
4012
|
-
"aria-label": `${r.id === "todo" ? "待办" : "顾客标签"}方案:${r.label}`,
|
|
4013
|
-
"aria-expanded": u.value === r.id,
|
|
4014
|
-
onMouseenter: (f) => zn(r.id, f, !0),
|
|
4015
|
-
onPointerdownCapture: (f) => Po(r.id, f),
|
|
4016
|
-
onMouseleave: ot,
|
|
4017
|
-
onClick: (f) => zn(r.id, f, !1)
|
|
4018
|
-
}, {
|
|
4019
|
-
default: K(() => [
|
|
4020
|
-
x(k(de), {
|
|
4021
|
-
class: "fkp-question-tag-icon",
|
|
4022
|
-
name: _t[r.icon] || "book",
|
|
4023
|
-
size: 16
|
|
4024
|
-
}, null, 8, ["name"]),
|
|
4025
|
-
_("span", Za, Z(r.label), 1),
|
|
4026
|
-
x(k(de), {
|
|
4027
|
-
name: "arrow-down",
|
|
4028
|
-
size: 12
|
|
4029
|
-
})
|
|
4030
|
-
]),
|
|
4031
|
-
_: 2
|
|
4032
|
-
}, 1032, ["data-fkp-menu-trigger", "class", "disabled", "aria-label", "aria-expanded", "onMouseenter", "onPointerdownCapture", "onClick"]))), 128))
|
|
4033
|
-
])) : $("", !0)
|
|
4034
|
-
]),
|
|
4035
|
-
_("div", el, [
|
|
4036
|
-
xt.value ? (E(), C("div", tl, [
|
|
4037
|
-
_("p", null, "此知识包含当前版本无法编辑的内容:" + Z(xt.value) + "。请升级扩展后编辑。", 1),
|
|
4038
|
-
_("pre", nl, Z(Co.value), 1),
|
|
4039
|
-
Vn.value ? (E(), C(Ae, { key: 0 }, [
|
|
4040
|
-
t[40] || (t[40] = _("p", null, "扩展状态(只读)", -1)),
|
|
4041
|
-
_("pre", ol, Z(Vn.value), 1)
|
|
4042
|
-
], 64)) : $("", !0)
|
|
4043
|
-
])) : l.value.type !== "agent" ? (E(), le(k(A), {
|
|
4044
|
-
ref_key: "area",
|
|
4045
|
-
ref: H,
|
|
4046
|
-
key: e.sceneKey + ":" + l.value.type + ":" + qn.value,
|
|
4047
|
-
"model-value": l.value.knowledge.doc || k(vt)(),
|
|
4048
|
-
editable: !re.value,
|
|
4049
|
-
"reference-placeholder": l.value.type === "reasoning",
|
|
4050
|
-
"schema-plan": Kn.value,
|
|
4051
|
-
"active-choice-id": u.value === ((d = F.value) == null ? void 0 : d.kind) ? (b = F.value) == null ? void 0 : b.nodeId : null,
|
|
4052
|
-
placeholder: l.value.type === "reasoning" ? `填写不同情况的判断条件和处理规则,例如:
|
|
4053
|
-
1、如果顾客咨询要换货…` : "填写知识内容",
|
|
4054
|
-
onFocusin: $o,
|
|
4055
|
-
onPasteCapture: ii,
|
|
4056
|
-
onDragoverCapture: ai,
|
|
4057
|
-
onDropCapture: li,
|
|
4058
|
-
"onUpdate:modelValue": Vo,
|
|
4059
|
-
onRetryMedia: k(si),
|
|
4060
|
-
onLoadError: Bo,
|
|
4061
|
-
onEditTool: Zo,
|
|
4062
|
-
onChoiceMenu: Qo,
|
|
4063
|
-
onLeaveChoice: ot
|
|
4064
|
-
}, null, 8, ["model-value", "editable", "reference-placeholder", "schema-plan", "active-choice-id", "placeholder", "onRetryMedia"])) : (E(), C("div", il, [
|
|
4065
|
-
Fe.value ? (E(), C("div", al, Z(Fe.value.name), 1)) : $("", !0),
|
|
4066
|
-
Zn.value ? (E(), C("div", {
|
|
4067
|
-
key: 1,
|
|
4068
|
-
class: Ke({
|
|
4069
|
-
placeholder: se.value !== "ready" || !Pe.value
|
|
4070
|
-
})
|
|
4071
|
-
}, Z(Zn.value), 3)) : $("", !0)
|
|
4072
|
-
]))
|
|
4073
|
-
]),
|
|
4074
|
-
x(k(ee), {
|
|
4075
|
-
class: "fkp-delete",
|
|
4076
|
-
type: "text",
|
|
4077
|
-
"aria-label": "删除知识",
|
|
4078
|
-
disabled: re.value,
|
|
4079
|
-
onClick: ui
|
|
4080
|
-
}, {
|
|
4081
|
-
default: K(() => [
|
|
4082
|
-
x(k(hi), { size: 19 })
|
|
4083
|
-
]),
|
|
4084
|
-
_: 1
|
|
4085
|
-
}, 8, ["disabled"])
|
|
4086
|
-
], 2),
|
|
4087
|
-
_("input", {
|
|
4088
|
-
ref_key: "fileInput",
|
|
4089
|
-
ref: Qe,
|
|
4090
|
-
type: "file",
|
|
4091
|
-
accept: xo.value,
|
|
4092
|
-
multiple: "",
|
|
4093
|
-
hidden: "",
|
|
4094
|
-
"aria-label": "选择媒体文件",
|
|
4095
|
-
onChange: oi
|
|
4096
|
-
}, null, 40, ll)
|
|
4097
|
-
], 34);
|
|
4098
|
-
};
|
|
4099
|
-
}
|
|
4100
|
-
});
|
|
4101
|
-
export {
|
|
4102
|
-
ml as _,
|
|
4103
|
-
vt as a,
|
|
4104
|
-
mt as b,
|
|
4105
|
-
pt as c,
|
|
4106
|
-
ia as d,
|
|
4107
|
-
nn as e,
|
|
4108
|
-
kl as f,
|
|
4109
|
-
vl as g,
|
|
4110
|
-
yl as h,
|
|
4111
|
-
zi as i,
|
|
4112
|
-
yt as p,
|
|
4113
|
-
Bt as r,
|
|
4114
|
-
gl as v
|
|
4115
|
-
};
|