@ibiz-template/vue3-components 0.7.41-alpha.152 → 0.7.41-alpha.154
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/{index-Cs2bf-qT.js → index-CCjwOWuI.js} +6 -6
- package/dist/{index-DA2x586m.js → index-Cv6Yk83f.js} +1 -1
- package/dist/{index-B-mkNJ8X.js → index-DxYqmpkw.js} +1 -1
- package/dist/{index.es-CZeEzytG.js → index.es-CWquGkZQ.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-C09nwfM5.js → wang-editor-DoBDjJq7.js} +1 -1
- package/dist/{xlsx-util-C0viiHdq.js → xlsx-util-CQznxxzl.js} +1 -1
- package/es/common/rawitem/rawitem.mjs +38 -12
- package/es/editor/ai-chat/embed-ai-chat/embed-ai-chat.mjs +2 -1
- package/es/locale/en/index.mjs +2 -1
- package/es/locale/zh-CN/index.mjs +2 -1
- package/es/util/ai-chat-util/ai-chat-util.mjs +135 -26
- package/lib/common/rawitem/rawitem.cjs +38 -12
- package/lib/editor/ai-chat/embed-ai-chat/embed-ai-chat.cjs +2 -1
- package/lib/locale/en/index.cjs +2 -1
- package/lib/locale/zh-CN/index.cjs +2 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +135 -26
- package/package.json +5 -5
- package/src/common/rawitem/rawitem.tsx +50 -19
- package/src/editor/ai-chat/embed-ai-chat/embed-ai-chat.tsx +3 -0
- package/src/locale/en/index.ts +2 -0
- package/src/locale/zh-CN/index.ts +1 -0
- package/src/util/ai-chat-util/ai-chat-util.ts +195 -28
|
@@ -2,6 +2,7 @@ import { defineComponent, createVNode, resolveComponent, ref, watch } from 'vue'
|
|
|
2
2
|
import { useNamespace } from '@ibiz-template/vue3-util';
|
|
3
3
|
import { createUUID } from 'qx-util';
|
|
4
4
|
import { isBase64Image, isBase64, isSvg } from '@ibiz-template/core';
|
|
5
|
+
import { isObject } from 'lodash-es';
|
|
5
6
|
import '../../util/index.mjs';
|
|
6
7
|
import './rawitem.css';
|
|
7
8
|
import { parseHtml } from '../../util/wang-editor-util/wang-editor-util.mjs';
|
|
@@ -119,7 +120,8 @@ const IBizRawItem = /* @__PURE__ */ defineComponent({
|
|
|
119
120
|
}
|
|
120
121
|
} else if (["INFO", "WARNING", "ERROR"].includes(contentType)) {
|
|
121
122
|
rawItemContent.value = rawItem.rawContent;
|
|
122
|
-
} else if (
|
|
123
|
+
} else if (contentType === "DIVIDER" && !rawItem.rawItemParams) {
|
|
124
|
+
rawItemContent.value = rawItem.rawContent;
|
|
123
125
|
} else if (contentType === "IMAGE" && sysImage) {
|
|
124
126
|
rawItemContent.value = sysImage;
|
|
125
127
|
}
|
|
@@ -157,6 +159,15 @@ const IBizRawItem = /* @__PURE__ */ defineComponent({
|
|
|
157
159
|
showIcon: false
|
|
158
160
|
});
|
|
159
161
|
const rawItemText = ref("");
|
|
162
|
+
const getRawItemParams = () => {
|
|
163
|
+
const tempParams = {};
|
|
164
|
+
if (rawItem && rawItem.rawItemParams && rawItem.rawItemParams.length > 0) {
|
|
165
|
+
rawItem.rawItemParams.forEach((item) => {
|
|
166
|
+
tempParams[item.key] = item.value;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return tempParams;
|
|
170
|
+
};
|
|
160
171
|
const convertValue = () => {
|
|
161
172
|
if (rawItemType.value === "IMAGE") {
|
|
162
173
|
if (props.content && typeof props.content === "string") {
|
|
@@ -192,20 +203,36 @@ const IBizRawItem = /* @__PURE__ */ defineComponent({
|
|
|
192
203
|
let rawConfig = {};
|
|
193
204
|
try {
|
|
194
205
|
if (typeof rawItemContent.value === "string") {
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
if (/^[[{]/.test(rawItemContent.value)) {
|
|
207
|
+
const func = new Function("return (".concat(rawItemContent.value, ");"));
|
|
208
|
+
rawConfig = func();
|
|
209
|
+
} else {
|
|
210
|
+
rawConfig = rawItemContent.value;
|
|
211
|
+
}
|
|
197
212
|
switch (rawItemType.value) {
|
|
198
213
|
case "VIDEO":
|
|
199
|
-
|
|
214
|
+
if (isObject(rawConfig)) {
|
|
215
|
+
Object.assign(playerParams.value, rawConfig);
|
|
216
|
+
} else {
|
|
217
|
+
playerParams.value.path = rawConfig;
|
|
218
|
+
}
|
|
200
219
|
break;
|
|
201
220
|
case "DIVIDER":
|
|
202
|
-
|
|
221
|
+
if (isObject(rawConfig)) {
|
|
222
|
+
Object.assign(dividerParams.value, rawConfig);
|
|
223
|
+
} else {
|
|
224
|
+
dividerParams.value.html = rawConfig;
|
|
225
|
+
}
|
|
203
226
|
break;
|
|
204
227
|
case "INFO":
|
|
205
228
|
case "WARNING":
|
|
206
229
|
case "ERROR":
|
|
207
230
|
alertParams.value.type = rawItemType.value.toLocaleLowerCase();
|
|
208
|
-
|
|
231
|
+
if (isObject(rawConfig)) {
|
|
232
|
+
Object.assign(alertParams.value, rawConfig);
|
|
233
|
+
} else {
|
|
234
|
+
alertParams.value.title = rawConfig;
|
|
235
|
+
}
|
|
209
236
|
break;
|
|
210
237
|
default:
|
|
211
238
|
break;
|
|
@@ -216,13 +243,12 @@ const IBizRawItem = /* @__PURE__ */ defineComponent({
|
|
|
216
243
|
type: rawItemType.value
|
|
217
244
|
}));
|
|
218
245
|
}
|
|
219
|
-
} else if (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
rawItem.rawItemParams.forEach((item) => {
|
|
223
|
-
tempParams[item.key] = item.value;
|
|
224
|
-
});
|
|
246
|
+
} else if (["DIVIDER", "VIDEO"].includes(rawItemType.value)) {
|
|
247
|
+
const tempParams = getRawItemParams();
|
|
248
|
+
if (rawItemType.value === "VIDEO") {
|
|
225
249
|
Object.assign(playerParams.value, tempParams);
|
|
250
|
+
} else {
|
|
251
|
+
Object.assign(dividerParams.value, tempParams);
|
|
226
252
|
}
|
|
227
253
|
}
|
|
228
254
|
}
|
|
@@ -84,7 +84,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ defineComponent({
|
|
|
84
84
|
containerOptions: {
|
|
85
85
|
container: aiChatElementRef.value,
|
|
86
86
|
compWrapperId: editorParams.compwrapperid || "DEFAULT",
|
|
87
|
-
enableBackFill: false
|
|
87
|
+
enableBackFill: false,
|
|
88
|
+
isEmbedAiHeaderHidden: editorParams.isembedaiheaderhidden ? editorParams.isembedaiheaderhidden === "true" : ibiz.config.common.isEmbedAiHeaderHidden
|
|
88
89
|
},
|
|
89
90
|
topicOptions: {
|
|
90
91
|
appid: ibiz.env.appId,
|
package/es/locale/en/index.mjs
CHANGED
|
@@ -921,7 +921,8 @@ var index = {
|
|
|
921
921
|
discriminationPrejudice: "Discrimination or Prejudice Answer",
|
|
922
922
|
violationPrivacy: "Violation of Privacy",
|
|
923
923
|
contentInfringement: "Content infringement",
|
|
924
|
-
placeholder: "Please enter"
|
|
924
|
+
placeholder: "Please enter",
|
|
925
|
+
noFilePreviewAddress: "No attachment preview service. Please contact the administrator to add it!"
|
|
925
926
|
},
|
|
926
927
|
screenShotUtil: {
|
|
927
928
|
prepareCanvas: "Prepare the canvas...",
|
|
@@ -917,7 +917,8 @@ var index = {
|
|
|
917
917
|
discriminationPrejudice: "\u6B67\u89C6\u6216\u504F\u89C1\u56DE\u7B54",
|
|
918
918
|
violationPrivacy: "\u4FB5\u72AF\u9690\u79C1",
|
|
919
919
|
contentInfringement: "\u5185\u5BB9\u4FB5\u6743",
|
|
920
|
-
placeholder: "\u8BF7\u8F93\u5165"
|
|
920
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
921
|
+
noFilePreviewAddress: "\u65E0\u9644\u4EF6\u9884\u89C8\u670D\u52A1\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0!"
|
|
921
922
|
},
|
|
922
923
|
screenShotUtil: {
|
|
923
924
|
prepareCanvas: "\u51C6\u5907\u753B\u5E03\u4E2D...",
|
|
@@ -223,6 +223,11 @@ class AIChatUtil {
|
|
|
223
223
|
} else {
|
|
224
224
|
chatOptions.chatMessagePageSize = ibiz.config.common.aiChatMessagePageSize;
|
|
225
225
|
}
|
|
226
|
+
if (editorParams.srfaienableworkspace) {
|
|
227
|
+
chatOptions.enableWorkSpace = editorParams.srfaienableworkspace === "true";
|
|
228
|
+
} else {
|
|
229
|
+
chatOptions.enableWorkSpace = ibiz.config.common.aiEnableWorkSpace;
|
|
230
|
+
}
|
|
226
231
|
chatOptions.fetchAgentList = (args2 = {}) => {
|
|
227
232
|
const { query, agentid } = args2;
|
|
228
233
|
return this.getAIAgentList(
|
|
@@ -248,10 +253,21 @@ class AIChatUtil {
|
|
|
248
253
|
}
|
|
249
254
|
const sessionid = this.getChatSessionId("TEMP");
|
|
250
255
|
chatOptions.sessionid = sessionid;
|
|
251
|
-
|
|
252
|
-
|
|
256
|
+
const chatStateMap = /* @__PURE__ */ new WeakMap();
|
|
257
|
+
const getChatState = (aiChat) => {
|
|
258
|
+
let state = chatStateMap.get(aiChat);
|
|
259
|
+
if (!state) {
|
|
260
|
+
state = { id: "", abortController: new AbortController() };
|
|
261
|
+
chatStateMap.set(aiChat, state);
|
|
262
|
+
}
|
|
263
|
+
return state;
|
|
264
|
+
};
|
|
253
265
|
const { chatInstance, view, ctrl } = args;
|
|
254
|
-
|
|
266
|
+
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
267
|
+
if (editorParams.srfaifilepreviewmode) {
|
|
268
|
+
filePreviewMode = editorParams.srfaifilepreviewmode;
|
|
269
|
+
}
|
|
270
|
+
const fileSystemOptions = await this.getAIFileSystemOptions(filePreviewMode);
|
|
255
271
|
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
256
272
|
chatOptions.history = async (ctx, param, other) => {
|
|
257
273
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -314,8 +330,10 @@ class AIChatUtil {
|
|
|
314
330
|
};
|
|
315
331
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
316
332
|
let updateFlag = true;
|
|
317
|
-
|
|
318
|
-
|
|
333
|
+
const state = getChatState(aiChat);
|
|
334
|
+
state.id = createUUID();
|
|
335
|
+
state.abortController = new AbortController();
|
|
336
|
+
const { id, abortController } = state;
|
|
319
337
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
320
338
|
try {
|
|
321
339
|
const questionRequestData = {
|
|
@@ -437,6 +455,7 @@ class AIChatUtil {
|
|
|
437
455
|
}
|
|
438
456
|
};
|
|
439
457
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
458
|
+
const { id, abortController } = getChatState(aiChat);
|
|
440
459
|
abortController == null ? void 0 : abortController.abort();
|
|
441
460
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
442
461
|
if (asyncacitonid) {
|
|
@@ -471,8 +490,10 @@ class AIChatUtil {
|
|
|
471
490
|
};
|
|
472
491
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
473
492
|
if (other.asyncacitonid) {
|
|
474
|
-
|
|
475
|
-
|
|
493
|
+
const state = getChatState(aiChat);
|
|
494
|
+
state.id = createUUID();
|
|
495
|
+
state.abortController = new AbortController();
|
|
496
|
+
const { id, abortController } = state;
|
|
476
497
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
477
498
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
478
499
|
if (other.sessionid) {
|
|
@@ -490,11 +511,9 @@ class AIChatUtil {
|
|
|
490
511
|
srfproject: other.srfproject
|
|
491
512
|
});
|
|
492
513
|
try {
|
|
493
|
-
aiChat.addWaitingMessage(id);
|
|
494
514
|
await deService.aiResumeSse(
|
|
495
515
|
(msg) => {
|
|
496
516
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
497
|
-
aiChat.removeWaitingMessage(id);
|
|
498
517
|
aiChat.isLoading.value = true;
|
|
499
518
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
500
519
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -564,7 +583,6 @@ class AIChatUtil {
|
|
|
564
583
|
}
|
|
565
584
|
abortController == null ? void 0 : abortController.abort();
|
|
566
585
|
} finally {
|
|
567
|
-
aiChat.removeWaitingMessage(id);
|
|
568
586
|
aiChat.isLoading.value = false;
|
|
569
587
|
aiChat.completeMessage(id, true);
|
|
570
588
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -724,7 +742,7 @@ class AIChatUtil {
|
|
|
724
742
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
725
743
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
726
744
|
var _a2, _b, _c;
|
|
727
|
-
const { id
|
|
745
|
+
const { id, isPluginApp } = source;
|
|
728
746
|
let appId = source.appId;
|
|
729
747
|
const tempContext = IBizContext.create(context2);
|
|
730
748
|
if (isPluginApp) {
|
|
@@ -739,7 +757,7 @@ class AIChatUtil {
|
|
|
739
757
|
}
|
|
740
758
|
}
|
|
741
759
|
const result = await UIActionUtil.exec(
|
|
742
|
-
|
|
760
|
+
id,
|
|
743
761
|
{
|
|
744
762
|
view,
|
|
745
763
|
ctrl,
|
|
@@ -1028,6 +1046,12 @@ class AIChatUtil {
|
|
|
1028
1046
|
} else {
|
|
1029
1047
|
chatOptions.chatMessagePageSize = ibiz.config.common.aiChatMessagePageSize;
|
|
1030
1048
|
}
|
|
1049
|
+
if (params.hasOwnProperty("srfaienableworkspace")) {
|
|
1050
|
+
chatOptions.enableWorkSpace = params.srfaienableworkspace === "true";
|
|
1051
|
+
delete params.srfaienableworkspace;
|
|
1052
|
+
} else {
|
|
1053
|
+
chatOptions.enableWorkSpace = ibiz.config.common.aiEnableWorkSpace;
|
|
1054
|
+
}
|
|
1031
1055
|
chatOptions.fetchAgentList = (args2 = {}) => {
|
|
1032
1056
|
const { query, agentid } = args2;
|
|
1033
1057
|
return this.getAIAgentList(context, {
|
|
@@ -1051,10 +1075,22 @@ class AIChatUtil {
|
|
|
1051
1075
|
chatOptions.questionToolbarItems = questionToolbarItems;
|
|
1052
1076
|
chatOptions.otherToolbarItems = otherToolbarItems;
|
|
1053
1077
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1078
|
+
const chatStateMap = /* @__PURE__ */ new WeakMap();
|
|
1079
|
+
const getChatState = (aiChat) => {
|
|
1080
|
+
let state = chatStateMap.get(aiChat);
|
|
1081
|
+
if (!state) {
|
|
1082
|
+
state = { id: "", abortController: new AbortController() };
|
|
1083
|
+
chatStateMap.set(aiChat, state);
|
|
1084
|
+
}
|
|
1085
|
+
return state;
|
|
1086
|
+
};
|
|
1056
1087
|
const { chatInstance, view, ctrl } = args;
|
|
1057
|
-
|
|
1088
|
+
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
1089
|
+
if (params.hasOwnProperty("srfaifilepreviewmode")) {
|
|
1090
|
+
filePreviewMode = params.srfaifilepreviewmode;
|
|
1091
|
+
delete params.srfaifilepreviewmode;
|
|
1092
|
+
}
|
|
1093
|
+
const fileSystemOptions = await this.getAIFileSystemOptions(filePreviewMode);
|
|
1058
1094
|
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
1059
1095
|
chatOptions.history = async (ctx, param, other) => {
|
|
1060
1096
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -1117,8 +1153,10 @@ class AIChatUtil {
|
|
|
1117
1153
|
};
|
|
1118
1154
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
1119
1155
|
let updateFlag = true;
|
|
1120
|
-
|
|
1121
|
-
|
|
1156
|
+
const state = getChatState(aiChat);
|
|
1157
|
+
state.id = createUUID();
|
|
1158
|
+
state.abortController = new AbortController();
|
|
1159
|
+
const { id, abortController } = state;
|
|
1122
1160
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1123
1161
|
try {
|
|
1124
1162
|
const questionRequestData = {
|
|
@@ -1238,6 +1276,7 @@ class AIChatUtil {
|
|
|
1238
1276
|
}
|
|
1239
1277
|
};
|
|
1240
1278
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
1279
|
+
const { id, abortController } = getChatState(aiChat);
|
|
1241
1280
|
abortController == null ? void 0 : abortController.abort();
|
|
1242
1281
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
1243
1282
|
if (asyncacitonid) {
|
|
@@ -1272,8 +1311,10 @@ class AIChatUtil {
|
|
|
1272
1311
|
};
|
|
1273
1312
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
1274
1313
|
if (other.asyncacitonid) {
|
|
1275
|
-
|
|
1276
|
-
|
|
1314
|
+
const state = getChatState(aiChat);
|
|
1315
|
+
state.id = createUUID();
|
|
1316
|
+
state.abortController = new AbortController();
|
|
1317
|
+
const { id, abortController } = state;
|
|
1277
1318
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1278
1319
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
1279
1320
|
if (other.sessionid) {
|
|
@@ -1291,11 +1332,9 @@ class AIChatUtil {
|
|
|
1291
1332
|
srfproject: other.srfproject
|
|
1292
1333
|
});
|
|
1293
1334
|
try {
|
|
1294
|
-
aiChat.addWaitingMessage(id);
|
|
1295
1335
|
await deService.aiResumeSse(
|
|
1296
1336
|
(msg) => {
|
|
1297
1337
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1298
|
-
aiChat.removeWaitingMessage(id);
|
|
1299
1338
|
aiChat.isLoading.value = true;
|
|
1300
1339
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1301
1340
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -1365,7 +1404,6 @@ class AIChatUtil {
|
|
|
1365
1404
|
}
|
|
1366
1405
|
abortController == null ? void 0 : abortController.abort();
|
|
1367
1406
|
} finally {
|
|
1368
|
-
aiChat.removeWaitingMessage(id);
|
|
1369
1407
|
aiChat.isLoading.value = false;
|
|
1370
1408
|
aiChat.completeMessage(id, true);
|
|
1371
1409
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -1527,7 +1565,7 @@ class AIChatUtil {
|
|
|
1527
1565
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
1528
1566
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
1529
1567
|
var _a2, _b, _c;
|
|
1530
|
-
const { id
|
|
1568
|
+
const { id, isPluginApp } = source;
|
|
1531
1569
|
let appId = source.appId;
|
|
1532
1570
|
const tempContext = IBizContext.create(context2);
|
|
1533
1571
|
if (isPluginApp) {
|
|
@@ -1542,7 +1580,7 @@ class AIChatUtil {
|
|
|
1542
1580
|
}
|
|
1543
1581
|
}
|
|
1544
1582
|
const result = await UIActionUtil.exec(
|
|
1545
|
-
|
|
1583
|
+
id,
|
|
1546
1584
|
{
|
|
1547
1585
|
view,
|
|
1548
1586
|
ctrl,
|
|
@@ -1891,8 +1929,34 @@ class AIChatUtil {
|
|
|
1891
1929
|
* @returns {*} {Promise<IData>}
|
|
1892
1930
|
* @memberof AIChatUtil
|
|
1893
1931
|
*/
|
|
1894
|
-
async getAIFileSystemOptions() {
|
|
1932
|
+
async getAIFileSystemOptions(filePreviewMode) {
|
|
1895
1933
|
const fileSystemOptions = {};
|
|
1934
|
+
fileSystemOptions.filePreviewMode = filePreviewMode;
|
|
1935
|
+
fileSystemOptions.getCustomFilePreviewUrl = async (ctx, param, other) => {
|
|
1936
|
+
var _a;
|
|
1937
|
+
const filePreviewAddress = (_a = ibiz.env.customParams) == null ? void 0 : _a.file_preview_address;
|
|
1938
|
+
if (!filePreviewAddress) {
|
|
1939
|
+
ibiz.message.error(
|
|
1940
|
+
ibiz.i18n.t("util.aiChartUtil.noFilePreviewAddress")
|
|
1941
|
+
);
|
|
1942
|
+
return "";
|
|
1943
|
+
}
|
|
1944
|
+
const { id, name, folder } = other;
|
|
1945
|
+
let { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
1946
|
+
ctx,
|
|
1947
|
+
param,
|
|
1948
|
+
{},
|
|
1949
|
+
{ osscat: folder }
|
|
1950
|
+
);
|
|
1951
|
+
downloadUrl = downloadUrl.replace("%fileId%", id);
|
|
1952
|
+
const { protocol, hostname, port } = window.location;
|
|
1953
|
+
const actualPort = port || (protocol === "https:" ? "443" : "80");
|
|
1954
|
+
const windowInfo = "".concat(protocol, "//").concat(hostname, ":").concat(actualPort);
|
|
1955
|
+
const filedownloadurl = "".concat(windowInfo).concat(downloadUrl, "?fullfilename=").concat(name);
|
|
1956
|
+
const b64Encoded = ibiz.util.base64.encode(filedownloadurl);
|
|
1957
|
+
const previewUrl = "".concat(filePreviewAddress, "/onlinePreview?url=").concat(encodeURIComponent(b64Encoded));
|
|
1958
|
+
return previewUrl;
|
|
1959
|
+
};
|
|
1896
1960
|
fileSystemOptions.getFileList = async (ctx, param, other) => {
|
|
1897
1961
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1898
1962
|
const response = await deService.aiChatProject(
|
|
@@ -1909,12 +1973,57 @@ class AIChatUtil {
|
|
|
1909
1973
|
const response = await deService.aiChatProject(
|
|
1910
1974
|
ctx,
|
|
1911
1975
|
{ srfactag: param.srfactag },
|
|
1912
|
-
{
|
|
1976
|
+
{ action: "UPLOAD", ...other }
|
|
1913
1977
|
);
|
|
1914
1978
|
if (response.ok)
|
|
1915
1979
|
return response.data;
|
|
1916
1980
|
return void 0;
|
|
1917
1981
|
};
|
|
1982
|
+
fileSystemOptions.createFolder = async (ctx, param, other) => {
|
|
1983
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1984
|
+
const response = await deService.aiChatProject(
|
|
1985
|
+
ctx,
|
|
1986
|
+
{ srfactag: param.srfactag },
|
|
1987
|
+
{ action: "MKDIR", ...other }
|
|
1988
|
+
);
|
|
1989
|
+
return response.data;
|
|
1990
|
+
};
|
|
1991
|
+
fileSystemOptions.createFile = async (ctx, param, other) => {
|
|
1992
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1993
|
+
const response = await deService.aiChatProject(
|
|
1994
|
+
ctx,
|
|
1995
|
+
{ srfactag: param.srfactag },
|
|
1996
|
+
{ action: "WRITE", ...other }
|
|
1997
|
+
);
|
|
1998
|
+
return response.data;
|
|
1999
|
+
};
|
|
2000
|
+
fileSystemOptions.move = async (ctx, param, other) => {
|
|
2001
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
2002
|
+
const response = await deService.aiChatProject(
|
|
2003
|
+
ctx,
|
|
2004
|
+
{ srfactag: param.srfactag },
|
|
2005
|
+
{ action: "MOVE", ...other }
|
|
2006
|
+
);
|
|
2007
|
+
return response.data;
|
|
2008
|
+
};
|
|
2009
|
+
fileSystemOptions.delete = async (ctx, param, other) => {
|
|
2010
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
2011
|
+
const response = await deService.aiChatProject(
|
|
2012
|
+
ctx,
|
|
2013
|
+
{ srfactag: param.srfactag },
|
|
2014
|
+
{ recursive: true, action: "DELETE", ...other }
|
|
2015
|
+
);
|
|
2016
|
+
return response.data;
|
|
2017
|
+
};
|
|
2018
|
+
fileSystemOptions.readFile = async (ctx, param, other) => {
|
|
2019
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
2020
|
+
const response = await deService.aiChatProject(
|
|
2021
|
+
ctx,
|
|
2022
|
+
{ srfactag: param.srfactag },
|
|
2023
|
+
{ action: "READ", ...other }
|
|
2024
|
+
);
|
|
2025
|
+
return response.data;
|
|
2026
|
+
};
|
|
1918
2027
|
fileSystemOptions.getContent = async (ctx, param, id, type, cat) => {
|
|
1919
2028
|
const app = await ibiz.hub.getAppAsync(ctx.appId);
|
|
1920
2029
|
const requestUrl = "/ibizutil/downloadtxt/".concat(cat ? "".concat(cat, "/") : "").concat(id, "?type=").concat(type);
|
|
@@ -4,6 +4,7 @@ var vue = require('vue');
|
|
|
4
4
|
var vue3Util = require('@ibiz-template/vue3-util');
|
|
5
5
|
var qxUtil = require('qx-util');
|
|
6
6
|
var core = require('@ibiz-template/core');
|
|
7
|
+
var lodashEs = require('lodash-es');
|
|
7
8
|
require('../../util/index.cjs');
|
|
8
9
|
require('./rawitem.css');
|
|
9
10
|
var wangEditorUtil = require('../../util/wang-editor-util/wang-editor-util.cjs');
|
|
@@ -121,7 +122,8 @@ const IBizRawItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
121
122
|
}
|
|
122
123
|
} else if (["INFO", "WARNING", "ERROR"].includes(contentType)) {
|
|
123
124
|
rawItemContent.value = rawItem.rawContent;
|
|
124
|
-
} else if (
|
|
125
|
+
} else if (contentType === "DIVIDER" && !rawItem.rawItemParams) {
|
|
126
|
+
rawItemContent.value = rawItem.rawContent;
|
|
125
127
|
} else if (contentType === "IMAGE" && sysImage) {
|
|
126
128
|
rawItemContent.value = sysImage;
|
|
127
129
|
}
|
|
@@ -159,6 +161,15 @@ const IBizRawItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
159
161
|
showIcon: false
|
|
160
162
|
});
|
|
161
163
|
const rawItemText = vue.ref("");
|
|
164
|
+
const getRawItemParams = () => {
|
|
165
|
+
const tempParams = {};
|
|
166
|
+
if (rawItem && rawItem.rawItemParams && rawItem.rawItemParams.length > 0) {
|
|
167
|
+
rawItem.rawItemParams.forEach((item) => {
|
|
168
|
+
tempParams[item.key] = item.value;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return tempParams;
|
|
172
|
+
};
|
|
162
173
|
const convertValue = () => {
|
|
163
174
|
if (rawItemType.value === "IMAGE") {
|
|
164
175
|
if (props.content && typeof props.content === "string") {
|
|
@@ -194,20 +205,36 @@ const IBizRawItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
194
205
|
let rawConfig = {};
|
|
195
206
|
try {
|
|
196
207
|
if (typeof rawItemContent.value === "string") {
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
if (/^[[{]/.test(rawItemContent.value)) {
|
|
209
|
+
const func = new Function("return (".concat(rawItemContent.value, ");"));
|
|
210
|
+
rawConfig = func();
|
|
211
|
+
} else {
|
|
212
|
+
rawConfig = rawItemContent.value;
|
|
213
|
+
}
|
|
199
214
|
switch (rawItemType.value) {
|
|
200
215
|
case "VIDEO":
|
|
201
|
-
|
|
216
|
+
if (lodashEs.isObject(rawConfig)) {
|
|
217
|
+
Object.assign(playerParams.value, rawConfig);
|
|
218
|
+
} else {
|
|
219
|
+
playerParams.value.path = rawConfig;
|
|
220
|
+
}
|
|
202
221
|
break;
|
|
203
222
|
case "DIVIDER":
|
|
204
|
-
|
|
223
|
+
if (lodashEs.isObject(rawConfig)) {
|
|
224
|
+
Object.assign(dividerParams.value, rawConfig);
|
|
225
|
+
} else {
|
|
226
|
+
dividerParams.value.html = rawConfig;
|
|
227
|
+
}
|
|
205
228
|
break;
|
|
206
229
|
case "INFO":
|
|
207
230
|
case "WARNING":
|
|
208
231
|
case "ERROR":
|
|
209
232
|
alertParams.value.type = rawItemType.value.toLocaleLowerCase();
|
|
210
|
-
|
|
233
|
+
if (lodashEs.isObject(rawConfig)) {
|
|
234
|
+
Object.assign(alertParams.value, rawConfig);
|
|
235
|
+
} else {
|
|
236
|
+
alertParams.value.title = rawConfig;
|
|
237
|
+
}
|
|
211
238
|
break;
|
|
212
239
|
default:
|
|
213
240
|
break;
|
|
@@ -218,13 +245,12 @@ const IBizRawItem = /* @__PURE__ */ vue.defineComponent({
|
|
|
218
245
|
type: rawItemType.value
|
|
219
246
|
}));
|
|
220
247
|
}
|
|
221
|
-
} else if (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
rawItem.rawItemParams.forEach((item) => {
|
|
225
|
-
tempParams[item.key] = item.value;
|
|
226
|
-
});
|
|
248
|
+
} else if (["DIVIDER", "VIDEO"].includes(rawItemType.value)) {
|
|
249
|
+
const tempParams = getRawItemParams();
|
|
250
|
+
if (rawItemType.value === "VIDEO") {
|
|
227
251
|
Object.assign(playerParams.value, tempParams);
|
|
252
|
+
} else {
|
|
253
|
+
Object.assign(dividerParams.value, tempParams);
|
|
228
254
|
}
|
|
229
255
|
}
|
|
230
256
|
}
|
|
@@ -86,7 +86,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ vue.defineComponent({
|
|
|
86
86
|
containerOptions: {
|
|
87
87
|
container: aiChatElementRef.value,
|
|
88
88
|
compWrapperId: editorParams.compwrapperid || "DEFAULT",
|
|
89
|
-
enableBackFill: false
|
|
89
|
+
enableBackFill: false,
|
|
90
|
+
isEmbedAiHeaderHidden: editorParams.isembedaiheaderhidden ? editorParams.isembedaiheaderhidden === "true" : ibiz.config.common.isEmbedAiHeaderHidden
|
|
90
91
|
},
|
|
91
92
|
topicOptions: {
|
|
92
93
|
appid: ibiz.env.appId,
|
package/lib/locale/en/index.cjs
CHANGED
|
@@ -925,7 +925,8 @@ var index = {
|
|
|
925
925
|
discriminationPrejudice: "Discrimination or Prejudice Answer",
|
|
926
926
|
violationPrivacy: "Violation of Privacy",
|
|
927
927
|
contentInfringement: "Content infringement",
|
|
928
|
-
placeholder: "Please enter"
|
|
928
|
+
placeholder: "Please enter",
|
|
929
|
+
noFilePreviewAddress: "No attachment preview service. Please contact the administrator to add it!"
|
|
929
930
|
},
|
|
930
931
|
screenShotUtil: {
|
|
931
932
|
prepareCanvas: "Prepare the canvas...",
|
|
@@ -921,7 +921,8 @@ var index = {
|
|
|
921
921
|
discriminationPrejudice: "\u6B67\u89C6\u6216\u504F\u89C1\u56DE\u7B54",
|
|
922
922
|
violationPrivacy: "\u4FB5\u72AF\u9690\u79C1",
|
|
923
923
|
contentInfringement: "\u5185\u5BB9\u4FB5\u6743",
|
|
924
|
-
placeholder: "\u8BF7\u8F93\u5165"
|
|
924
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
925
|
+
noFilePreviewAddress: "\u65E0\u9644\u4EF6\u9884\u89C8\u670D\u52A1\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0!"
|
|
925
926
|
},
|
|
926
927
|
screenShotUtil: {
|
|
927
928
|
prepareCanvas: "\u51C6\u5907\u753B\u5E03\u4E2D...",
|