@myun/gimi-chat 0.9.45 → 0.9.46
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/apis/useApi.d.ts +6 -0
- package/dist/apis/useApi.js +45 -1
- package/dist/components/ai-chat-dialogue/index copy.js +1 -1
- package/dist/components/ai-chat-dialogue/index.js +4 -2
- package/dist/components/answer-item/component/artifacts/index.d.ts +13 -0
- package/dist/components/answer-item/component/artifacts/index.js +52 -0
- package/dist/components/answer-item/component/artifacts/index.module.css +24 -0
- package/dist/components/answer-item/component/tool-list/index.d.ts +7 -0
- package/dist/components/answer-item/component/tool-list/index.js +97 -0
- package/dist/components/answer-item/component/tool-list/index.module.css +92 -0
- package/dist/components/answer-item/index.d.ts +2 -1
- package/dist/components/answer-item/index.js +160 -7
- package/dist/components/answer-item/index.module.css +24 -0
- package/dist/components/ask-card/index.d.ts +1 -1
- package/dist/components/chat-input/extension/index.d.ts +1 -0
- package/dist/components/chat-input/extension/index.js +2 -1
- package/dist/components/chat-input/extension/skill/MentionList.d.ts +30 -0
- package/dist/components/chat-input/extension/skill/MentionList.js +181 -0
- package/dist/components/chat-input/extension/skill/ReferSlot.d.ts +3 -0
- package/dist/components/chat-input/extension/skill/ReferSlot.js +100 -0
- package/dist/components/chat-input/extension/skill/data.d.ts +10 -0
- package/dist/components/chat-input/extension/skill/data.js +49 -0
- package/dist/components/chat-input/extension/skill/index.d.ts +7 -0
- package/dist/components/chat-input/extension/skill/index.js +5 -0
- package/dist/components/chat-input/extension/skill/index.less +100 -0
- package/dist/components/chat-input/extension/skill/suggestion.d.ts +14 -0
- package/dist/components/chat-input/extension/skill/suggestion.js +173 -0
- package/dist/components/chat-input/index.js +63 -15
- package/dist/components/file-card/index.js +2 -1
- package/dist/components/file-card/index.module.css +1 -0
- package/dist/components/knowledge-trace/tryWatch.js +8 -1
- package/dist/components/message-list/index.js +15 -3
- package/dist/components/message-list/index.module.css +3 -0
- package/dist/components/message-list/skill-tag/index.d.ts +5 -0
- package/dist/components/message-list/skill-tag/index.js +24 -0
- package/dist/components/message-list/skill-tag/index.module.css +22 -0
- package/dist/components/templates/CommonChat.js +3 -1
- package/dist/hooks/useChatActions.d.ts +2 -1
- package/dist/hooks/useChatActions.js +41 -3
- package/dist/hooks/useChatStream.d.ts +6 -1
- package/dist/hooks/useChatStream.js +96 -5
- package/dist/hooks/useCommonChatAPI.d.ts +1 -1
- package/dist/hooks/useCommonChatAPI.js +190 -54
- package/dist/i18n/locales/en-US.d.ts +3 -0
- package/dist/i18n/locales/en-US.js +10 -7
- package/dist/i18n/locales/zh-CN.d.ts +3 -0
- package/dist/i18n/locales/zh-CN.js +4 -1
- package/dist/interfaces/chatMessage.d.ts +38 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.d.ts +6 -0
- package/dist/utils/tools.js +31 -0
- package/package.json +3 -2
package/dist/utils/tools.d.ts
CHANGED
|
@@ -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格式的字符串
|
package/dist/utils/tools.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.9.46",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -23,11 +23,12 @@
|
|
|
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",
|
|
32
33
|
"@volcengine/rtc": "^4.68.0",
|
|
33
34
|
"classnames": "^2.2.6",
|