@ibiz-template/vue3-components 0.7.41-alpha.150 → 0.7.41-alpha.151
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-Dki2yYe9.js → index-BQtM_xOm.js} +4 -4
- package/dist/{index.es-7UWnjdb2.js → index.es-C1PS5x93.js} +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/{wang-editor-DRcvMIVh.js → wang-editor-D_CTYTF8.js} +1 -1
- package/dist/{xlsx-util-CkixgGjt.js → xlsx-util-Iz_Nf9mP.js} +1 -1
- package/es/control/drtab/drtab-control.util.mjs +1 -1
- package/es/editor/ai-chat/embed-ai-chat/embed-ai-chat.mjs +2 -1
- package/es/editor/upload/use/use-custom-upload.mjs +3 -1
- package/es/util/ai-chat-util/ai-chat-util.mjs +73 -28
- package/es/util/fullscreen/fullscreen-util.mjs +1 -1
- package/lib/control/drtab/drtab-control.util.cjs +1 -1
- package/lib/editor/ai-chat/embed-ai-chat/embed-ai-chat.cjs +2 -1
- package/lib/editor/upload/use/use-custom-upload.cjs +3 -1
- package/lib/util/ai-chat-util/ai-chat-util.cjs +73 -28
- package/lib/util/fullscreen/fullscreen-util.cjs +1 -1
- package/package.json +6 -6
- package/src/editor/ai-chat/embed-ai-chat/embed-ai-chat.tsx +1 -0
- package/src/editor/upload/use/use-custom-upload.ts +5 -1
- package/src/util/ai-chat-util/ai-chat-util.ts +106 -44
- /package/es/node_modules/.pnpm/{@ibiz-template_core@0.7.41-alpha.150_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs +0 -0
- /package/lib/node_modules/.pnpm/{@ibiz-template_core@0.7.41-alpha.150_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1 → @ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1}/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, watch, watchEffect, onUnmounted } from 'vue';
|
|
2
|
-
import { defaultNamespace } from '../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.
|
|
2
|
+
import { defaultNamespace } from '../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs';
|
|
3
3
|
|
|
4
4
|
"use strict";
|
|
5
5
|
function useAppDRTab(c, controlRef, counterData) {
|
|
@@ -83,7 +83,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ defineComponent({
|
|
|
83
83
|
resourceOptions,
|
|
84
84
|
containerOptions: {
|
|
85
85
|
container: aiChatElementRef.value,
|
|
86
|
-
compWrapperId: editorParams.compwrapperid || "DEFAULT"
|
|
86
|
+
compWrapperId: editorParams.compwrapperid || "DEFAULT",
|
|
87
|
+
enableBackFill: false
|
|
87
88
|
},
|
|
88
89
|
topicOptions: {
|
|
89
90
|
appid: ibiz.env.appId,
|
|
@@ -146,7 +146,9 @@ function useCustomUpload(c, options, emit) {
|
|
|
146
146
|
for (const file of files) {
|
|
147
147
|
const rawFile = file;
|
|
148
148
|
rawFile.uid = genFileId();
|
|
149
|
-
|
|
149
|
+
const relativePath = file.webkitRelativePath;
|
|
150
|
+
const lastSlash = relativePath.lastIndexOf("/");
|
|
151
|
+
rawFile.path = lastSlash > -1 ? relativePath.slice(0, lastSlash) : relativePath;
|
|
150
152
|
if (options.addCacheCount) {
|
|
151
153
|
options.addCacheCount();
|
|
152
154
|
}
|
|
@@ -251,19 +251,8 @@ class AIChatUtil {
|
|
|
251
251
|
let id = "";
|
|
252
252
|
let abortController;
|
|
253
253
|
const { chatInstance, view, ctrl } = args;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const response = await deService.aiChatProject(
|
|
257
|
-
ctx,
|
|
258
|
-
{ srfactag: param.srfactag },
|
|
259
|
-
other
|
|
260
|
-
);
|
|
261
|
-
let result = [];
|
|
262
|
-
if (response.data) {
|
|
263
|
-
result = Array.isArray(response.data) ? response.data : response.data.children;
|
|
264
|
-
}
|
|
265
|
-
return result;
|
|
266
|
-
};
|
|
254
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
255
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
267
256
|
chatOptions.history = async (ctx, param, other) => {
|
|
268
257
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
269
258
|
const historyRequestData = {};
|
|
@@ -323,7 +312,8 @@ class AIChatUtil {
|
|
|
323
312
|
}
|
|
324
313
|
return true;
|
|
325
314
|
};
|
|
326
|
-
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject) => {
|
|
315
|
+
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
316
|
+
let updateFlag = true;
|
|
327
317
|
id = createUUID();
|
|
328
318
|
abortController = new AbortController();
|
|
329
319
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -368,6 +358,10 @@ class AIChatUtil {
|
|
|
368
358
|
await deService.aiChatSse(
|
|
369
359
|
(msg) => {
|
|
370
360
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
361
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
362
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
363
|
+
updateFlag = false;
|
|
364
|
+
}
|
|
371
365
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
372
366
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
373
367
|
}
|
|
@@ -1054,19 +1048,8 @@ class AIChatUtil {
|
|
|
1054
1048
|
let id = "";
|
|
1055
1049
|
let abortController;
|
|
1056
1050
|
const { chatInstance, view, ctrl } = args;
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
const response = await deService.aiChatProject(
|
|
1060
|
-
ctx,
|
|
1061
|
-
{ srfactag: param.srfactag },
|
|
1062
|
-
other
|
|
1063
|
-
);
|
|
1064
|
-
let result = [];
|
|
1065
|
-
if (response.data) {
|
|
1066
|
-
result = Array.isArray(response.data) ? response.data : response.data.children;
|
|
1067
|
-
}
|
|
1068
|
-
return result;
|
|
1069
|
-
};
|
|
1051
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
1052
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
1070
1053
|
chatOptions.history = async (ctx, param, other) => {
|
|
1071
1054
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1072
1055
|
const historyRequestData = {};
|
|
@@ -1126,7 +1109,8 @@ class AIChatUtil {
|
|
|
1126
1109
|
}
|
|
1127
1110
|
return true;
|
|
1128
1111
|
};
|
|
1129
|
-
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject) => {
|
|
1112
|
+
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
1113
|
+
let updateFlag = true;
|
|
1130
1114
|
id = createUUID();
|
|
1131
1115
|
abortController = new AbortController();
|
|
1132
1116
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -1169,6 +1153,10 @@ class AIChatUtil {
|
|
|
1169
1153
|
await deService.aiChatSse(
|
|
1170
1154
|
(msg) => {
|
|
1171
1155
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1156
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
1157
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
1158
|
+
updateFlag = false;
|
|
1159
|
+
}
|
|
1172
1160
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1173
1161
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
1174
1162
|
}
|
|
@@ -1886,6 +1874,63 @@ class AIChatUtil {
|
|
|
1886
1874
|
};
|
|
1887
1875
|
return resourceOptions;
|
|
1888
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* @description 获取AI文件系统相关参数
|
|
1879
|
+
* @returns {*} {Promise<IData>}
|
|
1880
|
+
* @memberof AIChatUtil
|
|
1881
|
+
*/
|
|
1882
|
+
async getAIFileSystemOptions() {
|
|
1883
|
+
const fileSystemOptions = {};
|
|
1884
|
+
fileSystemOptions.getFileList = async (ctx, param, other) => {
|
|
1885
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1886
|
+
const response = await deService.aiChatProject(
|
|
1887
|
+
ctx,
|
|
1888
|
+
{ srfactag: param.srfactag },
|
|
1889
|
+
{ ...other }
|
|
1890
|
+
);
|
|
1891
|
+
if (response.ok)
|
|
1892
|
+
return response.data;
|
|
1893
|
+
return void 0;
|
|
1894
|
+
};
|
|
1895
|
+
fileSystemOptions.uploadFile = async (ctx, param, other) => {
|
|
1896
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1897
|
+
const response = await deService.aiChatProject(
|
|
1898
|
+
ctx,
|
|
1899
|
+
{ srfactag: param.srfactag },
|
|
1900
|
+
{ ...other, action: "UPLOAD" }
|
|
1901
|
+
);
|
|
1902
|
+
if (response.ok)
|
|
1903
|
+
return response.data;
|
|
1904
|
+
return void 0;
|
|
1905
|
+
};
|
|
1906
|
+
fileSystemOptions.getContent = async (ctx, param, id, type, cat) => {
|
|
1907
|
+
const app = await ibiz.hub.getAppAsync(ctx.appId);
|
|
1908
|
+
const requestUrl = "/ibizutil/downloadtxt/".concat(cat ? "".concat(cat, "/") : "").concat(id, "?type=").concat(type);
|
|
1909
|
+
const res = await app.net.get(requestUrl);
|
|
1910
|
+
if (res && res.ok && res.data) {
|
|
1911
|
+
return res.data;
|
|
1912
|
+
}
|
|
1913
|
+
};
|
|
1914
|
+
fileSystemOptions.getImgContent = async (ctx, param, id, type, cat) => {
|
|
1915
|
+
const { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
1916
|
+
ctx,
|
|
1917
|
+
param,
|
|
1918
|
+
{},
|
|
1919
|
+
{ osscat: cat }
|
|
1920
|
+
);
|
|
1921
|
+
let content = downloadUrl.replace("%fileId%", id);
|
|
1922
|
+
if (type === "svg") {
|
|
1923
|
+
const response = await ibiz.net.request(content, {
|
|
1924
|
+
method: "get",
|
|
1925
|
+
responseType: "blob",
|
|
1926
|
+
baseURL: ""
|
|
1927
|
+
});
|
|
1928
|
+
content = await response.data.text();
|
|
1929
|
+
}
|
|
1930
|
+
return content;
|
|
1931
|
+
};
|
|
1932
|
+
return fileSystemOptions;
|
|
1933
|
+
}
|
|
1889
1934
|
}
|
|
1890
1935
|
|
|
1891
1936
|
export { AIChatUtil };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createApp } from 'vue';
|
|
2
2
|
import ElementPlus from 'element-plus';
|
|
3
|
-
import { defaultNamespace } from '../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.
|
|
3
|
+
import { defaultNamespace } from '../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1/node_modules/@ibiz-template/core/out/utils/namespace/namespace.mjs';
|
|
4
4
|
import { IBizFullscreenToolbar } from '../../common/fullscreen-toolbar/fullscreen-toolbar.mjs';
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
|
-
var namespace = require('../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.
|
|
4
|
+
var namespace = require('../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs');
|
|
5
5
|
|
|
6
6
|
"use strict";
|
|
7
7
|
function useAppDRTab(c, controlRef, counterData) {
|
|
@@ -85,7 +85,8 @@ const IBizEmbedAIChat = /* @__PURE__ */ vue.defineComponent({
|
|
|
85
85
|
resourceOptions,
|
|
86
86
|
containerOptions: {
|
|
87
87
|
container: aiChatElementRef.value,
|
|
88
|
-
compWrapperId: editorParams.compwrapperid || "DEFAULT"
|
|
88
|
+
compWrapperId: editorParams.compwrapperid || "DEFAULT",
|
|
89
|
+
enableBackFill: false
|
|
89
90
|
},
|
|
90
91
|
topicOptions: {
|
|
91
92
|
appid: ibiz.env.appId,
|
|
@@ -148,7 +148,9 @@ function useCustomUpload(c, options, emit) {
|
|
|
148
148
|
for (const file of files) {
|
|
149
149
|
const rawFile = file;
|
|
150
150
|
rawFile.uid = genFileId();
|
|
151
|
-
|
|
151
|
+
const relativePath = file.webkitRelativePath;
|
|
152
|
+
const lastSlash = relativePath.lastIndexOf("/");
|
|
153
|
+
rawFile.path = lastSlash > -1 ? relativePath.slice(0, lastSlash) : relativePath;
|
|
152
154
|
if (options.addCacheCount) {
|
|
153
155
|
options.addCacheCount();
|
|
154
156
|
}
|
|
@@ -253,19 +253,8 @@ class AIChatUtil {
|
|
|
253
253
|
let id = "";
|
|
254
254
|
let abortController;
|
|
255
255
|
const { chatInstance, view, ctrl } = args;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
const response = await deService.aiChatProject(
|
|
259
|
-
ctx,
|
|
260
|
-
{ srfactag: param.srfactag },
|
|
261
|
-
other
|
|
262
|
-
);
|
|
263
|
-
let result = [];
|
|
264
|
-
if (response.data) {
|
|
265
|
-
result = Array.isArray(response.data) ? response.data : response.data.children;
|
|
266
|
-
}
|
|
267
|
-
return result;
|
|
268
|
-
};
|
|
256
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
257
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
269
258
|
chatOptions.history = async (ctx, param, other) => {
|
|
270
259
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
271
260
|
const historyRequestData = {};
|
|
@@ -325,7 +314,8 @@ class AIChatUtil {
|
|
|
325
314
|
}
|
|
326
315
|
return true;
|
|
327
316
|
};
|
|
328
|
-
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject) => {
|
|
317
|
+
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
318
|
+
let updateFlag = true;
|
|
329
319
|
id = qxUtil.createUUID();
|
|
330
320
|
abortController = new AbortController();
|
|
331
321
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -370,6 +360,10 @@ class AIChatUtil {
|
|
|
370
360
|
await deService.aiChatSse(
|
|
371
361
|
(msg) => {
|
|
372
362
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
363
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
364
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
365
|
+
updateFlag = false;
|
|
366
|
+
}
|
|
373
367
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
374
368
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
375
369
|
}
|
|
@@ -1056,19 +1050,8 @@ class AIChatUtil {
|
|
|
1056
1050
|
let id = "";
|
|
1057
1051
|
let abortController;
|
|
1058
1052
|
const { chatInstance, view, ctrl } = args;
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
const response = await deService.aiChatProject(
|
|
1062
|
-
ctx,
|
|
1063
|
-
{ srfactag: param.srfactag },
|
|
1064
|
-
other
|
|
1065
|
-
);
|
|
1066
|
-
let result = [];
|
|
1067
|
-
if (response.data) {
|
|
1068
|
-
result = Array.isArray(response.data) ? response.data : response.data.children;
|
|
1069
|
-
}
|
|
1070
|
-
return result;
|
|
1071
|
-
};
|
|
1053
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
1054
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
1072
1055
|
chatOptions.history = async (ctx, param, other) => {
|
|
1073
1056
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1074
1057
|
const historyRequestData = {};
|
|
@@ -1128,7 +1111,8 @@ class AIChatUtil {
|
|
|
1128
1111
|
}
|
|
1129
1112
|
return true;
|
|
1130
1113
|
};
|
|
1131
|
-
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject) => {
|
|
1114
|
+
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
1115
|
+
let updateFlag = true;
|
|
1132
1116
|
id = qxUtil.createUUID();
|
|
1133
1117
|
abortController = new AbortController();
|
|
1134
1118
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
@@ -1171,6 +1155,10 @@ class AIChatUtil {
|
|
|
1171
1155
|
await deService.aiChatSse(
|
|
1172
1156
|
(msg) => {
|
|
1173
1157
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1158
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
1159
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
1160
|
+
updateFlag = false;
|
|
1161
|
+
}
|
|
1174
1162
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1175
1163
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
1176
1164
|
}
|
|
@@ -1888,6 +1876,63 @@ class AIChatUtil {
|
|
|
1888
1876
|
};
|
|
1889
1877
|
return resourceOptions;
|
|
1890
1878
|
}
|
|
1879
|
+
/**
|
|
1880
|
+
* @description 获取AI文件系统相关参数
|
|
1881
|
+
* @returns {*} {Promise<IData>}
|
|
1882
|
+
* @memberof AIChatUtil
|
|
1883
|
+
*/
|
|
1884
|
+
async getAIFileSystemOptions() {
|
|
1885
|
+
const fileSystemOptions = {};
|
|
1886
|
+
fileSystemOptions.getFileList = async (ctx, param, other) => {
|
|
1887
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1888
|
+
const response = await deService.aiChatProject(
|
|
1889
|
+
ctx,
|
|
1890
|
+
{ srfactag: param.srfactag },
|
|
1891
|
+
{ ...other }
|
|
1892
|
+
);
|
|
1893
|
+
if (response.ok)
|
|
1894
|
+
return response.data;
|
|
1895
|
+
return void 0;
|
|
1896
|
+
};
|
|
1897
|
+
fileSystemOptions.uploadFile = async (ctx, param, other) => {
|
|
1898
|
+
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, param.appDataEntityId);
|
|
1899
|
+
const response = await deService.aiChatProject(
|
|
1900
|
+
ctx,
|
|
1901
|
+
{ srfactag: param.srfactag },
|
|
1902
|
+
{ ...other, action: "UPLOAD" }
|
|
1903
|
+
);
|
|
1904
|
+
if (response.ok)
|
|
1905
|
+
return response.data;
|
|
1906
|
+
return void 0;
|
|
1907
|
+
};
|
|
1908
|
+
fileSystemOptions.getContent = async (ctx, param, id, type, cat) => {
|
|
1909
|
+
const app = await ibiz.hub.getAppAsync(ctx.appId);
|
|
1910
|
+
const requestUrl = "/ibizutil/downloadtxt/".concat(cat ? "".concat(cat, "/") : "").concat(id, "?type=").concat(type);
|
|
1911
|
+
const res = await app.net.get(requestUrl);
|
|
1912
|
+
if (res && res.ok && res.data) {
|
|
1913
|
+
return res.data;
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
fileSystemOptions.getImgContent = async (ctx, param, id, type, cat) => {
|
|
1917
|
+
const { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
1918
|
+
ctx,
|
|
1919
|
+
param,
|
|
1920
|
+
{},
|
|
1921
|
+
{ osscat: cat }
|
|
1922
|
+
);
|
|
1923
|
+
let content = downloadUrl.replace("%fileId%", id);
|
|
1924
|
+
if (type === "svg") {
|
|
1925
|
+
const response = await ibiz.net.request(content, {
|
|
1926
|
+
method: "get",
|
|
1927
|
+
responseType: "blob",
|
|
1928
|
+
baseURL: ""
|
|
1929
|
+
});
|
|
1930
|
+
content = await response.data.text();
|
|
1931
|
+
}
|
|
1932
|
+
return content;
|
|
1933
|
+
};
|
|
1934
|
+
return fileSystemOptions;
|
|
1935
|
+
}
|
|
1891
1936
|
}
|
|
1892
1937
|
|
|
1893
1938
|
exports.AIChatUtil = AIChatUtil;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var vue = require('vue');
|
|
4
4
|
var ElementPlus = require('element-plus');
|
|
5
|
-
var namespace = require('../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.
|
|
5
|
+
var namespace = require('../../node_modules/.pnpm/@ibiz-template_core@0.7.41-alpha.152_axios@1.12.2_lodash-es@4.17.21_qs@6.14.0_qx-util@0.4.8_ramda@0.29.1/node_modules/@ibiz-template/core/out/utils/namespace/namespace.cjs');
|
|
6
6
|
var fullscreenToolbar = require('../../common/fullscreen-toolbar/fullscreen-toolbar.cjs');
|
|
7
7
|
|
|
8
8
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/vue3-components",
|
|
3
|
-
"version": "0.7.41-alpha.
|
|
3
|
+
"version": "0.7.41-alpha.151",
|
|
4
4
|
"description": "web端组件库(vue3)",
|
|
5
5
|
"main": "lib/index.cjs",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
33
33
|
"@floating-ui/dom": "^1.5.3",
|
|
34
|
-
"@ibiz-template-plugin/ai-chat": "^0.0.
|
|
34
|
+
"@ibiz-template-plugin/ai-chat": "^0.0.116",
|
|
35
35
|
"@ibiz-template-plugin/gantt": "0.1.8-alpha.468",
|
|
36
36
|
"@ibiz-template-plugin/bi-report": "0.0.32",
|
|
37
37
|
"@ibiz-template-plugin/data-view": "0.0.8",
|
|
38
|
-
"@ibiz-template/core": "0.7.41-alpha.
|
|
38
|
+
"@ibiz-template/core": "0.7.41-alpha.152",
|
|
39
39
|
"@ibiz-template/devtool": "0.0.17",
|
|
40
|
-
"@ibiz-template/model-helper": "0.7.41-alpha.
|
|
41
|
-
"@ibiz-template/runtime": "0.7.41-alpha.
|
|
40
|
+
"@ibiz-template/model-helper": "0.7.41-alpha.152",
|
|
41
|
+
"@ibiz-template/runtime": "0.7.41-alpha.152",
|
|
42
42
|
"@ibiz-template/theme": "0.7.39",
|
|
43
|
-
"@ibiz-template/vue3-util": "0.7.41-alpha.
|
|
43
|
+
"@ibiz-template/vue3-util": "0.7.41-alpha.152",
|
|
44
44
|
"@ibiz-template/web-theme": "3.16.0",
|
|
45
45
|
"@ibiz/model-core": "^0.1.89",
|
|
46
46
|
"@imengyu/vue3-context-menu": "^1.3.5",
|
|
@@ -253,7 +253,11 @@ export function useCustomUpload(
|
|
|
253
253
|
for (const file of files) {
|
|
254
254
|
const rawFile = file as UploadRawFile;
|
|
255
255
|
rawFile.uid = genFileId();
|
|
256
|
-
|
|
256
|
+
// path 仅保留目录部分,去掉自身文件名
|
|
257
|
+
const relativePath = file.webkitRelativePath;
|
|
258
|
+
const lastSlash = relativePath.lastIndexOf('/');
|
|
259
|
+
rawFile.path =
|
|
260
|
+
lastSlash > -1 ? relativePath.slice(0, lastSlash) : relativePath;
|
|
257
261
|
|
|
258
262
|
// 文件夹上传绕过 beforeUpload 钩子,需要手动补偿缓存计数
|
|
259
263
|
if (options.addCacheCount) {
|
|
@@ -378,28 +378,9 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
378
378
|
let id: string = '';
|
|
379
379
|
let abortController: AbortController;
|
|
380
380
|
const { chatInstance, view, ctrl } = args;
|
|
381
|
-
//
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
param: IParams,
|
|
385
|
-
other: IParams,
|
|
386
|
-
) => {
|
|
387
|
-
const deService = await ibiz.hub
|
|
388
|
-
.getApp(ctx.srfappid)
|
|
389
|
-
.deService.getService(ctx, param.appDataEntityId);
|
|
390
|
-
const response = await deService.aiChatProject(
|
|
391
|
-
ctx,
|
|
392
|
-
{ srfactag: param.srfactag },
|
|
393
|
-
other,
|
|
394
|
-
);
|
|
395
|
-
let result: IData[] = [];
|
|
396
|
-
if (response.data) {
|
|
397
|
-
result = Array.isArray(response.data)
|
|
398
|
-
? response.data
|
|
399
|
-
: response.data.children;
|
|
400
|
-
}
|
|
401
|
-
return result;
|
|
402
|
-
};
|
|
381
|
+
// 文件系统操作参数
|
|
382
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
383
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
403
384
|
// 请求历史
|
|
404
385
|
chatOptions.history = async (
|
|
405
386
|
ctx: IContext,
|
|
@@ -483,7 +464,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
483
464
|
mcpservers: string | undefined,
|
|
484
465
|
sessionmeta: IData | undefined,
|
|
485
466
|
srfproject: string | undefined,
|
|
467
|
+
localMsgID: string,
|
|
486
468
|
) => {
|
|
469
|
+
// 更新标记,主要用于更新用户消息真实消息ID(每条消息都会回asextparam,只需要设置一次即可)
|
|
470
|
+
let updateFlag = true;
|
|
487
471
|
id = createUUID();
|
|
488
472
|
abortController = new AbortController();
|
|
489
473
|
const deService = await ibiz.hub
|
|
@@ -528,6 +512,11 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
528
512
|
(msg: IPortalAsyncAction) => {
|
|
529
513
|
// 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
|
|
530
514
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
515
|
+
// 更新用户消息真实id
|
|
516
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
517
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
518
|
+
updateFlag = false;
|
|
519
|
+
}
|
|
531
520
|
// 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
|
|
532
521
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
533
522
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -1383,28 +1372,9 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1383
1372
|
let id: string = '';
|
|
1384
1373
|
let abortController: AbortController;
|
|
1385
1374
|
const { chatInstance, view, ctrl } = args;
|
|
1386
|
-
//
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
param: IParams,
|
|
1390
|
-
other: IParams,
|
|
1391
|
-
) => {
|
|
1392
|
-
const deService = await ibiz.hub
|
|
1393
|
-
.getApp(ctx.srfappid)
|
|
1394
|
-
.deService.getService(ctx, param.appDataEntityId);
|
|
1395
|
-
const response = await deService.aiChatProject(
|
|
1396
|
-
ctx,
|
|
1397
|
-
{ srfactag: param.srfactag },
|
|
1398
|
-
other,
|
|
1399
|
-
);
|
|
1400
|
-
let result: IData[] = [];
|
|
1401
|
-
if (response.data) {
|
|
1402
|
-
result = Array.isArray(response.data)
|
|
1403
|
-
? response.data
|
|
1404
|
-
: response.data.children;
|
|
1405
|
-
}
|
|
1406
|
-
return result;
|
|
1407
|
-
};
|
|
1375
|
+
// 文件系统操作参数
|
|
1376
|
+
const fileSystemOptions = await this.getAIFileSystemOptions();
|
|
1377
|
+
chatOptions.fileSystemOptions = fileSystemOptions;
|
|
1408
1378
|
// 查询历史
|
|
1409
1379
|
chatOptions.history = async (
|
|
1410
1380
|
ctx: IContext,
|
|
@@ -1488,7 +1458,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1488
1458
|
mcpservers: string | undefined,
|
|
1489
1459
|
sessionmeta: IData | undefined,
|
|
1490
1460
|
srfproject: string | undefined,
|
|
1461
|
+
localMsgID: string,
|
|
1491
1462
|
) => {
|
|
1463
|
+
// 更新标记,主要用于更新用户消息真实消息ID(每条消息都会回asextparam,只需要设置一次即可)
|
|
1464
|
+
let updateFlag = true;
|
|
1492
1465
|
id = createUUID();
|
|
1493
1466
|
abortController = new AbortController();
|
|
1494
1467
|
const deService = await ibiz.hub
|
|
@@ -1531,6 +1504,11 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1531
1504
|
(msg: IPortalAsyncAction) => {
|
|
1532
1505
|
// 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
|
|
1533
1506
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1507
|
+
// 更新用户消息真实id
|
|
1508
|
+
if (msg.asextparam && localMsgID && updateFlag) {
|
|
1509
|
+
aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
|
|
1510
|
+
updateFlag = false;
|
|
1511
|
+
}
|
|
1534
1512
|
// 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
|
|
1535
1513
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1536
1514
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -2415,4 +2393,88 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
2415
2393
|
};
|
|
2416
2394
|
return resourceOptions;
|
|
2417
2395
|
}
|
|
2396
|
+
|
|
2397
|
+
/**
|
|
2398
|
+
* @description 获取AI文件系统相关参数
|
|
2399
|
+
* @returns {*} {Promise<IData>}
|
|
2400
|
+
* @memberof AIChatUtil
|
|
2401
|
+
*/
|
|
2402
|
+
async getAIFileSystemOptions(): Promise<IData> {
|
|
2403
|
+
const fileSystemOptions: IData = {};
|
|
2404
|
+
// 查询文件列表
|
|
2405
|
+
fileSystemOptions.getFileList = async (
|
|
2406
|
+
ctx: IContext,
|
|
2407
|
+
param: IParams,
|
|
2408
|
+
other: IParams,
|
|
2409
|
+
): Promise<IData | undefined> => {
|
|
2410
|
+
const deService = await ibiz.hub
|
|
2411
|
+
.getApp(ctx.srfappid)
|
|
2412
|
+
.deService.getService(ctx, param.appDataEntityId);
|
|
2413
|
+
const response = await deService.aiChatProject(
|
|
2414
|
+
ctx,
|
|
2415
|
+
{ srfactag: param.srfactag },
|
|
2416
|
+
{ ...other },
|
|
2417
|
+
);
|
|
2418
|
+
if (response.ok) return response.data;
|
|
2419
|
+
return undefined;
|
|
2420
|
+
};
|
|
2421
|
+
// 上传文件
|
|
2422
|
+
fileSystemOptions.uploadFile = async (
|
|
2423
|
+
ctx: IContext,
|
|
2424
|
+
param: IParams,
|
|
2425
|
+
other: IParams,
|
|
2426
|
+
): Promise<IData | undefined> => {
|
|
2427
|
+
const deService = await ibiz.hub
|
|
2428
|
+
.getApp(ctx.srfappid)
|
|
2429
|
+
.deService.getService(ctx, param.appDataEntityId);
|
|
2430
|
+
const response = await deService.aiChatProject(
|
|
2431
|
+
ctx,
|
|
2432
|
+
{ srfactag: param.srfactag },
|
|
2433
|
+
{ ...other, action: 'UPLOAD' },
|
|
2434
|
+
);
|
|
2435
|
+
if (response.ok) return response.data;
|
|
2436
|
+
return undefined;
|
|
2437
|
+
};
|
|
2438
|
+
// 获取文件内容
|
|
2439
|
+
fileSystemOptions.getContent = async (
|
|
2440
|
+
ctx: IContext,
|
|
2441
|
+
param: IParams,
|
|
2442
|
+
id: string,
|
|
2443
|
+
type: string,
|
|
2444
|
+
cat: string,
|
|
2445
|
+
): Promise<string | IData | undefined> => {
|
|
2446
|
+
const app = await ibiz.hub.getAppAsync(ctx.appId);
|
|
2447
|
+
const requestUrl = `/ibizutil/downloadtxt/${cat ? `${cat}/` : ''}${id}?type=${type}`;
|
|
2448
|
+
const res = await app.net.get(requestUrl);
|
|
2449
|
+
if (res && res.ok && res.data) {
|
|
2450
|
+
return res.data;
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
// 获取图片内容
|
|
2454
|
+
fileSystemOptions.getImgContent = async (
|
|
2455
|
+
ctx: IContext,
|
|
2456
|
+
param: IParams,
|
|
2457
|
+
id: string,
|
|
2458
|
+
type: string,
|
|
2459
|
+
cat: string,
|
|
2460
|
+
): Promise<string> => {
|
|
2461
|
+
const { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
|
|
2462
|
+
ctx,
|
|
2463
|
+
param,
|
|
2464
|
+
{},
|
|
2465
|
+
{ osscat: cat },
|
|
2466
|
+
);
|
|
2467
|
+
let content = downloadUrl.replace('%fileId%', id);
|
|
2468
|
+
if (type === 'svg') {
|
|
2469
|
+
const response = await ibiz.net.request(content, {
|
|
2470
|
+
method: 'get',
|
|
2471
|
+
responseType: 'blob',
|
|
2472
|
+
baseURL: '',
|
|
2473
|
+
});
|
|
2474
|
+
content = await response.data.text();
|
|
2475
|
+
}
|
|
2476
|
+
return content;
|
|
2477
|
+
};
|
|
2478
|
+
return fileSystemOptions;
|
|
2479
|
+
}
|
|
2418
2480
|
}
|