@myun/gimi-chat 0.9.71 → 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.
@@ -622,7 +622,7 @@ var useApi = function useApi(baseUrl, authToken) {
622
622
  return _regeneratorRuntime().wrap(function _callee31$(_context31) {
623
623
  while (1) switch (_context31.prev = _context31.next) {
624
624
  case 0:
625
- return _context31.abrupt("return", fetchService.get('/mbot/web/agent/thinking/effective', {
625
+ return _context31.abrupt("return", fetchService.get('/mcourse/web/agent/thinking/effective', {
626
626
  params: {
627
627
  agentId: agentId
628
628
  }
@@ -644,7 +644,7 @@ var useApi = function useApi(baseUrl, authToken) {
644
644
  return _regeneratorRuntime().wrap(function _callee32$(_context32) {
645
645
  while (1) switch (_context32.prev = _context32.next) {
646
646
  case 0:
647
- return _context32.abrupt("return", fetchService.post('/mbot/web/agent/thinking/save', params));
647
+ return _context32.abrupt("return", fetchService.post('/mcourse/web/agent/thinking/save', params));
648
648
  case 1:
649
649
  case "end":
650
650
  return _context32.stop();
@@ -13,16 +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) {
16
+
17
+ // 思考工具项组件
18
+ var ThinkingToolItem = function ThinkingToolItem(_ref) {
17
19
  var item = _ref.item,
18
20
  customRender = _ref.customRender;
19
21
  var _useState = useState(false),
20
22
  _useState2 = _slicedToArray(_useState, 2),
21
23
  showContent = _useState2[0],
22
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];
23
59
  var content = useMemo(function () {
24
- // item.content 可能是:普通文本 / 单层 JSON / 双层 JSON 字符串
25
- // 逐层 parse,直到结果不是字符串或 parse 失败为止
26
60
  var result = item.content || '';
27
61
  for (var depth = 0; depth < 2 && typeof result === 'string'; depth++) {
28
62
  try {
@@ -31,10 +65,8 @@ var ToolItemCom = function ToolItemCom(_ref) {
31
65
  break;
32
66
  }
33
67
  }
34
- // parse 到底是字符串直接用;如果是对象,取里面的文本字段渲染
35
68
  if (typeof result === 'string') return result;
36
69
  if (result && typeof result.content === 'string') return result.content;
37
- // 兜底:对象序列化
38
70
  return JSON.stringify(result, null, 2);
39
71
  }, [item.content]);
40
72
  return /*#__PURE__*/React.createElement("div", {
@@ -64,10 +96,10 @@ var ToolItemCom = function ToolItemCom(_ref) {
64
96
  showLoading: item.status === "RUNNING"
65
97
  })));
66
98
  };
67
- var ConfirmToolItem = function ConfirmToolItem(_ref2) {
99
+ var ConfirmToolItem = function ConfirmToolItem(_ref3) {
68
100
  var _item$data;
69
- var item = _ref2.item,
70
- handleClickConfirm = _ref2.handleClickConfirm;
101
+ var item = _ref3.item,
102
+ handleClickConfirm = _ref3.handleClickConfirm;
71
103
  var confirmTextMap = {
72
104
  PENDING: "等待人工确认",
73
105
  CONFIRMED: "用户已同意",
@@ -101,18 +133,28 @@ var ConfirmToolItem = function ConfirmToolItem(_ref2) {
101
133
  }
102
134
  }, "\u62D2\u7EDD"))));
103
135
  };
104
- var ToolList = function ToolList(_ref3) {
105
- var toolList = _ref3.toolList,
106
- handleClickConfirm = _ref3.handleClickConfirm,
107
- customRender = _ref3.customRender;
136
+ var ToolList = function ToolList(_ref4) {
137
+ var toolList = _ref4.toolList,
138
+ handleClickConfirm = _ref4.handleClickConfirm,
139
+ customRender = _ref4.customRender;
108
140
  return /*#__PURE__*/React.createElement("div", {
109
141
  className: styles.toolList
110
142
  }, toolList.map(function (item) {
111
- return item.moduleType === "user_confirm" ? /*#__PURE__*/React.createElement(ConfirmToolItem, {
112
- key: item.id,
113
- item: item,
114
- handleClickConfirm: handleClickConfirm
115
- }) : /*#__PURE__*/React.createElement(ToolItemCom, {
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, {
116
158
  key: item.id,
117
159
  item: item,
118
160
  customRender: customRender
@@ -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,7 +21,6 @@ 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
26
  import WorkFlowContent from "../work-flow-content";
@@ -43,8 +42,10 @@ import Artifacts from "./component/artifacts";
43
42
  import ChatContext from "../templates/chatContext";
44
43
  import { setMessageList } from "../../store/slices/gimiMenuSlice";
45
44
  import { TOOL_MODULE_TYPES, getToolNameByStatus } from "../../hooks/useChatStream";
45
+ import ReasoningSearch from "../reasoning-search";
46
+ import { Toast } from '@douyinfe/semi-ui';
46
47
  var AnswerItem = function AnswerItem(_ref) {
47
- 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;
48
49
  var item = _ref.item,
49
50
  onSucess = _ref.onSucess,
50
51
  onFailure = _ref.onFailure,
@@ -193,13 +194,42 @@ var AnswerItem = function AnswerItem(_ref) {
193
194
  }, {
194
195
  type: 'myunproduct',
195
196
  component: ProductTag
196
- }
197
- // {
198
- // type: 'correction',
199
- // component: AICorrection
200
- // }
201
- ];
197
+ }, {
198
+ type: 'search',
199
+ component: ReasoningSearch
200
+ }];
202
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]);
203
233
  var handleExpendThinking = /*#__PURE__*/function () {
204
234
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
205
235
  var _item$thinkingInfo;
@@ -321,18 +351,12 @@ var AnswerItem = function AnswerItem(_ref) {
321
351
  className: classNames(styles.icon, _defineProperty({}, styles.hasContent, expendThinking)),
322
352
  type: expendThinking ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
323
353
  size: 12
324
- })), 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, {
325
- toolList: item.toolList,
354
+ })), expendThinking && /*#__PURE__*/React.createElement(React.Fragment, null, mergedToolList.length > 0 && /*#__PURE__*/React.createElement(ToolList, {
355
+ toolList: mergedToolList,
326
356
  handleClickConfirm: handleClickConfirm,
327
357
  customRender: customRender
328
- }), item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
329
- reasoningTitle: reasoningTitle,
330
- item: item
331
358
  }))), item.mcp && /*#__PURE__*/React.createElement(WorkFlowContent, {
332
359
  chatItem: item
333
- }), (agentDetail === null || agentDetail === void 0 ? void 0 : agentDetail.agentMode) === 'workflow' && item.vipLevel === 1 && item.reasoningContent && /*#__PURE__*/React.createElement(ReasoningContent, {
334
- reasoningTitle: reasoningTitle,
335
- item: item
336
360
  }), showTaskSuccess && /*#__PURE__*/React.createElement("div", {
337
361
  className: styles.completed
338
362
  }, /*#__PURE__*/React.createElement(IconTickCircle, {
@@ -395,6 +419,10 @@ var AnswerItem = function AnswerItem(_ref) {
395
419
  }, t('answer.courseRecommend')), (item.relatedCourseRecommendation || []).length > 4 && /*#__PURE__*/React.createElement("div", {
396
420
  className: styles.course_recommend_header_more,
397
421
  onClick: function onClick() {
422
+ if (platform === 'qiwei') {
423
+ Toast.info(t('trace.traceNotOpen'));
424
+ return;
425
+ }
398
426
  handleShowCourse(item);
399
427
  }
400
428
  }, /*#__PURE__*/React.createElement("span", {
@@ -407,7 +435,11 @@ var AnswerItem = function AnswerItem(_ref) {
407
435
  className: styles.courseItem,
408
436
  key: course.id,
409
437
  onClick: function onClick() {
410
- 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));
411
443
  }
412
444
  }, /*#__PURE__*/React.createElement("div", {
413
445
  className: styles.cover
@@ -138,11 +138,11 @@ 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: 1 显示深度思考按钮,0 隐藏
141
+ // thinking: 0 置灰禁用,1 可点击
142
142
  var _React$useState5 = React.useState(false),
143
143
  _React$useState6 = _slicedToArray(_React$useState5, 2),
144
- shouldShowDeepThink = _React$useState6[0],
145
- setShouldShowDeepThink = _React$useState6[1];
144
+ deepThinkDisabled = _React$useState6[0],
145
+ setDeepThinkDisabled = _React$useState6[1];
146
146
  // thinkingEnable: 1 高亮(已开启),0 默认
147
147
  var _React$useState7 = React.useState(false),
148
148
  _React$useState8 = _slicedToArray(_React$useState7, 2),
@@ -177,7 +177,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
177
177
  useEffect(function () {
178
178
  var agentId = agentObj === null || agentObj === void 0 ? void 0 : agentObj.agentId;
179
179
  if (props.hiddenDeepThink || !agentId || !(apiService !== null && apiService !== void 0 && apiService.getThinkingEffective)) {
180
- setShouldShowDeepThink(false);
180
+ setDeepThinkDisabled(false);
181
181
  setDeepThinkActive(false);
182
182
  return;
183
183
  }
@@ -185,14 +185,14 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
185
185
  apiService.getThinkingEffective(agentId).then(function (res) {
186
186
  if (cancelled) return;
187
187
  var result = (res === null || res === void 0 ? void 0 : res.result) || {};
188
- // thinking: 1 显示按钮,0 隐藏
189
- setShouldShowDeepThink(result.thinking === 1);
188
+ // thinking: 0 置灰禁用,1 可点击
189
+ setDeepThinkDisabled(result.thinking !== 1);
190
190
  // thinkingEnable: 1 高亮(已开启),0 默认
191
191
  setDeepThinkActive(result.thinkingEnable === 1);
192
192
  }).catch(function (e) {
193
193
  if (!cancelled) {
194
194
  console.error('[deepThink] getThinkingEffective error:', e);
195
- setShouldShowDeepThink(false);
195
+ setDeepThinkDisabled(false);
196
196
  setDeepThinkActive(false);
197
197
  }
198
198
  });
@@ -665,6 +665,7 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
665
665
  // 点击切换深度思考开关
666
666
  var handleToggleDeepThink = React.useCallback(function () {
667
667
  var _agentObjRef$current4;
668
+ if (deepThinkDisabled) return; // 置灰禁用时不可点击
668
669
  var agentId = (_agentObjRef$current4 = agentObjRef.current) === null || _agentObjRef$current4 === void 0 ? void 0 : _agentObjRef$current4.agentId;
669
670
  if (!agentId || !(apiService !== null && apiService !== void 0 && apiService.saveThinkingEnable)) return;
670
671
  var nextActive = !deepThinkActive;
@@ -680,14 +681,14 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
680
681
  setDeepThinkActive(!nextActive);
681
682
  Toast.error(t('action.failed'));
682
683
  });
683
- }, [apiService, deepThinkActive, t]);
684
+ }, [apiService, deepThinkActive, deepThinkDisabled, t]);
684
685
  var renderConfigureArea = React.useCallback(function () {
685
686
  return /*#__PURE__*/React.createElement("div", {
686
687
  className: styles.configureArea
687
- }, UploadFileTool, !props.hiddenDeepThink && shouldShowDeepThink && /*#__PURE__*/React.createElement(Tooltip, {
688
- content: t('chatInput.deepThinkTip')
688
+ }, UploadFileTool, !props.hiddenDeepThink && (deepThinkDisabled ? /*#__PURE__*/React.createElement(Tooltip, {
689
+ content: t('chatInput.deepThinkNotSupported')
689
690
  }, /*#__PURE__*/React.createElement("div", {
690
- className: classNames(styles.deepthink, _defineProperty({}, styles.active, deepThinkActive)),
691
+ className: classNames(styles.deepthink, _defineProperty(_defineProperty({}, styles.active, deepThinkActive), styles.disabled, deepThinkDisabled)),
691
692
  onClick: handleToggleDeepThink
692
693
  }, /*#__PURE__*/React.createElement(IconFontCom, {
693
694
  type: "icon-moxing",
@@ -696,14 +697,18 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
696
697
  style: {
697
698
  marginBottom: 2
698
699
  }
699
- }, t('chatInput.deepThinkModeAuto')), /*#__PURE__*/React.createElement(IconFontCom, {
700
- type: "icon-a-jiantoucu2x",
701
- size: 12,
702
- extraStyle: {
703
- 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
704
709
  }
705
- }))), AgentContainer);
706
- }, [UploadFileTool, props.hiddenDeepThink, shouldShowDeepThink, deepThinkActive, handleToggleDeepThink, AgentContainer]);
710
+ }, t('chatInput.deepThinkModeAuto')))), AgentContainer);
711
+ }, [UploadFileTool, props.hiddenDeepThink, deepThinkActive, deepThinkDisabled, handleToggleDeepThink, AgentContainer]);
707
712
  var stopSSe = function stopSSe() {
708
713
  if (uploadFileRef.current) {
709
714
  var _uploadFileRef$curren2;
@@ -21,6 +21,7 @@
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
  }
@@ -31,14 +32,18 @@
31
32
  color: var(--theme-primary, #4086ff);
32
33
  background-color: var(--theme-primary-pale, #F0F8FF);
33
34
  }
35
+ .deepthink.disabled {
36
+ opacity: 0.5;
37
+ cursor: not-allowed;
38
+ }
39
+ .deepthink.disabled :hover {
40
+ background-color: transparent;
41
+ }
34
42
  .deepthink span {
35
43
  margin-left: 4px;
36
- font-family: PingFangSC, PingFang SC;
37
- font-weight: 400;
44
+ font-weight: 500;
38
45
  font-size: 14px;
39
46
  line-height: 14px;
40
- text-align: right;
41
- font-style: normal;
42
47
  }
43
48
  .deepthink .imgs {
44
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,13 +68,13 @@ 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
  });
74
77
  var isLastMessage = lastMessageId !== undefined && lastMessageId === messageId;
75
- var platform = useAppSelector(function (state) {
76
- return state.gimiMenu.platform;
77
- });
78
78
  var iconUrl = type === 'video' ? knowledgeConstants.VIDEO_ICON_KNOWLADGE_TRACE_ADDRESS : type === 'document' ? knowledgeConstants.DOCUMENT_ICON_ADDRESS : type === "information" ? knowledgeConstants.INFORMATION_ICON_ADRESS : knowledgeConstants.CLASS_ICON_ADDRESS;
79
79
  var kowledgeTrace = {
80
80
  type: type,
@@ -91,6 +91,10 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
91
91
  isLoading = _useKnowledgeService.isLoading;
92
92
  var handleCurrentTrace = React.useCallback(function (trace) {
93
93
  if (trace.isDelete === 1 || trace.isDeleted === 1) return;
94
+ if (platform === 'qiwei') {
95
+ Toast.info(t('trace.traceNotOpen'));
96
+ return;
97
+ }
94
98
  if (type === 'video' && curPlayer) {
95
99
  curPlayer === null || curPlayer === void 0 || curPlayer.pause();
96
100
  }
@@ -153,7 +157,7 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
153
157
  }, [isMsgRecieving, isLastMessage, dispatch, messageId, resources, type]);
154
158
  var typeLabel = type === 'video' ? t('knowledgeTrace.type.video') : type === 'product' ? t('knowledgeTrace.type.course') : type === 'information' ? t('knowledgeTrace.type.information') : t('knowledgeTrace.type.document');
155
159
  var unit = type === 'information' ? t('trace.unit.article') : t('trace.unit.piece');
156
- return /*#__PURE__*/React.createElement(React.Fragment, null, platform !== 'qiwei' ? /*#__PURE__*/React.createElement(Popover, {
160
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Popover, {
157
161
  content: /*#__PURE__*/React.createElement(React.Fragment, null, hoverPanelContent),
158
162
  visible: showPanel,
159
163
  onVisibleChange: onVisibleChange,
@@ -168,16 +172,7 @@ export var KnowledgeIconComponent = function KnowledgeIconComponent(_ref2) {
168
172
  count: resources === null || resources === void 0 ? void 0 : resources.length,
169
173
  unit: unit,
170
174
  type: typeLabel
171
- })))) : /*#__PURE__*/React.createElement("div", {
172
- className: styles.icon_btn,
173
- onClick: handleIconClick
174
- }, /*#__PURE__*/React.createElement(KnowledgeIcon, {
175
- url: iconUrl
176
- }), /*#__PURE__*/React.createElement("span", null, t('trace.countByType', {
177
- count: resources === null || resources === void 0 ? void 0 : resources.length,
178
- unit: unit,
179
- type: typeLabel
180
- }))), /*#__PURE__*/React.createElement(TryWatch, {
175
+ })))), /*#__PURE__*/React.createElement(TryWatch, {
181
176
  item: curTrace,
182
177
  type: type,
183
178
  visible: tryWatchVisible,
@@ -40,7 +40,7 @@ export var MODULE_TYPE_NAMES = {
40
40
  'summary': '章节总结节点',
41
41
  'loop': '循环节点',
42
42
  'skill': '技能节点',
43
- 'skillBase': '通用技能节点',
43
+ 'skillBase': '技能',
44
44
  'break': '终止循环节点',
45
45
  'http': 'HTTP节点',
46
46
  'esKnowledge': '知识库节点',
@@ -54,11 +54,6 @@ var NODE_STATUS_TEXTS = {
54
54
  'RUNNING': '正在理解问题',
55
55
  'COMPLETED': '已完成理解问题'
56
56
  },
57
- 'llm': {
58
- 'STARTED': '开始分析问题',
59
- 'RUNNING': '正在分析问题',
60
- 'COMPLETED': '已完成分析'
61
- },
62
57
  'thinking': {
63
58
  'STARTED': '开始分析问题',
64
59
  'RUNNING': '正在分析问题',
@@ -75,9 +70,14 @@ var NODE_STATUS_TEXTS = {
75
70
  'COMPLETED': '已调用知识库检索'
76
71
  },
77
72
  "mcp": {
78
- 'STARTED': '开始调用MCP',
79
- 'RUNNING': '正在调用MCP',
80
- 'COMPLETED': '已调用MCP'
73
+ 'STARTED': '开始调用技能',
74
+ 'RUNNING': '正在调用技能',
75
+ 'COMPLETED': '已调用技能'
76
+ },
77
+ "skillBase": {
78
+ 'STARTED': '开始调用技能',
79
+ 'RUNNING': '正在调用技能',
80
+ 'COMPLETED': '已调用技能'
81
81
  },
82
82
  "http": {
83
83
  'STARTED': '开始调用处理数据',
@@ -110,9 +110,14 @@ var NODE_STATUS_TEXTS = {
110
110
  'COMPLETED': '已处理任务'
111
111
  },
112
112
  "text": {
113
- 'STARTED': '开始调用写入文件',
114
- 'RUNNING': '正在调用写入文件',
115
- 'COMPLETED': '已调用写入文件'
113
+ 'STARTED': '开始调用处理数据',
114
+ 'RUNNING': '正在调用处理数据',
115
+ 'COMPLETED': '已调用处理数据'
116
+ },
117
+ "llm": {
118
+ 'STARTED': '开始分析问题',
119
+ 'RUNNING': '正在分析问题',
120
+ 'COMPLETED': '已完成分析'
116
121
  }
117
122
 
118
123
  // 其他节点可继续添加自定义文案
@@ -355,22 +355,28 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
355
355
  }));
356
356
  }, [dispatch]);
357
357
  var handleToolStreamRs = React.useCallback(function (dataObj) {
358
+ var _curToolList$curToolI;
358
359
  // 只处理工作流模式下的 tool_result,其他情况暂不处理
359
360
  if (dataObj.moduleType === 'tool_result' && dataObj.name !== 'executeWorkflow') return;
360
361
  setStatus(2);
362
+ // 特殊逻辑,将开始节点处理成 agent 类型,保持只有一个 agent 节点
363
+ if (dataObj.moduleType === 'start') {
364
+ dataObj.moduleType = 'agent';
365
+ }
366
+ ;
361
367
  var messageList = messageListRef.current;
362
368
  var lastMessage = messageList[messageList.length - 1];
363
369
  var curToolList = _toConsumableArray((lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.toolList) || []);
364
370
  var curToolIndex = curToolList.findIndex(function (item) {
365
371
  return (item === null || item === void 0 ? void 0 : item.id) === dataObj.id;
366
372
  });
367
-
373
+ var curThinkingContent = ((_curToolList$curToolI = curToolList[curToolIndex]) === null || _curToolList$curToolI === void 0 ? void 0 : _curToolList$curToolI.content) || '';
368
374
  // 为新节点类型根据 status 生成 toolName
369
375
  var isNewNodeType = !['tool_invocation', 'tool_result', "agent"].includes(dataObj.moduleType);
370
376
  var toolName = isNewNodeType ? getToolNameByStatus(dataObj.moduleType, dataObj.status) : dataObj.toolName;
371
377
  if (curToolIndex >= 0) {
372
378
  curToolList[curToolIndex] = _objectSpread(_objectSpread({}, curToolList[curToolIndex]), {}, {
373
- content: dataObj.moduleType === 'thinking' ? dataObj.reasoningContent : dataObj.content || '',
379
+ content: dataObj.moduleType === 'thinking' ? curThinkingContent + (dataObj.reasoningContent || '') : dataObj.content || '',
374
380
  // tool_invocation 更新 toolName 和 status,新节点类型也更新
375
381
  toolName: dataObj.moduleType === 'tool_invocation' ? dataObj.toolName || '' : isNewNodeType ? toolName : curToolList[curToolIndex].toolName,
376
382
  status: dataObj.moduleType === 'tool_invocation' || isNewNodeType ? dataObj.status : curToolList[curToolIndex].status
@@ -379,9 +385,9 @@ var useCommonChatAPI = function useCommonChatAPI(props) {
379
385
  // 新增工具时,为新节点类型补充 toolName
380
386
  // agent 类类型,保持只有一个 agent
381
387
  // tool_result只是工具的结果,不能新增
382
- if (dataObj.moduleType === 'agent' && curToolList.length > 0 || dataObj.moduleType === 'tool_result') return;
388
+ if (['agent'].includes(dataObj.moduleType) && curToolList.length > 0 || dataObj.moduleType === 'tool_result') return;
383
389
  curToolList = curToolList.filter(function (tool) {
384
- return tool.moduleType !== 'agent';
390
+ return !['agent'].includes(tool.moduleType);
385
391
  });
386
392
  curToolList = [].concat(_toConsumableArray(curToolList), [_objectSpread(_objectSpread({}, dataObj), {}, {
387
393
  toolName: toolName || dataObj.toolName
@@ -18,7 +18,7 @@ declare const enUS: {
18
18
  'chatInput.flowUnsupported': string;
19
19
  'chatInput.uploadFile': string;
20
20
  'chatInput.newConversation': string;
21
- 'chatInput.deepThinkTip': string;
21
+ 'chatInput.deepThinkNotSupported': string;
22
22
  'chatInput.deepThinkModeAuto': string;
23
23
  'chatInput.fetchingVoice': string;
24
24
  'chatInput.voiceCallUnsupported': string;
@@ -62,6 +62,7 @@ declare const enUS: {
62
62
  'trace.tryFullTipsNoEntitlement': string;
63
63
  'trace.tryFull': string;
64
64
  'trace.iconAlt': string;
65
+ 'trace.traceNotOpen': string;
65
66
  'trace.countByType': string;
66
67
  'file.totalInConversation': string;
67
68
  'file.download': string;
@@ -18,7 +18,7 @@ var enUS = {
18
18
  'chatInput.flowUnsupported': 'This button is not supported in the current flow. Please wait for the current flow to finish or follow the instructions on the chat card.',
19
19
  'chatInput.uploadFile': 'Supports Word, Excel,and Images.\nUp to 10 files (max 10MB each)',
20
20
  'chatInput.newConversation': 'New conversation',
21
- 'chatInput.deepThinkTip': 'Auto-switching thinking mode',
21
+ 'chatInput.deepThinkNotSupported': 'Deep thinking is not supported for this agent',
22
22
  'chatInput.deepThinkModeAuto': 'Deep Thinking',
23
23
  'chatInput.fetchingVoice': 'Capturing Voice Input...',
24
24
  'chatInput.voiceCallUnsupported': 'Voice call is not supported in the current flow',
@@ -62,6 +62,7 @@ var enUS = {
62
62
  'trace.tryFullTipsNoEntitlement': 'No viewing rights. Please upgrade to Class A or reach out to your admin/instructor.',
63
63
  'trace.tryFull': 'View',
64
64
  'trace.iconAlt': 'Knowledge source icon',
65
+ 'trace.traceNotOpen': 'Please open in a browser',
65
66
  'trace.countByType': '{{count}} {{type}}',
66
67
  'file.totalInConversation': '{{count}} documents in this conversation',
67
68
  'file.download': 'Download',
@@ -18,7 +18,7 @@ declare const zhCN: {
18
18
  'chatInput.flowUnsupported': string;
19
19
  'chatInput.uploadFile': string;
20
20
  'chatInput.newConversation': string;
21
- 'chatInput.deepThinkTip': string;
21
+ 'chatInput.deepThinkNotSupported': string;
22
22
  'chatInput.deepThinkModeAuto': string;
23
23
  'chatInput.fetchingVoice': string;
24
24
  'chatInput.voiceCallUnsupported': string;
@@ -62,6 +62,7 @@ declare const zhCN: {
62
62
  'trace.tryFullTipsNoEntitlement': string;
63
63
  'trace.tryFull': string;
64
64
  'trace.iconAlt': string;
65
+ 'trace.traceNotOpen': string;
65
66
  'trace.countByType': string;
66
67
  'trace.unit.piece': string;
67
68
  'trace.unit.article': string;
@@ -18,7 +18,7 @@ var zhCN = {
18
18
  'chatInput.flowUnsupported': '当前流程不支持该按钮的使用,请等待正在进行的流程结束或按对话卡片指示继续流程',
19
19
  'chatInput.uploadFile': '支持Word、Excel、图片\n最多10个文件(单个不超过10M)',
20
20
  'chatInput.newConversation': '新对话',
21
- 'chatInput.deepThinkTip': '系统智能切换思考模式',
21
+ 'chatInput.deepThinkNotSupported': '当前智能体不支持深度思考',
22
22
  'chatInput.deepThinkModeAuto': '深度思考',
23
23
  'chatInput.fetchingVoice': '正在获取语音内容...',
24
24
  'chatInput.voiceCallUnsupported': '当前流程不支持语音通话',
@@ -62,6 +62,7 @@ var zhCN = {
62
62
  'trace.tryFullTipsNoEntitlement': '您的账号暂无查看权益,查看完整内容需升级A类权益账号,可联系企业管理员或课程顾问进行沟通调整。',
63
63
  'trace.tryFull': '查看',
64
64
  'trace.iconAlt': '知识库溯源图标',
65
+ 'trace.traceNotOpen': '请用浏览器打开',
65
66
  'trace.countByType': '{{count}}{{unit}}{{type}}',
66
67
  'trace.unit.piece': '个',
67
68
  'trace.unit.article': '篇',
@@ -13,6 +13,8 @@ export interface ToolItem {
13
13
  id?: string;
14
14
  /** 工具调用内容 */
15
15
  content?: string;
16
+ /** 工具调用推理内容 */
17
+ reasoningContent?: string;
16
18
  /** 工具调用数据 */
17
19
  data?: any;
18
20
  /** 确认状态