@myun/gimi-chat 0.9.65 → 0.9.66

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 (54) hide show
  1. package/dist/apis/useApi.d.ts +6 -0
  2. package/dist/apis/useApi.js +45 -1
  3. package/dist/components/ai-chat-dialogue/index copy.js +1 -1
  4. package/dist/components/ai-chat-dialogue/index.js +4 -2
  5. package/dist/components/answer-item/component/artifacts/index.d.ts +13 -0
  6. package/dist/components/answer-item/component/artifacts/index.js +52 -0
  7. package/dist/components/answer-item/component/artifacts/index.module.css +24 -0
  8. package/dist/components/answer-item/component/tool-list/index.d.ts +7 -0
  9. package/dist/components/answer-item/component/tool-list/index.js +117 -0
  10. package/dist/components/answer-item/component/tool-list/index.module.css +97 -0
  11. package/dist/components/answer-item/index.d.ts +2 -1
  12. package/dist/components/answer-item/index.js +179 -8
  13. package/dist/components/answer-item/index.module.css +35 -0
  14. package/dist/components/ask-card/index.d.ts +1 -1
  15. package/dist/components/chat-input/extension/index.d.ts +1 -0
  16. package/dist/components/chat-input/extension/index.js +2 -1
  17. package/dist/components/chat-input/extension/skill/MentionList.d.ts +31 -0
  18. package/dist/components/chat-input/extension/skill/MentionList.js +199 -0
  19. package/dist/components/chat-input/extension/skill/ReferSlot.d.ts +3 -0
  20. package/dist/components/chat-input/extension/skill/ReferSlot.js +100 -0
  21. package/dist/components/chat-input/extension/skill/data.d.ts +10 -0
  22. package/dist/components/chat-input/extension/skill/data.js +49 -0
  23. package/dist/components/chat-input/extension/skill/index.d.ts +7 -0
  24. package/dist/components/chat-input/extension/skill/index.js +5 -0
  25. package/dist/components/chat-input/extension/skill/index.less +117 -0
  26. package/dist/components/chat-input/extension/skill/suggestion.d.ts +16 -0
  27. package/dist/components/chat-input/extension/skill/suggestion.js +206 -0
  28. package/dist/components/chat-input/index.js +145 -24
  29. package/dist/components/chat-input/index.module.css +6 -0
  30. package/dist/components/file-card/index.js +2 -1
  31. package/dist/components/file-card/index.module.css +1 -0
  32. package/dist/components/knowledge-trace/KnowledgeIconComponent.js +6 -1
  33. package/dist/components/knowledge-trace/tryWatch.js +2 -2
  34. package/dist/components/message-list/index.js +15 -3
  35. package/dist/components/message-list/index.module.css +3 -0
  36. package/dist/components/message-list/skill-tag/index.d.ts +5 -0
  37. package/dist/components/message-list/skill-tag/index.js +23 -0
  38. package/dist/components/message-list/skill-tag/index.module.css +22 -0
  39. package/dist/components/templates/CommonChat.js +3 -1
  40. package/dist/hooks/useChatActions.d.ts +2 -1
  41. package/dist/hooks/useChatActions.js +52 -12
  42. package/dist/hooks/useChatStream.d.ts +6 -1
  43. package/dist/hooks/useChatStream.js +97 -5
  44. package/dist/hooks/useCommonChatAPI.d.ts +1 -1
  45. package/dist/hooks/useCommonChatAPI.js +212 -58
  46. package/dist/i18n/locales/en-US.d.ts +7 -0
  47. package/dist/i18n/locales/en-US.js +8 -1
  48. package/dist/i18n/locales/zh-CN.d.ts +7 -0
  49. package/dist/i18n/locales/zh-CN.js +8 -1
  50. package/dist/interfaces/chatMessage.d.ts +40 -0
  51. package/dist/umd/index.min.js +1 -1
  52. package/dist/utils/tools.d.ts +7 -0
  53. package/dist/utils/tools.js +38 -1
  54. package/package.json +4 -2
@@ -1,5 +1,6 @@
1
1
  import { IChatMessageItem } from "../interfaces/chatMessage";
2
2
  import { FileItem } from "../types/file";
3
+ export declare const maxInputLength = 10000;
3
4
  export declare function downloadExcelByUrl(url: string, fileName?: string): Promise<void>;
4
5
  export declare function parseMessageContent(str: string): {
5
6
  moduleInfo: any | null;
@@ -28,6 +29,12 @@ export declare const retryWithExponentialBackoff: <T>(fn: () => Promise<T>, opti
28
29
  * @returns 格式化后的中文时间字符串
29
30
  */
30
31
  export declare function formatSecondsToChinese(seconds: number): number;
32
+ /**
33
+ * 将毫秒数格式化为可读时长字符串
34
+ * @param ms - 毫秒数(非负数)
35
+ * @returns 格式化后的时长字符串(32333 -> "32s",1203000 -> "20m3s",60000 -> "1m0s")
36
+ */
37
+ export declare function formatDurationMs(ms: number): string;
31
38
  export declare function replaceBraces(str: string): string;
32
39
  /**
33
40
  * 将字节数转换为KB或MB格式的字符串
@@ -16,6 +16,9 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
16
16
  import { FileStatus } from "../interfaces/fileInterface";
17
17
  import { set, cloneDeep } from 'lodash';
18
18
  import { Toast } from "@douyinfe/semi-ui";
19
+
20
+ // 最大输入长度
21
+ export var maxInputLength = 10000;
19
22
  export function downloadExcelByUrl(_x) {
20
23
  return _downloadExcelByUrl.apply(this, arguments);
21
24
  }
@@ -286,6 +289,22 @@ export function formatSecondsToChinese(seconds) {
286
289
  var minutes = Math.ceil(totalSeconds / 60);
287
290
  return minutes;
288
291
  }
292
+
293
+ /**
294
+ * 将毫秒数格式化为可读时长字符串
295
+ * @param ms - 毫秒数(非负数)
296
+ * @returns 格式化后的时长字符串(32333 -> "32s",1203000 -> "20m3s",60000 -> "1m0s")
297
+ */
298
+ export function formatDurationMs(ms) {
299
+ // 边界值处理:确保输入为非负数
300
+ if (typeof ms !== 'number' || isNaN(ms) || ms < 0) {
301
+ return '0s';
302
+ }
303
+ var totalSeconds = Math.floor(ms / 1000);
304
+ var minutes = Math.floor(totalSeconds / 60);
305
+ var seconds = totalSeconds % 60;
306
+ return minutes > 0 ? "".concat(minutes, "m").concat(seconds, "s") : "".concat(seconds, "s");
307
+ }
289
308
  export function replaceBraces(str) {
290
309
  if (str === null || str === '') {
291
310
  return str === '' ? '' : String(str);
@@ -442,7 +461,16 @@ export function formatFields(dataList, chatList) {
442
461
  dataList.forEach(function (item, index) {
443
462
  if (item.role === 1 && item.chatId !== null && roleZeroMap.has(item.chatId)) {
444
463
  var _roleZeroData$related;
464
+ // 当前处于用户交互确认
465
+ var isPendingUserConfirm = item.moduleType === "user_confirm" && (item === null || item === void 0 ? void 0 : item.pendingUserConfirm);
445
466
  var roleZeroData = roleZeroMap.get(item.chatId);
467
+ var artifacts = [];
468
+ try {
469
+ var _item$attachedEvents;
470
+ artifacts = JSON.parse(((_item$attachedEvents = item.attachedEvents) === null || _item$attachedEvents === void 0 || (_item$attachedEvents = _item$attachedEvents[0]) === null || _item$attachedEvents === void 0 ? void 0 : _item$attachedEvents.eventData) || '{}').artifacts || [];
471
+ } catch (error) {
472
+ console.log('error', error);
473
+ }
446
474
  item.relatedCount = roleZeroData.relatedCount;
447
475
  item.relatedCourseRecommendation = roleZeroData.relatedCourseRecommendation ? JSON.parse(roleZeroData.relatedCourseRecommendation) : [];
448
476
  item.questionId = roleZeroData.questionId;
@@ -459,7 +487,7 @@ export function formatFields(dataList, chatList) {
459
487
  var _parseMessageContent2 = parseMessageContent(item.content || ''),
460
488
  moduleInfo = _parseMessageContent2.moduleInfo,
461
489
  content = _parseMessageContent2.content;
462
- item.stop = item.contentState ? 0 : 1; // 推理状态 0 推理完成 1 停止
490
+ item.stop = isPendingUserConfirm ? 0 : item.contentState ? 0 : 1; // 推理状态 0 推理完成 1 停止
463
491
  // item.moduleType = item.content ? JSON.parse(item.content).moduleType : null;
464
492
  item.moduleInfo = moduleInfo;
465
493
  if (content) {
@@ -470,6 +498,15 @@ export function formatFields(dataList, chatList) {
470
498
  item.selectValue = getSelectValue(item.content, moduleInfo, isLastItem, nextItem);
471
499
  item.reTryed = checkHasRetry(item.skillResult, index === dataList.length - 1); // 最新的一个skill生成结果失败,才可以重试
472
500
  item.disableUploadFile = getDisableUploadFile(item.content, moduleInfo, isLastItem);
501
+ item.artifacts = artifacts;
502
+ item.totalTokens = item.totalTokens || 0;
503
+ item.thinkingInfo = {
504
+ status: "COMPLETED",
505
+ toolName: "已完成",
506
+ collapse: !isPendingUserConfirm,
507
+ loaded: false,
508
+ needInit: isPendingUserConfirm
509
+ };
473
510
  }
474
511
  });
475
512
  return dataList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myun/gimi-chat",
3
- "version": "0.9.65",
3
+ "version": "0.9.66",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -23,12 +23,14 @@
23
23
  "dependencies": {
24
24
  "@douyinfe/semi-icons": "^2.90.0",
25
25
  "@douyinfe/semi-ui": "^2.90.0",
26
+ "@gaodun.com/gplayer": "3.3.12",
26
27
  "@microsoft/fetch-event-source": "^2.0.1",
27
28
  "@myun/gimi-design": "0.1.35",
28
- "@gaodun.com/gplayer": "3.3.12",
29
29
  "@reduxjs/toolkit": "^2.11.2",
30
30
  "@tiptap/core": "^3.15.3",
31
+ "@tiptap/extension-mention": "^3.30.1",
31
32
  "@tiptap/react": "^3.15.3",
33
+ "@tiptap/suggestion": "3.30.1",
32
34
  "@volcengine/rtc": "^4.68.0",
33
35
  "classnames": "^2.2.6",
34
36
  "crypto-js": "^4.2.0",