@freecallai/pro 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +16 -2
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +4115 -0
- package/dist/KnowledgeArea-OPR7smbt.js +923 -0
- package/dist/ToolForm-CWpUIVTl.js +185 -0
- package/dist/choice-DDg5gNtS.js +29 -0
- package/dist/guard-BCatAeT4.js +749 -0
- package/dist/index-5a9mHHzg.js +41 -0
- package/dist/index-BsQLwz91.js +5 -0
- package/dist/index-CJlAseSN.js +15 -0
- package/dist/index-CzpY61Qj.js +6 -0
- package/dist/index-D8bcFtWR.js +6 -0
- package/dist/index-DOEijEGU.js +49 -0
- package/dist/index-DSgEWJGP.js +6 -0
- package/dist/index-DxxX09iY.js +6 -0
- package/dist/index-nnvfy5q0.js +31 -0
- package/dist/index-urNonkMH.js +6 -0
- package/dist/index-xAjlBylT.js +5 -0
- package/dist/index.js +16 -0
- package/dist/inline-TT_dl8Y3.js +17 -0
- package/dist/knowledge-BZCmalF_.js +6 -0
- package/dist/knowledge-DnYGicjn.js +13 -0
- package/dist/media-extensions-ZoxmhIhH.js +276 -0
- package/dist/media-migration-CGOFwdYm.js +59 -0
- package/dist/media-upload-Dx45yv6a.js +69 -0
- package/dist/operations-JgnjGx3H.js +19 -0
- package/dist/question-D1--acV8.js +10 -0
- package/dist/question-DGC6JHy5.js +6 -0
- package/dist/rich-text/index.js +224 -0
- package/dist/rich-text/legacy-converter/index.js +485 -0
- package/dist/selection-state-D47jhx0U.js +20 -0
- package/dist/state-KfOqha3d.js +16 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +242 -0
- package/dist/types/rich-text/MediaView.vue.d.ts +92 -0
- package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +35 -0
- package/dist/types/rich-text/config/catalog.d.ts +3 -0
- package/dist/types/rich-text/config/descriptor.d.ts +58 -0
- package/dist/types/rich-text/config/media-options.d.ts +6 -0
- package/dist/types/rich-text/config/resolve.d.ts +17 -0
- package/dist/types/rich-text/config/selection-options.d.ts +6 -0
- package/dist/types/rich-text/extensions.d.ts +6 -0
- package/dist/types/rich-text/index.d.ts +17 -0
- package/dist/types/rich-text/legacy-converter/index.d.ts +45 -0
- package/dist/types/rich-text/media-extensions.d.ts +4 -0
- package/dist/types/rich-text/media-id.d.ts +2 -0
- package/dist/types/rich-text/model/agent-context.d.ts +7 -0
- package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
- package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
- package/dist/types/rich-text/model/convert.d.ts +6 -0
- package/dist/types/rich-text/model/guard.d.ts +7 -0
- package/dist/types/rich-text/model/json-value.d.ts +2 -0
- package/dist/types/rich-text/model/media-migration.d.ts +8 -0
- package/dist/types/rich-text/model/node-contract.d.ts +10 -0
- package/dist/types/rich-text/model/node-identity.d.ts +8 -0
- package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
- package/dist/types/rich-text/model/preview.d.ts +2 -0
- package/dist/types/rich-text/model/question-text.d.ts +15 -0
- package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
- package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
- package/dist/types/rich-text/model/validate.d.ts +19 -0
- package/dist/types/rich-text/model/web-url.d.ts +2 -0
- package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/block.d.ts +3 -0
- package/dist/types/rich-text/plugins/choice.d.ts +4 -0
- package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/inline.d.ts +3 -0
- package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
- package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/operations.d.ts +86 -0
- package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/registry.d.ts +14 -0
- package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
- package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/state.d.ts +3 -0
- package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
- package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
- package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +588 -0
- package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
- package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
- package/dist/types/rich-text/runtime/media-target.d.ts +8 -0
- package/dist/types/rich-text/runtime/media-upload-session.d.ts +59 -0
- package/dist/types/rich-text/runtime/operations.d.ts +48 -0
- package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
- package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
- package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
- package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
- package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
- package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
- package/dist/types/rich-text/types.d.ts +40 -0
- package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +117 -0
- package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
- package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
- package/package.json +70 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { p as a, g as n } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js";
|
|
2
|
+
const c = {
|
|
3
|
+
id: "reasoningPolish",
|
|
4
|
+
slot: "sceneAction",
|
|
5
|
+
apiVersion: 1,
|
|
6
|
+
dataVersion: 1,
|
|
7
|
+
actions: {
|
|
8
|
+
"reasoningPolish.propose": {
|
|
9
|
+
async execute(i, e) {
|
|
10
|
+
const s = e.ports.proposeReasoning;
|
|
11
|
+
if (!s)
|
|
12
|
+
return {
|
|
13
|
+
ok: !1,
|
|
14
|
+
error: {
|
|
15
|
+
code: "UNAVAILABLE",
|
|
16
|
+
message: "宿主未提供推理润色接口",
|
|
17
|
+
retryable: !1
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const r = await s(
|
|
21
|
+
{ scene: e.scene },
|
|
22
|
+
e.request
|
|
23
|
+
), o = a(r, n);
|
|
24
|
+
return o.ok ? {
|
|
25
|
+
ok: !0,
|
|
26
|
+
data: [
|
|
27
|
+
{
|
|
28
|
+
kind: "replaceSceneDoc",
|
|
29
|
+
capabilityId: "reasoningPolish",
|
|
30
|
+
doc: o.data.proposedDoc,
|
|
31
|
+
confirmation: "应用润色后的知识内容?"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
} : o;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
c as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { b as e } from "./operations-JgnjGx3H.js";
|
|
2
|
+
const a = {
|
|
3
|
+
execute: () => [
|
|
4
|
+
{
|
|
5
|
+
kind: "insertOwnToken",
|
|
6
|
+
capabilityId: "separator",
|
|
7
|
+
key: "separator",
|
|
8
|
+
label: "分隔符",
|
|
9
|
+
token: "{分隔符}"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}, n = e("separator", "knowledgeInline", a);
|
|
13
|
+
export {
|
|
14
|
+
n as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { p as n, h as i } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js";
|
|
2
|
+
const c = {
|
|
3
|
+
id: "reasoningTemplate",
|
|
4
|
+
slot: "sceneAction",
|
|
5
|
+
apiVersion: 1,
|
|
6
|
+
dataVersion: 1,
|
|
7
|
+
actions: {
|
|
8
|
+
"reasoningTemplate.load": {
|
|
9
|
+
async execute(r, a) {
|
|
10
|
+
const { option: e } = r;
|
|
11
|
+
if (!e || typeof e.id != "string" || !e.id || typeof e.label != "string" || !e.label.trim())
|
|
12
|
+
return {
|
|
13
|
+
ok: !1,
|
|
14
|
+
error: {
|
|
15
|
+
code: "INVALID_RESPONSE",
|
|
16
|
+
message: "模板选项无效",
|
|
17
|
+
retryable: !1
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const o = a.ports.getReasoningTemplate;
|
|
21
|
+
if (!o)
|
|
22
|
+
return {
|
|
23
|
+
ok: !1,
|
|
24
|
+
error: {
|
|
25
|
+
code: "UNAVAILABLE",
|
|
26
|
+
message: "宿主未提供推理模板接口",
|
|
27
|
+
retryable: !1
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const s = await o({ templateId: e.id }, a.request), t = n(s, i);
|
|
31
|
+
return t.ok ? {
|
|
32
|
+
ok: !0,
|
|
33
|
+
data: [
|
|
34
|
+
{
|
|
35
|
+
kind: "replaceSceneDoc",
|
|
36
|
+
capabilityId: "reasoningTemplate",
|
|
37
|
+
doc: t.data.doc,
|
|
38
|
+
question: t.data.question,
|
|
39
|
+
confirmation: "使用后,将清空当前已配置内容,并添加此模板知识内容。确认使用吗?"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
} : t;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
c as default
|
|
49
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { b as i } from "./operations-JgnjGx3H.js";
|
|
2
|
+
import { m as r } from "./inline-TT_dl8Y3.js";
|
|
3
|
+
const a = {
|
|
4
|
+
execute(o, e, d) {
|
|
5
|
+
if (!e.option) return [];
|
|
6
|
+
if (!e.edit) return r.execute(o, e, d);
|
|
7
|
+
const { nodeId: n, nodeVersion: t } = e.edit;
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
kind: "updateOwnNode",
|
|
11
|
+
capabilityId: o,
|
|
12
|
+
nodeId: n,
|
|
13
|
+
expectedNodeVersion: t,
|
|
14
|
+
node: {
|
|
15
|
+
type: "businessToken",
|
|
16
|
+
attrs: {
|
|
17
|
+
id: n,
|
|
18
|
+
nodeVersion: t + 1,
|
|
19
|
+
kind: o,
|
|
20
|
+
key: e.option.id,
|
|
21
|
+
label: e.option.label,
|
|
22
|
+
params: e.option.params
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
}, m = i("tool", "knowledgeInline", a);
|
|
29
|
+
export {
|
|
30
|
+
m as default
|
|
31
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { _ as o } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js";
|
|
2
|
+
import { e as t, r as n } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js";
|
|
3
|
+
import { s as p, a as c } from "./guard-BCatAeT4.js";
|
|
4
|
+
const a = {
|
|
5
|
+
install(e) {
|
|
6
|
+
e.component("FkpRichText", o);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
o as FkpRichText,
|
|
11
|
+
a as default,
|
|
12
|
+
t as emptyScene,
|
|
13
|
+
n as resolveSceneConfig,
|
|
14
|
+
p as serializeQuestionForModel,
|
|
15
|
+
c as serializeQuestionTagsForModel
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const a = {
|
|
2
|
+
execute(e, o) {
|
|
3
|
+
return o.option ? [
|
|
4
|
+
{
|
|
5
|
+
kind: "insertOwnToken",
|
|
6
|
+
capabilityId: e,
|
|
7
|
+
key: o.option.id,
|
|
8
|
+
label: o.option.label,
|
|
9
|
+
...e === "variable" && o.option.token ? { token: o.option.token } : {},
|
|
10
|
+
...e === "tool" && o.option.params ? { params: o.option.params } : {}
|
|
11
|
+
}
|
|
12
|
+
] : [];
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
a as m
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { b as l } from "./operations-JgnjGx3H.js";
|
|
2
|
+
const o = {
|
|
3
|
+
execute(e) {
|
|
4
|
+
return e === "originalReply" ? [{ kind: "insertOwnBlock", capabilityId: e, block: e }] : [];
|
|
5
|
+
}
|
|
6
|
+
}, i = l(
|
|
7
|
+
"originalReply",
|
|
8
|
+
"knowledgeBlock",
|
|
9
|
+
o
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
i as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { Node as S, mergeAttributes as A } from "@tiptap/core";
|
|
2
|
+
import { nodeViewProps as D, NodeViewWrapper as I, VueNodeViewRenderer as L } from "@tiptap/vue-3";
|
|
3
|
+
import { defineComponent as T, ref as w, watch as N, onMounted as H, onBeforeUnmount as P, openBlock as s, createBlock as l, unref as i, normalizeClass as U, withCtx as f, createElementVNode as k, createElementBlock as p, createVNode as u, createTextVNode as E, createCommentVNode as m, toDisplayString as V } from "vue";
|
|
4
|
+
import { Button as C, ImagePreview as q, Modal as F } from "@freecallai/ui";
|
|
5
|
+
import { closeHistory as O } from "@tiptap/pm/history";
|
|
6
|
+
import g from "@freecallai/icons";
|
|
7
|
+
import { IconDragDotVertical as R, IconDelete as W } from "@freecallai/ui/es/icon/index.js";
|
|
8
|
+
const j = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "fk-media-failed"
|
|
11
|
+
}, G = ["draggable", "src", "alt"], J = ["draggable", "src", "poster", "controls"], K = { class: "fk-media-actions" }, Q = {
|
|
12
|
+
key: 0,
|
|
13
|
+
"data-drag-handle": "",
|
|
14
|
+
class: "fk-media-handle",
|
|
15
|
+
title: "拖动调整位置"
|
|
16
|
+
}, X = {
|
|
17
|
+
key: 4,
|
|
18
|
+
class: "fk-upload-state"
|
|
19
|
+
}, Y = { class: "fk-media-caption" }, Z = {
|
|
20
|
+
key: 1,
|
|
21
|
+
class: "fk-error"
|
|
22
|
+
}, h = ["src"], x = /* @__PURE__ */ T({
|
|
23
|
+
__name: "MediaView",
|
|
24
|
+
props: D,
|
|
25
|
+
setup(r) {
|
|
26
|
+
const a = r, o = a.extension.options.sceneStyle === !0, n = w(!1), v = w(!1), b = w(null), c = w(a.editor.isEditable);
|
|
27
|
+
function z(e) {
|
|
28
|
+
const { detail: t } = e;
|
|
29
|
+
(t == null ? void 0 : t.id) === a.node.attrs.id && a.node.attrs.status === "uploading" && typeof t.percent == "number" && Number.isFinite(t.percent) && (b.value = t.percent);
|
|
30
|
+
}
|
|
31
|
+
const y = () => {
|
|
32
|
+
c.value = a.editor.isEditable;
|
|
33
|
+
};
|
|
34
|
+
a.editor.on("update", y), a.editor.on("transaction", y);
|
|
35
|
+
function M() {
|
|
36
|
+
a.editor.isEditable && (a.editor.view.dispatch(O(a.editor.state.tr)), a.deleteNode());
|
|
37
|
+
}
|
|
38
|
+
function $() {
|
|
39
|
+
a.editor.view.dom.dispatchEvent(
|
|
40
|
+
new CustomEvent("fkp-media-retry", {
|
|
41
|
+
bubbles: !0,
|
|
42
|
+
detail: { id: a.node.attrs.id }
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function B(e) {
|
|
47
|
+
!o || a.node.attrs.kind !== "video" || e.target instanceof Element && e.target.closest(".fk-media-actions") || (n.value = !0);
|
|
48
|
+
}
|
|
49
|
+
return N(
|
|
50
|
+
() => a.node.attrs.src,
|
|
51
|
+
() => {
|
|
52
|
+
v.value = !1;
|
|
53
|
+
}
|
|
54
|
+
), N(
|
|
55
|
+
() => a.node.attrs.status,
|
|
56
|
+
(e) => {
|
|
57
|
+
e !== "uploading" && (b.value = null);
|
|
58
|
+
}
|
|
59
|
+
), H(() => {
|
|
60
|
+
a.editor.view.dom.addEventListener("fkp-media-progress", z);
|
|
61
|
+
}), P(() => {
|
|
62
|
+
a.editor.view.dom.removeEventListener("fkp-media-progress", z), a.editor.off("update", y), a.editor.off("transaction", y);
|
|
63
|
+
}), (e, t) => (s(), l(i(I), {
|
|
64
|
+
class: U(["fk-media", {
|
|
65
|
+
"is-selected": e.selected,
|
|
66
|
+
"is-scene-media": o,
|
|
67
|
+
"is-video": e.node.attrs.kind === "video",
|
|
68
|
+
"is-error": e.node.attrs.status === "error"
|
|
69
|
+
}]),
|
|
70
|
+
"data-media-id": e.node.attrs.id,
|
|
71
|
+
"data-drag-handle": o && c.value ? "" : void 0,
|
|
72
|
+
contenteditable: "false"
|
|
73
|
+
}, {
|
|
74
|
+
default: f(() => [
|
|
75
|
+
k("div", {
|
|
76
|
+
class: "fk-media-surface",
|
|
77
|
+
onClick: B
|
|
78
|
+
}, [
|
|
79
|
+
v.value ? (s(), p("div", j, [
|
|
80
|
+
u(i(g), {
|
|
81
|
+
name: "fail",
|
|
82
|
+
size: 24
|
|
83
|
+
}),
|
|
84
|
+
t[7] || (t[7] = E("媒体无法加载"))
|
|
85
|
+
])) : e.node.attrs.kind === "image" ? (s(), p("img", {
|
|
86
|
+
key: 1,
|
|
87
|
+
draggable: o ? !1 : void 0,
|
|
88
|
+
src: e.node.attrs.src,
|
|
89
|
+
alt: e.node.attrs.name,
|
|
90
|
+
onError: t[0] || (t[0] = (d) => v.value = !0),
|
|
91
|
+
onDblclick: t[1] || (t[1] = (d) => n.value = !0)
|
|
92
|
+
}, null, 40, G)) : (s(), p("video", {
|
|
93
|
+
key: 2,
|
|
94
|
+
draggable: o ? !1 : void 0,
|
|
95
|
+
src: e.node.attrs.src,
|
|
96
|
+
poster: e.node.attrs.poster || void 0,
|
|
97
|
+
controls: !o,
|
|
98
|
+
muted: o,
|
|
99
|
+
playsinline: "",
|
|
100
|
+
preload: "metadata",
|
|
101
|
+
onError: t[2] || (t[2] = (d) => v.value = !0)
|
|
102
|
+
}, null, 40, J)),
|
|
103
|
+
o && e.node.attrs.kind === "video" && !v.value ? (s(), l(i(C), {
|
|
104
|
+
key: 3,
|
|
105
|
+
class: "fk-media-play",
|
|
106
|
+
type: "text",
|
|
107
|
+
"aria-label": "播放视频",
|
|
108
|
+
style: { "pointer-events": "none" },
|
|
109
|
+
onClick: t[3] || (t[3] = (d) => n.value = !0)
|
|
110
|
+
}, {
|
|
111
|
+
default: f(() => [
|
|
112
|
+
u(i(g), {
|
|
113
|
+
name: "visible",
|
|
114
|
+
size: 14
|
|
115
|
+
}),
|
|
116
|
+
t[8] || (t[8] = E("点击播放视频"))
|
|
117
|
+
]),
|
|
118
|
+
_: 1
|
|
119
|
+
})) : m("", !0),
|
|
120
|
+
k("div", K, [
|
|
121
|
+
c.value ? (s(), p("span", Q, [
|
|
122
|
+
u(i(R), { size: 15 })
|
|
123
|
+
])) : m("", !0),
|
|
124
|
+
u(i(C), {
|
|
125
|
+
type: "text",
|
|
126
|
+
size: "mini",
|
|
127
|
+
title: "预览媒体",
|
|
128
|
+
"aria-label": "预览媒体",
|
|
129
|
+
onClick: t[4] || (t[4] = (d) => n.value = !0)
|
|
130
|
+
}, {
|
|
131
|
+
default: f(() => [
|
|
132
|
+
u(i(g), {
|
|
133
|
+
name: "open",
|
|
134
|
+
size: 15
|
|
135
|
+
})
|
|
136
|
+
]),
|
|
137
|
+
_: 1
|
|
138
|
+
}),
|
|
139
|
+
c.value && e.node.attrs.status === "error" ? (s(), l(i(C), {
|
|
140
|
+
key: 1,
|
|
141
|
+
type: "text",
|
|
142
|
+
size: "mini",
|
|
143
|
+
title: "重试上传",
|
|
144
|
+
"aria-label": "重试上传",
|
|
145
|
+
onClick: $
|
|
146
|
+
}, {
|
|
147
|
+
default: f(() => t[9] || (t[9] = [
|
|
148
|
+
E("重试")
|
|
149
|
+
])),
|
|
150
|
+
_: 1
|
|
151
|
+
})) : m("", !0),
|
|
152
|
+
c.value ? (s(), l(i(C), {
|
|
153
|
+
key: 2,
|
|
154
|
+
type: "text",
|
|
155
|
+
size: "mini",
|
|
156
|
+
title: "删除媒体",
|
|
157
|
+
"aria-label": "删除媒体",
|
|
158
|
+
onClick: M
|
|
159
|
+
}, {
|
|
160
|
+
default: f(() => [
|
|
161
|
+
u(i(W), { size: 15 })
|
|
162
|
+
]),
|
|
163
|
+
_: 1
|
|
164
|
+
})) : m("", !0)
|
|
165
|
+
]),
|
|
166
|
+
e.node.attrs.status === "uploading" ? (s(), p("div", X, [
|
|
167
|
+
u(i(g), {
|
|
168
|
+
name: "sync",
|
|
169
|
+
size: 17,
|
|
170
|
+
class: "fk-spin"
|
|
171
|
+
}),
|
|
172
|
+
E("正在上传" + V(b.value === null ? "…" : ` ${b.value}%`), 1)
|
|
173
|
+
])) : m("", !0)
|
|
174
|
+
]),
|
|
175
|
+
k("div", Y, [
|
|
176
|
+
e.node.attrs.kind === "video" ? (s(), l(i(g), {
|
|
177
|
+
key: 0,
|
|
178
|
+
name: "video2",
|
|
179
|
+
size: 12
|
|
180
|
+
})) : m("", !0),
|
|
181
|
+
k("span", null, V(e.node.attrs.name), 1),
|
|
182
|
+
e.node.attrs.status === "error" ? (s(), p("span", Z, V(e.node.attrs.error), 1)) : m("", !0)
|
|
183
|
+
]),
|
|
184
|
+
e.node.attrs.kind === "image" ? (s(), l(i(q), {
|
|
185
|
+
key: 0,
|
|
186
|
+
visible: n.value,
|
|
187
|
+
"onUpdate:visible": t[5] || (t[5] = (d) => n.value = d),
|
|
188
|
+
src: e.node.attrs.src,
|
|
189
|
+
"mask-closable": !0
|
|
190
|
+
}, null, 8, ["visible", "src"])) : (s(), l(i(F), {
|
|
191
|
+
key: 1,
|
|
192
|
+
visible: n.value,
|
|
193
|
+
"onUpdate:visible": t[6] || (t[6] = (d) => n.value = d),
|
|
194
|
+
title: e.node.attrs.name,
|
|
195
|
+
footer: !1,
|
|
196
|
+
width: "min(960px, 90vw)",
|
|
197
|
+
"unmount-on-close": ""
|
|
198
|
+
}, {
|
|
199
|
+
default: f(() => [
|
|
200
|
+
k("video", {
|
|
201
|
+
class: "fk-video-preview",
|
|
202
|
+
src: e.node.attrs.src,
|
|
203
|
+
controls: "",
|
|
204
|
+
autoplay: ""
|
|
205
|
+
}, null, 8, h)
|
|
206
|
+
]),
|
|
207
|
+
_: 1
|
|
208
|
+
}, 8, ["visible", "title"]))
|
|
209
|
+
]),
|
|
210
|
+
_: 1
|
|
211
|
+
}, 8, ["class", "data-media-id", "data-drag-handle"]));
|
|
212
|
+
}
|
|
213
|
+
}), oe = S.create({
|
|
214
|
+
name: "mediaBlock",
|
|
215
|
+
group: "block",
|
|
216
|
+
atom: !0,
|
|
217
|
+
draggable: !0,
|
|
218
|
+
selectable: !0,
|
|
219
|
+
addOptions() {
|
|
220
|
+
return { sceneStyle: !1 };
|
|
221
|
+
},
|
|
222
|
+
addAttributes() {
|
|
223
|
+
return {
|
|
224
|
+
id: { default: "" },
|
|
225
|
+
nodeVersion: { default: 0 },
|
|
226
|
+
assetId: { default: null },
|
|
227
|
+
src: { default: "" },
|
|
228
|
+
kind: { default: "image" },
|
|
229
|
+
name: { default: "" },
|
|
230
|
+
poster: { default: null },
|
|
231
|
+
status: { default: "ready" },
|
|
232
|
+
error: { default: "" }
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
parseHTML() {
|
|
236
|
+
return [
|
|
237
|
+
{
|
|
238
|
+
tag: "figure[data-media-block]",
|
|
239
|
+
getAttrs: (r) => {
|
|
240
|
+
var a, o;
|
|
241
|
+
return {
|
|
242
|
+
id: r.getAttribute("data-id"),
|
|
243
|
+
kind: r.getAttribute("data-kind"),
|
|
244
|
+
src: (a = r.querySelector("img,video")) == null ? void 0 : a.getAttribute("src"),
|
|
245
|
+
name: (o = r.querySelector("figcaption")) == null ? void 0 : o.textContent,
|
|
246
|
+
status: "ready"
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
];
|
|
251
|
+
},
|
|
252
|
+
renderHTML({ node: r, HTMLAttributes: a }) {
|
|
253
|
+
return [
|
|
254
|
+
"figure",
|
|
255
|
+
A(a, {
|
|
256
|
+
"data-media-block": "",
|
|
257
|
+
"data-id": r.attrs.id,
|
|
258
|
+
"data-kind": r.attrs.kind
|
|
259
|
+
}),
|
|
260
|
+
r.attrs.kind === "video" ? [
|
|
261
|
+
"video",
|
|
262
|
+
{ src: r.attrs.src, controls: "", poster: r.attrs.poster }
|
|
263
|
+
] : ["img", { src: r.attrs.src, alt: r.attrs.name }],
|
|
264
|
+
["figcaption", {}, r.attrs.name]
|
|
265
|
+
];
|
|
266
|
+
},
|
|
267
|
+
renderText({ node: r }) {
|
|
268
|
+
return `[${r.attrs.kind === "video" ? "视频" : "图片"}:${r.attrs.name}]`;
|
|
269
|
+
},
|
|
270
|
+
addNodeView() {
|
|
271
|
+
return L(x);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
export {
|
|
275
|
+
oe as MediaBlock
|
|
276
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { f as m, e as A } from "./guard-BCatAeT4.js";
|
|
2
|
+
function b(i) {
|
|
3
|
+
let s = 2166136261;
|
|
4
|
+
for (let a = 0; a < i.length; a++)
|
|
5
|
+
s = Math.imul(s ^ i.charCodeAt(a), 16777619);
|
|
6
|
+
return `legacy-${(s >>> 0).toString(16).padStart(8, "0")}`;
|
|
7
|
+
}
|
|
8
|
+
function N(i, s) {
|
|
9
|
+
if (typeof s != "string" || !s.trim())
|
|
10
|
+
throw new Error("旧知识迁移需要稳定的来源记录键");
|
|
11
|
+
if (!i || typeof i != "object" || Array.isArray(i) || m(i) !== null || i.type !== "doc")
|
|
12
|
+
throw new Error("旧知识包含非 JSON 内容");
|
|
13
|
+
const a = JSON.parse(JSON.stringify(i)), o = (t) => {
|
|
14
|
+
if (!t || typeof t != "object" || Array.isArray(t) || typeof t.type != "string" || !t.type)
|
|
15
|
+
throw new Error("旧知识节点格式不正确");
|
|
16
|
+
if (t.attrs !== void 0 && (!t.attrs || typeof t.attrs != "object" || Array.isArray(t.attrs)))
|
|
17
|
+
throw new Error("旧知识节点属性格式不正确");
|
|
18
|
+
if (t.content !== void 0) {
|
|
19
|
+
if (!Array.isArray(t.content))
|
|
20
|
+
throw new Error("旧知识节点内容格式不正确");
|
|
21
|
+
t.content.forEach(o);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
o(a);
|
|
25
|
+
const l = /* @__PURE__ */ new Set(), p = (t) => {
|
|
26
|
+
var e, n;
|
|
27
|
+
t.type && A(t.type) && typeof ((e = t.attrs) == null ? void 0 : e.id) == "string" && t.attrs.id.trim() && l.add(t.attrs.id), (n = t.content) == null || n.forEach(p);
|
|
28
|
+
};
|
|
29
|
+
p(a);
|
|
30
|
+
const y = /* @__PURE__ */ new Set();
|
|
31
|
+
let c = !1;
|
|
32
|
+
const g = (t, e) => {
|
|
33
|
+
var n, h, w, $, E;
|
|
34
|
+
if (t.type && A(t.type)) {
|
|
35
|
+
let r = typeof ((n = t.attrs) == null ? void 0 : n.id) == "string" ? t.attrs.id : "";
|
|
36
|
+
if (!r.trim() || y.has(r)) {
|
|
37
|
+
const f = b(
|
|
38
|
+
t.type === "mediaBlock" ? `${s}:${e}:${String(((h = t.attrs) == null ? void 0 : h.src) || "")}` : `${s}:${e}:${t.type}:${String(
|
|
39
|
+
((w = t.attrs) == null ? void 0 : w.key) || ""
|
|
40
|
+
)}`
|
|
41
|
+
);
|
|
42
|
+
r = f;
|
|
43
|
+
let S = 1;
|
|
44
|
+
for (; l.has(r) || y.has(r); ) r = `${f}-${S++}`;
|
|
45
|
+
t.attrs = { ...t.attrs, id: r, nodeVersion: 0 }, c = !0;
|
|
46
|
+
} else (($ = t.attrs) == null ? void 0 : $.nodeVersion) === void 0 && (t.attrs = { ...t.attrs, nodeVersion: 0 }, c = !0);
|
|
47
|
+
y.add(r);
|
|
48
|
+
}
|
|
49
|
+
(E = t.content) == null || E.forEach(
|
|
50
|
+
(r, f) => g(r, `${e}.content[${f}]`)
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
return g(a, "knowledge.doc"), { doc: a, changed: c };
|
|
54
|
+
}
|
|
55
|
+
const I = N;
|
|
56
|
+
export {
|
|
57
|
+
N as a,
|
|
58
|
+
I as b
|
|
59
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { p as l, f as c } from "./FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js";
|
|
2
|
+
function u(o) {
|
|
3
|
+
return {
|
|
4
|
+
id: o,
|
|
5
|
+
slot: "knowledgeBlock",
|
|
6
|
+
apiVersion: 1,
|
|
7
|
+
dataVersion: 1,
|
|
8
|
+
actions: {
|
|
9
|
+
[`${o}.upload`]: {
|
|
10
|
+
async execute(d, s) {
|
|
11
|
+
const { upload: e } = d;
|
|
12
|
+
if (!e || !(e.file instanceof File) || typeof e.nodeId != "string" || !e.nodeId || !Number.isSafeInteger(e.expectedNodeVersion) || e.expectedNodeVersion < 0 || e.expectedNodeVersion >= Number.MAX_SAFE_INTEGER)
|
|
13
|
+
return {
|
|
14
|
+
ok: !1,
|
|
15
|
+
error: {
|
|
16
|
+
code: "INVALID_RESPONSE",
|
|
17
|
+
message: "媒体上传参数无效",
|
|
18
|
+
retryable: !1
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const a = s.ports.uploadMedia;
|
|
22
|
+
if (!a)
|
|
23
|
+
return {
|
|
24
|
+
ok: !1,
|
|
25
|
+
error: {
|
|
26
|
+
code: "UNAVAILABLE",
|
|
27
|
+
message: "宿主未提供媒体上传接口",
|
|
28
|
+
retryable: !1
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const n = await a({ file: e.file, kind: o }, s.request), r = l(
|
|
32
|
+
n,
|
|
33
|
+
(i) => c(o, i)
|
|
34
|
+
);
|
|
35
|
+
if (!r.ok) return r;
|
|
36
|
+
const t = r.data;
|
|
37
|
+
return {
|
|
38
|
+
ok: !0,
|
|
39
|
+
data: [
|
|
40
|
+
{
|
|
41
|
+
kind: "updateOwnNode",
|
|
42
|
+
capabilityId: o,
|
|
43
|
+
nodeId: e.nodeId,
|
|
44
|
+
expectedNodeVersion: e.expectedNodeVersion,
|
|
45
|
+
node: {
|
|
46
|
+
type: "mediaBlock",
|
|
47
|
+
attrs: {
|
|
48
|
+
id: e.nodeId,
|
|
49
|
+
nodeVersion: e.expectedNodeVersion + 1,
|
|
50
|
+
assetId: t.id || null,
|
|
51
|
+
src: t.url,
|
|
52
|
+
kind: o,
|
|
53
|
+
name: e.file.name,
|
|
54
|
+
poster: t.posterUrl || null,
|
|
55
|
+
status: "ready",
|
|
56
|
+
error: ""
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
u as c
|
|
69
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function i(e, a, n) {
|
|
2
|
+
return {
|
|
3
|
+
id: e,
|
|
4
|
+
slot: a,
|
|
5
|
+
apiVersion: 1,
|
|
6
|
+
dataVersion: 1,
|
|
7
|
+
actions: {
|
|
8
|
+
[`${e}.${a}.apply`]: {
|
|
9
|
+
execute: async (t, c) => ({
|
|
10
|
+
ok: !0,
|
|
11
|
+
data: n.execute(e, t, c.scene)
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
i as b
|
|
19
|
+
};
|