@myun/gimi-chat 0.9.54 → 0.9.55
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/index.js +20 -9
- package/dist/components/chat-input/extension/skill/MentionList.js +7 -6
- package/dist/components/chat-input/extension/skill/index.less +16 -1
- package/dist/components/chat-input/index.js +1 -2
- package/dist/hooks/useCommonChatAPI.js +2 -2
- package/dist/interfaces/chatMessage.d.ts +2 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.js +6 -3
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ import ChatContext from "../templates/chatContext";
|
|
|
45
45
|
import { setMessageList } from "../../store/slices/gimiMenuSlice";
|
|
46
46
|
import { TOOL_MODULE_TYPES, getToolNameByStatus } from "../../hooks/useChatStream";
|
|
47
47
|
var AnswerItem = function AnswerItem(_ref) {
|
|
48
|
-
var _item$thinkingInfo3, _item$
|
|
48
|
+
var _item$thinkingInfo3, _item$thinkingInfo5, _item$thinkingInfo6, _item$thinkingInfo7, _item$toolList, _item$artifacts, _agentDetail$voiceCon;
|
|
49
49
|
var item = _ref.item,
|
|
50
50
|
onSucess = _ref.onSucess,
|
|
51
51
|
onFailure = _ref.onFailure,
|
|
@@ -250,12 +250,17 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
250
250
|
return v.id === ((_data4 = data) === null || _data4 === void 0 ? void 0 : _data4.id);
|
|
251
251
|
});
|
|
252
252
|
if (index < 0) {
|
|
253
|
-
toolList.push(
|
|
254
|
-
|
|
253
|
+
toolList.push({
|
|
254
|
+
data: _objectSpread(_objectSpread({}, data), {}, {
|
|
255
|
+
askingEventId: item.askingEventId
|
|
256
|
+
}),
|
|
257
|
+
status: item.confirmStatus === "PENDING" ? "RUNNING" : 'COMPLETED',
|
|
255
258
|
content: data.content || '',
|
|
256
259
|
toolName: item.moduleType === 'stream' && item.status === 'TERMINATED' ? '技能调用已停止' : toolName,
|
|
257
|
-
confirmStatus: item.confirmStatus
|
|
258
|
-
|
|
260
|
+
confirmStatus: item.confirmStatus,
|
|
261
|
+
id: item.id || +new Date(),
|
|
262
|
+
moduleType: item.moduleType
|
|
263
|
+
});
|
|
259
264
|
} else {
|
|
260
265
|
toolList[index] = _objectSpread(_objectSpread({}, toolList[index]), {}, {
|
|
261
266
|
content: data.content || toolList[index].content
|
|
@@ -291,8 +296,14 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
291
296
|
}();
|
|
292
297
|
useEffect(function () {
|
|
293
298
|
var _item$thinkingInfo2;
|
|
294
|
-
|
|
295
|
-
|
|
299
|
+
if ((_item$thinkingInfo2 = item.thinkingInfo) !== null && _item$thinkingInfo2 !== void 0 && _item$thinkingInfo2.needInit) {
|
|
300
|
+
handleExpendThinking();
|
|
301
|
+
}
|
|
302
|
+
}, [(_item$thinkingInfo3 = item.thinkingInfo) === null || _item$thinkingInfo3 === void 0 ? void 0 : _item$thinkingInfo3.needInit]);
|
|
303
|
+
useEffect(function () {
|
|
304
|
+
var _item$thinkingInfo4;
|
|
305
|
+
setExpendThinking(!((_item$thinkingInfo4 = item.thinkingInfo) !== null && _item$thinkingInfo4 !== void 0 && _item$thinkingInfo4.collapse));
|
|
306
|
+
}, [(_item$thinkingInfo5 = item.thinkingInfo) === null || _item$thinkingInfo5 === void 0 ? void 0 : _item$thinkingInfo5.collapse]);
|
|
296
307
|
return /*#__PURE__*/React.createElement("div", {
|
|
297
308
|
className: styles.title,
|
|
298
309
|
onClickCapture: handleLinkClickCapture
|
|
@@ -305,14 +316,14 @@ var AnswerItem = function AnswerItem(_ref) {
|
|
|
305
316
|
item: item
|
|
306
317
|
})) : /*#__PURE__*/React.createElement("div", {
|
|
307
318
|
className: styles.thinkingContent
|
|
308
|
-
}, ((_item$
|
|
319
|
+
}, ((_item$thinkingInfo6 = item.thinkingInfo) === null || _item$thinkingInfo6 === void 0 ? void 0 : _item$thinkingInfo6.status) === "COMPLETED" && /*#__PURE__*/React.createElement("div", {
|
|
309
320
|
className: styles.thinkingLabel,
|
|
310
321
|
onClick: function onClick() {
|
|
311
322
|
return handleExpendThinking();
|
|
312
323
|
}
|
|
313
324
|
}, /*#__PURE__*/React.createElement("div", {
|
|
314
325
|
className: styles.toolName
|
|
315
|
-
}, (_item$
|
|
326
|
+
}, (_item$thinkingInfo7 = item.thinkingInfo) === null || _item$thinkingInfo7 === void 0 ? void 0 : _item$thinkingInfo7.toolName), /*#__PURE__*/React.createElement(IconFont, {
|
|
316
327
|
className: classNames(styles.icon, _defineProperty({}, styles.hasContent, expendThinking)),
|
|
317
328
|
type: expendThinking ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
|
|
318
329
|
size: 12
|
|
@@ -101,11 +101,10 @@ var MentionList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
101
101
|
var item = filterOptions[id];
|
|
102
102
|
if (item) {
|
|
103
103
|
if (getCurrentTextLength) {
|
|
104
|
-
var _item$toolId, _item$toolCategoryDes, _item$
|
|
104
|
+
var _item$toolId, _item$toolCategoryDes, _item$toolName;
|
|
105
105
|
var serialized = "<skilltool>".concat(JSON.stringify({
|
|
106
106
|
toolId: (_item$toolId = item.toolId) !== null && _item$toolId !== void 0 ? _item$toolId : '',
|
|
107
107
|
toolType: (_item$toolCategoryDes = item.toolCategoryDesc) !== null && _item$toolCategoryDes !== void 0 ? _item$toolCategoryDes : '',
|
|
108
|
-
imageUrl: (_item$imageUrl = item.imageUrl) !== null && _item$imageUrl !== void 0 ? _item$imageUrl : '',
|
|
109
108
|
toolName: (_item$toolName = item.toolName) !== null && _item$toolName !== void 0 ? _item$toolName : ''
|
|
110
109
|
}), "</skilltool>");
|
|
111
110
|
var currentLen = getCurrentTextLength();
|
|
@@ -169,13 +168,15 @@ var MentionList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
169
168
|
style: {
|
|
170
169
|
width: '100%'
|
|
171
170
|
}
|
|
172
|
-
},
|
|
171
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
172
|
+
className: "skillTitle"
|
|
173
|
+
}, t('common.selectSkill')), loading ? /*#__PURE__*/React.createElement("div", {
|
|
173
174
|
style: {
|
|
174
175
|
margin: '20px'
|
|
175
176
|
}
|
|
176
|
-
}, /*#__PURE__*/React.createElement(AiLoading, null)) : filterOptions.length ? /*#__PURE__*/React.createElement("div",
|
|
177
|
-
className: "
|
|
178
|
-
},
|
|
177
|
+
}, /*#__PURE__*/React.createElement(AiLoading, null)) : filterOptions.length ? /*#__PURE__*/React.createElement("div", {
|
|
178
|
+
className: "ai-chat-input-custom-extension-dropdown-wrap"
|
|
179
|
+
}, filterOptions.map(function (item, index) {
|
|
179
180
|
return (
|
|
180
181
|
/*#__PURE__*/
|
|
181
182
|
// eslint-disable-next-line jsx-a11y/click-events-have-keyEvents
|
|
@@ -5,9 +5,23 @@
|
|
|
5
5
|
box-shadow: 0 2px 32px 0 rgba(0, 0, 0, 0.10);
|
|
6
6
|
padding: 10px;
|
|
7
7
|
max-height: 300px;
|
|
8
|
-
overflow-y: auto;
|
|
9
8
|
box-sizing: border-box;
|
|
9
|
+
.ai-chat-input-custom-extension-dropdown-wrap {
|
|
10
|
+
overflow-y: auto;
|
|
11
|
+
max-height: 240px;
|
|
12
|
+
padding-right: 14px;
|
|
10
13
|
|
|
14
|
+
&::-webkit-scrollbar {
|
|
15
|
+
width: 6px;
|
|
16
|
+
}
|
|
17
|
+
&::-webkit-scrollbar-thumb {
|
|
18
|
+
background-color: #EDEDEB;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
}
|
|
21
|
+
&::-webkit-scrollbar-track {
|
|
22
|
+
background: transparent;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
11
25
|
.optionItem {
|
|
12
26
|
display: flex;
|
|
13
27
|
align-items: center;
|
|
@@ -37,6 +51,7 @@
|
|
|
37
51
|
font-weight: 500;
|
|
38
52
|
line-height: 21px;
|
|
39
53
|
margin-bottom: 3px;
|
|
54
|
+
padding-left: 5px;
|
|
40
55
|
}
|
|
41
56
|
.skillItem {
|
|
42
57
|
display: flex;
|
|
@@ -53,12 +53,11 @@ var extractText = function extractText() {
|
|
|
53
53
|
// skill 节点序列化为 <skilltool> 标记发送,取值来自 content 中 transformer 展开后的 item
|
|
54
54
|
|
|
55
55
|
if (item.type === 'skill' && !skipSkill) {
|
|
56
|
-
var _skill$toolId, _skill$toolType, _skill$
|
|
56
|
+
var _skill$toolId, _skill$toolType, _skill$toolName;
|
|
57
57
|
var skill = item;
|
|
58
58
|
return "<skilltool>".concat(JSON.stringify({
|
|
59
59
|
toolId: (_skill$toolId = skill.toolId) !== null && _skill$toolId !== void 0 ? _skill$toolId : '',
|
|
60
60
|
toolType: (_skill$toolType = skill.toolType) !== null && _skill$toolType !== void 0 ? _skill$toolType : '',
|
|
61
|
-
imageUrl: (_skill$imageUrl = skill.imageUrl) !== null && _skill$imageUrl !== void 0 ? _skill$imageUrl : '',
|
|
62
61
|
toolName: (_skill$toolName = skill.toolName) !== null && _skill$toolName !== void 0 ? _skill$toolName : ''
|
|
63
62
|
}), "</skilltool>");
|
|
64
63
|
}
|
|
@@ -735,7 +735,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
735
735
|
lastUserMessage = chatList.filter(function (item) {
|
|
736
736
|
return item.role === 0;
|
|
737
737
|
}).pop(); // 检查最后一条消息是否为未完成的AI消息
|
|
738
|
-
if ((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === 1 && lastMessage.isCompleteOut === 0 && lastMessage.chatId) {
|
|
738
|
+
if ((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === 1 && lastMessage.isCompleteOut === 0 && lastMessage.chatId && lastMessage.moduleType !== 'user_confirm') {
|
|
739
739
|
if (lastMessage.vipLevel === 1) {
|
|
740
740
|
vipLevelRef.current = 1;
|
|
741
741
|
}
|
|
@@ -752,7 +752,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
752
752
|
reasoningContent: processString(lastMessage.reasoningContent || '')
|
|
753
753
|
}, agentObjRef.current); // 调用续传接口
|
|
754
754
|
}
|
|
755
|
-
if (!((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === 1 && lastMessage.isCompleteOut === 1)) {
|
|
755
|
+
if (!((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === 1 && lastMessage.isCompleteOut === 1 && lastMessage.moduleType !== 'user_confirm')) {
|
|
756
756
|
_context8.next = 10;
|
|
757
757
|
break;
|
|
758
758
|
}
|
|
@@ -27,6 +27,7 @@ export interface ToolItem {
|
|
|
27
27
|
* 聊天消息主接口
|
|
28
28
|
*/
|
|
29
29
|
export interface IChatMessageItem {
|
|
30
|
+
pendingUserConfirm: any;
|
|
30
31
|
/** 代理ID(可选,无值时为 null) */
|
|
31
32
|
agentId?: number | null;
|
|
32
33
|
/** 机器人ID(可选,无值时为 null) */
|
|
@@ -135,6 +136,7 @@ export interface IChatMessageItem {
|
|
|
135
136
|
toolName?: string;
|
|
136
137
|
collapse?: boolean;
|
|
137
138
|
loaded?: boolean;
|
|
139
|
+
needInit?: boolean;
|
|
138
140
|
};
|
|
139
141
|
/** 资产列表 */
|
|
140
142
|
artifacts?: Artifact[] | null;
|