@freecallai/pro 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -2
- package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js} +1811 -1781
- package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-ClZoLiaZ.js} +1 -1
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js +1830 -0
- package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-BK9epxdr.js} +1 -1
- package/dist/agent-prompt-editor/index.js +575 -549
- package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
- package/dist/{choice-BqjECVyx.js → choice-UgePgrSl.js} +1 -1
- package/dist/{guard-BmLOamCj.js → guard-DPwe4mCm.js} +200 -185
- package/dist/{index-gS1h8iW8.js → index-BIi3k45j.js} +1 -1
- package/dist/index-BMHUPL5x.js +5 -0
- package/dist/{index-B1rTu0jX.js → index-CaA13lC9.js} +1 -1
- package/dist/{index-6VSUucFX.js → index-ChuzFuNm.js} +1 -1
- package/dist/index-DJLfgC4v.js +5 -0
- package/dist/{index-0BXLYaKG.js → index-DfKH-RZq.js} +2 -2
- package/dist/{index-CN2knQcE.js → index-DiLMgNEe.js} +1 -1
- package/dist/{index-BDinNJn_.js → index-RHu4JIw7.js} +1 -1
- package/dist/{index-CCwmXuSJ.js → index-v1UD08i6.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CRGzAti7.js → inline-CVF1zEsG.js} +1 -1
- package/dist/{knowledge-DNDouB-s.js → knowledge-DWM6tWnP.js} +1 -1
- package/dist/media-extensions-YYbGuUQa.js +341 -0
- package/dist/{media-migration-D1KoHKoP.js → media-migration-BctCLEuT.js} +1 -1
- package/dist/media-policy-B1UuSN2e.js +215 -0
- package/dist/{media-upload-C5N6YWHu.js → media-upload-DtH-oCtw.js} +1 -1
- package/dist/{model-BVh9EZ9G.js → model-VLLhEQfn.js} +1 -1
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +357 -355
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/FkpAgentPromptEditor.vue.d.ts +37 -2
- package/dist/types/agent-prompt-editor/index.d.ts +1 -0
- package/dist/types/agent-prompt-editor/types.d.ts +4 -0
- package/dist/types/filters/FkpFilter.vue.d.ts +2 -2
- package/dist/types/filters/FkpFilterDateRange.vue.d.ts +2 -2
- package/dist/types/filters/FkpFilterPeriod.vue.d.ts +2 -2
- package/dist/types/filters/FkpSearchableMultiSelect.vue.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +20 -2
- package/dist/types/rich-text/index.d.ts +1 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/token.d.ts +1 -0
- package/dist/types/rich-text/plugins/tableKnowledge/token.d.ts +1 -0
- package/dist/types/rich-text/plugins/ticket/token.d.ts +2 -1
- package/dist/types/rich-text/plugins/token-catalog.d.ts +4 -1
- package/dist/types/rich-text/plugins/token-definition.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +7 -2
- package/dist/types/rich-text/runtime/document-adapter.d.ts +3 -0
- package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
- package/dist/types/rich-text/runtime/tag-validity.d.ts +46 -0
- package/dist/types/rich-text/ui/FkpKnowledgeTypePicker.vue.d.ts +2 -2
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +10 -0
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +23 -14
- package/dist/types/rich-text/ui/ToolForm.vue.d.ts +2 -2
- package/dist/types/switcher/FkpSwitcher.vue.d.ts +2 -2
- package/package.json +5 -4
- package/dist/KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js +0 -1659
- package/dist/index-CAczgwau.js +0 -5
- package/dist/index-faGbB8v6.js +0 -5
- package/dist/media-extensions-wlcCEdtg.js +0 -324
- package/dist/media-policy-D3-Qglzz.js +0 -158
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as L } from "../../media-id-b2dgniSy.js";
|
|
2
|
-
import { i as N, f as x } from "../../guard-
|
|
3
|
-
import { f as I, v as U } from "../../model-
|
|
4
|
-
const O = 1024 * 1024,
|
|
2
|
+
import { i as N, f as x } from "../../guard-DPwe4mCm.js";
|
|
3
|
+
import { f as I, v as U } from "../../model-VLLhEQfn.js";
|
|
4
|
+
const O = 1024 * 1024, V = 1e4, _ = /[\u200b-\u200d\ufeff]/gu, R = /#@|##|\$\$小额打款@|\{(?:待办|业务属性|属性|分隔符|原话复述|变量|自定义Agent|推理)|\[sep\]|<\s*(?:img|video)\b/iu, T = /* @__PURE__ */ new Set(["DIV", "P", "LI", "SECTION", "ARTICLE"]), M = /* @__PURE__ */ new Set([
|
|
5
5
|
"SPAN",
|
|
6
6
|
"B",
|
|
7
7
|
"STRONG",
|
|
@@ -20,20 +20,20 @@ function m(t, e, a) {
|
|
|
20
20
|
function g(t) {
|
|
21
21
|
return t.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function z(t) {
|
|
24
24
|
return t.replace(
|
|
25
25
|
/<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
|
|
26
26
|
"<video$1></video>"
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function S(t, e = []) {
|
|
30
30
|
return {
|
|
31
31
|
type: "text",
|
|
32
32
|
text: t,
|
|
33
33
|
...e != null && e.length ? { marks: e } : {}
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function A(t, e, a, n) {
|
|
37
37
|
return {
|
|
38
38
|
type: "businessToken",
|
|
39
39
|
attrs: { kind: t, key: e, label: a, ...n ? { token: n } : {} }
|
|
@@ -41,7 +41,7 @@ function T(t, e, a, n) {
|
|
|
41
41
|
}
|
|
42
42
|
function G(t, e) {
|
|
43
43
|
const a = t.getAttribute("data-attr-key") || e, n = t.getAttribute("data-attr-id");
|
|
44
|
-
return
|
|
44
|
+
return A(
|
|
45
45
|
"attribute",
|
|
46
46
|
a,
|
|
47
47
|
e,
|
|
@@ -49,12 +49,12 @@ function G(t, e) {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
function v(t) {
|
|
52
|
-
var u,
|
|
52
|
+
var u, c, i, s;
|
|
53
53
|
const e = t.getAttribute("data-tag-type") || (t.getAttribute("data-size") === "true" ? "size_chart" : "") || (t.getAttribute("data-tableknowledge") === "true" ? "table_knowledge" : "") || (t.getAttribute("data-variable") === "true" ? "variable" : "") || (t.getAttribute("data-divider") === "true" ? "separator" : "") || (t.getAttribute("data-tag") === "true" ? "biz_attribute" : "");
|
|
54
54
|
if (!e) return null;
|
|
55
|
-
const a = ((u = t.textContent) == null ? void 0 : u.replace(_, "").trim()) || "", n = (r,
|
|
55
|
+
const a = ((u = t.textContent) == null ? void 0 : u.replace(_, "").trim()) || "", n = (r, l) => {
|
|
56
56
|
var b, h;
|
|
57
|
-
return (r == null ? void 0 : r.trim()) || ((h = (b =
|
|
57
|
+
return (r == null ? void 0 : r.trim()) || ((h = (b = l.exec(a)) == null ? void 0 : b[1]) == null ? void 0 : h.trim()) || "";
|
|
58
58
|
};
|
|
59
59
|
switch (e) {
|
|
60
60
|
case "table_knowledge": {
|
|
@@ -62,7 +62,7 @@ function v(t) {
|
|
|
62
62
|
t.getAttribute("data-table-name"),
|
|
63
63
|
/^##([^#]+)##$/u
|
|
64
64
|
);
|
|
65
|
-
return r && a === `##${r}##` ?
|
|
65
|
+
return r && a === `##${r}##` ? A("tableKnowledge", r, r) : null;
|
|
66
66
|
}
|
|
67
67
|
case "size_chart": {
|
|
68
68
|
const r = n(
|
|
@@ -72,7 +72,7 @@ function v(t) {
|
|
|
72
72
|
return r && a === `#@${r}@#` ? { type: "agentSizeChart", attrs: { name: r } } : null;
|
|
73
73
|
}
|
|
74
74
|
case "biz_attribute": {
|
|
75
|
-
const r = ((
|
|
75
|
+
const r = ((c = t.getAttribute("data-attr-name")) == null ? void 0 : c.trim()) || ((s = (i = /^\{业务属性@([^}]+)\}$/u.exec(a)) == null ? void 0 : i[1]) == null ? void 0 : s.trim()) || a;
|
|
76
76
|
return r && (a === r || a === `{业务属性@${r}}`) ? G(t, r) : null;
|
|
77
77
|
}
|
|
78
78
|
case "variable": {
|
|
@@ -80,11 +80,11 @@ function v(t) {
|
|
|
80
80
|
t.getAttribute("data-variable-name"),
|
|
81
81
|
/^#([^#]+)#$/u
|
|
82
82
|
);
|
|
83
|
-
return r && a === `#${r}#` ?
|
|
83
|
+
return r && a === `#${r}#` ? A("variable", r, r, `#${r}#`) : null;
|
|
84
84
|
}
|
|
85
85
|
case "todo": {
|
|
86
86
|
const r = n(t.getAttribute("data-tag-name"), /^\{待办@([^}]+)\}$/u) || (a === "{待办}" ? "默认" : "");
|
|
87
|
-
return r && a === (r === "默认" ? "{待办}" : `{待办@${r}}`) ?
|
|
87
|
+
return r && a === (r === "默认" ? "{待办}" : `{待办@${r}}`) ? A(
|
|
88
88
|
"todo",
|
|
89
89
|
t.getAttribute("plan_id") || r,
|
|
90
90
|
r,
|
|
@@ -92,7 +92,7 @@ function v(t) {
|
|
|
92
92
|
) : null;
|
|
93
93
|
}
|
|
94
94
|
case "separator":
|
|
95
|
-
return a === "{分隔符}" || a === "[sep]" ?
|
|
95
|
+
return a === "{分隔符}" || a === "[sep]" ? A("separator", "separator", "分隔符", "{分隔符}") : null;
|
|
96
96
|
case "small_payment": {
|
|
97
97
|
const r = Number(t.getAttribute("data-max-amount-cent"));
|
|
98
98
|
return !Number.isInteger(r) || r < 100 || r > 9900 || r % 100 !== 0 || a !== `$$小额打款@${r}$$` ? null : {
|
|
@@ -121,6 +121,7 @@ function C(t) {
|
|
|
121
121
|
src: a,
|
|
122
122
|
name: t.getAttribute("data-media-name") || "",
|
|
123
123
|
assetId: t.getAttribute("data-asset-id"),
|
|
124
|
+
sourceType: t.getAttribute("data-source-type"),
|
|
124
125
|
poster: n || null,
|
|
125
126
|
status: "ready"
|
|
126
127
|
}
|
|
@@ -128,15 +129,15 @@ function C(t) {
|
|
|
128
129
|
}
|
|
129
130
|
function w(t) {
|
|
130
131
|
const e = (n, u) => {
|
|
131
|
-
const
|
|
132
|
+
const c = (i) => {
|
|
132
133
|
var s;
|
|
133
134
|
return ((s = new RegExp(`\\b${i}=["']([^"']*)["']`, "iu").exec(n)) == null ? void 0 : s[1]) || "";
|
|
134
135
|
};
|
|
135
136
|
return `${u}:${JSON.stringify([
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
c("src"),
|
|
138
|
+
c("data-asset-id"),
|
|
139
|
+
c("data-media-name"),
|
|
140
|
+
c("poster")
|
|
140
141
|
])}`;
|
|
141
142
|
};
|
|
142
143
|
return t.replace(/ | | /giu, " ").replace(/&/giu, "&").replace(/</giu, "<").replace(/>/giu, ">").replace(/"/giu, '"').replace(/'/giu, "'").replace(/<img\b[^>]*>/giu, (n) => e(n, "img")).replace(
|
|
@@ -154,11 +155,11 @@ function B(t) {
|
|
|
154
155
|
type: "paragraph",
|
|
155
156
|
...a.length ? { content: a } : {}
|
|
156
157
|
}), a = []);
|
|
157
|
-
},
|
|
158
|
+
}, c = (i, s = []) => {
|
|
158
159
|
if (n) return;
|
|
159
160
|
if (i.nodeType === Node.TEXT_NODE) {
|
|
160
161
|
(i.textContent || "").replace(_, "").split(/\r\n?|\n/u).forEach((b, h) => {
|
|
161
|
-
h && u(!0), b && a.push(
|
|
162
|
+
h && u(!0), b && a.push(S(b, s));
|
|
162
163
|
});
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
@@ -168,38 +169,38 @@ function B(t) {
|
|
|
168
169
|
return;
|
|
169
170
|
}
|
|
170
171
|
if (i.tagName === "IMG" || i.tagName === "VIDEO") {
|
|
171
|
-
const
|
|
172
|
-
|
|
172
|
+
const l = C(i);
|
|
173
|
+
l ? (u(), e.push(l)) : n = !0;
|
|
173
174
|
return;
|
|
174
175
|
}
|
|
175
176
|
if (i.hasAttribute("data-tag-type")) {
|
|
176
|
-
const
|
|
177
|
-
!
|
|
177
|
+
const l = v(i);
|
|
178
|
+
!l || l.type === "agentSizeChart" ? n = !0 : a.push(l);
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
180
|
-
if (!M.has(i.tagName) && !
|
|
181
|
+
if (!M.has(i.tagName) && !T.has(i.tagName)) {
|
|
181
182
|
n = !0;
|
|
182
183
|
return;
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
+
T.has(i.tagName) && u();
|
|
185
186
|
const r = [...s || []];
|
|
186
187
|
if ((i.tagName === "B" || i.tagName === "STRONG") && r.push({ type: "bold" }), (i.tagName === "I" || i.tagName === "EM") && r.push({ type: "italic" }), i.tagName === "U" && r.push({ type: "underline" }), (i.tagName === "S" || i.tagName === "STRIKE") && r.push({ type: "strike" }), i.tagName === "CODE" && r.push({ type: "code" }), i.tagName === "A") {
|
|
187
|
-
const
|
|
188
|
-
if (!N(
|
|
188
|
+
const l = i.getAttribute("href");
|
|
189
|
+
if (!N(l)) {
|
|
189
190
|
n = !0;
|
|
190
191
|
return;
|
|
191
192
|
}
|
|
192
|
-
r.push({ type: "link", attrs: { href:
|
|
193
|
+
r.push({ type: "link", attrs: { href: l, target: "_self" } });
|
|
193
194
|
}
|
|
194
|
-
i.childNodes.forEach((
|
|
195
|
+
i.childNodes.forEach((l) => c(l, r)), T.has(i.tagName) && u();
|
|
195
196
|
};
|
|
196
|
-
return t.childNodes.forEach((i) =>
|
|
197
|
+
return t.childNodes.forEach((i) => c(i)), u(), n ? null : e.length ? e : [{ type: "paragraph" }];
|
|
197
198
|
}
|
|
198
199
|
function Y(t) {
|
|
199
|
-
const e = { clues: t.clues || "", webClues: t.webClues || "" }, a = (
|
|
200
|
+
const e = { clues: t.clues || "", webClues: t.webClues || "" }, a = (o, f, $) => ({
|
|
200
201
|
ok: !1,
|
|
201
202
|
raw: e,
|
|
202
|
-
issues: [m(
|
|
203
|
+
issues: [m(o, f, $)]
|
|
203
204
|
});
|
|
204
205
|
if (typeof t.clues != "string" || typeof t.webClues != "string")
|
|
205
206
|
return a("PROMPT_FIELDS_INVALID", "提示词字段必须为字符串", "clues");
|
|
@@ -220,19 +221,19 @@ function Y(t) {
|
|
|
220
221
|
type: "doc",
|
|
221
222
|
content: e.clues.split(/\r\n?|\n/u).map((f) => ({
|
|
222
223
|
type: "paragraph",
|
|
223
|
-
...f ? { content: [
|
|
224
|
+
...f ? { content: [S(f)] } : {}
|
|
224
225
|
}))
|
|
225
226
|
}
|
|
226
227
|
},
|
|
227
228
|
warnings: []
|
|
228
229
|
};
|
|
229
230
|
const n = new DOMParser().parseFromString(
|
|
230
|
-
|
|
231
|
+
z(e.webClues),
|
|
231
232
|
"text/html"
|
|
232
233
|
), u = [];
|
|
233
|
-
let
|
|
234
|
-
const s = [], r = (
|
|
235
|
-
if (R.test(
|
|
234
|
+
let c = [], i = 0;
|
|
235
|
+
const s = [], r = (o, f, $) => {
|
|
236
|
+
if (R.test(o)) {
|
|
236
237
|
s.push(
|
|
237
238
|
m(
|
|
238
239
|
"PROMPT_UNTAGGED_MARKER",
|
|
@@ -242,25 +243,25 @@ function Y(t) {
|
|
|
242
243
|
);
|
|
243
244
|
return;
|
|
244
245
|
}
|
|
245
|
-
for (const [p, y] of
|
|
246
|
-
p &&
|
|
247
|
-
},
|
|
248
|
-
(
|
|
246
|
+
for (const [p, y] of o.replace(_, "").split(/\r\n?|\n/u).entries())
|
|
247
|
+
p && l(!0), y && c.push(S(y, f));
|
|
248
|
+
}, l = (o = !1) => {
|
|
249
|
+
(c.length || o) && (u.push({
|
|
249
250
|
type: "paragraph",
|
|
250
|
-
...
|
|
251
|
-
}),
|
|
252
|
-
}, b = (
|
|
253
|
-
if (++i >
|
|
251
|
+
...c.length ? { content: c } : {}
|
|
252
|
+
}), c = []);
|
|
253
|
+
}, b = (o, f, $ = []) => {
|
|
254
|
+
if (++i > V) {
|
|
254
255
|
s.push(m("PROMPT_TOO_LARGE", "历史提示词节点过多", f));
|
|
255
256
|
return;
|
|
256
257
|
}
|
|
257
|
-
if (
|
|
258
|
-
r(
|
|
258
|
+
if (o.nodeType === Node.TEXT_NODE) {
|
|
259
|
+
r(o.textContent || "", $, f);
|
|
259
260
|
return;
|
|
260
261
|
}
|
|
261
|
-
if (!(
|
|
262
|
-
const p =
|
|
263
|
-
if (
|
|
262
|
+
if (!(o instanceof Element)) return;
|
|
263
|
+
const p = o.tagName;
|
|
264
|
+
if (o.getAttribute("data-tag-icon") === "true") return;
|
|
264
265
|
if (["SCRIPT", "STYLE", "IFRAME", "OBJECT", "SVG", "TEMPLATE"].includes(p)) {
|
|
265
266
|
s.push(
|
|
266
267
|
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含无法编辑的 HTML", f)
|
|
@@ -268,16 +269,16 @@ function Y(t) {
|
|
|
268
269
|
return;
|
|
269
270
|
}
|
|
270
271
|
if (p === "BR") {
|
|
271
|
-
|
|
272
|
+
l(!0);
|
|
272
273
|
return;
|
|
273
274
|
}
|
|
274
275
|
if (p === "IMG" || p === "VIDEO") {
|
|
275
|
-
const d = C(
|
|
276
|
-
d ? (
|
|
276
|
+
const d = C(o);
|
|
277
|
+
d ? (l(), u.push(d)) : s.push(m("PROMPT_MEDIA_INVALID", "媒体地址或类型无效", f));
|
|
277
278
|
return;
|
|
278
279
|
}
|
|
279
|
-
if (
|
|
280
|
-
const d =
|
|
280
|
+
if (o.hasAttribute("data-original-repeat-template") || o.getAttribute("data-tag-type") === "original_repeat") {
|
|
281
|
+
const d = o.querySelector(
|
|
281
282
|
"[data-original-repeat-input], .original-repeat-input"
|
|
282
283
|
), E = d && B(d);
|
|
283
284
|
if (!E) {
|
|
@@ -286,52 +287,52 @@ function Y(t) {
|
|
|
286
287
|
);
|
|
287
288
|
return;
|
|
288
289
|
}
|
|
289
|
-
|
|
290
|
+
l(), u.push({
|
|
290
291
|
type: "originalReply",
|
|
291
292
|
content: E
|
|
292
293
|
});
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
295
|
-
if (
|
|
296
|
-
const d = v(
|
|
297
|
-
d ?
|
|
296
|
+
if (o.hasAttribute("data-tag-type") || o.hasAttribute("data-size") || o.hasAttribute("data-tableknowledge") || o.hasAttribute("data-variable") || o.hasAttribute("data-divider") || o.getAttribute("data-tag") === "true") {
|
|
297
|
+
const d = v(o);
|
|
298
|
+
d ? c.push(d) : s.push(
|
|
298
299
|
m("PROMPT_TAG_UNSUPPORTED", "业务标签无法无损恢复", f)
|
|
299
300
|
);
|
|
300
301
|
return;
|
|
301
302
|
}
|
|
302
|
-
if (!M.has(p) && !
|
|
303
|
+
if (!M.has(p) && !T.has(p)) {
|
|
303
304
|
s.push(
|
|
304
305
|
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含不支持的排版节点", f)
|
|
305
306
|
);
|
|
306
307
|
return;
|
|
307
308
|
}
|
|
308
|
-
|
|
309
|
+
T.has(p) && l();
|
|
309
310
|
const y = [...$ || []];
|
|
310
311
|
if ((p === "B" || p === "STRONG") && y.push({ type: "bold" }), (p === "I" || p === "EM") && y.push({ type: "italic" }), p === "U" && y.push({ type: "underline" }), (p === "S" || p === "STRIKE") && y.push({ type: "strike" }), p === "CODE" && y.push({ type: "code" }), p === "A") {
|
|
311
|
-
const d =
|
|
312
|
+
const d = o.getAttribute("href");
|
|
312
313
|
if (!N(d)) {
|
|
313
314
|
s.push(m("PROMPT_LINK_INVALID", "链接地址无效", f));
|
|
314
315
|
return;
|
|
315
316
|
}
|
|
316
317
|
y.push({ type: "link", attrs: { href: d, target: "_self" } });
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
+
o.childNodes.forEach(
|
|
319
320
|
(d, E) => b(d, `${f}.childNodes[${E}]`, y)
|
|
320
|
-
),
|
|
321
|
+
), T.has(p) && l();
|
|
321
322
|
};
|
|
322
323
|
if (n.body.childNodes.forEach(
|
|
323
|
-
(
|
|
324
|
-
),
|
|
324
|
+
(o, f) => b(o, `webClues.childNodes[${f}]`)
|
|
325
|
+
), l(), s.length) return { ok: !1, raw: e, issues: s };
|
|
325
326
|
const h = {
|
|
326
327
|
schemaVersion: 1,
|
|
327
328
|
doc: {
|
|
328
329
|
type: "doc",
|
|
329
330
|
content: u.length ? u : [{ type: "paragraph" }]
|
|
330
331
|
}
|
|
331
|
-
},
|
|
332
|
-
if (
|
|
333
|
-
return a("PROMPT_DOCUMENT_INVALID", "历史提示词结构无效",
|
|
334
|
-
const P =
|
|
332
|
+
}, k = I(h);
|
|
333
|
+
if (k)
|
|
334
|
+
return a("PROMPT_DOCUMENT_INVALID", "历史提示词结构无效", k);
|
|
335
|
+
const P = X(h);
|
|
335
336
|
return P.ok ? w(P.clues) !== w(e.clues) ? a(
|
|
336
337
|
"PROMPT_FIELDS_MISMATCH",
|
|
337
338
|
"展示内容与算法提示词不一致",
|
|
@@ -347,8 +348,8 @@ function K(t) {
|
|
|
347
348
|
)}">${e}</a>`);
|
|
348
349
|
return e;
|
|
349
350
|
}
|
|
350
|
-
function
|
|
351
|
-
const { kind: e, key: a, label: n, token: u, params:
|
|
351
|
+
function q(t) {
|
|
352
|
+
const { kind: e, key: a, label: n, token: u, params: c } = t.attrs || {}, i = String(n || "");
|
|
352
353
|
if (e === "tableKnowledge") {
|
|
353
354
|
const s = `##${i}##`;
|
|
354
355
|
return {
|
|
@@ -391,7 +392,7 @@ function F(t) {
|
|
|
391
392
|
if (e === "tool" && a === "small_payment") {
|
|
392
393
|
const s = x(t);
|
|
393
394
|
if (!s) return null;
|
|
394
|
-
const r = Number(
|
|
395
|
+
const r = Number(c == null ? void 0 : c.amount) * 100;
|
|
395
396
|
return {
|
|
396
397
|
clues: s,
|
|
397
398
|
web: `<span contenteditable="false" data-tag="true" data-tag-type="small_payment" data-max-amount-cent="${r}">${s}</span>`
|
|
@@ -399,14 +400,17 @@ function F(t) {
|
|
|
399
400
|
}
|
|
400
401
|
return null;
|
|
401
402
|
}
|
|
402
|
-
function
|
|
403
|
-
const { kind: e, src: a, assetId: n, name: u, poster:
|
|
403
|
+
function F(t) {
|
|
404
|
+
const { kind: e, src: a, assetId: n, name: u, poster: c, status: i, sourceType: s } = t.attrs || {};
|
|
404
405
|
if (i !== "ready" || e !== "image" && e !== "video" || !N(a))
|
|
405
406
|
return null;
|
|
406
|
-
const
|
|
407
|
-
return {
|
|
407
|
+
const r = `src="${g(a)}"${n ? ` data-asset-id="${g(String(n))}"` : ""}${s === "qianniuVideo" ? ' data-source-type="qianniuVideo"' : ""}${u ? ` data-media-name="${g(String(u))}"` : ""}${c ? ` poster="${g(String(c))}"` : ""}`, l = e === "image" ? `<img ${r} width="120"/>` : `<video ${r} width="240" controls/>`;
|
|
408
|
+
return {
|
|
409
|
+
clues: s === "qianniuVideo" ? String(a) : l,
|
|
410
|
+
web: l
|
|
411
|
+
};
|
|
408
412
|
}
|
|
409
|
-
function
|
|
413
|
+
function H(t) {
|
|
410
414
|
var e;
|
|
411
415
|
if (t.type === "text")
|
|
412
416
|
return { clues: t.text || "", web: K(t) };
|
|
@@ -421,18 +425,18 @@ function X(t) {
|
|
|
421
425
|
)}">${g(n)}</span>`
|
|
422
426
|
};
|
|
423
427
|
}
|
|
424
|
-
return t.type === "businessToken" ?
|
|
428
|
+
return t.type === "businessToken" ? q(t) : null;
|
|
425
429
|
}
|
|
426
430
|
function D(t) {
|
|
427
|
-
if (t.type === "mediaBlock") return
|
|
431
|
+
if (t.type === "mediaBlock") return F(t);
|
|
428
432
|
if (t.type === "originalReply") {
|
|
429
433
|
const a = (t.content || []).map(D);
|
|
430
434
|
if (a.some((i) => !i)) return null;
|
|
431
|
-
let n = "", u = "",
|
|
435
|
+
let n = "", u = "", c = !1;
|
|
432
436
|
return (t.content || []).forEach((i, s) => {
|
|
433
437
|
const r = a[s];
|
|
434
|
-
|
|
435
|
-
`, u += "<br>"), n += r.clues, u += i.type === "paragraph" ? r.web.replace(/^<div>/u, "").replace(/<\/div>$/u, "") : r.web,
|
|
438
|
+
c && i.type === "paragraph" && (n += `
|
|
439
|
+
`, u += "<br>"), n += r.clues, u += i.type === "paragraph" ? r.web.replace(/^<div>/u, "").replace(/<\/div>$/u, "") : r.web, c = i.type === "paragraph";
|
|
436
440
|
}), {
|
|
437
441
|
clues: `<{原话复述}${n}>`,
|
|
438
442
|
web: `<span data-original-repeat-template="true" data-tag-type="original_repeat"><span data-original-repeat-input="true">${u}</span></span>`
|
|
@@ -444,13 +448,13 @@ function D(t) {
|
|
|
444
448
|
web: '<span data-divider="true" data-tag-type="separator">{分隔符}</span>'
|
|
445
449
|
};
|
|
446
450
|
if (t.type !== "paragraph") return null;
|
|
447
|
-
const e = (t.content || []).map(
|
|
451
|
+
const e = (t.content || []).map(H);
|
|
448
452
|
return e.some((a) => !a) ? null : {
|
|
449
453
|
clues: e.map((a) => a.clues).join(""),
|
|
450
454
|
web: `<div>${e.map((a) => a.web).join("") || "<br>"}</div>`
|
|
451
455
|
};
|
|
452
456
|
}
|
|
453
|
-
function
|
|
457
|
+
function X(t, e = 1e4) {
|
|
454
458
|
const a = I(t);
|
|
455
459
|
if (a)
|
|
456
460
|
return {
|
|
@@ -461,22 +465,22 @@ function q(t, e = 1e4) {
|
|
|
461
465
|
};
|
|
462
466
|
const n = U(t, e);
|
|
463
467
|
if (n.length) return { ok: !1, issues: n };
|
|
464
|
-
const u = (t.doc.content || []).map(D),
|
|
465
|
-
if (
|
|
468
|
+
const u = (t.doc.content || []).map(D), c = u.findIndex((s) => !s);
|
|
469
|
+
if (c >= 0)
|
|
466
470
|
return {
|
|
467
471
|
ok: !1,
|
|
468
472
|
issues: [
|
|
469
473
|
m(
|
|
470
474
|
"PROMPT_NODE_UNSUPPORTED",
|
|
471
475
|
"提示词包含旧接口不能保存的内容",
|
|
472
|
-
`doc.content[${
|
|
476
|
+
`doc.content[${c}]`
|
|
473
477
|
)
|
|
474
478
|
]
|
|
475
479
|
};
|
|
476
480
|
let i = "";
|
|
477
481
|
return (t.doc.content || []).forEach((s, r) => {
|
|
478
|
-
var
|
|
479
|
-
r > 0 && s.type !== "originalReply" && ((b = (
|
|
482
|
+
var l, b;
|
|
483
|
+
r > 0 && s.type !== "originalReply" && ((b = (l = t.doc.content) == null ? void 0 : l[r - 1]) == null ? void 0 : b.type) !== "originalReply" && (i += `
|
|
480
484
|
`), i += u[r].clues;
|
|
481
485
|
}), {
|
|
482
486
|
ok: !0,
|
|
@@ -485,6 +489,6 @@ function q(t, e = 1e4) {
|
|
|
485
489
|
};
|
|
486
490
|
}
|
|
487
491
|
export {
|
|
488
|
-
|
|
492
|
+
X as exportLegacyAgentPrompt,
|
|
489
493
|
Y as importLegacyAgentPrompt
|
|
490
494
|
};
|