@freecallai/pro 0.0.13 → 0.0.15
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 +1 -1
- package/dist/{FkpRichText.vue_vue_type_script_setup_true_lang-D-SOdFra.js → FkpRichText.vue_vue_type_script_setup_true_lang-DaSKjAe7.js} +246 -244
- package/dist/{KnowledgeArea-ClZoLiaZ.js → KnowledgeArea-BV2T5ecq.js} +1 -1
- package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-CoFF-WCe.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-QJZNyAnH.js} +221 -223
- package/dist/{ToolForm-BK9epxdr.js → ToolForm-CJRw9QhZ.js} +1 -1
- package/dist/agent-prompt-editor/index.js +198 -179
- package/dist/agent-prompt-editor/legacy-converter/index.js +188 -162
- package/dist/{choice-UgePgrSl.js → choice-BZa68Gpl.js} +1 -1
- package/dist/{guard-DPwe4mCm.js → guard-CZOoBb3d.js} +271 -213
- package/dist/index-9-vUHS0W.js +15 -0
- package/dist/index-B4oT1Q9u.js +5 -0
- package/dist/index-BHgHsPrz.js +5 -0
- package/dist/index-Bd2S6qOP.js +19 -0
- package/dist/{index-CaA13lC9.js → index-BdSClCaD.js} +1 -1
- package/dist/{index-BIi3k45j.js → index-BwkcWrL6.js} +1 -1
- package/dist/{index-ChuzFuNm.js → index-Cn_sllKh.js} +1 -1
- package/dist/{index-DiLMgNEe.js → index-DvDbrMvv.js} +1 -1
- package/dist/{index-DfKH-RZq.js → index-OMoExOaa.js} +2 -2
- package/dist/{index-RHu4JIw7.js → index-WExTogRL.js} +1 -1
- package/dist/{index-v1UD08i6.js → index-w2M63UAJ.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CVF1zEsG.js → inline-BJJy0svW.js} +1 -1
- package/dist/{knowledge-DWM6tWnP.js → knowledge-B3aTxExW.js} +1 -1
- package/dist/media-extensions-CpwsEWCD.js +338 -0
- package/dist/{media-migration-BctCLEuT.js → media-migration-3-xnOp0T.js} +1 -1
- package/dist/{media-policy-B1UuSN2e.js → media-policy-BqquGDH1.js} +36 -36
- package/dist/{media-upload-DtH-oCtw.js → media-upload-AunEWyNv.js} +1 -1
- package/dist/{model-VLLhEQfn.js → model-aED-32GY.js} +10 -6
- package/dist/rich-text/index.js +6 -6
- package/dist/rich-text/legacy-converter/index.js +905 -842
- package/dist/style.css +1 -1
- package/dist/types/agent-prompt-editor/model.d.ts +1 -1
- package/dist/types/rich-text/config/descriptor.d.ts +2 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +1 -0
- package/dist/types/rich-text/plugins/noFollow/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/noFollow/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/noFollow/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningMarker/token.d.ts +2 -0
- package/dist/types/rich-text/plugins/token-catalog.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +1 -1
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +6 -6
- package/package.json +3 -3
- package/dist/index-BMHUPL5x.js +0 -5
- package/dist/index-DJLfgC4v.js +0 -5
- package/dist/media-extensions-YYbGuUQa.js +0 -341
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { i as
|
|
3
|
-
import { f as
|
|
4
|
-
const O = 1024 * 1024,
|
|
1
|
+
import { c as x } from "../../media-id-b2dgniSy.js";
|
|
2
|
+
import { i as T, f as U } from "../../guard-CZOoBb3d.js";
|
|
3
|
+
import { f as R, v as V } from "../../model-aED-32GY.js";
|
|
4
|
+
const O = 1024 * 1024, z = 1e4, P = /[\u200b-\u200d\ufeff]/gu, M = /<不发送跟单>|#@|##|\$\$小额打款@|\{(?:待办|业务属性|属性|分隔符|原话复述|变量|自定义Agent|推理)|\[sep\]|<\s*(?:img|video)\b/iu, $ = /* @__PURE__ */ new Set(["DIV", "P", "LI", "SECTION", "ARTICLE"]), I = /* @__PURE__ */ new Set([
|
|
5
5
|
"SPAN",
|
|
6
6
|
"B",
|
|
7
7
|
"STRONG",
|
|
@@ -20,13 +20,13 @@ 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 G(t) {
|
|
24
24
|
return t.replace(
|
|
25
25
|
/<video\b((?:[^"'<>]|"[^"]*"|'[^']*')*)\/>/giu,
|
|
26
26
|
"<video$1></video>"
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function k(t, e = []) {
|
|
30
30
|
return {
|
|
31
31
|
type: "text",
|
|
32
32
|
text: t,
|
|
@@ -39,7 +39,7 @@ function A(t, e, a, n) {
|
|
|
39
39
|
attrs: { kind: t, key: e, label: a, ...n ? { token: n } : {} }
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function B(t, e) {
|
|
43
43
|
const a = t.getAttribute("data-attr-key") || e, n = t.getAttribute("data-attr-id");
|
|
44
44
|
return A(
|
|
45
45
|
"attribute",
|
|
@@ -49,59 +49,68 @@ function G(t, e) {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
function v(t) {
|
|
52
|
-
var u,
|
|
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" : "");
|
|
52
|
+
var u, l, r, s;
|
|
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") === "no_send_follow_order" ? "no_send_follow_order" : "") || (t.getAttribute("data-reasoning") === "true" ? "reasoning" : "") || (t.getAttribute("data-tag") === "true" ? "biz_attribute" : "");
|
|
54
54
|
if (!e) return null;
|
|
55
|
-
const a = ((u = t.textContent) == null ? void 0 : u.replace(
|
|
55
|
+
const a = ((u = t.textContent) == null ? void 0 : u.replace(P, "").trim()) || "", n = (i, c) => {
|
|
56
56
|
var b, h;
|
|
57
|
-
return (
|
|
57
|
+
return (i == null ? void 0 : i.trim()) || ((h = (b = c.exec(a)) == null ? void 0 : b[1]) == null ? void 0 : h.trim()) || "";
|
|
58
58
|
};
|
|
59
59
|
switch (e) {
|
|
60
60
|
case "table_knowledge": {
|
|
61
|
-
const
|
|
61
|
+
const i = n(
|
|
62
62
|
t.getAttribute("data-table-name"),
|
|
63
63
|
/^##([^#]+)##$/u
|
|
64
64
|
);
|
|
65
|
-
return
|
|
65
|
+
return i && a === `##${i}##` ? A("tableKnowledge", i, i) : null;
|
|
66
66
|
}
|
|
67
67
|
case "size_chart": {
|
|
68
|
-
const
|
|
68
|
+
const i = n(
|
|
69
69
|
t.getAttribute("data-size-name"),
|
|
70
70
|
/^#@([^@#]+)@#$/u
|
|
71
71
|
);
|
|
72
|
-
return
|
|
72
|
+
return i && a === `#@${i}@#` ? { type: "agentSizeChart", attrs: { name: i } } : null;
|
|
73
73
|
}
|
|
74
74
|
case "biz_attribute": {
|
|
75
|
-
const
|
|
76
|
-
return
|
|
75
|
+
const i = ((l = t.getAttribute("data-attr-name")) == null ? void 0 : l.trim()) || ((s = (r = /^\{业务属性@([^}]+)\}$/u.exec(a)) == null ? void 0 : r[1]) == null ? void 0 : s.trim()) || a;
|
|
76
|
+
return i && (a === i || a === `{业务属性@${i}}`) ? B(t, i) : null;
|
|
77
77
|
}
|
|
78
78
|
case "variable": {
|
|
79
|
-
const
|
|
79
|
+
const i = n(
|
|
80
80
|
t.getAttribute("data-variable-name"),
|
|
81
81
|
/^#([^#]+)#$/u
|
|
82
82
|
);
|
|
83
|
-
return
|
|
83
|
+
return i && a === `#${i}#` ? A(
|
|
84
|
+
"variable",
|
|
85
|
+
i,
|
|
86
|
+
i,
|
|
87
|
+
i === "订单链接" ? "{订单链接}" : `#${i}#`
|
|
88
|
+
) : null;
|
|
84
89
|
}
|
|
90
|
+
case "no_send_follow_order":
|
|
91
|
+
return a === "不跟单" || a === "不发送跟单" ? A("noFollow", "noFollow", "不跟单", "<不发送跟单>") : null;
|
|
92
|
+
case "reasoning":
|
|
93
|
+
return a === "推理" || a === "{推理}" ? A("reasoningMarker", "reasoningMarker", "推理", "{推理}") : null;
|
|
85
94
|
case "todo": {
|
|
86
|
-
const
|
|
87
|
-
return
|
|
95
|
+
const i = n(t.getAttribute("data-tag-name"), /^\{待办@([^}]+)\}$/u) || (a === "{待办}" ? "默认" : "");
|
|
96
|
+
return i && a === (i === "默认" ? "{待办}" : `{待办@${i}}`) ? A(
|
|
88
97
|
"todo",
|
|
89
|
-
t.getAttribute("plan_id") ||
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
t.getAttribute("plan_id") || i,
|
|
99
|
+
i,
|
|
100
|
+
i === "默认" ? "{待办}" : void 0
|
|
92
101
|
) : null;
|
|
93
102
|
}
|
|
94
103
|
case "separator":
|
|
95
104
|
return a === "{分隔符}" || a === "[sep]" ? A("separator", "separator", "分隔符", "{分隔符}") : null;
|
|
96
105
|
case "small_payment": {
|
|
97
|
-
const
|
|
98
|
-
return !Number.isInteger(
|
|
106
|
+
const i = Number(t.getAttribute("data-max-amount-cent"));
|
|
107
|
+
return !Number.isInteger(i) || i < 100 || i > 9900 || i % 100 !== 0 || a !== `$$小额打款@${i}$$` ? null : {
|
|
99
108
|
type: "businessToken",
|
|
100
109
|
attrs: {
|
|
101
110
|
kind: "tool",
|
|
102
111
|
key: "small_payment",
|
|
103
112
|
label: "小额打款",
|
|
104
|
-
params: { amount: String(
|
|
113
|
+
params: { amount: String(i / 100) }
|
|
105
114
|
}
|
|
106
115
|
};
|
|
107
116
|
}
|
|
@@ -112,15 +121,15 @@ function v(t) {
|
|
|
112
121
|
function C(t) {
|
|
113
122
|
var u;
|
|
114
123
|
const e = t.tagName === "VIDEO" ? "video" : "image", a = t.getAttribute("src") || ((u = t.querySelector("source[src]")) == null ? void 0 : u.getAttribute("src")), n = t.getAttribute("poster");
|
|
115
|
-
return !
|
|
124
|
+
return !T(a) || n && !T(n) ? null : {
|
|
116
125
|
type: "mediaBlock",
|
|
117
126
|
attrs: {
|
|
118
|
-
id:
|
|
127
|
+
id: x(),
|
|
119
128
|
nodeVersion: 0,
|
|
120
129
|
kind: e,
|
|
121
130
|
src: a,
|
|
122
131
|
name: t.getAttribute("data-media-name") || "",
|
|
123
|
-
assetId: t.getAttribute("data-asset-id"),
|
|
132
|
+
assetId: t.getAttribute("data-asset-id") || t.getAttribute("data-video-id") || (t.getAttribute("data-source-type") === "qianniuVideo" ? t.getAttribute("id") : null),
|
|
124
133
|
sourceType: t.getAttribute("data-source-type"),
|
|
125
134
|
poster: n || null,
|
|
126
135
|
status: "ready"
|
|
@@ -129,78 +138,78 @@ function C(t) {
|
|
|
129
138
|
}
|
|
130
139
|
function w(t) {
|
|
131
140
|
const e = (n, u) => {
|
|
132
|
-
const
|
|
141
|
+
const l = (r) => {
|
|
133
142
|
var s;
|
|
134
|
-
return ((s = new RegExp(`\\b${
|
|
143
|
+
return ((s = new RegExp(`\\b${r}=["']([^"']*)["']`, "iu").exec(n)) == null ? void 0 : s[1]) || "";
|
|
135
144
|
};
|
|
136
145
|
return `${u}:${JSON.stringify([
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
146
|
+
l("src"),
|
|
147
|
+
l("data-asset-id"),
|
|
148
|
+
l("data-media-name"),
|
|
149
|
+
l("poster")
|
|
141
150
|
])}`;
|
|
142
151
|
};
|
|
143
152
|
return t.replace(/ | | /giu, " ").replace(/&/giu, "&").replace(/</giu, "<").replace(/>/giu, ">").replace(/"/giu, '"').replace(/'/giu, "'").replace(/<img\b[^>]*>/giu, (n) => e(n, "img")).replace(
|
|
144
153
|
/<video\b[^>]*\/?>(?:<\/video>)?/giu,
|
|
145
154
|
(n) => e(n, "video")
|
|
146
|
-
).replace(/\[sep\]|\{分隔符\}/gu, "sep").replace(
|
|
155
|
+
).replace(/\[sep\]|\{分隔符\}/gu, "sep").replace(P, "").replace(/\r\n?/gu, `
|
|
147
156
|
`).replace(/[\t\u00a0 ]+/gu, " ").replace(/ *\n */gu, `
|
|
148
157
|
`).trim();
|
|
149
158
|
}
|
|
150
|
-
function
|
|
159
|
+
function F(t) {
|
|
151
160
|
const e = [];
|
|
152
161
|
let a = [], n = !1;
|
|
153
|
-
const u = (
|
|
154
|
-
(a.length ||
|
|
162
|
+
const u = (r = !1) => {
|
|
163
|
+
(a.length || r) && (e.push({
|
|
155
164
|
type: "paragraph",
|
|
156
165
|
...a.length ? { content: a } : {}
|
|
157
166
|
}), a = []);
|
|
158
|
-
},
|
|
167
|
+
}, l = (r, s = []) => {
|
|
159
168
|
if (n) return;
|
|
160
|
-
if (
|
|
161
|
-
(
|
|
162
|
-
h && u(!0), b && a.push(
|
|
169
|
+
if (r.nodeType === Node.TEXT_NODE) {
|
|
170
|
+
(r.textContent || "").replace(P, "").split(/\r\n?|\n/u).forEach((b, h) => {
|
|
171
|
+
h && u(!0), b && a.push(k(b, s));
|
|
163
172
|
});
|
|
164
173
|
return;
|
|
165
174
|
}
|
|
166
|
-
if (!(
|
|
167
|
-
if (
|
|
175
|
+
if (!(r instanceof Element) || r.getAttribute("data-tag-icon") === "true") return;
|
|
176
|
+
if (r.tagName === "BR") {
|
|
168
177
|
u(!0);
|
|
169
178
|
return;
|
|
170
179
|
}
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
173
|
-
|
|
180
|
+
if (r.tagName === "IMG" || r.tagName === "VIDEO") {
|
|
181
|
+
const c = C(r);
|
|
182
|
+
c ? (u(), e.push(c)) : n = !0;
|
|
174
183
|
return;
|
|
175
184
|
}
|
|
176
|
-
if (
|
|
177
|
-
const
|
|
178
|
-
!
|
|
185
|
+
if (r.hasAttribute("data-tag-type") || r.getAttribute("data-tag") === "no_send_follow_order" || r.getAttribute("data-reasoning") === "true") {
|
|
186
|
+
const c = v(r);
|
|
187
|
+
!c || c.type === "agentSizeChart" ? n = !0 : a.push(c);
|
|
179
188
|
return;
|
|
180
189
|
}
|
|
181
|
-
if (!
|
|
190
|
+
if (!I.has(r.tagName) && !$.has(r.tagName)) {
|
|
182
191
|
n = !0;
|
|
183
192
|
return;
|
|
184
193
|
}
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
if ((
|
|
188
|
-
const
|
|
189
|
-
if (!
|
|
194
|
+
$.has(r.tagName) && u();
|
|
195
|
+
const i = [...s || []];
|
|
196
|
+
if ((r.tagName === "B" || r.tagName === "STRONG") && i.push({ type: "bold" }), (r.tagName === "I" || r.tagName === "EM") && i.push({ type: "italic" }), r.tagName === "U" && i.push({ type: "underline" }), (r.tagName === "S" || r.tagName === "STRIKE") && i.push({ type: "strike" }), r.tagName === "CODE" && i.push({ type: "code" }), r.tagName === "A") {
|
|
197
|
+
const c = r.getAttribute("href");
|
|
198
|
+
if (!T(c)) {
|
|
190
199
|
n = !0;
|
|
191
200
|
return;
|
|
192
201
|
}
|
|
193
|
-
|
|
202
|
+
i.push({ type: "link", attrs: { href: c, target: "_self" } });
|
|
194
203
|
}
|
|
195
|
-
|
|
204
|
+
r.childNodes.forEach((c) => l(c, i)), $.has(r.tagName) && u();
|
|
196
205
|
};
|
|
197
|
-
return t.childNodes.forEach((
|
|
206
|
+
return t.childNodes.forEach((r) => l(r)), u(), n ? null : e.length ? e : [{ type: "paragraph" }];
|
|
198
207
|
}
|
|
199
|
-
function
|
|
200
|
-
const e = { clues: t.clues || "", webClues: t.webClues || "" }, a = (o,
|
|
208
|
+
function Q(t) {
|
|
209
|
+
const e = { clues: t.clues || "", webClues: t.webClues || "" }, a = (o, p, _) => ({
|
|
201
210
|
ok: !1,
|
|
202
211
|
raw: e,
|
|
203
|
-
issues: [m(o,
|
|
212
|
+
issues: [m(o, p, _)]
|
|
204
213
|
});
|
|
205
214
|
if (typeof t.clues != "string" || typeof t.webClues != "string")
|
|
206
215
|
return a("PROMPT_FIELDS_INVALID", "提示词字段必须为字符串", "clues");
|
|
@@ -209,7 +218,7 @@ function Y(t) {
|
|
|
209
218
|
if (typeof DOMParser > "u")
|
|
210
219
|
return a("DOM_UNAVAILABLE", "当前环境无法解析旧提示词", "webClues");
|
|
211
220
|
if (!e.webClues.trim())
|
|
212
|
-
return
|
|
221
|
+
return M.test(e.clues) ? a(
|
|
213
222
|
"PROMPT_STRUCTURE_MISSING",
|
|
214
223
|
"缺少可恢复业务标签的展示字段",
|
|
215
224
|
"webClues"
|
|
@@ -219,125 +228,133 @@ function Y(t) {
|
|
|
219
228
|
schemaVersion: 1,
|
|
220
229
|
doc: {
|
|
221
230
|
type: "doc",
|
|
222
|
-
content: e.clues.split(/\r\n?|\n/u).map((
|
|
231
|
+
content: e.clues.split(/\r\n?|\n/u).map((p) => ({
|
|
223
232
|
type: "paragraph",
|
|
224
|
-
...
|
|
233
|
+
...p ? { content: [k(p)] } : {}
|
|
225
234
|
}))
|
|
226
235
|
}
|
|
227
236
|
},
|
|
228
237
|
warnings: []
|
|
229
238
|
};
|
|
230
239
|
const n = new DOMParser().parseFromString(
|
|
231
|
-
|
|
240
|
+
G(e.webClues),
|
|
232
241
|
"text/html"
|
|
233
242
|
), u = [];
|
|
234
|
-
let
|
|
235
|
-
const s = [],
|
|
236
|
-
if (
|
|
243
|
+
let l = [], r = 0;
|
|
244
|
+
const s = [], i = (o, p, _) => {
|
|
245
|
+
if (M.test(o)) {
|
|
237
246
|
s.push(
|
|
238
247
|
m(
|
|
239
248
|
"PROMPT_UNTAGGED_MARKER",
|
|
240
249
|
"历史提示词含无法确认的普通文本标记",
|
|
241
|
-
|
|
250
|
+
_
|
|
242
251
|
)
|
|
243
252
|
);
|
|
244
253
|
return;
|
|
245
254
|
}
|
|
246
|
-
for (const [
|
|
247
|
-
|
|
248
|
-
},
|
|
249
|
-
(
|
|
255
|
+
for (const [d, y] of o.replace(P, "").split(/\r\n?|\n/u).entries())
|
|
256
|
+
d && c(!0), y && l.push(k(y, p));
|
|
257
|
+
}, c = (o = !1) => {
|
|
258
|
+
(l.length || o) && (u.push({
|
|
250
259
|
type: "paragraph",
|
|
251
|
-
...
|
|
252
|
-
}),
|
|
253
|
-
}, b = (o,
|
|
254
|
-
if (++
|
|
255
|
-
s.push(m("PROMPT_TOO_LARGE", "历史提示词节点过多",
|
|
260
|
+
...l.length ? { content: l } : {}
|
|
261
|
+
}), l = []);
|
|
262
|
+
}, b = (o, p, _ = []) => {
|
|
263
|
+
if (++r > z) {
|
|
264
|
+
s.push(m("PROMPT_TOO_LARGE", "历史提示词节点过多", p));
|
|
256
265
|
return;
|
|
257
266
|
}
|
|
258
267
|
if (o.nodeType === Node.TEXT_NODE) {
|
|
259
|
-
|
|
268
|
+
i(o.textContent || "", _, p);
|
|
260
269
|
return;
|
|
261
270
|
}
|
|
262
271
|
if (!(o instanceof Element)) return;
|
|
263
|
-
const
|
|
272
|
+
const d = o.tagName;
|
|
264
273
|
if (o.getAttribute("data-tag-icon") === "true") return;
|
|
265
|
-
if (["SCRIPT", "STYLE", "IFRAME", "OBJECT", "SVG", "TEMPLATE"].includes(
|
|
274
|
+
if (["SCRIPT", "STYLE", "IFRAME", "OBJECT", "SVG", "TEMPLATE"].includes(d)) {
|
|
266
275
|
s.push(
|
|
267
|
-
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含无法编辑的 HTML",
|
|
276
|
+
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含无法编辑的 HTML", p)
|
|
268
277
|
);
|
|
269
278
|
return;
|
|
270
279
|
}
|
|
271
|
-
if (
|
|
272
|
-
|
|
280
|
+
if (d === "BR") {
|
|
281
|
+
c(!0);
|
|
273
282
|
return;
|
|
274
283
|
}
|
|
275
|
-
if (
|
|
276
|
-
const
|
|
277
|
-
|
|
284
|
+
if (d === "IMG" || d === "VIDEO") {
|
|
285
|
+
const f = C(o);
|
|
286
|
+
f ? (c(), u.push(f)) : s.push(m("PROMPT_MEDIA_INVALID", "媒体地址或类型无效", p));
|
|
278
287
|
return;
|
|
279
288
|
}
|
|
280
289
|
if (o.hasAttribute("data-original-repeat-template") || o.getAttribute("data-tag-type") === "original_repeat") {
|
|
281
|
-
const
|
|
290
|
+
const f = o.querySelector(
|
|
282
291
|
"[data-original-repeat-input], .original-repeat-input"
|
|
283
|
-
), E =
|
|
292
|
+
), E = f && F(f);
|
|
284
293
|
if (!E) {
|
|
285
294
|
s.push(
|
|
286
|
-
m("PROMPT_REPLY_UNSUPPORTED", "原话复述模板无法无损恢复",
|
|
295
|
+
m("PROMPT_REPLY_UNSUPPORTED", "原话复述模板无法无损恢复", p)
|
|
287
296
|
);
|
|
288
297
|
return;
|
|
289
298
|
}
|
|
290
|
-
|
|
299
|
+
c(), u.push({
|
|
291
300
|
type: "originalReply",
|
|
292
301
|
content: E
|
|
293
302
|
});
|
|
294
303
|
return;
|
|
295
304
|
}
|
|
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
|
|
298
|
-
|
|
299
|
-
m("PROMPT_TAG_UNSUPPORTED", "业务标签无法无损恢复",
|
|
305
|
+
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" || o.getAttribute("data-tag") === "no_send_follow_order" || o.getAttribute("data-reasoning") === "true") {
|
|
306
|
+
const f = v(o);
|
|
307
|
+
f ? l.push(f) : s.push(
|
|
308
|
+
m("PROMPT_TAG_UNSUPPORTED", "业务标签无法无损恢复", p)
|
|
300
309
|
);
|
|
301
310
|
return;
|
|
302
311
|
}
|
|
303
|
-
if (!
|
|
312
|
+
if (!I.has(d) && !$.has(d)) {
|
|
304
313
|
s.push(
|
|
305
|
-
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含不支持的排版节点",
|
|
314
|
+
m("PROMPT_HTML_UNSUPPORTED", "旧提示词含不支持的排版节点", p)
|
|
306
315
|
);
|
|
307
316
|
return;
|
|
308
317
|
}
|
|
309
|
-
|
|
310
|
-
const y = [
|
|
311
|
-
if ((
|
|
312
|
-
const
|
|
313
|
-
if (!
|
|
314
|
-
s.push(m("PROMPT_LINK_INVALID", "链接地址无效",
|
|
318
|
+
$.has(d) && c();
|
|
319
|
+
const y = [..._ || []];
|
|
320
|
+
if ((d === "B" || d === "STRONG") && y.push({ type: "bold" }), (d === "I" || d === "EM") && y.push({ type: "italic" }), d === "U" && y.push({ type: "underline" }), (d === "S" || d === "STRIKE") && y.push({ type: "strike" }), d === "CODE" && y.push({ type: "code" }), d === "A") {
|
|
321
|
+
const f = o.getAttribute("href");
|
|
322
|
+
if (!T(f)) {
|
|
323
|
+
s.push(m("PROMPT_LINK_INVALID", "链接地址无效", p));
|
|
315
324
|
return;
|
|
316
325
|
}
|
|
317
|
-
y.push({ type: "link", attrs: { href:
|
|
326
|
+
y.push({ type: "link", attrs: { href: f, target: "_self" } });
|
|
318
327
|
}
|
|
319
328
|
o.childNodes.forEach(
|
|
320
|
-
(
|
|
321
|
-
),
|
|
329
|
+
(f, E) => b(f, `${p}.childNodes[${E}]`, y)
|
|
330
|
+
), $.has(d) && c();
|
|
322
331
|
};
|
|
323
332
|
if (n.body.childNodes.forEach(
|
|
324
|
-
(o,
|
|
325
|
-
),
|
|
333
|
+
(o, p) => b(o, `webClues.childNodes[${p}]`)
|
|
334
|
+
), c(), s.length) return { ok: !1, raw: e, issues: s };
|
|
326
335
|
const h = {
|
|
327
336
|
schemaVersion: 1,
|
|
328
337
|
doc: {
|
|
329
338
|
type: "doc",
|
|
330
339
|
content: u.length ? u : [{ type: "paragraph" }]
|
|
331
340
|
}
|
|
332
|
-
},
|
|
333
|
-
if (
|
|
334
|
-
return a("PROMPT_DOCUMENT_INVALID", "历史提示词结构无效",
|
|
335
|
-
const
|
|
336
|
-
|
|
341
|
+
}, S = R(h);
|
|
342
|
+
if (S)
|
|
343
|
+
return a("PROMPT_DOCUMENT_INVALID", "历史提示词结构无效", S);
|
|
344
|
+
const N = j(h);
|
|
345
|
+
if (!N.ok) return { ok: !1, raw: e, issues: N.issues };
|
|
346
|
+
const L = N.clues.replace(
|
|
347
|
+
/<video\b[^>]*data-source-type="qianniuVideo"[^>]*\/>/giu,
|
|
348
|
+
(o) => {
|
|
349
|
+
var p;
|
|
350
|
+
return ((p = /\bsrc="([^"]+)"/iu.exec(o)) == null ? void 0 : p[1]) || o;
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
return w(N.clues) !== w(e.clues) && w(L) !== w(e.clues) ? a(
|
|
337
354
|
"PROMPT_FIELDS_MISMATCH",
|
|
338
355
|
"展示内容与算法提示词不一致",
|
|
339
356
|
"clues"
|
|
340
|
-
) : { ok: !0, value: h, warnings: [] }
|
|
357
|
+
) : { ok: !0, value: h, warnings: [] };
|
|
341
358
|
}
|
|
342
359
|
function K(t) {
|
|
343
360
|
var a;
|
|
@@ -349,39 +366,49 @@ function K(t) {
|
|
|
349
366
|
return e;
|
|
350
367
|
}
|
|
351
368
|
function q(t) {
|
|
352
|
-
const { kind: e, key: a, label: n, token: u, params:
|
|
369
|
+
const { kind: e, key: a, label: n, token: u, params: l } = t.attrs || {}, r = String(n || "");
|
|
353
370
|
if (e === "tableKnowledge") {
|
|
354
|
-
const s = `##${
|
|
371
|
+
const s = `##${r}##`;
|
|
355
372
|
return {
|
|
356
373
|
clues: s,
|
|
357
374
|
web: `<span data-tableKnowledge="true" data-tag-type="table_knowledge" data-table-name="${g(
|
|
358
|
-
|
|
375
|
+
r
|
|
359
376
|
)}">${g(s)}</span>`
|
|
360
377
|
};
|
|
361
378
|
}
|
|
362
379
|
if (e === "attribute") {
|
|
363
|
-
const s = `{业务属性@${
|
|
380
|
+
const s = `{业务属性@${r}}`, i = typeof u == "string" && u.startsWith("legacy-id:") ? u.slice(10) : "";
|
|
364
381
|
return {
|
|
365
382
|
clues: s,
|
|
366
383
|
web: `<span data-tag="true" data-tag-type="biz_attribute" data-attr-name="${g(
|
|
367
|
-
|
|
368
|
-
)}" data-attr-key="${g(String(a ||
|
|
384
|
+
r
|
|
385
|
+
)}" data-attr-key="${g(String(a || r))}"${i ? ` data-attr-id="${g(i)}"` : ""}>${g(r)}</span>`
|
|
369
386
|
};
|
|
370
387
|
}
|
|
371
388
|
if (e === "variable") {
|
|
372
|
-
const s = typeof u == "string" && u.trim() ? u : `#${
|
|
389
|
+
const s = r === "订单链接" ? "{订单链接}" : typeof u == "string" && u.trim() ? u : `#${r}#`;
|
|
373
390
|
return {
|
|
374
391
|
clues: s,
|
|
375
392
|
web: `<span data-variable="true" data-tag-type="variable" data-variable-name="${g(
|
|
376
|
-
|
|
377
|
-
)}">${g(s)}</span>`
|
|
393
|
+
r
|
|
394
|
+
)}">${g(r === "订单链接" ? "#订单链接#" : s)}</span>`
|
|
378
395
|
};
|
|
379
396
|
}
|
|
397
|
+
if (e === "noFollow")
|
|
398
|
+
return {
|
|
399
|
+
clues: "<不发送跟单>",
|
|
400
|
+
web: '<span data-tag="no_send_follow_order">不跟单</span>'
|
|
401
|
+
};
|
|
402
|
+
if (e === "reasoningMarker")
|
|
403
|
+
return {
|
|
404
|
+
clues: "{推理}",
|
|
405
|
+
web: '<span data-tag-type="reasoning" data-reasoning="true">推理</span>'
|
|
406
|
+
};
|
|
380
407
|
if (e === "todo") {
|
|
381
|
-
const s =
|
|
408
|
+
const s = r === "默认" && u === "{待办}" ? "{待办}" : `{待办@${r}}`;
|
|
382
409
|
return {
|
|
383
410
|
clues: s,
|
|
384
|
-
web: `<span data-tag="true" data-tag-type="todo"${
|
|
411
|
+
web: `<span data-tag="true" data-tag-type="todo"${r === "默认" ? "" : ` data-tag-name="${g(r)}"`}${a && a !== r ? ` plan_id="${g(String(a))}"` : ""}>${g(s)}</span>`
|
|
385
412
|
};
|
|
386
413
|
}
|
|
387
414
|
if (e === "separator")
|
|
@@ -390,27 +417,26 @@ function q(t) {
|
|
|
390
417
|
web: '<span data-divider="true" data-tag-type="separator">{分隔符}</span>'
|
|
391
418
|
};
|
|
392
419
|
if (e === "tool" && a === "small_payment") {
|
|
393
|
-
const s =
|
|
420
|
+
const s = U(t);
|
|
394
421
|
if (!s) return null;
|
|
395
|
-
const
|
|
422
|
+
const i = Number(l == null ? void 0 : l.amount) * 100;
|
|
396
423
|
return {
|
|
397
424
|
clues: s,
|
|
398
|
-
web: `<span contenteditable="false" data-tag="true" data-tag-type="small_payment" data-max-amount-cent="${
|
|
425
|
+
web: `<span contenteditable="false" data-tag="true" data-tag-type="small_payment" data-max-amount-cent="${i}">${s}</span>`
|
|
399
426
|
};
|
|
400
427
|
}
|
|
401
428
|
return null;
|
|
402
429
|
}
|
|
403
|
-
function
|
|
404
|
-
const { kind: e, src: a, assetId: n, name: u, poster:
|
|
405
|
-
if (
|
|
430
|
+
function H(t) {
|
|
431
|
+
const { kind: e, src: a, assetId: n, name: u, poster: l, status: r, sourceType: s } = t.attrs || {};
|
|
432
|
+
if (r !== "ready" || e !== "image" && e !== "video" || !T(a))
|
|
406
433
|
return null;
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
};
|
|
434
|
+
const i = `src="${g(a)}"${n ? ` data-asset-id="${g(String(n))}"` : ""}${s === "qianniuVideo" ? ' data-source-type="qianniuVideo"' : ""}${s === "qianniuVideo" && n ? ` id="${g(String(n))}" data-video-id="${g(
|
|
435
|
+
String(n)
|
|
436
|
+
)}"` : ""}${u ? ` data-media-name="${g(String(u))}"` : ""}${l ? ` poster="${g(String(l))}"` : ""}`, c = e === "image" ? `<img ${i} width="120"/>` : `<video ${i} width="240" controls/>`;
|
|
437
|
+
return { clues: c, web: c };
|
|
412
438
|
}
|
|
413
|
-
function
|
|
439
|
+
function X(t) {
|
|
414
440
|
var e;
|
|
415
441
|
if (t.type === "text")
|
|
416
442
|
return { clues: t.text || "", web: K(t) };
|
|
@@ -428,15 +454,15 @@ function H(t) {
|
|
|
428
454
|
return t.type === "businessToken" ? q(t) : null;
|
|
429
455
|
}
|
|
430
456
|
function D(t) {
|
|
431
|
-
if (t.type === "mediaBlock") return
|
|
457
|
+
if (t.type === "mediaBlock") return H(t);
|
|
432
458
|
if (t.type === "originalReply") {
|
|
433
459
|
const a = (t.content || []).map(D);
|
|
434
|
-
if (a.some((
|
|
435
|
-
let n = "", u = "",
|
|
436
|
-
return (t.content || []).forEach((
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
`, u += "<br>"), n +=
|
|
460
|
+
if (a.some((r) => !r)) return null;
|
|
461
|
+
let n = "", u = "", l = !1;
|
|
462
|
+
return (t.content || []).forEach((r, s) => {
|
|
463
|
+
const i = a[s];
|
|
464
|
+
l && r.type === "paragraph" && (n += `
|
|
465
|
+
`, u += "<br>"), n += i.clues, u += r.type === "paragraph" ? i.web.replace(/^<div>/u, "").replace(/<\/div>$/u, "") : i.web, l = r.type === "paragraph";
|
|
440
466
|
}), {
|
|
441
467
|
clues: `<{原话复述}${n}>`,
|
|
442
468
|
web: `<span data-original-repeat-template="true" data-tag-type="original_repeat"><span data-original-repeat-input="true">${u}</span></span>`
|
|
@@ -448,14 +474,14 @@ function D(t) {
|
|
|
448
474
|
web: '<span data-divider="true" data-tag-type="separator">{分隔符}</span>'
|
|
449
475
|
};
|
|
450
476
|
if (t.type !== "paragraph") return null;
|
|
451
|
-
const e = (t.content || []).map(
|
|
477
|
+
const e = (t.content || []).map(X);
|
|
452
478
|
return e.some((a) => !a) ? null : {
|
|
453
479
|
clues: e.map((a) => a.clues).join(""),
|
|
454
480
|
web: `<div>${e.map((a) => a.web).join("") || "<br>"}</div>`
|
|
455
481
|
};
|
|
456
482
|
}
|
|
457
|
-
function
|
|
458
|
-
const a =
|
|
483
|
+
function j(t, e = 1e4) {
|
|
484
|
+
const a = R(t);
|
|
459
485
|
if (a)
|
|
460
486
|
return {
|
|
461
487
|
ok: !1,
|
|
@@ -463,32 +489,32 @@ function X(t, e = 1e4) {
|
|
|
463
489
|
m("PROMPT_DOCUMENT_INVALID", "提示词文档包含无效内容", a)
|
|
464
490
|
]
|
|
465
491
|
};
|
|
466
|
-
const n =
|
|
492
|
+
const n = V(t, e);
|
|
467
493
|
if (n.length) return { ok: !1, issues: n };
|
|
468
|
-
const u = (t.doc.content || []).map(D),
|
|
469
|
-
if (
|
|
494
|
+
const u = (t.doc.content || []).map(D), l = u.findIndex((s) => !s);
|
|
495
|
+
if (l >= 0)
|
|
470
496
|
return {
|
|
471
497
|
ok: !1,
|
|
472
498
|
issues: [
|
|
473
499
|
m(
|
|
474
500
|
"PROMPT_NODE_UNSUPPORTED",
|
|
475
501
|
"提示词包含旧接口不能保存的内容",
|
|
476
|
-
`doc.content[${
|
|
502
|
+
`doc.content[${l}]`
|
|
477
503
|
)
|
|
478
504
|
]
|
|
479
505
|
};
|
|
480
|
-
let
|
|
481
|
-
return (t.doc.content || []).forEach((s,
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
-
`),
|
|
506
|
+
let r = "";
|
|
507
|
+
return (t.doc.content || []).forEach((s, i) => {
|
|
508
|
+
var c, b;
|
|
509
|
+
i > 0 && s.type !== "originalReply" && ((b = (c = t.doc.content) == null ? void 0 : c[i - 1]) == null ? void 0 : b.type) !== "originalReply" && (r += `
|
|
510
|
+
`), r += u[i].clues;
|
|
485
511
|
}), {
|
|
486
512
|
ok: !0,
|
|
487
|
-
clues:
|
|
513
|
+
clues: r.trim(),
|
|
488
514
|
webClues: u.map((s) => s.web).join("")
|
|
489
515
|
};
|
|
490
516
|
}
|
|
491
517
|
export {
|
|
492
|
-
|
|
493
|
-
|
|
518
|
+
j as exportLegacyAgentPrompt,
|
|
519
|
+
Q as importLegacyAgentPrompt
|
|
494
520
|
};
|