@freecallai/pro 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js +4416 -0
- package/dist/KnowledgeArea-BkRVWFrg.js +1224 -0
- package/dist/{ToolForm-CWpUIVTl.js → ToolForm-BSJxTJ7U.js} +1 -1
- package/dist/index-BVHYCLDv.js +5 -0
- package/dist/{index-DOEijEGU.js → index-BnFTr8u9.js} +1 -1
- package/dist/{index-5a9mHHzg.js → index-CG2j9Znw.js} +1 -1
- package/dist/index-kOPLn4DD.js +5 -0
- package/dist/index.js +3 -3
- package/dist/{media-migration-CGOFwdYm.js → media-migration-Cj-3xrxd.js} +1 -1
- package/dist/{media-upload-Dx45yv6a.js → media-upload-D7DpMJYx.js} +1 -1
- package/dist/rich-text/index.js +5 -5
- package/dist/rich-text/legacy-converter/index.js +766 -321
- package/dist/{guard-BCatAeT4.js → rules-CC6NoltX.js} +252 -190
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/rich-text/FkpRichText.vue.d.ts +16 -5
- package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +12 -0
- package/dist/types/rich-text/index.d.ts +1 -1
- package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +32 -0
- package/dist/types/rich-text/legacy-converter/index.d.ts +1 -0
- package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +5 -0
- package/dist/types/rich-text/plugins/tool/rules.d.ts +34 -0
- package/dist/types/rich-text/public/types.d.ts +10 -0
- package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
- package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
- package/dist/types/rich-text/runtime/media-target.d.ts +1 -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/ui/KnowledgeArea.vue.d.ts +7 -0
- package/package.json +1 -1
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +0 -4115
- package/dist/KnowledgeArea-OPR7smbt.js +0 -923
- package/dist/index-BsQLwz91.js +0 -5
- package/dist/index-xAjlBylT.js +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ot = [
|
|
2
2
|
{
|
|
3
3
|
id: "todo",
|
|
4
4
|
apiVersion: 1,
|
|
@@ -30,7 +30,7 @@ const it = [
|
|
|
30
30
|
optionSource: "flatTags",
|
|
31
31
|
optionTrigger: "hover"
|
|
32
32
|
}
|
|
33
|
-
],
|
|
33
|
+
], st = [
|
|
34
34
|
{
|
|
35
35
|
id: "ticket",
|
|
36
36
|
apiVersion: 1,
|
|
@@ -46,7 +46,7 @@ const it = [
|
|
|
46
46
|
optionSource: "flatTags",
|
|
47
47
|
optionTrigger: "hover"
|
|
48
48
|
}
|
|
49
|
-
],
|
|
49
|
+
], at = [
|
|
50
50
|
{
|
|
51
51
|
id: "originalReply",
|
|
52
52
|
apiVersion: 1,
|
|
@@ -71,7 +71,7 @@ const it = [
|
|
|
71
71
|
types: ["reasoning"],
|
|
72
72
|
icon: "original"
|
|
73
73
|
}
|
|
74
|
-
],
|
|
74
|
+
], lt = [
|
|
75
75
|
{
|
|
76
76
|
id: "memory",
|
|
77
77
|
apiVersion: 1,
|
|
@@ -84,7 +84,7 @@ const it = [
|
|
|
84
84
|
types: ["normal", "reasoning", "agent"],
|
|
85
85
|
icon: "memory"
|
|
86
86
|
}
|
|
87
|
-
],
|
|
87
|
+
], ct = [
|
|
88
88
|
{
|
|
89
89
|
id: "tagged",
|
|
90
90
|
apiVersion: 1,
|
|
@@ -101,7 +101,7 @@ const it = [
|
|
|
101
101
|
optionTrigger: "hover",
|
|
102
102
|
questionTag: { kind: "default" }
|
|
103
103
|
}
|
|
104
|
-
],
|
|
104
|
+
], pt = [
|
|
105
105
|
{
|
|
106
106
|
id: "attribute",
|
|
107
107
|
apiVersion: 1,
|
|
@@ -118,7 +118,7 @@ const it = [
|
|
|
118
118
|
optionTrigger: "hover",
|
|
119
119
|
optionHierarchy: "tree"
|
|
120
120
|
}
|
|
121
|
-
],
|
|
121
|
+
], dt = [
|
|
122
122
|
{
|
|
123
123
|
id: "tool",
|
|
124
124
|
apiVersion: 1,
|
|
@@ -136,7 +136,7 @@ const it = [
|
|
|
136
136
|
optionHierarchy: "tree",
|
|
137
137
|
uiPorts: ["getToolForm"]
|
|
138
138
|
}
|
|
139
|
-
],
|
|
139
|
+
], ut = [
|
|
140
140
|
{
|
|
141
141
|
id: "variable",
|
|
142
142
|
apiVersion: 1,
|
|
@@ -152,7 +152,7 @@ const it = [
|
|
|
152
152
|
optionSource: "variables"
|
|
153
153
|
}
|
|
154
154
|
];
|
|
155
|
-
const
|
|
155
|
+
const Kt = {
|
|
156
156
|
agents: "searchAgents",
|
|
157
157
|
variables: "listVariables",
|
|
158
158
|
flatTags: "listCapabilityOptions",
|
|
@@ -173,7 +173,7 @@ const w = {
|
|
|
173
173
|
id: "reasoningTemplate.load",
|
|
174
174
|
requiredPorts: ["getReasoningTemplate"]
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, gt = [
|
|
177
177
|
{
|
|
178
178
|
id: "image",
|
|
179
179
|
apiVersion: 1,
|
|
@@ -188,7 +188,7 @@ const w = {
|
|
|
188
188
|
icon: "image",
|
|
189
189
|
optionKind: "media"
|
|
190
190
|
}
|
|
191
|
-
],
|
|
191
|
+
], ft = [
|
|
192
192
|
{
|
|
193
193
|
id: "video",
|
|
194
194
|
apiVersion: 1,
|
|
@@ -203,7 +203,7 @@ const w = {
|
|
|
203
203
|
icon: "video",
|
|
204
204
|
optionKind: "media"
|
|
205
205
|
}
|
|
206
|
-
],
|
|
206
|
+
], yt = [
|
|
207
207
|
{
|
|
208
208
|
id: "separator",
|
|
209
209
|
apiVersion: 1,
|
|
@@ -216,7 +216,7 @@ const w = {
|
|
|
216
216
|
types: ["normal", "reasoning"],
|
|
217
217
|
icon: "separator"
|
|
218
218
|
}
|
|
219
|
-
],
|
|
219
|
+
], mt = [
|
|
220
220
|
{
|
|
221
221
|
id: "reasoningPolish",
|
|
222
222
|
apiVersion: 1,
|
|
@@ -246,7 +246,7 @@ const w = {
|
|
|
246
246
|
optionKind: "selection",
|
|
247
247
|
optionSource: "capabilities"
|
|
248
248
|
}
|
|
249
|
-
],
|
|
249
|
+
], bt = [
|
|
250
250
|
{
|
|
251
251
|
id: "agentSelect",
|
|
252
252
|
apiVersion: 1,
|
|
@@ -263,8 +263,7 @@ const w = {
|
|
|
263
263
|
optionSource: "agents",
|
|
264
264
|
optionTrigger: "hover"
|
|
265
265
|
}
|
|
266
|
-
],
|
|
267
|
-
...it,
|
|
266
|
+
], Z = [
|
|
268
267
|
...ot,
|
|
269
268
|
...st,
|
|
270
269
|
...at,
|
|
@@ -276,10 +275,11 @@ const w = {
|
|
|
276
275
|
...gt,
|
|
277
276
|
...ft,
|
|
278
277
|
...yt,
|
|
278
|
+
...mt,
|
|
279
279
|
...kt,
|
|
280
|
-
...
|
|
280
|
+
...bt
|
|
281
281
|
];
|
|
282
|
-
function
|
|
282
|
+
function tt(r, n = "") {
|
|
283
283
|
const e = /* @__PURE__ */ new Set(), s = (o, t, i) => {
|
|
284
284
|
if (o === null || typeof o == "string" || typeof o == "boolean")
|
|
285
285
|
return null;
|
|
@@ -288,122 +288,122 @@ function Z(n, r = "") {
|
|
|
288
288
|
if (typeof o != "object" || i > 64 || e.has(o))
|
|
289
289
|
return t;
|
|
290
290
|
if (!Array.isArray(o)) {
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
291
|
+
const c = Object.getPrototypeOf(o);
|
|
292
|
+
if (c !== Object.prototype && c !== null) return t;
|
|
293
293
|
}
|
|
294
294
|
const u = Reflect.ownKeys(o);
|
|
295
|
-
if (u.some((
|
|
295
|
+
if (u.some((c) => typeof c == "symbol")) return t;
|
|
296
296
|
if (Array.isArray(o)) {
|
|
297
297
|
if (u.length !== o.length + 1) return t;
|
|
298
|
-
for (let
|
|
299
|
-
if (!Object.prototype.hasOwnProperty.call(o,
|
|
300
|
-
return `${t}[${
|
|
298
|
+
for (let c = 0; c < o.length; c++)
|
|
299
|
+
if (!Object.prototype.hasOwnProperty.call(o, c))
|
|
300
|
+
return `${t}[${c}]`;
|
|
301
301
|
}
|
|
302
302
|
e.add(o);
|
|
303
|
-
for (const
|
|
304
|
-
if (Array.isArray(o) &&
|
|
305
|
-
const a = Object.getOwnPropertyDescriptor(o,
|
|
303
|
+
for (const c of u) {
|
|
304
|
+
if (Array.isArray(o) && c === "length") continue;
|
|
305
|
+
const a = Object.getOwnPropertyDescriptor(o, c), l = Array.isArray(o) ? `${t}[${String(c)}]` : t ? `${t}.${String(c)}` : String(c);
|
|
306
306
|
if (!a || !("value" in a) || !Array.isArray(o) && !a.enumerable)
|
|
307
|
-
return
|
|
308
|
-
const d = s(a.value,
|
|
307
|
+
return l;
|
|
308
|
+
const d = s(a.value, l, i + 1);
|
|
309
309
|
if (d !== null) return d;
|
|
310
310
|
}
|
|
311
311
|
return e.delete(o), null;
|
|
312
312
|
};
|
|
313
313
|
try {
|
|
314
|
-
return s(
|
|
314
|
+
return s(r, n, 0);
|
|
315
315
|
} catch {
|
|
316
|
-
return
|
|
316
|
+
return n;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
function $(
|
|
320
|
-
if (typeof
|
|
319
|
+
function $(r) {
|
|
320
|
+
if (typeof r != "string" || !/^https?:\/\/[^\s]+$/i.test(r))
|
|
321
321
|
return !1;
|
|
322
322
|
try {
|
|
323
|
-
const
|
|
324
|
-
return (
|
|
323
|
+
const n = new URL(r);
|
|
324
|
+
return (n.protocol === "http:" || n.protocol === "https:") && !!n.hostname && !n.username && !n.password;
|
|
325
325
|
} catch {
|
|
326
326
|
return !1;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const wt = [
|
|
330
330
|
"todo",
|
|
331
331
|
"ticket",
|
|
332
332
|
"variable",
|
|
333
333
|
"attribute",
|
|
334
334
|
"tool",
|
|
335
335
|
"separator"
|
|
336
|
-
],
|
|
336
|
+
], St = ["todo", "ticket", "attribute"], At = ["image", "video"], $t = new Set(wt), It = new Set(St), ht = new Set(At), et = (r) => typeof r == "string" && $t.has(r), Nt = (r) => typeof r == "string" && It.has(r), rt = (r) => typeof r == "string" && ht.has(r), Tt = /* @__PURE__ */ new Set([
|
|
337
337
|
"businessToken",
|
|
338
338
|
"originalReply",
|
|
339
339
|
"messageSeparator",
|
|
340
340
|
"mediaBlock"
|
|
341
|
-
]),
|
|
342
|
-
function
|
|
343
|
-
return
|
|
341
|
+
]), I = (r) => Tt.has(r);
|
|
342
|
+
function _t(r, n) {
|
|
343
|
+
return r === "businessToken" ? et(n == null ? void 0 : n.kind) ? n.kind : null : r === "mediaBlock" ? rt(n == null ? void 0 : n.kind) ? n.kind : null : r === "originalReply" ? "originalReply" : r === "messageSeparator" ? "separator" : null;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
346
|
-
var
|
|
347
|
-
return !!((
|
|
348
|
-
(e) => typeof e.type == "string" &&
|
|
345
|
+
function Vt(r) {
|
|
346
|
+
var n;
|
|
347
|
+
return !!((n = r.content) != null && n.some(
|
|
348
|
+
(e) => typeof e.type == "string" && I(e.type) || Vt(e)
|
|
349
349
|
));
|
|
350
350
|
}
|
|
351
|
-
const
|
|
352
|
-
function
|
|
353
|
-
const
|
|
351
|
+
const Lt = "fkpTrustedNodeIds";
|
|
352
|
+
function Mt(r) {
|
|
353
|
+
const n = [], e = (s) => {
|
|
354
354
|
var o, t;
|
|
355
|
-
s.type &&
|
|
355
|
+
s.type && I(s.type) && typeof ((o = s.attrs) == null ? void 0 : o.id) == "string" && s.attrs.id && n.push(s.attrs.id), (t = s.content) == null || t.forEach(e);
|
|
356
356
|
};
|
|
357
|
-
return Array.isArray(
|
|
357
|
+
return Array.isArray(r) ? r.forEach(e) : e(r), n;
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function Ct(r, n) {
|
|
360
360
|
for (let t = 0; t < 8; t++) {
|
|
361
|
-
const i =
|
|
362
|
-
if (i && !
|
|
361
|
+
const i = n();
|
|
362
|
+
if (i && !r.has(i)) return i;
|
|
363
363
|
}
|
|
364
|
-
const e =
|
|
364
|
+
const e = n() || "node";
|
|
365
365
|
let s = e, o = 1;
|
|
366
|
-
for (;
|
|
366
|
+
for (; r.has(s); ) s = `${e}-${o++}`;
|
|
367
367
|
return s;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
369
|
+
const Q = {
|
|
370
370
|
todo: "待办",
|
|
371
371
|
tagged: "顾客标签"
|
|
372
372
|
};
|
|
373
|
-
function
|
|
374
|
-
return
|
|
373
|
+
function Pt(r) {
|
|
374
|
+
return r.includes("[") || r.includes("]") || /[【】\r\n]/u.test(r);
|
|
375
375
|
}
|
|
376
|
-
function nt(
|
|
377
|
-
return /[{}\r\n]/u.test(
|
|
376
|
+
function nt(r) {
|
|
377
|
+
return /[{}\r\n]/u.test(r);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function qt(r, n) {
|
|
380
380
|
var i;
|
|
381
|
-
const e = (i =
|
|
381
|
+
const e = (i = r.extensionState[n]) == null ? void 0 : i.data;
|
|
382
382
|
if (!e || typeof e != "object" || Array.isArray(e)) return null;
|
|
383
383
|
const { tag: s } = e;
|
|
384
384
|
if (!s || typeof s != "object" || Array.isArray(s)) return null;
|
|
385
385
|
const { id: o, label: t } = s;
|
|
386
386
|
return typeof o != "string" || !o.trim() || typeof t != "string" || !t.trim() ? null : { id: o, label: t };
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
return ["todo", "tagged"].flatMap((
|
|
388
|
+
function xt(r) {
|
|
389
|
+
return ["todo", "tagged"].flatMap((n) => {
|
|
390
390
|
var t;
|
|
391
|
-
if (
|
|
392
|
-
const e = (t =
|
|
391
|
+
if (n === "todo" && r.type !== "normal") return [];
|
|
392
|
+
const e = (t = r.extensionState[n]) == null ? void 0 : t.data, s = e && typeof e == "object" && !Array.isArray(e) ? e.enabled === !0 : !1, o = s ? qt(r, n) : null;
|
|
393
393
|
if (s && !o)
|
|
394
|
-
throw new Error(`${
|
|
394
|
+
throw new Error(`${Q[n]}已开启但未选择方案`);
|
|
395
395
|
if (o && nt(o.label))
|
|
396
396
|
throw new Error("方案名称包含协议保留字符");
|
|
397
|
-
return o ? [`{${
|
|
397
|
+
return o ? [`{${Q[n]}@${o.label}}`] : [];
|
|
398
398
|
}).join("");
|
|
399
399
|
}
|
|
400
|
-
function
|
|
401
|
-
var
|
|
402
|
-
if (typeof ((
|
|
400
|
+
function Ft(r) {
|
|
401
|
+
var n;
|
|
402
|
+
if (typeof ((n = r.question) == null ? void 0 : n.text) != "string" || Pt(r.question.text))
|
|
403
403
|
throw new Error("意图文字中不可填写方括号或换行,请修改");
|
|
404
|
-
return `[${
|
|
404
|
+
return `[${r.question.text}]${xt(r)}`;
|
|
405
405
|
}
|
|
406
|
-
const
|
|
406
|
+
const it = /* @__PURE__ */ new Set([
|
|
407
407
|
"doc",
|
|
408
408
|
"paragraph",
|
|
409
409
|
"text",
|
|
@@ -418,7 +418,7 @@ const rt = /* @__PURE__ */ new Set([
|
|
|
418
418
|
"originalReply",
|
|
419
419
|
"messageSeparator",
|
|
420
420
|
"mediaBlock"
|
|
421
|
-
]),
|
|
421
|
+
]), Ut = (r) => it.has(r), Ot = /* @__PURE__ */ new Set([
|
|
422
422
|
"bold",
|
|
423
423
|
"italic",
|
|
424
424
|
"strike",
|
|
@@ -444,7 +444,7 @@ const rt = /* @__PURE__ */ new Set([
|
|
|
444
444
|
blockquote: A,
|
|
445
445
|
codeBlock: /* @__PURE__ */ new Set(["text"]),
|
|
446
446
|
originalReply: /* @__PURE__ */ new Set(["paragraph", "mediaBlock", "messageSeparator"])
|
|
447
|
-
},
|
|
447
|
+
}, vt = {
|
|
448
448
|
orderedList: /* @__PURE__ */ new Set(["start", "type"]),
|
|
449
449
|
codeBlock: /* @__PURE__ */ new Set(["language"]),
|
|
450
450
|
businessToken: /* @__PURE__ */ new Set([
|
|
@@ -470,13 +470,13 @@ const rt = /* @__PURE__ */ new Set([
|
|
|
470
470
|
"error"
|
|
471
471
|
])
|
|
472
472
|
};
|
|
473
|
-
function jt(
|
|
474
|
-
if (!
|
|
475
|
-
const
|
|
476
|
-
if (typeof
|
|
473
|
+
function jt(r) {
|
|
474
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
475
|
+
const n = r;
|
|
476
|
+
if (typeof n.type != "string" || !Ot.has(n.type) || Object.keys(n).some((o) => !["type", "attrs"].includes(o)) || n.attrs !== void 0 && (!n.attrs || typeof n.attrs != "object" || Array.isArray(n.attrs)))
|
|
477
477
|
return !1;
|
|
478
|
-
const e =
|
|
479
|
-
if (
|
|
478
|
+
const e = n.attrs || {};
|
|
479
|
+
if (n.type !== "link") return Object.keys(e).length === 0;
|
|
480
480
|
if (Object.keys(e).some(
|
|
481
481
|
(o) => !["href", "target", "rel", "class", "title"].includes(o)
|
|
482
482
|
) || !$(e.href))
|
|
@@ -484,30 +484,30 @@ function jt(n) {
|
|
|
484
484
|
const s = (o) => o == null || typeof o == "string";
|
|
485
485
|
return !s(e.rel) || !s(e.class) || !s(e.title) || e.target !== void 0 && e.target !== null && !["_blank", "_self"].includes(String(e.target)) ? !1 : e.target !== "_blank" || typeof e.rel == "string" && e.rel.split(/\s+/).includes("noopener");
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
const s = Object.keys(
|
|
489
|
-
(o) => !
|
|
487
|
+
function k(r, n, e = "") {
|
|
488
|
+
const s = Object.keys(r).find(
|
|
489
|
+
(o) => !n.includes(o)
|
|
490
490
|
);
|
|
491
491
|
return s ? e ? `${e}.${s}` : s : null;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
494
|
-
if (
|
|
493
|
+
function Y(r, n = "knowledge.doc") {
|
|
494
|
+
if (r === null) return null;
|
|
495
495
|
const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new WeakSet();
|
|
496
|
-
function o(t, i, u,
|
|
497
|
-
var
|
|
498
|
-
if (!t || typeof t != "object" || !t.type || !
|
|
496
|
+
function o(t, i, u, c = !1) {
|
|
497
|
+
var l, d, f, g, m, y, b, h, T, V, P, q, x, O, v, j, R, D, B, K, N, _, L, M, C, F, U, E, z, H;
|
|
498
|
+
if (!t || typeof t != "object" || !t.type || !it.has(t.type) || s.has(t) || (s.add(t), u ? !((l = J[u]) != null && l.has(t.type)) : t.type !== "doc") || c && t.type === "businessToken" && ((d = t.attrs) == null ? void 0 : d.kind) === "attribute")
|
|
499
499
|
return i;
|
|
500
|
-
for (const
|
|
501
|
-
if (!["type", "attrs", "content", "marks", "text"].includes(
|
|
502
|
-
return `${i}.${
|
|
500
|
+
for (const p of Object.keys(t))
|
|
501
|
+
if (!["type", "attrs", "content", "marks", "text"].includes(p))
|
|
502
|
+
return `${i}.${p}`;
|
|
503
503
|
if (t.content !== void 0 && !Array.isArray(t.content))
|
|
504
504
|
return `${i}.content`;
|
|
505
505
|
if (["bulletList", "orderedList", "blockquote", "originalReply"].includes(
|
|
506
506
|
t.type
|
|
507
|
-
) && !((
|
|
507
|
+
) && !((f = t.content) != null && f.length))
|
|
508
508
|
return `${i}.content`;
|
|
509
|
-
if (t.type === "listItem" && ((
|
|
510
|
-
return (
|
|
509
|
+
if (t.type === "listItem" && ((m = (g = t.content) == null ? void 0 : g[0]) == null ? void 0 : m.type) !== "paragraph")
|
|
510
|
+
return (y = t.content) != null && y.length ? `${i}.content[0]` : `${i}.content`;
|
|
511
511
|
if (t.text !== void 0 && t.type !== "text") return `${i}.text`;
|
|
512
512
|
if (t.type === "text" && (typeof t.text != "string" || t.text.length === 0))
|
|
513
513
|
return `${i}.text`;
|
|
@@ -517,104 +517,104 @@ function G(n, r = "knowledge.doc") {
|
|
|
517
517
|
return `${i}.content`;
|
|
518
518
|
if (t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
|
|
519
519
|
return `${i}.attrs`;
|
|
520
|
-
const a =
|
|
521
|
-
for (const
|
|
522
|
-
if (!a.has(
|
|
523
|
-
if (t.type === "businessToken" && !
|
|
520
|
+
const a = vt[t.type] || /* @__PURE__ */ new Set();
|
|
521
|
+
for (const p of Object.keys(t.attrs || {}))
|
|
522
|
+
if (!a.has(p)) return `${i}.attrs.${p}`;
|
|
523
|
+
if (t.type === "businessToken" && !et((h = t.attrs) == null ? void 0 : h.kind))
|
|
524
524
|
return `${i}.attrs.kind`;
|
|
525
|
-
if (t.type === "businessToken" && (typeof ((
|
|
525
|
+
if (t.type === "businessToken" && (typeof ((T = t.attrs) == null ? void 0 : T.key) != "string" || !t.attrs.key))
|
|
526
526
|
return `${i}.attrs.key`;
|
|
527
|
-
if (t.type === "businessToken" && ((
|
|
527
|
+
if (t.type === "businessToken" && ((V = t.attrs) == null ? void 0 : V.label) !== void 0 && typeof t.attrs.label != "string")
|
|
528
528
|
return `${i}.attrs.label`;
|
|
529
|
-
if (t.type === "businessToken" && ((
|
|
529
|
+
if (t.type === "businessToken" && ((P = t.attrs) == null ? void 0 : P.token) !== void 0 && t.attrs.token !== null && typeof t.attrs.token != "string")
|
|
530
530
|
return `${i}.attrs.token`;
|
|
531
|
-
if (t.type === "businessToken" && ((
|
|
531
|
+
if (t.type === "businessToken" && ((q = t.attrs) == null ? void 0 : q.params) != null && (t.attrs.kind !== "tool" || typeof t.attrs.params != "object" || Array.isArray(t.attrs.params) || tt(t.attrs.params) !== null || JSON.stringify(t.attrs.params).length > 8192))
|
|
532
532
|
return `${i}.attrs.params`;
|
|
533
|
-
if (t.type === "mediaBlock" && !
|
|
533
|
+
if (t.type === "mediaBlock" && !rt((x = t.attrs) == null ? void 0 : x.kind))
|
|
534
534
|
return `${i}.attrs.kind`;
|
|
535
535
|
if (t.type === "mediaBlock") {
|
|
536
|
-
if (((
|
|
536
|
+
if (((O = t.attrs) == null ? void 0 : O.assetId) !== void 0 && t.attrs.assetId !== null && typeof t.attrs.assetId != "string")
|
|
537
537
|
return `${i}.attrs.assetId`;
|
|
538
|
-
if (((
|
|
538
|
+
if (((v = t.attrs) == null ? void 0 : v.name) !== void 0 && typeof t.attrs.name != "string")
|
|
539
539
|
return `${i}.attrs.name`;
|
|
540
|
-
if (((
|
|
540
|
+
if (((j = t.attrs) == null ? void 0 : j.error) !== void 0 && typeof t.attrs.error != "string")
|
|
541
541
|
return `${i}.attrs.error`;
|
|
542
542
|
if (((R = t.attrs) == null ? void 0 : R.status) !== void 0 && !["ready", "uploading", "error"].includes(String(t.attrs.status)))
|
|
543
543
|
return `${i}.attrs.status`;
|
|
544
|
-
const
|
|
545
|
-
if (!$((N = t.attrs) == null ? void 0 : N.src) && !
|
|
544
|
+
const p = (((D = t.attrs) == null ? void 0 : D.status) === "uploading" || ((B = t.attrs) == null ? void 0 : B.status) === "error") && typeof ((K = t.attrs) == null ? void 0 : K.src) == "string" && t.attrs.src.startsWith("blob:");
|
|
545
|
+
if (!$((N = t.attrs) == null ? void 0 : N.src) && !p)
|
|
546
546
|
return `${i}.attrs.src`;
|
|
547
|
-
if (((
|
|
547
|
+
if (((_ = t.attrs) == null ? void 0 : _.poster) !== void 0 && t.attrs.poster !== null && !$(t.attrs.poster))
|
|
548
548
|
return `${i}.attrs.poster`;
|
|
549
549
|
}
|
|
550
|
-
if (
|
|
551
|
-
const
|
|
552
|
-
if ((t.type === "mediaBlock" ||
|
|
550
|
+
if (I(t.type)) {
|
|
551
|
+
const p = (L = t.attrs) == null ? void 0 : L.id;
|
|
552
|
+
if ((t.type === "mediaBlock" || p !== void 0) && (typeof p != "string" || !p.trim() || e.has(p)))
|
|
553
553
|
return `${i}.attrs.id`;
|
|
554
|
-
if (typeof
|
|
554
|
+
if (typeof p == "string" && e.add(p), ((M = t.attrs) == null ? void 0 : M.nodeVersion) !== void 0 && (!Number.isSafeInteger(t.attrs.nodeVersion) || t.attrs.nodeVersion < 0))
|
|
555
555
|
return `${i}.attrs.nodeVersion`;
|
|
556
556
|
}
|
|
557
|
-
if (t.type === "orderedList" && ((
|
|
557
|
+
if (t.type === "orderedList" && ((C = t.attrs) == null ? void 0 : C.start) !== void 0 && (!Number.isSafeInteger(t.attrs.start) || t.attrs.start < 1))
|
|
558
558
|
return `${i}.attrs.start`;
|
|
559
|
-
if (t.type === "orderedList" && ((
|
|
559
|
+
if (t.type === "orderedList" && ((F = t.attrs) == null ? void 0 : F.type) !== void 0 && t.attrs.type !== null && !["1", "a", "A", "i", "I"].includes(t.attrs.type))
|
|
560
560
|
return `${i}.attrs.type`;
|
|
561
|
-
if (t.type === "codeBlock" && ((
|
|
561
|
+
if (t.type === "codeBlock" && ((U = t.attrs) == null ? void 0 : U.language) !== void 0 && t.attrs.language !== null && typeof t.attrs.language != "string")
|
|
562
562
|
return `${i}.attrs.language`;
|
|
563
563
|
if (t.marks !== void 0 && !Array.isArray(t.marks))
|
|
564
564
|
return `${i}.marks`;
|
|
565
|
-
if (u === "codeBlock" && ((
|
|
566
|
-
if ((z = t.marks) != null && z.some((
|
|
565
|
+
if (u === "codeBlock" && ((E = t.marks) != null && E.length)) return `${i}.marks`;
|
|
566
|
+
if ((z = t.marks) != null && z.some((p) => !jt(p)))
|
|
567
567
|
return `${i}.marks`;
|
|
568
568
|
if ((H = t.marks) != null && H.length) {
|
|
569
|
-
const
|
|
570
|
-
if (new Set(
|
|
569
|
+
const p = t.marks.map((S) => S.type);
|
|
570
|
+
if (new Set(p).size !== p.length || p.includes("code") && p.length > 1)
|
|
571
571
|
return `${i}.marks`;
|
|
572
572
|
}
|
|
573
|
-
for (const [
|
|
574
|
-
const
|
|
573
|
+
for (const [p, S] of (t.content || []).entries()) {
|
|
574
|
+
const W = o(
|
|
575
575
|
S,
|
|
576
|
-
`${i}.content[${
|
|
576
|
+
`${i}.content[${p}]`,
|
|
577
577
|
t.type,
|
|
578
|
-
|
|
578
|
+
c || t.type === "originalReply"
|
|
579
579
|
);
|
|
580
|
-
if (
|
|
580
|
+
if (W) return W;
|
|
581
581
|
}
|
|
582
582
|
return null;
|
|
583
583
|
}
|
|
584
|
-
return o(
|
|
584
|
+
return o(r, n);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
if (!
|
|
586
|
+
function G(r, n, e = "knowledge.doc") {
|
|
587
|
+
if (!r) return null;
|
|
588
588
|
const s = /* @__PURE__ */ new WeakSet(), o = (t, i) => {
|
|
589
|
-
var a,
|
|
589
|
+
var a, l;
|
|
590
590
|
if (s.has(t)) return i;
|
|
591
591
|
s.add(t);
|
|
592
|
-
const u = t.type === "businessToken" ? String((a = t.attrs) == null ? void 0 : a.kind) : t.type === "mediaBlock" ? String((
|
|
593
|
-
if (t.type === "messageSeparator" &&
|
|
594
|
-
(d) => d.id === u && d.slot ===
|
|
592
|
+
const u = t.type === "businessToken" ? String((a = t.attrs) == null ? void 0 : a.kind) : t.type === "mediaBlock" ? String((l = t.attrs) == null ? void 0 : l.kind) : t.type === "originalReply" ? "originalReply" : t.type === "messageSeparator" ? "separator" : null, c = t.type === "businessToken" ? "knowledgeInline" : u ? "knowledgeBlock" : null;
|
|
593
|
+
if (t.type === "messageSeparator" && n === "agent" || u && t.type !== "messageSeparator" && !Z.some(
|
|
594
|
+
(d) => d.id === u && d.slot === c && d.types.includes(n)
|
|
595
595
|
))
|
|
596
596
|
return i;
|
|
597
|
-
for (const [d,
|
|
598
|
-
const g = o(
|
|
597
|
+
for (const [d, f] of (t.content || []).entries()) {
|
|
598
|
+
const g = o(f, `${i}.content[${d}]`);
|
|
599
599
|
if (g) return g;
|
|
600
600
|
}
|
|
601
601
|
return null;
|
|
602
602
|
};
|
|
603
|
-
return o(
|
|
603
|
+
return o(r, e);
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
if (!
|
|
607
|
-
const
|
|
608
|
-
return ["normal", "reasoning", "agent"].includes(String(
|
|
605
|
+
function Et(r) {
|
|
606
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
607
|
+
const n = r, e = n.question, s = n.knowledge;
|
|
608
|
+
return ["normal", "reasoning", "agent"].includes(String(n.type)) && !!e && typeof e == "object" && !Array.isArray(e) && typeof e.text == "string" && !!s && typeof s == "object" && !Array.isArray(s) && Object.prototype.hasOwnProperty.call(s, "doc") && !!n.extensionState && typeof n.extensionState == "object" && !Array.isArray(n.extensionState);
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
if (!
|
|
610
|
+
function zt(r) {
|
|
611
|
+
if (!r || typeof r != "object" || Array.isArray(r))
|
|
612
612
|
return "modelValue";
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
const e =
|
|
613
|
+
const n = tt(r);
|
|
614
|
+
if (n !== null) return n || "modelValue";
|
|
615
|
+
const e = r;
|
|
616
616
|
if (e.schemaVersion !== 1) return "schemaVersion";
|
|
617
|
-
const s =
|
|
617
|
+
const s = k(e, [
|
|
618
618
|
"schemaVersion",
|
|
619
619
|
"id",
|
|
620
620
|
"type",
|
|
@@ -627,7 +627,7 @@ function Ft(n) {
|
|
|
627
627
|
if (!["normal", "reasoning", "agent"].includes(e.type)) return "type";
|
|
628
628
|
if (!e.question || typeof e.question != "object" || Array.isArray(e.question) || typeof e.question.text != "string")
|
|
629
629
|
return "question.text";
|
|
630
|
-
const o =
|
|
630
|
+
const o = k(
|
|
631
631
|
e.question,
|
|
632
632
|
["text"],
|
|
633
633
|
"question"
|
|
@@ -635,7 +635,7 @@ function Ft(n) {
|
|
|
635
635
|
if (o) return o;
|
|
636
636
|
if (!e.knowledge || typeof e.knowledge != "object" || Array.isArray(e.knowledge))
|
|
637
637
|
return "knowledge";
|
|
638
|
-
const t =
|
|
638
|
+
const t = k(
|
|
639
639
|
e.knowledge,
|
|
640
640
|
["doc", "retainedDoc", "agentRef"],
|
|
641
641
|
"knowledge"
|
|
@@ -652,27 +652,27 @@ function Ft(n) {
|
|
|
652
652
|
const { agentRef: a } = e.knowledge;
|
|
653
653
|
if (typeof a != "object" || Array.isArray(a) || typeof a.id != "string" || !a.id || typeof a.name != "string")
|
|
654
654
|
return "knowledge.agentRef";
|
|
655
|
-
const
|
|
655
|
+
const l = k(
|
|
656
656
|
a,
|
|
657
657
|
["id", "name"],
|
|
658
658
|
"knowledge.agentRef"
|
|
659
659
|
);
|
|
660
|
-
if (
|
|
660
|
+
if (l) return l;
|
|
661
661
|
}
|
|
662
|
-
const i =
|
|
662
|
+
const i = Y(e.knowledge.doc);
|
|
663
663
|
if (i) return i;
|
|
664
|
-
const u =
|
|
664
|
+
const u = G(
|
|
665
665
|
e.knowledge.doc,
|
|
666
666
|
e.type
|
|
667
667
|
);
|
|
668
668
|
if (u) return u;
|
|
669
|
-
const
|
|
669
|
+
const c = Y(
|
|
670
670
|
e.knowledge.retainedDoc ?? null,
|
|
671
671
|
"knowledge.retainedDoc"
|
|
672
672
|
);
|
|
673
|
-
if (
|
|
673
|
+
if (c) return c;
|
|
674
674
|
if (e.type === "agent") {
|
|
675
|
-
const a =
|
|
675
|
+
const a = G(
|
|
676
676
|
e.knowledge.retainedDoc ?? null,
|
|
677
677
|
"normal",
|
|
678
678
|
"knowledge.retainedDoc"
|
|
@@ -681,38 +681,38 @@ function Ft(n) {
|
|
|
681
681
|
}
|
|
682
682
|
if (!e.extensionState || typeof e.extensionState != "object" || Array.isArray(e.extensionState))
|
|
683
683
|
return "extensionState";
|
|
684
|
-
for (const [a,
|
|
685
|
-
const d =
|
|
684
|
+
for (const [a, l] of Object.entries(e.extensionState)) {
|
|
685
|
+
const d = Z.find(
|
|
686
686
|
(g) => g.id === a && g.types.includes(e.type) && g.implementation === "plugin"
|
|
687
687
|
);
|
|
688
688
|
if (!d) return `extensionState.${a}`;
|
|
689
|
-
if (!
|
|
689
|
+
if (!l || typeof l != "object" || l.version !== d.dataVersion)
|
|
690
690
|
return `extensionState.${a}.version`;
|
|
691
|
-
const
|
|
692
|
-
|
|
691
|
+
const f = k(
|
|
692
|
+
l,
|
|
693
693
|
["version", "data"],
|
|
694
694
|
`extensionState.${a}`
|
|
695
695
|
);
|
|
696
|
-
if (
|
|
697
|
-
if (!
|
|
696
|
+
if (f) return f;
|
|
697
|
+
if (!l.data || typeof l.data != "object" || Array.isArray(l.data))
|
|
698
698
|
return `extensionState.${a}.data`;
|
|
699
|
-
if (d.slot === "questionAction" && typeof
|
|
699
|
+
if (d.slot === "questionAction" && typeof l.data.enabled != "boolean")
|
|
700
700
|
return `extensionState.${a}.data.enabled`;
|
|
701
701
|
if (d.slot === "questionAction" && (a === "todo" || a === "tagged")) {
|
|
702
|
-
const g =
|
|
702
|
+
const g = l.data;
|
|
703
703
|
if (g.enabled === !0 && g.tag === void 0)
|
|
704
704
|
return `extensionState.${a}.data.tag`;
|
|
705
705
|
if (g.tag !== void 0) {
|
|
706
|
-
const { tag:
|
|
707
|
-
if (!
|
|
706
|
+
const { tag: m } = g;
|
|
707
|
+
if (!m || typeof m != "object" || Array.isArray(m))
|
|
708
708
|
return `extensionState.${a}.data.tag`;
|
|
709
|
-
const
|
|
710
|
-
if (typeof
|
|
709
|
+
const y = m;
|
|
710
|
+
if (typeof y.id != "string" || !y.id.trim())
|
|
711
711
|
return `extensionState.${a}.data.tag.id`;
|
|
712
|
-
if (typeof
|
|
712
|
+
if (typeof y.label != "string" || !y.label.trim() || nt(y.label))
|
|
713
713
|
return `extensionState.${a}.data.tag.label`;
|
|
714
|
-
const b =
|
|
715
|
-
|
|
714
|
+
const b = k(
|
|
715
|
+
y,
|
|
716
716
|
["id", "label"],
|
|
717
717
|
`extensionState.${a}.data.tag`
|
|
718
718
|
);
|
|
@@ -722,28 +722,90 @@ function Ft(n) {
|
|
|
722
722
|
}
|
|
723
723
|
return null;
|
|
724
724
|
}
|
|
725
|
+
const Rt = (r) => typeof r == "string" && /^(?:[1-9]|[1-9]\d)$/.test(r), Dt = {
|
|
726
|
+
none: "不标记",
|
|
727
|
+
red: "红色",
|
|
728
|
+
yellow: "黄色",
|
|
729
|
+
green: "绿色",
|
|
730
|
+
blue: "蓝色",
|
|
731
|
+
purple: "紫色"
|
|
732
|
+
}, Ht = {
|
|
733
|
+
none: "",
|
|
734
|
+
red: "#f53f3f",
|
|
735
|
+
yellow: "#ff7d00",
|
|
736
|
+
green: "#00b42a",
|
|
737
|
+
blue: "#165dff",
|
|
738
|
+
purple: "#722ed1"
|
|
739
|
+
};
|
|
740
|
+
function Bt(r) {
|
|
741
|
+
if (!r || typeof r != "object" || Array.isArray(r)) return !1;
|
|
742
|
+
const n = r;
|
|
743
|
+
return typeof n.id == "string" && /^rmk_[a-z0-9]{8}$/.test(n.id) && (n.contentMode === "fixed" || n.contentMode === "smart") && typeof n.content == "string" && !!n.content.trim() && [...n.content.trim()].length <= 500 && !/\^\^|\$\$|¥¥/.test(n.content) && !n.content.endsWith("^") && Object.hasOwn(Dt, String(n.flag)) && typeof n.preserveFlag == "boolean" && (n.position === "first" || n.position === "last");
|
|
744
|
+
}
|
|
745
|
+
function X() {
|
|
746
|
+
return `rmk_${crypto.randomUUID().replace(/-/g, "").slice(0, 8)}`;
|
|
747
|
+
}
|
|
748
|
+
function Wt(r, n, e, s, o) {
|
|
749
|
+
if (r !== "small_payment" && r !== "order_note")
|
|
750
|
+
return { ok: !0, params: n };
|
|
751
|
+
let t = 0;
|
|
752
|
+
const i = /* @__PURE__ */ new Set(), u = (l) => {
|
|
753
|
+
var d, f, g;
|
|
754
|
+
l.type === "businessToken" && ((d = l.attrs) == null ? void 0 : d.kind) === "tool" && (!o || l.attrs.id !== o) && (l.attrs.key === "small_payment" && t++, l.attrs.key === "order_note" && i.add(String(((f = l.attrs.params) == null ? void 0 : f.id) || ""))), (g = l.content) == null || g.forEach(u);
|
|
755
|
+
};
|
|
756
|
+
if (s && u(s), r === "small_payment")
|
|
757
|
+
return Rt(n.amount) ? t ? {
|
|
758
|
+
ok: !1,
|
|
759
|
+
code: "TOOL_LIMIT_REACHED",
|
|
760
|
+
message: "最多配置一个小额打款工具"
|
|
761
|
+
} : { ok: !0, params: n } : {
|
|
762
|
+
ok: !1,
|
|
763
|
+
code: "TOOL_PARAMS_INVALID",
|
|
764
|
+
message: "打款金额必须是1-99的整数元"
|
|
765
|
+
};
|
|
766
|
+
let c = typeof e.id == "string" && /^rmk_[a-z0-9]{8}$/.test(e.id) ? e.id : X();
|
|
767
|
+
if (!o)
|
|
768
|
+
for (; i.has(c); ) c = X();
|
|
769
|
+
if (i.has(c))
|
|
770
|
+
return {
|
|
771
|
+
ok: !1,
|
|
772
|
+
code: "TOOL_PARAMS_INVALID",
|
|
773
|
+
message: "订单备注编号重复"
|
|
774
|
+
};
|
|
775
|
+
const a = { ...n, id: c };
|
|
776
|
+
return Bt(a) ? { ok: !0, params: { ...a } } : {
|
|
777
|
+
ok: !1,
|
|
778
|
+
code: "TOOL_PARAMS_INVALID",
|
|
779
|
+
message: "订单备注内容或配置不合法"
|
|
780
|
+
};
|
|
781
|
+
}
|
|
725
782
|
export {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
783
|
+
wt as B,
|
|
784
|
+
St as C,
|
|
785
|
+
At as M,
|
|
786
|
+
xt as a,
|
|
787
|
+
zt as b,
|
|
788
|
+
Z as c,
|
|
789
|
+
Et as d,
|
|
790
|
+
I as e,
|
|
791
|
+
tt as f,
|
|
792
|
+
Y as g,
|
|
793
|
+
Pt as h,
|
|
794
|
+
Ut as i,
|
|
738
795
|
$ as j,
|
|
739
796
|
nt as k,
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
797
|
+
_t as l,
|
|
798
|
+
Vt as m,
|
|
799
|
+
qt as n,
|
|
800
|
+
Kt as o,
|
|
801
|
+
Wt as p,
|
|
745
802
|
Rt as q,
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
803
|
+
Bt as r,
|
|
804
|
+
Ft as s,
|
|
805
|
+
Dt as t,
|
|
806
|
+
Lt as u,
|
|
807
|
+
Ct as v,
|
|
808
|
+
Nt as w,
|
|
809
|
+
Mt as x,
|
|
810
|
+
Ht as y
|
|
749
811
|
};
|