@freecallai/pro 0.0.11 → 0.0.12
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-D2sgT7XP.js → FkpRichText.vue_vue_type_script_setup_true_lang-DiS7CZdc.js} +1470 -1455
- package/dist/{KnowledgeArea-Sbfs_E0C.js → KnowledgeArea-FGgCcubh.js} +1 -1
- package/dist/{KnowledgeArea.vue_vue_type_script_setup_true_lang-BNDRTWXW.js → KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js} +523 -519
- package/dist/{ToolForm-_ZTW7lwU.js → ToolForm-CHmdyhjh.js} +1 -1
- package/dist/agent-prompt-editor/index.js +304 -293
- package/dist/agent-prompt-editor/legacy-converter/index.js +98 -94
- package/dist/{choice-BqjECVyx.js → choice-CUCsR2dN.js} +1 -1
- package/dist/{guard-BmLOamCj.js → guard-DgExtfXo.js} +199 -185
- package/dist/{index-BDinNJn_.js → index-BwZXmefJ.js} +1 -1
- package/dist/{index-6VSUucFX.js → index-C54ce9Tn.js} +1 -1
- package/dist/index-CMl5mgFR.js +5 -0
- package/dist/index-Cs38tTe4.js +5 -0
- package/dist/{index-CCwmXuSJ.js → index-DIMONp3g.js} +1 -1
- package/dist/{index-CN2knQcE.js → index-DaGfiqBX.js} +1 -1
- package/dist/{index-gS1h8iW8.js → index-DqJvaPTD.js} +1 -1
- package/dist/{index-0BXLYaKG.js → index-dnsGFj0F.js} +2 -2
- package/dist/{index-B1rTu0jX.js → index-pdr6mUf0.js} +1 -1
- package/dist/index.js +3 -3
- package/dist/{inline-CRGzAti7.js → inline-BpwAryXp.js} +1 -1
- package/dist/{knowledge-DNDouB-s.js → knowledge-DIzYk2iM.js} +1 -1
- package/dist/media-extensions-YYbGuUQa.js +341 -0
- package/dist/{media-migration-D1KoHKoP.js → media-migration-Bnfn27i9.js} +1 -1
- package/dist/media-policy-tG5OHWSj.js +215 -0
- package/dist/{media-upload-C5N6YWHu.js → media-upload-_xeZtn3i.js} +1 -1
- package/dist/{model-BVh9EZ9G.js → model-DlAjlPai.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 +4 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +2 -0
- package/dist/types/rich-text/model/qianniu-video.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +2 -2
- package/dist/types/rich-text/runtime/media-sources.d.ts +1 -1
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +1 -0
- package/dist/types/rich-text/ui/MediaSourceControls.vue.d.ts +19 -10
- package/package.json +3 -3
- 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,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Popover as
|
|
3
|
-
import
|
|
4
|
-
import { u as wt, c as
|
|
5
|
-
import { i as
|
|
6
|
-
import { _ as
|
|
7
|
-
import { Node as
|
|
8
|
-
import { f as ne, a as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as It, ref as d, computed as N, onMounted as Mt, watch as $, onBeforeUnmount as Et, openBlock as v, createElementBlock as b, withKeys as Tt, withModifiers as ae, normalizeClass as Lt, createElementVNode as y, Fragment as ve, renderList as Le, createCommentVNode as q, createVNode as x, unref as I, withCtx as me, createBlock as We, createTextVNode as _e, toDisplayString as U, renderSlot as _t, normalizeStyle as Ct, withDirectives as Xe, vModelText as Ge, nextTick as ge } from "vue";
|
|
2
|
+
import { Popover as St, Button as Ce } from "@freecallai/ui";
|
|
3
|
+
import Se from "@freecallai/icons";
|
|
4
|
+
import { u as wt, c as Ze, m as be, _ as Dt, M as je, a as Nt, b as Pt } from "../media-policy-tG5OHWSj.js";
|
|
5
|
+
import { i as Qe } from "../guard-DgExtfXo.js";
|
|
6
|
+
import { _ as Ot } from "../KnowledgeArea.vue_vue_type_script_setup_true_lang-JH_F4CFe.js";
|
|
7
|
+
import { Node as Vt } from "@tiptap/core";
|
|
8
|
+
import { f as ne, a as et, c as zt, e as Kt, v as xt } from "../model-DlAjlPai.js";
|
|
9
|
+
const Rt = Vt.create({
|
|
10
10
|
name: "agentSizeChart",
|
|
11
11
|
group: "inline",
|
|
12
12
|
inline: !0,
|
|
@@ -40,11 +40,11 @@ const Kt = Ot.create({
|
|
|
40
40
|
return `#@${L.attrs.name}@#`;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
function
|
|
43
|
+
function Ft(L) {
|
|
44
44
|
return {
|
|
45
45
|
ariaLabel: "Agent 提示词",
|
|
46
46
|
placeholder: "填写提示词",
|
|
47
|
-
extensions: [
|
|
47
|
+
extensions: [Rt],
|
|
48
48
|
clipboard: {
|
|
49
49
|
allowBusinessToken: (_, D) => _ !== "tool" || D === "small_payment",
|
|
50
50
|
sanitizeInlineNode(_) {
|
|
@@ -62,26 +62,26 @@ function Rt(L) {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
const
|
|
65
|
+
const Bt = {
|
|
66
66
|
key: 0,
|
|
67
67
|
class: "fkp-toolbar-divider",
|
|
68
68
|
"aria-hidden": "true"
|
|
69
|
-
},
|
|
69
|
+
}, $t = {
|
|
70
70
|
key: 0,
|
|
71
71
|
class: "fkp-more-wrap"
|
|
72
|
-
},
|
|
72
|
+
}, qt = {
|
|
73
73
|
key: 0,
|
|
74
74
|
class: "fkp-menu fkp-more-menu",
|
|
75
75
|
role: "menu",
|
|
76
76
|
"aria-label": "更多提示词操作"
|
|
77
|
-
}, Ut = { class: "fkp-toolbar-right fkp-agent-prompt-toolbar-right" },
|
|
77
|
+
}, Ut = { class: "fkp-toolbar-right fkp-agent-prompt-toolbar-right" }, Yt = ["aria-label"], Ht = { key: 0 }, Jt = { key: 1 }, Wt = ["disabled", "onClick"], Xt = {
|
|
78
78
|
key: 1,
|
|
79
79
|
class: "fkp-agent-prompt-options"
|
|
80
|
-
},
|
|
80
|
+
}, Gt = {
|
|
81
81
|
key: 2,
|
|
82
82
|
role: "alert",
|
|
83
83
|
class: "fkp-agent-prompt-error"
|
|
84
|
-
},
|
|
84
|
+
}, Zt = { class: "fkp-agent-prompt-footer" }, ia = /* @__PURE__ */ It({
|
|
85
85
|
name: "FkpAgentPromptEditor",
|
|
86
86
|
__name: "FkpAgentPromptEditor",
|
|
87
87
|
props: {
|
|
@@ -104,20 +104,20 @@ const Ft = {
|
|
|
104
104
|
function we(e) {
|
|
105
105
|
return JSON.parse(JSON.stringify(e));
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return ne(e) ?
|
|
107
|
+
function De(e) {
|
|
108
|
+
return ne(e) ? Kt() : we(e);
|
|
109
109
|
}
|
|
110
|
-
const C =
|
|
110
|
+
const C = d(De(o.modelValue)), O = d(
|
|
111
111
|
ne(o.modelValue)
|
|
112
|
-
), Y =
|
|
113
|
-
let
|
|
114
|
-
const R = /* @__PURE__ */ new Set(),
|
|
115
|
-
let A = null,
|
|
116
|
-
const
|
|
112
|
+
), Y = d(0), c = d(), oe = d(), ye = d(), H = d(), J = d(Number.POSITIVE_INFINITY), M = d(!1), h = d(null), ie = d([]), W = d(""), re = d(!1), Ne = d(12), k = d(!1), X = d(null), G = d(0), Z = d(0), ue = d(), S = d(null), P = d(null), se = d(!1), { suppressedMediaHint: tt, suppressMediaHint: at, resumeMediaHintOnHover: nt } = wt(), Pe = d({});
|
|
113
|
+
let w = null;
|
|
114
|
+
const R = /* @__PURE__ */ new Set(), ce = /* @__PURE__ */ new Map();
|
|
115
|
+
let A = null, he = null, lt = 0;
|
|
116
|
+
const de = d(Date.now());
|
|
117
117
|
let j;
|
|
118
|
-
const
|
|
119
|
-
() => new Set(o.capabilities ||
|
|
120
|
-
),
|
|
118
|
+
const Oe = N(
|
|
119
|
+
() => new Set(o.capabilities || et)
|
|
120
|
+
), Ve = [
|
|
121
121
|
{ id: "variable", label: "变量", icon: "hashtag", group: "reference" },
|
|
122
122
|
{ id: "todo", label: "待办", icon: "rte-todo", group: "reference" },
|
|
123
123
|
{
|
|
@@ -138,7 +138,7 @@ const Ft = {
|
|
|
138
138
|
{ id: "originalReply", label: "原话复述", icon: "quote", group: "format" },
|
|
139
139
|
{ id: "separator", label: "分隔符", icon: "sep", group: "format" },
|
|
140
140
|
{ id: "smallPayment", label: "小额打款", icon: "rte-tool", group: "tool" }
|
|
141
|
-
],
|
|
141
|
+
], ot = N(
|
|
142
142
|
() => {
|
|
143
143
|
var e;
|
|
144
144
|
return new Set(
|
|
@@ -146,34 +146,34 @@ const Ft = {
|
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
), pe = N(
|
|
149
|
-
() =>
|
|
150
|
-
(e) =>
|
|
149
|
+
() => Ve.filter(
|
|
150
|
+
(e) => Oe.value.has(e.id) && !ot.value.has(e.id)
|
|
151
151
|
)
|
|
152
152
|
), ze = N(
|
|
153
153
|
() => pe.value.slice(0, J.value)
|
|
154
|
-
),
|
|
154
|
+
), Ae = N(
|
|
155
155
|
() => pe.value.slice(J.value)
|
|
156
|
-
),
|
|
156
|
+
), Ke = N(
|
|
157
157
|
() => {
|
|
158
158
|
var e;
|
|
159
|
-
return ((e =
|
|
159
|
+
return ((e = Ve.find((t) => t.id === h.value)) == null ? void 0 : e.label) || "";
|
|
160
160
|
}
|
|
161
|
-
),
|
|
162
|
-
() => o.readonly || o.disabled || !!O.value || !!o.policy && o.policy.expiresAt <=
|
|
161
|
+
), V = N(
|
|
162
|
+
() => o.readonly || o.disabled || !!O.value || !!o.policy && o.policy.expiresAt <= de.value
|
|
163
163
|
);
|
|
164
164
|
function g(e) {
|
|
165
|
-
return !
|
|
165
|
+
return !V.value && et.includes(e) && Oe.value.has(e) && (!o.policy || o.policy.allowed.includes(e));
|
|
166
166
|
}
|
|
167
|
-
const
|
|
168
|
-
function
|
|
167
|
+
const it = Ft(() => g("sizeChart"));
|
|
168
|
+
function ke(e) {
|
|
169
169
|
var t, a;
|
|
170
170
|
return g(e) && (e === "variable" ? !!((t = o.ports) != null && t.listVariables) : !!((a = o.ports) != null && a.listCapabilityOptions));
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return e === "image" || e === "video" ? g(e) &&
|
|
172
|
+
function Ie(e) {
|
|
173
|
+
return e === "image" || e === "video" ? g(e) && be(o.mediaSources, e).some(
|
|
174
174
|
(t) => {
|
|
175
175
|
var a;
|
|
176
|
-
return t
|
|
176
|
+
return t !== "local" || !!((a = o.ports) != null && a.uploadMedia);
|
|
177
177
|
}
|
|
178
178
|
) : [
|
|
179
179
|
"variable",
|
|
@@ -181,51 +181,51 @@ const Ft = {
|
|
|
181
181
|
"tableKnowledge",
|
|
182
182
|
"sizeChart",
|
|
183
183
|
"attribute"
|
|
184
|
-
].includes(e) ?
|
|
184
|
+
].includes(e) ? ke(e) : g(e);
|
|
185
185
|
}
|
|
186
186
|
function F() {
|
|
187
187
|
A == null || A.abort(), h.value = null;
|
|
188
188
|
}
|
|
189
189
|
function xe(e, t) {
|
|
190
190
|
var a;
|
|
191
|
-
if (
|
|
192
|
-
if (
|
|
191
|
+
if (Ie(e))
|
|
192
|
+
if (M.value = !1, F(), z(), k.value = !1, ["variable", "todo", "tableKnowledge", "sizeChart", "attribute"].includes(
|
|
193
193
|
e
|
|
194
194
|
)) {
|
|
195
195
|
const n = t.currentTarget, l = (a = oe.value) == null ? void 0 : a.getBoundingClientRect();
|
|
196
|
-
l && (
|
|
196
|
+
l && (Ne.value = Math.max(
|
|
197
197
|
12,
|
|
198
198
|
Math.min(
|
|
199
199
|
n.getBoundingClientRect().left - l.left,
|
|
200
200
|
l.width - 332
|
|
201
201
|
)
|
|
202
|
-
)),
|
|
203
|
-
} else e === "image" || e === "video" ?
|
|
202
|
+
)), dt(e);
|
|
203
|
+
} else e === "image" || e === "video" ? ft(e, t) : e === "smallPayment" ? mt() : fe({ type: "capability", capabilityId: e });
|
|
204
204
|
}
|
|
205
|
-
let Q,
|
|
205
|
+
let Q, Re = 0;
|
|
206
206
|
async function ee() {
|
|
207
|
-
const e = ++
|
|
208
|
-
for (J.value = pe.value.length, await
|
|
209
|
-
J.value--, await
|
|
210
|
-
|
|
207
|
+
const e = ++Re;
|
|
208
|
+
for (J.value = pe.value.length, await ge(); e === Re && H.value && H.value.clientWidth > 0 && H.value.scrollWidth > H.value.clientWidth + 1 && J.value > 0; )
|
|
209
|
+
J.value--, await ge();
|
|
210
|
+
Ae.value.length || (M.value = !1);
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function Fe(e) {
|
|
213
213
|
var t;
|
|
214
|
-
(t = oe.value) != null && t.contains(e.target) || (
|
|
214
|
+
(t = oe.value) != null && t.contains(e.target) || (M.value = !1, F(), P.value || z(), k.value = !1);
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
window.addEventListener("resize", ee), document.addEventListener("click",
|
|
216
|
+
Mt(() => {
|
|
217
|
+
window.addEventListener("resize", ee), document.addEventListener("click", Fe), typeof ResizeObserver < "u" && ye.value && (Q = new ResizeObserver(() => void ee()), Q.observe(ye.value)), ee();
|
|
218
218
|
}), $(pe, (e) => {
|
|
219
219
|
h.value && !e.some((t) => t.id === h.value) && F(), k.value && !e.some((t) => t.id === "smallPayment") && (k.value = !1), ee();
|
|
220
|
-
}), $(
|
|
221
|
-
e && (F(),
|
|
220
|
+
}), $(V, (e) => {
|
|
221
|
+
e && (F(), z(), k.value = !1, M.value = !1);
|
|
222
222
|
});
|
|
223
|
-
const
|
|
223
|
+
const rt = {
|
|
224
224
|
businessToken: !0,
|
|
225
225
|
originalReply: !0,
|
|
226
226
|
separator: !0,
|
|
227
227
|
mediaBlock: !0
|
|
228
|
-
},
|
|
228
|
+
}, ut = N(
|
|
229
229
|
() => [
|
|
230
230
|
"variable",
|
|
231
231
|
"todo",
|
|
@@ -242,32 +242,32 @@ const Ft = {
|
|
|
242
242
|
id: e,
|
|
243
243
|
slot: e === "image" || e === "video" || e === "originalReply" ? "knowledgeBlock" : "knowledgeInline"
|
|
244
244
|
}))
|
|
245
|
-
),
|
|
246
|
-
function
|
|
247
|
-
j && clearTimeout(j),
|
|
248
|
-
|
|
249
|
-
Math.min(o.policy.expiresAt -
|
|
245
|
+
), st = N(() => zt(C.value));
|
|
246
|
+
function Be() {
|
|
247
|
+
j && clearTimeout(j), de.value = Date.now(), o.policy && o.policy.expiresAt > de.value && (j = setTimeout(
|
|
248
|
+
Be,
|
|
249
|
+
Math.min(o.policy.expiresAt - de.value + 1, 2147483647)
|
|
250
250
|
));
|
|
251
251
|
}
|
|
252
252
|
$(() => {
|
|
253
253
|
var e;
|
|
254
254
|
return (e = o.policy) == null ? void 0 : e.expiresAt;
|
|
255
|
-
},
|
|
255
|
+
}, Be, { immediate: !0 });
|
|
256
256
|
function te() {
|
|
257
257
|
le("busy-change", {
|
|
258
258
|
uploading: G.value,
|
|
259
259
|
requesting: Z.value
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
|
|
262
|
+
function $e() {
|
|
263
|
+
z();
|
|
264
264
|
for (const e of R) e.abort();
|
|
265
|
-
R.clear(),
|
|
265
|
+
R.clear(), ce.clear(), A = null, h.value = null, M.value = !1, k.value = !1, ie.value = [], re.value = !1, G.value = 0, Z.value = 0, te();
|
|
266
266
|
}
|
|
267
267
|
$(
|
|
268
268
|
() => o.promptKey,
|
|
269
269
|
() => {
|
|
270
|
-
|
|
270
|
+
$e(), C.value = De(o.modelValue), O.value = ne(o.modelValue), Y.value = 0;
|
|
271
271
|
},
|
|
272
272
|
{ flush: "sync" }
|
|
273
273
|
), $(
|
|
@@ -278,15 +278,15 @@ const Ft = {
|
|
|
278
278
|
O.value = a, m("PROMPT_DOCUMENT_INVALID", "输入的提示词文档无效", a);
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
|
-
if (
|
|
281
|
+
if (Ze(e) === Ze(C.value)) {
|
|
282
282
|
O.value = null;
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
285
285
|
Y.value > 0 && (t || 0) < Y.value || (O.value = null, C.value = we(e));
|
|
286
286
|
},
|
|
287
287
|
{ deep: !0 }
|
|
288
|
-
),
|
|
289
|
-
|
|
288
|
+
), Et(() => {
|
|
289
|
+
$e(), j && clearTimeout(j), Q == null || Q.disconnect(), window.removeEventListener("resize", ee), document.removeEventListener("click", Fe);
|
|
290
290
|
});
|
|
291
291
|
function m(e, t, a = "doc") {
|
|
292
292
|
le("diagnostic", {
|
|
@@ -297,115 +297,115 @@ const Ft = {
|
|
|
297
297
|
source: "validation"
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
|
-
function
|
|
301
|
-
if (
|
|
300
|
+
function Me(e, t, a) {
|
|
301
|
+
if (V.value) return !1;
|
|
302
302
|
const n = { schemaVersion: 1, doc: e }, l = ne(n);
|
|
303
303
|
if (l)
|
|
304
|
-
return m("PROMPT_DOCUMENT_INVALID", "编辑结果包含无效内容", l),
|
|
304
|
+
return m("PROMPT_DOCUMENT_INVALID", "编辑结果包含无效内容", l), ge(() => {
|
|
305
305
|
var i;
|
|
306
306
|
return (i = c.value) == null ? void 0 : i.restoreDoc(C.value.doc);
|
|
307
307
|
}), !1;
|
|
308
308
|
C.value = n;
|
|
309
|
-
const
|
|
309
|
+
const u = ++Y.value;
|
|
310
310
|
return le("change", n, {
|
|
311
311
|
promptKey: o.promptKey,
|
|
312
|
-
revision:
|
|
312
|
+
revision: u,
|
|
313
313
|
origin: t,
|
|
314
314
|
...a ? { capabilityId: a } : {}
|
|
315
315
|
}), le("update:modelValue", n), !0;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
const t =
|
|
319
|
-
|
|
317
|
+
function ct(e) {
|
|
318
|
+
const t = he;
|
|
319
|
+
Me(e, (t == null ? void 0 : t.origin) || "user", t == null ? void 0 : t.capabilityId);
|
|
320
320
|
}
|
|
321
|
-
function
|
|
322
|
-
|
|
321
|
+
function E(e, t, a) {
|
|
322
|
+
he = { origin: t, capabilityId: a };
|
|
323
323
|
try {
|
|
324
324
|
return e();
|
|
325
325
|
} finally {
|
|
326
|
-
|
|
326
|
+
he = null;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function p(e, t) {
|
|
330
330
|
return m(e, t), { ok: !1, code: e, message: t };
|
|
331
331
|
}
|
|
332
332
|
function B() {
|
|
333
333
|
return { ok: !0, revision: Y.value };
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function qe(e) {
|
|
336
336
|
const t = /* @__PURE__ */ new Set(), a = (n) => {
|
|
337
|
-
var l,
|
|
338
|
-
e === "agentSizeChart" && n.type === e && t.add(String(((l = n.attrs) == null ? void 0 : l.name) || "").trim()), e === "tableKnowledge" && ((
|
|
337
|
+
var l, u, i, r;
|
|
338
|
+
e === "agentSizeChart" && n.type === e && t.add(String(((l = n.attrs) == null ? void 0 : l.name) || "").trim()), e === "tableKnowledge" && ((u = n.attrs) == null ? void 0 : u.kind) === e && t.add(String(((i = n.attrs) == null ? void 0 : i.label) || "").trim()), (r = n.content) == null || r.forEach(a);
|
|
339
339
|
};
|
|
340
340
|
return a(C.value.doc), t;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function Ee(e, t) {
|
|
343
343
|
return {
|
|
344
344
|
promptKey: o.promptKey,
|
|
345
345
|
capabilityId: e,
|
|
346
|
-
requestId: `agent-prompt-${++
|
|
346
|
+
requestId: `agent-prompt-${++lt}`,
|
|
347
347
|
signal: t.signal
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
|
-
async function
|
|
351
|
-
var i, r,
|
|
352
|
-
if (
|
|
350
|
+
async function fe(e) {
|
|
351
|
+
var i, r, K;
|
|
352
|
+
if (V.value) return p("PROMPT_READONLY", "当前提示词不可编辑");
|
|
353
353
|
const t = o.promptKey;
|
|
354
354
|
let a = c.value;
|
|
355
|
-
if (a || (await
|
|
356
|
-
return
|
|
355
|
+
if (a || (await ge(), a = c.value), !a || !await a.whenReady() || t !== o.promptKey)
|
|
356
|
+
return p("EDITOR_UNAVAILABLE", "提示词编辑器尚未就绪");
|
|
357
357
|
if (e.type === "text")
|
|
358
|
-
return e.text ?
|
|
358
|
+
return e.text ? E(
|
|
359
359
|
() => a.insertText(e.text, e.placement, e.selectInserted),
|
|
360
360
|
"api"
|
|
361
|
-
) ? B() :
|
|
361
|
+
) ? B() : p("INSERT_FAILED", "文本插入失败") : p("EMPTY_TEXT", "插入文本不能为空");
|
|
362
362
|
if (e.type === "media") {
|
|
363
|
-
const { asset:
|
|
364
|
-
if (!g(
|
|
365
|
-
return
|
|
363
|
+
const { asset: s } = e;
|
|
364
|
+
if (!g(s.kind) || !Qe(s.url))
|
|
365
|
+
return p("MEDIA_INVALID", "媒体资源不可用");
|
|
366
366
|
const f = a.captureMediaTarget() || a.captureEndTarget();
|
|
367
|
-
if (!f) return
|
|
367
|
+
if (!f) return p("INSERT_FAILED", "无法确定媒体插入位置");
|
|
368
368
|
try {
|
|
369
|
-
const
|
|
370
|
-
return
|
|
369
|
+
const T = a.insertMedia(s, e.name || "", f, !0);
|
|
370
|
+
return T && Me(T, "api", s.kind) ? B() : p("INSERT_FAILED", "媒体插入失败");
|
|
371
371
|
} finally {
|
|
372
372
|
f.dispose();
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
const n = e.capabilityId;
|
|
376
|
-
if (!g(n)) return
|
|
376
|
+
if (!g(n)) return p("CAPABILITY_DISABLED", "当前功能不可用");
|
|
377
377
|
const { option: l } = e;
|
|
378
378
|
if (n === "originalReply")
|
|
379
|
-
return
|
|
379
|
+
return E(() => a.insertOriginal(), "api", n) ? B() : p("INSERT_FAILED", "原话复述插入失败");
|
|
380
380
|
if (n === "separator")
|
|
381
|
-
return
|
|
381
|
+
return E(() => a.insertSeparator(), "api", n) ? B() : p("INSERT_FAILED", "分隔符插入失败");
|
|
382
382
|
if (n === "smallPayment") {
|
|
383
|
-
const
|
|
384
|
-
return !Number.isInteger(
|
|
383
|
+
const s = Number((i = l == null ? void 0 : l.params) == null ? void 0 : i.amount);
|
|
384
|
+
return !Number.isInteger(s) || s < 1 || s > 99 ? p("PAYMENT_INVALID", "小额打款金额必须为 1–99 整数元") : E(
|
|
385
385
|
() => a.upsertToken("tool", "small_payment", "小额打款", {
|
|
386
|
-
amount: String(
|
|
386
|
+
amount: String(s)
|
|
387
387
|
}),
|
|
388
388
|
"api",
|
|
389
389
|
n
|
|
390
|
-
) ? B() :
|
|
390
|
+
) ? B() : p("PAYMENT_INVALID", "小额打款金额必须为 1–99 整数元");
|
|
391
391
|
}
|
|
392
|
-
if (!((r = l == null ? void 0 : l.label) != null && r.trim()) || !((
|
|
393
|
-
return
|
|
392
|
+
if (!((r = l == null ? void 0 : l.label) != null && r.trim()) || !((K = l.id) != null && K.trim()))
|
|
393
|
+
return p("OPTION_INVALID", "请选择有效的功能选项");
|
|
394
394
|
if (n === "tableKnowledge" || n === "sizeChart") {
|
|
395
|
-
const
|
|
395
|
+
const s = qe("tableKnowledge"), f = qe("agentSizeChart");
|
|
396
396
|
if (n === "tableKnowledge") {
|
|
397
397
|
if (f.size)
|
|
398
|
-
return
|
|
399
|
-
if (!
|
|
400
|
-
return
|
|
398
|
+
return p("TABLE_SIZE_CONFLICT", "表格知识与尺码表不能同时引用");
|
|
399
|
+
if (!s.has(l.label) && s.size >= 5)
|
|
400
|
+
return p("TABLE_LIMIT", "最多引用 5 个表格知识");
|
|
401
401
|
} else {
|
|
402
|
-
if (
|
|
403
|
-
return
|
|
402
|
+
if (s.size)
|
|
403
|
+
return p("TABLE_SIZE_CONFLICT", "表格知识与尺码表不能同时引用");
|
|
404
404
|
if (!f.has(l.label) && f.size >= 4)
|
|
405
|
-
return
|
|
405
|
+
return p("SIZE_LIMIT", "最多引用 4 个尺码表");
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
|
-
return
|
|
408
|
+
return E(
|
|
409
409
|
() => n === "sizeChart" ? a.insertInlineNode("agentSizeChart", {
|
|
410
410
|
name: l.label.trim()
|
|
411
411
|
}) : a.insertToken(
|
|
@@ -417,11 +417,11 @@ const Ft = {
|
|
|
417
417
|
),
|
|
418
418
|
"api",
|
|
419
419
|
n
|
|
420
|
-
) ? B() :
|
|
420
|
+
) ? B() : p("INSERT_FAILED", "功能内容插入失败");
|
|
421
421
|
}
|
|
422
422
|
async function Ue(e) {
|
|
423
|
-
var n, l,
|
|
424
|
-
if (!
|
|
423
|
+
var n, l, u, i;
|
|
424
|
+
if (!ke(e)) return;
|
|
425
425
|
A == null || A.abort(), h.value = e, ie.value = [];
|
|
426
426
|
const t = new AbortController();
|
|
427
427
|
A = t, R.add(t), Z.value++, re.value = !0, te();
|
|
@@ -430,11 +430,11 @@ const Ft = {
|
|
|
430
430
|
const r = e === "variable" ? await ((l = (n = o.ports) == null ? void 0 : n.listVariables) == null ? void 0 : l.call(
|
|
431
431
|
n,
|
|
432
432
|
{ search: W.value, limit: 50 },
|
|
433
|
-
|
|
434
|
-
)) : await ((i = (
|
|
435
|
-
|
|
433
|
+
Ee(e, t)
|
|
434
|
+
)) : await ((i = (u = o.ports) == null ? void 0 : u.listCapabilityOptions) == null ? void 0 : i.call(
|
|
435
|
+
u,
|
|
436
436
|
{ capabilityId: e, search: W.value, limit: 50 },
|
|
437
|
-
|
|
437
|
+
Ee(e, t)
|
|
438
438
|
));
|
|
439
439
|
if (t.signal.aborted || a !== o.promptKey || h.value !== e)
|
|
440
440
|
return;
|
|
@@ -449,12 +449,12 @@ const Ft = {
|
|
|
449
449
|
A === t && (A = null, re.value = !1), R.delete(t) && (Z.value = Math.max(0, Z.value - 1), te());
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
452
|
+
function dt(e) {
|
|
453
|
+
ke(e) && (W.value = "", Ue(e));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function pt(e) {
|
|
456
456
|
const t = h.value;
|
|
457
|
-
t && (A == null || A.abort(), h.value = null,
|
|
457
|
+
t && (A == null || A.abort(), h.value = null, fe({
|
|
458
458
|
type: "capability",
|
|
459
459
|
capabilityId: t,
|
|
460
460
|
option: {
|
|
@@ -464,29 +464,29 @@ const Ft = {
|
|
|
464
464
|
}
|
|
465
465
|
}));
|
|
466
466
|
}
|
|
467
|
-
function
|
|
468
|
-
|
|
467
|
+
function z() {
|
|
468
|
+
S.value = null, P.value = null, se.value = !1, w == null || w.dispose(), w = null;
|
|
469
469
|
}
|
|
470
|
-
$(() => o.mediaSources,
|
|
471
|
-
function
|
|
472
|
-
var
|
|
473
|
-
const a =
|
|
474
|
-
(
|
|
475
|
-
var
|
|
476
|
-
return
|
|
470
|
+
$(() => o.mediaSources, z, { deep: !0 });
|
|
471
|
+
function ft(e, t) {
|
|
472
|
+
var u, i, r;
|
|
473
|
+
const a = be(o.mediaSources, e).filter(
|
|
474
|
+
(K) => {
|
|
475
|
+
var s;
|
|
476
|
+
return K !== "local" || !!((s = o.ports) != null && s.uploadMedia);
|
|
477
477
|
}
|
|
478
478
|
);
|
|
479
479
|
if (!g(e) || !a.length) return;
|
|
480
|
-
if (
|
|
480
|
+
if (at(e), w = ((u = c.value) == null ? void 0 : u.captureMediaTarget()) || ((i = c.value) == null ? void 0 : i.captureEndTarget()) || null, !w) {
|
|
481
481
|
m("EDITOR_UNAVAILABLE", "无法确定媒体插入位置");
|
|
482
482
|
return;
|
|
483
483
|
}
|
|
484
484
|
if (a.length === 1) {
|
|
485
|
-
|
|
485
|
+
Ye(e, a[0]);
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
const n = t.currentTarget.getBoundingClientRect(), l = (r = oe.value) == null ? void 0 : r.getBoundingClientRect();
|
|
489
|
-
|
|
489
|
+
Pe.value = {
|
|
490
490
|
left: `${Math.max(
|
|
491
491
|
8,
|
|
492
492
|
Math.min(
|
|
@@ -495,35 +495,44 @@ const Ft = {
|
|
|
495
495
|
)
|
|
496
496
|
)}px`,
|
|
497
497
|
top: `${n.bottom - ((l == null ? void 0 : l.top) || 0) + 4}px`
|
|
498
|
-
},
|
|
498
|
+
}, S.value = e;
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
if (
|
|
502
|
-
P.value = e;
|
|
500
|
+
function Ye(e, t) {
|
|
501
|
+
if (S.value = null, t === "online" || t === "qianniu") {
|
|
502
|
+
se.value = t === "qianniu", P.value = e;
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
505
505
|
ue.value && (ue.value.accept = e === "image" ? "image/png,image/jpeg" : "video/mp4", ue.value.click());
|
|
506
506
|
}
|
|
507
|
-
function
|
|
508
|
-
const t =
|
|
509
|
-
t &&
|
|
507
|
+
function vt(e) {
|
|
508
|
+
const t = S.value;
|
|
509
|
+
t && Ye(t, e);
|
|
510
510
|
}
|
|
511
|
-
function
|
|
512
|
-
var
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
511
|
+
function He(e, t) {
|
|
512
|
+
var l;
|
|
513
|
+
const a = P.value, n = w;
|
|
514
|
+
if (w = null, P.value = null, se.value = !1, !(!a || !n))
|
|
515
515
|
try {
|
|
516
|
-
if (!g(
|
|
516
|
+
if (!g(a) || n.status() !== "ready") {
|
|
517
517
|
m("INSERT_TARGET_LOST", "媒体插入位置已失效");
|
|
518
518
|
return;
|
|
519
519
|
}
|
|
520
|
-
const
|
|
521
|
-
|
|
520
|
+
const u = (l = c.value) == null ? void 0 : l.insertMedia(
|
|
521
|
+
{
|
|
522
|
+
kind: a,
|
|
523
|
+
url: e,
|
|
524
|
+
...t ? { id: t, sourceType: "qianniuVideo" } : {}
|
|
525
|
+
},
|
|
526
|
+
"",
|
|
527
|
+
n,
|
|
528
|
+
!0
|
|
529
|
+
);
|
|
530
|
+
(!u || !Me(u, "api", a)) && m("INSERT_FAILED", "在线媒体插入失败");
|
|
522
531
|
} finally {
|
|
523
|
-
|
|
532
|
+
n.dispose();
|
|
524
533
|
}
|
|
525
534
|
}
|
|
526
|
-
function
|
|
535
|
+
function mt() {
|
|
527
536
|
if (!g("smallPayment")) return;
|
|
528
537
|
X.value = null;
|
|
529
538
|
const e = (t) => {
|
|
@@ -532,8 +541,8 @@ const Ft = {
|
|
|
532
541
|
};
|
|
533
542
|
e(C.value.doc), k.value = !0, h.value = null;
|
|
534
543
|
}
|
|
535
|
-
async function
|
|
536
|
-
(await
|
|
544
|
+
async function gt() {
|
|
545
|
+
(await fe({
|
|
537
546
|
type: "capability",
|
|
538
547
|
capabilityId: "smallPayment",
|
|
539
548
|
option: {
|
|
@@ -543,30 +552,30 @@ const Ft = {
|
|
|
543
552
|
}
|
|
544
553
|
})).ok && (k.value = !1);
|
|
545
554
|
}
|
|
546
|
-
function
|
|
547
|
-
var
|
|
548
|
-
if (!e.length || e.length >
|
|
549
|
-
t == null || t.dispose(), m("INVALID_MEDIA", `一次最多添加 ${
|
|
555
|
+
function Te(e, t) {
|
|
556
|
+
var u;
|
|
557
|
+
if (!e.length || e.length > je) {
|
|
558
|
+
t == null || t.dispose(), m("INVALID_MEDIA", `一次最多添加 ${je} 个媒体文件`);
|
|
550
559
|
return;
|
|
551
560
|
}
|
|
552
561
|
const a = e.map((i) => {
|
|
553
562
|
var r;
|
|
554
563
|
return {
|
|
555
564
|
file: i,
|
|
556
|
-
kind: (r =
|
|
565
|
+
kind: (r = Nt(i)) == null ? void 0 : r.kind
|
|
557
566
|
};
|
|
558
567
|
});
|
|
559
568
|
if (a.some(
|
|
560
|
-
({ file: i, kind: r }) => !r || !g(r) || i.size >
|
|
569
|
+
({ file: i, kind: r }) => !r || !g(r) || i.size > Pt[r]
|
|
561
570
|
)) {
|
|
562
571
|
t == null || t.dispose(), m("INVALID_MEDIA", "仅支持符合大小限制的 JPG、PNG、MP4 文件");
|
|
563
572
|
return;
|
|
564
573
|
}
|
|
565
|
-
if (!((
|
|
574
|
+
if (!((u = o.ports) != null && u.uploadMedia) || !t || !c.value) {
|
|
566
575
|
t == null || t.dispose(), m("UPLOAD_UNAVAILABLE", "上传功能不可用");
|
|
567
576
|
return;
|
|
568
577
|
}
|
|
569
|
-
const n = a, l =
|
|
578
|
+
const n = a, l = E(
|
|
570
579
|
() => {
|
|
571
580
|
var i;
|
|
572
581
|
return ((i = c.value) == null ? void 0 : i.insertPendingMediaBatch(n, t)) || null;
|
|
@@ -579,29 +588,29 @@ const Ft = {
|
|
|
579
588
|
return;
|
|
580
589
|
}
|
|
581
590
|
l.forEach((i, r) => {
|
|
582
|
-
|
|
591
|
+
ce.set(i, n[r].file), Je(i, n[r].file, n[r].kind);
|
|
583
592
|
});
|
|
584
593
|
}
|
|
585
|
-
async function
|
|
586
|
-
var i, r,
|
|
594
|
+
async function Je(e, t, a) {
|
|
595
|
+
var i, r, K;
|
|
587
596
|
const n = (i = o.ports) == null ? void 0 : i.uploadMedia;
|
|
588
597
|
if (!n) return;
|
|
589
598
|
const l = new AbortController();
|
|
590
599
|
R.add(l), G.value++, te();
|
|
591
|
-
const
|
|
600
|
+
const u = o.promptKey;
|
|
592
601
|
try {
|
|
593
|
-
const
|
|
594
|
-
if (l.signal.aborted ||
|
|
602
|
+
const s = await n({ file: t, kind: a }, Ee(a, l));
|
|
603
|
+
if (l.signal.aborted || u !== o.promptKey) return;
|
|
595
604
|
const f = (r = c.value) == null ? void 0 : r.getMediaState(e);
|
|
596
605
|
if (!f || f.status !== "uploading") return;
|
|
597
|
-
if (!
|
|
606
|
+
if (!s.ok || !Qe(s.data.url) || s.data.kind !== a) {
|
|
598
607
|
m(
|
|
599
608
|
"UPLOAD_FAILED",
|
|
600
|
-
|
|
601
|
-
),
|
|
609
|
+
s.ok ? "上传资源无效" : s.error.message
|
|
610
|
+
), E(
|
|
602
611
|
() => {
|
|
603
|
-
var
|
|
604
|
-
return (
|
|
612
|
+
var T;
|
|
613
|
+
return (T = c.value) == null ? void 0 : T.failMedia(e, "上传失败", f.nodeVersion);
|
|
605
614
|
},
|
|
606
615
|
"plugin",
|
|
607
616
|
a
|
|
@@ -609,31 +618,31 @@ const Ft = {
|
|
|
609
618
|
return;
|
|
610
619
|
}
|
|
611
620
|
if (!g(a)) {
|
|
612
|
-
|
|
621
|
+
E(
|
|
613
622
|
() => {
|
|
614
|
-
var
|
|
615
|
-
return (
|
|
623
|
+
var T;
|
|
624
|
+
return (T = c.value) == null ? void 0 : T.failMedia(e, "当前无媒体权限", f.nodeVersion);
|
|
616
625
|
},
|
|
617
626
|
"plugin",
|
|
618
627
|
a
|
|
619
628
|
);
|
|
620
629
|
return;
|
|
621
630
|
}
|
|
622
|
-
|
|
631
|
+
E(
|
|
623
632
|
() => {
|
|
624
|
-
var
|
|
625
|
-
return ((
|
|
633
|
+
var T;
|
|
634
|
+
return ((T = c.value) == null ? void 0 : T.completeMedia(e, f.nodeVersion, s.data)) || !1;
|
|
626
635
|
},
|
|
627
636
|
"plugin",
|
|
628
637
|
a
|
|
629
|
-
) &&
|
|
638
|
+
) && ce.delete(e);
|
|
630
639
|
} catch {
|
|
631
640
|
if (!l.signal.aborted) {
|
|
632
|
-
const
|
|
633
|
-
(
|
|
641
|
+
const s = (K = c.value) == null ? void 0 : K.getMediaState(e);
|
|
642
|
+
(s == null ? void 0 : s.status) === "uploading" && E(
|
|
634
643
|
() => {
|
|
635
644
|
var f;
|
|
636
|
-
return (f = c.value) == null ? void 0 : f.failMedia(e, "上传失败",
|
|
645
|
+
return (f = c.value) == null ? void 0 : f.failMedia(e, "上传失败", s.nodeVersion);
|
|
637
646
|
},
|
|
638
647
|
"plugin",
|
|
639
648
|
a
|
|
@@ -643,73 +652,73 @@ const Ft = {
|
|
|
643
652
|
R.delete(l) && (G.value = Math.max(0, G.value - 1), te());
|
|
644
653
|
}
|
|
645
654
|
}
|
|
646
|
-
function
|
|
655
|
+
function bt(e) {
|
|
647
656
|
var n;
|
|
648
|
-
const t =
|
|
649
|
-
!t || !a || a.status !== "error" || !g(a.kind) ||
|
|
657
|
+
const t = ce.get(e), a = (n = c.value) == null ? void 0 : n.getMediaState(e);
|
|
658
|
+
!t || !a || a.status !== "error" || !g(a.kind) || E(
|
|
650
659
|
() => {
|
|
651
660
|
var l;
|
|
652
661
|
return (l = c.value) == null ? void 0 : l.retryMedia(e, a.nodeVersion);
|
|
653
662
|
},
|
|
654
663
|
"plugin",
|
|
655
664
|
a.kind
|
|
656
|
-
) &&
|
|
665
|
+
) && Je(e, t, a.kind);
|
|
657
666
|
}
|
|
658
|
-
async function
|
|
659
|
-
var n, l,
|
|
667
|
+
async function yt(e) {
|
|
668
|
+
var n, l, u;
|
|
660
669
|
const t = Array.from(e.target.files || []);
|
|
661
670
|
e.target.value = "";
|
|
662
|
-
const a =
|
|
663
|
-
if (
|
|
671
|
+
const a = w;
|
|
672
|
+
if (w = null, t.length) {
|
|
664
673
|
const i = o.promptKey;
|
|
665
674
|
if (!await ((n = c.value) == null ? void 0 : n.whenReady()) || i !== o.promptKey) {
|
|
666
675
|
a == null || a.dispose();
|
|
667
676
|
return;
|
|
668
677
|
}
|
|
669
|
-
const r = a || ((l = c.value) == null ? void 0 : l.captureMediaTarget()) || ((
|
|
670
|
-
|
|
678
|
+
const r = a || ((l = c.value) == null ? void 0 : l.captureMediaTarget()) || ((u = c.value) == null ? void 0 : u.captureEndTarget());
|
|
679
|
+
Te(t, r || null);
|
|
671
680
|
} else a == null || a.dispose();
|
|
672
681
|
}
|
|
673
|
-
function
|
|
674
|
-
var n, l,
|
|
682
|
+
function ht(e) {
|
|
683
|
+
var n, l, u, i;
|
|
675
684
|
const t = Array.from(((n = e.clipboardData) == null ? void 0 : n.files) || []);
|
|
676
|
-
if (!t.length ||
|
|
685
|
+
if (!t.length || V.value) return;
|
|
677
686
|
e.preventDefault();
|
|
678
|
-
const a = ((l = c.value) == null ? void 0 : l.pasteClipboardContent(e)) || ((
|
|
679
|
-
a &&
|
|
687
|
+
const a = ((l = c.value) == null ? void 0 : l.pasteClipboardContent(e)) || ((u = c.value) == null ? void 0 : u.captureMediaTarget()) || ((i = c.value) == null ? void 0 : i.captureEndTarget());
|
|
688
|
+
a && Te(t, a);
|
|
680
689
|
}
|
|
681
|
-
function
|
|
682
|
-
var n, l,
|
|
690
|
+
function At(e) {
|
|
691
|
+
var n, l, u;
|
|
683
692
|
const t = Array.from(((n = e.dataTransfer) == null ? void 0 : n.files) || []);
|
|
684
|
-
if (!t.length ||
|
|
693
|
+
if (!t.length || V.value) return;
|
|
685
694
|
e.preventDefault();
|
|
686
|
-
const a = ((l = c.value) == null ? void 0 : l.captureMediaTargetAt(e.clientX, e.clientY)) || ((
|
|
687
|
-
a &&
|
|
695
|
+
const a = ((l = c.value) == null ? void 0 : l.captureMediaTargetAt(e.clientX, e.clientY)) || ((u = c.value) == null ? void 0 : u.captureEndTarget());
|
|
696
|
+
a && Te(t, a);
|
|
688
697
|
}
|
|
689
|
-
function
|
|
698
|
+
function kt() {
|
|
690
699
|
return xt(C.value, o.maxLength);
|
|
691
700
|
}
|
|
692
701
|
return _({
|
|
693
|
-
insertContent:
|
|
702
|
+
insertContent: fe,
|
|
694
703
|
focus: () => {
|
|
695
704
|
var e;
|
|
696
705
|
return (e = c.value) == null ? void 0 : e.focus();
|
|
697
706
|
},
|
|
698
|
-
validate:
|
|
707
|
+
validate: kt
|
|
699
708
|
}), (e, t) => (v(), b("section", {
|
|
700
709
|
ref_key: "root",
|
|
701
710
|
ref: oe,
|
|
702
|
-
class:
|
|
703
|
-
"has-open-menu": !!h.value || k.value ||
|
|
711
|
+
class: Lt(["fkp-rich-text fkp-agent-prompt-editor", {
|
|
712
|
+
"has-open-menu": !!h.value || k.value || M.value || !!S.value
|
|
704
713
|
}]),
|
|
705
714
|
"aria-label": "Agent 提示词编辑器",
|
|
706
|
-
onKeydown: t[
|
|
707
|
-
F(), k.value = !1,
|
|
715
|
+
onKeydown: t[11] || (t[11] = Tt(ae((a) => {
|
|
716
|
+
F(), k.value = !1, M.value = !1, z();
|
|
708
717
|
}, ["stop"]), ["esc"]))
|
|
709
718
|
}, [
|
|
710
719
|
y("div", {
|
|
711
720
|
ref_key: "toolbar",
|
|
712
|
-
ref:
|
|
721
|
+
ref: ye,
|
|
713
722
|
class: "fkp-scene-toolbar fkp-agent-prompt-toolbar",
|
|
714
723
|
role: "toolbar",
|
|
715
724
|
"aria-label": "提示词工具栏"
|
|
@@ -719,33 +728,33 @@ const Ft = {
|
|
|
719
728
|
ref: H,
|
|
720
729
|
class: "fkp-toolbar-groups fkp-agent-prompt-toolbar-left"
|
|
721
730
|
}, [
|
|
722
|
-
(v(!0), b(
|
|
731
|
+
(v(!0), b(ve, null, Le(ze.value, (a, n) => (v(), b(ve, {
|
|
723
732
|
key: a.id
|
|
724
733
|
}, [
|
|
725
|
-
n > 0 && a.group !== ze.value[n - 1].group ? (v(), b("span",
|
|
726
|
-
|
|
734
|
+
n > 0 && a.group !== ze.value[n - 1].group ? (v(), b("span", Bt)) : q("", !0),
|
|
735
|
+
x(I(St), {
|
|
727
736
|
trigger: "hover",
|
|
728
737
|
position: "bottom",
|
|
729
738
|
content: a.label,
|
|
730
|
-
"popup-visible":
|
|
739
|
+
"popup-visible": I(tt) === a.id || a.id === "video" && I(be)(e.mediaSources, "video").includes("qianniu") || S.value === a.id || P.value === a.id ? !1 : void 0
|
|
731
740
|
}, {
|
|
732
|
-
default:
|
|
733
|
-
|
|
741
|
+
default: me(() => [
|
|
742
|
+
x(I(Ce), {
|
|
734
743
|
class: "fkp-tool-button fkp-agent-prompt-tool",
|
|
735
744
|
type: "text",
|
|
736
745
|
"data-fkp-menu-trigger": a.id,
|
|
737
746
|
"aria-label": a.label,
|
|
738
|
-
disabled: !
|
|
739
|
-
onMouseenter: (l) =>
|
|
747
|
+
disabled: !Ie(a.id),
|
|
748
|
+
onMouseenter: (l) => I(nt)(
|
|
740
749
|
a.id,
|
|
741
|
-
!!
|
|
750
|
+
!!S.value || !!P.value
|
|
742
751
|
),
|
|
743
752
|
onMousedown: t[0] || (t[0] = ae(() => {
|
|
744
753
|
}, ["prevent"])),
|
|
745
754
|
onClick: (l) => xe(a.id, l)
|
|
746
755
|
}, {
|
|
747
|
-
default:
|
|
748
|
-
|
|
756
|
+
default: me(() => [
|
|
757
|
+
x(I(Se), {
|
|
749
758
|
name: a.icon,
|
|
750
759
|
size: 16
|
|
751
760
|
}, null, 8, ["name"])
|
|
@@ -757,87 +766,89 @@ const Ft = {
|
|
|
757
766
|
}, 1032, ["content", "popup-visible"])
|
|
758
767
|
], 64))), 128))
|
|
759
768
|
], 512),
|
|
760
|
-
|
|
761
|
-
|
|
769
|
+
Ae.value.length ? (v(), b("div", $t, [
|
|
770
|
+
x(I(Ce), {
|
|
762
771
|
class: "fkp-more-button",
|
|
763
772
|
type: "text",
|
|
764
773
|
"aria-label": "更多操作",
|
|
765
774
|
"aria-haspopup": "menu",
|
|
766
|
-
"aria-expanded":
|
|
775
|
+
"aria-expanded": M.value,
|
|
767
776
|
onMousedown: t[1] || (t[1] = ae(() => {
|
|
768
777
|
}, ["prevent"])),
|
|
769
|
-
onClick: t[2] || (t[2] = (a) =>
|
|
778
|
+
onClick: t[2] || (t[2] = (a) => M.value = !M.value)
|
|
770
779
|
}, {
|
|
771
|
-
default:
|
|
772
|
-
|
|
780
|
+
default: me(() => [
|
|
781
|
+
x(I(Se), {
|
|
773
782
|
name: "more",
|
|
774
783
|
size: 16
|
|
775
784
|
})
|
|
776
785
|
]),
|
|
777
786
|
_: 1
|
|
778
787
|
}, 8, ["aria-expanded"]),
|
|
779
|
-
|
|
780
|
-
(v(!0), b(
|
|
788
|
+
M.value ? (v(), b("div", qt, [
|
|
789
|
+
(v(!0), b(ve, null, Le(Ae.value, (a) => (v(), We(I(Ce), {
|
|
781
790
|
key: a.id,
|
|
782
791
|
class: "fkp-agent-prompt-more-item",
|
|
783
792
|
type: "text",
|
|
784
793
|
role: "menuitem",
|
|
785
794
|
"data-fkp-menu-trigger": a.id,
|
|
786
|
-
disabled: !
|
|
795
|
+
disabled: !Ie(a.id),
|
|
787
796
|
onMousedown: t[3] || (t[3] = ae(() => {
|
|
788
797
|
}, ["prevent"])),
|
|
789
798
|
onClick: (n) => xe(a.id, n)
|
|
790
799
|
}, {
|
|
791
|
-
default:
|
|
792
|
-
|
|
800
|
+
default: me(() => [
|
|
801
|
+
x(I(Se), {
|
|
793
802
|
name: a.icon,
|
|
794
803
|
size: 16
|
|
795
804
|
}, null, 8, ["name"]),
|
|
796
|
-
|
|
805
|
+
_e(U(a.label), 1)
|
|
797
806
|
]),
|
|
798
807
|
_: 2
|
|
799
808
|
}, 1032, ["data-fkp-menu-trigger", "disabled", "onClick"]))), 128))
|
|
800
|
-
])) :
|
|
801
|
-
])) :
|
|
809
|
+
])) : q("", !0)
|
|
810
|
+
])) : q("", !0),
|
|
802
811
|
y("div", Ut, [
|
|
803
|
-
|
|
812
|
+
_t(e.$slots, "toolbar-action")
|
|
804
813
|
]),
|
|
805
814
|
y("input", {
|
|
806
815
|
ref_key: "fileInput",
|
|
807
816
|
ref: ue,
|
|
808
817
|
type: "file",
|
|
809
818
|
hidden: "",
|
|
810
|
-
onChange:
|
|
819
|
+
onChange: yt
|
|
811
820
|
}, null, 544)
|
|
812
821
|
], 512),
|
|
813
|
-
|
|
814
|
-
"menu-kind":
|
|
822
|
+
x(Dt, {
|
|
823
|
+
"menu-kind": S.value,
|
|
815
824
|
"dialog-kind": P.value,
|
|
816
|
-
"
|
|
817
|
-
|
|
825
|
+
"qianniu-dialog": se.value,
|
|
826
|
+
"menu-style": Pe.value,
|
|
827
|
+
sources: S.value ? I(be)(e.mediaSources, S.value).filter(
|
|
818
828
|
(a) => {
|
|
819
829
|
var n;
|
|
820
|
-
return a
|
|
830
|
+
return a !== "local" || !!((n = e.ports) != null && n.uploadMedia);
|
|
821
831
|
}
|
|
822
832
|
) : [],
|
|
823
|
-
onChoose:
|
|
824
|
-
onSubmit:
|
|
825
|
-
|
|
826
|
-
|
|
833
|
+
onChoose: vt,
|
|
834
|
+
onSubmit: He,
|
|
835
|
+
onSubmitQianniu: t[4] || (t[4] = ({ id: a, url: n }) => He(n, a)),
|
|
836
|
+
onClose: z
|
|
837
|
+
}, null, 8, ["menu-kind", "dialog-kind", "qianniu-dialog", "menu-style", "sources"]),
|
|
827
838
|
h.value ? (v(), b("div", {
|
|
828
839
|
key: 0,
|
|
829
840
|
class: "fkp-agent-prompt-options",
|
|
830
|
-
style:
|
|
841
|
+
style: Ct({ left: `${Ne.value}px` })
|
|
831
842
|
}, [
|
|
832
843
|
y("label", null, [
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
"onUpdate:modelValue": t[
|
|
844
|
+
_e(" 搜索" + U(Ke.value) + " ", 1),
|
|
845
|
+
Xe(y("input", {
|
|
846
|
+
"onUpdate:modelValue": t[5] || (t[5] = (a) => W.value = a),
|
|
836
847
|
type: "search",
|
|
837
|
-
"aria-label": `搜索${
|
|
838
|
-
onInput: t[
|
|
839
|
-
}, null, 40,
|
|
840
|
-
[
|
|
848
|
+
"aria-label": `搜索${Ke.value}`,
|
|
849
|
+
onInput: t[6] || (t[6] = (a) => Ue(h.value))
|
|
850
|
+
}, null, 40, Yt), [
|
|
851
|
+
[Ge, W.value]
|
|
841
852
|
])
|
|
842
853
|
]),
|
|
843
854
|
y("button", {
|
|
@@ -845,32 +856,32 @@ const Ft = {
|
|
|
845
856
|
"aria-label": "关闭选项",
|
|
846
857
|
onClick: F
|
|
847
858
|
}, "×"),
|
|
848
|
-
re.value ? (v(), b("p",
|
|
849
|
-
(v(!0), b(
|
|
859
|
+
re.value ? (v(), b("p", Ht, "加载中…")) : (v(), b("ul", Jt, [
|
|
860
|
+
(v(!0), b(ve, null, Le(ie.value, (a) => (v(), b("li", {
|
|
850
861
|
key: a.id
|
|
851
862
|
}, [
|
|
852
863
|
y("button", {
|
|
853
864
|
type: "button",
|
|
854
865
|
disabled: a.disabled,
|
|
855
|
-
onMousedown: t[
|
|
866
|
+
onMousedown: t[7] || (t[7] = ae(() => {
|
|
856
867
|
}, ["prevent"])),
|
|
857
|
-
onClick: (n) =>
|
|
858
|
-
},
|
|
868
|
+
onClick: (n) => pt(a)
|
|
869
|
+
}, U(a.label), 41, Wt)
|
|
859
870
|
]))), 128))
|
|
860
871
|
]))
|
|
861
|
-
], 4)) :
|
|
862
|
-
k.value ? (v(), b("div",
|
|
872
|
+
], 4)) : q("", !0),
|
|
873
|
+
k.value ? (v(), b("div", Xt, [
|
|
863
874
|
y("label", null, [
|
|
864
|
-
t[
|
|
865
|
-
|
|
866
|
-
"onUpdate:modelValue": t[
|
|
875
|
+
t[12] || (t[12] = _e(" 小额打款金额(元) ")),
|
|
876
|
+
Xe(y("input", {
|
|
877
|
+
"onUpdate:modelValue": t[8] || (t[8] = (a) => X.value = a),
|
|
867
878
|
type: "number",
|
|
868
879
|
min: "1",
|
|
869
880
|
max: "99",
|
|
870
881
|
step: "1"
|
|
871
882
|
}, null, 512), [
|
|
872
883
|
[
|
|
873
|
-
|
|
884
|
+
Ge,
|
|
874
885
|
X.value,
|
|
875
886
|
void 0,
|
|
876
887
|
{ number: !0 }
|
|
@@ -879,39 +890,39 @@ const Ft = {
|
|
|
879
890
|
]),
|
|
880
891
|
y("button", {
|
|
881
892
|
type: "button",
|
|
882
|
-
onClick: t[
|
|
893
|
+
onClick: t[9] || (t[9] = (a) => k.value = !1)
|
|
883
894
|
}, "取消"),
|
|
884
895
|
y("button", {
|
|
885
896
|
type: "button",
|
|
886
|
-
onClick:
|
|
897
|
+
onClick: gt
|
|
887
898
|
}, "确认")
|
|
888
|
-
])) :
|
|
889
|
-
O.value ? (v(), b("p",
|
|
890
|
-
(v(),
|
|
899
|
+
])) : q("", !0),
|
|
900
|
+
O.value ? (v(), b("p", Gt, "提示词文档无效:" + U(O.value), 1)) : q("", !0),
|
|
901
|
+
(v(), We(Ot, {
|
|
891
902
|
key: e.promptKey,
|
|
892
903
|
ref_key: "area",
|
|
893
904
|
ref: c,
|
|
894
905
|
"model-value": C.value.doc,
|
|
895
|
-
editable: !
|
|
906
|
+
editable: !V.value,
|
|
896
907
|
placeholder: e.placeholder,
|
|
897
|
-
"schema-plan":
|
|
898
|
-
"paste-capabilities":
|
|
899
|
-
"document-adapter":
|
|
900
|
-
"onUpdate:modelValue":
|
|
901
|
-
onLoadError: t[
|
|
902
|
-
onRetryMedia:
|
|
903
|
-
onPasteCapture:
|
|
904
|
-
onDropCapture:
|
|
908
|
+
"schema-plan": rt,
|
|
909
|
+
"paste-capabilities": ut.value,
|
|
910
|
+
"document-adapter": I(it),
|
|
911
|
+
"onUpdate:modelValue": ct,
|
|
912
|
+
onLoadError: t[10] || (t[10] = (a) => m("EDITOR_LOAD_FAILED", a)),
|
|
913
|
+
onRetryMedia: bt,
|
|
914
|
+
onPasteCapture: ht,
|
|
915
|
+
onDropCapture: At
|
|
905
916
|
}, null, 8, ["model-value", "editable", "placeholder", "paste-capabilities", "document-adapter"])),
|
|
906
|
-
y("div",
|
|
907
|
-
y("span", null,
|
|
917
|
+
y("div", Zt, [
|
|
918
|
+
y("span", null, U(st.value) + "/" + U(e.maxLength), 1)
|
|
908
919
|
])
|
|
909
920
|
], 34));
|
|
910
921
|
}
|
|
911
922
|
});
|
|
912
923
|
export {
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
924
|
+
ia as FkpAgentPromptEditor,
|
|
925
|
+
ia as default,
|
|
926
|
+
Kt as emptyAgentPrompt,
|
|
916
927
|
xt as validateAgentPrompt
|
|
917
928
|
};
|