@kg-ui/kg-ui-plus 0.2.13 → 0.2.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/dist/es/api/copilot.mjs +0 -8
- package/dist/es/kgCopilot/copilotCanvas/docViewer/index.vue.mjs +1 -1
- package/dist/es/kgCopilot/copilotCanvas/docViewer/index.vue2.mjs +6 -12
- package/dist/es/kgCopilot/copilotCanvas/docViewer/index.vue3.mjs +2 -2
- package/dist/es/kgCopilot/copilotCanvas/docViewer/wpsFileViewer/wpsPanel.vue.mjs +1 -1
- package/dist/es/kgCopilot/copilotCanvas/docViewer/wpsFileViewer/wpsPanel.vue2.mjs +112 -61
- package/dist/es/kgCopilot/copilotCanvas/docViewer/wpsFileViewer/wpsPanel.vue3.mjs +2 -2
- package/dist/es/kgCopilot/copilotCanvas/index.vue.mjs +1 -1
- package/dist/es/kgCopilot/copilotCanvas/index.vue2.mjs +10 -10
- package/dist/es/kgCopilot/copilotCanvas/index.vue3.mjs +2 -2
- package/dist/es/kgCopilot/copilotDialog/CopiContent/index.vue.mjs +1 -1
- package/dist/es/kgCopilot/copilotDialog/CopiContent/index.vue2.mjs +4 -3
- package/dist/es/kgCopilot/copilotDialog/CopiContent/index.vue3.mjs +2 -2
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/codeBox.vue.mjs +4 -4
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/codeBox.vue2.mjs +2 -2
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/index.vue.mjs +1 -1
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/index.vue2.mjs +35 -7
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/index.vue3.mjs +2 -2
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/reportBox2.vue.mjs +108 -0
- package/dist/es/kgCopilot/copilotDialog/CopiContent/messageParse/reportBox2.vue2.mjs +4 -0
- package/dist/es/node_modules/.pnpm/call-bind-apply-helpers@1.0.1/node_modules/call-bind-apply-helpers/actualApply.mjs +4 -4
- package/dist/es/node_modules/.pnpm/call-bind-apply-helpers@1.0.1/node_modules/call-bind-apply-helpers/functionCall.mjs +2 -10
- package/dist/es/node_modules/.pnpm/call-bind-apply-helpers@1.0.1/node_modules/call-bind-apply-helpers/index.mjs +4 -4
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.mjs +65 -73
- package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.mjs +4 -12
- package/dist/es/node_modules/.pnpm/get-intrinsic@1.2.6/node_modules/get-intrinsic/index.mjs +4 -4
- package/dist/es/node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.mjs +2 -2
- package/dist/es/store/modules/copilot.mjs +66 -9
- package/dist/es/style.css +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ref, onMounted, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createBlock, unref, toDisplayString } from "vue";
|
|
2
|
+
import _sfc_main$1 from "./fileIcon.vue.mjs";
|
|
3
|
+
import "../../../../node_modules/.pnpm/pinyin-match@1.2.4/node_modules/pinyin-match/es/main.mjs";
|
|
4
|
+
import { useCopilotStoreHook } from "../../../../store/modules/copilot.mjs";
|
|
5
|
+
import { storeToRefs } from "pinia";
|
|
6
|
+
import "../../../../utils/http/index.mjs";
|
|
7
|
+
import data from "../../../../node_modules/.pnpm/@iconify-icons_ep@1.2.12/node_modules/@iconify-icons/ep/loading.mjs";
|
|
8
|
+
import "./reportBox2.vue2.mjs";
|
|
9
|
+
import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.mjs";
|
|
10
|
+
const _hoisted_1 = { class: "file-content flex-1 p-4" };
|
|
11
|
+
const _hoisted_2 = { class: "flex items-center" };
|
|
12
|
+
const _hoisted_3 = { class: "h-4 w-4 flex items-center justify-center text-blue-500 mr-3" };
|
|
13
|
+
const _hoisted_4 = { class: "flex-1 min-w-0" };
|
|
14
|
+
const _hoisted_5 = { class: "text-sm font-medium text-gray-800 truncate" };
|
|
15
|
+
const _hoisted_6 = { class: "text-xs text-gray-500 mt-1" };
|
|
16
|
+
const _sfc_main = {
|
|
17
|
+
__name: "reportBox2",
|
|
18
|
+
props: {
|
|
19
|
+
file_status: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "loading"
|
|
22
|
+
},
|
|
23
|
+
file_url: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
file_name: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: ""
|
|
30
|
+
},
|
|
31
|
+
msgIndex: Number,
|
|
32
|
+
subMsgInde: Number
|
|
33
|
+
},
|
|
34
|
+
emits: ["printOk", "update:isPrinting"],
|
|
35
|
+
setup(__props, { emit: emits }) {
|
|
36
|
+
const props = __props;
|
|
37
|
+
const CopilotStore = useCopilotStoreHook();
|
|
38
|
+
storeToRefs(CopilotStore);
|
|
39
|
+
const { getPreviewFileUrl3, openCanvasVisible, openCanvasVisibleWithIndex } = CopilotStore;
|
|
40
|
+
const fileType = ref("");
|
|
41
|
+
const preview = () => {
|
|
42
|
+
if (props.file_status === "success") {
|
|
43
|
+
getPreviewFileUrl3(props.file_url, props.file_name);
|
|
44
|
+
openCanvasVisibleWithIndex(props.msgIndex, props.subMsgInde);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
emits("update:isPrinting", false);
|
|
49
|
+
emits("printOk");
|
|
50
|
+
});
|
|
51
|
+
watch(
|
|
52
|
+
() => props.file_status,
|
|
53
|
+
(newValue) => {
|
|
54
|
+
if (newValue === "template" || newValue === "success") {
|
|
55
|
+
const suffix = props.file_name.split(".").pop();
|
|
56
|
+
switch (suffix) {
|
|
57
|
+
case "doc":
|
|
58
|
+
fileType.value = "word";
|
|
59
|
+
break;
|
|
60
|
+
case "docx":
|
|
61
|
+
fileType.value = "word";
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
getPreviewFileUrl3(props.file_url, props.file_name);
|
|
65
|
+
openCanvasVisibleWithIndex(props.msgIndex, props.subMsgInde);
|
|
66
|
+
}
|
|
67
|
+
if (newValue !== "loading") {
|
|
68
|
+
emits("update:isPrinting", false);
|
|
69
|
+
emits("printOk");
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
immediate: true
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
return (_ctx, _cache) => {
|
|
77
|
+
const _component_IconifyIconOffline = resolveComponent("IconifyIconOffline");
|
|
78
|
+
return openBlock(), createElementBlock("div", {
|
|
79
|
+
class: "file-box bg-gray-50 rounded-lg border border-gray-200 hover:bg-blue-50 hover:border-blue-100 transition-colors duration-200 shadow-sm overflow-hidden flex flex-col",
|
|
80
|
+
onClick: preview
|
|
81
|
+
}, [
|
|
82
|
+
createElementVNode("div", _hoisted_1, [
|
|
83
|
+
createElementVNode("div", _hoisted_2, [
|
|
84
|
+
createElementVNode("div", _hoisted_3, [
|
|
85
|
+
__props.file_status === "loading" || __props.file_status === "template" ? (openBlock(), createBlock(_component_IconifyIconOffline, {
|
|
86
|
+
key: 0,
|
|
87
|
+
class: "animate-spin h-4 w-4",
|
|
88
|
+
icon: unref(data)
|
|
89
|
+
}, null, 8, ["icon"])) : (openBlock(), createBlock(_sfc_main$1, {
|
|
90
|
+
key: 1,
|
|
91
|
+
class: "",
|
|
92
|
+
type: fileType.value
|
|
93
|
+
}, null, 8, ["type"]))
|
|
94
|
+
]),
|
|
95
|
+
createElementVNode("div", _hoisted_4, [
|
|
96
|
+
createElementVNode("p", _hoisted_5, toDisplayString(__props.file_status === "loading" || __props.file_status === "template" ? "报告生成中" : __props.file_status === "success" ? __props.file_name : "文件异常"), 1),
|
|
97
|
+
createElementVNode("p", _hoisted_6, toDisplayString(__props.file_status === "loading" || __props.file_status === "template" ? "请稍候,正在为您生成文档..." : __props.file_status === "success" ? "点击预览文件内容" : "服务器错误,请稍后再试"), 1)
|
|
98
|
+
])
|
|
99
|
+
])
|
|
100
|
+
])
|
|
101
|
+
]);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const ReportBox2 = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-d4c0b971"]]);
|
|
106
|
+
export {
|
|
107
|
+
ReportBox2 as default
|
|
108
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import functionBind from "../../../function-bind@1.1.2/node_modules/function-bind/index.mjs";
|
|
2
2
|
import { __require as requireFunctionApply } from "./functionApply.mjs";
|
|
3
|
-
import
|
|
3
|
+
import functionCall from "./functionCall.mjs";
|
|
4
4
|
import reflectApply from "./reflectApply.mjs";
|
|
5
|
-
var bind =
|
|
5
|
+
var bind = functionBind;
|
|
6
6
|
var $apply = requireFunctionApply();
|
|
7
|
-
var $call =
|
|
7
|
+
var $call = functionCall;
|
|
8
8
|
var $reflectApply = reflectApply;
|
|
9
9
|
var actualApply = $reflectApply || bind.call($call, $apply);
|
|
10
10
|
export {
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
var functionCall;
|
|
2
|
-
var hasRequiredFunctionCall;
|
|
3
|
-
function requireFunctionCall() {
|
|
4
|
-
if (hasRequiredFunctionCall)
|
|
5
|
-
return functionCall;
|
|
6
|
-
hasRequiredFunctionCall = 1;
|
|
7
|
-
functionCall = Function.prototype.call;
|
|
8
|
-
return functionCall;
|
|
9
|
-
}
|
|
1
|
+
var functionCall = Function.prototype.call;
|
|
10
2
|
export {
|
|
11
|
-
|
|
3
|
+
functionCall as default
|
|
12
4
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import functionBind from "../../../function-bind@1.1.2/node_modules/function-bind/index.mjs";
|
|
2
2
|
import type from "../../../es-errors@1.3.0/node_modules/es-errors/type.mjs";
|
|
3
|
-
import
|
|
3
|
+
import functionCall from "./functionCall.mjs";
|
|
4
4
|
import actualApply from "./actualApply.mjs";
|
|
5
|
-
var bind =
|
|
5
|
+
var bind = functionBind;
|
|
6
6
|
var $TypeError = type;
|
|
7
|
-
var $call =
|
|
7
|
+
var $call = functionCall;
|
|
8
8
|
var $actualApply = actualApply;
|
|
9
9
|
var callBindApplyHelpers = function callBindBasic(args) {
|
|
10
10
|
if (args.length < 1 || typeof args[0] !== "function") {
|
package/dist/es/node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.mjs
CHANGED
|
@@ -1,80 +1,72 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var joiny = function(arr, joiner) {
|
|
29
|
-
var str = "";
|
|
30
|
-
for (var i = 0; i < arr.length; i += 1) {
|
|
31
|
-
str += arr[i];
|
|
32
|
-
if (i + 1 < arr.length) {
|
|
33
|
-
str += joiner;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return str;
|
|
37
|
-
};
|
|
38
|
-
implementation = function bind(that) {
|
|
39
|
-
var target = this;
|
|
40
|
-
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
41
|
-
throw new TypeError(ERROR_MESSAGE + target);
|
|
1
|
+
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
2
|
+
var toStr = Object.prototype.toString;
|
|
3
|
+
var max = Math.max;
|
|
4
|
+
var funcType = "[object Function]";
|
|
5
|
+
var concatty = function concatty2(a, b) {
|
|
6
|
+
var arr = [];
|
|
7
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
8
|
+
arr[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
11
|
+
arr[j + a.length] = b[j];
|
|
12
|
+
}
|
|
13
|
+
return arr;
|
|
14
|
+
};
|
|
15
|
+
var slicy = function slicy2(arrLike, offset) {
|
|
16
|
+
var arr = [];
|
|
17
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
18
|
+
arr[j] = arrLike[i];
|
|
19
|
+
}
|
|
20
|
+
return arr;
|
|
21
|
+
};
|
|
22
|
+
var joiny = function(arr, joiner) {
|
|
23
|
+
var str = "";
|
|
24
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
25
|
+
str += arr[i];
|
|
26
|
+
if (i + 1 < arr.length) {
|
|
27
|
+
str += joiner;
|
|
42
28
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
that,
|
|
29
|
+
}
|
|
30
|
+
return str;
|
|
31
|
+
};
|
|
32
|
+
var implementation = function bind(that) {
|
|
33
|
+
var target = this;
|
|
34
|
+
if (typeof target !== "function" || toStr.apply(target) !== funcType) {
|
|
35
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
36
|
+
}
|
|
37
|
+
var args = slicy(arguments, 1);
|
|
38
|
+
var bound;
|
|
39
|
+
var binder = function() {
|
|
40
|
+
if (this instanceof bound) {
|
|
41
|
+
var result = target.apply(
|
|
42
|
+
this,
|
|
58
43
|
concatty(args, arguments)
|
|
59
44
|
);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
boundArgs[i] = "$" + i;
|
|
65
|
-
}
|
|
66
|
-
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
67
|
-
if (target.prototype) {
|
|
68
|
-
var Empty = function Empty2() {
|
|
69
|
-
};
|
|
70
|
-
Empty.prototype = target.prototype;
|
|
71
|
-
bound.prototype = new Empty();
|
|
72
|
-
Empty.prototype = null;
|
|
45
|
+
if (Object(result) === result) {
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
return this;
|
|
73
49
|
}
|
|
74
|
-
return
|
|
50
|
+
return target.apply(
|
|
51
|
+
that,
|
|
52
|
+
concatty(args, arguments)
|
|
53
|
+
);
|
|
75
54
|
};
|
|
76
|
-
|
|
77
|
-
|
|
55
|
+
var boundLength = max(0, target.length - args.length);
|
|
56
|
+
var boundArgs = [];
|
|
57
|
+
for (var i = 0; i < boundLength; i++) {
|
|
58
|
+
boundArgs[i] = "$" + i;
|
|
59
|
+
}
|
|
60
|
+
bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
|
|
61
|
+
if (target.prototype) {
|
|
62
|
+
var Empty = function Empty2() {
|
|
63
|
+
};
|
|
64
|
+
Empty.prototype = target.prototype;
|
|
65
|
+
bound.prototype = new Empty();
|
|
66
|
+
Empty.prototype = null;
|
|
67
|
+
}
|
|
68
|
+
return bound;
|
|
69
|
+
};
|
|
78
70
|
export {
|
|
79
|
-
|
|
71
|
+
implementation as default
|
|
80
72
|
};
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function requireFunctionBind() {
|
|
5
|
-
if (hasRequiredFunctionBind)
|
|
6
|
-
return functionBind;
|
|
7
|
-
hasRequiredFunctionBind = 1;
|
|
8
|
-
var implementation = requireImplementation();
|
|
9
|
-
functionBind = Function.prototype.bind || implementation;
|
|
10
|
-
return functionBind;
|
|
11
|
-
}
|
|
1
|
+
import implementation$1 from "./implementation.mjs";
|
|
2
|
+
var implementation = implementation$1;
|
|
3
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
12
4
|
export {
|
|
13
|
-
|
|
5
|
+
functionBind as default
|
|
14
6
|
};
|
|
@@ -16,8 +16,8 @@ import esDefineProperty from "../../../es-define-property@1.0.1/node_modules/es-
|
|
|
16
16
|
import { __require as requireHasSymbols } from "../../../has-symbols@1.1.0/node_modules/has-symbols/index.mjs";
|
|
17
17
|
import { __require as requireGet } from "../../../dunder-proto@1.0.1/node_modules/dunder-proto/get.mjs";
|
|
18
18
|
import { __require as requireFunctionApply } from "../../../call-bind-apply-helpers@1.0.1/node_modules/call-bind-apply-helpers/functionApply.mjs";
|
|
19
|
-
import
|
|
20
|
-
import
|
|
19
|
+
import functionCall from "../../../call-bind-apply-helpers@1.0.1/node_modules/call-bind-apply-helpers/functionCall.mjs";
|
|
20
|
+
import functionBind from "../../../function-bind@1.1.2/node_modules/function-bind/index.mjs";
|
|
21
21
|
import { __require as requireHasown } from "../../../hasown@2.0.2/node_modules/hasown/index.mjs";
|
|
22
22
|
var undefined$1;
|
|
23
23
|
var $Object = esObjectAtoms;
|
|
@@ -61,7 +61,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
61
61
|
var getDunderProto = requireGet();
|
|
62
62
|
var getProto = typeof Reflect === "function" && Reflect.getPrototypeOf || $Object.getPrototypeOf || getDunderProto;
|
|
63
63
|
var $apply = requireFunctionApply();
|
|
64
|
-
var $call =
|
|
64
|
+
var $call = functionCall;
|
|
65
65
|
var needsEval = {};
|
|
66
66
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
67
67
|
var INTRINSICS = {
|
|
@@ -227,7 +227,7 @@ var LEGACY_ALIASES = {
|
|
|
227
227
|
"%WeakMapPrototype%": ["WeakMap", "prototype"],
|
|
228
228
|
"%WeakSetPrototype%": ["WeakSet", "prototype"]
|
|
229
229
|
};
|
|
230
|
-
var bind =
|
|
230
|
+
var bind = functionBind;
|
|
231
231
|
var hasOwn = requireHasown();
|
|
232
232
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
233
233
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import functionBind from "../../../function-bind@1.1.2/node_modules/function-bind/index.mjs";
|
|
2
2
|
var hasown;
|
|
3
3
|
var hasRequiredHasown;
|
|
4
4
|
function requireHasown() {
|
|
@@ -7,7 +7,7 @@ function requireHasown() {
|
|
|
7
7
|
hasRequiredHasown = 1;
|
|
8
8
|
var call = Function.prototype.call;
|
|
9
9
|
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
10
|
-
var bind =
|
|
10
|
+
var bind = functionBind;
|
|
11
11
|
hasown = bind.call(call, $hasOwn);
|
|
12
12
|
return hasown;
|
|
13
13
|
}
|
|
@@ -12,6 +12,7 @@ var DataType = /* @__PURE__ */ ((DataType2) => {
|
|
|
12
12
|
DataType2[DataType2["stream"] = 4] = "stream";
|
|
13
13
|
DataType2["report"] = "report_word";
|
|
14
14
|
DataType2["report_code"] = "report_code";
|
|
15
|
+
DataType2["report2"] = "report_word2";
|
|
15
16
|
return DataType2;
|
|
16
17
|
})(DataType || {});
|
|
17
18
|
var aiBarBtnType = /* @__PURE__ */ ((aiBarBtnType2) => {
|
|
@@ -74,7 +75,7 @@ const useCopilotStore = defineStore({
|
|
|
74
75
|
},
|
|
75
76
|
wpsAiConfig: {},
|
|
76
77
|
successShowFile: false,
|
|
77
|
-
|
|
78
|
+
canvasMsgIndex: [-1, -1]
|
|
78
79
|
// 定位 code文件内容 [msgIndex,msgUuid ]
|
|
79
80
|
}),
|
|
80
81
|
getters: {
|
|
@@ -184,6 +185,11 @@ const useCopilotStore = defineStore({
|
|
|
184
185
|
this.canvasVisible = true;
|
|
185
186
|
this.canvasType = type;
|
|
186
187
|
},
|
|
188
|
+
openCanvasVisibleWithIndex(msgIndex, subMsgIndex, type = "report_word") {
|
|
189
|
+
this.canvasVisible = true;
|
|
190
|
+
this.setCanvasCodeMsgIndex(msgIndex, subMsgIndex);
|
|
191
|
+
this.canvasType = type;
|
|
192
|
+
},
|
|
187
193
|
// changeCanvasType(type: string) {
|
|
188
194
|
// this.canvasType = type;
|
|
189
195
|
// },
|
|
@@ -195,10 +201,10 @@ const useCopilotStore = defineStore({
|
|
|
195
201
|
this.fileName = name;
|
|
196
202
|
},
|
|
197
203
|
setCanvasCodeMsgIndex(msgIndex, subMsgIndex) {
|
|
198
|
-
this.
|
|
204
|
+
this.canvasMsgIndex = [msgIndex, subMsgIndex];
|
|
199
205
|
},
|
|
200
206
|
setCanvasCodeMsgIndex2(val) {
|
|
201
|
-
this.
|
|
207
|
+
this.canvasMsgIndex = val;
|
|
202
208
|
},
|
|
203
209
|
// wps需要 url 和 name
|
|
204
210
|
getPreviewFileUrl2(url, name) {
|
|
@@ -214,6 +220,19 @@ const useCopilotStore = defineStore({
|
|
|
214
220
|
}
|
|
215
221
|
this.fileName = name + suffix;
|
|
216
222
|
},
|
|
223
|
+
getPreviewFileUrl3(url, name) {
|
|
224
|
+
const index = url.indexOf("/files/tools");
|
|
225
|
+
const pre = url.includes("ai-work-prod") ? "/dify-prod" : "/dify";
|
|
226
|
+
this.previewFileUrl = pre + url.slice(index);
|
|
227
|
+
this.fileUrl = url;
|
|
228
|
+
let suffix = "";
|
|
229
|
+
const filePath = url.split("?")[0].split("#")[0];
|
|
230
|
+
const lastDotIndex = filePath.lastIndexOf(".");
|
|
231
|
+
if (lastDotIndex !== -1 && lastDotIndex !== filePath.length - 1) {
|
|
232
|
+
suffix = filePath.slice(lastDotIndex).toLowerCase();
|
|
233
|
+
}
|
|
234
|
+
this.fileName = name + suffix;
|
|
235
|
+
},
|
|
217
236
|
async getCanvasAiRes(selText, actionType) {
|
|
218
237
|
const { data, headers } = this.defaultDeal.requestParameFn({
|
|
219
238
|
lastMsgs: [selText],
|
|
@@ -600,7 +619,7 @@ const useCopilotStore = defineStore({
|
|
|
600
619
|
isResult,
|
|
601
620
|
content,
|
|
602
621
|
streamIsOver,
|
|
603
|
-
|
|
622
|
+
canvasMsgIndex: [this.msgList.length - 1, lastMsg.msgs.length]
|
|
604
623
|
});
|
|
605
624
|
this.setCanvasCodeMsgIndex(
|
|
606
625
|
this.msgList.length - 1,
|
|
@@ -610,6 +629,12 @@ const useCopilotStore = defineStore({
|
|
|
610
629
|
lastMiniMsg.content += content;
|
|
611
630
|
}
|
|
612
631
|
} else if (type === "report_start") {
|
|
632
|
+
const varReportMsg = lastMsg.msgs.find(
|
|
633
|
+
(item) => item.type === "report_word2"
|
|
634
|
+
/* report2 */
|
|
635
|
+
);
|
|
636
|
+
if (varReportMsg)
|
|
637
|
+
return;
|
|
613
638
|
const codeSubMsg = lastMsg.msgs.find(
|
|
614
639
|
(item) => item.type === "report_code"
|
|
615
640
|
/* report_code */
|
|
@@ -630,14 +655,46 @@ const useCopilotStore = defineStore({
|
|
|
630
655
|
(item) => item.type === "report_code"
|
|
631
656
|
/* report_code */
|
|
632
657
|
);
|
|
633
|
-
if (
|
|
634
|
-
lastMiniMsg.file_url = file_url;
|
|
635
|
-
lastMiniMsg.file_name = file_name;
|
|
636
|
-
lastMiniMsg.file_status = file_url ? "success" : "fail";
|
|
637
|
-
} else {
|
|
658
|
+
if (codeSubMsg) {
|
|
638
659
|
codeSubMsg.file_url = file_url;
|
|
639
660
|
codeSubMsg.file_name = file_name;
|
|
640
661
|
codeSubMsg.file_status = file_url ? "success" : "fail";
|
|
662
|
+
} else {
|
|
663
|
+
const reportSubMsg = lastMsg.msgs.find(
|
|
664
|
+
(item) => item.type === "report_word2"
|
|
665
|
+
/* report2 */
|
|
666
|
+
);
|
|
667
|
+
if (reportSubMsg) {
|
|
668
|
+
reportSubMsg.file_url = file_url;
|
|
669
|
+
reportSubMsg.file_name = file_name;
|
|
670
|
+
reportSubMsg.file_status = file_url ? "success" : "fail";
|
|
671
|
+
reportSubMsg.varPoor = {};
|
|
672
|
+
} else {
|
|
673
|
+
lastMiniMsg.file_url = file_url;
|
|
674
|
+
lastMiniMsg.file_name = file_name;
|
|
675
|
+
lastMiniMsg.file_status = file_url ? "success" : "fail";
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
} else if (type === "report_start2") {
|
|
679
|
+
lastMsg.msgs.push({
|
|
680
|
+
needPrinting: false,
|
|
681
|
+
uuid: `${Date.now()}+${Math.random()}`,
|
|
682
|
+
type: "report_word2",
|
|
683
|
+
file_status: "template",
|
|
684
|
+
isResult,
|
|
685
|
+
content,
|
|
686
|
+
streamIsOver,
|
|
687
|
+
file_url,
|
|
688
|
+
file_name,
|
|
689
|
+
varPoor: {}
|
|
690
|
+
});
|
|
691
|
+
} else if (type === "report2_var") {
|
|
692
|
+
const reportSubMsg = lastMsg.msgs.find(
|
|
693
|
+
(item) => item.type === "report_word2"
|
|
694
|
+
/* report2 */
|
|
695
|
+
);
|
|
696
|
+
if (reportSubMsg) {
|
|
697
|
+
Object.assign(reportSubMsg.varPoor, { ...content });
|
|
641
698
|
}
|
|
642
699
|
} else {
|
|
643
700
|
lastMiniMsg.streamIsOver = true;
|