@ibiz-template/vue3-components 0.7.41-alpha.153 → 0.7.41-alpha.155

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.
Files changed (44) hide show
  1. package/dist/index-CR7U-PBa.js +339 -0
  2. package/dist/{index.es-DcGGowg9.js → index.es-Bi7iirdS.js} +1 -1
  3. package/dist/index.min.css +1 -1
  4. package/dist/index.system.min.js +1 -1
  5. package/dist/{wang-editor-D0vwuhRC.js → wang-editor-JVvrMHPf.js} +1 -1
  6. package/dist/{xlsx-util-oopIn_S1.js → xlsx-util-DVsxoQbL.js} +1 -1
  7. package/es/control/calendar/index.mjs +1 -0
  8. package/es/control/data-view/index.mjs +1 -0
  9. package/es/control/drtab/index.mjs +1 -0
  10. package/es/control/grid/grid/index.mjs +1 -0
  11. package/es/control/grid/grid-column/grid-field-edit-column/index.mjs +3 -0
  12. package/es/control/grid/grid-column/index.mjs +3 -0
  13. package/es/control/grid/index.mjs +5 -0
  14. package/es/control/index.mjs +10 -0
  15. package/es/control/tree/index.mjs +1 -0
  16. package/es/control/tree-grid-ex/index.mjs +1 -0
  17. package/es/control/tree-grid-ex/tree-grid-ex-column/index.mjs +3 -0
  18. package/es/index.mjs +10 -0
  19. package/es/util/ai-chat-util/ai-chat-util.mjs +51 -24
  20. package/lib/control/calendar/index.cjs +4 -0
  21. package/lib/control/data-view/index.cjs +2 -0
  22. package/lib/control/drtab/index.cjs +2 -0
  23. package/lib/control/grid/grid/index.cjs +3 -0
  24. package/lib/control/grid/grid-column/grid-field-edit-column/index.cjs +6 -0
  25. package/lib/control/grid/grid-column/index.cjs +6 -0
  26. package/lib/control/grid/index.cjs +12 -0
  27. package/lib/control/index.cjs +31 -0
  28. package/lib/control/tree/index.cjs +9 -0
  29. package/lib/control/tree-grid-ex/index.cjs +2 -0
  30. package/lib/control/tree-grid-ex/tree-grid-ex-column/index.cjs +6 -0
  31. package/lib/index.cjs +31 -0
  32. package/lib/util/ai-chat-util/ai-chat-util.cjs +51 -24
  33. package/package.json +5 -5
  34. package/src/control/calendar/index.ts +2 -0
  35. package/src/control/data-view/index.ts +1 -0
  36. package/src/control/drtab/index.ts +1 -0
  37. package/src/control/grid/grid/index.ts +1 -0
  38. package/src/control/grid/grid-column/grid-field-edit-column/index.ts +4 -0
  39. package/src/control/grid/index.ts +1 -0
  40. package/src/control/tree/index.ts +2 -0
  41. package/src/control/tree-grid-ex/index.ts +2 -0
  42. package/src/control/tree-grid-ex/tree-grid-ex-column/index.ts +3 -0
  43. package/src/util/ai-chat-util/ai-chat-util.ts +62 -26
  44. package/dist/index-pFskXRPD.js +0 -339
@@ -383,8 +383,19 @@ export class AIChatUtil implements IApiAIChatUtil {
383
383
  const sessionid = this.getChatSessionId('TEMP');
384
384
  chatOptions.sessionid = sessionid;
385
385
 
386
- let id: string = '';
387
- let abortController: AbortController;
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
- id = createUUID();
488
- abortController = new AbortController();
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
- id = createUUID();
672
- abortController = new AbortController();
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
  // 标记当前消息已经交互完成
@@ -901,7 +911,7 @@ export class AIChatUtil implements IApiAIChatUtil {
901
911
  options?.context || context,
902
912
  options?.params || params,
903
913
  {},
904
- { enableNoAccess: true, osscat: folder },
914
+ { enableNoAccess: true, osscat: options?.folder || folder },
905
915
  );
906
916
  const headers = ibiz.util.file.getUploadHeaders();
907
917
  const formData = new FormData();
@@ -1405,8 +1415,19 @@ export class AIChatUtil implements IApiAIChatUtil {
1405
1415
  chatOptions.otherToolbarItems = otherToolbarItems;
1406
1416
  }
1407
1417
 
1408
- let id: string = '';
1409
- let abortController: AbortController;
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
- id = createUUID();
1511
- abortController = new AbortController();
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
- id = createUUID();
1693
- abortController = new AbortController();
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
  // 标记当前消息已经交互完成
@@ -1923,7 +1943,7 @@ export class AIChatUtil implements IApiAIChatUtil {
1923
1943
  options?.context || context,
1924
1944
  options?.params || params,
1925
1945
  {},
1926
- { enableNoAccess: true, osscat: folder },
1946
+ { enableNoAccess: true, osscat: options?.folder || folder },
1927
1947
  );
1928
1948
  const headers = ibiz.util.file.getUploadHeaders();
1929
1949
  const formData = new FormData();
@@ -2526,6 +2546,22 @@ export class AIChatUtil implements IApiAIChatUtil {
2526
2546
  if (response.ok) return response.data;
2527
2547
  return undefined;
2528
2548
  };
2549
+ // 下载文件
2550
+ fileSystemOptions.downloadFile = async (
2551
+ ctx: IContext,
2552
+ param: IParams,
2553
+ other: IParams,
2554
+ ): Promise<IData> => {
2555
+ const deService = await ibiz.hub
2556
+ .getApp(ctx.srfappid)
2557
+ .deService.getService(ctx, param.appDataEntityId);
2558
+ const response = await deService.aiChatProject(
2559
+ ctx,
2560
+ { srfactag: param.srfactag },
2561
+ { action: 'DOWNLOAD', ...other },
2562
+ );
2563
+ return response.data;
2564
+ };
2529
2565
  // 新建目录
2530
2566
  fileSystemOptions.createFolder = async (
2531
2567
  ctx: IContext,