@myun/gimi-chat 0.9.0 → 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 () {
@@ -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);
@@ -117,6 +117,7 @@ export interface CommonChatProps {
117
117
  showHeader?: boolean;
118
118
  autoSendValue?: string;
119
119
  initSendValue?: string;
120
+ enableSearchCourse?: boolean;
120
121
  initAttachments?: FileItem[];
121
122
  initQuoteSource?: {
122
123
  teachModelId: number;