@myun/gimi-chat 0.9.70 → 0.9.72

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.
@@ -92,6 +92,12 @@ export interface IUseApi {
92
92
  chatId: string;
93
93
  pageSize: number;
94
94
  }) => Promise<FetchResponse<any>>;
95
+ checkFileExist: (fileKey: string) => Promise<FetchResponse<any>>;
96
+ getThinkingEffective: (agentId: number) => Promise<FetchResponse<any>>;
97
+ saveThinkingEnable: (params: {
98
+ agentId: number;
99
+ thinkingEnable: number;
100
+ }) => Promise<FetchResponse<any>>;
95
101
  }
96
102
  declare const useApi: (baseUrl: string, authToken: string, locale?: string) => IUseApi;
97
103
  export default useApi;
@@ -595,6 +595,66 @@ var useApi = function useApi(baseUrl, authToken) {
595
595
  return _ref30.apply(this, arguments);
596
596
  };
597
597
  }();
598
+
599
+ // 校验文件链接是否有效
600
+ var checkFileExist = /*#__PURE__*/function () {
601
+ var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(fileKey) {
602
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
603
+ while (1) switch (_context30.prev = _context30.next) {
604
+ case 0:
605
+ return _context30.abrupt("return", fetchService.post('/mfilesvc/fileExist/checkFile', {
606
+ fileKey: fileKey
607
+ }));
608
+ case 1:
609
+ case "end":
610
+ return _context30.stop();
611
+ }
612
+ }, _callee30);
613
+ }));
614
+ return function checkFileExist(_x29) {
615
+ return _ref31.apply(this, arguments);
616
+ };
617
+ }();
618
+
619
+ // 获取深度思考是否生效
620
+ var getThinkingEffective = /*#__PURE__*/function () {
621
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(agentId) {
622
+ return _regeneratorRuntime().wrap(function _callee31$(_context31) {
623
+ while (1) switch (_context31.prev = _context31.next) {
624
+ case 0:
625
+ return _context31.abrupt("return", fetchService.get('/mcourse/web/agent/thinking/effective', {
626
+ params: {
627
+ agentId: agentId
628
+ }
629
+ }));
630
+ case 1:
631
+ case "end":
632
+ return _context31.stop();
633
+ }
634
+ }, _callee31);
635
+ }));
636
+ return function getThinkingEffective(_x30) {
637
+ return _ref32.apply(this, arguments);
638
+ };
639
+ }();
640
+
641
+ // 保存深度思考开关状态
642
+ var saveThinkingEnable = /*#__PURE__*/function () {
643
+ var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(params) {
644
+ return _regeneratorRuntime().wrap(function _callee32$(_context32) {
645
+ while (1) switch (_context32.prev = _context32.next) {
646
+ case 0:
647
+ return _context32.abrupt("return", fetchService.post('/mcourse/web/agent/thinking/save', params));
648
+ case 1:
649
+ case "end":
650
+ return _context32.stop();
651
+ }
652
+ }, _callee32);
653
+ }));
654
+ return function saveThinkingEnable(_x31) {
655
+ return _ref33.apply(this, arguments);
656
+ };
657
+ }();
598
658
  return {
599
659
  getSkillData: getSkillData,
600
660
  getProductList: getProductList,
@@ -625,7 +685,10 @@ var useApi = function useApi(baseUrl, authToken) {
625
685
  getVideoType: getVideoType,
626
686
  getDocumentTrialUrl: getDocumentTrialUrl,
627
687
  getAgentSkillList: getAgentSkillList,
628
- getAgentToolList: getAgentToolList
688
+ getAgentToolList: getAgentToolList,
689
+ checkFileExist: checkFileExist,
690
+ getThinkingEffective: getThinkingEffective,
691
+ saveThinkingEnable: saveThinkingEnable
629
692
  };
630
693
  };
631
694
  export default useApi;
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { ToolItem } from "../../../../interfaces/chatMessage";
3
- declare const ToolList: ({ toolList, handleClickConfirm }: {
3
+ declare const ToolList: ({ toolList, handleClickConfirm, customRender }: {
4
4
  toolList: ToolItem[];
5
5
  handleClickConfirm: (item: any, confirmed: boolean) => void;
6
+ customRender: any;
6
7
  }) => React.JSX.Element;
7
8
  export default ToolList;
@@ -13,15 +13,50 @@ import { MMarkdown } from '@myun/gimi-design';
13
13
  import IconFont from "../../../iconfont-com";
14
14
  import styles from "./index.module.css";
15
15
  import classNames from "classnames";
16
- var ToolItemCom = function ToolItemCom(_ref) {
17
- var item = _ref.item;
16
+
17
+ // 思考工具项组件
18
+ var ThinkingToolItem = function ThinkingToolItem(_ref) {
19
+ var item = _ref.item,
20
+ customRender = _ref.customRender;
18
21
  var _useState = useState(false),
19
22
  _useState2 = _slicedToArray(_useState, 2),
20
23
  showContent = _useState2[0],
21
24
  setShowContent = _useState2[1];
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ className: styles.toolItem
27
+ }, /*#__PURE__*/React.createElement("div", {
28
+ className: styles.toolItemLabel,
29
+ onClick: function onClick() {
30
+ return item.content && setShowContent(!showContent);
31
+ }
32
+ }, item.status === "COMPLETED" && /*#__PURE__*/React.createElement("img", {
33
+ className: styles.toolIcon,
34
+ src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202609/07/e5347_20260907085700.png"
35
+ }), /*#__PURE__*/React.createElement("div", {
36
+ className: classNames(styles.toolName, _defineProperty({}, styles.running, item.status === "RUNNING" || item.status === "STARTED"))
37
+ }, item.toolName), item.status === "COMPLETED" && item.content && /*#__PURE__*/React.createElement(IconFont, {
38
+ className: classNames(styles.icon, _defineProperty({}, styles.hasContent, showContent)),
39
+ type: showContent ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
40
+ size: 12,
41
+ extraStyle: {
42
+ color: !showContent ? "var(--theme-neutral, #626262)" : "var(--theme-mediumNeutral, #B3B2B2)"
43
+ }
44
+ })), item.content && showContent && /*#__PURE__*/React.createElement("div", {
45
+ className: styles.toolItemContent
46
+ }, /*#__PURE__*/React.createElement(MMarkdown, {
47
+ content: item.content,
48
+ customRender: customRender,
49
+ showLoading: item.status === "RUNNING"
50
+ })));
51
+ };
52
+ var ToolItemCom = function ToolItemCom(_ref2) {
53
+ var item = _ref2.item,
54
+ customRender = _ref2.customRender;
55
+ var _useState3 = useState(false),
56
+ _useState4 = _slicedToArray(_useState3, 2),
57
+ showContent = _useState4[0],
58
+ setShowContent = _useState4[1];
22
59
  var content = useMemo(function () {
23
- // item.content 可能是:普通文本 / 单层 JSON / 双层 JSON 字符串
24
- // 逐层 parse,直到结果不是字符串或 parse 失败为止
25
60
  var result = item.content || '';
26
61
  for (var depth = 0; depth < 2 && typeof result === 'string'; depth++) {
27
62
  try {
@@ -30,10 +65,8 @@ var ToolItemCom = function ToolItemCom(_ref) {
30
65
  break;
31
66
  }
32
67
  }
33
- // parse 到底是字符串直接用;如果是对象,取里面的文本字段渲染
34
68
  if (typeof result === 'string') return result;
35
69
  if (result && typeof result.content === 'string') return result.content;
36
- // 兜底:对象序列化
37
70
  return JSON.stringify(result, null, 2);
38
71
  }, [item.content]);
39
72
  return /*#__PURE__*/React.createElement("div", {
@@ -58,13 +91,15 @@ var ToolItemCom = function ToolItemCom(_ref) {
58
91
  })), item.content && showContent && /*#__PURE__*/React.createElement("div", {
59
92
  className: styles.toolItemContent
60
93
  }, /*#__PURE__*/React.createElement(MMarkdown, {
61
- content: content
94
+ content: content,
95
+ customRender: customRender,
96
+ showLoading: item.status === "RUNNING"
62
97
  })));
63
98
  };
64
- var ConfirmToolItem = function ConfirmToolItem(_ref2) {
99
+ var ConfirmToolItem = function ConfirmToolItem(_ref3) {
65
100
  var _item$data;
66
- var item = _ref2.item,
67
- handleClickConfirm = _ref2.handleClickConfirm;
101
+ var item = _ref3.item,
102
+ handleClickConfirm = _ref3.handleClickConfirm;
68
103
  var confirmTextMap = {
69
104
  PENDING: "等待人工确认",
70
105
  CONFIRMED: "用户已同意",
@@ -98,19 +133,31 @@ var ConfirmToolItem = function ConfirmToolItem(_ref2) {
98
133
  }
99
134
  }, "\u62D2\u7EDD"))));
100
135
  };
101
- var ToolList = function ToolList(_ref3) {
102
- var toolList = _ref3.toolList,
103
- handleClickConfirm = _ref3.handleClickConfirm;
136
+ var ToolList = function ToolList(_ref4) {
137
+ var toolList = _ref4.toolList,
138
+ handleClickConfirm = _ref4.handleClickConfirm,
139
+ customRender = _ref4.customRender;
104
140
  return /*#__PURE__*/React.createElement("div", {
105
141
  className: styles.toolList
106
142
  }, toolList.map(function (item) {
107
- return item.moduleType === "user_confirm" ? /*#__PURE__*/React.createElement(ConfirmToolItem, {
143
+ if (item.moduleType === "user_confirm") {
144
+ return /*#__PURE__*/React.createElement(ConfirmToolItem, {
145
+ key: item.id,
146
+ item: item,
147
+ handleClickConfirm: handleClickConfirm
148
+ });
149
+ }
150
+ if (item.moduleType === "thinking") {
151
+ return /*#__PURE__*/React.createElement(ThinkingToolItem, {
152
+ key: item.id,
153
+ item: item,
154
+ customRender: customRender
155
+ });
156
+ }
157
+ return /*#__PURE__*/React.createElement(ToolItemCom, {
108
158
  key: item.id,
109
159
  item: item,
110
- handleClickConfirm: handleClickConfirm
111
- }) : /*#__PURE__*/React.createElement(ToolItemCom, {
112
- key: item.id,
113
- item: item
160
+ customRender: customRender
114
161
  });
115
162
  }));
116
163
  };
@@ -5,12 +5,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
10
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
9
11
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
12
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
13
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
15
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
16
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -21,10 +21,8 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
21
21
  import { useTranslation } from 'react-i18next';
22
22
  import styles from "./index.module.css";
23
23
  import classNames from 'classnames';
24
- import ReasoningContent from "../reasoning-content/index";
25
24
  import { processString, formatDurationMs } from "../../utils/tools";
26
25
  import { MMarkdown } from '@myun/gimi-design';
27
- import AskCard from "../ask-card";
28
26
  import WorkFlowContent from "../work-flow-content";
29
27
  import ExcelSuccessCard from "../excel-components/ExcelSuccessCard";
30
28
  import KnowledgeIconGroup from "../knowledge-trace/KnowledgeIconComponent";
@@ -44,8 +42,10 @@ import Artifacts from "./component/artifacts";
44
42
  import ChatContext from "../templates/chatContext";
45
43
  import { setMessageList } from "../../store/slices/gimiMenuSlice";
46
44
  import { TOOL_MODULE_TYPES, getToolNameByStatus } from "../../hooks/useChatStream";
45
+ import ReasoningSearch from "../reasoning-search";
46
+ import { Toast } from '@douyinfe/semi-ui';
47
47
  var AnswerItem = function AnswerItem(_ref) {
48
- var _item$thinkingInfo3, _item$thinkingInfo5, _item$thinkingInfo6, _item$thinkingInfo7, _item$toolList, _item$artifacts, _agentDetail$voiceCon;
48
+ var _item$thinkingInfo3, _item$thinkingInfo5, _item$thinkingInfo6, _item$thinkingInfo7, _item$artifacts, _agentDetail$voiceCon;
49
49
  var item = _ref.item,
50
50
  onSucess = _ref.onSucess,
51
51
  onFailure = _ref.onFailure,
@@ -194,13 +194,42 @@ var AnswerItem = function AnswerItem(_ref) {
194
194
  }, {
195
195
  type: 'myunproduct',
196
196
  component: ProductTag
197
- }
198
- // {
199
- // type: 'correction',
200
- // component: AICorrection
201
- // }
202
- ];
197
+ }, {
198
+ type: 'search',
199
+ component: ReasoningSearch
200
+ }];
203
201
  }, [onDownloadCallback, model, item.id]);
202
+
203
+ // 构造思考工具项
204
+ var thinkingToolItem = React.useMemo(function () {
205
+ if (!item.reasoningContent || item.vipLevel !== 1) return null;
206
+ return {
207
+ id: "thinking-".concat(item.id),
208
+ moduleType: 'thinking',
209
+ toolName: getToolNameByStatus('thinking', item.reasoningStatus === 1 ? 'RUNNING' : item.reasoningStatus === 2 ? 'COMPLETED' : 'FAILED'),
210
+ content: item.reasoningContent,
211
+ status: item.reasoningStatus === 1 ? 'RUNNING' : item.reasoningStatus === 2 ? 'COMPLETED' : 'FAILED'
212
+ };
213
+ }, [item.reasoningContent, item.reasoningStatus, item.vipLevel, item.id]);
214
+
215
+ // 合并工具列表
216
+ var mergedToolList = React.useMemo(function () {
217
+ var tools = _toConsumableArray(item.toolList || []);
218
+ if (thinkingToolItem) {
219
+ // 找到 moduleType 为 end 的索引
220
+ var endIndex = tools.findIndex(function (tool) {
221
+ return tool.moduleType === 'end';
222
+ });
223
+ if (endIndex !== -1) {
224
+ // 插入到 end 前面
225
+ tools.splice(endIndex, 0, thinkingToolItem);
226
+ } else {
227
+ // 没有 end,插入到结尾
228
+ tools.push(thinkingToolItem);
229
+ }
230
+ }
231
+ return tools;
232
+ }, [item.toolList, thinkingToolItem]);
204
233
  var handleExpendThinking = /*#__PURE__*/function () {
205
234
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
206
235
  var _item$thinkingInfo;
@@ -309,12 +338,7 @@ var AnswerItem = function AnswerItem(_ref) {
309
338
  onClickCapture: handleLinkClickCapture
310
339
  }, /*#__PURE__*/React.createElement("div", {
311
340
  className: classNames(styles.answer)
312
- }, item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
313
- chatItem: item
314
- }), (agentDetail === null || agentDetail === void 0 ? void 0 : agentDetail.agentMode) === 'workflow' ? /*#__PURE__*/React.createElement(React.Fragment, null, item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
315
- reasoningTitle: reasoningTitle,
316
- item: item
317
- })) : /*#__PURE__*/React.createElement("div", {
341
+ }, /*#__PURE__*/React.createElement("div", {
318
342
  className: styles.thinkingContent
319
343
  }, ((_item$thinkingInfo6 = item.thinkingInfo) === null || _item$thinkingInfo6 === void 0 ? void 0 : _item$thinkingInfo6.status) === "COMPLETED" && /*#__PURE__*/React.createElement("div", {
320
344
  className: styles.thinkingLabel,
@@ -327,13 +351,13 @@ var AnswerItem = function AnswerItem(_ref) {
327
351
  className: classNames(styles.icon, _defineProperty({}, styles.hasContent, expendThinking)),
328
352
  type: expendThinking ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
329
353
  size: 12
330
- })), expendThinking && /*#__PURE__*/React.createElement(React.Fragment, null, (item === null || item === void 0 ? void 0 : item.toolList) && ((_item$toolList = item.toolList) === null || _item$toolList === void 0 ? void 0 : _item$toolList.length) > 0 && /*#__PURE__*/React.createElement(ToolList, {
331
- toolList: item.toolList,
332
- handleClickConfirm: handleClickConfirm
333
- }), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
334
- reasoningTitle: reasoningTitle,
335
- item: item
336
- }))), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
354
+ })), expendThinking && /*#__PURE__*/React.createElement(React.Fragment, null, mergedToolList.length > 0 && /*#__PURE__*/React.createElement(ToolList, {
355
+ toolList: mergedToolList,
356
+ handleClickConfirm: handleClickConfirm,
357
+ customRender: customRender
358
+ }))), item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
359
+ chatItem: item
360
+ }), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
337
361
  className: styles.completed
338
362
  }, /*#__PURE__*/React.createElement(IconTickCircle, {
339
363
  className: styles.checkIcon
@@ -343,10 +367,6 @@ var AnswerItem = function AnswerItem(_ref) {
343
367
  content: processString(item.content || ''),
344
368
  customRender: customRender,
345
369
  showLoading: item.loading
346
- }), showAskTag && /*#__PURE__*/React.createElement(AskCard, {
347
- item: item,
348
- moduleInfo: item.moduleInfo,
349
- handleClickAskList: handleClickAskList
350
370
  }), showSkillTag && /*#__PURE__*/React.createElement(ExcelCard, {
351
371
  onRetry: onRetry,
352
372
  item: item,
@@ -399,6 +419,10 @@ var AnswerItem = function AnswerItem(_ref) {
399
419
  }, t('answer.courseRecommend')), (item.relatedCourseRecommendation || []).length > 4 && /*#__PURE__*/React.createElement("div", {
400
420
  className: styles.course_recommend_header_more,
401
421
  onClick: function onClick() {
422
+ if (platform === 'qiwei') {
423
+ Toast.info(t('trace.traceNotOpen'));
424
+ return;
425
+ }
402
426
  handleShowCourse(item);
403
427
  }
404
428
  }, /*#__PURE__*/React.createElement("span", {
@@ -411,7 +435,11 @@ var AnswerItem = function AnswerItem(_ref) {
411
435
  className: styles.courseItem,
412
436
  key: course.id,
413
437
  onClick: function onClick() {
414
- return window.open(course.productType === 'project' ? "/project-product/".concat(course.productId || course.id) : "/new-product/".concat(course.productId || course.id));
438
+ if (platform === 'qiwei') {
439
+ Toast.info(t('trace.traceNotOpen'));
440
+ return;
441
+ }
442
+ window.open(course.productType === 'project' ? "/project-product/".concat(course.productId || course.id) : "/new-product/".concat(course.productId || course.id));
415
443
  }
416
444
  }, /*#__PURE__*/React.createElement("div", {
417
445
  className: styles.cover
@@ -138,6 +138,16 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
138
138
  _React$useState4 = _slicedToArray(_React$useState3, 2),
139
139
  hasContent = _React$useState4[0],
140
140
  setHasContent = _React$useState4[1];
141
+ // thinking: 0 置灰禁用,1 可点击
142
+ var _React$useState5 = React.useState(false),
143
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
144
+ deepThinkDisabled = _React$useState6[0],
145
+ setDeepThinkDisabled = _React$useState6[1];
146
+ // thinkingEnable: 1 高亮(已开启),0 默认
147
+ var _React$useState7 = React.useState(false),
148
+ _React$useState8 = _slicedToArray(_React$useState7, 2),
149
+ deepThinkActive = _React$useState8[0],
150
+ setDeepThinkActive = _React$useState8[1];
141
151
  var _useContext = useContext(ChatContext),
142
152
  apiService = _useContext.apiService;
143
153
  var _ref = apiService,
@@ -162,6 +172,34 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
162
172
  }
163
173
  });
164
174
  }, [apiService]);
175
+
176
+ // 获取深度思考配置
177
+ useEffect(function () {
178
+ var agentId = agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId;
179
+ if (props.hiddenDeepThink || !agentId || !(apiService !== null && apiService !== void 0 && apiService.getThinkingEffective)) {
180
+ setDeepThinkDisabled(false);
181
+ setDeepThinkActive(false);
182
+ return;
183
+ }
184
+ var cancelled = false;
185
+ apiService.getThinkingEffective(agentId).then(function (res) {
186
+ if (cancelled) return;
187
+ var result = (res === null || res === void 0 ? void 0 : res.result) || {};
188
+ // thinking: 0 置灰禁用,1 可点击
189
+ setDeepThinkDisabled(result.thinking !== 1);
190
+ // thinkingEnable: 1 高亮(已开启),0 默认
191
+ setDeepThinkActive(result.thinkingEnable === 1);
192
+ }).catch(function (e) {
193
+ if (!cancelled) {
194
+ console.error('[deepThink] getThinkingEffective error:', e);
195
+ setDeepThinkDisabled(false);
196
+ setDeepThinkActive(false);
197
+ }
198
+ });
199
+ return function () {
200
+ cancelled = true;
201
+ };
202
+ }, [agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId, apiService]);
165
203
  React.useEffect(function () {
166
204
  if (!props.defaultPrompt) {
167
205
  setHasContent(false);
@@ -623,14 +661,35 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
623
661
  }
624
662
  (_props$onSend = props.onSend) === null || _props$onSend === void 0 || _props$onSend.call(props, text);
625
663
  }, [props, fileList, t]);
664
+
665
+ // 点击切换深度思考开关
666
+ var handleToggleDeepThink = React.useCallback(function () {
667
+ var _agentObjRef$current4;
668
+ if (deepThinkDisabled) return; // 置灰禁用时不可点击
669
+ var agentId = (_agentObjRef$current4 = agentObjRef.current) === null || _agentObjRef$current4 === void 0 ? void 0 : _agentObjRef$current4.agentId;
670
+ if (!agentId || !(apiService !== null && apiService !== void 0 && apiService.saveThinkingEnable)) return;
671
+ var nextActive = !deepThinkActive;
672
+ var thinkingEnable = nextActive ? 1 : 0;
673
+ // 乐观更新 UI
674
+ setDeepThinkActive(nextActive);
675
+ apiService.saveThinkingEnable({
676
+ agentId: agentId,
677
+ thinkingEnable: thinkingEnable
678
+ }).catch(function (e) {
679
+ // 接口失败回滚
680
+ console.error('[deepThink] saveThinkingEnable error:', e);
681
+ setDeepThinkActive(!nextActive);
682
+ Toast.error(t('action.failed'));
683
+ });
684
+ }, [apiService, deepThinkActive, deepThinkDisabled, t]);
626
685
  var renderConfigureArea = React.useCallback(function () {
627
686
  return /*#__PURE__*/React.createElement("div", {
628
687
  className: styles.configureArea
629
- }, UploadFileTool, !props.hiddenDeepThink && /*#__PURE__*/React.createElement(Tooltip, {
630
- trigger: 'click',
631
- content: t('chatInput.deepThinkTip')
688
+ }, UploadFileTool, !props.hiddenDeepThink && (deepThinkDisabled ? /*#__PURE__*/React.createElement(Tooltip, {
689
+ content: t('chatInput.deepThinkNotSupported')
632
690
  }, /*#__PURE__*/React.createElement("div", {
633
- className: styles.deepthink
691
+ className: classNames(styles.deepthink, _defineProperty(_defineProperty({}, styles.active, deepThinkActive), styles.disabled, deepThinkDisabled)),
692
+ onClick: handleToggleDeepThink
634
693
  }, /*#__PURE__*/React.createElement(IconFontCom, {
635
694
  type: "icon-moxing",
636
695
  size: 14
@@ -638,14 +697,18 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
638
697
  style: {
639
698
  marginBottom: 2
640
699
  }
641
- }, t('chatInput.deepThinkModeAuto')), /*#__PURE__*/React.createElement(IconFontCom, {
642
- type: "icon-a-jiantoucu2x",
643
- size: 12,
644
- extraStyle: {
645
- marginLeft: 0
700
+ }, t('chatInput.deepThinkModeAuto')))) : /*#__PURE__*/React.createElement("div", {
701
+ className: classNames(styles.deepthink, _defineProperty(_defineProperty({}, styles.active, deepThinkActive), styles.disabled, deepThinkDisabled)),
702
+ onClick: handleToggleDeepThink
703
+ }, /*#__PURE__*/React.createElement(IconFontCom, {
704
+ type: "icon-moxing",
705
+ size: 14
706
+ }), /*#__PURE__*/React.createElement("span", {
707
+ style: {
708
+ marginBottom: 2
646
709
  }
647
- }))), AgentContainer);
648
- }, [UploadFileTool, props.hiddenDeepThink, AgentContainer]);
710
+ }, t('chatInput.deepThinkModeAuto')))), AgentContainer);
711
+ }, [UploadFileTool, props.hiddenDeepThink, deepThinkActive, deepThinkDisabled, handleToggleDeepThink, AgentContainer]);
649
712
  var stopSSe = function stopSSe() {
650
713
  if (uploadFileRef.current) {
651
714
  var _uploadFileRef$curren2;
@@ -21,20 +21,29 @@
21
21
  display: flex;
22
22
  align-items: center;
23
23
  justify-content: center;
24
+ color: var(--theme-deepNeutral, #221813);
24
25
  cursor: pointer;
25
26
  margin-right: 4px;
26
27
  }
27
28
  .deepthink :hover {
28
29
  background-color: var(--theme-subtleNeutral, #F5F7FA);
29
30
  }
31
+ .deepthink.active {
32
+ color: var(--theme-primary, #4086ff);
33
+ background-color: var(--theme-primary-pale, #F0F8FF);
34
+ }
35
+ .deepthink.disabled {
36
+ opacity: 0.5;
37
+ cursor: not-allowed;
38
+ }
39
+ .deepthink.disabled :hover {
40
+ background-color: transparent;
41
+ }
30
42
  .deepthink span {
31
43
  margin-left: 4px;
32
- font-family: PingFangSC, PingFang SC;
33
- font-weight: 400;
44
+ font-weight: 500;
34
45
  font-size: 14px;
35
46
  line-height: 14px;
36
- text-align: right;
37
- font-style: normal;
38
47
  }
39
48
  .deepthink .imgs {
40
49
  display: flex;
@@ -13,7 +13,7 @@ import { knowledgeConstants } from "../../constants";
13
13
  import { useAppDispatch, useAppSelector } from "../../store/hooks";
14
14
  import React, { useMemo, useState } from 'react';
15
15
  import { useTranslation } from 'react-i18next';
16
- import { Popover } from '@douyinfe/semi-ui';
16
+ import { Popover, Toast } from '@douyinfe/semi-ui';
17
17
  import useKnowledgeService from "../../hooks/useKnowledgeService";
18
18
  import VideoList from "./videoList";
19
19
  import ClassList from "./classList";
@@ -68,6 +68,9 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
68
68
  if (!list || list.length === 0) return undefined;
69
69
  return list[list.length - 1].id;
70
70
  });
71
+ var platform = useAppSelector(function (state) {
72
+ return state.gimiMenu.platform;
73
+ });
71
74
  var isMsgRecieving = useAppSelector(function (state) {
72
75
  return state.gimiMenu.isMsgRecieving;
73
76
  });
@@ -88,6 +91,10 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
88
91
  isLoading = _useKnowledgeService.isLoading;
89
92
  var handleCurrentTrace = React.useCallback(function (trace) {
90
93
  if (trace.isDelete === 1 || trace.isDeleted === 1) return;
94
+ if (platform === 'qiwei') {
95
+ Toast.info(t('trace.traceNotOpen'));
96
+ return;
97
+ }
91
98
  if (type === 'video' && curPlayer) {
92
99
  curPlayer === null || curPlayer === void 0 || curPlayer.pause();
93
100
  }
@@ -156,7 +163,6 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
156
163
  onVisibleChange: onVisibleChange,
157
164
  className: "knowledgeHoverPanel",
158
165
  position: "bottomLeft"
159
- // trigger='click'
160
166
  }, /*#__PURE__*/React.createElement("div", {
161
167
  className: styles.icon_btn,
162
168
  onClick: handleIconClick