@ibiz-template/vue3-components 0.7.41-alpha.42 → 0.7.41-alpha.44
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/ibiz-markdown-editor-CUzKkFER.js +1 -0
- package/dist/{index-CaWTEUU1.js → index-DgqTP4Vw.js} +1 -1
- package/dist/{index-CD2XM6M6.js → index-Dr0VM8iS.js} +1 -1
- package/dist/index-DtEaU3-5.js +11 -0
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/wang-editor-CRWSwyXY.js +1 -0
- package/dist/{xlsx-util-B1eGfH7d.js → xlsx-util-CMJON8Uq.js} +1 -1
- package/es/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.mjs +2 -1
- package/es/control/grid/grid-column/grid-field-column/attachment-column/file-util.mjs +22 -11
- package/es/control/toolbar/export-excel/export-excel.mjs +19 -4
- package/es/editor/carousel/ibiz-carousel/ibiz-carousel.mjs +5 -2
- package/es/editor/code/monaco-editor/monaco-editor.mjs +8 -194
- package/es/editor/html/wang-editor/module/ai-module.mjs +1 -1
- package/es/editor/html/wang-editor/wang-editor.mjs +35 -207
- package/es/editor/markdown/ibiz-markdown-editor/custom-menu.mjs +11 -222
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +23 -12
- package/es/editor/text-box/input/input.mjs +11 -197
- package/es/editor/text-box/signature/signature.mjs +28 -15
- package/es/editor/upload/upload-editor.controller.mjs +12 -1
- package/es/editor/upload/use/use-iview-upload.mjs +28 -13
- package/es/locale/en/index.mjs +29 -2
- package/es/locale/zh-CN/index.mjs +29 -2
- package/es/panel-component/coop-pos/coop-pos.controller.mjs +11 -1
- package/es/panel-component/panel-app-title/panel-app-title.controller.mjs +3 -1
- package/es/panel-component/panel-app-title/panel-app-title.mjs +22 -43
- package/es/util/ai-chat-util/ai-chat-util.mjs +672 -7
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +130 -0
- package/es/util/app-util/app-util.mjs +26 -247
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.mjs +56 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.mjs +52 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.mjs +143 -0
- package/es/util/inline-ai-util/inline-ai-textarea/common/index.mjs +4 -0
- package/es/util/inline-ai-util/inline-ai-textarea/icon.mjs +52 -1
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.mjs +34 -4
- package/es/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.mjs +32 -25
- package/es/util/inline-ai-util/inline-ai-textarea/interface.mjs +1 -0
- package/lib/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.cjs +2 -1
- package/lib/control/grid/grid-column/grid-field-column/attachment-column/file-util.cjs +22 -11
- package/lib/control/toolbar/export-excel/export-excel.cjs +18 -3
- package/lib/editor/carousel/ibiz-carousel/ibiz-carousel.cjs +5 -2
- package/lib/editor/code/monaco-editor/monaco-editor.cjs +8 -194
- package/lib/editor/html/wang-editor/module/ai-module.cjs +1 -1
- package/lib/editor/html/wang-editor/wang-editor.cjs +34 -206
- package/lib/editor/markdown/ibiz-markdown-editor/custom-menu.cjs +11 -222
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +23 -12
- package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.css +1 -1
- package/lib/editor/text-box/input/input.cjs +10 -196
- package/lib/editor/text-box/signature/signature.cjs +28 -15
- package/lib/editor/upload/upload-editor.controller.cjs +12 -1
- package/lib/editor/upload/use/use-iview-upload.cjs +28 -13
- package/lib/locale/en/index.cjs +29 -2
- package/lib/locale/zh-CN/index.cjs +29 -2
- package/lib/panel-component/coop-pos/coop-pos.controller.cjs +11 -1
- package/lib/panel-component/panel-app-title/panel-app-title.cjs +21 -42
- package/lib/panel-component/panel-app-title/panel-app-title.controller.cjs +3 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +670 -5
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +132 -0
- package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
- package/lib/util/app-util/app-util.cjs +25 -246
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.cjs +58 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-think/ai-think.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.cjs +54 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call/ai-tool-call.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.cjs +145 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/ai-tool-call-item/ai-tool-call-item.css +1 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/common/index.cjs +9 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/icon.cjs +54 -0
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.cjs +31 -24
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.css +1 -1
- package/lib/util/inline-ai-util/inline-ai-textarea/inline-ai-textarea.hook.cjs +34 -4
- package/lib/util/inline-ai-util/inline-ai-textarea/interface.cjs +3 -0
- package/package.json +7 -7
- package/dist/ibiz-markdown-editor-pEdb_gS_.js +0 -1
- package/dist/index-BObZTN7-.js +0 -11
- package/dist/wang-editor-Ck-JCWqK.js +0 -1
package/es/control/grid/grid-column/grid-field-column/attachment-column/attachment-column.mjs
CHANGED
|
@@ -25,6 +25,7 @@ const AttachmentColumn = /* @__PURE__ */ defineComponent({
|
|
|
25
25
|
const {
|
|
26
26
|
getDownloadUrl,
|
|
27
27
|
files,
|
|
28
|
+
enableNoAccess,
|
|
28
29
|
onDownload,
|
|
29
30
|
getDownloadTicketParams
|
|
30
31
|
} = useFilesParse(props, props.controller);
|
|
@@ -55,7 +56,7 @@ const AttachmentColumn = /* @__PURE__ */ defineComponent({
|
|
|
55
56
|
const handlePDFPreview = async (file) => {
|
|
56
57
|
const downloadUrl = getDownloadUrl(props.data, file);
|
|
57
58
|
let url = file.url || downloadUrl.replace("%fileId%", file.id);
|
|
58
|
-
if (ibiz.config.common.enableDownloadTicket) {
|
|
59
|
+
if (ibiz.config.common.enableDownloadTicket && !enableNoAccess) {
|
|
59
60
|
const downloadTicket = await ibiz.util.file.getDownloadTicket(props.controller.context, props.controller.params, props.data, {
|
|
60
61
|
fileId: file.id
|
|
61
62
|
}, getDownloadTicketParams());
|
|
@@ -20,9 +20,12 @@ const getFileType = (extension) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
function useFilesParse(props, c) {
|
|
23
|
+
var _a, _b;
|
|
23
24
|
const files = ref([]);
|
|
24
25
|
const uploadUrl = ref("");
|
|
25
26
|
const svgBlob = /* @__PURE__ */ new Map();
|
|
27
|
+
const enableNoAccess = ((_a = c.model.userParam) == null ? void 0 : _a.enablenoaccess) === "true";
|
|
28
|
+
const osscat = (_b = c.model.userParam) == null ? void 0 : _b.osscat;
|
|
26
29
|
const getDownloadTicketParams = () => {
|
|
27
30
|
const downloadTicketParams = {};
|
|
28
31
|
if (!c.model.userParam) {
|
|
@@ -78,7 +81,7 @@ function useFilesParse(props, c) {
|
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
const getDownloadUrl = (data, file) => {
|
|
81
|
-
const editorParams = {};
|
|
84
|
+
const editorParams = { osscat, enableNoAccess };
|
|
82
85
|
if (file && file.folder) {
|
|
83
86
|
editorParams.osscat = file.folder;
|
|
84
87
|
}
|
|
@@ -93,14 +96,20 @@ function useFilesParse(props, c) {
|
|
|
93
96
|
const onDownload = (file) => {
|
|
94
97
|
const downloadUrl = getDownloadUrl(props.data, file);
|
|
95
98
|
const url = file.url || downloadUrl.replace("%fileId%", file.id);
|
|
96
|
-
ibiz.util.file.fileDownload(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
ibiz.util.file.fileDownload(
|
|
100
|
+
url,
|
|
101
|
+
file.name,
|
|
102
|
+
{
|
|
103
|
+
context: c.context,
|
|
104
|
+
params: c.params,
|
|
105
|
+
data: props.data,
|
|
106
|
+
file: { fileId: file.id, ...file },
|
|
107
|
+
extraParams: { osscat, enableNoAccess },
|
|
108
|
+
downloadTicketParams: getDownloadTicketParams()
|
|
109
|
+
},
|
|
110
|
+
void 0,
|
|
111
|
+
enableNoAccess
|
|
112
|
+
);
|
|
104
113
|
};
|
|
105
114
|
watch(
|
|
106
115
|
() => props.value,
|
|
@@ -113,11 +122,12 @@ function useFilesParse(props, c) {
|
|
|
113
122
|
() => props.data,
|
|
114
123
|
(newVal) => {
|
|
115
124
|
if (newVal) {
|
|
125
|
+
const editorParams = { osscat, enableNoAccess };
|
|
116
126
|
const urls = ibiz.util.file.calcFileUpDownUrl(
|
|
117
127
|
c.context,
|
|
118
128
|
c.params,
|
|
119
129
|
newVal,
|
|
120
|
-
|
|
130
|
+
editorParams
|
|
121
131
|
);
|
|
122
132
|
uploadUrl.value = urls.uploadUrl;
|
|
123
133
|
}
|
|
@@ -133,7 +143,7 @@ function useFilesParse(props, c) {
|
|
|
133
143
|
Object.assign(file, {
|
|
134
144
|
url: file.url || downloadUrl.replace("%fileId%", file.id)
|
|
135
145
|
});
|
|
136
|
-
if (ibiz.config.common.enableDownloadTicket) {
|
|
146
|
+
if (ibiz.config.common.enableDownloadTicket && !enableNoAccess) {
|
|
137
147
|
ibiz.util.file.getDownloadTicket(
|
|
138
148
|
c.context,
|
|
139
149
|
c.params,
|
|
@@ -164,6 +174,7 @@ function useFilesParse(props, c) {
|
|
|
164
174
|
return {
|
|
165
175
|
files,
|
|
166
176
|
uploadUrl,
|
|
177
|
+
enableNoAccess,
|
|
167
178
|
onDownload,
|
|
168
179
|
getDownloadUrl,
|
|
169
180
|
getDownloadTicketParams
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isVNode, defineComponent, createVNode, resolveComponent, createTextVNode, ref } from 'vue';
|
|
1
|
+
import { isVNode, defineComponent, createVNode, resolveComponent, createTextVNode, ref, onMounted } from 'vue';
|
|
2
2
|
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
3
|
import { showTitle } from '@ibiz-template/core';
|
|
4
4
|
import '../../../util/index.mjs';
|
|
@@ -29,7 +29,8 @@ const IBizExportExcel = /* @__PURE__ */ defineComponent({
|
|
|
29
29
|
required: true
|
|
30
30
|
},
|
|
31
31
|
controller: {
|
|
32
|
-
type: Object
|
|
32
|
+
type: Object,
|
|
33
|
+
required: true
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
emits: ["exportExcel"],
|
|
@@ -39,6 +40,15 @@ const IBizExportExcel = /* @__PURE__ */ defineComponent({
|
|
|
39
40
|
const ns = useNamespace("export-excel");
|
|
40
41
|
const startPage = ref(1);
|
|
41
42
|
const endPage = ref(9999);
|
|
43
|
+
const maxRowCount = ref(1e3);
|
|
44
|
+
const xdataControl = props.controller.xdataControl;
|
|
45
|
+
onMounted(() => {
|
|
46
|
+
if (xdataControl)
|
|
47
|
+
xdataControl.evt.on("onMounted", () => {
|
|
48
|
+
var _a;
|
|
49
|
+
maxRowCount.value = ((_a = xdataControl.dataExport) == null ? void 0 : _a.maxRowCount) || 1e3;
|
|
50
|
+
});
|
|
51
|
+
});
|
|
42
52
|
const onCommand = (command, e) => {
|
|
43
53
|
if (!command) {
|
|
44
54
|
return;
|
|
@@ -51,6 +61,7 @@ const IBizExportExcel = /* @__PURE__ */ defineComponent({
|
|
|
51
61
|
};
|
|
52
62
|
return {
|
|
53
63
|
ns,
|
|
64
|
+
maxRowCount,
|
|
54
65
|
endPage,
|
|
55
66
|
startPage,
|
|
56
67
|
onCommand
|
|
@@ -78,7 +89,9 @@ const IBizExportExcel = /* @__PURE__ */ defineComponent({
|
|
|
78
89
|
return [createVNode(resolveComponent("el-menu-item"), {
|
|
79
90
|
"class": this.ns.b("menu-item"),
|
|
80
91
|
"onClick": (e) => this.onCommand("maxRowCount", e)
|
|
81
|
-
}, _isSlot(_slot2 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll"
|
|
92
|
+
}, _isSlot(_slot2 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll", {
|
|
93
|
+
maxRowCount: this.maxRowCount
|
|
94
|
+
})) ? _slot2 : {
|
|
82
95
|
default: () => [_slot2]
|
|
83
96
|
}), createVNode(resolveComponent("el-menu-item"), {
|
|
84
97
|
"class": this.ns.b("menu-item"),
|
|
@@ -154,7 +167,9 @@ const IBizExportExcel = /* @__PURE__ */ defineComponent({
|
|
|
154
167
|
return createVNode(resolveComponent("el-dropdown-menu"), null, {
|
|
155
168
|
default: () => [createVNode(resolveComponent("el-dropdown-item"), {
|
|
156
169
|
"command": "maxRowCount"
|
|
157
|
-
}, _isSlot(_slot7 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll"
|
|
170
|
+
}, _isSlot(_slot7 = ibiz.i18n.t("control.toolbar.exportExcel.exportAll", {
|
|
171
|
+
maxRowCount: this.maxRowCount
|
|
172
|
+
})) ? _slot7 : {
|
|
158
173
|
default: () => [_slot7]
|
|
159
174
|
}), createVNode(resolveComponent("el-dropdown-item"), {
|
|
160
175
|
"command": "activatedPage"
|
|
@@ -8,9 +8,11 @@ const IBizCarousel = /* @__PURE__ */ defineComponent({
|
|
|
8
8
|
props: getEditorProps(),
|
|
9
9
|
emits: getEditorEmits(),
|
|
10
10
|
setup(props) {
|
|
11
|
+
var _a;
|
|
11
12
|
const ns = useNamespace("carousel");
|
|
12
13
|
const c = props.controller;
|
|
13
14
|
const editorModel = c.model;
|
|
15
|
+
const enableNoAccess = ((_a = c == null ? void 0 : c.editorParams) == null ? void 0 : _a.enablenoaccess) === "true";
|
|
14
16
|
const carouselData = ref([]);
|
|
15
17
|
const isAuto = ref(true);
|
|
16
18
|
const timeSpan = ref(3e3);
|
|
@@ -23,7 +25,8 @@ const IBizCarousel = /* @__PURE__ */ defineComponent({
|
|
|
23
25
|
});
|
|
24
26
|
const getDownloadUrl = (data, file) => {
|
|
25
27
|
const editorParams = {
|
|
26
|
-
...c.editorParams
|
|
28
|
+
...c.editorParams,
|
|
29
|
+
enableNoAccess
|
|
27
30
|
};
|
|
28
31
|
if (editorParams.exportparams) {
|
|
29
32
|
editorParams.exportParams = JSON.parse(editorParams.exportparams);
|
|
@@ -39,7 +42,7 @@ const IBizCarousel = /* @__PURE__ */ defineComponent({
|
|
|
39
42
|
newVal.forEach((carousel) => {
|
|
40
43
|
const downloadUrl = getDownloadUrl(props.data, carousel);
|
|
41
44
|
carousel.imgUrl = carousel.imgUrl || downloadUrl.replace("%fileId%", carousel.id);
|
|
42
|
-
if (ibiz.config.common.enableDownloadTicket) {
|
|
45
|
+
if (ibiz.config.common.enableDownloadTicket && !enableNoAccess) {
|
|
43
46
|
ibiz.util.file.getDownloadTicket(c.context, c.params, props.data, {
|
|
44
47
|
fileId: carousel.id
|
|
45
48
|
}, c.downloadTicketParams).then((downloadTicket) => {
|
|
@@ -3,8 +3,6 @@ import { useNamespace, useUIStore, getEditorEmits, getCodeProps } from '@ibiz-te
|
|
|
3
3
|
import { createUUID } from 'qx-util';
|
|
4
4
|
import { ElMessageBox } from 'element-plus';
|
|
5
5
|
import '../../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/index.mjs';
|
|
6
|
-
import { UIActionUtil, SysUIActionTag } from '@ibiz-template/runtime';
|
|
7
|
-
import { IBizContext } from '@ibiz-template/core';
|
|
8
6
|
import './monaco-editor.css';
|
|
9
7
|
import loader from '../../../node_modules/.pnpm/@monaco-editor_loader@1.5.0/node_modules/@monaco-editor/loader/lib/es/loader/index.mjs';
|
|
10
8
|
|
|
@@ -117,21 +115,18 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
117
115
|
const openAIChat = async () => {
|
|
118
116
|
if (!c.deACMode || !c.model.appDataEntityId)
|
|
119
117
|
return;
|
|
120
|
-
|
|
121
|
-
const {
|
|
122
|
-
contentToolbarItems,
|
|
123
|
-
footerToolbarItems,
|
|
124
|
-
questionToolbarItems,
|
|
125
|
-
otherToolbarItems
|
|
126
|
-
} = ibiz.aiChatUtil.calcAiToolbarItemsByAc(c.deACMode);
|
|
118
|
+
chatInstance = await ibiz.aiChatUtil.getAIChat();
|
|
127
119
|
const {
|
|
128
120
|
containerOptions,
|
|
129
121
|
chatOptions
|
|
130
|
-
} = ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
} = await ibiz.aiChatUtil.getEditorExAIChatParams(c.editorParams, c.context, c.params, props.data, c.deACMode, {
|
|
123
|
+
chatInstance,
|
|
124
|
+
view: c.view,
|
|
125
|
+
ctrl: c.ctrl
|
|
126
|
+
});
|
|
127
|
+
const resourceOptions = await ibiz.aiChatUtil.getAIResourceOptions(c.context, c.params);
|
|
134
128
|
chatInstance.create({
|
|
129
|
+
resourceOptions,
|
|
135
130
|
containerOptions: {
|
|
136
131
|
zIndex: zIndex.increment(),
|
|
137
132
|
...containerOptions
|
|
@@ -146,191 +141,10 @@ const IBizCode = /* @__PURE__ */ defineComponent({
|
|
|
146
141
|
srfactag: c.deACMode.codeName
|
|
147
142
|
},
|
|
148
143
|
appDataEntityId: c.model.appDataEntityId,
|
|
149
|
-
contentToolbarItems,
|
|
150
|
-
footerToolbarItems,
|
|
151
|
-
questionToolbarItems,
|
|
152
|
-
otherToolbarItems,
|
|
153
|
-
aiAgentlist,
|
|
154
144
|
...chatOptions,
|
|
155
|
-
question: async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode) => {
|
|
156
|
-
id = createUUID();
|
|
157
|
-
abortController = new AbortController();
|
|
158
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
159
|
-
try {
|
|
160
|
-
const questionRequestData = {
|
|
161
|
-
messages: arr,
|
|
162
|
-
sessionid
|
|
163
|
-
};
|
|
164
|
-
if (srfaiagent) {
|
|
165
|
-
questionRequestData.srfaiagent = srfaiagent;
|
|
166
|
-
}
|
|
167
|
-
if (srfmode) {
|
|
168
|
-
questionRequestData.mode = srfmode;
|
|
169
|
-
}
|
|
170
|
-
await deService.aiChatSse((msg) => {
|
|
171
|
-
if (msg.actionstate === 20 && msg.actionresult) {
|
|
172
|
-
aiChat.addMessage({
|
|
173
|
-
messageid: id,
|
|
174
|
-
state: msg.actionstate,
|
|
175
|
-
type: "DEFAULT",
|
|
176
|
-
role: "ASSISTANT",
|
|
177
|
-
content: msg.actionresult
|
|
178
|
-
});
|
|
179
|
-
} else if (msg.actionstate === 30 && msg.actionresult) {
|
|
180
|
-
const result = JSON.parse(msg.actionresult);
|
|
181
|
-
const choices = result.choices;
|
|
182
|
-
if (choices && choices.length > 0) {
|
|
183
|
-
aiChat.replaceMessage({
|
|
184
|
-
messageid: id,
|
|
185
|
-
state: msg.actionstate,
|
|
186
|
-
type: "DEFAULT",
|
|
187
|
-
role: "ASSISTANT",
|
|
188
|
-
content: choices[0].content || ""
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
} else if (msg.actionstate === 40) {
|
|
192
|
-
aiChat.replaceMessage({
|
|
193
|
-
messageid: id,
|
|
194
|
-
state: msg.actionstate,
|
|
195
|
-
type: "ERROR",
|
|
196
|
-
role: "ASSISTANT",
|
|
197
|
-
content: msg.actionresult
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}, abortController, ctx, param, {
|
|
201
|
-
...questionRequestData
|
|
202
|
-
});
|
|
203
|
-
} catch (error) {
|
|
204
|
-
aiChat.replaceMessage({
|
|
205
|
-
messageid: id,
|
|
206
|
-
state: 40,
|
|
207
|
-
type: "ERROR",
|
|
208
|
-
role: "ASSISTANT",
|
|
209
|
-
content: error.message || ibiz.i18n.t("app.aiError")
|
|
210
|
-
});
|
|
211
|
-
abortController == null ? void 0 : abortController.abort();
|
|
212
|
-
} finally {
|
|
213
|
-
aiChat.completeMessage(id, true);
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
abortQuestion: async (aiChat) => {
|
|
218
|
-
abortController == null ? void 0 : abortController.abort();
|
|
219
|
-
await aiChat.stopMessage({
|
|
220
|
-
messageid: id,
|
|
221
|
-
state: 30,
|
|
222
|
-
type: "DEFAULT",
|
|
223
|
-
role: "ASSISTANT",
|
|
224
|
-
content: ""
|
|
225
|
-
});
|
|
226
|
-
await aiChat.completeMessage(id, true);
|
|
227
|
-
},
|
|
228
145
|
action: (action, message) => {
|
|
229
146
|
if (action === "backfill")
|
|
230
147
|
emit("change", message.realcontent);
|
|
231
|
-
},
|
|
232
|
-
history: async (ctx, param, other) => {
|
|
233
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
234
|
-
const historyRequestData = {};
|
|
235
|
-
if (other.appendCurData) {
|
|
236
|
-
Object.assign(historyRequestData, {
|
|
237
|
-
...other.appendCurData
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
if (other.srfaiagent) {
|
|
241
|
-
Object.assign(historyRequestData, {
|
|
242
|
-
srfaiagent: other.srfaiagent
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
if (other.srfmode) {
|
|
246
|
-
Object.assign(historyRequestData, {
|
|
247
|
-
mode: other.srfmode
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
const result = await deService.aiChatHistory(ctx, param, historyRequestData);
|
|
251
|
-
if (result.data && Array.isArray(result.data)) {
|
|
252
|
-
let preMsg;
|
|
253
|
-
result.data.forEach((item) => {
|
|
254
|
-
if (item.role === "TOOL") {
|
|
255
|
-
if (preMsg && item.content) {
|
|
256
|
-
chatInstance.aiChat.updateRecommendPrompt(preMsg, item.content);
|
|
257
|
-
}
|
|
258
|
-
} else {
|
|
259
|
-
const msg = {
|
|
260
|
-
messageid: createUUID(),
|
|
261
|
-
state: 30,
|
|
262
|
-
type: "DEFAULT",
|
|
263
|
-
role: item.role,
|
|
264
|
-
content: item.content,
|
|
265
|
-
completed: true
|
|
266
|
-
};
|
|
267
|
-
preMsg = msg;
|
|
268
|
-
chatInstance.aiChat.addMessage(msg);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
return true;
|
|
273
|
-
},
|
|
274
|
-
recommendPrompt: async (ctx, param, other) => {
|
|
275
|
-
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
276
|
-
const result = await deService.aiChatRecommendPrompt(ctx, param, other.message);
|
|
277
|
-
if (result.ok && result.data) {
|
|
278
|
-
const choices = result.data.choices;
|
|
279
|
-
if (choices && choices.length > 0) {
|
|
280
|
-
return choices[0];
|
|
281
|
-
}
|
|
282
|
-
return null;
|
|
283
|
-
}
|
|
284
|
-
return null;
|
|
285
|
-
},
|
|
286
|
-
uploader: {
|
|
287
|
-
onUpload: async (file, reportProgress, options) => {
|
|
288
|
-
const fileMeata = ibiz.util.file.calcFileUpDownUrl((options == null ? void 0 : options.context) || c.context, (options == null ? void 0 : options.params) || c.params, {});
|
|
289
|
-
const uploadHeaders = ibiz.util.file.getUploadHeaders();
|
|
290
|
-
const formData = new FormData();
|
|
291
|
-
formData.append("file", file);
|
|
292
|
-
const res = await ibiz.net.axios({
|
|
293
|
-
url: fileMeata.uploadUrl,
|
|
294
|
-
method: "post",
|
|
295
|
-
headers: uploadHeaders,
|
|
296
|
-
data: formData,
|
|
297
|
-
onUploadProgress: (progressEvent) => {
|
|
298
|
-
const percent = progressEvent.loaded / progressEvent.total * 100;
|
|
299
|
-
reportProgress(percent);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
return res.data;
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
extendToolbarClick: async (event, source, context, params, data) => {
|
|
306
|
-
var _a, _b;
|
|
307
|
-
const result = await UIActionUtil.exec(source.id, {
|
|
308
|
-
view: c.view,
|
|
309
|
-
ctrl: c.ctrl,
|
|
310
|
-
context: IBizContext.create(context),
|
|
311
|
-
params,
|
|
312
|
-
data: [data],
|
|
313
|
-
event
|
|
314
|
-
}, source.appId);
|
|
315
|
-
if (result.closeView) {
|
|
316
|
-
c.view.closeView({
|
|
317
|
-
ok: true
|
|
318
|
-
});
|
|
319
|
-
} else if (result.refresh) {
|
|
320
|
-
switch (result.refreshMode) {
|
|
321
|
-
case 1:
|
|
322
|
-
c.view.callUIAction(SysUIActionTag.REFRESH);
|
|
323
|
-
break;
|
|
324
|
-
case 2:
|
|
325
|
-
(_a = c.view.parentView) == null ? void 0 : _a.callUIAction(SysUIActionTag.REFRESH);
|
|
326
|
-
break;
|
|
327
|
-
case 3:
|
|
328
|
-
(_b = c.view.getTopView()) == null ? void 0 : _b.callUIAction(SysUIActionTag.REFRESH);
|
|
329
|
-
break;
|
|
330
|
-
default:
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return result;
|
|
334
148
|
}
|
|
335
149
|
}
|
|
336
150
|
});
|
|
@@ -20,7 +20,7 @@ class AIButtonMenu {
|
|
|
20
20
|
* @type {string}
|
|
21
21
|
* @memberof AIButtonMenu
|
|
22
22
|
*/
|
|
23
|
-
__publicField(this, "iconSvg", '<svg xmlns="http://www.w3.org/2000/svg"
|
|
23
|
+
__publicField(this, "iconSvg", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" height="1em" width="1em" preserveAspectRatio="xMidYMid meet" focusable="false" class="cherry-menu-AIChart"><g id="aae1.Base\u57FA\u7840/1.icon\u56FE\u6807/2.normal/ai-star" stroke-width="1" fill-rule="evenodd"><path d="M5.817 1.53l3.158 8.797h.054v.152l1.443 4.021-1.402.001-1.041-2.982H2.495l-1.03 2.982L0 14.5 4.671 1.533l1.146-.003zm7.86 5.424V14.5h-1.213V6.954h1.212zM5.248 3.549l-2.342 6.778h4.706L5.249 3.55zM13.046 0c.075 0 .147.02.204.071a.318.318 0 01.094.181l.064.273c.097.417.17.727.255.968.084.24.177.4.31.523.134.124.318.218.599.306.281.088.65.166 1.15.265a.358.358 0 01.195.095c.056.057.083.13.083.213a.289.289 0 01-.083.21.362.362 0 01-.197.094c-.528.093-.918.167-1.214.255-.295.088-.485.187-.621.324-.137.138-.23.324-.31.606-.08.283-.145.651-.23 1.147a.329.329 0 01-.093.184.293.293 0 01-.206.075.308.308 0 01-.207-.072.322.322 0 01-.1-.188l-.006-.033c-.085-.486-.149-.845-.228-1.12-.079-.274-.17-.452-.305-.585-.135-.133-.323-.23-.618-.32s-.683-.168-1.21-.273a.353.353 0 01-.2-.096.29.29 0 01-.08-.208c0-.079.023-.153.079-.211a.35.35 0 01.2-.097c.5-.098.869-.176 1.15-.263.282-.087.465-.18.597-.302.132-.12.224-.278.306-.511.082-.236.151-.539.244-.947l.071-.312a.312.312 0 01.102-.183.311.311 0 01.205-.069z" id="aae\u5F62\u72B6\u7ED3\u5408"></path></g></svg>');
|
|
24
24
|
/**
|
|
25
25
|
*
|
|
26
26
|
*
|