@ibiz-template/vue3-components 0.7.41-alpha.150 → 0.7.41-alpha.152

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 (25) hide show
  1. package/dist/{index-Dki2yYe9.js → index-Cs2bf-qT.js} +4 -4
  2. package/dist/{index.es-7UWnjdb2.js → index.es-CZeEzytG.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-DRcvMIVh.js → wang-editor-C09nwfM5.js} +1 -1
  6. package/dist/{xlsx-util-CkixgGjt.js → xlsx-util-C0viiHdq.js} +1 -1
  7. package/es/control/calendar/calendar.mjs +8 -5
  8. package/es/control/drtab/drtab-control.util.mjs +1 -1
  9. package/es/editor/ai-chat/embed-ai-chat/embed-ai-chat.mjs +2 -1
  10. package/es/editor/upload/use/use-custom-upload.mjs +3 -1
  11. package/es/util/ai-chat-util/ai-chat-util.mjs +85 -28
  12. package/es/util/fullscreen/fullscreen-util.mjs +1 -1
  13. package/lib/control/calendar/calendar.cjs +7 -4
  14. package/lib/control/drtab/drtab-control.util.cjs +1 -1
  15. package/lib/editor/ai-chat/embed-ai-chat/embed-ai-chat.cjs +2 -1
  16. package/lib/editor/upload/use/use-custom-upload.cjs +3 -1
  17. package/lib/util/ai-chat-util/ai-chat-util.cjs +85 -28
  18. package/lib/util/fullscreen/fullscreen-util.cjs +1 -1
  19. package/package.json +6 -6
  20. package/src/control/calendar/calendar.tsx +3 -1
  21. package/src/editor/ai-chat/embed-ai-chat/embed-ai-chat.tsx +1 -0
  22. package/src/editor/upload/use/use-custom-upload.ts +5 -1
  23. package/src/util/ai-chat-util/ai-chat-util.ts +130 -44
  24. /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
  25. /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
@@ -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
- chatOptions.fetchProject = async (
383
- ctx: IContext,
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
@@ -524,10 +508,19 @@ export class AIChatUtil implements IApiAIChatUtil {
524
508
  if (extParams && Object.keys(extParams).length > 0) {
525
509
  Object.assign(questionRequestData, { srfextparams: extParams });
526
510
  }
511
+ // 新增等待回复消息(AI首条内容到达前显示loading气泡)
512
+ aiChat.addWaitingMessage(id);
527
513
  await deService.aiChatSse(
528
514
  (msg: IPortalAsyncAction) => {
529
515
  // 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
530
516
  if (msg.actionstate === 20 && msg.actionresult) {
517
+ // 移除等待回复消息
518
+ aiChat.removeWaitingMessage(id);
519
+ // 更新用户消息真实id
520
+ if (msg.asextparam && localMsgID && updateFlag) {
521
+ aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
522
+ updateFlag = false;
523
+ }
531
524
  // 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
532
525
  if (!aiChat.getActiveAsyncacitonId()) {
533
526
  aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
@@ -599,6 +592,8 @@ export class AIChatUtil implements IApiAIChatUtil {
599
592
  }
600
593
  abortController?.abort();
601
594
  } finally {
595
+ // 移除等待回复消息
596
+ aiChat.removeWaitingMessage(id);
602
597
  // 标记当前消息已经交互完成
603
598
  aiChat.completeMessage(id, true);
604
599
  // 清空异步消息任务
@@ -678,10 +673,14 @@ export class AIChatUtil implements IApiAIChatUtil {
678
673
  srfproject: other.srfproject,
679
674
  });
680
675
  try {
676
+ // 新增等待回复消息(AI首条内容到达前显示loading气泡)
677
+ aiChat.addWaitingMessage(id);
681
678
  await deService.aiResumeSse(
682
679
  (msg: IPortalAsyncAction) => {
683
680
  // 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
684
681
  if (msg.actionstate === 20 && msg.actionresult) {
682
+ // 移除等待回复消息
683
+ aiChat.removeWaitingMessage(id);
685
684
  // 设置当前聊天在加载中
686
685
  aiChat.isLoading.value = true;
687
686
  // 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
@@ -759,6 +758,8 @@ export class AIChatUtil implements IApiAIChatUtil {
759
758
  }
760
759
  abortController?.abort();
761
760
  } finally {
761
+ // 移除等待回复消息
762
+ aiChat.removeWaitingMessage(id);
762
763
  // 设置当前聊天加载状态已完成
763
764
  aiChat.isLoading.value = false;
764
765
  // 标记当前消息已经交互完成
@@ -1383,28 +1384,9 @@ export class AIChatUtil implements IApiAIChatUtil {
1383
1384
  let id: string = '';
1384
1385
  let abortController: AbortController;
1385
1386
  const { chatInstance, view, ctrl } = args;
1386
- // 查询项目
1387
- chatOptions.fetchProject = async (
1388
- ctx: IContext,
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
- };
1387
+ // 文件系统操作参数
1388
+ const fileSystemOptions = await this.getAIFileSystemOptions();
1389
+ chatOptions.fileSystemOptions = fileSystemOptions;
1408
1390
  // 查询历史
1409
1391
  chatOptions.history = async (
1410
1392
  ctx: IContext,
@@ -1488,7 +1470,10 @@ export class AIChatUtil implements IApiAIChatUtil {
1488
1470
  mcpservers: string | undefined,
1489
1471
  sessionmeta: IData | undefined,
1490
1472
  srfproject: string | undefined,
1473
+ localMsgID: string,
1491
1474
  ) => {
1475
+ // 更新标记,主要用于更新用户消息真实消息ID(每条消息都会回asextparam,只需要设置一次即可)
1476
+ let updateFlag = true;
1492
1477
  id = createUUID();
1493
1478
  abortController = new AbortController();
1494
1479
  const deService = await ibiz.hub
@@ -1527,10 +1512,19 @@ export class AIChatUtil implements IApiAIChatUtil {
1527
1512
  if (extParams && Object.keys(extParams).length > 0) {
1528
1513
  Object.assign(questionRequestData, { srfextparams: extParams });
1529
1514
  }
1515
+ // 新增等待回复消息(AI首条内容到达前显示loading气泡)
1516
+ aiChat.addWaitingMessage(id);
1530
1517
  await deService.aiChatSse(
1531
1518
  (msg: IPortalAsyncAction) => {
1532
1519
  // 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
1533
1520
  if (msg.actionstate === 20 && msg.actionresult) {
1521
+ // 移除等待回复消息
1522
+ aiChat.removeWaitingMessage(id);
1523
+ // 更新用户消息真实id
1524
+ if (msg.asextparam && localMsgID && updateFlag) {
1525
+ aiChat.updateMsgRealMessageID(localMsgID, msg.asextparam);
1526
+ updateFlag = false;
1527
+ }
1534
1528
  // 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
1535
1529
  if (!aiChat.getActiveAsyncacitonId()) {
1536
1530
  aiChat.setActiveAsyncacitonId(msg.asyncacitonid);
@@ -1602,6 +1596,8 @@ export class AIChatUtil implements IApiAIChatUtil {
1602
1596
  }
1603
1597
  abortController?.abort();
1604
1598
  } finally {
1599
+ // 移除等待回复消息
1600
+ aiChat.removeWaitingMessage(id);
1605
1601
  // 清空异步消息任务
1606
1602
  aiChat.setActiveAsyncacitonId('');
1607
1603
  // 标记当前消息已经交互完成
@@ -1681,10 +1677,14 @@ export class AIChatUtil implements IApiAIChatUtil {
1681
1677
  srfproject: other.srfproject,
1682
1678
  });
1683
1679
  try {
1680
+ // 新增等待回复消息(AI首条内容到达前显示loading气泡)
1681
+ aiChat.addWaitingMessage(id);
1684
1682
  await deService.aiResumeSse(
1685
1683
  (msg: IPortalAsyncAction) => {
1686
1684
  // 20: 持续回答中,消息会持续推送。同一个消息 id 会显示在同一个框内
1687
1685
  if (msg.actionstate === 20 && msg.actionresult) {
1686
+ // 移除等待回复消息
1687
+ aiChat.removeWaitingMessage(id);
1688
1688
  // 设置当前聊天在加载中
1689
1689
  aiChat.isLoading.value = true;
1690
1690
  // 不存在才设置,存在则不设置(下方设置的时候需要去存储话题数据中)
@@ -1762,6 +1762,8 @@ export class AIChatUtil implements IApiAIChatUtil {
1762
1762
  }
1763
1763
  abortController?.abort();
1764
1764
  } finally {
1765
+ // 移除等待回复消息
1766
+ aiChat.removeWaitingMessage(id);
1765
1767
  // 设置当前聊天加载状态已完成
1766
1768
  aiChat.isLoading.value = false;
1767
1769
  // 标记当前消息已经交互完成
@@ -2415,4 +2417,88 @@ export class AIChatUtil implements IApiAIChatUtil {
2415
2417
  };
2416
2418
  return resourceOptions;
2417
2419
  }
2420
+
2421
+ /**
2422
+ * @description 获取AI文件系统相关参数
2423
+ * @returns {*} {Promise<IData>}
2424
+ * @memberof AIChatUtil
2425
+ */
2426
+ async getAIFileSystemOptions(): Promise<IData> {
2427
+ const fileSystemOptions: IData = {};
2428
+ // 查询文件列表
2429
+ fileSystemOptions.getFileList = async (
2430
+ ctx: IContext,
2431
+ param: IParams,
2432
+ other: IParams,
2433
+ ): Promise<IData | undefined> => {
2434
+ const deService = await ibiz.hub
2435
+ .getApp(ctx.srfappid)
2436
+ .deService.getService(ctx, param.appDataEntityId);
2437
+ const response = await deService.aiChatProject(
2438
+ ctx,
2439
+ { srfactag: param.srfactag },
2440
+ { ...other },
2441
+ );
2442
+ if (response.ok) return response.data;
2443
+ return undefined;
2444
+ };
2445
+ // 上传文件
2446
+ fileSystemOptions.uploadFile = async (
2447
+ ctx: IContext,
2448
+ param: IParams,
2449
+ other: IParams,
2450
+ ): Promise<IData | undefined> => {
2451
+ const deService = await ibiz.hub
2452
+ .getApp(ctx.srfappid)
2453
+ .deService.getService(ctx, param.appDataEntityId);
2454
+ const response = await deService.aiChatProject(
2455
+ ctx,
2456
+ { srfactag: param.srfactag },
2457
+ { ...other, action: 'UPLOAD' },
2458
+ );
2459
+ if (response.ok) return response.data;
2460
+ return undefined;
2461
+ };
2462
+ // 获取文件内容
2463
+ fileSystemOptions.getContent = async (
2464
+ ctx: IContext,
2465
+ param: IParams,
2466
+ id: string,
2467
+ type: string,
2468
+ cat: string,
2469
+ ): Promise<string | IData | undefined> => {
2470
+ const app = await ibiz.hub.getAppAsync(ctx.appId);
2471
+ const requestUrl = `/ibizutil/downloadtxt/${cat ? `${cat}/` : ''}${id}?type=${type}`;
2472
+ const res = await app.net.get(requestUrl);
2473
+ if (res && res.ok && res.data) {
2474
+ return res.data;
2475
+ }
2476
+ };
2477
+ // 获取图片内容
2478
+ fileSystemOptions.getImgContent = async (
2479
+ ctx: IContext,
2480
+ param: IParams,
2481
+ id: string,
2482
+ type: string,
2483
+ cat: string,
2484
+ ): Promise<string> => {
2485
+ const { downloadUrl } = ibiz.util.file.calcFileUpDownUrl(
2486
+ ctx,
2487
+ param,
2488
+ {},
2489
+ { osscat: cat },
2490
+ );
2491
+ let content = downloadUrl.replace('%fileId%', id);
2492
+ if (type === 'svg') {
2493
+ const response = await ibiz.net.request(content, {
2494
+ method: 'get',
2495
+ responseType: 'blob',
2496
+ baseURL: '',
2497
+ });
2498
+ content = await response.data.text();
2499
+ }
2500
+ return content;
2501
+ };
2502
+ return fileSystemOptions;
2503
+ }
2418
2504
  }