@ibiz-template/vue3-components 0.7.41-alpha.153 → 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-pFskXRPD.js → index-CCjwOWuI.js} +4 -4
- package/dist/{index.es-DcGGowg9.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-D0vwuhRC.js → wang-editor-DoBDjJq7.js} +1 -1
- package/dist/{xlsx-util-oopIn_S1.js → xlsx-util-CQznxxzl.js} +1 -1
- package/es/util/ai-chat-util/ai-chat-util.mjs +40 -22
- package/lib/util/ai-chat-util/ai-chat-util.cjs +40 -22
- package/package.json +5 -5
- package/src/util/ai-chat-util/ai-chat-util.ts +44 -24
|
@@ -253,8 +253,15 @@ class AIChatUtil {
|
|
|
253
253
|
}
|
|
254
254
|
const sessionid = this.getChatSessionId("TEMP");
|
|
255
255
|
chatOptions.sessionid = sessionid;
|
|
256
|
-
|
|
257
|
-
|
|
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
|
+
};
|
|
258
265
|
const { chatInstance, view, ctrl } = args;
|
|
259
266
|
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
260
267
|
if (editorParams.srfaifilepreviewmode) {
|
|
@@ -323,8 +330,10 @@ class AIChatUtil {
|
|
|
323
330
|
};
|
|
324
331
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
325
332
|
let updateFlag = true;
|
|
326
|
-
|
|
327
|
-
|
|
333
|
+
const state = getChatState(aiChat);
|
|
334
|
+
state.id = createUUID();
|
|
335
|
+
state.abortController = new AbortController();
|
|
336
|
+
const { id, abortController } = state;
|
|
328
337
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
329
338
|
try {
|
|
330
339
|
const questionRequestData = {
|
|
@@ -446,6 +455,7 @@ class AIChatUtil {
|
|
|
446
455
|
}
|
|
447
456
|
};
|
|
448
457
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
458
|
+
const { id, abortController } = getChatState(aiChat);
|
|
449
459
|
abortController == null ? void 0 : abortController.abort();
|
|
450
460
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
451
461
|
if (asyncacitonid) {
|
|
@@ -480,8 +490,10 @@ class AIChatUtil {
|
|
|
480
490
|
};
|
|
481
491
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
482
492
|
if (other.asyncacitonid) {
|
|
483
|
-
|
|
484
|
-
|
|
493
|
+
const state = getChatState(aiChat);
|
|
494
|
+
state.id = createUUID();
|
|
495
|
+
state.abortController = new AbortController();
|
|
496
|
+
const { id, abortController } = state;
|
|
485
497
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
486
498
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
487
499
|
if (other.sessionid) {
|
|
@@ -499,11 +511,9 @@ class AIChatUtil {
|
|
|
499
511
|
srfproject: other.srfproject
|
|
500
512
|
});
|
|
501
513
|
try {
|
|
502
|
-
aiChat.addWaitingMessage(id);
|
|
503
514
|
await deService.aiResumeSse(
|
|
504
515
|
(msg) => {
|
|
505
516
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
506
|
-
aiChat.removeWaitingMessage(id);
|
|
507
517
|
aiChat.isLoading.value = true;
|
|
508
518
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
509
519
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -573,7 +583,6 @@ class AIChatUtil {
|
|
|
573
583
|
}
|
|
574
584
|
abortController == null ? void 0 : abortController.abort();
|
|
575
585
|
} finally {
|
|
576
|
-
aiChat.removeWaitingMessage(id);
|
|
577
586
|
aiChat.isLoading.value = false;
|
|
578
587
|
aiChat.completeMessage(id, true);
|
|
579
588
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -733,7 +742,7 @@ class AIChatUtil {
|
|
|
733
742
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
734
743
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
735
744
|
var _a2, _b, _c;
|
|
736
|
-
const { id
|
|
745
|
+
const { id, isPluginApp } = source;
|
|
737
746
|
let appId = source.appId;
|
|
738
747
|
const tempContext = IBizContext.create(context2);
|
|
739
748
|
if (isPluginApp) {
|
|
@@ -748,7 +757,7 @@ class AIChatUtil {
|
|
|
748
757
|
}
|
|
749
758
|
}
|
|
750
759
|
const result = await UIActionUtil.exec(
|
|
751
|
-
|
|
760
|
+
id,
|
|
752
761
|
{
|
|
753
762
|
view,
|
|
754
763
|
ctrl,
|
|
@@ -1066,8 +1075,15 @@ class AIChatUtil {
|
|
|
1066
1075
|
chatOptions.questionToolbarItems = questionToolbarItems;
|
|
1067
1076
|
chatOptions.otherToolbarItems = otherToolbarItems;
|
|
1068
1077
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
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
|
+
};
|
|
1071
1087
|
const { chatInstance, view, ctrl } = args;
|
|
1072
1088
|
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
1073
1089
|
if (params.hasOwnProperty("srfaifilepreviewmode")) {
|
|
@@ -1137,8 +1153,10 @@ class AIChatUtil {
|
|
|
1137
1153
|
};
|
|
1138
1154
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
1139
1155
|
let updateFlag = true;
|
|
1140
|
-
|
|
1141
|
-
|
|
1156
|
+
const state = getChatState(aiChat);
|
|
1157
|
+
state.id = createUUID();
|
|
1158
|
+
state.abortController = new AbortController();
|
|
1159
|
+
const { id, abortController } = state;
|
|
1142
1160
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1143
1161
|
try {
|
|
1144
1162
|
const questionRequestData = {
|
|
@@ -1258,6 +1276,7 @@ class AIChatUtil {
|
|
|
1258
1276
|
}
|
|
1259
1277
|
};
|
|
1260
1278
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
1279
|
+
const { id, abortController } = getChatState(aiChat);
|
|
1261
1280
|
abortController == null ? void 0 : abortController.abort();
|
|
1262
1281
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
1263
1282
|
if (asyncacitonid) {
|
|
@@ -1292,8 +1311,10 @@ class AIChatUtil {
|
|
|
1292
1311
|
};
|
|
1293
1312
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
1294
1313
|
if (other.asyncacitonid) {
|
|
1295
|
-
|
|
1296
|
-
|
|
1314
|
+
const state = getChatState(aiChat);
|
|
1315
|
+
state.id = createUUID();
|
|
1316
|
+
state.abortController = new AbortController();
|
|
1317
|
+
const { id, abortController } = state;
|
|
1297
1318
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1298
1319
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
1299
1320
|
if (other.sessionid) {
|
|
@@ -1311,11 +1332,9 @@ class AIChatUtil {
|
|
|
1311
1332
|
srfproject: other.srfproject
|
|
1312
1333
|
});
|
|
1313
1334
|
try {
|
|
1314
|
-
aiChat.addWaitingMessage(id);
|
|
1315
1335
|
await deService.aiResumeSse(
|
|
1316
1336
|
(msg) => {
|
|
1317
1337
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1318
|
-
aiChat.removeWaitingMessage(id);
|
|
1319
1338
|
aiChat.isLoading.value = true;
|
|
1320
1339
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1321
1340
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -1385,7 +1404,6 @@ class AIChatUtil {
|
|
|
1385
1404
|
}
|
|
1386
1405
|
abortController == null ? void 0 : abortController.abort();
|
|
1387
1406
|
} finally {
|
|
1388
|
-
aiChat.removeWaitingMessage(id);
|
|
1389
1407
|
aiChat.isLoading.value = false;
|
|
1390
1408
|
aiChat.completeMessage(id, true);
|
|
1391
1409
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -1547,7 +1565,7 @@ class AIChatUtil {
|
|
|
1547
1565
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
1548
1566
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
1549
1567
|
var _a2, _b, _c;
|
|
1550
|
-
const { id
|
|
1568
|
+
const { id, isPluginApp } = source;
|
|
1551
1569
|
let appId = source.appId;
|
|
1552
1570
|
const tempContext = IBizContext.create(context2);
|
|
1553
1571
|
if (isPluginApp) {
|
|
@@ -1562,7 +1580,7 @@ class AIChatUtil {
|
|
|
1562
1580
|
}
|
|
1563
1581
|
}
|
|
1564
1582
|
const result = await UIActionUtil.exec(
|
|
1565
|
-
|
|
1583
|
+
id,
|
|
1566
1584
|
{
|
|
1567
1585
|
view,
|
|
1568
1586
|
ctrl,
|
|
@@ -255,8 +255,15 @@ class AIChatUtil {
|
|
|
255
255
|
}
|
|
256
256
|
const sessionid = this.getChatSessionId("TEMP");
|
|
257
257
|
chatOptions.sessionid = sessionid;
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
const chatStateMap = /* @__PURE__ */ new WeakMap();
|
|
259
|
+
const getChatState = (aiChat) => {
|
|
260
|
+
let state = chatStateMap.get(aiChat);
|
|
261
|
+
if (!state) {
|
|
262
|
+
state = { id: "", abortController: new AbortController() };
|
|
263
|
+
chatStateMap.set(aiChat, state);
|
|
264
|
+
}
|
|
265
|
+
return state;
|
|
266
|
+
};
|
|
260
267
|
const { chatInstance, view, ctrl } = args;
|
|
261
268
|
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
262
269
|
if (editorParams.srfaifilepreviewmode) {
|
|
@@ -325,8 +332,10 @@ class AIChatUtil {
|
|
|
325
332
|
};
|
|
326
333
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid2, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
327
334
|
let updateFlag = true;
|
|
328
|
-
|
|
329
|
-
|
|
335
|
+
const state = getChatState(aiChat);
|
|
336
|
+
state.id = qxUtil.createUUID();
|
|
337
|
+
state.abortController = new AbortController();
|
|
338
|
+
const { id, abortController } = state;
|
|
330
339
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
331
340
|
try {
|
|
332
341
|
const questionRequestData = {
|
|
@@ -448,6 +457,7 @@ class AIChatUtil {
|
|
|
448
457
|
}
|
|
449
458
|
};
|
|
450
459
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
460
|
+
const { id, abortController } = getChatState(aiChat);
|
|
451
461
|
abortController == null ? void 0 : abortController.abort();
|
|
452
462
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
453
463
|
if (asyncacitonid) {
|
|
@@ -482,8 +492,10 @@ class AIChatUtil {
|
|
|
482
492
|
};
|
|
483
493
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
484
494
|
if (other.asyncacitonid) {
|
|
485
|
-
|
|
486
|
-
|
|
495
|
+
const state = getChatState(aiChat);
|
|
496
|
+
state.id = qxUtil.createUUID();
|
|
497
|
+
state.abortController = new AbortController();
|
|
498
|
+
const { id, abortController } = state;
|
|
487
499
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
488
500
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
489
501
|
if (other.sessionid) {
|
|
@@ -501,11 +513,9 @@ class AIChatUtil {
|
|
|
501
513
|
srfproject: other.srfproject
|
|
502
514
|
});
|
|
503
515
|
try {
|
|
504
|
-
aiChat.addWaitingMessage(id);
|
|
505
516
|
await deService.aiResumeSse(
|
|
506
517
|
(msg) => {
|
|
507
518
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
508
|
-
aiChat.removeWaitingMessage(id);
|
|
509
519
|
aiChat.isLoading.value = true;
|
|
510
520
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
511
521
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -575,7 +585,6 @@ class AIChatUtil {
|
|
|
575
585
|
}
|
|
576
586
|
abortController == null ? void 0 : abortController.abort();
|
|
577
587
|
} finally {
|
|
578
|
-
aiChat.removeWaitingMessage(id);
|
|
579
588
|
aiChat.isLoading.value = false;
|
|
580
589
|
aiChat.completeMessage(id, true);
|
|
581
590
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -735,7 +744,7 @@ class AIChatUtil {
|
|
|
735
744
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
736
745
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
737
746
|
var _a2, _b, _c;
|
|
738
|
-
const { id
|
|
747
|
+
const { id, isPluginApp } = source;
|
|
739
748
|
let appId = source.appId;
|
|
740
749
|
const tempContext = core.IBizContext.create(context2);
|
|
741
750
|
if (isPluginApp) {
|
|
@@ -750,7 +759,7 @@ class AIChatUtil {
|
|
|
750
759
|
}
|
|
751
760
|
}
|
|
752
761
|
const result = await runtime.UIActionUtil.exec(
|
|
753
|
-
|
|
762
|
+
id,
|
|
754
763
|
{
|
|
755
764
|
view,
|
|
756
765
|
ctrl,
|
|
@@ -1068,8 +1077,15 @@ class AIChatUtil {
|
|
|
1068
1077
|
chatOptions.questionToolbarItems = questionToolbarItems;
|
|
1069
1078
|
chatOptions.otherToolbarItems = otherToolbarItems;
|
|
1070
1079
|
}
|
|
1071
|
-
|
|
1072
|
-
|
|
1080
|
+
const chatStateMap = /* @__PURE__ */ new WeakMap();
|
|
1081
|
+
const getChatState = (aiChat) => {
|
|
1082
|
+
let state = chatStateMap.get(aiChat);
|
|
1083
|
+
if (!state) {
|
|
1084
|
+
state = { id: "", abortController: new AbortController() };
|
|
1085
|
+
chatStateMap.set(aiChat, state);
|
|
1086
|
+
}
|
|
1087
|
+
return state;
|
|
1088
|
+
};
|
|
1073
1089
|
const { chatInstance, view, ctrl } = args;
|
|
1074
1090
|
let filePreviewMode = ibiz.config.common.aiFilePreviewMode;
|
|
1075
1091
|
if (params.hasOwnProperty("srfaifilepreviewmode")) {
|
|
@@ -1139,8 +1155,10 @@ class AIChatUtil {
|
|
|
1139
1155
|
};
|
|
1140
1156
|
chatOptions.question = async (aiChat, ctx, param, other, arr, sessionid, srfaiagent, srfmode, srfscope, srfknowledgebases, srfaiagentconfig, appendcurdata, mcpservers, sessionmeta, srfproject, localMsgID) => {
|
|
1141
1157
|
let updateFlag = true;
|
|
1142
|
-
|
|
1143
|
-
|
|
1158
|
+
const state = getChatState(aiChat);
|
|
1159
|
+
state.id = qxUtil.createUUID();
|
|
1160
|
+
state.abortController = new AbortController();
|
|
1161
|
+
const { id, abortController } = state;
|
|
1144
1162
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1145
1163
|
try {
|
|
1146
1164
|
const questionRequestData = {
|
|
@@ -1260,6 +1278,7 @@ class AIChatUtil {
|
|
|
1260
1278
|
}
|
|
1261
1279
|
};
|
|
1262
1280
|
chatOptions.abortQuestion = async (aiChat, ctx, param, other) => {
|
|
1281
|
+
const { id, abortController } = getChatState(aiChat);
|
|
1263
1282
|
abortController == null ? void 0 : abortController.abort();
|
|
1264
1283
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
1265
1284
|
if (asyncacitonid) {
|
|
@@ -1294,8 +1313,10 @@ class AIChatUtil {
|
|
|
1294
1313
|
};
|
|
1295
1314
|
chatOptions.resumeQuestion = async (aiChat, ctx, param, other, arr) => {
|
|
1296
1315
|
if (other.asyncacitonid) {
|
|
1297
|
-
|
|
1298
|
-
|
|
1316
|
+
const state = getChatState(aiChat);
|
|
1317
|
+
state.id = qxUtil.createUUID();
|
|
1318
|
+
state.abortController = new AbortController();
|
|
1319
|
+
const { id, abortController } = state;
|
|
1299
1320
|
const deService = await ibiz.hub.getApp(ctx.srfappid).deService.getService(ctx, other.appDataEntityId);
|
|
1300
1321
|
const resumeRequestData = { asyncacitonid: other.asyncacitonid };
|
|
1301
1322
|
if (other.sessionid) {
|
|
@@ -1313,11 +1334,9 @@ class AIChatUtil {
|
|
|
1313
1334
|
srfproject: other.srfproject
|
|
1314
1335
|
});
|
|
1315
1336
|
try {
|
|
1316
|
-
aiChat.addWaitingMessage(id);
|
|
1317
1337
|
await deService.aiResumeSse(
|
|
1318
1338
|
(msg) => {
|
|
1319
1339
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1320
|
-
aiChat.removeWaitingMessage(id);
|
|
1321
1340
|
aiChat.isLoading.value = true;
|
|
1322
1341
|
if (!aiChat.getActiveAsyncacitonId()) {
|
|
1323
1342
|
aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
|
|
@@ -1387,7 +1406,6 @@ class AIChatUtil {
|
|
|
1387
1406
|
}
|
|
1388
1407
|
abortController == null ? void 0 : abortController.abort();
|
|
1389
1408
|
} finally {
|
|
1390
|
-
aiChat.removeWaitingMessage(id);
|
|
1391
1409
|
aiChat.isLoading.value = false;
|
|
1392
1410
|
aiChat.completeMessage(id, true);
|
|
1393
1411
|
aiChat.setActiveAsyncacitonId("");
|
|
@@ -1549,7 +1567,7 @@ class AIChatUtil {
|
|
|
1549
1567
|
chatOptions.uploader.maxSize = uploadMaxSize;
|
|
1550
1568
|
chatOptions.extendToolbarClick = async (event, source, context2, params2, data2) => {
|
|
1551
1569
|
var _a2, _b, _c;
|
|
1552
|
-
const { id
|
|
1570
|
+
const { id, isPluginApp } = source;
|
|
1553
1571
|
let appId = source.appId;
|
|
1554
1572
|
const tempContext = core.IBizContext.create(context2);
|
|
1555
1573
|
if (isPluginApp) {
|
|
@@ -1564,7 +1582,7 @@ class AIChatUtil {
|
|
|
1564
1582
|
}
|
|
1565
1583
|
}
|
|
1566
1584
|
const result = await runtime.UIActionUtil.exec(
|
|
1567
|
-
|
|
1585
|
+
id,
|
|
1568
1586
|
{
|
|
1569
1587
|
view,
|
|
1570
1588
|
ctrl,
|
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.154",
|
|
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.119",
|
|
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
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.154",
|
|
41
|
+
"@ibiz-template/runtime": "0.7.41-alpha.154",
|
|
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.154",
|
|
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",
|
|
@@ -383,8 +383,19 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
383
383
|
const sessionid = this.getChatSessionId('TEMP');
|
|
384
384
|
chatOptions.sessionid = sessionid;
|
|
385
385
|
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
// 按聊天控制器实例隔离提问状态,避免多话题会话共用闭包变量相互污染
|
|
387
|
+
const chatStateMap = new WeakMap<
|
|
388
|
+
object,
|
|
389
|
+
{ id: string; abortController: AbortController }
|
|
390
|
+
>();
|
|
391
|
+
const getChatState = (aiChat: object) => {
|
|
392
|
+
let state = chatStateMap.get(aiChat);
|
|
393
|
+
if (!state) {
|
|
394
|
+
state = { id: '', abortController: new AbortController() };
|
|
395
|
+
chatStateMap.set(aiChat, state);
|
|
396
|
+
}
|
|
397
|
+
return state;
|
|
398
|
+
};
|
|
388
399
|
const { chatInstance, view, ctrl } = args;
|
|
389
400
|
|
|
390
401
|
// 文件系统操作参数
|
|
@@ -484,8 +495,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
484
495
|
) => {
|
|
485
496
|
// 更新标记,主要用于更新用户消息真实消息ID(每条消息都会回asextparam,只需要设置一次即可)
|
|
486
497
|
let updateFlag = true;
|
|
487
|
-
|
|
488
|
-
|
|
498
|
+
const state = getChatState(aiChat);
|
|
499
|
+
state.id = createUUID();
|
|
500
|
+
state.abortController = new AbortController();
|
|
501
|
+
const { id, abortController } = state;
|
|
489
502
|
const deService = await ibiz.hub
|
|
490
503
|
.getApp(ctx.srfappid)
|
|
491
504
|
.deService.getService(ctx, other.appDataEntityId);
|
|
@@ -624,6 +637,7 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
624
637
|
param: IParams,
|
|
625
638
|
other: IParams,
|
|
626
639
|
) => {
|
|
640
|
+
const { id, abortController } = getChatState(aiChat);
|
|
627
641
|
abortController?.abort();
|
|
628
642
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
629
643
|
if (asyncacitonid) {
|
|
@@ -668,8 +682,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
668
682
|
arr: IChatMessage[],
|
|
669
683
|
) => {
|
|
670
684
|
if (other.asyncacitonid) {
|
|
671
|
-
|
|
672
|
-
|
|
685
|
+
const state = getChatState(aiChat);
|
|
686
|
+
state.id = createUUID();
|
|
687
|
+
state.abortController = new AbortController();
|
|
688
|
+
const { id, abortController } = state;
|
|
673
689
|
const deService = await ibiz.hub
|
|
674
690
|
.getApp(ctx.srfappid)
|
|
675
691
|
.deService.getService(ctx, other.appDataEntityId);
|
|
@@ -689,14 +705,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
689
705
|
srfproject: other.srfproject,
|
|
690
706
|
});
|
|
691
707
|
try {
|
|
692
|
-
// 新增等待回复消息(AI首条内容到达前显示loading气泡)
|
|
693
|
-
aiChat.addWaitingMessage(id);
|
|
694
708
|
await deService.aiResumeSse(
|
|
695
709
|
(msg: IPortalAsyncAction) => {
|
|
696
710
|
// 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
|
|
697
711
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
698
|
-
// 移除等待回复消息
|
|
699
|
-
aiChat.removeWaitingMessage(id);
|
|
700
712
|
// 设置当前聊天在加载中
|
|
701
713
|
aiChat.isLoading.value = true;
|
|
702
714
|
// 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
|
|
@@ -774,8 +786,6 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
774
786
|
}
|
|
775
787
|
abortController?.abort();
|
|
776
788
|
} finally {
|
|
777
|
-
// 移除等待回复消息
|
|
778
|
-
aiChat.removeWaitingMessage(id);
|
|
779
789
|
// 设置当前聊天加载状态已完成
|
|
780
790
|
aiChat.isLoading.value = false;
|
|
781
791
|
// 标记当前消息已经交互完成
|
|
@@ -1405,8 +1415,19 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1405
1415
|
chatOptions.otherToolbarItems = otherToolbarItems;
|
|
1406
1416
|
}
|
|
1407
1417
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1418
|
+
// 按聊天控制器实例隔离提问状态,避免多话题会话共用闭包变量相互污染
|
|
1419
|
+
const chatStateMap = new WeakMap<
|
|
1420
|
+
object,
|
|
1421
|
+
{ id: string; abortController: AbortController }
|
|
1422
|
+
>();
|
|
1423
|
+
const getChatState = (aiChat: object) => {
|
|
1424
|
+
let state = chatStateMap.get(aiChat);
|
|
1425
|
+
if (!state) {
|
|
1426
|
+
state = { id: '', abortController: new AbortController() };
|
|
1427
|
+
chatStateMap.set(aiChat, state);
|
|
1428
|
+
}
|
|
1429
|
+
return state;
|
|
1430
|
+
};
|
|
1410
1431
|
const { chatInstance, view, ctrl } = args;
|
|
1411
1432
|
// 文件系统操作参数
|
|
1412
1433
|
|
|
@@ -1507,8 +1528,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1507
1528
|
) => {
|
|
1508
1529
|
// 更新标记,主要用于更新用户消息真实消息ID(每条消息都会回asextparam,只需要设置一次即可)
|
|
1509
1530
|
let updateFlag = true;
|
|
1510
|
-
|
|
1511
|
-
|
|
1531
|
+
const state = getChatState(aiChat);
|
|
1532
|
+
state.id = createUUID();
|
|
1533
|
+
state.abortController = new AbortController();
|
|
1534
|
+
const { id, abortController } = state;
|
|
1512
1535
|
const deService = await ibiz.hub
|
|
1513
1536
|
.getApp(ctx.srfappid)
|
|
1514
1537
|
.deService.getService(ctx, other.appDataEntityId);
|
|
@@ -1645,6 +1668,7 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1645
1668
|
param: IParams,
|
|
1646
1669
|
other: IParams,
|
|
1647
1670
|
) => {
|
|
1671
|
+
const { id, abortController } = getChatState(aiChat);
|
|
1648
1672
|
abortController?.abort();
|
|
1649
1673
|
const asyncacitonid = aiChat.getActiveAsyncacitonId();
|
|
1650
1674
|
if (asyncacitonid) {
|
|
@@ -1689,8 +1713,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1689
1713
|
arr: IChatMessage[],
|
|
1690
1714
|
) => {
|
|
1691
1715
|
if (other.asyncacitonid) {
|
|
1692
|
-
|
|
1693
|
-
|
|
1716
|
+
const state = getChatState(aiChat);
|
|
1717
|
+
state.id = createUUID();
|
|
1718
|
+
state.abortController = new AbortController();
|
|
1719
|
+
const { id, abortController } = state;
|
|
1694
1720
|
const deService = await ibiz.hub
|
|
1695
1721
|
.getApp(ctx.srfappid)
|
|
1696
1722
|
.deService.getService(ctx, other.appDataEntityId);
|
|
@@ -1710,14 +1736,10 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1710
1736
|
srfproject: other.srfproject,
|
|
1711
1737
|
});
|
|
1712
1738
|
try {
|
|
1713
|
-
// 新增等待回复消息(AI首条内容到达前显示loading气泡)
|
|
1714
|
-
aiChat.addWaitingMessage(id);
|
|
1715
1739
|
await deService.aiResumeSse(
|
|
1716
1740
|
(msg: IPortalAsyncAction) => {
|
|
1717
1741
|
// 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
|
|
1718
1742
|
if (msg.actionstate === 20 && msg.actionresult) {
|
|
1719
|
-
// 移除等待回复消息
|
|
1720
|
-
aiChat.removeWaitingMessage(id);
|
|
1721
1743
|
// 设置当前聊天在加载中
|
|
1722
1744
|
aiChat.isLoading.value = true;
|
|
1723
1745
|
// 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
|
|
@@ -1795,8 +1817,6 @@ export class AIChatUtil implements IApiAIChatUtil {
|
|
|
1795
1817
|
}
|
|
1796
1818
|
abortController?.abort();
|
|
1797
1819
|
} finally {
|
|
1798
|
-
// 移除等待回复消息
|
|
1799
|
-
aiChat.removeWaitingMessage(id);
|
|
1800
1820
|
// 设置当前聊天加载状态已完成
|
|
1801
1821
|
aiChat.isLoading.value = false;
|
|
1802
1822
|
// 标记当前消息已经交互完成
|