@fonixtree/magic-design 2.0.4 → 2.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.
@@ -7,6 +7,7 @@
7
7
  background-color: #FFF;
8
8
  border-radius: 4px;
9
9
  .history_header {
10
+ font-size: 14px;
10
11
  display: flex;
11
12
  justify-content: space-between;
12
13
  padding: 16px;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _antd = require("antd");
13
13
 
14
- var _marked = require("marked");
15
-
16
14
  var _classnames = _interopRequireDefault(require("classnames"));
17
15
 
18
16
  var _CopyBtn = _interopRequireDefault(require("./components/CopyBtn"));
@@ -23,6 +21,8 @@ var _FonixtreeGpt = _interopRequireDefault(require("../FonixtreeGpt"));
23
21
 
24
22
  var _AiImageGenerator = _interopRequireDefault(require("../AiImageGenerator"));
25
23
 
24
+ var _commonUtil = require("../../../utils/commonUtil");
25
+
26
26
  require("./index.less");
27
27
 
28
28
  require("./markdown.less");
@@ -72,7 +72,8 @@ function (_super) {
72
72
  message: '',
73
73
  context: [],
74
74
  isGenerating: false,
75
- aiImageVisible: false
75
+ aiImageVisible: false,
76
+ loading: true
76
77
  };
77
78
 
78
79
  _this.scrollBottom = function () {
@@ -87,7 +88,7 @@ function (_super) {
87
88
  };
88
89
 
89
90
  _this.getMarkText = function (text) {
90
- return (0, _marked.parse)(text);
91
+ return marked.parse(text);
91
92
  };
92
93
 
93
94
  _this.onEnter = function () {
@@ -172,10 +173,17 @@ function (_super) {
172
173
  }
173
174
 
174
175
  ChatRobot.prototype.componentDidMount = function () {
176
+ var _this = this;
177
+
175
178
  var context = this.chatGpt.getContext();
176
179
  this.setState({
177
180
  context: context
178
181
  });
182
+ (0, _commonUtil.importAsync)('https://cdn.jsdelivr.net/npm/marked/marked.min.js').then(function () {
183
+ return _this.setState({
184
+ loading: false
185
+ });
186
+ });
179
187
  };
180
188
 
181
189
  ChatRobot.prototype.render = function () {
@@ -186,7 +194,13 @@ function (_super) {
186
194
  message = _a.message,
187
195
  open = _a.open,
188
196
  isGenerating = _a.isGenerating,
189
- aiImageVisible = _a.aiImageVisible;
197
+ aiImageVisible = _a.aiImageVisible,
198
+ loading = _a.loading;
199
+
200
+ if (loading) {
201
+ return null;
202
+ }
203
+
190
204
  return /*#__PURE__*/_react["default"].createElement("div", {
191
205
  className: "chat_wrap"
192
206
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -7,6 +7,7 @@
7
7
  background-color: #FFF;
8
8
  border-radius: 4px;
9
9
  .history_header {
10
+ font-size: 14px;
10
11
  display: flex;
11
12
  justify-content: space-between;
12
13
  padding: 16px;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _antd = require("antd");
13
13
 
14
- var _marked = require("marked");
15
-
16
14
  var _classnames = _interopRequireDefault(require("classnames"));
17
15
 
18
16
  var _CopyBtn = _interopRequireDefault(require("./components/CopyBtn"));
@@ -23,6 +21,8 @@ var _FonixtreeGpt = _interopRequireDefault(require("../FonixtreeGpt"));
23
21
 
24
22
  var _AiImageGenerator = _interopRequireDefault(require("../AiImageGenerator"));
25
23
 
24
+ var _commonUtil = require("../../../utils/commonUtil");
25
+
26
26
  require("./index.less");
27
27
 
28
28
  require("./markdown.less");
@@ -72,7 +72,8 @@ function (_super) {
72
72
  message: '',
73
73
  context: [],
74
74
  isGenerating: false,
75
- aiImageVisible: false
75
+ aiImageVisible: false,
76
+ loading: true
76
77
  };
77
78
 
78
79
  _this.scrollBottom = function () {
@@ -87,7 +88,7 @@ function (_super) {
87
88
  };
88
89
 
89
90
  _this.getMarkText = function (text) {
90
- return (0, _marked.parse)(text);
91
+ return marked.parse(text);
91
92
  };
92
93
 
93
94
  _this.onEnter = function () {
@@ -172,10 +173,17 @@ function (_super) {
172
173
  }
173
174
 
174
175
  ChatRobot.prototype.componentDidMount = function () {
176
+ var _this = this;
177
+
175
178
  var context = this.chatGpt.getContext();
176
179
  this.setState({
177
180
  context: context
178
181
  });
182
+ (0, _commonUtil.importAsync)('https://cdn.jsdelivr.net/npm/marked/marked.min.js').then(function () {
183
+ return _this.setState({
184
+ loading: false
185
+ });
186
+ });
179
187
  };
180
188
 
181
189
  ChatRobot.prototype.render = function () {
@@ -186,7 +194,13 @@ function (_super) {
186
194
  message = _a.message,
187
195
  open = _a.open,
188
196
  isGenerating = _a.isGenerating,
189
- aiImageVisible = _a.aiImageVisible;
197
+ aiImageVisible = _a.aiImageVisible,
198
+ loading = _a.loading;
199
+
200
+ if (loading) {
201
+ return null;
202
+ }
203
+
190
204
  return /*#__PURE__*/_react["default"].createElement("div", {
191
205
  className: "chat_wrap"
192
206
  }, /*#__PURE__*/_react["default"].createElement("div", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "2.0.4",
4
+ "version": "2.0.6",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",