@myun/gimi-chat 0.9.45 → 0.9.47

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 (52) 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 +97 -0
  10. package/dist/components/answer-item/component/tool-list/index.module.css +92 -0
  11. package/dist/components/answer-item/index.d.ts +2 -1
  12. package/dist/components/answer-item/index.js +160 -7
  13. package/dist/components/answer-item/index.module.css +24 -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 +30 -0
  18. package/dist/components/chat-input/extension/skill/MentionList.js +181 -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 +100 -0
  26. package/dist/components/chat-input/extension/skill/suggestion.d.ts +14 -0
  27. package/dist/components/chat-input/extension/skill/suggestion.js +173 -0
  28. package/dist/components/chat-input/index.js +63 -15
  29. package/dist/components/file-card/index.js +2 -1
  30. package/dist/components/file-card/index.module.css +1 -0
  31. package/dist/components/knowledge-trace/tryWatch.js +8 -1
  32. package/dist/components/message-list/index.js +15 -3
  33. package/dist/components/message-list/index.module.css +3 -0
  34. package/dist/components/message-list/skill-tag/index.d.ts +5 -0
  35. package/dist/components/message-list/skill-tag/index.js +24 -0
  36. package/dist/components/message-list/skill-tag/index.module.css +22 -0
  37. package/dist/components/templates/CommonChat.js +3 -1
  38. package/dist/hooks/useChatActions.d.ts +2 -1
  39. package/dist/hooks/useChatActions.js +41 -3
  40. package/dist/hooks/useChatStream.d.ts +6 -1
  41. package/dist/hooks/useChatStream.js +96 -5
  42. package/dist/hooks/useCommonChatAPI.d.ts +1 -1
  43. package/dist/hooks/useCommonChatAPI.js +190 -54
  44. package/dist/i18n/locales/en-US.d.ts +3 -0
  45. package/dist/i18n/locales/en-US.js +10 -7
  46. package/dist/i18n/locales/zh-CN.d.ts +3 -0
  47. package/dist/i18n/locales/zh-CN.js +4 -1
  48. package/dist/interfaces/chatMessage.d.ts +38 -0
  49. package/dist/umd/index.min.js +1 -1
  50. package/dist/utils/tools.d.ts +6 -0
  51. package/dist/utils/tools.js +31 -0
  52. package/package.json +4 -2
@@ -28,6 +28,12 @@ export declare const retryWithExponentialBackoff: <T>(fn: () => Promise<T>, opti
28
28
  * @returns 格式化后的中文时间字符串
29
29
  */
30
30
  export declare function formatSecondsToChinese(seconds: number): number;
31
+ /**
32
+ * 将毫秒数格式化为可读时长字符串
33
+ * @param ms - 毫秒数(非负数)
34
+ * @returns 格式化后的时长字符串(32333 -> "32s",1203000 -> "20m3s",60000 -> "1m0s")
35
+ */
36
+ export declare function formatDurationMs(ms: number): string;
31
37
  export declare function replaceBraces(str: string): string;
32
38
  /**
33
39
  * 将字节数转换为KB或MB格式的字符串
@@ -286,6 +286,22 @@ export function formatSecondsToChinese(seconds) {
286
286
  var minutes = Math.ceil(totalSeconds / 60);
287
287
  return minutes;
288
288
  }
289
+
290
+ /**
291
+ * 将毫秒数格式化为可读时长字符串
292
+ * @param ms - 毫秒数(非负数)
293
+ * @returns 格式化后的时长字符串(32333 -> "32s",1203000 -> "20m3s",60000 -> "1m0s")
294
+ */
295
+ export function formatDurationMs(ms) {
296
+ // 边界值处理:确保输入为非负数
297
+ if (typeof ms !== 'number' || isNaN(ms) || ms < 0) {
298
+ return '0s';
299
+ }
300
+ var totalSeconds = Math.floor(ms / 1000);
301
+ var minutes = Math.floor(totalSeconds / 60);
302
+ var seconds = totalSeconds % 60;
303
+ return minutes > 0 ? "".concat(minutes, "m").concat(seconds, "s") : "".concat(seconds, "s");
304
+ }
289
305
  export function replaceBraces(str) {
290
306
  if (str === null || str === '') {
291
307
  return str === '' ? '' : String(str);
@@ -443,6 +459,13 @@ export function formatFields(dataList, chatList) {
443
459
  if (item.role === 1 && item.chatId !== null && roleZeroMap.has(item.chatId)) {
444
460
  var _roleZeroData$related;
445
461
  var roleZeroData = roleZeroMap.get(item.chatId);
462
+ var artifacts = [];
463
+ try {
464
+ var _item$attachedEvents;
465
+ 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 || [];
466
+ } catch (error) {
467
+ console.log('error', error);
468
+ }
446
469
  item.relatedCount = roleZeroData.relatedCount;
447
470
  item.relatedCourseRecommendation = roleZeroData.relatedCourseRecommendation ? JSON.parse(roleZeroData.relatedCourseRecommendation) : [];
448
471
  item.questionId = roleZeroData.questionId;
@@ -470,6 +493,14 @@ export function formatFields(dataList, chatList) {
470
493
  item.selectValue = getSelectValue(item.content, moduleInfo, isLastItem, nextItem);
471
494
  item.reTryed = checkHasRetry(item.skillResult, index === dataList.length - 1); // 最新的一个skill生成结果失败,才可以重试
472
495
  item.disableUploadFile = getDisableUploadFile(item.content, moduleInfo, isLastItem);
496
+ item.artifacts = artifacts;
497
+ item.totalTokens = item.tokens || 0;
498
+ item.thinkingInfo = {
499
+ status: "COMPLETED",
500
+ toolName: "已完成",
501
+ collapse: true,
502
+ loaded: false
503
+ };
473
504
  }
474
505
  });
475
506
  return dataList;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myun/gimi-chat",
3
- "version": "0.9.45",
3
+ "version": "0.9.47",
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",