@myun/gimi-chat 0.8.9 → 0.9.1
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.
|
@@ -43,7 +43,9 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
43
|
_props$model = props.model,
|
|
44
44
|
model = _props$model === void 0 ? 'fullscreen' : _props$model,
|
|
45
45
|
conversationId = props.conversationId,
|
|
46
|
-
businessParams = props.businessParams
|
|
46
|
+
businessParams = props.businessParams,
|
|
47
|
+
_props$enableSearchCo = props.enableSearchCourse,
|
|
48
|
+
enableSearchCourse = _props$enableSearchCo === void 0 ? true : _props$enableSearchCo;
|
|
47
49
|
var store = useStore();
|
|
48
50
|
var dispatch = useAppDispatch();
|
|
49
51
|
var containerRef = React.useRef(null);
|
|
@@ -70,7 +72,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
70
72
|
isPlaying = _useChatVoice.isPlaying;
|
|
71
73
|
|
|
72
74
|
// 搜索相关课程 - 开始
|
|
73
|
-
var _useSearchCourse = useSearchCourse(),
|
|
75
|
+
var _useSearchCourse = useSearchCourse(enableSearchCourse),
|
|
74
76
|
searchedCourseList = _useSearchCourse.searchedCourseList,
|
|
75
77
|
searching = _useSearchCourse.searching,
|
|
76
78
|
searchCourses = _useSearchCourse.searchCourses,
|
|
@@ -203,7 +205,7 @@ var CommonChat = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
203
205
|
return;
|
|
204
206
|
}
|
|
205
207
|
handleSend(val, agent, isSystemAuto);
|
|
206
|
-
}, [handleSend, startConversationAndChat, setSearchedCourseList, dispatch, sidebar.type]);
|
|
208
|
+
}, [handleSend, startConversationAndChat, setSearchedCourseList, dispatch, sidebar.type, store]);
|
|
207
209
|
|
|
208
210
|
// 输入框开头Agent名称
|
|
209
211
|
var showTitleSlot = React.useMemo(function () {
|
|
@@ -807,7 +807,7 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
807
807
|
return function (_x14) {
|
|
808
808
|
return _ref11.apply(this, arguments);
|
|
809
809
|
};
|
|
810
|
-
}(), [dispatch, inputValue,
|
|
810
|
+
}(), [dispatch, inputValue, streamEsAbortRef]);
|
|
811
811
|
var fillInputModel = React.useCallback(function (value, messageList) {
|
|
812
812
|
if ((messageList === null || messageList === void 0 ? void 0 : messageList.length) > 0 && value && messageList[messageList.length - 1].moduleType === 'ask') {
|
|
813
813
|
var targetChatItem = _toConsumableArray(messageList).reverse().find(function (item) {
|
|
@@ -1143,7 +1143,6 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
|
|
|
1143
1143
|
setDisableSend(true);
|
|
1144
1144
|
var uploadFile = fileList[0];
|
|
1145
1145
|
var isLastMessageEmptyUserChat = (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.moduleType) === 'ask'; // 空内容
|
|
1146
|
-
// const isDerectlySend = Boolean(lastMessage.role === 0 && lastMessage.messageFiles?.content); // 最后一条消息是用户上传的excel
|
|
1147
1146
|
if (!isLastMessageEmptyUserChat) {
|
|
1148
1147
|
var shouldEnableUpload = uploadFile.status === FileStatus.UPLOAD_FAILED || uploadFile.status === FileStatus.ANALYSE_FAILED;
|
|
1149
1148
|
var newMessageList = [].concat(_toConsumableArray(messageList.slice(0, -2)), [_objectSpread(_objectSpread({}, messageList[messageList.length - 2]), {}, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ICourseItem } from "../components/search-course-list";
|
|
3
|
-
declare const useSearchCourse: () => {
|
|
3
|
+
declare const useSearchCourse: (enableSearchCourse: boolean) => {
|
|
4
4
|
searchedCourseList: ICourseItem[];
|
|
5
5
|
searching: boolean;
|
|
6
6
|
searchCourses: (query: string, callback?: () => void) => void;
|
|
@@ -8,7 +8,7 @@ import { useState } from "react";
|
|
|
8
8
|
import { useContext } from "react";
|
|
9
9
|
import ChatContext from "../components/templates/chatContext";
|
|
10
10
|
import { Toast } from "@douyinfe/semi-ui";
|
|
11
|
-
var useSearchCourse = function useSearchCourse() {
|
|
11
|
+
var useSearchCourse = function useSearchCourse(enableSearchCourse) {
|
|
12
12
|
var _useContext = useContext(ChatContext),
|
|
13
13
|
apiService = _useContext.apiService;
|
|
14
14
|
var _ref = apiService,
|
|
@@ -22,6 +22,9 @@ var useSearchCourse = function useSearchCourse() {
|
|
|
22
22
|
searching = _useState4[0],
|
|
23
23
|
setSearching = _useState4[1];
|
|
24
24
|
var searchCourses = function searchCourses(query, callback) {
|
|
25
|
+
if (!enableSearchCourse) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
25
28
|
setSearching(true);
|
|
26
29
|
getSearchCourseList(query).then(function (res) {
|
|
27
30
|
setSearching(false);
|
package/dist/types/chat.d.ts
CHANGED