@myun/gimi-chat 0.0.4 → 0.0.6
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/components/ai-chat-dialogue/index.js +182 -136
- package/dist/components/ai-chat-dialogue/index.module.css +230 -0
- package/dist/components/ai-correction/index.js +38 -25
- package/dist/components/ai-loading/index.js +13 -9
- package/dist/components/ai-loading/index.module.css +11 -0
- package/dist/components/answer-item/index.js +136 -114
- package/dist/components/answer-item/index.module.css +266 -0
- package/dist/components/ask-card/index.js +43 -34
- package/dist/components/ask-card/index.module.css +122 -0
- package/dist/components/chat-input/index.js +136 -115
- package/dist/components/chat-input/index.module.css +42 -0
- package/dist/components/chat-voice/VoiceCommunication.js +23 -21
- package/dist/components/chat-voice/VoiceRecord.js +24 -21
- package/dist/components/conversation-delete/index.js +10 -8
- package/dist/components/dots-loading/index.js +11 -8
- package/dist/components/dots-loading/index.module.css +41 -0
- package/dist/components/empty/index.js +13 -8
- package/dist/components/empty/index.module.css +24 -0
- package/dist/components/excel-components/ExcelCard.js +7 -3
- package/dist/components/excel-components/ExcelExcuting.js +61 -44
- package/dist/components/excel-components/ExcelFailCard.js +16 -11
- package/dist/components/excel-components/ExcelSuccessCard.js +3 -2
- package/dist/components/excel-components/index.module.css +212 -0
- package/dist/components/excel-components/styles.module.css +178 -0
- package/dist/components/file-card/fileCardSidebar.js +24 -17
- package/dist/components/file-card/index.js +69 -50
- package/dist/components/file-card/index.module.css +139 -0
- package/dist/components/file-preview/index.js +39 -34
- package/dist/components/file-preview/index.module.css +83 -0
- package/dist/components/file-upload/index.js +10 -7
- package/dist/components/file-upload/uploadV1.js +33 -27
- package/dist/components/gimi-sidebar/index.js +21 -14
- package/dist/components/gimi-sidebar/index.module.css +118 -0
- package/dist/components/header/index.js +19 -12
- package/dist/components/header/index.module.css +19 -0
- package/dist/components/iconfont-com/index.js +2 -1
- package/dist/components/knowledge-trace/KnowledgeIconComponent.js +29 -23
- package/dist/components/knowledge-trace/classList.js +38 -29
- package/dist/components/knowledge-trace/documentList.js +37 -28
- package/dist/components/knowledge-trace/index.js +29 -22
- package/dist/components/knowledge-trace/index.module.css +254 -0
- package/dist/components/knowledge-trace/videoList.js +47 -37
- package/dist/components/lottie-img/index.js +10 -8
- package/dist/components/message-actions/CopyButton.js +25 -22
- package/dist/components/message-actions/LikeButton.js +25 -22
- package/dist/components/message-actions/RegenerateButton.js +21 -18
- package/dist/components/message-actions/UnLikeButton.js +25 -22
- package/dist/components/message-actions/VoicePlay.js +25 -22
- package/dist/components/message-list/index.js +86 -76
- package/dist/components/message-list/index.module.css +261 -0
- package/dist/components/no-microphone-root/index.js +40 -30
- package/dist/components/no-microphone-root/index.module.css +48 -0
- package/dist/components/preset-agent-content/index.js +21 -16
- package/dist/components/preset-agent-content/index.module.css +46 -0
- package/dist/components/quoted-content/index.module.css +80 -0
- package/dist/components/reasoning-content/index.js +56 -43
- package/dist/components/reasoning-content/index.module.css +169 -0
- package/dist/components/reference-content/index.js +73 -64
- package/dist/components/reference-content/index.module.css +84 -0
- package/dist/components/templates/CommonChat.js +79 -65
- package/dist/components/templates/GimiChatComponent.js +13 -6
- package/dist/components/templates/demo/demo.js +104 -103
- package/dist/components/templates/index.module.css +109 -0
- package/dist/components/upload-list/index.js +57 -42
- package/dist/components/upload-list/index.module.css +119 -0
- package/dist/components/voice-bars/index.js +22 -19
- package/dist/components/voice-check-dialog/index.js +25 -18
- package/dist/components/voice-check-dialog/{index.module.scss → index.module.css} +2 -2
- package/dist/components/voice-recording/index.js +58 -43
- package/dist/components/voice-recording/index.module.css +41 -0
- package/dist/components/work-flow-content/demo.js +2 -1
- package/dist/components/work-flow-content/index.js +13 -10
- package/dist/components/work-flow-content/index.module.css +24 -0
- package/package.json +7 -6
- package/dist/components/ai-chat-dialogue/index.module.scss +0 -272
- package/dist/components/ai-loading/index.module.scss +0 -11
- package/dist/components/answer-item/index.module.scss +0 -295
- package/dist/components/ask-card/index.module.scss +0 -125
- package/dist/components/chat-input/index.module.scss +0 -44
- package/dist/components/dots-loading/index.module.scss +0 -45
- package/dist/components/empty/index.module.scss +0 -27
- package/dist/components/excel-components/index.module.scss +0 -210
- package/dist/components/excel-components/styles.module.scss +0 -186
- package/dist/components/file-card/index.module.scss +0 -139
- package/dist/components/file-preview/index.module.scss +0 -120
- package/dist/components/gimi-sidebar/index.module.scss +0 -136
- package/dist/components/header/index.module.scss +0 -26
- package/dist/components/knowledge-trace/index.module.scss +0 -262
- package/dist/components/message-list/index.module.scss +0 -304
- package/dist/components/no-microphone-root/index.module.scss +0 -42
- package/dist/components/preset-agent-content/index.module.scss +0 -48
- package/dist/components/quoted-content/index.module.scss +0 -76
- package/dist/components/reasoning-content/index.module.scss +0 -164
- package/dist/components/reference-content/index.module.scss +0 -73
- package/dist/components/templates/index.module.scss +0 -119
- package/dist/components/upload-list/index.module.scss +0 -119
- package/dist/components/voice-recording/index.module.scss +0 -41
- package/dist/components/work-flow-content/index.module.scss +0 -23
|
@@ -5,10 +5,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
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
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import styles from "./index.module.
|
|
8
|
+
import styles from "./index.module.css";
|
|
9
9
|
import { MMarkdown } from '@myun/gimi-design';
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import FileUpload from "../file-upload";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
14
|
var AskCard = function AskCard(_ref) {
|
|
13
15
|
var item = _ref.item,
|
|
14
16
|
moduleInfo = _ref.moduleInfo,
|
|
@@ -37,40 +39,47 @@ var AskCard = function AskCard(_ref) {
|
|
|
37
39
|
optionsList = _React$useMemo.optionsList,
|
|
38
40
|
questionContent = _React$useMemo.questionContent;
|
|
39
41
|
var optionRender = function optionRender(v) {
|
|
40
|
-
return /*#__PURE__*/
|
|
42
|
+
return /*#__PURE__*/_jsx("span", {
|
|
43
|
+
children: v.value ? v.value : v.key
|
|
44
|
+
});
|
|
41
45
|
};
|
|
42
|
-
return /*#__PURE__*/
|
|
43
|
-
className: styles.askList
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
47
|
+
className: styles.askList,
|
|
48
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: styles.askQuestion,
|
|
50
|
+
style: detailInfo.answerType === 1 || detailInfo.uploadFile ? {
|
|
51
|
+
marginBottom: 12
|
|
52
|
+
} : {
|
|
53
|
+
marginBottom: 0
|
|
54
|
+
},
|
|
55
|
+
children: /*#__PURE__*/_jsx(MMarkdown, {
|
|
56
|
+
content: questionContent,
|
|
57
|
+
id: item.id
|
|
58
|
+
})
|
|
59
|
+
}), detailInfo.answerType === 1 && (optionsList === null || optionsList === void 0 ? void 0 : optionsList.map(function (v) {
|
|
60
|
+
return /*#__PURE__*/_jsx("div", {
|
|
61
|
+
className: classNames(styles.askItem, detailInfo.answerType === 0 || item.selectValue ? styles.disablebox : ''),
|
|
62
|
+
onClick: function onClick() {
|
|
63
|
+
return handleClickAskList(moduleInfo, 'click', v.key, v.value || v.key);
|
|
64
|
+
},
|
|
65
|
+
children: optionRender(v)
|
|
66
|
+
}, v.key);
|
|
67
|
+
})), detailInfo.uploadFile && detailInfo.answerType === 0 && /*#__PURE__*/_jsx("div", {
|
|
68
|
+
className: classNames(styles.showUpload, item.disableUploadFile ? styles.disableFile : ''),
|
|
58
69
|
onClick: function onClick() {
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
alt: ""
|
|
74
|
-
}), "\u6587\u4EF6\u4E0A\u4F20"))));
|
|
70
|
+
return onAskCardCallback === null || onAskCardCallback === void 0 ? void 0 : onAskCardCallback();
|
|
71
|
+
},
|
|
72
|
+
children: /*#__PURE__*/_jsx(FileUpload, {
|
|
73
|
+
disabled: item.disableUploadFile,
|
|
74
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
75
|
+
className: classNames(styles.uploadIcon),
|
|
76
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
77
|
+
src: item.disableUploadFile ? 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/19/b1e04_20250919162201.png' : 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/11/83ad4_20250911153220.png',
|
|
78
|
+
alt: ""
|
|
79
|
+
}), "\u6587\u4EF6\u4E0A\u4F20"]
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
75
84
|
};
|
|
76
85
|
export default AskCard;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
.askList {
|
|
2
|
+
width: clamp(380px, 100%, 600px);
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
padding: 20px;
|
|
5
|
+
border-radius: 16px;
|
|
6
|
+
border: 1px solid var(---, #e9ebf2);
|
|
7
|
+
background: linear-gradient(180deg, #f9fefe 0%, #fff 100%);
|
|
8
|
+
box-shadow: 0 2px 2px 0 #fff inset;
|
|
9
|
+
margin-top: 12px;
|
|
10
|
+
}
|
|
11
|
+
.askList .askItem {
|
|
12
|
+
width: fit-content;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
padding: 12px 20px;
|
|
15
|
+
border-radius: 22px;
|
|
16
|
+
border: 1px solid var(---, #d9dce5);
|
|
17
|
+
background: #fff;
|
|
18
|
+
color: #000;
|
|
19
|
+
font-family: "PingFang SC";
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
font-style: normal;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
line-height: normal;
|
|
24
|
+
margin-bottom: 16px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
min-width: clamp(88px, 25%, 100px);
|
|
27
|
+
max-width: 100%;
|
|
28
|
+
display: flex;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
align-items: center;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
.askList .disablebox {
|
|
34
|
+
border-radius: 22px;
|
|
35
|
+
border: 1px solid var(---, #d9dce5);
|
|
36
|
+
background: #fff;
|
|
37
|
+
color: #ced3d9;
|
|
38
|
+
font-family: "PingFang SC";
|
|
39
|
+
font-size: 14px;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
line-height: normal;
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
pointer-events: none;
|
|
45
|
+
}
|
|
46
|
+
.askList .selectbox {
|
|
47
|
+
border-radius: 22px;
|
|
48
|
+
background: var(---, #2e394c);
|
|
49
|
+
color: #fff;
|
|
50
|
+
font-family: "PingFang SC";
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
line-height: normal;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
.askList .askQuestion {
|
|
59
|
+
max-width: 100%;
|
|
60
|
+
color: #2e394c;
|
|
61
|
+
font-family: "PingFang SC";
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
line-height: 28px; /* 175% */
|
|
66
|
+
margin-bottom: 12px;
|
|
67
|
+
}
|
|
68
|
+
.askList .askQuestion :global(.markdown_container) p {
|
|
69
|
+
margin: 0;
|
|
70
|
+
white-space: pre-wrap;
|
|
71
|
+
}
|
|
72
|
+
.askList .askQuestion :global(.markdown_container) li {
|
|
73
|
+
white-space: pre-line;
|
|
74
|
+
}
|
|
75
|
+
.askList .askItem:nth-last-child(1) {
|
|
76
|
+
margin-bottom: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.showUpload {
|
|
80
|
+
width: 128px;
|
|
81
|
+
height: 44px;
|
|
82
|
+
flex-shrink: 0;
|
|
83
|
+
border-radius: 22px;
|
|
84
|
+
border: 1px solid var(---, #d9dce5);
|
|
85
|
+
background: #fff;
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
color: #000;
|
|
93
|
+
font-family: "PingFang SC";
|
|
94
|
+
font-size: 14px;
|
|
95
|
+
font-style: normal;
|
|
96
|
+
font-weight: 600;
|
|
97
|
+
line-height: normal;
|
|
98
|
+
}
|
|
99
|
+
.showUpload :global(.ant-upload) {
|
|
100
|
+
height: 100%;
|
|
101
|
+
}
|
|
102
|
+
.showUpload .uploadIcon {
|
|
103
|
+
height: 100%;
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
}
|
|
107
|
+
.showUpload .disableFile {
|
|
108
|
+
border-radius: 22px;
|
|
109
|
+
border: 1px solid var(---, #d9dce5);
|
|
110
|
+
background: #fff;
|
|
111
|
+
color: #ced3d9;
|
|
112
|
+
font-family: "PingFang SC";
|
|
113
|
+
font-size: 14px;
|
|
114
|
+
font-style: normal;
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
line-height: normal;
|
|
117
|
+
}
|
|
118
|
+
.showUpload img {
|
|
119
|
+
width: 32px;
|
|
120
|
+
height: 32px;
|
|
121
|
+
flex-shrink: 0;
|
|
122
|
+
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
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
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
3
7
|
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; }
|
|
4
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); } }
|
|
5
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); }); }; }
|
|
@@ -19,7 +23,7 @@ import VoiceRecord from "../chat-voice/VoiceRecord";
|
|
|
19
23
|
import VoiceRecording from "../voice-recording";
|
|
20
24
|
import deepThinkActive from "../../assets/image/deepthinkActive.png";
|
|
21
25
|
import { Tooltip } from "@douyinfe/semi-ui";
|
|
22
|
-
import styles from "./index.module.
|
|
26
|
+
import styles from "./index.module.css";
|
|
23
27
|
import FileUpload from "../file-upload";
|
|
24
28
|
import { useAppSelector, useAppDispatch } from "../../store/hooks";
|
|
25
29
|
import { setConversationId, setFileList } from "../../store/slices/gimiMenuSlice";
|
|
@@ -29,6 +33,9 @@ import UploadList from "../upload-list";
|
|
|
29
33
|
import { FileStatus } from "../../interfaces/fileInterface";
|
|
30
34
|
import LottieImg from "../lottie-img";
|
|
31
35
|
import AIChatDialogue from "../ai-chat-dialogue";
|
|
36
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
37
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
38
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
39
|
var extractText = function extractText() {
|
|
33
40
|
var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
34
41
|
return content.map(function (item) {
|
|
@@ -158,24 +165,28 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
158
165
|
if (!props.enableFileUpload || messageList.length > 0) {
|
|
159
166
|
return null;
|
|
160
167
|
}
|
|
161
|
-
return /*#__PURE__*/
|
|
168
|
+
return /*#__PURE__*/_jsx(FileUpload, {
|
|
162
169
|
ref: uploadFileRef,
|
|
163
170
|
accept: props.accept,
|
|
164
|
-
disabled: props.disabled
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
171
|
+
disabled: props.disabled,
|
|
172
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
173
|
+
content: '上传文件',
|
|
174
|
+
children: (fileList === null || fileList === void 0 ? void 0 : fileList.length) === 0 ? /*#__PURE__*/_jsx("div", {
|
|
175
|
+
className: styles.uploadIcon,
|
|
176
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
177
|
+
src: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/11/83ad4_20250911153220.png',
|
|
178
|
+
alt: ""
|
|
179
|
+
})
|
|
180
|
+
}) : /*#__PURE__*/_jsx("div", {
|
|
181
|
+
className: styles.uploadIcon,
|
|
182
|
+
onClick: handleTip,
|
|
183
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
184
|
+
src: 'https://simg01.gaodunwangxiao.com/uploadimgs/tmp/upload/202509/24/6726e_20250924141448.png',
|
|
185
|
+
alt: ""
|
|
186
|
+
})
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
});
|
|
179
190
|
}, [props.enableFileUpload, messageList]);
|
|
180
191
|
var openChatCommunication = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
181
192
|
var params, res;
|
|
@@ -269,31 +280,34 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
269
280
|
if (!props.enableVoiceChat && !props.enableVoiceRecord) {
|
|
270
281
|
return null;
|
|
271
282
|
}
|
|
272
|
-
return /*#__PURE__*/
|
|
273
|
-
trigger: /*#__PURE__*/
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
283
|
+
return /*#__PURE__*/_jsx(VoiceCheckDialog, {
|
|
284
|
+
trigger: /*#__PURE__*/_jsxs(_Fragment, {
|
|
285
|
+
children: [props.enableVoiceChat && ((_agentObjRef$current = agentObjRef.current) === null || _agentObjRef$current === void 0 ? void 0 : _agentObjRef$current.isEnableVoiceCall) === 1 && /*#__PURE__*/_jsx(VoiceCommunication, {
|
|
286
|
+
disabled: props.disabled || props.disableVoiceCommunication || props.isVoiceGetting || isMsgRecieving,
|
|
287
|
+
onClick: openChatCommunication
|
|
288
|
+
}), props.enableVoiceRecord && /*#__PURE__*/_jsx(VoiceRecord, {
|
|
289
|
+
onClick: props.shortAsrClick,
|
|
290
|
+
disabled: props.disabled || isMsgRecieving || props.isVoiceGetting
|
|
291
|
+
})]
|
|
292
|
+
})
|
|
280
293
|
});
|
|
281
294
|
}, [props.enableVoiceChat, props.enableVoiceRecord, props.disabled, props.disableVoiceCommunication, props.isVoiceGetting, isMsgRecieving, openChatCommunication, props.shortAsrClick]);
|
|
282
295
|
var renderActionArea = React.useCallback(function (renderProps) {
|
|
283
|
-
return /*#__PURE__*/
|
|
296
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
284
297
|
className: renderProps.className,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
298
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
299
|
+
style: {
|
|
300
|
+
display: 'flex',
|
|
301
|
+
alignItems: 'center'
|
|
302
|
+
},
|
|
303
|
+
children: [VoiceTools, UploadFileTool, /*#__PURE__*/_jsx(Divider, {
|
|
304
|
+
layout: "vertical",
|
|
305
|
+
style: {
|
|
306
|
+
marginLeft: 8
|
|
307
|
+
}
|
|
308
|
+
})]
|
|
309
|
+
}), renderProps.menuItem]
|
|
310
|
+
}, 'action_area');
|
|
297
311
|
}, [VoiceTools, UploadFileTool]);
|
|
298
312
|
var onMessageSend = React.useCallback(function (content) {
|
|
299
313
|
var _props$onSend;
|
|
@@ -302,17 +316,21 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
302
316
|
(_props$onSend = props.onSend) === null || _props$onSend === void 0 || _props$onSend.call(props, text);
|
|
303
317
|
}, []);
|
|
304
318
|
var renderConfigureArea = React.useCallback(function () {
|
|
305
|
-
return /*#__PURE__*/
|
|
319
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
306
320
|
trigger: 'click',
|
|
307
|
-
content: "\u7CFB\u7EDF\u667A\u80FD\u5207\u6362\u601D\u8003\u6A21\u5F0F"
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
321
|
+
content: "\u7CFB\u7EDF\u667A\u80FD\u5207\u6362\u601D\u8003\u6A21\u5F0F",
|
|
322
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
323
|
+
className: styles.deepthink,
|
|
324
|
+
children: [/*#__PURE__*/_jsx("img", {
|
|
325
|
+
width: 14,
|
|
326
|
+
src: deepThinkActive,
|
|
327
|
+
className: styles.imgs,
|
|
328
|
+
alt: ""
|
|
329
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
330
|
+
children: "\u6DF1\u5EA6\u601D\u8003:\xA0\xA0\u81EA\u52A8"
|
|
331
|
+
})]
|
|
332
|
+
})
|
|
333
|
+
});
|
|
316
334
|
}, []);
|
|
317
335
|
var stopSSe = function stopSSe() {
|
|
318
336
|
if (uploadFileRef.current) {
|
|
@@ -340,27 +358,29 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
340
358
|
}
|
|
341
359
|
};
|
|
342
360
|
var renderReference = React.useCallback(function () {
|
|
343
|
-
return /*#__PURE__*/
|
|
361
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
344
362
|
className: styles.reference,
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
363
|
+
children: [!props.isRecording && (fileList === null || fileList === void 0 ? void 0 : fileList.length) > 0 && messageList.length === 0 && /*#__PURE__*/_jsx(UploadList, {
|
|
364
|
+
file: fileList[0],
|
|
365
|
+
handleReTry: handleReTry,
|
|
366
|
+
handleDelFile: handleDelFile
|
|
367
|
+
}), props.isVoiceGetting && /*#__PURE__*/_jsxs("div", {
|
|
368
|
+
style: {
|
|
369
|
+
display: 'flex',
|
|
370
|
+
alignItems: 'start',
|
|
371
|
+
height: '60px'
|
|
372
|
+
},
|
|
373
|
+
children: [/*#__PURE__*/_jsx(LottieImg, {
|
|
374
|
+
name: "aiLoading",
|
|
375
|
+
size: [20, 40]
|
|
376
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
377
|
+
style: {
|
|
378
|
+
flex: 1
|
|
379
|
+
},
|
|
380
|
+
children: "\u6B63\u5728\u83B7\u53D6\u8BED\u97F3\u5185\u5BB9..."
|
|
381
|
+
})]
|
|
382
|
+
})]
|
|
383
|
+
}, 'reference');
|
|
364
384
|
}, [fileList, props.isRecording, props.isVoiceGetting, messageList]);
|
|
365
385
|
var handleHangUp = function handleHangUp() {
|
|
366
386
|
var _props$onHistoryReloa;
|
|
@@ -382,52 +402,53 @@ var ChatInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
382
402
|
setHasContent(false);
|
|
383
403
|
}
|
|
384
404
|
}, [props.defaultPrompt, messageList.length]);
|
|
385
|
-
return /*#__PURE__*/
|
|
405
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
386
406
|
className: styles.inputWrap,
|
|
387
|
-
ref: inputWrapRef
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
407
|
+
ref: inputWrapRef,
|
|
408
|
+
children: [props.isRecording ? /*#__PURE__*/_jsx(VoiceRecording, {
|
|
409
|
+
recordingCount: props.recordingCount,
|
|
410
|
+
stopRecording: stopRecording,
|
|
411
|
+
containerWidth: inputWidth
|
|
412
|
+
}) : /*#__PURE__*/_jsx(AIChatInput, _objectSpread(_objectSpread({}, props), {}, {
|
|
413
|
+
ref: inputRef,
|
|
414
|
+
style: {
|
|
415
|
+
width: '100%'
|
|
416
|
+
},
|
|
417
|
+
placeholder: props.placeholder || '',
|
|
418
|
+
references: [{
|
|
419
|
+
type: 'text',
|
|
420
|
+
id: '123'
|
|
421
|
+
}],
|
|
422
|
+
defaultContent: props.showDefaultPrompt ? transformToInputSlots(props.defaultPrompt || '') : '',
|
|
423
|
+
onContentChange: onContentChange
|
|
424
|
+
// 输入框底部右侧操作区域
|
|
425
|
+
,
|
|
426
|
+
renderActionArea: renderActionArea
|
|
427
|
+
// 输入框底部左侧操作区域
|
|
428
|
+
,
|
|
429
|
+
renderConfigureArea: renderConfigureArea
|
|
430
|
+
// 自定义引用区域
|
|
431
|
+
,
|
|
432
|
+
renderReference: renderReference,
|
|
433
|
+
onStopGenerate: props.onInterrupt
|
|
434
|
+
// 上传文件配置开始
|
|
435
|
+
,
|
|
436
|
+
showUploadButton: false,
|
|
437
|
+
showUploadFile: false
|
|
438
|
+
// 上传文件配置结束
|
|
439
|
+
,
|
|
440
|
+
canSend: !props.disabled && hasContent,
|
|
441
|
+
onMessageSend: onMessageSend,
|
|
442
|
+
generating: isMsgRecieving
|
|
443
|
+
})), showChatCommunication && /*#__PURE__*/_jsx(AIChatDialogue, {
|
|
444
|
+
paper: {
|
|
445
|
+
enableCaptions: false,
|
|
446
|
+
conversationId: conversationId,
|
|
447
|
+
botId: agentObj.botId
|
|
448
|
+
},
|
|
449
|
+
setSpeech: setShowChatCommunication,
|
|
450
|
+
handleHangUp: handleHangUp
|
|
451
|
+
})]
|
|
452
|
+
});
|
|
432
453
|
});
|
|
433
454
|
export default ChatInput;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.inputWrap {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.deepthink {
|
|
8
|
+
padding: 0 8px;
|
|
9
|
+
height: 32px;
|
|
10
|
+
border-radius: 18px;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
color: #4086ff;
|
|
16
|
+
background-color: #f1f7ff;
|
|
17
|
+
}
|
|
18
|
+
.deepthink span {
|
|
19
|
+
margin-left: 4px;
|
|
20
|
+
font-family: PingFangSC, PingFang SC;
|
|
21
|
+
font-weight: 400;
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
line-height: 14px;
|
|
24
|
+
text-align: right;
|
|
25
|
+
font-style: normal;
|
|
26
|
+
}
|
|
27
|
+
.deepthink .imgs {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.uploadIcon {
|
|
34
|
+
width: 32px;
|
|
35
|
+
height: 32px;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
}
|
|
38
|
+
.uploadIcon img {
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
object-fit: cover;
|
|
42
|
+
}
|