@myun/gimi-chat 0.9.65 → 0.9.66
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.
- package/dist/apis/useApi.d.ts +6 -0
- package/dist/apis/useApi.js +45 -1
- package/dist/components/ai-chat-dialogue/index copy.js +1 -1
- package/dist/components/ai-chat-dialogue/index.js +4 -2
- package/dist/components/answer-item/component/artifacts/index.d.ts +13 -0
- package/dist/components/answer-item/component/artifacts/index.js +52 -0
- package/dist/components/answer-item/component/artifacts/index.module.css +24 -0
- package/dist/components/answer-item/component/tool-list/index.d.ts +7 -0
- package/dist/components/answer-item/component/tool-list/index.js +117 -0
- package/dist/components/answer-item/component/tool-list/index.module.css +97 -0
- package/dist/components/answer-item/index.d.ts +2 -1
- package/dist/components/answer-item/index.js +179 -8
- package/dist/components/answer-item/index.module.css +35 -0
- package/dist/components/ask-card/index.d.ts +1 -1
- package/dist/components/chat-input/extension/index.d.ts +1 -0
- package/dist/components/chat-input/extension/index.js +2 -1
- package/dist/components/chat-input/extension/skill/MentionList.d.ts +31 -0
- package/dist/components/chat-input/extension/skill/MentionList.js +199 -0
- package/dist/components/chat-input/extension/skill/ReferSlot.d.ts +3 -0
- package/dist/components/chat-input/extension/skill/ReferSlot.js +100 -0
- package/dist/components/chat-input/extension/skill/data.d.ts +10 -0
- package/dist/components/chat-input/extension/skill/data.js +49 -0
- package/dist/components/chat-input/extension/skill/index.d.ts +7 -0
- package/dist/components/chat-input/extension/skill/index.js +5 -0
- package/dist/components/chat-input/extension/skill/index.less +117 -0
- package/dist/components/chat-input/extension/skill/suggestion.d.ts +16 -0
- package/dist/components/chat-input/extension/skill/suggestion.js +206 -0
- package/dist/components/chat-input/index.js +145 -24
- package/dist/components/chat-input/index.module.css +6 -0
- package/dist/components/file-card/index.js +2 -1
- package/dist/components/file-card/index.module.css +1 -0
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +6 -1
- package/dist/components/knowledge-trace/tryWatch.js +2 -2
- package/dist/components/message-list/index.js +15 -3
- package/dist/components/message-list/index.module.css +3 -0
- package/dist/components/message-list/skill-tag/index.d.ts +5 -0
- package/dist/components/message-list/skill-tag/index.js +23 -0
- package/dist/components/message-list/skill-tag/index.module.css +22 -0
- package/dist/components/templates/CommonChat.js +3 -1
- package/dist/hooks/useChatActions.d.ts +2 -1
- package/dist/hooks/useChatActions.js +52 -12
- package/dist/hooks/useChatStream.d.ts +6 -1
- package/dist/hooks/useChatStream.js +97 -5
- package/dist/hooks/useCommonChatAPI.d.ts +1 -1
- package/dist/hooks/useCommonChatAPI.js +212 -58
- package/dist/i18n/locales/en-US.d.ts +7 -0
- package/dist/i18n/locales/en-US.js +8 -1
- package/dist/i18n/locales/zh-CN.d.ts +7 -0
- package/dist/i18n/locales/zh-CN.js +8 -1
- package/dist/interfaces/chatMessage.d.ts +40 -0
- package/dist/umd/index.min.js +1 -1
- package/dist/utils/tools.d.ts +7 -0
- package/dist/utils/tools.js +38 -1
- package/package.json +4 -2
package/dist/apis/useApi.d.ts
CHANGED
|
@@ -86,6 +86,12 @@ export interface IUseApi {
|
|
|
86
86
|
getDocumentTrialUrl: (params: {
|
|
87
87
|
resourceUrl: string;
|
|
88
88
|
}) => Promise<FetchResponse<IDocumentTrialResult>>;
|
|
89
|
+
getAgentSkillList: (agentId: number) => Promise<FetchResponse<any>>;
|
|
90
|
+
getAgentToolList: (params: {
|
|
91
|
+
conversationId: string;
|
|
92
|
+
chatId: string;
|
|
93
|
+
pageSize: number;
|
|
94
|
+
}) => Promise<FetchResponse<any>>;
|
|
89
95
|
}
|
|
90
96
|
declare const useApi: (baseUrl: string, authToken: string, locale?: string) => IUseApi;
|
|
91
97
|
export default useApi;
|
package/dist/apis/useApi.js
CHANGED
|
@@ -553,6 +553,48 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
553
553
|
return _ref28.apply(this, arguments);
|
|
554
554
|
};
|
|
555
555
|
}();
|
|
556
|
+
|
|
557
|
+
// 获取当前智能体技能
|
|
558
|
+
var getAgentSkillList = /*#__PURE__*/function () {
|
|
559
|
+
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(agentId) {
|
|
560
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
561
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
562
|
+
case 0:
|
|
563
|
+
return _context28.abrupt("return", fetchService.get('/mcourse/web/agent/tool/list', {
|
|
564
|
+
params: {
|
|
565
|
+
agentId: agentId
|
|
566
|
+
}
|
|
567
|
+
}));
|
|
568
|
+
case 1:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context28.stop();
|
|
571
|
+
}
|
|
572
|
+
}, _callee28);
|
|
573
|
+
}));
|
|
574
|
+
return function getAgentSkillList(_x27) {
|
|
575
|
+
return _ref29.apply(this, arguments);
|
|
576
|
+
};
|
|
577
|
+
}();
|
|
578
|
+
|
|
579
|
+
// 获取当前对话的工具调用
|
|
580
|
+
var getAgentToolList = /*#__PURE__*/function () {
|
|
581
|
+
var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(params) {
|
|
582
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
583
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
584
|
+
case 0:
|
|
585
|
+
return _context29.abrupt("return", fetchService.get('/mbot/web/agent-message/event/timeline', {
|
|
586
|
+
params: params
|
|
587
|
+
}));
|
|
588
|
+
case 1:
|
|
589
|
+
case "end":
|
|
590
|
+
return _context29.stop();
|
|
591
|
+
}
|
|
592
|
+
}, _callee29);
|
|
593
|
+
}));
|
|
594
|
+
return function getAgentToolList(_x28) {
|
|
595
|
+
return _ref30.apply(this, arguments);
|
|
596
|
+
};
|
|
597
|
+
}();
|
|
556
598
|
return {
|
|
557
599
|
getSkillData: getSkillData,
|
|
558
600
|
getProductList: getProductList,
|
|
@@ -581,7 +623,9 @@ var useApi = function useApi(baseUrl, authToken) {
|
|
|
581
623
|
checkProductType: checkProductType,
|
|
582
624
|
getBusinessAgent: getBusinessAgent,
|
|
583
625
|
getVideoType: getVideoType,
|
|
584
|
-
getDocumentTrialUrl: getDocumentTrialUrl
|
|
626
|
+
getDocumentTrialUrl: getDocumentTrialUrl,
|
|
627
|
+
getAgentSkillList: getAgentSkillList,
|
|
628
|
+
getAgentToolList: getAgentToolList
|
|
585
629
|
};
|
|
586
630
|
};
|
|
587
631
|
export default useApi;
|
|
@@ -494,7 +494,7 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
494
494
|
setIsTextLoading(false);
|
|
495
495
|
}
|
|
496
496
|
// 卡片和问答直接关闭
|
|
497
|
-
if (textData.moduleType === 'skill' || textData.moduleType === 'ask') {
|
|
497
|
+
if (textData.moduleType === 'skill' || textData.moduleType === 'ask' || textData.moduleType === 'user_confirm') {
|
|
498
498
|
// 关闭loading
|
|
499
499
|
setIsTextLoading(false);
|
|
500
500
|
}
|
|
@@ -488,16 +488,18 @@ var AiExplain = function AiExplain(_ref) {
|
|
|
488
488
|
}
|
|
489
489
|
if (text.includes('moduleType')) {
|
|
490
490
|
var textData = splitTextAndModuleTypeJson(text).json || {};
|
|
491
|
+
console.log('textData', textData);
|
|
492
|
+
|
|
491
493
|
// 标准通话模式文字回显结束停止文字加载
|
|
492
494
|
if (textData.moduleType === 'end' && textData.conversationStatus && textData.conversationStatus === 'stop') {
|
|
493
495
|
setIsTextLoading(false);
|
|
494
496
|
}
|
|
495
497
|
// 卡片和问答直接关闭
|
|
496
|
-
if (textData.moduleType === 'skill' || textData.moduleType === 'ask') {
|
|
498
|
+
if (textData.moduleType === 'skill' || textData.moduleType === 'ask' || textData.moduleType === 'user_confirm') {
|
|
497
499
|
// 关闭loading
|
|
498
500
|
setIsTextLoading(false);
|
|
499
501
|
}
|
|
500
|
-
if (textData.answerType === 1 || textData.moduleType === 'skill') {
|
|
502
|
+
if (textData.answerType === 1 || textData.moduleType === 'skill' || textData.moduleType === 'user_confirm') {
|
|
501
503
|
var _clientRef$current2, _clientRef$current2$m;
|
|
502
504
|
// 静音点击置灰
|
|
503
505
|
setIsDisable(true);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Artifact {
|
|
3
|
+
artifactId: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
relativePath: string;
|
|
6
|
+
contentType: string;
|
|
7
|
+
fileSize: number;
|
|
8
|
+
fileAddr: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Artifacts: ({ artifacts }: {
|
|
11
|
+
artifacts: Artifact[];
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
export default Artifacts;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState } from 'react';
|
|
8
|
+
import { FileCard } from "../../../file-card";
|
|
9
|
+
import IconFont from "../../../iconfont-com";
|
|
10
|
+
import styles from "./index.module.css";
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
var formatFileSize = function formatFileSize(size) {
|
|
13
|
+
if (size <= 0) return '0B';
|
|
14
|
+
var units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
15
|
+
var i = Math.floor(Math.log(size) / Math.log(1024));
|
|
16
|
+
var value = size / Math.pow(1024, i);
|
|
17
|
+
return "".concat(parseFloat(value.toFixed(1))).concat(units[i]);
|
|
18
|
+
};
|
|
19
|
+
var Artifacts = function Artifacts(_ref) {
|
|
20
|
+
var artifacts = _ref.artifacts;
|
|
21
|
+
var _useState = useState(false),
|
|
22
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
+
showContent = _useState2[0],
|
|
24
|
+
setShowContent = _useState2[1];
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: classNames(styles.main, showContent && styles.show)
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: styles.toolItemLabel,
|
|
29
|
+
onClick: function onClick() {
|
|
30
|
+
return setShowContent(!showContent);
|
|
31
|
+
}
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: styles.toolName
|
|
34
|
+
}, "\u67E5\u770B\u6240\u6709\u4EA7\u7269"), /*#__PURE__*/React.createElement(IconFont, {
|
|
35
|
+
className: styles.icon,
|
|
36
|
+
type: showContent ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
|
|
37
|
+
size: 14
|
|
38
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: styles.list
|
|
40
|
+
}, artifacts.map(function (item) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(FileCard, {
|
|
42
|
+
fileName: item.fileName,
|
|
43
|
+
downloadUrl: item.fileAddr,
|
|
44
|
+
size: formatFileSize(item.fileSize),
|
|
45
|
+
fileType: item.fileName.split('.').pop() || '',
|
|
46
|
+
model: "sidebar",
|
|
47
|
+
disablePreview: true,
|
|
48
|
+
key: item.artifactId
|
|
49
|
+
});
|
|
50
|
+
})));
|
|
51
|
+
};
|
|
52
|
+
export default Artifacts;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.main .toolItemLabel {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
margin-bottom: 8px;
|
|
7
|
+
}
|
|
8
|
+
.main .toolItemLabel:hover .icon {
|
|
9
|
+
color: var(--theme-neutral, #626262) !important;
|
|
10
|
+
}
|
|
11
|
+
.main .toolItemLabel:hover .toolName {
|
|
12
|
+
color: var(--theme-neutral, #626262);
|
|
13
|
+
}
|
|
14
|
+
.main .toolItemLabel .icon, .main .toolItemLabel .toolName {
|
|
15
|
+
color: var(--theme-mediumNeutral, #B3B2B2);
|
|
16
|
+
}
|
|
17
|
+
.main.show .list {
|
|
18
|
+
display: flex;
|
|
19
|
+
}
|
|
20
|
+
.main .list {
|
|
21
|
+
display: none;
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
gap: 10px;
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToolItem } from "../../../../interfaces/chatMessage";
|
|
3
|
+
declare const ToolList: ({ toolList, handleClickConfirm }: {
|
|
4
|
+
toolList: ToolItem[];
|
|
5
|
+
handleClickConfirm: (item: any, confirmed: boolean) => void;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default ToolList;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
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; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
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); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
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."); }
|
|
7
|
+
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); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useMemo, useState } from "react";
|
|
12
|
+
import { MMarkdown } from '@myun/gimi-design';
|
|
13
|
+
import IconFont from "../../../iconfont-com";
|
|
14
|
+
import styles from "./index.module.css";
|
|
15
|
+
import classNames from "classnames";
|
|
16
|
+
var ToolItemCom = function ToolItemCom(_ref) {
|
|
17
|
+
var item = _ref.item;
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
showContent = _useState2[0],
|
|
21
|
+
setShowContent = _useState2[1];
|
|
22
|
+
var content = useMemo(function () {
|
|
23
|
+
// item.content 可能是:普通文本 / 单层 JSON / 双层 JSON 字符串
|
|
24
|
+
// 逐层 parse,直到结果不是字符串或 parse 失败为止
|
|
25
|
+
var result = item.content || '';
|
|
26
|
+
for (var depth = 0; depth < 2 && typeof result === 'string'; depth++) {
|
|
27
|
+
try {
|
|
28
|
+
result = JSON.parse(result);
|
|
29
|
+
} catch (_unused) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// parse 到底是字符串直接用;如果是对象,取里面的文本字段渲染
|
|
34
|
+
if (typeof result === 'string') return result;
|
|
35
|
+
if (result && typeof result.content === 'string') return result.content;
|
|
36
|
+
// 兜底:对象序列化
|
|
37
|
+
return JSON.stringify(result, null, 2);
|
|
38
|
+
}, [item.content]);
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: styles.toolItem
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: styles.toolItemLabel,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return item.content && setShowContent(!showContent);
|
|
45
|
+
}
|
|
46
|
+
}, item.status === "COMPLETED" && /*#__PURE__*/React.createElement("img", {
|
|
47
|
+
className: styles.toolIcon,
|
|
48
|
+
src: "https://simg01.gaodunwangxiao.com/uploadfiles/tmp/upload/202609/07/e5347_20260907085700.png"
|
|
49
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: classNames(styles.toolName, _defineProperty({}, styles.running, item.status === "RUNNING" || item.status === "STARTED"))
|
|
51
|
+
}, item.toolName), item.status === "COMPLETED" && item.content && /*#__PURE__*/React.createElement(IconFont, {
|
|
52
|
+
className: classNames(styles.icon, _defineProperty({}, styles.hasContent, showContent)),
|
|
53
|
+
type: showContent ? "icon-a-jiantoucu2x-copy1" : "icon-a-jiantoucu2x",
|
|
54
|
+
size: 12,
|
|
55
|
+
extraStyle: {
|
|
56
|
+
color: !showContent ? "var(--theme-neutral, #626262)" : "var(--theme-mediumNeutral, #B3B2B2)"
|
|
57
|
+
}
|
|
58
|
+
})), item.content && showContent && /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: styles.toolItemContent
|
|
60
|
+
}, /*#__PURE__*/React.createElement(MMarkdown, {
|
|
61
|
+
content: content
|
|
62
|
+
})));
|
|
63
|
+
};
|
|
64
|
+
var ConfirmToolItem = function ConfirmToolItem(_ref2) {
|
|
65
|
+
var _item$data;
|
|
66
|
+
var item = _ref2.item,
|
|
67
|
+
handleClickConfirm = _ref2.handleClickConfirm;
|
|
68
|
+
var confirmTextMap = {
|
|
69
|
+
PENDING: "等待人工确认",
|
|
70
|
+
CONFIRMED: "用户已同意",
|
|
71
|
+
REJECTED: "用户已拒绝",
|
|
72
|
+
PARTIAL: "用户已同意部分"
|
|
73
|
+
};
|
|
74
|
+
var handleConfirmResult = function handleConfirmResult(confirmed) {
|
|
75
|
+
handleClickConfirm(item, confirmed);
|
|
76
|
+
};
|
|
77
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: styles.toolItem
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: styles.toolItemLabel
|
|
81
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: classNames(styles.toolName, _defineProperty({}, styles.running, item.status === "RUNNING" || item.status === "STARTED"))
|
|
83
|
+
}, confirmTextMap[item.confirmStatus || "PENDING"])), item.confirmStatus === "PENDING" && /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: styles.confirmContent
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
+
className: styles.confirmDesc
|
|
87
|
+
}, ((_item$data = item.data) === null || _item$data === void 0 ? void 0 : _item$data.message) || ''), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: styles.confirmActions
|
|
89
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: styles.confirmBtn,
|
|
91
|
+
onClick: function onClick() {
|
|
92
|
+
return handleConfirmResult(true);
|
|
93
|
+
}
|
|
94
|
+
}, "\u5141\u8BB8\u4E00\u6B21"), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: styles.confirmBtn,
|
|
96
|
+
onClick: function onClick() {
|
|
97
|
+
return handleConfirmResult(false);
|
|
98
|
+
}
|
|
99
|
+
}, "\u62D2\u7EDD"))));
|
|
100
|
+
};
|
|
101
|
+
var ToolList = function ToolList(_ref3) {
|
|
102
|
+
var toolList = _ref3.toolList,
|
|
103
|
+
handleClickConfirm = _ref3.handleClickConfirm;
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: styles.toolList
|
|
106
|
+
}, toolList.map(function (item) {
|
|
107
|
+
return item.moduleType === "user_confirm" ? /*#__PURE__*/React.createElement(ConfirmToolItem, {
|
|
108
|
+
key: item.id,
|
|
109
|
+
item: item,
|
|
110
|
+
handleClickConfirm: handleClickConfirm
|
|
111
|
+
}) : /*#__PURE__*/React.createElement(ToolItemCom, {
|
|
112
|
+
key: item.id,
|
|
113
|
+
item: item
|
|
114
|
+
});
|
|
115
|
+
}));
|
|
116
|
+
};
|
|
117
|
+
export default ToolList;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
.toolItem .toolItemLabel {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
margin-bottom: 8px;
|
|
7
|
+
}
|
|
8
|
+
.toolItem .toolItemLabel:hover .icon {
|
|
9
|
+
display: block;
|
|
10
|
+
color: var(--theme-neutral, #626262) !important;
|
|
11
|
+
}
|
|
12
|
+
.toolItem .toolItemLabel:hover .toolName {
|
|
13
|
+
color: var(--theme-neutral, #626262);
|
|
14
|
+
}
|
|
15
|
+
.toolItem .toolItemLabel .toolIcon {
|
|
16
|
+
width: 12px;
|
|
17
|
+
height: 12px;
|
|
18
|
+
margin-right: 4px;
|
|
19
|
+
}
|
|
20
|
+
.toolItem .toolItemLabel .toolName {
|
|
21
|
+
color: var(--theme-dustyNeutral, #878786);
|
|
22
|
+
font-size: 13px;
|
|
23
|
+
}
|
|
24
|
+
.toolItem .toolItemLabel .toolName.running {
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
.toolItem .toolItemLabel .toolName.running::after {
|
|
28
|
+
content: "";
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 0;
|
|
31
|
+
left: -150%;
|
|
32
|
+
width: 100%;
|
|
33
|
+
height: 20px;
|
|
34
|
+
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
|
|
35
|
+
transform: skewX(-25deg);
|
|
36
|
+
animation: shine 2s infinite;
|
|
37
|
+
}
|
|
38
|
+
.toolItem .toolItemLabel .icon {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
.toolItem .toolItemLabel .icon.hasContent {
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
.toolItem .toolItemContent {
|
|
45
|
+
max-height: 188px;
|
|
46
|
+
padding: 0 24px 0 16px;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
border-radius: 16px;
|
|
49
|
+
border: 1px solid var(--theme-lightNeutral, #EDEDEB);
|
|
50
|
+
background: #FCFCFC;
|
|
51
|
+
}
|
|
52
|
+
.toolItem .confirmContent {
|
|
53
|
+
width: clamp(360px, 90%, 600px);
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
padding: 20px;
|
|
56
|
+
border-radius: 16px;
|
|
57
|
+
border: 1px solid var(--theme-lightNeutral, #E9EBF2);
|
|
58
|
+
background-color: var(--theme-subtleNeutral, #F7F7F7);
|
|
59
|
+
margin-top: 12px;
|
|
60
|
+
}
|
|
61
|
+
.toolItem .confirmContent .confirmDesc {
|
|
62
|
+
color: var(--theme-neutral, #626262);
|
|
63
|
+
font-size: 13px;
|
|
64
|
+
line-height: 1.4;
|
|
65
|
+
margin-bottom: 16px;
|
|
66
|
+
}
|
|
67
|
+
.toolItem .confirmContent .confirmActions {
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
gap: 16px;
|
|
71
|
+
}
|
|
72
|
+
.toolItem .confirmContent .confirmBtn {
|
|
73
|
+
height: 44px;
|
|
74
|
+
border-radius: 22px;
|
|
75
|
+
border: 1px solid #E3E3E1;
|
|
76
|
+
background: #FFFFFF;
|
|
77
|
+
color: #221813;
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
transition: opacity 0.2s;
|
|
85
|
+
}
|
|
86
|
+
.toolItem .confirmContent .confirmBtn:hover {
|
|
87
|
+
opacity: 0.85;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes shine {
|
|
91
|
+
0% {
|
|
92
|
+
left: -60%;
|
|
93
|
+
}
|
|
94
|
+
100% {
|
|
95
|
+
left: 80%;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -9,7 +9,8 @@ interface AnswerItemProps {
|
|
|
9
9
|
showOpera?: (id: number) => boolean;
|
|
10
10
|
handleShowCourse: (v: any) => void;
|
|
11
11
|
handleClickPromptWord?: (prompt: string) => void;
|
|
12
|
-
handleClickAskList: (item: any, operation: string, key: string, value?: string) => void;
|
|
12
|
+
handleClickAskList: (item: any, operation: string, key: string, value?: string, inputModel?: any) => void;
|
|
13
|
+
handleClickConfirm: (item: any, confirmed: boolean) => void;
|
|
13
14
|
playTTSByText: (text: string) => void;
|
|
14
15
|
stopTTSByText: () => void;
|
|
15
16
|
isVoicePlaying: boolean;
|