@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.
@@ -7,13 +7,17 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
11
+ 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); } }
12
+ 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); }); }; }
10
13
  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; }
11
14
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
15
  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); }
13
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
16
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
14
17
  import classNames from 'classnames';
15
18
  import styles from "./index.module.css";
16
- import { Spin } from '@douyinfe/semi-ui';
19
+ import { Spin, Toast } from '@douyinfe/semi-ui';
20
+ import { useTranslation } from 'react-i18next';
17
21
  import { References } from "../reference-content";
18
22
  import { replaceBraces } from "../../utils/tools";
19
23
  import UploadList from "../upload-list";
@@ -26,6 +30,7 @@ import CopyButton from "../message-actions/CopyButton";
26
30
  import { Virtuoso } from 'react-virtuoso';
27
31
  import { MMarkdown } from '@myun/gimi-design';
28
32
  import SkillTag from "./skill-tag";
33
+ import ChatContext from "../templates/chatContext";
29
34
  var MessageItem = /*#__PURE__*/React.memo(function (props) {
30
35
  var _v$quoteTeachModelLis, _v$quoteProductList, _v$messageFilesList;
31
36
  var v = props.v,
@@ -166,6 +171,125 @@ var MessageList = function MessageList(_ref) {
166
171
  var _useGimiFileUpload = useGimiFileUpload(),
167
172
  handleSSEFileAnalyize = _useGimiFileUpload.handleSSEFileAnalyize,
168
173
  fileUpload = _useGimiFileUpload.fileUpload;
174
+ var _useTranslation = useTranslation(),
175
+ t = _useTranslation.t;
176
+ var _useContext = useContext(ChatContext),
177
+ apiService = _useContext.apiService;
178
+
179
+ // 需要校验有效性的文件域名
180
+ var FILE_VALIDATE_DOMAINS = useMemo(function () {
181
+ return ['mstatic.gaodunwangxiao.com', 'gd-mcloud.oss-cn-hangzhou.aliyuncs.com'];
182
+ }, []);
183
+
184
+ // 校验文件链接是否有效,失效返回 false
185
+ var validateFileLink = useCallback( /*#__PURE__*/function () {
186
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
187
+ var _res$result, urlObj, fileKey, res;
188
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
189
+ while (1) switch (_context.prev = _context.next) {
190
+ case 0:
191
+ _context.prev = 0;
192
+ urlObj = new URL(url); // pathname 会把中文百分号编码,后端期望中文原文,需 decode 还原
193
+ fileKey = decodeURIComponent(urlObj.pathname.replace(/^\//, ''));
194
+ if (fileKey) {
195
+ _context.next = 5;
196
+ break;
197
+ }
198
+ return _context.abrupt("return", true);
199
+ case 5:
200
+ _context.next = 7;
201
+ return apiService === null || apiService === void 0 ? void 0 : apiService.checkFileExist(fileKey);
202
+ case 7:
203
+ res = _context.sent;
204
+ return _context.abrupt("return", (res === null || res === void 0 ? void 0 : res.status) === 0 && (res === null || res === void 0 || (_res$result = res.result) === null || _res$result === void 0 ? void 0 : _res$result.fileExist) === 1);
205
+ case 11:
206
+ _context.prev = 11;
207
+ _context.t0 = _context["catch"](0);
208
+ console.error('校验文件链接失败:', _context.t0);
209
+ // 校验接口异常时不阻断,允许访问
210
+ return _context.abrupt("return", true);
211
+ case 15:
212
+ case "end":
213
+ return _context.stop();
214
+ }
215
+ }, _callee, null, [[0, 11]]);
216
+ }));
217
+ return function (_x) {
218
+ return _ref2.apply(this, arguments);
219
+ };
220
+ }(), [apiService]);
221
+
222
+ // 监听 markdown 内 a 标签点击,对指定域名链接做有效性校验
223
+ useEffect(function () {
224
+ var container = containerRef.current;
225
+ if (!container) return;
226
+ var handleClick = /*#__PURE__*/function () {
227
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
228
+ var target, link, href, hostname, needValidate, isValid;
229
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
230
+ while (1) switch (_context2.prev = _context2.next) {
231
+ case 0:
232
+ target = event.target;
233
+ link = target.closest('a');
234
+ if (link) {
235
+ _context2.next = 4;
236
+ break;
237
+ }
238
+ return _context2.abrupt("return");
239
+ case 4:
240
+ href = link.href;
241
+ if (href) {
242
+ _context2.next = 7;
243
+ break;
244
+ }
245
+ return _context2.abrupt("return");
246
+ case 7:
247
+ // 判断是否为需要校验的域名
248
+ hostname = '';
249
+ _context2.prev = 8;
250
+ hostname = new URL(href).hostname;
251
+ _context2.next = 15;
252
+ break;
253
+ case 12:
254
+ _context2.prev = 12;
255
+ _context2.t0 = _context2["catch"](8);
256
+ return _context2.abrupt("return");
257
+ case 15:
258
+ needValidate = FILE_VALIDATE_DOMAINS.some(function (domain) {
259
+ return hostname === domain || hostname.endsWith('.' + domain);
260
+ });
261
+ if (needValidate) {
262
+ _context2.next = 18;
263
+ break;
264
+ }
265
+ return _context2.abrupt("return");
266
+ case 18:
267
+ // 先阻止默认跳转,异步校验通过后再手动打开
268
+ event.preventDefault();
269
+ _context2.next = 21;
270
+ return validateFileLink(href);
271
+ case 21:
272
+ isValid = _context2.sent;
273
+ if (isValid) {
274
+ window.open(href, '_blank', 'noopener,noreferrer');
275
+ } else {
276
+ Toast.warning(t('chatApi.linkUnavailable'));
277
+ }
278
+ case 23:
279
+ case "end":
280
+ return _context2.stop();
281
+ }
282
+ }, _callee2, null, [[8, 12]]);
283
+ }));
284
+ return function handleClick(_x2) {
285
+ return _ref3.apply(this, arguments);
286
+ };
287
+ }();
288
+ container.addEventListener('click', handleClick);
289
+ return function () {
290
+ container.removeEventListener('click', handleClick);
291
+ };
292
+ }, [containerRef, FILE_VALIDATE_DOMAINS, validateFileLink, t]);
169
293
  var handleReTry = React.useCallback(function (file) {
170
294
  if (file.status === FileStatus.ANALYSE_FAILED) {
171
295
  handleSSEFileAnalyize(file);
@@ -17,12 +17,7 @@ import { setIsMsgRecieving } from "../store/slices/gimiMenuSlice";
17
17
  import { getTimeZone } from "../utils/tools";
18
18
 
19
19
  // 需要展示为工具调用的模块类型
20
- export var TOOL_MODULE_TYPES = ['tool_invocation', 'tool_result', "thinking"
21
- // 'start', 'llm', 'knowledge', 'video', 'image-text',
22
- // 'input', 'if-select', 'intent', 'talk', 'text',
23
- // 'video-caption', 'summary', 'loop', 'skillBase',
24
- // 'break', 'http', 'esKnowledge', 'mcp'
25
- ];
20
+ export var TOOL_MODULE_TYPES = ['tool_invocation', 'tool_result', "thinking", 'start', 'llm', 'knowledge', 'video', 'image-text', 'input', 'if-select', 'intent', 'talk', 'text', 'video-caption', 'summary', 'loop', 'skillBase', 'break', 'http', 'esKnowledge', 'mcp'];
26
21
 
27
22
  // 所有需要进入处理流程的模块类型(包括工具类型 + 特殊处理类型)
28
23
  var PROCESSABLE_MODULE_TYPES = [].concat(TOOL_MODULE_TYPES, ['end', 'ask', 'skill', 'tool_call', 'artifact', 'user_confirm', 'COMPLETED']);
@@ -45,32 +40,105 @@ export var MODULE_TYPE_NAMES = {
45
40
  'summary': '章节总结节点',
46
41
  'loop': '循环节点',
47
42
  'skill': '技能节点',
48
- 'skillBase': '通用技能节点',
43
+ 'skillBase': '技能',
49
44
  'break': '终止循环节点',
50
45
  'http': 'HTTP节点',
51
46
  'esKnowledge': '知识库节点',
52
47
  'mcp': 'MCP节点'
53
48
  };
54
49
 
50
+ // 节点状态文案配置(每个节点可自定义各状态文案)
51
+ var NODE_STATUS_TEXTS = {
52
+ 'start': {
53
+ 'STARTED': '开始理解问题',
54
+ 'RUNNING': '正在理解问题',
55
+ 'COMPLETED': '已完成理解问题'
56
+ },
57
+ 'thinking': {
58
+ 'STARTED': '开始分析问题',
59
+ 'RUNNING': '正在分析问题',
60
+ 'COMPLETED': '已完成分析'
61
+ },
62
+ 'knowledge': {
63
+ 'STARTED': '开始调用知识库检索',
64
+ 'RUNNING': '正在调用知识库检索',
65
+ 'COMPLETED': '已调用知识库检索'
66
+ },
67
+ "esKnowledge": {
68
+ 'STARTED': '开始调用知识库检索',
69
+ 'RUNNING': '正在调用知识库检索',
70
+ 'COMPLETED': '已调用知识库检索'
71
+ },
72
+ "mcp": {
73
+ 'STARTED': '开始调用技能',
74
+ 'RUNNING': '正在调用技能',
75
+ 'COMPLETED': '已调用技能'
76
+ },
77
+ "skillBase": {
78
+ 'STARTED': '开始调用技能',
79
+ 'RUNNING': '正在调用技能',
80
+ 'COMPLETED': '已调用技能'
81
+ },
82
+ "http": {
83
+ 'STARTED': '开始调用处理数据',
84
+ 'RUNNING': '正在调用处理数据',
85
+ 'COMPLETED': '已调用处理数据'
86
+ },
87
+ "loop": {
88
+ 'STARTED': '开始处理任务',
89
+ 'RUNNING': '正在处理任务',
90
+ 'COMPLETED': '已处理任务'
91
+ },
92
+ "intent": {
93
+ 'STARTED': '开始规划下一步处理方式',
94
+ 'RUNNING': '正在规划下一步处理方式',
95
+ 'COMPLETED': '已规划下一步处理方式'
96
+ },
97
+ "video": {
98
+ 'STARTED': '开始处理任务',
99
+ 'RUNNING': '正在处理任务',
100
+ 'COMPLETED': '已处理任务'
101
+ },
102
+ "talk": {
103
+ 'STARTED': '开始处理任务',
104
+ 'RUNNING': '正在处理任务',
105
+ 'COMPLETED': '已处理任务'
106
+ },
107
+ "image-text": {
108
+ 'STARTED': '开始处理任务',
109
+ 'RUNNING': '正在处理任务',
110
+ 'COMPLETED': '已处理任务'
111
+ },
112
+ "text": {
113
+ 'STARTED': '开始调用处理数据',
114
+ 'RUNNING': '正在调用处理数据',
115
+ 'COMPLETED': '已调用处理数据'
116
+ },
117
+ "llm": {
118
+ 'STARTED': '开始分析问题',
119
+ 'RUNNING': '正在分析问题',
120
+ 'COMPLETED': '已完成分析'
121
+ }
122
+
123
+ // 其他节点可继续添加自定义文案
124
+ };
125
+
55
126
  // 根据 moduleType 和 status 生成 toolName
56
127
  export var getToolNameByStatus = function getToolNameByStatus(moduleType, status) {
57
- // thinking 类型定制文案
58
- if (moduleType === 'thinking') {
59
- if (status === 'STARTED') {
60
- return '开始分析问题';
61
- } else if (status === 'RUNNING') {
62
- return '正在分析问题';
63
- } else if (status === 'COMPLETED') {
64
- return '已完成分析';
65
- }
66
- return '深度思考';
67
- }
68
128
  var baseName = MODULE_TYPE_NAMES[moduleType] || moduleType;
129
+
130
+ // 如果没有状态,返回基础名
69
131
  if (!status) {
70
132
  return baseName;
71
133
  }
72
134
 
73
- // 根据状态生成描述
135
+ // 优先查找节点特定配置
136
+ var nodeTexts = NODE_STATUS_TEXTS[moduleType];
137
+ if (nodeTexts !== null && nodeTexts !== void 0 && nodeTexts[status]) {
138
+ return nodeTexts[status];
139
+ }
140
+
141
+ // 降级到通用模板
74
142
  if (status === 'STARTED') {
75
143
  return "\u5F00\u59CB\u8FD0\u884C".concat(baseName);
76
144
  } else if (status === 'COMPLETED') {
@@ -231,7 +299,6 @@ export var useChatStream = function useChatStream(platform) {
231
299
 
232
300
  // 工具调用
233
301
  if (TOOL_MODULE_TYPES.includes(_dataObj.moduleType) && !["execute", "notifyWorkflowStart"].includes(_dataObj.name)) {
234
- // console.log('dataObj',dataObj);
235
302
  onToolStream === null || onToolStream === void 0 || onToolStream(_dataObj);
236
303
  }
237
304
  // 生成产物
@@ -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;
@@ -171,6 +172,7 @@ declare const enUS: {
171
172
  'chatApi.completed': string;
172
173
  'chatApi.organizingAnswer': string;
173
174
  'chatApi.waitingForConfirmation': string;
175
+ 'chatApi.linkUnavailable': string;
174
176
  'messageAction.copy': string;
175
177
  'messageAction.likeDone': string;
176
178
  'messageAction.like': 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',
@@ -171,6 +172,7 @@ var enUS = {
171
172
  'chatApi.completed': 'Completed',
172
173
  'chatApi.organizingAnswer': 'Organizing answer',
173
174
  'chatApi.waitingForConfirmation': 'Waiting for confirmation',
175
+ 'chatApi.linkUnavailable': 'This link is temporarily unavailable',
174
176
  'messageAction.copy': 'Copy',
175
177
  'messageAction.likeDone': 'Liked',
176
178
  'messageAction.like': 'Like',
@@ -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;
@@ -173,6 +174,7 @@ declare const zhCN: {
173
174
  'chatApi.completed': string;
174
175
  'chatApi.organizingAnswer': string;
175
176
  'chatApi.waitingForConfirmation': string;
177
+ 'chatApi.linkUnavailable': string;
176
178
  'messageAction.copy': string;
177
179
  'messageAction.likeDone': string;
178
180
  'messageAction.like': 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': '篇',
@@ -173,6 +174,7 @@ var zhCN = {
173
174
  'chatApi.completed': '已完成',
174
175
  'chatApi.organizingAnswer': '正在整理答案',
175
176
  'chatApi.waitingForConfirmation': '等待人工确认',
177
+ 'chatApi.linkUnavailable': '该链接暂时无法访问',
176
178
  'messageAction.copy': '复制',
177
179
  'messageAction.likeDone': '已点赞',
178
180
  'messageAction.like': '点赞',
@@ -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
  /** 确认状态
@@ -13,7 +13,7 @@ export interface SidebarState {
13
13
  searchCourseList: ICourseItem[];
14
14
  }
15
15
  export interface GimiMenuState {
16
- platform: 'myun' | 'preview' | 'damai';
16
+ platform: 'myun' | 'preview' | 'damai' | 'qiwei';
17
17
  token: string;
18
18
  baseUrl: string;
19
19
  conversationId: number | null;
@@ -82,7 +82,7 @@ export declare const setAgentDetail: import("@reduxjs/toolkit").ActionCreatorWit
82
82
  }, "gimiMenu/setBaseUrl">, setToken: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
83
83
  token: string;
84
84
  }, "gimiMenu/setToken">, setPlatform: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
85
- platform: 'myun' | 'preview' | 'damai';
85
+ platform: 'myun' | 'preview' | 'damai' | 'qiwei';
86
86
  }, "gimiMenu/setPlatform">, updateState: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<GimiMenuState>, "gimiMenu/updateState">, setMessageList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
87
87
  messageList: IChatMessageItem[];
88
88
  }, "gimiMenu/setMessageList">, setFileList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -130,7 +130,7 @@ export interface CommonChatProps {
130
130
  duration: number;
131
131
  };
132
132
  chatInputConfig?: IAIInputProps;
133
- platform?: 'myun' | 'preview' | 'damai';
133
+ platform?: 'myun' | 'preview' | 'damai' | 'qiwei';
134
134
  businessType: 'correction' | 'chat';
135
135
  businessParams?: Record<string, any>;
136
136
  defaultMessages?: IChatMessageItem[];