@myun/gimi-chat 0.9.74 → 0.9.75
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/components/answer-item/component/tool-list/index.js +29 -17
- package/dist/hooks/useChatStream.js +26 -13
- package/dist/hooks/useCommonChatAPI.js +1 -2
- package/dist/interfaces/chatMessage.d.ts +0 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.js +12 -5
- package/package.json +1 -1
package/dist/utils/tools.js
CHANGED
|
@@ -107,6 +107,10 @@ export function parseMessageContent(str) {
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
+
// 特殊场景 JSON.parse 返回的是数字
|
|
111
|
+
if (Object.prototype.toString.call(parsedRs) === '[object Number]') {
|
|
112
|
+
result.content = String(parsedRs);
|
|
113
|
+
}
|
|
110
114
|
} catch (error) {
|
|
111
115
|
result.content = str;
|
|
112
116
|
}
|
|
@@ -461,8 +465,6 @@ export function formatFields(dataList, chatList) {
|
|
|
461
465
|
dataList.forEach(function (item, index) {
|
|
462
466
|
if (item.role === 1 && item.chatId !== null && roleZeroMap.has(item.chatId)) {
|
|
463
467
|
var _roleZeroData$related;
|
|
464
|
-
// 当前处于用户交互确认
|
|
465
|
-
var isPendingUserConfirm = item.moduleType === "user_confirm" && (item === null || item === void 0 ? void 0 : item.pendingUserConfirm);
|
|
466
468
|
var roleZeroData = roleZeroMap.get(item.chatId);
|
|
467
469
|
var artifacts = [];
|
|
468
470
|
try {
|
|
@@ -487,7 +489,12 @@ export function formatFields(dataList, chatList) {
|
|
|
487
489
|
var _parseMessageContent2 = parseMessageContent(item.content || ''),
|
|
488
490
|
moduleInfo = _parseMessageContent2.moduleInfo,
|
|
489
491
|
content = _parseMessageContent2.content;
|
|
490
|
-
|
|
492
|
+
// 当前处于用户交互确认
|
|
493
|
+
var isPendingUserConfirm = item.moduleType === "user_confirm" && (item === null || item === void 0 ? void 0 : item.pendingUserConfirm);
|
|
494
|
+
// 当前处于用户问答确认
|
|
495
|
+
var isAskPending = item.moduleType === "ask" && (moduleInfo === null || moduleInfo === void 0 ? void 0 : moduleInfo.status) === "PENDING";
|
|
496
|
+
var isPending = isAskPending || isPendingUserConfirm;
|
|
497
|
+
item.stop = isPending ? 0 : item.contentState ? 0 : 1; // 推理状态 0 推理完成 1 停止
|
|
491
498
|
// item.moduleType = item.content ? JSON.parse(item.content).moduleType : null;
|
|
492
499
|
item.moduleInfo = moduleInfo;
|
|
493
500
|
if (content) {
|
|
@@ -503,9 +510,9 @@ export function formatFields(dataList, chatList) {
|
|
|
503
510
|
item.thinkingInfo = {
|
|
504
511
|
status: "COMPLETED",
|
|
505
512
|
toolName: "已完成",
|
|
506
|
-
collapse: !
|
|
513
|
+
collapse: !isPending,
|
|
507
514
|
loaded: false,
|
|
508
|
-
needInit:
|
|
515
|
+
needInit: isPending
|
|
509
516
|
};
|
|
510
517
|
}
|
|
511
518
|
});
|