@difizen/libro-ai-native 0.2.41-next.5 → 0.2.42
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/es/ai-native-command-contribution.d.ts.map +1 -1
- package/es/ai-native-command-contribution.js +8 -6
- package/es/ai-native-for-cell-view.d.ts.map +1 -1
- package/es/ai-native-for-cell-view.js +28 -20
- package/es/error-output-model.d.ts.map +1 -1
- package/es/error-output-model.js +4 -3
- package/es/index.less +2 -2
- package/es/libro-ai-native-chat-service.d.ts.map +1 -1
- package/es/libro-ai-native-chat-service.js +31 -22
- package/package.json +2 -2
- package/src/error-output-model.tsx +5 -2
- package/src/index.less +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-native-command-contribution.d.ts","sourceRoot":"","sources":["../src/ai-native-command-contribution.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAKjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAa,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI1E,qBACa,gCACX,YAAW,mBAAmB,EAAE,mBAAmB;IAErB,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAEpF,2BAA2B,EAAE,2BAA2B,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,CAAC;IAC/B,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,WAAW,EAAE,WAAW,CAAC;IAE9C,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAuBrD,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"ai-native-command-contribution.d.ts","sourceRoot":"","sources":["../src/ai-native-command-contribution.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAKjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAa,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAI1E,qBACa,gCACX,YAAW,mBAAmB,EAAE,mBAAmB;IAErB,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAAC;IAEpF,2BAA2B,EAAE,2BAA2B,CAAC;IAC/B,gBAAgB,EAAE,gBAAgB,CAAC;IAC/B,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,WAAW,EAAE,WAAW,CAAC;IAE9C,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAuBrD,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;CAmMjD"}
|
|
@@ -232,7 +232,7 @@ export var LibroAINativeCommandContribution = (_dec = singleton({
|
|
|
232
232
|
this.libroCommand.registerLibroCommand(command, AINativeCommands['Explain'], {
|
|
233
233
|
execute: function () {
|
|
234
234
|
var _execute4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(cell, libro) {
|
|
235
|
-
var libroAINativeForCellView;
|
|
235
|
+
var libroAINativeForCellView, code;
|
|
236
236
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
237
237
|
while (1) switch (_context4.prev = _context4.next) {
|
|
238
238
|
case 0:
|
|
@@ -248,11 +248,12 @@ export var LibroAINativeCommandContribution = (_dec = singleton({
|
|
|
248
248
|
libroAINativeForCellView = _context4.sent;
|
|
249
249
|
libroAINativeForCellView.showAI = true;
|
|
250
250
|
addCellAIClassname(cell);
|
|
251
|
+
code = l10n.getLang() === 'en-US' ? "Could you please explain this piece of code?\uFF1A".concat(cell.model.value, "\uFF0CProvide the reasons and the results of the optimization.") : "\u5E2E\u5FD9\u4F18\u5316\u4E00\u4E0B\u8FD9\u6BB5\u4EE3\u7801\uFF1A".concat(cell.model.value, "\uFF0C\u7ED9\u51FA\u539F\u56E0\u4EE5\u53CA\u4F18\u5316\u7ED3\u679C");
|
|
251
252
|
libroAINativeForCellView.chatStream({
|
|
252
|
-
content:
|
|
253
|
+
content: code
|
|
253
254
|
});
|
|
254
255
|
// this.libroService.active?.enterEditMode();
|
|
255
|
-
case
|
|
256
|
+
case 9:
|
|
256
257
|
case "end":
|
|
257
258
|
return _context4.stop();
|
|
258
259
|
}
|
|
@@ -273,7 +274,7 @@ export var LibroAINativeCommandContribution = (_dec = singleton({
|
|
|
273
274
|
this.libroCommand.registerLibroCommand(command, AINativeCommands['Optimize'], {
|
|
274
275
|
execute: function () {
|
|
275
276
|
var _execute5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(cell, libro) {
|
|
276
|
-
var libroAINativeForCellView;
|
|
277
|
+
var libroAINativeForCellView, code;
|
|
277
278
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
278
279
|
while (1) switch (_context5.prev = _context5.next) {
|
|
279
280
|
case 0:
|
|
@@ -288,12 +289,13 @@ export var LibroAINativeCommandContribution = (_dec = singleton({
|
|
|
288
289
|
case 4:
|
|
289
290
|
libroAINativeForCellView = _context5.sent;
|
|
290
291
|
libroAINativeForCellView.showAI = true;
|
|
292
|
+
code = l10n.getLang() === 'en-US' ? "Please help optimize this piece of code: ".concat(cell.model.value, ",provide reasons and the optimized result.") : "\u5E2E\u5FD9\u4F18\u5316\u4E00\u4E0B\u8FD9\u6BB5\u4EE3\u7801\uFF1A".concat(cell.model.value, "\uFF0C\u7ED9\u51FA\u539F\u56E0\u4EE5\u53CA\u4F18\u5316\u7ED3\u679C");
|
|
291
293
|
addCellAIClassname(cell);
|
|
292
294
|
libroAINativeForCellView.chatStream({
|
|
293
|
-
content:
|
|
295
|
+
content: code
|
|
294
296
|
});
|
|
295
297
|
// this.libroService.active?.enterEditMode();
|
|
296
|
-
case
|
|
298
|
+
case 9:
|
|
297
299
|
case "end":
|
|
298
300
|
return _context5.stop();
|
|
299
301
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-native-for-cell-view.d.ts","sourceRoot":"","sources":["../src/ai-native-for-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-native-for-cell-view.d.ts","sourceRoot":"","sources":["../src/ai-native-for-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAmB,MAAM,mBAAmB,CAAC;AAW9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAGhE,wBAAgB,0BAA0B,mDA+CzC;AAED,qBAEa,wBAAyB,SAAQ,QAAQ;IAC3C,IAAI,EAAE,aAAa,CAA8B;IACzC,OAAO,EAAE,OAAO,CAAC;IAClC,IAAI,EAAE,QAAQ,CAAC;IAEf,6BAA6B,EAAE,aAAa,CAAC,OAAO,2BAA2B,CAAC,CAAC;IAEjF,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;IAG1D,MAAM,UAAS;gBACiB,OAAO,EAAE,0BAA0B;IAKnE,UAAU,WAAkB,YAAY,mBA+DtC;CACH"}
|
|
@@ -91,7 +91,7 @@ export var LibroAINativeForCellView = (_dec = transient(), _dec2 = view('libro-a
|
|
|
91
91
|
_initializerDefineProperty(_this, "showAI", _descriptor4, _assertThisInitialized(_this));
|
|
92
92
|
_this.chatStream = /*#__PURE__*/function () {
|
|
93
93
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(option) {
|
|
94
|
-
var chat_key, content, language, url, msg, res, reader, stream, msgItem, alreayDone, _yield$reader$read, value, done, data, event;
|
|
94
|
+
var chat_key, content, language, url, msg, res, reader, stream, msgItem, alreayDone, error, _yield$reader$read, value, done, data, event;
|
|
95
95
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
96
96
|
while (1) switch (_context.prev = _context.next) {
|
|
97
97
|
case 0:
|
|
@@ -99,7 +99,7 @@ export var LibroAINativeForCellView = (_dec = transient(), _dec2 = view('libro-a
|
|
|
99
99
|
url = "/libro/api/chatstream";
|
|
100
100
|
msg = {
|
|
101
101
|
chat_key: chat_key,
|
|
102
|
-
prompt: content,
|
|
102
|
+
prompt: encodeURIComponent(content),
|
|
103
103
|
language: language
|
|
104
104
|
};
|
|
105
105
|
_context.next = 5;
|
|
@@ -113,7 +113,7 @@ export var LibroAINativeForCellView = (_dec = transient(), _dec2 = view('libro-a
|
|
|
113
113
|
case 5:
|
|
114
114
|
res = _context.sent;
|
|
115
115
|
if (!(res.status === 200)) {
|
|
116
|
-
_context.next =
|
|
116
|
+
_context.next = 36;
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
if (typeof res.data === 'string') {
|
|
@@ -131,49 +131,57 @@ export var LibroAINativeForCellView = (_dec = transient(), _dec2 = view('libro-a
|
|
|
131
131
|
});
|
|
132
132
|
_this.libroAIChatMessageItemModel = msgItem;
|
|
133
133
|
alreayDone = false;
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
error = {
|
|
135
|
+
data: '',
|
|
136
|
+
type: 'event'
|
|
137
|
+
};
|
|
138
|
+
_context.prev = 12;
|
|
139
|
+
case 13:
|
|
136
140
|
if (alreayDone) {
|
|
137
|
-
_context.next =
|
|
141
|
+
_context.next = 29;
|
|
138
142
|
break;
|
|
139
143
|
}
|
|
140
|
-
_context.next =
|
|
144
|
+
_context.next = 16;
|
|
141
145
|
return reader.read();
|
|
142
|
-
case
|
|
146
|
+
case 16:
|
|
143
147
|
_yield$reader$read = _context.sent;
|
|
144
148
|
value = _yield$reader$read.value;
|
|
145
149
|
done = _yield$reader$read.done;
|
|
150
|
+
if (value) {
|
|
151
|
+
error = value;
|
|
152
|
+
}
|
|
146
153
|
if (!done) {
|
|
147
|
-
_context.next =
|
|
154
|
+
_context.next = 24;
|
|
148
155
|
break;
|
|
149
156
|
}
|
|
150
157
|
alreayDone = true;
|
|
151
158
|
msgItem.handleEventData({
|
|
152
159
|
type: 'done'
|
|
153
160
|
});
|
|
154
|
-
return _context.abrupt("break",
|
|
155
|
-
case
|
|
161
|
+
return _context.abrupt("break", 29);
|
|
162
|
+
case 24:
|
|
156
163
|
data = JSON.parse(value.data);
|
|
157
164
|
event = ChatEvent.format(value.event || 'chunk', data);
|
|
158
165
|
msgItem.handleEventData(event);
|
|
159
|
-
_context.next =
|
|
160
|
-
break;
|
|
161
|
-
case 27:
|
|
162
|
-
_context.next = 32;
|
|
166
|
+
_context.next = 13;
|
|
163
167
|
break;
|
|
164
168
|
case 29:
|
|
165
|
-
_context.
|
|
166
|
-
|
|
169
|
+
_context.next = 35;
|
|
170
|
+
break;
|
|
171
|
+
case 31:
|
|
172
|
+
_context.prev = 31;
|
|
173
|
+
_context.t0 = _context["catch"](12);
|
|
174
|
+
console.error('libro-ai-error:' + error.data);
|
|
167
175
|
msgItem.handleEventData({
|
|
168
176
|
type: 'error'
|
|
169
177
|
});
|
|
170
|
-
case
|
|
178
|
+
case 35:
|
|
171
179
|
return _context.abrupt("return");
|
|
172
|
-
case
|
|
180
|
+
case 36:
|
|
173
181
|
case "end":
|
|
174
182
|
return _context.stop();
|
|
175
183
|
}
|
|
176
|
-
}, _callee, null, [[
|
|
184
|
+
}, _callee, null, [[12, 31]]);
|
|
177
185
|
}));
|
|
178
186
|
return function (_x) {
|
|
179
187
|
return _ref.apply(this, arguments);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-output-model.d.ts","sourceRoot":"","sources":["../src/error-output-model.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,gBAAgB,EAIjB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"error-output-model.d.ts","sourceRoot":"","sources":["../src/error-output-model.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,gBAAgB,EAIjB,MAAM,wBAAwB,CAAC;AAOhC,OAAO,cAAc,CAAC;AAsFtB,qBAEa,kBAAmB,SAAQ,gBAAgB;IAC7C,IAAI,2FAA4B;IACjC,QAAQ,UAAS;CAC1B"}
|
package/es/error-output-model.js
CHANGED
|
@@ -54,7 +54,7 @@ var AIErrorOutputModelRender = /*#__PURE__*/forwardRef(function ErrorOutputModel
|
|
|
54
54
|
};
|
|
55
55
|
var handleFixWithAI = /*#__PURE__*/function () {
|
|
56
56
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
57
|
-
var libroAINativeForCellView;
|
|
57
|
+
var libroAINativeForCellView, code;
|
|
58
58
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
59
59
|
while (1) switch (_context.prev = _context.next) {
|
|
60
60
|
case 0:
|
|
@@ -64,12 +64,13 @@ var AIErrorOutputModelRender = /*#__PURE__*/forwardRef(function ErrorOutputModel
|
|
|
64
64
|
libroAINativeForCellView = _context.sent;
|
|
65
65
|
addCellAIClassname(output.cell);
|
|
66
66
|
libroAINativeForCellView.showAI = true;
|
|
67
|
+
code = l10n.getLang() === 'en-US' ? "Code is:\n".concat(output.cell.model.value, "\nError trackback is:\n").concat(concatMultilineString(source.traceback)) : "\u4EE3\u7801\u4E3A:\n".concat(output.cell.model.value, "\n\u62A5\u9519\u4E3A:\n").concat(concatMultilineString(source.traceback));
|
|
67
68
|
libroAINativeForCellView.chatStream({
|
|
68
69
|
chat_key: 'LLM:debug',
|
|
69
|
-
content:
|
|
70
|
+
content: code,
|
|
70
71
|
language: l10n.getLang()
|
|
71
72
|
});
|
|
72
|
-
case
|
|
73
|
+
case 7:
|
|
73
74
|
case "end":
|
|
74
75
|
return _context.stop();
|
|
75
76
|
}
|
package/es/index.less
CHANGED
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.libro-ai-native-for-cell-cancel-btn {
|
|
182
|
-
width:
|
|
182
|
+
width: 92px;
|
|
183
183
|
|
|
184
184
|
&.@{ant-prefix}-btn-variant-outlined {
|
|
185
185
|
border-color: var(--mana-libro-ai-native-color);
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
|
|
266
266
|
.libro-ai-native-for-cell-container {
|
|
267
267
|
display: flex;
|
|
268
|
-
padding
|
|
268
|
+
padding: 18px 0;
|
|
269
269
|
justify-content: space-between;
|
|
270
270
|
}
|
|
271
271
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-ai-native-chat-service.d.ts","sourceRoot":"","sources":["../src/libro-ai-native-chat-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-ai-native-chat-service.d.ts","sourceRoot":"","sources":["../src/libro-ai-native-chat-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKzD,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,eAAe,CAAC;AAGxE,qBACa,wBAAyB,SAAQ,gBAAgB;IACnD,IAAI,WACH,kCAAkC,KACzC,QAAQ,gBAAgB,EAAE,CAAC,CAkB5B;IACO,UAAU,WACT,kCAAkC,0BAClB,gBAAgB,KAAK,IAAI,yBAC1B,UAAU,KAAK,IAAI,mBAgE1C;CACH"}
|
|
@@ -39,7 +39,7 @@ export var LibroAINativeChatService = (_dec = singleton(), _dec(_class = /*#__PU
|
|
|
39
39
|
content = option.content, system_prompt = option.system_prompt;
|
|
40
40
|
_context.next = 3;
|
|
41
41
|
return _this.fetcher.post("/libro/api/chat", {
|
|
42
|
-
prompt: content,
|
|
42
|
+
prompt: encodeURIComponent(content),
|
|
43
43
|
system_prompt: system_prompt
|
|
44
44
|
});
|
|
45
45
|
case 3:
|
|
@@ -73,14 +73,14 @@ export var LibroAINativeChatService = (_dec = singleton(), _dec(_class = /*#__PU
|
|
|
73
73
|
}();
|
|
74
74
|
_this.chatStream = /*#__PURE__*/function () {
|
|
75
75
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(option, messgeCallback, eventCallback) {
|
|
76
|
-
var content, system_prompt, url, msg, res, reader, stream, alreayDone, _yield$reader$read, value, done, data, _event;
|
|
76
|
+
var content, system_prompt, url, msg, res, reader, stream, alreayDone, error, _yield$reader$read, value, done, data, _event;
|
|
77
77
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
78
|
while (1) switch (_context2.prev = _context2.next) {
|
|
79
79
|
case 0:
|
|
80
80
|
content = option.content, system_prompt = option.system_prompt;
|
|
81
81
|
url = "/libro/api/chatstream";
|
|
82
82
|
msg = {
|
|
83
|
-
prompt: content,
|
|
83
|
+
prompt: encodeURIComponent(content),
|
|
84
84
|
system_prompt: system_prompt
|
|
85
85
|
};
|
|
86
86
|
_context2.next = 5;
|
|
@@ -94,7 +94,7 @@ export var LibroAINativeChatService = (_dec = singleton(), _dec(_class = /*#__PU
|
|
|
94
94
|
case 5:
|
|
95
95
|
res = _context2.sent;
|
|
96
96
|
if (!(res.status === 200)) {
|
|
97
|
-
_context2.next =
|
|
97
|
+
_context2.next = 35;
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
if (typeof res.data === 'string') {
|
|
@@ -111,49 +111,58 @@ export var LibroAINativeChatService = (_dec = singleton(), _dec(_class = /*#__PU
|
|
|
111
111
|
content: ''
|
|
112
112
|
});
|
|
113
113
|
alreayDone = false;
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
error = {
|
|
115
|
+
data: '',
|
|
116
|
+
type: 'event'
|
|
117
|
+
};
|
|
118
|
+
_context2.prev = 11;
|
|
119
|
+
case 12:
|
|
116
120
|
if (alreayDone) {
|
|
117
|
-
_context2.next =
|
|
121
|
+
_context2.next = 28;
|
|
118
122
|
break;
|
|
119
123
|
}
|
|
120
|
-
_context2.next =
|
|
124
|
+
_context2.next = 15;
|
|
121
125
|
return reader.read();
|
|
122
|
-
case
|
|
126
|
+
case 15:
|
|
123
127
|
_yield$reader$read = _context2.sent;
|
|
124
128
|
value = _yield$reader$read.value;
|
|
125
129
|
done = _yield$reader$read.done;
|
|
126
130
|
if (!done) {
|
|
127
|
-
_context2.next =
|
|
131
|
+
_context2.next = 22;
|
|
128
132
|
break;
|
|
129
133
|
}
|
|
130
134
|
alreayDone = true;
|
|
131
135
|
eventCallback({
|
|
132
136
|
type: 'done'
|
|
133
137
|
});
|
|
134
|
-
return _context2.abrupt("break",
|
|
135
|
-
case
|
|
138
|
+
return _context2.abrupt("break", 28);
|
|
139
|
+
case 22:
|
|
140
|
+
if (value) {
|
|
141
|
+
error = value;
|
|
142
|
+
}
|
|
136
143
|
data = JSON.parse(value.data);
|
|
137
144
|
_event = ChatEvent.format(value.event || 'chunk', data);
|
|
138
145
|
eventCallback(_event);
|
|
139
|
-
_context2.next =
|
|
140
|
-
break;
|
|
141
|
-
case 26:
|
|
142
|
-
_context2.next = 31;
|
|
146
|
+
_context2.next = 12;
|
|
143
147
|
break;
|
|
144
148
|
case 28:
|
|
145
|
-
_context2.
|
|
146
|
-
|
|
149
|
+
_context2.next = 34;
|
|
150
|
+
break;
|
|
151
|
+
case 30:
|
|
152
|
+
_context2.prev = 30;
|
|
153
|
+
_context2.t0 = _context2["catch"](11);
|
|
154
|
+
console.error('libro-ai-error:' + error.data);
|
|
147
155
|
eventCallback({
|
|
148
|
-
type: 'error'
|
|
156
|
+
type: 'error',
|
|
157
|
+
message: error.data
|
|
149
158
|
});
|
|
150
|
-
case
|
|
159
|
+
case 34:
|
|
151
160
|
return _context2.abrupt("return");
|
|
152
|
-
case
|
|
161
|
+
case 35:
|
|
153
162
|
case "end":
|
|
154
163
|
return _context2.stop();
|
|
155
164
|
}
|
|
156
|
-
}, _callee2, null, [[
|
|
165
|
+
}, _callee2, null, [[11, 30]]);
|
|
157
166
|
}));
|
|
158
167
|
return function (_x2, _x3, _x4) {
|
|
159
168
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-ai-native",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.42",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@difizen/libro-jupyter": "0.2.
|
|
35
|
+
"@difizen/libro-jupyter": "^0.2.42",
|
|
36
36
|
"@ant-design/icons": "^5.4.0",
|
|
37
37
|
"react-zoom-pan-pinch": "^3.6.1",
|
|
38
38
|
"@difizen/mana-app": "latest",
|
|
@@ -49,10 +49,13 @@ const AIErrorOutputModelRender = forwardRef<HTMLDivElement>(
|
|
|
49
49
|
);
|
|
50
50
|
addCellAIClassname(output.cell);
|
|
51
51
|
libroAINativeForCellView.showAI = true;
|
|
52
|
-
|
|
52
|
+
const code =
|
|
53
|
+
l10n.getLang() === 'en-US'
|
|
54
|
+
? `Code is:\n${output.cell.model.value}\nError trackback is:\n${concatMultilineString(source.traceback)}`
|
|
55
|
+
: `代码为:\n${output.cell.model.value}\n报错为:\n${concatMultilineString(source.traceback)}`;
|
|
53
56
|
libroAINativeForCellView.chatStream({
|
|
54
57
|
chat_key: 'LLM:debug',
|
|
55
|
-
content:
|
|
58
|
+
content: code,
|
|
56
59
|
language: l10n.getLang(),
|
|
57
60
|
});
|
|
58
61
|
};
|