deep-chat-dev 9.0.4 → 9.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/custom-elements.json +8623 -8617
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +1138 -1306
- package/dist/types/handler.d.ts +6 -8
- package/dist/types/handler.d.ts.map +1 -1
- package/dist/utils/HTTP/HTTPRequest.d.ts.map +1 -1
- package/dist/utils/HTTP/customHandler.d.ts +1 -0
- package/dist/utils/HTTP/customHandler.d.ts.map +1 -1
- package/dist/utils/HTTP/stream.d.ts.map +1 -1
- package/dist/utils/HTTP/websocket.d.ts.map +1 -1
- package/dist/views/chat/messages/messages.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -319,38 +319,130 @@ function getInvalidResponseMessage(r, e, t, n) {
|
|
319
319
|
return "".concat(s + o, "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \n You can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
|
320
320
|
}
|
321
321
|
var ErrorMessages = {
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
}
|
327
|
-
function
|
322
|
+
INVALID_KEY: "Invalid API Key",
|
323
|
+
CONNECTION_FAILED: "Failed to connect",
|
324
|
+
INVALID_RESPONSE: getInvalidResponseMessage,
|
325
|
+
INVALID_STREAM_RESPONSE: "Make sure the events are using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor"
|
326
|
+
},
|
327
|
+
_RequestUtils = /*#__PURE__*/function () {
|
328
|
+
function D() {
|
329
|
+
_classCallCheck(this, D);
|
330
|
+
}
|
331
|
+
_createClass(D, null, [{
|
332
|
+
key: "temporarilyRemoveHeader",
|
333
|
+
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
334
|
+
// prettier-ignore
|
335
|
+
function () {
|
336
|
+
var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e, t, n) {
|
337
|
+
var s;
|
338
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
339
|
+
while (1) switch (_context.prev = _context.next) {
|
340
|
+
case 0:
|
341
|
+
if (e != null && e.headers) {
|
342
|
+
_context.next = 2;
|
343
|
+
break;
|
344
|
+
}
|
345
|
+
throw new Error("Request settings have not been set up");
|
346
|
+
case 2:
|
347
|
+
s = e.headers[D.CONTENT_TYPE];
|
348
|
+
delete e.headers[D.CONTENT_TYPE];
|
349
|
+
_context.next = 6;
|
350
|
+
return t(n);
|
351
|
+
case 6:
|
352
|
+
e.headers[D.CONTENT_TYPE] = s;
|
353
|
+
case 7:
|
354
|
+
case "end":
|
355
|
+
return _context.stop();
|
356
|
+
}
|
357
|
+
}, _callee);
|
358
|
+
}));
|
359
|
+
function temporarilyRemoveHeader(_x, _x2, _x3) {
|
360
|
+
return _temporarilyRemoveHeader.apply(this, arguments);
|
361
|
+
}
|
362
|
+
return temporarilyRemoveHeader;
|
363
|
+
}()
|
364
|
+
}, {
|
365
|
+
key: "displayError",
|
366
|
+
value: function displayError(e, t) {
|
367
|
+
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
|
368
|
+
if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
|
369
|
+
e.addNewErrorMessage("service", t);
|
370
|
+
}
|
371
|
+
}, {
|
372
|
+
key: "processResponseByType",
|
373
|
+
value: function processResponseByType(e) {
|
374
|
+
var t = e.headers.get("content-type");
|
375
|
+
return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
|
376
|
+
}
|
377
|
+
}, {
|
378
|
+
key: "processRequestInterceptor",
|
379
|
+
value: function () {
|
380
|
+
var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t) {
|
381
|
+
var a, n, s, o;
|
382
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
383
|
+
while (1) switch (_context2.prev = _context2.next) {
|
384
|
+
case 0:
|
385
|
+
_context2.next = 2;
|
386
|
+
return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
|
387
|
+
case 2:
|
388
|
+
_context2.t0 = _context2.sent;
|
389
|
+
if (_context2.t0) {
|
390
|
+
_context2.next = 5;
|
391
|
+
break;
|
392
|
+
}
|
393
|
+
_context2.t0 = t;
|
394
|
+
case 5:
|
395
|
+
n = _context2.t0;
|
396
|
+
s = n;
|
397
|
+
o = n;
|
398
|
+
return _context2.abrupt("return", {
|
399
|
+
body: s.body,
|
400
|
+
headers: s.headers,
|
401
|
+
error: o.error
|
402
|
+
});
|
403
|
+
case 9:
|
404
|
+
case "end":
|
405
|
+
return _context2.stop();
|
406
|
+
}
|
407
|
+
}, _callee2);
|
408
|
+
}));
|
409
|
+
function processRequestInterceptor(_x4, _x5) {
|
410
|
+
return _processRequestInterceptor.apply(this, arguments);
|
411
|
+
}
|
412
|
+
return processRequestInterceptor;
|
413
|
+
}()
|
414
|
+
}]);
|
415
|
+
return D;
|
416
|
+
}();
|
417
|
+
_RequestUtils.CONTENT_TYPE = "Content-Type";
|
418
|
+
var RequestUtils = _RequestUtils;
|
419
|
+
function getBytes(_x6, _x7) {
|
328
420
|
return _getBytes.apply(this, arguments);
|
329
421
|
}
|
330
422
|
function _getBytes() {
|
331
|
-
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
423
|
+
_getBytes = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee71(r, e) {
|
332
424
|
var t, n;
|
333
|
-
return _regeneratorRuntime().wrap(function
|
334
|
-
while (1) switch (
|
425
|
+
return _regeneratorRuntime().wrap(function _callee71$(_context71) {
|
426
|
+
while (1) switch (_context71.prev = _context71.next) {
|
335
427
|
case 0:
|
336
428
|
t = r.getReader();
|
337
429
|
case 1:
|
338
|
-
|
430
|
+
_context71.next = 3;
|
339
431
|
return t.read();
|
340
432
|
case 3:
|
341
|
-
if ((n =
|
342
|
-
|
433
|
+
if ((n = _context71.sent).done) {
|
434
|
+
_context71.next = 7;
|
343
435
|
break;
|
344
436
|
}
|
345
437
|
e(n.value);
|
346
438
|
case 5:
|
347
|
-
|
439
|
+
_context71.next = 1;
|
348
440
|
break;
|
349
441
|
case 7:
|
350
442
|
case "end":
|
351
|
-
return
|
443
|
+
return _context71.stop();
|
352
444
|
}
|
353
|
-
},
|
445
|
+
}, _callee71);
|
354
446
|
}));
|
355
447
|
return _getBytes.apply(this, arguments);
|
356
448
|
}
|
@@ -439,254 +531,81 @@ function fetchEventSource(r, e) {
|
|
439
531
|
c = e.openWhenHidden,
|
440
532
|
u = e.fetch,
|
441
533
|
d = __rest(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
442
|
-
return new Promise(function (h,
|
443
|
-
var
|
444
|
-
|
534
|
+
return new Promise(function (h, p) {
|
535
|
+
var f = Object.assign({}, n);
|
536
|
+
f.accept || (f.accept = EventStreamContentType);
|
445
537
|
var b;
|
446
538
|
function m() {
|
447
|
-
b.abort(), document.hidden ||
|
539
|
+
b.abort(), document.hidden || I();
|
448
540
|
}
|
449
541
|
c || document.addEventListener("visibilitychange", m);
|
450
|
-
var
|
451
|
-
|
542
|
+
var v = DefaultRetryInterval,
|
543
|
+
g = 0;
|
452
544
|
function y() {
|
453
|
-
document.removeEventListener("visibilitychange", m), window.clearTimeout(
|
545
|
+
document.removeEventListener("visibilitychange", m), window.clearTimeout(g), b.abort();
|
454
546
|
}
|
455
547
|
t == null || t.addEventListener("abort", function () {
|
456
548
|
y(), h();
|
457
549
|
});
|
458
|
-
var
|
459
|
-
|
460
|
-
function
|
461
|
-
return
|
462
|
-
}
|
463
|
-
function
|
464
|
-
|
465
|
-
var R,
|
466
|
-
return _regeneratorRuntime().wrap(function
|
467
|
-
while (1) switch (
|
550
|
+
var x = u !== null && u !== void 0 ? u : window.fetch,
|
551
|
+
_ = s !== null && s !== void 0 ? s : defaultOnOpen;
|
552
|
+
function I() {
|
553
|
+
return _I.apply(this, arguments);
|
554
|
+
}
|
555
|
+
function _I() {
|
556
|
+
_I = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
557
|
+
var R, w, S;
|
558
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
559
|
+
while (1) switch (_context3.prev = _context3.next) {
|
468
560
|
case 0:
|
469
561
|
b = new AbortController();
|
470
|
-
|
471
|
-
|
472
|
-
return
|
473
|
-
headers:
|
562
|
+
_context3.prev = 1;
|
563
|
+
_context3.next = 4;
|
564
|
+
return x(r, Object.assign(Object.assign({}, d), {
|
565
|
+
headers: f,
|
474
566
|
signal: b.signal
|
475
567
|
}));
|
476
568
|
case 4:
|
477
|
-
|
478
|
-
|
479
|
-
return
|
569
|
+
w = _context3.sent;
|
570
|
+
_context3.next = 7;
|
571
|
+
return _(w);
|
480
572
|
case 7:
|
481
|
-
|
482
|
-
return getBytes(
|
483
|
-
|
484
|
-
}, function (
|
485
|
-
|
573
|
+
_context3.next = 9;
|
574
|
+
return getBytes(w.body, getLines(getMessages(function (S) {
|
575
|
+
S ? f[LastEventId] = S : delete f[LastEventId];
|
576
|
+
}, function (S) {
|
577
|
+
v = S;
|
486
578
|
}, o)));
|
487
579
|
case 9:
|
488
580
|
a == null || a();
|
489
581
|
y();
|
490
582
|
h();
|
491
|
-
|
583
|
+
_context3.next = 17;
|
492
584
|
break;
|
493
585
|
case 14:
|
494
|
-
|
495
|
-
|
586
|
+
_context3.prev = 14;
|
587
|
+
_context3.t0 = _context3["catch"](1);
|
496
588
|
if (!b.signal.aborted) try {
|
497
|
-
|
498
|
-
window.clearTimeout(
|
499
|
-
} catch (
|
500
|
-
y(),
|
589
|
+
S = (R = l == null ? void 0 : l(_context3.t0)) !== null && R !== void 0 ? R : v;
|
590
|
+
window.clearTimeout(g), g = window.setTimeout(I, S);
|
591
|
+
} catch (S) {
|
592
|
+
y(), p(S);
|
501
593
|
}
|
502
594
|
case 17:
|
503
595
|
case "end":
|
504
|
-
return
|
596
|
+
return _context3.stop();
|
505
597
|
}
|
506
|
-
},
|
598
|
+
}, _callee3, null, [[1, 14]]);
|
507
599
|
}));
|
508
|
-
return
|
600
|
+
return _I.apply(this, arguments);
|
509
601
|
}
|
510
|
-
|
602
|
+
I();
|
511
603
|
});
|
512
604
|
}
|
513
605
|
function defaultOnOpen(r) {
|
514
606
|
var e = r.headers.get("content-type");
|
515
607
|
if (!(e != null && e.startsWith(EventStreamContentType))) throw new Error("Expected content-type to be ".concat(EventStreamContentType, ", Actual: ").concat(e));
|
516
608
|
}
|
517
|
-
var _RequestUtils = /*#__PURE__*/function () {
|
518
|
-
function D() {
|
519
|
-
_classCallCheck(this, D);
|
520
|
-
}
|
521
|
-
_createClass(D, null, [{
|
522
|
-
key: "temporarilyRemoveHeader",
|
523
|
-
value: // need to pass stringifyBody boolean separately as binding is throwing an error for some reason
|
524
|
-
// prettier-ignore
|
525
|
-
function () {
|
526
|
-
var _temporarilyRemoveHeader = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e, t, n) {
|
527
|
-
var s;
|
528
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
529
|
-
while (1) switch (_context2.prev = _context2.next) {
|
530
|
-
case 0:
|
531
|
-
if (e != null && e.headers) {
|
532
|
-
_context2.next = 2;
|
533
|
-
break;
|
534
|
-
}
|
535
|
-
throw new Error("Request settings have not been set up");
|
536
|
-
case 2:
|
537
|
-
s = e.headers[D.CONTENT_TYPE];
|
538
|
-
delete e.headers[D.CONTENT_TYPE];
|
539
|
-
_context2.next = 6;
|
540
|
-
return t(n);
|
541
|
-
case 6:
|
542
|
-
e.headers[D.CONTENT_TYPE] = s;
|
543
|
-
case 7:
|
544
|
-
case "end":
|
545
|
-
return _context2.stop();
|
546
|
-
}
|
547
|
-
}, _callee2);
|
548
|
-
}));
|
549
|
-
function temporarilyRemoveHeader(_x4, _x5, _x6) {
|
550
|
-
return _temporarilyRemoveHeader.apply(this, arguments);
|
551
|
-
}
|
552
|
-
return temporarilyRemoveHeader;
|
553
|
-
}()
|
554
|
-
}, {
|
555
|
-
key: "displayError",
|
556
|
-
value: function displayError(e, t) {
|
557
|
-
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "Service error, please try again.";
|
558
|
-
if (console.error(t), _typeof(t) == "object") return Object.keys(t).length === 0 ? e.addNewErrorMessage("service", n) : e.addNewErrorMessage("service", JSON.stringify(t));
|
559
|
-
e.addNewErrorMessage("service", t);
|
560
|
-
}
|
561
|
-
}, {
|
562
|
-
key: "processResponseByType",
|
563
|
-
value: function processResponseByType(e) {
|
564
|
-
var t = e.headers.get("content-type");
|
565
|
-
return t != null && t.includes("application/json") ? e.json() : t != null && t.includes("text/plain") || !t ? e : e.blob();
|
566
|
-
}
|
567
|
-
}, {
|
568
|
-
key: "processRequestInterceptor",
|
569
|
-
value: function () {
|
570
|
-
var _processRequestInterceptor = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e, t) {
|
571
|
-
var a, n, s, o;
|
572
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
573
|
-
while (1) switch (_context3.prev = _context3.next) {
|
574
|
-
case 0:
|
575
|
-
_context3.next = 2;
|
576
|
-
return (a = e.requestInterceptor) == null ? void 0 : a.call(e, t);
|
577
|
-
case 2:
|
578
|
-
_context3.t0 = _context3.sent;
|
579
|
-
if (_context3.t0) {
|
580
|
-
_context3.next = 5;
|
581
|
-
break;
|
582
|
-
}
|
583
|
-
_context3.t0 = t;
|
584
|
-
case 5:
|
585
|
-
n = _context3.t0;
|
586
|
-
s = n;
|
587
|
-
o = n;
|
588
|
-
return _context3.abrupt("return", {
|
589
|
-
body: s.body,
|
590
|
-
headers: s.headers,
|
591
|
-
error: o.error
|
592
|
-
});
|
593
|
-
case 9:
|
594
|
-
case "end":
|
595
|
-
return _context3.stop();
|
596
|
-
}
|
597
|
-
}, _callee3);
|
598
|
-
}));
|
599
|
-
function processRequestInterceptor(_x7, _x8) {
|
600
|
-
return _processRequestInterceptor.apply(this, arguments);
|
601
|
-
}
|
602
|
-
return processRequestInterceptor;
|
603
|
-
}()
|
604
|
-
}]);
|
605
|
-
return D;
|
606
|
-
}();
|
607
|
-
_RequestUtils.CONTENT_TYPE = "Content-Type";
|
608
|
-
var RequestUtils = _RequestUtils;
|
609
|
-
var _Demo = /*#__PURE__*/function () {
|
610
|
-
function A() {
|
611
|
-
_classCallCheck(this, A);
|
612
|
-
}
|
613
|
-
_createClass(A, null, [{
|
614
|
-
key: "generateResponseForOneMessage",
|
615
|
-
value: function generateResponseForOneMessage(e) {
|
616
|
-
if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
|
617
|
-
if (e.text) {
|
618
|
-
if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
619
|
-
if (e.text.includes("updog")) return "What's updog?";
|
620
|
-
}
|
621
|
-
return "Hi there! This is a demo response!";
|
622
|
-
}
|
623
|
-
}, {
|
624
|
-
key: "generateResponse",
|
625
|
-
value: function generateResponse(e) {
|
626
|
-
var t = [];
|
627
|
-
for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
|
628
|
-
if (t.length === 1) return A.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
|
629
|
-
var n = e.messages.findIndex(function (s) {
|
630
|
-
return s.text;
|
631
|
-
});
|
632
|
-
return n !== -1 && t.splice(n, 1), t.length === 1 ? A.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
|
633
|
-
}
|
634
|
-
}, {
|
635
|
-
key: "getCustomResponse",
|
636
|
-
value: function getCustomResponse(e, t) {
|
637
|
-
return typeof e == "function" ? e(t) : e;
|
638
|
-
}
|
639
|
-
}, {
|
640
|
-
key: "getResponse",
|
641
|
-
value: function getResponse(e) {
|
642
|
-
return e.customDemoResponse ? A.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
643
|
-
text: A.generateResponse(e)
|
644
|
-
};
|
645
|
-
}
|
646
|
-
// timeout is used to simulate a timeout for a response to come back
|
647
|
-
}, {
|
648
|
-
key: "request",
|
649
|
-
value: function request(e, t, n) {
|
650
|
-
var s = A.getResponse(e);
|
651
|
-
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
652
|
-
var o;
|
653
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
654
|
-
while (1) switch (_context4.prev = _context4.next) {
|
655
|
-
case 0:
|
656
|
-
_context4.next = 2;
|
657
|
-
return n == null ? void 0 : n(s);
|
658
|
-
case 2:
|
659
|
-
_context4.t0 = _context4.sent;
|
660
|
-
if (_context4.t0) {
|
661
|
-
_context4.next = 5;
|
662
|
-
break;
|
663
|
-
}
|
664
|
-
_context4.t0 = s;
|
665
|
-
case 5:
|
666
|
-
o = _context4.t0;
|
667
|
-
o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
|
668
|
-
case 7:
|
669
|
-
case "end":
|
670
|
-
return _context4.stop();
|
671
|
-
}
|
672
|
-
}, _callee4);
|
673
|
-
})), 400);
|
674
|
-
}
|
675
|
-
// timeout is used to simulate a timeout for a response to come back
|
676
|
-
}, {
|
677
|
-
key: "requestStream",
|
678
|
-
value: function requestStream(e, t) {
|
679
|
-
setTimeout(function () {
|
680
|
-
var s;
|
681
|
-
var n = (s = A.getResponse(e)) == null ? void 0 : s.text;
|
682
|
-
Stream.simulate(e, t, n);
|
683
|
-
}, 400);
|
684
|
-
}
|
685
|
-
}]);
|
686
|
-
return A;
|
687
|
-
}();
|
688
|
-
_Demo.URL = "deep-chat-demo";
|
689
|
-
var Demo = _Demo;
|
690
609
|
var Stream = /*#__PURE__*/function () {
|
691
610
|
function Stream() {
|
692
611
|
_classCallCheck(this, Stream);
|
@@ -695,12 +614,11 @@ var Stream = /*#__PURE__*/function () {
|
|
695
614
|
key: "request",
|
696
615
|
value: // prettier-ignore
|
697
616
|
function () {
|
698
|
-
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
617
|
+
var _request = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(e, t, n) {
|
699
618
|
var s,
|
700
|
-
|
619
|
+
f,
|
701
620
|
b,
|
702
621
|
m,
|
703
|
-
g,
|
704
622
|
v,
|
705
623
|
o,
|
706
624
|
_yield$RequestUtils$p,
|
@@ -711,20 +629,20 @@ var Stream = /*#__PURE__*/function () {
|
|
711
629
|
u,
|
712
630
|
d,
|
713
631
|
h,
|
714
|
-
|
715
|
-
|
716
|
-
return _regeneratorRuntime().wrap(function
|
717
|
-
while (1) switch (
|
632
|
+
p,
|
633
|
+
_args5 = arguments;
|
634
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
635
|
+
while (1) switch (_context5.prev = _context5.next) {
|
718
636
|
case 0:
|
719
|
-
s =
|
637
|
+
s = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : !0;
|
720
638
|
o = {
|
721
639
|
body: t,
|
722
|
-
headers: (
|
640
|
+
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
723
641
|
};
|
724
|
-
|
642
|
+
_context5.next = 4;
|
725
643
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
726
644
|
case 4:
|
727
|
-
_yield$RequestUtils$p =
|
645
|
+
_yield$RequestUtils$p = _context5.sent;
|
728
646
|
a = _yield$RequestUtils$p.body;
|
729
647
|
l = _yield$RequestUtils$p.headers;
|
730
648
|
c = _yield$RequestUtils$p.error;
|
@@ -733,85 +651,79 @@ var Stream = /*#__PURE__*/function () {
|
|
733
651
|
d = _e$streamHandlers.onClose;
|
734
652
|
h = _e$streamHandlers.abortStream;
|
735
653
|
if (!c) {
|
736
|
-
|
654
|
+
_context5.next = 14;
|
737
655
|
break;
|
738
656
|
}
|
739
|
-
return
|
657
|
+
return _context5.abrupt("return", Stream.onInterceptorError(n, c, d));
|
740
658
|
case 14:
|
741
|
-
if (!((b = e.requestSettings)
|
742
|
-
|
659
|
+
if (!(((b = e.requestSettings) == null ? void 0 : b.url) === Demo.URL)) {
|
660
|
+
_context5.next = 16;
|
743
661
|
break;
|
744
662
|
}
|
745
|
-
return
|
663
|
+
return _context5.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
746
664
|
case 16:
|
747
|
-
|
748
|
-
|
749
|
-
break;
|
750
|
-
}
|
751
|
-
return _context6.abrupt("return", Demo.requestStream(n, e.streamHandlers));
|
752
|
-
case 18:
|
753
|
-
f = null;
|
754
|
-
fetchEventSource(((g = e.requestSettings) == null ? void 0 : g.url) || e.url || "", {
|
665
|
+
p = null;
|
666
|
+
fetchEventSource(((m = e.requestSettings) == null ? void 0 : m.url) || e.url || "", {
|
755
667
|
method: ((v = e.requestSettings) == null ? void 0 : v.method) || "POST",
|
756
668
|
headers: l,
|
757
669
|
body: s ? JSON.stringify(a) : a,
|
758
670
|
openWhenHidden: !0,
|
759
671
|
// keep stream open when browser tab not open
|
760
|
-
onopen: function onopen(
|
761
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
762
|
-
return _regeneratorRuntime().wrap(function
|
763
|
-
while (1) switch (
|
672
|
+
onopen: function onopen(g) {
|
673
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
674
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
675
|
+
while (1) switch (_context4.prev = _context4.next) {
|
764
676
|
case 0:
|
765
|
-
if (!
|
766
|
-
|
677
|
+
if (!g.ok) {
|
678
|
+
_context4.next = 2;
|
767
679
|
break;
|
768
680
|
}
|
769
|
-
return
|
681
|
+
return _context4.abrupt("return", (p = n.addNewStreamedMessage(), u()));
|
770
682
|
case 2:
|
771
|
-
|
772
|
-
return RequestUtils.processResponseByType(
|
683
|
+
_context4.next = 4;
|
684
|
+
return RequestUtils.processResponseByType(g);
|
773
685
|
case 4:
|
774
|
-
throw
|
686
|
+
throw _context4.sent;
|
775
687
|
case 5:
|
776
688
|
case "end":
|
777
|
-
return
|
689
|
+
return _context4.stop();
|
778
690
|
}
|
779
|
-
},
|
691
|
+
}, _callee4);
|
780
692
|
}))();
|
781
693
|
},
|
782
|
-
onmessage: function onmessage(
|
783
|
-
var
|
784
|
-
if (JSON.stringify(
|
785
|
-
var
|
786
|
-
(
|
787
|
-
(
|
788
|
-
})["catch"](function (
|
789
|
-
return RequestUtils.displayError(n,
|
694
|
+
onmessage: function onmessage(g) {
|
695
|
+
var y;
|
696
|
+
if (JSON.stringify(g.data) !== JSON.stringify("[DONE]")) {
|
697
|
+
var x = JSON.parse(g.data);
|
698
|
+
(y = e.extractResultData) == null || y.call(e, x).then(function (_) {
|
699
|
+
(_ == null ? void 0 : _.text) === void 0 ? console.error("Response data: ".concat(g.data, " \n ").concat(ErrorMessages.INVALID_STREAM_RESPONSE)) : p && n.updateStreamedMessage(_.text, p);
|
700
|
+
})["catch"](function (_) {
|
701
|
+
return RequestUtils.displayError(n, _);
|
790
702
|
});
|
791
703
|
}
|
792
704
|
},
|
793
|
-
onerror: function onerror(
|
794
|
-
throw d(),
|
705
|
+
onerror: function onerror(g) {
|
706
|
+
throw d(), g;
|
795
707
|
},
|
796
708
|
onclose: function onclose() {
|
797
709
|
n.finaliseStreamedMessage(), d();
|
798
710
|
},
|
799
711
|
signal: h.signal
|
800
|
-
})["catch"](function (
|
801
|
-
var
|
802
|
-
(
|
803
|
-
RequestUtils.displayError(n,
|
804
|
-
})["catch"](function (
|
805
|
-
RequestUtils.displayError(n,
|
712
|
+
})["catch"](function (g) {
|
713
|
+
var y;
|
714
|
+
(y = e.extractResultData) == null || y.call(e, g).then(function () {
|
715
|
+
RequestUtils.displayError(n, g);
|
716
|
+
})["catch"](function (x) {
|
717
|
+
RequestUtils.displayError(n, x);
|
806
718
|
});
|
807
719
|
});
|
808
|
-
case
|
720
|
+
case 18:
|
809
721
|
case "end":
|
810
|
-
return
|
722
|
+
return _context5.stop();
|
811
723
|
}
|
812
|
-
},
|
724
|
+
}, _callee5);
|
813
725
|
}));
|
814
|
-
function request(_x9, _x10
|
726
|
+
function request(_x8, _x9, _x10) {
|
815
727
|
return _request.apply(this, arguments);
|
816
728
|
}
|
817
729
|
return request;
|
@@ -853,157 +765,87 @@ var Stream = /*#__PURE__*/function () {
|
|
853
765
|
}]);
|
854
766
|
return Stream;
|
855
767
|
}();
|
856
|
-
var
|
857
|
-
function
|
858
|
-
_classCallCheck(this,
|
768
|
+
var _Demo = /*#__PURE__*/function () {
|
769
|
+
function C() {
|
770
|
+
_classCallCheck(this, C);
|
859
771
|
}
|
860
|
-
_createClass(
|
861
|
-
key: "
|
862
|
-
value: function () {
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
case 0:
|
868
|
-
s = /*#__PURE__*/function () {
|
869
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(l) {
|
870
|
-
var u, d, c;
|
871
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
872
|
-
while (1) switch (_context7.prev = _context7.next) {
|
873
|
-
case 0:
|
874
|
-
_context7.next = 2;
|
875
|
-
return (d = (u = e.deepChat).responseInterceptor) == null ? void 0 : d.call(u, l);
|
876
|
-
case 2:
|
877
|
-
_context7.t0 = _context7.sent;
|
878
|
-
if (_context7.t0) {
|
879
|
-
_context7.next = 5;
|
880
|
-
break;
|
881
|
-
}
|
882
|
-
_context7.t0 = l;
|
883
|
-
case 5:
|
884
|
-
c = _context7.t0;
|
885
|
-
!c || _typeof(c) != "object" || typeof c.error != "string" && typeof c.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof c.error == "string" ? (console.error(c.error), n.addNewErrorMessage("service", c.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && c.text ? Stream.simulate(n, e.streamHandlers, c.text) : (n.addNewMessage(c, !0, !0), e.completionsHandlers.onFinish());
|
886
|
-
case 7:
|
887
|
-
case "end":
|
888
|
-
return _context7.stop();
|
889
|
-
}
|
890
|
-
}, _callee7);
|
891
|
-
}));
|
892
|
-
return function s(_x15) {
|
893
|
-
return _ref2.apply(this, arguments);
|
894
|
-
};
|
895
|
-
}();
|
896
|
-
(a = (o = e.requestSettings).handler) == null || a.call(o, t, {
|
897
|
-
onResponse: s
|
898
|
-
});
|
899
|
-
case 2:
|
900
|
-
case "end":
|
901
|
-
return _context8.stop();
|
902
|
-
}
|
903
|
-
}, _callee8);
|
904
|
-
}));
|
905
|
-
function request(_x12, _x13, _x14) {
|
906
|
-
return _request2.apply(this, arguments);
|
772
|
+
_createClass(C, null, [{
|
773
|
+
key: "generateResponseForOneMessage",
|
774
|
+
value: function generateResponseForOneMessage(e) {
|
775
|
+
if (e.file) return e.file.type === "image" ? "That is a nice image!" : e.file.type === "audio" ? "I like the sound of that!" : e.file.type === "gif" ? "That is a nice gif!" : "That is an interesting file!";
|
776
|
+
if (e.text) {
|
777
|
+
if (e.text.charAt(e.text.length - 1) === "?") return "I'm sorry but I can't answer that question...";
|
778
|
+
if (e.text.includes("updog")) return "What's updog?";
|
907
779
|
}
|
908
|
-
return
|
909
|
-
}
|
780
|
+
return "Hi there! This is a demo response!";
|
781
|
+
}
|
910
782
|
}, {
|
911
|
-
key: "
|
912
|
-
value: function () {
|
913
|
-
var
|
914
|
-
|
915
|
-
|
916
|
-
|
783
|
+
key: "generateResponse",
|
784
|
+
value: function generateResponse(e) {
|
785
|
+
var t = [];
|
786
|
+
for (var s = e.messages.length - 1; s >= 0 && e.messages[s].role !== "ai"; s -= 1) t.push(e.messages[s]);
|
787
|
+
if (t.length === 1) return C.generateResponseForOneMessage(e.messages[e.messages.length - 1]);
|
788
|
+
var n = e.messages.findIndex(function (s) {
|
789
|
+
return s.text;
|
790
|
+
});
|
791
|
+
return n !== -1 && t.splice(n, 1), t.length === 1 ? C.generateResponseForOneMessage(e.messages[e.messages.length - 1]) : "Wow, very cool files!";
|
792
|
+
}
|
793
|
+
}, {
|
794
|
+
key: "getCustomResponse",
|
795
|
+
value: function getCustomResponse(e, t) {
|
796
|
+
return typeof e == "function" ? e(t) : e;
|
797
|
+
}
|
798
|
+
}, {
|
799
|
+
key: "getResponse",
|
800
|
+
value: function getResponse(e) {
|
801
|
+
return e.customDemoResponse ? C.getCustomResponse(e.customDemoResponse, e.messages[e.messages.length - 1]) : {
|
802
|
+
text: C.generateResponse(e)
|
803
|
+
};
|
804
|
+
}
|
805
|
+
// timeout is used to simulate a timeout for a response to come back
|
806
|
+
}, {
|
807
|
+
key: "request",
|
808
|
+
value: function request(e, t, n) {
|
809
|
+
var s = C.getResponse(e);
|
810
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
811
|
+
var o;
|
812
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
813
|
+
while (1) switch (_context6.prev = _context6.next) {
|
917
814
|
case 0:
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
}
|
926
|
-
|
927
|
-
n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
|
928
|
-
};
|
929
|
-
d = {
|
930
|
-
onOpen: l,
|
931
|
-
onResponse: u,
|
932
|
-
onClose: c,
|
933
|
-
stopClicked: e.streamHandlers.stopClicked
|
934
|
-
};
|
935
|
-
(f = (h = e.requestSettings).handler) == null || f.call(h, t, d);
|
815
|
+
_context6.next = 2;
|
816
|
+
return n == null ? void 0 : n(s);
|
817
|
+
case 2:
|
818
|
+
_context6.t0 = _context6.sent;
|
819
|
+
if (_context6.t0) {
|
820
|
+
_context6.next = 5;
|
821
|
+
break;
|
822
|
+
}
|
823
|
+
_context6.t0 = s;
|
936
824
|
case 5:
|
825
|
+
o = _context6.t0;
|
826
|
+
o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
|
827
|
+
case 7:
|
937
828
|
case "end":
|
938
|
-
return
|
829
|
+
return _context6.stop();
|
939
830
|
}
|
940
|
-
},
|
941
|
-
}));
|
942
|
-
|
943
|
-
|
944
|
-
}
|
945
|
-
return stream;
|
946
|
-
}()
|
831
|
+
}, _callee6);
|
832
|
+
})), 400);
|
833
|
+
}
|
834
|
+
// timeout is used to simulate a timeout for a response to come back
|
947
835
|
}, {
|
948
|
-
key: "
|
949
|
-
value: function
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
}
|
956
|
-
};
|
957
|
-
e.websocket = n;
|
958
|
-
var l = {
|
959
|
-
onOpen: function onOpen() {
|
960
|
-
t.removeError(), n.isOpen = !0;
|
961
|
-
},
|
962
|
-
onResponse: function () {
|
963
|
-
var _onResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
|
964
|
-
var f, p, h;
|
965
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
966
|
-
while (1) switch (_context10.prev = _context10.next) {
|
967
|
-
case 0:
|
968
|
-
if (n.isOpen) {
|
969
|
-
_context10.next = 2;
|
970
|
-
break;
|
971
|
-
}
|
972
|
-
return _context10.abrupt("return");
|
973
|
-
case 2:
|
974
|
-
_context10.next = 4;
|
975
|
-
return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
|
976
|
-
case 4:
|
977
|
-
_context10.t0 = _context10.sent;
|
978
|
-
if (_context10.t0) {
|
979
|
-
_context10.next = 7;
|
980
|
-
break;
|
981
|
-
}
|
982
|
-
_context10.t0 = d;
|
983
|
-
case 7:
|
984
|
-
h = _context10.t0;
|
985
|
-
!h || _typeof(h) != "object" || typeof h.error != "string" && typeof h.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(d, "server", !!e.deepChat.responseInterceptor, h)), t.addNewErrorMessage("service", "Error in server message")) : typeof h.error == "string" ? (console.error(h.error), t.isLastMessageError() || t.addNewErrorMessage("service", h.error)) : e.deepChat.stream ? Stream.simulate(t, e.streamHandlers, h.text) : t.addNewMessage(h, !0, !0);
|
986
|
-
case 9:
|
987
|
-
case "end":
|
988
|
-
return _context10.stop();
|
989
|
-
}
|
990
|
-
}, _callee10);
|
991
|
-
}));
|
992
|
-
function onResponse(_x19) {
|
993
|
-
return _onResponse.apply(this, arguments);
|
994
|
-
}
|
995
|
-
return onResponse;
|
996
|
-
}(),
|
997
|
-
onClose: function onClose() {
|
998
|
-
n.isOpen = !1;
|
999
|
-
},
|
1000
|
-
newUserMessage: n.newUserMessage
|
1001
|
-
};
|
1002
|
-
(u = (c = e.requestSettings).handler) == null || u.call(c, void 0, l);
|
836
|
+
key: "requestStream",
|
837
|
+
value: function requestStream(e, t) {
|
838
|
+
setTimeout(function () {
|
839
|
+
var s;
|
840
|
+
var n = (s = C.getResponse(e)) == null ? void 0 : s.text;
|
841
|
+
Stream.simulate(e, t, n);
|
842
|
+
}, 400);
|
1003
843
|
}
|
1004
844
|
}]);
|
1005
|
-
return
|
845
|
+
return C;
|
1006
846
|
}();
|
847
|
+
_Demo.URL = "deep-chat-demo";
|
848
|
+
var Demo = _Demo;
|
1007
849
|
var HTTPRequest = /*#__PURE__*/function () {
|
1008
850
|
function HTTPRequest() {
|
1009
851
|
_classCallCheck(this, HTTPRequest);
|
@@ -1012,13 +854,12 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1012
854
|
key: "request",
|
1013
855
|
value: // prettier-ignore
|
1014
856
|
function () {
|
1015
|
-
var
|
857
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
|
1016
858
|
var s,
|
1017
859
|
h,
|
1018
|
-
f,
|
1019
860
|
p,
|
861
|
+
f,
|
1020
862
|
b,
|
1021
|
-
m,
|
1022
863
|
o,
|
1023
864
|
_yield$RequestUtils$p2,
|
1024
865
|
a,
|
@@ -1026,110 +867,104 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1026
867
|
c,
|
1027
868
|
u,
|
1028
869
|
d,
|
1029
|
-
|
1030
|
-
return _regeneratorRuntime().wrap(function
|
1031
|
-
while (1) switch (
|
870
|
+
_args8 = arguments;
|
871
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
872
|
+
while (1) switch (_context8.prev = _context8.next) {
|
1032
873
|
case 0:
|
1033
|
-
s =
|
874
|
+
s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
|
1034
875
|
o = {
|
1035
876
|
body: t,
|
1036
877
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
1037
878
|
};
|
1038
|
-
|
879
|
+
_context8.next = 4;
|
1039
880
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
1040
881
|
case 4:
|
1041
|
-
_yield$RequestUtils$p2 =
|
882
|
+
_yield$RequestUtils$p2 = _context8.sent;
|
1042
883
|
a = _yield$RequestUtils$p2.body;
|
1043
884
|
l = _yield$RequestUtils$p2.headers;
|
1044
885
|
c = _yield$RequestUtils$p2.error;
|
1045
886
|
u = e.completionsHandlers.onFinish;
|
1046
887
|
if (!c) {
|
1047
|
-
|
888
|
+
_context8.next = 11;
|
1048
889
|
break;
|
1049
890
|
}
|
1050
|
-
return
|
891
|
+
return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
1051
892
|
case 11:
|
1052
|
-
if (!((f = e.requestSettings) != null && f.handler)) {
|
1053
|
-
_context12.next = 13;
|
1054
|
-
break;
|
1055
|
-
}
|
1056
|
-
return _context12.abrupt("return", CustomHandler.request(e, a, n));
|
1057
|
-
case 13:
|
1058
893
|
if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
|
1059
|
-
|
894
|
+
_context8.next = 13;
|
1060
895
|
break;
|
1061
896
|
}
|
1062
|
-
return
|
1063
|
-
case
|
897
|
+
return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
898
|
+
case 13:
|
1064
899
|
d = !0;
|
1065
|
-
fetch(((
|
1066
|
-
method: ((
|
900
|
+
fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
|
901
|
+
method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
|
1067
902
|
headers: l,
|
1068
903
|
body: s ? JSON.stringify(a) : a
|
1069
|
-
}).then(function (
|
1070
|
-
return d = !!
|
1071
|
-
}).then(function (
|
1072
|
-
return RequestUtils.processResponseByType(
|
904
|
+
}).then(function (m) {
|
905
|
+
return d = !!m.ok, m;
|
906
|
+
}).then(function (m) {
|
907
|
+
return RequestUtils.processResponseByType(m);
|
1073
908
|
}).then( /*#__PURE__*/function () {
|
1074
|
-
var
|
1075
|
-
var
|
1076
|
-
return _regeneratorRuntime().wrap(function
|
1077
|
-
while (1) switch (
|
909
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(m) {
|
910
|
+
var y, x, v, g;
|
911
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
912
|
+
while (1) switch (_context7.prev = _context7.next) {
|
1078
913
|
case 0:
|
1079
914
|
if (e.extractResultData) {
|
1080
|
-
|
915
|
+
_context7.next = 2;
|
1081
916
|
break;
|
1082
917
|
}
|
1083
|
-
return
|
918
|
+
return _context7.abrupt("return");
|
1084
919
|
case 2:
|
1085
|
-
|
1086
|
-
return (
|
920
|
+
_context7.next = 4;
|
921
|
+
return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
|
1087
922
|
case 4:
|
1088
|
-
|
1089
|
-
if (
|
1090
|
-
|
923
|
+
_context7.t0 = _context7.sent;
|
924
|
+
if (_context7.t0) {
|
925
|
+
_context7.next = 7;
|
1091
926
|
break;
|
1092
927
|
}
|
1093
|
-
|
928
|
+
_context7.t0 = m;
|
1094
929
|
case 7:
|
1095
|
-
v =
|
1096
|
-
|
930
|
+
v = _context7.t0;
|
931
|
+
_context7.next = 10;
|
1097
932
|
return e.extractResultData(v);
|
1098
933
|
case 10:
|
1099
|
-
|
934
|
+
g = _context7.sent;
|
1100
935
|
if (d) {
|
1101
|
-
|
936
|
+
_context7.next = 13;
|
1102
937
|
break;
|
1103
938
|
}
|
1104
|
-
throw
|
939
|
+
throw m;
|
1105
940
|
case 13:
|
1106
|
-
if (!(!
|
1107
|
-
|
941
|
+
if (!(!g || _typeof(g) != "object")) {
|
942
|
+
_context7.next = 15;
|
1108
943
|
break;
|
1109
944
|
}
|
1110
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(
|
945
|
+
throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
|
1111
946
|
case 15:
|
1112
|
-
|
947
|
+
g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
|
1113
948
|
case 16:
|
1114
949
|
case "end":
|
1115
|
-
return
|
950
|
+
return _context7.stop();
|
1116
951
|
}
|
1117
|
-
},
|
952
|
+
}, _callee7);
|
1118
953
|
}));
|
1119
|
-
return function (
|
1120
|
-
return
|
954
|
+
return function (_x14) {
|
955
|
+
return _ref2.apply(this, arguments);
|
1121
956
|
};
|
1122
|
-
}())["catch"](function (
|
1123
|
-
RequestUtils.displayError(n,
|
957
|
+
}())["catch"](function (m) {
|
958
|
+
RequestUtils.displayError(n, m), u();
|
1124
959
|
});
|
1125
|
-
case
|
960
|
+
case 15:
|
1126
961
|
case "end":
|
1127
|
-
return
|
962
|
+
return _context8.stop();
|
1128
963
|
}
|
1129
|
-
},
|
964
|
+
}, _callee8);
|
1130
965
|
}));
|
1131
|
-
function request(
|
1132
|
-
return
|
966
|
+
function request(_x11, _x12, _x13) {
|
967
|
+
return _request2.apply(this, arguments);
|
1133
968
|
}
|
1134
969
|
return request;
|
1135
970
|
}() // prettier-ignore
|
@@ -1141,44 +976,44 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1141
976
|
fetch(t, n).then(function (a) {
|
1142
977
|
return a.json();
|
1143
978
|
}).then( /*#__PURE__*/function () {
|
1144
|
-
var
|
979
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
|
1145
980
|
var c, u, l;
|
1146
|
-
return _regeneratorRuntime().wrap(function
|
1147
|
-
while (1) switch (
|
981
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
982
|
+
while (1) switch (_context9.prev = _context9.next) {
|
1148
983
|
case 0:
|
1149
984
|
if (e.extractPollResultData) {
|
1150
|
-
|
985
|
+
_context9.next = 2;
|
1151
986
|
break;
|
1152
987
|
}
|
1153
|
-
return
|
988
|
+
return _context9.abrupt("return");
|
1154
989
|
case 2:
|
1155
|
-
|
1156
|
-
|
990
|
+
_context9.t0 = e;
|
991
|
+
_context9.next = 5;
|
1157
992
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
1158
993
|
case 5:
|
1159
|
-
|
1160
|
-
if (
|
1161
|
-
|
994
|
+
_context9.t1 = _context9.sent;
|
995
|
+
if (_context9.t1) {
|
996
|
+
_context9.next = 8;
|
1162
997
|
break;
|
1163
998
|
}
|
1164
|
-
|
999
|
+
_context9.t1 = a;
|
1165
1000
|
case 8:
|
1166
|
-
|
1167
|
-
|
1168
|
-
return
|
1001
|
+
_context9.t2 = _context9.t1;
|
1002
|
+
_context9.next = 11;
|
1003
|
+
return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
|
1169
1004
|
case 11:
|
1170
|
-
l =
|
1005
|
+
l = _context9.sent;
|
1171
1006
|
l.timeoutMS ? setTimeout(function () {
|
1172
1007
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1173
1008
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1174
1009
|
case 13:
|
1175
1010
|
case "end":
|
1176
|
-
return
|
1011
|
+
return _context9.stop();
|
1177
1012
|
}
|
1178
|
-
},
|
1013
|
+
}, _callee9);
|
1179
1014
|
}));
|
1180
|
-
return function (
|
1181
|
-
return
|
1015
|
+
return function (_x15) {
|
1016
|
+
return _ref3.apply(this, arguments);
|
1182
1017
|
};
|
1183
1018
|
}())["catch"](function (a) {
|
1184
1019
|
RequestUtils.displayError(s, a), o();
|
@@ -1188,9 +1023,9 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1188
1023
|
}, {
|
1189
1024
|
key: "poll",
|
1190
1025
|
value: function () {
|
1191
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1026
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
|
1192
1027
|
var s,
|
1193
|
-
|
1028
|
+
f,
|
1194
1029
|
b,
|
1195
1030
|
m,
|
1196
1031
|
o,
|
@@ -1201,42 +1036,42 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1201
1036
|
u,
|
1202
1037
|
d,
|
1203
1038
|
h,
|
1204
|
-
|
1205
|
-
|
1206
|
-
return _regeneratorRuntime().wrap(function
|
1207
|
-
while (1) switch (
|
1039
|
+
p,
|
1040
|
+
_args10 = arguments;
|
1041
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
1042
|
+
while (1) switch (_context10.prev = _context10.next) {
|
1208
1043
|
case 0:
|
1209
|
-
s =
|
1044
|
+
s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
|
1210
1045
|
o = {
|
1211
1046
|
body: t,
|
1212
|
-
headers: (
|
1047
|
+
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
1213
1048
|
};
|
1214
|
-
|
1049
|
+
_context10.next = 4;
|
1215
1050
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
1216
1051
|
case 4:
|
1217
|
-
_yield$RequestUtils$p3 =
|
1052
|
+
_yield$RequestUtils$p3 = _context10.sent;
|
1218
1053
|
a = _yield$RequestUtils$p3.body;
|
1219
1054
|
l = _yield$RequestUtils$p3.headers;
|
1220
1055
|
c = _yield$RequestUtils$p3.error;
|
1221
1056
|
if (!c) {
|
1222
|
-
|
1057
|
+
_context10.next = 10;
|
1223
1058
|
break;
|
1224
1059
|
}
|
1225
|
-
return
|
1060
|
+
return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1226
1061
|
case 10:
|
1227
|
-
u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a,
|
1062
|
+
u = ((b = e.requestSettings) == null ? void 0 : b.url) || e.url || "", d = ((m = e.requestSettings) == null ? void 0 : m.method) || "POST", h = s ? JSON.stringify(a) : a, p = {
|
1228
1063
|
method: d,
|
1229
1064
|
body: h,
|
1230
1065
|
headers: l
|
1231
1066
|
};
|
1232
|
-
HTTPRequest.executePollRequest(e, u,
|
1067
|
+
HTTPRequest.executePollRequest(e, u, p, n);
|
1233
1068
|
case 12:
|
1234
1069
|
case "end":
|
1235
|
-
return
|
1070
|
+
return _context10.stop();
|
1236
1071
|
}
|
1237
|
-
},
|
1072
|
+
}, _callee10);
|
1238
1073
|
}));
|
1239
|
-
function poll(
|
1074
|
+
function poll(_x16, _x17, _x18) {
|
1240
1075
|
return _poll.apply(this, arguments);
|
1241
1076
|
}
|
1242
1077
|
return poll;
|
@@ -1277,9 +1112,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
|
|
1277
1112
|
var n = 0,
|
1278
1113
|
s = e.length - 1;
|
1279
1114
|
for (s; s >= 0; s -= 1) {
|
1280
|
-
var
|
1281
|
-
if (
|
1282
|
-
e[s].text =
|
1115
|
+
var a = (o = e[s]) == null ? void 0 : o.text;
|
1116
|
+
if (a !== void 0 && (n += a.length, n > t)) {
|
1117
|
+
e[s].text = a.substring(0, a.length - (n - t));
|
1283
1118
|
break;
|
1284
1119
|
}
|
1285
1120
|
}
|
@@ -1329,19 +1164,16 @@ var Websocket = /*#__PURE__*/function () {
|
|
1329
1164
|
value: function createConnection(e, t) {
|
1330
1165
|
if (!document.body.contains(e.deepChat)) return;
|
1331
1166
|
var n = e.requestSettings.websocket;
|
1332
|
-
if (n) {
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
} catch (s) {
|
1343
|
-
console.error(s), Websocket.retryConnection(e, t);
|
1344
|
-
}
|
1167
|
+
if (n) try {
|
1168
|
+
var s = typeof n != "boolean" ? n : void 0,
|
1169
|
+
o = new WebSocket(e.requestSettings.url || "", s);
|
1170
|
+
e.websocket = o, e.websocket.onopen = function () {
|
1171
|
+
t.removeError(), e.websocket && _typeof(e.websocket) == "object" && Websocket.assignListeners(e, o, t);
|
1172
|
+
}, e.websocket.onerror = function (a) {
|
1173
|
+
console.error(a), Websocket.retryConnection(e, t);
|
1174
|
+
};
|
1175
|
+
} catch (s) {
|
1176
|
+
console.error(s), Websocket.retryConnection(e, t);
|
1345
1177
|
}
|
1346
1178
|
}
|
1347
1179
|
}, {
|
@@ -1355,53 +1187,53 @@ var Websocket = /*#__PURE__*/function () {
|
|
1355
1187
|
key: "assignListeners",
|
1356
1188
|
value: function assignListeners(e, t, n) {
|
1357
1189
|
t.onmessage = /*#__PURE__*/function () {
|
1358
|
-
var
|
1190
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
|
1359
1191
|
var o, a, l, c, u;
|
1360
|
-
return _regeneratorRuntime().wrap(function
|
1361
|
-
while (1) switch (
|
1192
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1193
|
+
while (1) switch (_context11.prev = _context11.next) {
|
1362
1194
|
case 0:
|
1363
1195
|
if (!e.extractResultData) {
|
1364
|
-
|
1196
|
+
_context11.next = 20;
|
1365
1197
|
break;
|
1366
1198
|
}
|
1367
|
-
|
1199
|
+
_context11.prev = 1;
|
1368
1200
|
l = JSON.parse(s.data);
|
1369
|
-
|
1201
|
+
_context11.next = 5;
|
1370
1202
|
return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
|
1371
1203
|
case 5:
|
1372
|
-
|
1373
|
-
if (
|
1374
|
-
|
1204
|
+
_context11.t0 = _context11.sent;
|
1205
|
+
if (_context11.t0) {
|
1206
|
+
_context11.next = 8;
|
1375
1207
|
break;
|
1376
1208
|
}
|
1377
|
-
|
1209
|
+
_context11.t0 = l;
|
1378
1210
|
case 8:
|
1379
|
-
c =
|
1380
|
-
|
1211
|
+
c = _context11.t0;
|
1212
|
+
_context11.next = 11;
|
1381
1213
|
return e.extractResultData(c);
|
1382
1214
|
case 11:
|
1383
|
-
u =
|
1215
|
+
u = _context11.sent;
|
1384
1216
|
if (!(!u || _typeof(u) != "object")) {
|
1385
|
-
|
1217
|
+
_context11.next = 14;
|
1386
1218
|
break;
|
1387
1219
|
}
|
1388
1220
|
throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
1389
1221
|
case 14:
|
1390
1222
|
e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
|
1391
|
-
|
1223
|
+
_context11.next = 20;
|
1392
1224
|
break;
|
1393
1225
|
case 17:
|
1394
|
-
|
1395
|
-
|
1396
|
-
RequestUtils.displayError(n,
|
1226
|
+
_context11.prev = 17;
|
1227
|
+
_context11.t1 = _context11["catch"](1);
|
1228
|
+
RequestUtils.displayError(n, _context11.t1, "Error in server message");
|
1397
1229
|
case 20:
|
1398
1230
|
case "end":
|
1399
|
-
return
|
1231
|
+
return _context11.stop();
|
1400
1232
|
}
|
1401
|
-
},
|
1233
|
+
}, _callee11, null, [[1, 17]]);
|
1402
1234
|
}));
|
1403
|
-
return function (
|
1404
|
-
return
|
1235
|
+
return function (_x19) {
|
1236
|
+
return _ref4.apply(this, arguments);
|
1405
1237
|
};
|
1406
1238
|
}(), t.onclose = function () {
|
1407
1239
|
console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
|
@@ -1410,7 +1242,7 @@ var Websocket = /*#__PURE__*/function () {
|
|
1410
1242
|
}, {
|
1411
1243
|
key: "sendWebsocket",
|
1412
1244
|
value: function () {
|
1413
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1245
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
|
1414
1246
|
var s,
|
1415
1247
|
d,
|
1416
1248
|
h,
|
@@ -1420,55 +1252,55 @@ var Websocket = /*#__PURE__*/function () {
|
|
1420
1252
|
l,
|
1421
1253
|
c,
|
1422
1254
|
u,
|
1423
|
-
|
1424
|
-
return _regeneratorRuntime().wrap(function
|
1425
|
-
while (1) switch (
|
1255
|
+
_args12 = arguments;
|
1256
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1257
|
+
while (1) switch (_context12.prev = _context12.next) {
|
1426
1258
|
case 0:
|
1427
|
-
s =
|
1259
|
+
s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
1428
1260
|
o = e.websocket;
|
1429
1261
|
if (!(!o || o === "pending")) {
|
1430
|
-
|
1262
|
+
_context12.next = 4;
|
1431
1263
|
break;
|
1432
1264
|
}
|
1433
|
-
return
|
1265
|
+
return _context12.abrupt("return");
|
1434
1266
|
case 4:
|
1435
1267
|
a = {
|
1436
1268
|
body: t,
|
1437
1269
|
headers: (d = e.requestSettings) == null ? void 0 : d.headers
|
1438
1270
|
};
|
1439
|
-
|
1271
|
+
_context12.next = 7;
|
1440
1272
|
return RequestUtils.processRequestInterceptor(e.deepChat, a);
|
1441
1273
|
case 7:
|
1442
|
-
_yield$RequestUtils$p4 =
|
1274
|
+
_yield$RequestUtils$p4 = _context12.sent;
|
1443
1275
|
l = _yield$RequestUtils$p4.body;
|
1444
1276
|
c = _yield$RequestUtils$p4.error;
|
1445
1277
|
if (!c) {
|
1446
|
-
|
1278
|
+
_context12.next = 12;
|
1447
1279
|
break;
|
1448
1280
|
}
|
1449
|
-
return
|
1281
|
+
return _context12.abrupt("return", n.addNewErrorMessage("service", c));
|
1450
1282
|
case 12:
|
1451
1283
|
if (Websocket.isWebSocket(o)) {
|
1452
|
-
|
1284
|
+
_context12.next = 14;
|
1453
1285
|
break;
|
1454
1286
|
}
|
1455
|
-
return
|
1287
|
+
return _context12.abrupt("return", o.newUserMessage.listener(l));
|
1456
1288
|
case 14:
|
1457
1289
|
u = s ? JSON.stringify(l) : l;
|
1458
1290
|
if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1459
|
-
|
1291
|
+
_context12.next = 17;
|
1460
1292
|
break;
|
1461
1293
|
}
|
1462
|
-
return
|
1294
|
+
return _context12.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
|
1463
1295
|
case 17:
|
1464
1296
|
o.readyState === void 0 || o.readyState !== o.OPEN ? (console.error("Connection is not open"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error")) : o.send(JSON.stringify(u));
|
1465
1297
|
case 18:
|
1466
1298
|
case "end":
|
1467
|
-
return
|
1299
|
+
return _context12.stop();
|
1468
1300
|
}
|
1469
|
-
},
|
1301
|
+
}, _callee12);
|
1470
1302
|
}));
|
1471
|
-
function sendWebsocket(
|
1303
|
+
function sendWebsocket(_x20, _x21, _x22) {
|
1472
1304
|
return _sendWebsocket.apply(this, arguments);
|
1473
1305
|
}
|
1474
1306
|
return sendWebsocket;
|
@@ -1974,13 +1806,13 @@ function normalizeReference(r) {
|
|
1974
1806
|
return r.trim().replace(/\s+/g, " ").toUpperCase();
|
1975
1807
|
}
|
1976
1808
|
function parseReference(r, e, t, n) {
|
1977
|
-
var s, o, a, l, c, u, d, h,
|
1809
|
+
var s, o, a, l, c, u, d, h, p;
|
1978
1810
|
if (r.charCodeAt(0) !== 91 || r.indexOf("]:") === -1 || (s = new StateInline(r, e, t, n, []), o = parseLinkLabel(s, 0), o < 0 || r.charCodeAt(o + 1) !== 58)) return -1;
|
1979
1811
|
for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
1980
1812
|
if (!parseLinkDestination(s, a)) return -1;
|
1981
1813
|
for (d = s.linkContent, a = s.pos, u = a, a = a + 1; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
1982
1814
|
for (a < l && u !== a && parseLinkTitle(s, a) ? (h = s.linkContent, a = s.pos) : (h = "", a = u); a < l && s.src.charCodeAt(a) === 32;) a++;
|
1983
|
-
return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (
|
1815
|
+
return a < l && s.src.charCodeAt(a) !== 10 ? -1 : (p = normalizeReference(r.slice(1, o)), _typeof(n.references[p]) > "u" && (n.references[p] = {
|
1984
1816
|
title: h,
|
1985
1817
|
href: d
|
1986
1818
|
}), a);
|
@@ -2017,9 +1849,9 @@ function footnote_block(r) {
|
|
2017
1849
|
u,
|
2018
1850
|
d = 0,
|
2019
1851
|
h = !1,
|
2020
|
-
|
2021
|
-
if (r.env.footnotes && (r.tokens = r.tokens.filter(function (
|
2022
|
-
return
|
1852
|
+
p = {};
|
1853
|
+
if (r.env.footnotes && (r.tokens = r.tokens.filter(function (f) {
|
1854
|
+
return f.type === "footnote_reference_open" ? (h = !0, c = [], u = f.label, !1) : f.type === "footnote_reference_close" ? (h = !1, p[":" + u] = c, !1) : (h && c.push(f), !h);
|
2023
1855
|
}), !!r.env.footnotes.list)) {
|
2024
1856
|
for (a = r.env.footnotes.list, r.tokens.push({
|
2025
1857
|
type: "footnote_block_open",
|
@@ -2042,7 +1874,7 @@ function footnote_block(r) {
|
|
2042
1874
|
type: "paragraph_close",
|
2043
1875
|
tight: !1,
|
2044
1876
|
level: --d
|
2045
|
-
})) : a[e].label && (l =
|
1877
|
+
})) : a[e].label && (l = p[":" + a[e].label]), r.tokens = r.tokens.concat(l), r.tokens[r.tokens.length - 1].type === "paragraph_close" ? o = r.tokens.pop() : o = null, s = a[e].count > 0 ? a[e].count : 1, n = 0; n < s; n++) r.tokens.push({
|
2046
1878
|
type: "footnote_anchor",
|
2047
1879
|
id: e,
|
2048
1880
|
subId: n,
|
@@ -2075,15 +1907,15 @@ function abbr2(r) {
|
|
2075
1907
|
u,
|
2076
1908
|
d,
|
2077
1909
|
h,
|
2078
|
-
|
2079
|
-
|
1910
|
+
p,
|
1911
|
+
f = r.tokens;
|
2080
1912
|
if (r.env.abbreviations) {
|
2081
|
-
for (r.env.abbrRegExp || (
|
1913
|
+
for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
|
2082
1914
|
return b.substr(1);
|
2083
1915
|
}).sort(function (b, m) {
|
2084
1916
|
return m.length - b.length;
|
2085
|
-
}).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(
|
2086
|
-
for (s =
|
1917
|
+
}).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(p, "g")), d = r.env.abbrRegExp, t = 0, n = f.length; t < n; t++) if (f[t].type === "inline") {
|
1918
|
+
for (s = f[t].children, e = s.length - 1; e >= 0; e--) if (o = s[e], o.type === "text") {
|
2087
1919
|
for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
|
2088
1920
|
type: "text",
|
2089
1921
|
content: a.slice(c, h.index + h[1].length),
|
@@ -2104,7 +1936,7 @@ function abbr2(r) {
|
|
2104
1936
|
type: "text",
|
2105
1937
|
content: a.slice(c),
|
2106
1938
|
level: u
|
2107
|
-
}),
|
1939
|
+
}), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
|
2108
1940
|
}
|
2109
1941
|
}
|
2110
1942
|
}
|
@@ -2139,29 +1971,29 @@ function replaceAt(r, e, t) {
|
|
2139
1971
|
return r.substr(0, e) + t + r.substr(e + 1);
|
2140
1972
|
}
|
2141
1973
|
function smartquotes(r) {
|
2142
|
-
var e, t, n, s, o, a, l, c, u, d, h,
|
1974
|
+
var e, t, n, s, o, a, l, c, u, d, h, p, f, b, m, v, g;
|
2143
1975
|
if (r.options.typographer) {
|
2144
|
-
for (
|
2145
|
-
for (
|
2146
|
-
for (l =
|
2147
|
-
|
1976
|
+
for (g = [], m = r.tokens.length - 1; m >= 0; m--) if (r.tokens[m].type === "inline") {
|
1977
|
+
for (v = r.tokens[m].children, g.length = 0, e = 0; e < v.length; e++) if (t = v[e], !(t.type !== "text" || QUOTE_TEST_RE.test(t.text))) {
|
1978
|
+
for (l = v[e].level, f = g.length - 1; f >= 0 && !(g[f].level <= l); f--);
|
1979
|
+
g.length = f + 1, n = t.content, o = 0, a = n.length;
|
2148
1980
|
e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
|
2149
1981
|
if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
|
2150
1982
|
b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2151
1983
|
continue;
|
2152
1984
|
}
|
2153
|
-
if (h = !u,
|
2154
|
-
for (
|
2155
|
-
d =
|
1985
|
+
if (h = !u, p = !c, p) {
|
1986
|
+
for (f = g.length - 1; f >= 0 && (d = g[f], !(g[f].level < l)); f--) if (d.single === b && g[f].level === l) {
|
1987
|
+
d = g[f], b ? (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[2]), t.content = replaceAt(t.content, s.index, r.options.quotes[3])) : (v[d.token].content = replaceAt(v[d.token].content, d.pos, r.options.quotes[0]), t.content = replaceAt(t.content, s.index, r.options.quotes[1])), g.length = f;
|
2156
1988
|
continue e;
|
2157
1989
|
}
|
2158
1990
|
}
|
2159
|
-
h ?
|
1991
|
+
h ? g.push({
|
2160
1992
|
token: e,
|
2161
1993
|
pos: s.index,
|
2162
1994
|
single: b,
|
2163
1995
|
level: l
|
2164
|
-
}) :
|
1996
|
+
}) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2165
1997
|
}
|
2166
1998
|
}
|
2167
1999
|
}
|
@@ -2273,20 +2105,20 @@ function blockquote(r, e, t, n) {
|
|
2273
2105
|
u,
|
2274
2106
|
d,
|
2275
2107
|
h,
|
2276
|
-
f,
|
2277
2108
|
p,
|
2109
|
+
f,
|
2278
2110
|
b,
|
2279
2111
|
m = r.bMarks[e] + r.tShift[e],
|
2280
|
-
|
2281
|
-
if (m >
|
2112
|
+
v = r.eMarks[e];
|
2113
|
+
if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
|
2282
2114
|
if (n) return !0;
|
2283
|
-
for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m <
|
2115
|
+
for (r.src.charCodeAt(m) === 32 && m++, c = r.blkIndent, r.blkIndent = 0, l = [r.bMarks[e]], r.bMarks[e] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a = [r.tShift[e]], r.tShift[e] = m - r.bMarks[e], h = r.parser.ruler.getRules("blockquote"), s = e + 1; s < t && (m = r.bMarks[s] + r.tShift[s], v = r.eMarks[s], !(m >= v)); s++) {
|
2284
2116
|
if (r.src.charCodeAt(m++) === 62) {
|
2285
|
-
r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m <
|
2117
|
+
r.src.charCodeAt(m) === 32 && m++, l.push(r.bMarks[s]), r.bMarks[s] = m, m = m < v ? r.skipSpaces(m) : m, o = m >= v, a.push(r.tShift[s]), r.tShift[s] = m - r.bMarks[s];
|
2286
2118
|
continue;
|
2287
2119
|
}
|
2288
2120
|
if (o) break;
|
2289
|
-
for (b = !1,
|
2121
|
+
for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
|
2290
2122
|
b = !0;
|
2291
2123
|
break;
|
2292
2124
|
}
|
@@ -2300,7 +2132,7 @@ function blockquote(r, e, t, n) {
|
|
2300
2132
|
}), r.parser.tokenize(r, e, s), r.tokens.push({
|
2301
2133
|
type: "blockquote_close",
|
2302
2134
|
level: --r.level
|
2303
|
-
}), r.parentType = u, d[1] = r.line,
|
2135
|
+
}), r.parentType = u, d[1] = r.line, p = 0; p < a.length; p++) r.bMarks[p + e] = l[p], r.tShift[p + e] = a[p];
|
2304
2136
|
return r.blkIndent = c, !0;
|
2305
2137
|
}
|
2306
2138
|
function hr(r, e, t, n) {
|
@@ -2353,55 +2185,55 @@ function list(r, e, t, n) {
|
|
2353
2185
|
u,
|
2354
2186
|
d,
|
2355
2187
|
h,
|
2356
|
-
f,
|
2357
2188
|
p,
|
2189
|
+
f,
|
2358
2190
|
b,
|
2359
2191
|
m,
|
2360
|
-
g,
|
2361
2192
|
v,
|
2193
|
+
g,
|
2362
2194
|
y,
|
2363
|
-
S,
|
2364
|
-
E,
|
2365
2195
|
x,
|
2366
|
-
R = !0,
|
2367
|
-
C,
|
2368
2196
|
_,
|
2197
|
+
I,
|
2198
|
+
R = !0,
|
2199
|
+
w,
|
2200
|
+
S,
|
2369
2201
|
H,
|
2370
2202
|
F;
|
2371
|
-
if ((h = skipOrderedListMarker(r, e)) >= 0)
|
2203
|
+
if ((h = skipOrderedListMarker(r, e)) >= 0) v = !0;else if ((h = skipBulletListMarker(r, e)) >= 0) v = !1;else return !1;
|
2372
2204
|
if (r.level >= r.options.maxNesting) return !1;
|
2373
2205
|
if (m = r.src.charCodeAt(h - 1), n) return !0;
|
2374
|
-
for (y = r.tokens.length,
|
2206
|
+
for (y = r.tokens.length, v ? (d = r.bMarks[e] + r.tShift[e], b = Number(r.src.substr(d, h - d - 1)), r.tokens.push({
|
2375
2207
|
type: "ordered_list_open",
|
2376
2208
|
order: b,
|
2377
|
-
lines:
|
2209
|
+
lines: _ = [e, 0],
|
2378
2210
|
level: r.level++
|
2379
2211
|
})) : r.tokens.push({
|
2380
2212
|
type: "bullet_list_open",
|
2381
|
-
lines:
|
2213
|
+
lines: _ = [e, 0],
|
2382
2214
|
level: r.level++
|
2383
|
-
}), s = e,
|
2215
|
+
}), s = e, x = !1, w = r.parser.ruler.getRules("list"); s < t && (g = r.skipSpaces(h), p = r.eMarks[s], g >= p ? f = 1 : f = g - h, f > 4 && (f = 1), f < 1 && (f = 1), o = h - r.bMarks[s] + f, r.tokens.push({
|
2384
2216
|
type: "list_item_open",
|
2385
|
-
lines:
|
2217
|
+
lines: I = [e, 0],
|
2386
2218
|
level: r.level++
|
2387
|
-
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] =
|
2219
|
+
}), l = r.blkIndent, c = r.tight, a = r.tShift[e], u = r.parentType, r.tShift[e] = g - r.bMarks[e], r.blkIndent = o, r.tight = !0, r.parentType = "list", r.parser.tokenize(r, e, t, !0), (!r.tight || x) && (R = !1), x = r.line - e > 1 && r.isEmpty(r.line - 1), r.blkIndent = l, r.tShift[e] = a, r.tight = c, r.parentType = u, r.tokens.push({
|
2388
2220
|
type: "list_item_close",
|
2389
2221
|
level: --r.level
|
2390
|
-
}), s = e = r.line,
|
2391
|
-
for (F = !1,
|
2222
|
+
}), s = e = r.line, I[1] = s, g = r.bMarks[e], !(s >= t || r.isEmpty(s) || r.tShift[s] < r.blkIndent));) {
|
2223
|
+
for (F = !1, S = 0, H = w.length; S < H; S++) if (w[S](r, s, t, !0)) {
|
2392
2224
|
F = !0;
|
2393
2225
|
break;
|
2394
2226
|
}
|
2395
2227
|
if (F) break;
|
2396
|
-
if (
|
2228
|
+
if (v) {
|
2397
2229
|
if (h = skipOrderedListMarker(r, s), h < 0) break;
|
2398
2230
|
} else if (h = skipBulletListMarker(r, s), h < 0) break;
|
2399
2231
|
if (m !== r.src.charCodeAt(h - 1)) break;
|
2400
2232
|
}
|
2401
2233
|
return r.tokens.push({
|
2402
|
-
type:
|
2234
|
+
type: v ? "ordered_list_close" : "bullet_list_close",
|
2403
2235
|
level: --r.level
|
2404
|
-
}),
|
2236
|
+
}), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
|
2405
2237
|
}
|
2406
2238
|
function footnote(r, e, t, n) {
|
2407
2239
|
var s,
|
@@ -2513,21 +2345,21 @@ function getLine(r, e) {
|
|
2513
2345
|
return r.src.substr(t, n - t);
|
2514
2346
|
}
|
2515
2347
|
function table(r, e, t, n) {
|
2516
|
-
var s, o, a, l, c, u, d, h,
|
2348
|
+
var s, o, a, l, c, u, d, h, p, f, b;
|
2517
2349
|
if (e + 2 > t || (c = e + 1, r.tShift[c] < r.blkIndent) || (a = r.bMarks[c] + r.tShift[c], a >= r.eMarks[c]) || (s = r.src.charCodeAt(a), s !== 124 && s !== 45 && s !== 58) || (o = getLine(r, e + 1), !/^[-:| ]+$/.test(o)) || (u = o.split("|"), u <= 2)) return !1;
|
2518
2350
|
for (h = [], l = 0; l < u.length; l++) {
|
2519
|
-
if (
|
2351
|
+
if (p = u[l].trim(), !p) {
|
2520
2352
|
if (l === 0 || l === u.length - 1) continue;
|
2521
2353
|
return !1;
|
2522
2354
|
}
|
2523
|
-
if (!/^:?-+:?$/.test(
|
2524
|
-
|
2355
|
+
if (!/^:?-+:?$/.test(p)) return !1;
|
2356
|
+
p.charCodeAt(p.length - 1) === 58 ? h.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? h.push("left") : h.push("");
|
2525
2357
|
}
|
2526
2358
|
if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
|
2527
2359
|
if (n) return !0;
|
2528
2360
|
for (r.tokens.push({
|
2529
2361
|
type: "table_open",
|
2530
|
-
lines:
|
2362
|
+
lines: f = [e, 0],
|
2531
2363
|
level: r.level++
|
2532
2364
|
}), r.tokens.push({
|
2533
2365
|
type: "thead_open",
|
@@ -2590,7 +2422,7 @@ function table(r, e, t, n) {
|
|
2590
2422
|
}), r.tokens.push({
|
2591
2423
|
type: "table_close",
|
2592
2424
|
level: --r.level
|
2593
|
-
}),
|
2425
|
+
}), f[1] = b[1] = c, r.line = c, !0;
|
2594
2426
|
}
|
2595
2427
|
function skipMarker(r, e) {
|
2596
2428
|
var t,
|
@@ -2606,7 +2438,7 @@ function markTightParagraphs$1(r, e) {
|
|
2606
2438
|
for (t = e + 2, n = r.tokens.length - 2; t < n; t++) r.tokens[t].level === s && r.tokens[t].type === "paragraph_open" && (r.tokens[t + 2].tight = !0, r.tokens[t].tight = !0, t += 2);
|
2607
2439
|
}
|
2608
2440
|
function deflist(r, e, t, n) {
|
2609
|
-
var s, o, a, l, c, u, d, h,
|
2441
|
+
var s, o, a, l, c, u, d, h, p, f, b, m, v, g;
|
2610
2442
|
if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
|
2611
2443
|
if (d = e + 1, r.isEmpty(d) && ++d > t || r.tShift[d] < r.blkIndent || (s = skipMarker(r, d), s < 0) || r.level >= r.options.maxNesting) return !1;
|
2612
2444
|
u = r.tokens.length, r.tokens.push({
|
@@ -2615,7 +2447,7 @@ function deflist(r, e, t, n) {
|
|
2615
2447
|
level: r.level++
|
2616
2448
|
}), a = e, o = d;
|
2617
2449
|
e: for (;;) {
|
2618
|
-
for (
|
2450
|
+
for (g = !0, v = !1, r.tokens.push({
|
2619
2451
|
type: "dt_open",
|
2620
2452
|
lines: [a, a],
|
2621
2453
|
level: r.level++
|
@@ -2633,7 +2465,7 @@ function deflist(r, e, t, n) {
|
|
2633
2465
|
type: "dd_open",
|
2634
2466
|
lines: l = [d, 0],
|
2635
2467
|
level: r.level++
|
2636
|
-
}), m = r.tight,
|
2468
|
+
}), m = r.tight, p = r.ddIndent, h = r.blkIndent, b = r.tShift[o], f = r.parentType, r.blkIndent = r.ddIndent = r.tShift[o] + 2, r.tShift[o] = s - r.bMarks[o], r.tight = !0, r.parentType = "deflist", r.parser.tokenize(r, o, t, !0), (!r.tight || v) && (g = !1), v = r.line - o > 1 && r.isEmpty(r.line - 1), r.tShift[o] = b, r.tight = m, r.parentType = f, r.blkIndent = h, r.ddIndent = p, r.tokens.push({
|
2637
2469
|
type: "dd_close",
|
2638
2470
|
level: --r.level
|
2639
2471
|
}), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
|
@@ -2645,7 +2477,7 @@ function deflist(r, e, t, n) {
|
|
2645
2477
|
return r.tokens.push({
|
2646
2478
|
type: "dl_close",
|
2647
2479
|
level: --r.level
|
2648
|
-
}), c[1] = d, r.line = d,
|
2480
|
+
}), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
|
2649
2481
|
}
|
2650
2482
|
function paragraph(r, e) {
|
2651
2483
|
var t,
|
@@ -3010,21 +2842,21 @@ function links(r, e) {
|
|
3010
2842
|
u,
|
3011
2843
|
d = !1,
|
3012
2844
|
h = r.pos,
|
3013
|
-
|
3014
|
-
|
3015
|
-
b = r.src.charCodeAt(
|
3016
|
-
if (b === 33 && (d = !0, b = r.src.charCodeAt(++
|
3017
|
-
if (l = n + 1, l <
|
3018
|
-
for (l++; l <
|
3019
|
-
if (l >=
|
3020
|
-
for (
|
3021
|
-
if (l <
|
3022
|
-
if (l >=
|
2845
|
+
p = r.posMax,
|
2846
|
+
f = r.pos,
|
2847
|
+
b = r.src.charCodeAt(f);
|
2848
|
+
if (b === 33 && (d = !0, b = r.src.charCodeAt(++f)), b !== 91 || r.level >= r.options.maxNesting || (t = f + 1, n = parseLinkLabel(r, f), n < 0)) return !1;
|
2849
|
+
if (l = n + 1, l < p && r.src.charCodeAt(l) === 40) {
|
2850
|
+
for (l++; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
2851
|
+
if (l >= p) return !1;
|
2852
|
+
for (f = l, parseLinkDestination(r, l) ? (o = r.linkContent, l = r.pos) : o = "", f = l; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
2853
|
+
if (l < p && f !== l && parseLinkTitle(r, l)) for (a = r.linkContent, l = r.pos; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);else a = "";
|
2854
|
+
if (l >= p || r.src.charCodeAt(l) !== 41) return r.pos = h, !1;
|
3023
2855
|
l++;
|
3024
2856
|
} else {
|
3025
2857
|
if (r.linkLevel > 0) return !1;
|
3026
|
-
for (; l <
|
3027
|
-
if (l <
|
2858
|
+
for (; l < p && (u = r.src.charCodeAt(l), !(u !== 32 && u !== 10)); l++);
|
2859
|
+
if (l < p && r.src.charCodeAt(l) === 91 && (f = l + 1, l = parseLinkLabel(r, l), l >= 0 ? s = r.src.slice(f, l++) : l = f - 1), s || (_typeof(s) > "u" && (l = n + 1), s = r.src.slice(t, n)), c = r.env.references[normalizeReference(s)], !c) return r.pos = h, !1;
|
3028
2860
|
o = c.href, a = c.title;
|
3029
2861
|
}
|
3030
2862
|
return e || (r.pos = t, r.posMax = n, d ? r.push({
|
@@ -3041,7 +2873,7 @@ function links(r, e) {
|
|
3041
2873
|
}), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
|
3042
2874
|
type: "link_close",
|
3043
2875
|
level: --r.level
|
3044
|
-
}))), r.pos = l, r.posMax =
|
2876
|
+
}))), r.pos = l, r.posMax = p, !0;
|
3045
2877
|
}
|
3046
2878
|
function footnote_inline(r, e) {
|
3047
2879
|
var t,
|
@@ -3426,10 +3258,10 @@ var SetFileTypes = /*#__PURE__*/function () {
|
|
3426
3258
|
key: "processMixedFiles",
|
3427
3259
|
value: function processMixedFiles(e, t, n) {
|
3428
3260
|
if (n) {
|
3429
|
-
var
|
3261
|
+
var s = {
|
3430
3262
|
acceptedFormats: ""
|
3431
3263
|
};
|
3432
|
-
e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings,
|
3264
|
+
e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
|
3433
3265
|
}
|
3434
3266
|
}
|
3435
3267
|
// needs to be set after audio to overwrite maxNumberOfFiles
|
@@ -3437,12 +3269,12 @@ var SetFileTypes = /*#__PURE__*/function () {
|
|
3437
3269
|
}, {
|
3438
3270
|
key: "processMicrophone",
|
3439
3271
|
value: function processMicrophone(e, t, n, s) {
|
3440
|
-
var _c$files,
|
3441
|
-
var l, c, u, d, h,
|
3272
|
+
var _c$files, _p$maxNumberOfFiles;
|
3273
|
+
var l, c, u, d, h, p;
|
3442
3274
|
var a = _objectSpread({
|
3443
3275
|
acceptedFormats: "audio/*"
|
3444
3276
|
}, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
|
3445
|
-
n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((
|
3277
|
+
n && (navigator.mediaDevices.getUserMedia !== void 0 ? (e.recordAudio = SetFileTypes.parseConfig(e.requestSettings, a, t, n), _typeof(n) == "object" && n.files && ((_c$files = (c = e.recordAudio).files) !== null && _c$files !== void 0 ? _c$files : c.files = {}, e.recordAudio.files.format = (u = n.files) == null ? void 0 : u.format, e.recordAudio.files.maxDurationSeconds = (d = n.files) == null ? void 0 : d.maxDurationSeconds, (h = e.fileTypes.audio) != null && h.files && ((_p$maxNumberOfFiles = (p = e.fileTypes.audio.files).maxNumberOfFiles) !== null && _p$maxNumberOfFiles !== void 0 ? _p$maxNumberOfFiles : p.maxNumberOfFiles = n.files.maxNumberOfFiles))) : s || (e.fileTypes.audio = SetFileTypes.parseConfig(e.requestSettings, a, t, n)));
|
3446
3278
|
}
|
3447
3279
|
// prettier-ignore
|
3448
3280
|
}, {
|
@@ -3528,11 +3360,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3528
3360
|
}, {
|
3529
3361
|
key: "callServiceAPI",
|
3530
3362
|
value: function () {
|
3531
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3363
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
|
3532
3364
|
var _c$headers, _u$ContentType;
|
3533
3365
|
var l, c, u, d, s, o, a;
|
3534
|
-
return _regeneratorRuntime().wrap(function
|
3535
|
-
while (1) switch (
|
3366
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
3367
|
+
while (1) switch (_context13.prev = _context13.next) {
|
3536
3368
|
case 0:
|
3537
3369
|
s = _objectSpread({
|
3538
3370
|
messages: t
|
@@ -3541,26 +3373,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3541
3373
|
(l = this.requestSettings.headers) != null && l["Content-Type"] || ((_c$headers = (c = this.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_u$ContentType = (u = this.requestSettings.headers)["Content-Type"]) !== null && _u$ContentType !== void 0 ? _u$ContentType : u["Content-Type"] = "application/json", o = !0);
|
3542
3374
|
a = this.deepChat.stream;
|
3543
3375
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3544
|
-
|
3376
|
+
_context13.next = 9;
|
3545
3377
|
break;
|
3546
3378
|
}
|
3547
|
-
|
3379
|
+
_context13.next = 7;
|
3548
3380
|
return Stream.request(this, s, e);
|
3549
3381
|
case 7:
|
3550
|
-
|
3382
|
+
_context13.next = 11;
|
3551
3383
|
break;
|
3552
3384
|
case 9:
|
3553
|
-
|
3385
|
+
_context13.next = 11;
|
3554
3386
|
return HTTPRequest.request(this, s, e);
|
3555
3387
|
case 11:
|
3556
3388
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3557
3389
|
case 12:
|
3558
3390
|
case "end":
|
3559
|
-
return
|
3391
|
+
return _context13.stop();
|
3560
3392
|
}
|
3561
|
-
},
|
3393
|
+
}, _callee13, this);
|
3562
3394
|
}));
|
3563
|
-
function callServiceAPI(
|
3395
|
+
function callServiceAPI(_x23, _x24, _x25) {
|
3564
3396
|
return _callServiceAPI.apply(this, arguments);
|
3565
3397
|
}
|
3566
3398
|
return callServiceAPI;
|
@@ -3568,24 +3400,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3568
3400
|
}, {
|
3569
3401
|
key: "callApiWithFiles",
|
3570
3402
|
value: function () {
|
3571
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3403
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
|
3572
3404
|
var o, a, l;
|
3573
|
-
return _regeneratorRuntime().wrap(function
|
3574
|
-
while (1) switch (
|
3405
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
3406
|
+
while (1) switch (_context14.prev = _context14.next) {
|
3575
3407
|
case 0:
|
3576
3408
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3577
3409
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3578
|
-
|
3410
|
+
_context14.next = 4;
|
3579
3411
|
return HTTPRequest.request(this, o, t, !1);
|
3580
3412
|
case 4:
|
3581
3413
|
this.requestSettings = a;
|
3582
3414
|
case 5:
|
3583
3415
|
case "end":
|
3584
|
-
return
|
3416
|
+
return _context14.stop();
|
3585
3417
|
}
|
3586
|
-
},
|
3418
|
+
}, _callee14, this);
|
3587
3419
|
}));
|
3588
|
-
function callApiWithFiles(
|
3420
|
+
function callApiWithFiles(_x26, _x27, _x28, _x29) {
|
3589
3421
|
return _callApiWithFiles.apply(this, arguments);
|
3590
3422
|
}
|
3591
3423
|
return callApiWithFiles;
|
@@ -3593,31 +3425,31 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3593
3425
|
}, {
|
3594
3426
|
key: "callAPI",
|
3595
3427
|
value: function () {
|
3596
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3597
|
-
var n,
|
3598
|
-
return _regeneratorRuntime().wrap(function
|
3599
|
-
while (1) switch (
|
3428
|
+
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(e, t) {
|
3429
|
+
var n, s;
|
3430
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
3431
|
+
while (1) switch (_context15.prev = _context15.next) {
|
3600
3432
|
case 0:
|
3601
3433
|
if (this.requestSettings) {
|
3602
|
-
|
3434
|
+
_context15.next = 2;
|
3603
3435
|
break;
|
3604
3436
|
}
|
3605
3437
|
throw new Error("Request settings have not been set up");
|
3606
3438
|
case 2:
|
3607
3439
|
n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
|
3608
3440
|
if (this.requestSettings.websocket) {
|
3609
|
-
|
3441
|
+
s = _objectSpread({
|
3610
3442
|
messages: n
|
3611
3443
|
}, this.rawBody);
|
3612
|
-
Websocket.sendWebsocket(this,
|
3444
|
+
Websocket.sendWebsocket(this, s, t, !1);
|
3613
3445
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3614
3446
|
case 4:
|
3615
3447
|
case "end":
|
3616
|
-
return
|
3448
|
+
return _context15.stop();
|
3617
3449
|
}
|
3618
|
-
},
|
3450
|
+
}, _callee15, this);
|
3619
3451
|
}));
|
3620
|
-
function callAPI(
|
3452
|
+
function callAPI(_x30, _x31) {
|
3621
3453
|
return _callAPI.apply(this, arguments);
|
3622
3454
|
}
|
3623
3455
|
return callAPI;
|
@@ -3626,24 +3458,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3626
3458
|
}, {
|
3627
3459
|
key: "extractResultData",
|
3628
3460
|
value: function () {
|
3629
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3630
|
-
return _regeneratorRuntime().wrap(function
|
3631
|
-
while (1) switch (
|
3461
|
+
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(e) {
|
3462
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
3463
|
+
while (1) switch (_context16.prev = _context16.next) {
|
3632
3464
|
case 0:
|
3633
3465
|
if (!e.error) {
|
3634
|
-
|
3466
|
+
_context16.next = 2;
|
3635
3467
|
break;
|
3636
3468
|
}
|
3637
3469
|
throw e.error;
|
3638
3470
|
case 2:
|
3639
|
-
return
|
3471
|
+
return _context16.abrupt("return", e.result ? (console.error("The {result: ....} response object type is deprecated since version 1.3.0."), console.error("Please change to using the new response object: https://deepchat.dev/docs/connect#Response"), e.result) : e);
|
3640
3472
|
case 3:
|
3641
3473
|
case "end":
|
3642
|
-
return
|
3474
|
+
return _context16.stop();
|
3643
3475
|
}
|
3644
|
-
},
|
3476
|
+
}, _callee16);
|
3645
3477
|
}));
|
3646
|
-
function extractResultData(
|
3478
|
+
function extractResultData(_x32) {
|
3647
3479
|
return _extractResultData.apply(this, arguments);
|
3648
3480
|
}
|
3649
3481
|
return extractResultData;
|
@@ -3860,8 +3692,8 @@ var InsertKeyView = /*#__PURE__*/function () {
|
|
3860
3692
|
n.id = "insert-key-help-text-contents";
|
3861
3693
|
var s = InsertKeyView.createFailText();
|
3862
3694
|
if (n.appendChild(s), e) {
|
3863
|
-
var
|
3864
|
-
n.appendChild(
|
3695
|
+
var a = InsertKeyView.createHelpLink(e);
|
3696
|
+
n.appendChild(a);
|
3865
3697
|
}
|
3866
3698
|
var o = InsertKeyView.createCautionText();
|
3867
3699
|
return n.appendChild(o), t.appendChild(n), {
|
@@ -4007,13 +3839,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
4007
3839
|
}, {
|
4008
3840
|
key: "callServiceAPI",
|
4009
3841
|
value: function () {
|
4010
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3842
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
|
4011
3843
|
var s;
|
4012
|
-
return _regeneratorRuntime().wrap(function
|
4013
|
-
while (1) switch (
|
3844
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3845
|
+
while (1) switch (_context17.prev = _context17.next) {
|
4014
3846
|
case 0:
|
4015
3847
|
if (this.requestSettings) {
|
4016
|
-
|
3848
|
+
_context17.next = 2;
|
4017
3849
|
break;
|
4018
3850
|
}
|
4019
3851
|
throw new Error("Request settings have not been set up");
|
@@ -4022,11 +3854,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
4022
3854
|
HTTPRequest.request(this, s, e);
|
4023
3855
|
case 4:
|
4024
3856
|
case "end":
|
4025
|
-
return
|
3857
|
+
return _context17.stop();
|
4026
3858
|
}
|
4027
|
-
},
|
3859
|
+
}, _callee17, this);
|
4028
3860
|
}));
|
4029
|
-
function callServiceAPI(
|
3861
|
+
function callServiceAPI(_x33, _x34, _x35) {
|
4030
3862
|
return _callServiceAPI2.apply(this, arguments);
|
4031
3863
|
}
|
4032
3864
|
return callServiceAPI;
|
@@ -4055,18 +3887,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
4055
3887
|
}, {
|
4056
3888
|
key: "callServiceAPI",
|
4057
3889
|
value: function () {
|
4058
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4059
|
-
return _regeneratorRuntime().wrap(function
|
4060
|
-
while (1) switch (
|
3890
|
+
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(e, t, n) {
|
3891
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
3892
|
+
while (1) switch (_context18.prev = _context18.next) {
|
4061
3893
|
case 0:
|
4062
3894
|
if (this.requestSettings) {
|
4063
|
-
|
3895
|
+
_context18.next = 2;
|
4064
3896
|
break;
|
4065
3897
|
}
|
4066
3898
|
throw new Error("Request settings have not been set up");
|
4067
3899
|
case 2:
|
4068
3900
|
if (n != null && n[0]) {
|
4069
|
-
|
3901
|
+
_context18.next = 4;
|
4070
3902
|
break;
|
4071
3903
|
}
|
4072
3904
|
throw new Error("No file was added");
|
@@ -4074,11 +3906,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
4074
3906
|
HTTPRequest.poll(this, n[0], e, !1);
|
4075
3907
|
case 5:
|
4076
3908
|
case "end":
|
4077
|
-
return
|
3909
|
+
return _context18.stop();
|
4078
3910
|
}
|
4079
|
-
},
|
3911
|
+
}, _callee18, this);
|
4080
3912
|
}));
|
4081
|
-
function callServiceAPI(
|
3913
|
+
function callServiceAPI(_x36, _x37, _x38) {
|
4082
3914
|
return _callServiceAPI3.apply(this, arguments);
|
4083
3915
|
}
|
4084
3916
|
return callServiceAPI;
|
@@ -4107,35 +3939,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4107
3939
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
4108
3940
|
key: "extractPollResultData",
|
4109
3941
|
value: function () {
|
4110
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3942
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
|
4111
3943
|
var t;
|
4112
|
-
return _regeneratorRuntime().wrap(function
|
4113
|
-
while (1) switch (
|
3944
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3945
|
+
while (1) switch (_context19.prev = _context19.next) {
|
4114
3946
|
case 0:
|
4115
3947
|
if (!e.estimated_time) {
|
4116
|
-
|
3948
|
+
_context19.next = 2;
|
4117
3949
|
break;
|
4118
3950
|
}
|
4119
|
-
return
|
3951
|
+
return _context19.abrupt("return", {
|
4120
3952
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4121
3953
|
});
|
4122
3954
|
case 2:
|
4123
3955
|
if (!e.error) {
|
4124
|
-
|
3956
|
+
_context19.next = 4;
|
4125
3957
|
break;
|
4126
3958
|
}
|
4127
3959
|
throw e.error;
|
4128
3960
|
case 4:
|
4129
|
-
return
|
3961
|
+
return _context19.abrupt("return", {
|
4130
3962
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4131
3963
|
});
|
4132
3964
|
case 5:
|
4133
3965
|
case "end":
|
4134
|
-
return
|
3966
|
+
return _context19.stop();
|
4135
3967
|
}
|
4136
|
-
},
|
3968
|
+
}, _callee19);
|
4137
3969
|
}));
|
4138
|
-
function extractPollResultData(
|
3970
|
+
function extractPollResultData(_x39) {
|
4139
3971
|
return _extractPollResultData.apply(this, arguments);
|
4140
3972
|
}
|
4141
3973
|
return extractPollResultData;
|
@@ -4158,35 +3990,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4158
3990
|
_createClass(HuggingFaceImageClassificationIO, [{
|
4159
3991
|
key: "extractPollResultData",
|
4160
3992
|
value: function () {
|
4161
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3993
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
|
4162
3994
|
var t;
|
4163
|
-
return _regeneratorRuntime().wrap(function
|
4164
|
-
while (1) switch (
|
3995
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3996
|
+
while (1) switch (_context20.prev = _context20.next) {
|
4165
3997
|
case 0:
|
4166
3998
|
if (!e.estimated_time) {
|
4167
|
-
|
3999
|
+
_context20.next = 2;
|
4168
4000
|
break;
|
4169
4001
|
}
|
4170
|
-
return
|
4002
|
+
return _context20.abrupt("return", {
|
4171
4003
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4172
4004
|
});
|
4173
4005
|
case 2:
|
4174
4006
|
if (!e.error) {
|
4175
|
-
|
4007
|
+
_context20.next = 4;
|
4176
4008
|
break;
|
4177
4009
|
}
|
4178
4010
|
throw e.error;
|
4179
4011
|
case 4:
|
4180
|
-
return
|
4012
|
+
return _context20.abrupt("return", {
|
4181
4013
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4182
4014
|
});
|
4183
4015
|
case 5:
|
4184
4016
|
case "end":
|
4185
|
-
return
|
4017
|
+
return _context20.stop();
|
4186
4018
|
}
|
4187
|
-
},
|
4019
|
+
}, _callee20);
|
4188
4020
|
}));
|
4189
|
-
function extractPollResultData(
|
4021
|
+
function extractPollResultData(_x40) {
|
4190
4022
|
return _extractPollResultData2.apply(this, arguments);
|
4191
4023
|
}
|
4192
4024
|
return extractPollResultData;
|
@@ -4271,19 +4103,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4271
4103
|
}, {
|
4272
4104
|
key: "callServiceAPI",
|
4273
4105
|
value: function () {
|
4274
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4106
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
|
4275
4107
|
var s;
|
4276
|
-
return _regeneratorRuntime().wrap(function
|
4277
|
-
while (1) switch (
|
4108
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
4109
|
+
while (1) switch (_context21.prev = _context21.next) {
|
4278
4110
|
case 0:
|
4279
4111
|
if (this.requestSettings) {
|
4280
|
-
|
4112
|
+
_context21.next = 2;
|
4281
4113
|
break;
|
4282
4114
|
}
|
4283
4115
|
throw new Error("Request settings have not been set up");
|
4284
4116
|
case 2:
|
4285
4117
|
if (n) {
|
4286
|
-
|
4118
|
+
_context21.next = 4;
|
4287
4119
|
break;
|
4288
4120
|
}
|
4289
4121
|
throw new Error("Image was not found");
|
@@ -4292,11 +4124,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4292
4124
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4293
4125
|
case 6:
|
4294
4126
|
case "end":
|
4295
|
-
return
|
4127
|
+
return _context21.stop();
|
4296
4128
|
}
|
4297
|
-
},
|
4129
|
+
}, _callee21, this);
|
4298
4130
|
}));
|
4299
|
-
function callServiceAPI(
|
4131
|
+
function callServiceAPI(_x41, _x42, _x43) {
|
4300
4132
|
return _callServiceAPI4.apply(this, arguments);
|
4301
4133
|
}
|
4302
4134
|
return callServiceAPI;
|
@@ -4304,17 +4136,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4304
4136
|
}, {
|
4305
4137
|
key: "extractResultData",
|
4306
4138
|
value: function () {
|
4307
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4308
|
-
return _regeneratorRuntime().wrap(function
|
4309
|
-
while (1) switch (
|
4139
|
+
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(e) {
|
4140
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
4141
|
+
while (1) switch (_context22.prev = _context22.next) {
|
4310
4142
|
case 0:
|
4311
4143
|
if (!e.message) {
|
4312
|
-
|
4144
|
+
_context22.next = 2;
|
4313
4145
|
break;
|
4314
4146
|
}
|
4315
4147
|
throw e.message;
|
4316
4148
|
case 2:
|
4317
|
-
return
|
4149
|
+
return _context22.abrupt("return", {
|
4318
4150
|
files: e.artifacts.map(function (n) {
|
4319
4151
|
return {
|
4320
4152
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4324,11 +4156,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4324
4156
|
});
|
4325
4157
|
case 3:
|
4326
4158
|
case "end":
|
4327
|
-
return
|
4159
|
+
return _context22.stop();
|
4328
4160
|
}
|
4329
|
-
},
|
4161
|
+
}, _callee22);
|
4330
4162
|
}));
|
4331
|
-
function extractResultData(
|
4163
|
+
function extractResultData(_x44) {
|
4332
4164
|
return _extractResultData2.apply(this, arguments);
|
4333
4165
|
}
|
4334
4166
|
return extractResultData;
|
@@ -4380,19 +4212,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4380
4212
|
}, {
|
4381
4213
|
key: "callServiceAPI",
|
4382
4214
|
value: function () {
|
4383
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4215
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
|
4384
4216
|
var a, l, s, o;
|
4385
|
-
return _regeneratorRuntime().wrap(function
|
4386
|
-
while (1) switch (
|
4217
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4218
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4387
4219
|
case 0:
|
4388
4220
|
if (this.requestSettings) {
|
4389
|
-
|
4221
|
+
_context23.next = 2;
|
4390
4222
|
break;
|
4391
4223
|
}
|
4392
4224
|
throw new Error("Request settings have not been set up");
|
4393
4225
|
case 2:
|
4394
4226
|
if (!(!n || !n[0] || !n[1])) {
|
4395
|
-
|
4227
|
+
_context23.next = 4;
|
4396
4228
|
break;
|
4397
4229
|
}
|
4398
4230
|
throw new Error("Image was not found");
|
@@ -4401,11 +4233,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4401
4233
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4402
4234
|
case 6:
|
4403
4235
|
case "end":
|
4404
|
-
return
|
4236
|
+
return _context23.stop();
|
4405
4237
|
}
|
4406
|
-
},
|
4238
|
+
}, _callee23, this);
|
4407
4239
|
}));
|
4408
|
-
function callServiceAPI(
|
4240
|
+
function callServiceAPI(_x45, _x46, _x47) {
|
4409
4241
|
return _callServiceAPI5.apply(this, arguments);
|
4410
4242
|
}
|
4411
4243
|
return callServiceAPI;
|
@@ -4413,17 +4245,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4413
4245
|
}, {
|
4414
4246
|
key: "extractResultData",
|
4415
4247
|
value: function () {
|
4416
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4417
|
-
return _regeneratorRuntime().wrap(function
|
4418
|
-
while (1) switch (
|
4248
|
+
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24(e) {
|
4249
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
4250
|
+
while (1) switch (_context24.prev = _context24.next) {
|
4419
4251
|
case 0:
|
4420
4252
|
if (!e.message) {
|
4421
|
-
|
4253
|
+
_context24.next = 2;
|
4422
4254
|
break;
|
4423
4255
|
}
|
4424
4256
|
throw e.message;
|
4425
4257
|
case 2:
|
4426
|
-
return
|
4258
|
+
return _context24.abrupt("return", {
|
4427
4259
|
files: e.artifacts.map(function (n) {
|
4428
4260
|
return {
|
4429
4261
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4433,11 +4265,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4433
4265
|
});
|
4434
4266
|
case 3:
|
4435
4267
|
case "end":
|
4436
|
-
return
|
4268
|
+
return _context24.stop();
|
4437
4269
|
}
|
4438
|
-
},
|
4270
|
+
}, _callee24);
|
4439
4271
|
}));
|
4440
|
-
function extractResultData(
|
4272
|
+
function extractResultData(_x48) {
|
4441
4273
|
return _extractResultData3.apply(this, arguments);
|
4442
4274
|
}
|
4443
4275
|
return extractResultData;
|
@@ -4470,34 +4302,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4470
4302
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4471
4303
|
key: "extractPollResultData",
|
4472
4304
|
value: function () {
|
4473
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4474
|
-
return _regeneratorRuntime().wrap(function
|
4475
|
-
while (1) switch (
|
4305
|
+
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25(e) {
|
4306
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
4307
|
+
while (1) switch (_context25.prev = _context25.next) {
|
4476
4308
|
case 0:
|
4477
4309
|
if (!e.estimated_time) {
|
4478
|
-
|
4310
|
+
_context25.next = 2;
|
4479
4311
|
break;
|
4480
4312
|
}
|
4481
|
-
return
|
4313
|
+
return _context25.abrupt("return", {
|
4482
4314
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4483
4315
|
});
|
4484
4316
|
case 2:
|
4485
4317
|
if (!e.error) {
|
4486
|
-
|
4318
|
+
_context25.next = 4;
|
4487
4319
|
break;
|
4488
4320
|
}
|
4489
4321
|
throw e.error;
|
4490
4322
|
case 4:
|
4491
|
-
return
|
4323
|
+
return _context25.abrupt("return", {
|
4492
4324
|
text: e.text || ""
|
4493
4325
|
});
|
4494
4326
|
case 5:
|
4495
4327
|
case "end":
|
4496
|
-
return
|
4328
|
+
return _context25.stop();
|
4497
4329
|
}
|
4498
|
-
},
|
4330
|
+
}, _callee25);
|
4499
4331
|
}));
|
4500
|
-
function extractPollResultData(
|
4332
|
+
function extractPollResultData(_x49) {
|
4501
4333
|
return _extractPollResultData3.apply(this, arguments);
|
4502
4334
|
}
|
4503
4335
|
return extractPollResultData;
|
@@ -4518,26 +4350,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4518
4350
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4519
4351
|
key: "extractResultData",
|
4520
4352
|
value: function () {
|
4521
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4522
|
-
return _regeneratorRuntime().wrap(function
|
4523
|
-
while (1) switch (
|
4353
|
+
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26(e) {
|
4354
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
4355
|
+
while (1) switch (_context26.prev = _context26.next) {
|
4524
4356
|
case 0:
|
4525
4357
|
if (!e.error) {
|
4526
|
-
|
4358
|
+
_context26.next = 2;
|
4527
4359
|
break;
|
4528
4360
|
}
|
4529
4361
|
throw e.error;
|
4530
4362
|
case 2:
|
4531
|
-
return
|
4363
|
+
return _context26.abrupt("return", {
|
4532
4364
|
text: e[0].generated_text || ""
|
4533
4365
|
});
|
4534
4366
|
case 3:
|
4535
4367
|
case "end":
|
4536
|
-
return
|
4368
|
+
return _context26.stop();
|
4537
4369
|
}
|
4538
|
-
},
|
4370
|
+
}, _callee26);
|
4539
4371
|
}));
|
4540
|
-
function extractResultData(
|
4372
|
+
function extractResultData(_x50) {
|
4541
4373
|
return _extractResultData4.apply(this, arguments);
|
4542
4374
|
}
|
4543
4375
|
return extractResultData;
|
@@ -4574,26 +4406,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4574
4406
|
}, {
|
4575
4407
|
key: "extractResultData",
|
4576
4408
|
value: function () {
|
4577
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4578
|
-
return _regeneratorRuntime().wrap(function
|
4579
|
-
while (1) switch (
|
4409
|
+
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27(e) {
|
4410
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
4411
|
+
while (1) switch (_context27.prev = _context27.next) {
|
4580
4412
|
case 0:
|
4581
4413
|
if (!e.error) {
|
4582
|
-
|
4414
|
+
_context27.next = 2;
|
4583
4415
|
break;
|
4584
4416
|
}
|
4585
4417
|
throw e.error;
|
4586
4418
|
case 2:
|
4587
|
-
return
|
4419
|
+
return _context27.abrupt("return", {
|
4588
4420
|
text: e.answer || ""
|
4589
4421
|
});
|
4590
4422
|
case 3:
|
4591
4423
|
case "end":
|
4592
|
-
return
|
4424
|
+
return _context27.stop();
|
4593
4425
|
}
|
4594
|
-
},
|
4426
|
+
}, _callee27);
|
4595
4427
|
}));
|
4596
|
-
function extractResultData(
|
4428
|
+
function extractResultData(_x51) {
|
4597
4429
|
return _extractResultData5.apply(this, arguments);
|
4598
4430
|
}
|
4599
4431
|
return extractResultData;
|
@@ -4614,26 +4446,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4614
4446
|
_createClass(HuggingFaceSummarizationIO, [{
|
4615
4447
|
key: "extractResultData",
|
4616
4448
|
value: function () {
|
4617
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4618
|
-
return _regeneratorRuntime().wrap(function
|
4619
|
-
while (1) switch (
|
4449
|
+
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28(e) {
|
4450
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
4451
|
+
while (1) switch (_context28.prev = _context28.next) {
|
4620
4452
|
case 0:
|
4621
4453
|
if (!e.error) {
|
4622
|
-
|
4454
|
+
_context28.next = 2;
|
4623
4455
|
break;
|
4624
4456
|
}
|
4625
4457
|
throw e.error;
|
4626
4458
|
case 2:
|
4627
|
-
return
|
4459
|
+
return _context28.abrupt("return", {
|
4628
4460
|
text: e[0].summary_text || ""
|
4629
4461
|
});
|
4630
4462
|
case 3:
|
4631
4463
|
case "end":
|
4632
|
-
return
|
4464
|
+
return _context28.stop();
|
4633
4465
|
}
|
4634
|
-
},
|
4466
|
+
}, _callee28);
|
4635
4467
|
}));
|
4636
|
-
function extractResultData(
|
4468
|
+
function extractResultData(_x52) {
|
4637
4469
|
return _extractResultData6.apply(this, arguments);
|
4638
4470
|
}
|
4639
4471
|
return extractResultData;
|
@@ -4694,26 +4526,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4694
4526
|
}, {
|
4695
4527
|
key: "extractResultData",
|
4696
4528
|
value: function () {
|
4697
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4698
|
-
return _regeneratorRuntime().wrap(function
|
4699
|
-
while (1) switch (
|
4529
|
+
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29(e) {
|
4530
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
4531
|
+
while (1) switch (_context29.prev = _context29.next) {
|
4700
4532
|
case 0:
|
4701
4533
|
if (!e.error) {
|
4702
|
-
|
4534
|
+
_context29.next = 2;
|
4703
4535
|
break;
|
4704
4536
|
}
|
4705
4537
|
throw e.error;
|
4706
4538
|
case 2:
|
4707
|
-
return
|
4539
|
+
return _context29.abrupt("return", {
|
4708
4540
|
text: e.generated_text || ""
|
4709
4541
|
});
|
4710
4542
|
case 3:
|
4711
4543
|
case "end":
|
4712
|
-
return
|
4544
|
+
return _context29.stop();
|
4713
4545
|
}
|
4714
|
-
},
|
4546
|
+
}, _callee29);
|
4715
4547
|
}));
|
4716
|
-
function extractResultData(
|
4548
|
+
function extractResultData(_x53) {
|
4717
4549
|
return _extractResultData7.apply(this, arguments);
|
4718
4550
|
}
|
4719
4551
|
return extractResultData;
|
@@ -4755,19 +4587,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4755
4587
|
}, {
|
4756
4588
|
key: "callServiceAPI",
|
4757
4589
|
value: function () {
|
4758
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4590
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
|
4759
4591
|
var a, l, s, o;
|
4760
|
-
return _regeneratorRuntime().wrap(function
|
4761
|
-
while (1) switch (
|
4592
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4593
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4762
4594
|
case 0:
|
4763
4595
|
if (this.requestSettings) {
|
4764
|
-
|
4596
|
+
_context30.next = 2;
|
4765
4597
|
break;
|
4766
4598
|
}
|
4767
4599
|
throw new Error("Request settings have not been set up");
|
4768
4600
|
case 2:
|
4769
4601
|
if (n) {
|
4770
|
-
|
4602
|
+
_context30.next = 4;
|
4771
4603
|
break;
|
4772
4604
|
}
|
4773
4605
|
throw new Error("Image was not found");
|
@@ -4776,11 +4608,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4776
4608
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4777
4609
|
case 6:
|
4778
4610
|
case "end":
|
4779
|
-
return
|
4611
|
+
return _context30.stop();
|
4780
4612
|
}
|
4781
|
-
},
|
4613
|
+
}, _callee30, this);
|
4782
4614
|
}));
|
4783
|
-
function callServiceAPI(
|
4615
|
+
function callServiceAPI(_x54, _x55, _x56) {
|
4784
4616
|
return _callServiceAPI6.apply(this, arguments);
|
4785
4617
|
}
|
4786
4618
|
return callServiceAPI;
|
@@ -4788,17 +4620,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4788
4620
|
}, {
|
4789
4621
|
key: "extractResultData",
|
4790
4622
|
value: function () {
|
4791
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4792
|
-
return _regeneratorRuntime().wrap(function
|
4793
|
-
while (1) switch (
|
4623
|
+
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31(e) {
|
4624
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
4625
|
+
while (1) switch (_context31.prev = _context31.next) {
|
4794
4626
|
case 0:
|
4795
4627
|
if (!e.message) {
|
4796
|
-
|
4628
|
+
_context31.next = 2;
|
4797
4629
|
break;
|
4798
4630
|
}
|
4799
4631
|
throw e.message;
|
4800
4632
|
case 2:
|
4801
|
-
return
|
4633
|
+
return _context31.abrupt("return", {
|
4802
4634
|
files: e.artifacts.map(function (n) {
|
4803
4635
|
return {
|
4804
4636
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4808,11 +4640,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4808
4640
|
});
|
4809
4641
|
case 3:
|
4810
4642
|
case "end":
|
4811
|
-
return
|
4643
|
+
return _context31.stop();
|
4812
4644
|
}
|
4813
|
-
},
|
4645
|
+
}, _callee31);
|
4814
4646
|
}));
|
4815
|
-
function extractResultData(
|
4647
|
+
function extractResultData(_x57) {
|
4816
4648
|
return _extractResultData8.apply(this, arguments);
|
4817
4649
|
}
|
4818
4650
|
return extractResultData;
|
@@ -4843,26 +4675,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4843
4675
|
_createClass(HuggingFaceTranslationIO, [{
|
4844
4676
|
key: "extractResultData",
|
4845
4677
|
value: function () {
|
4846
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4847
|
-
return _regeneratorRuntime().wrap(function
|
4848
|
-
while (1) switch (
|
4678
|
+
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32(e) {
|
4679
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
4680
|
+
while (1) switch (_context32.prev = _context32.next) {
|
4849
4681
|
case 0:
|
4850
4682
|
if (!e.error) {
|
4851
|
-
|
4683
|
+
_context32.next = 2;
|
4852
4684
|
break;
|
4853
4685
|
}
|
4854
4686
|
throw e.error;
|
4855
4687
|
case 2:
|
4856
|
-
return
|
4688
|
+
return _context32.abrupt("return", {
|
4857
4689
|
text: e[0].translation_text || ""
|
4858
4690
|
});
|
4859
4691
|
case 3:
|
4860
4692
|
case "end":
|
4861
|
-
return
|
4693
|
+
return _context32.stop();
|
4862
4694
|
}
|
4863
|
-
},
|
4695
|
+
}, _callee32);
|
4864
4696
|
}));
|
4865
|
-
function extractResultData(
|
4697
|
+
function extractResultData(_x58) {
|
4866
4698
|
return _extractResultData9.apply(this, arguments);
|
4867
4699
|
}
|
4868
4700
|
return extractResultData;
|
@@ -4896,13 +4728,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4896
4728
|
}, {
|
4897
4729
|
key: "callServiceAPI",
|
4898
4730
|
value: function () {
|
4899
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4731
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
|
4900
4732
|
var n;
|
4901
|
-
return _regeneratorRuntime().wrap(function
|
4902
|
-
while (1) switch (
|
4733
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4734
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4903
4735
|
case 0:
|
4904
4736
|
if (this.requestSettings) {
|
4905
|
-
|
4737
|
+
_context33.next = 2;
|
4906
4738
|
break;
|
4907
4739
|
}
|
4908
4740
|
throw new Error("Request settings have not been set up");
|
@@ -4911,11 +4743,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4911
4743
|
HTTPRequest.request(this, n, e);
|
4912
4744
|
case 4:
|
4913
4745
|
case "end":
|
4914
|
-
return
|
4746
|
+
return _context33.stop();
|
4915
4747
|
}
|
4916
|
-
},
|
4748
|
+
}, _callee33, this);
|
4917
4749
|
}));
|
4918
|
-
function callServiceAPI(
|
4750
|
+
function callServiceAPI(_x59, _x60) {
|
4919
4751
|
return _callServiceAPI7.apply(this, arguments);
|
4920
4752
|
}
|
4921
4753
|
return callServiceAPI;
|
@@ -4923,17 +4755,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4923
4755
|
}, {
|
4924
4756
|
key: "extractResultData",
|
4925
4757
|
value: function () {
|
4926
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4927
|
-
return _regeneratorRuntime().wrap(function
|
4928
|
-
while (1) switch (
|
4758
|
+
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34(e) {
|
4759
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
4760
|
+
while (1) switch (_context34.prev = _context34.next) {
|
4929
4761
|
case 0:
|
4930
4762
|
if (!e.message) {
|
4931
|
-
|
4763
|
+
_context34.next = 2;
|
4932
4764
|
break;
|
4933
4765
|
}
|
4934
4766
|
throw e.message;
|
4935
4767
|
case 2:
|
4936
|
-
return
|
4768
|
+
return _context34.abrupt("return", {
|
4937
4769
|
files: e.artifacts.map(function (n) {
|
4938
4770
|
return {
|
4939
4771
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4943,11 +4775,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4943
4775
|
});
|
4944
4776
|
case 3:
|
4945
4777
|
case "end":
|
4946
|
-
return
|
4778
|
+
return _context34.stop();
|
4947
4779
|
}
|
4948
|
-
},
|
4780
|
+
}, _callee34);
|
4949
4781
|
}));
|
4950
|
-
function extractResultData(
|
4782
|
+
function extractResultData(_x61) {
|
4951
4783
|
return _extractResultData10.apply(this, arguments);
|
4952
4784
|
}
|
4953
4785
|
return extractResultData;
|
@@ -4980,26 +4812,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4980
4812
|
_createClass(HuggingFaceFillMaskIO, [{
|
4981
4813
|
key: "extractResultData",
|
4982
4814
|
value: function () {
|
4983
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4984
|
-
return _regeneratorRuntime().wrap(function
|
4985
|
-
while (1) switch (
|
4815
|
+
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35(e) {
|
4816
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
4817
|
+
while (1) switch (_context35.prev = _context35.next) {
|
4986
4818
|
case 0:
|
4987
4819
|
if (!e.error) {
|
4988
|
-
|
4820
|
+
_context35.next = 2;
|
4989
4821
|
break;
|
4990
4822
|
}
|
4991
4823
|
throw e.error;
|
4992
4824
|
case 2:
|
4993
|
-
return
|
4825
|
+
return _context35.abrupt("return", {
|
4994
4826
|
text: e[0].sequence || ""
|
4995
4827
|
});
|
4996
4828
|
case 3:
|
4997
4829
|
case "end":
|
4998
|
-
return
|
4830
|
+
return _context35.stop();
|
4999
4831
|
}
|
5000
|
-
},
|
4832
|
+
}, _callee35);
|
5001
4833
|
}));
|
5002
|
-
function extractResultData(
|
4834
|
+
function extractResultData(_x62) {
|
5003
4835
|
return _extractResultData11.apply(this, arguments);
|
5004
4836
|
}
|
5005
4837
|
return extractResultData;
|
@@ -5074,13 +4906,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5074
4906
|
}, {
|
5075
4907
|
key: "callServiceAPI",
|
5076
4908
|
value: function () {
|
5077
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4909
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
|
5078
4910
|
var n;
|
5079
|
-
return _regeneratorRuntime().wrap(function
|
5080
|
-
while (1) switch (
|
4911
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4912
|
+
while (1) switch (_context36.prev = _context36.next) {
|
5081
4913
|
case 0:
|
5082
4914
|
if (this.requestSettings) {
|
5083
|
-
|
4915
|
+
_context36.next = 2;
|
5084
4916
|
break;
|
5085
4917
|
}
|
5086
4918
|
throw new Error("Request settings have not been set up");
|
@@ -5089,11 +4921,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5089
4921
|
HTTPRequest.request(this, n, e);
|
5090
4922
|
case 4:
|
5091
4923
|
case "end":
|
5092
|
-
return
|
4924
|
+
return _context36.stop();
|
5093
4925
|
}
|
5094
|
-
},
|
4926
|
+
}, _callee36, this);
|
5095
4927
|
}));
|
5096
|
-
function callServiceAPI(
|
4928
|
+
function callServiceAPI(_x63, _x64) {
|
5097
4929
|
return _callServiceAPI8.apply(this, arguments);
|
5098
4930
|
}
|
5099
4931
|
return callServiceAPI;
|
@@ -5101,27 +4933,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5101
4933
|
}, {
|
5102
4934
|
key: "extractResultData",
|
5103
4935
|
value: function () {
|
5104
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4936
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
5105
4937
|
var t;
|
5106
|
-
return _regeneratorRuntime().wrap(function
|
5107
|
-
while (1) switch (
|
4938
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4939
|
+
while (1) switch (_context37.prev = _context37.next) {
|
5108
4940
|
case 0:
|
5109
4941
|
if (!e.message) {
|
5110
|
-
|
4942
|
+
_context37.next = 2;
|
5111
4943
|
break;
|
5112
4944
|
}
|
5113
4945
|
throw e.message;
|
5114
4946
|
case 2:
|
5115
|
-
return
|
4947
|
+
return _context37.abrupt("return", {
|
5116
4948
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
5117
4949
|
});
|
5118
4950
|
case 3:
|
5119
4951
|
case "end":
|
5120
|
-
return
|
4952
|
+
return _context37.stop();
|
5121
4953
|
}
|
5122
|
-
},
|
4954
|
+
}, _callee37);
|
5123
4955
|
}));
|
5124
|
-
function extractResultData(
|
4956
|
+
function extractResultData(_x65) {
|
5125
4957
|
return _extractResultData12.apply(this, arguments);
|
5126
4958
|
}
|
5127
4959
|
return extractResultData;
|
@@ -5151,13 +4983,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5151
4983
|
}, {
|
5152
4984
|
key: "callServiceAPI",
|
5153
4985
|
value: function () {
|
5154
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4986
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
|
5155
4987
|
var n;
|
5156
|
-
return _regeneratorRuntime().wrap(function
|
5157
|
-
while (1) switch (
|
4988
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4989
|
+
while (1) switch (_context38.prev = _context38.next) {
|
5158
4990
|
case 0:
|
5159
4991
|
if (this.requestSettings) {
|
5160
|
-
|
4992
|
+
_context38.next = 2;
|
5161
4993
|
break;
|
5162
4994
|
}
|
5163
4995
|
throw new Error("Request settings have not been set up");
|
@@ -5166,11 +4998,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5166
4998
|
HTTPRequest.request(this, n, e);
|
5167
4999
|
case 4:
|
5168
5000
|
case "end":
|
5169
|
-
return
|
5001
|
+
return _context38.stop();
|
5170
5002
|
}
|
5171
|
-
},
|
5003
|
+
}, _callee38, this);
|
5172
5004
|
}));
|
5173
|
-
function callServiceAPI(
|
5005
|
+
function callServiceAPI(_x66, _x67) {
|
5174
5006
|
return _callServiceAPI9.apply(this, arguments);
|
5175
5007
|
}
|
5176
5008
|
return callServiceAPI;
|
@@ -5178,26 +5010,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5178
5010
|
}, {
|
5179
5011
|
key: "extractResultData",
|
5180
5012
|
value: function () {
|
5181
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5182
|
-
return _regeneratorRuntime().wrap(function
|
5183
|
-
while (1) switch (
|
5013
|
+
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39(e) {
|
5014
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
5015
|
+
while (1) switch (_context39.prev = _context39.next) {
|
5184
5016
|
case 0:
|
5185
5017
|
if (!e.message) {
|
5186
|
-
|
5018
|
+
_context39.next = 2;
|
5187
5019
|
break;
|
5188
5020
|
}
|
5189
5021
|
throw e.message;
|
5190
5022
|
case 2:
|
5191
|
-
return
|
5023
|
+
return _context39.abrupt("return", {
|
5192
5024
|
text: e.summary || ""
|
5193
5025
|
});
|
5194
5026
|
case 3:
|
5195
5027
|
case "end":
|
5196
|
-
return
|
5028
|
+
return _context39.stop();
|
5197
5029
|
}
|
5198
|
-
},
|
5030
|
+
}, _callee39);
|
5199
5031
|
}));
|
5200
|
-
function extractResultData(
|
5032
|
+
function extractResultData(_x68) {
|
5201
5033
|
return _extractResultData13.apply(this, arguments);
|
5202
5034
|
}
|
5203
5035
|
return extractResultData;
|
@@ -5354,13 +5186,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5354
5186
|
}, {
|
5355
5187
|
key: "callServiceAPI",
|
5356
5188
|
value: function () {
|
5357
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5189
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
5358
5190
|
var n;
|
5359
|
-
return _regeneratorRuntime().wrap(function
|
5360
|
-
while (1) switch (
|
5191
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5192
|
+
while (1) switch (_context40.prev = _context40.next) {
|
5361
5193
|
case 0:
|
5362
5194
|
if (this.requestSettings) {
|
5363
|
-
|
5195
|
+
_context40.next = 2;
|
5364
5196
|
break;
|
5365
5197
|
}
|
5366
5198
|
throw new Error("Request settings have not been set up");
|
@@ -5369,11 +5201,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5369
5201
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5370
5202
|
case 4:
|
5371
5203
|
case "end":
|
5372
|
-
return
|
5204
|
+
return _context40.stop();
|
5373
5205
|
}
|
5374
|
-
},
|
5206
|
+
}, _callee40, this);
|
5375
5207
|
}));
|
5376
|
-
function callServiceAPI(
|
5208
|
+
function callServiceAPI(_x69, _x70) {
|
5377
5209
|
return _callServiceAPI10.apply(this, arguments);
|
5378
5210
|
}
|
5379
5211
|
return callServiceAPI;
|
@@ -5381,34 +5213,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5381
5213
|
}, {
|
5382
5214
|
key: "extractResultData",
|
5383
5215
|
value: function () {
|
5384
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5385
|
-
var t, n,
|
5386
|
-
return _regeneratorRuntime().wrap(function
|
5387
|
-
while (1) switch (
|
5216
|
+
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee41(e) {
|
5217
|
+
var t, n, s;
|
5218
|
+
return _regeneratorRuntime().wrap(function _callee41$(_context41) {
|
5219
|
+
while (1) switch (_context41.prev = _context41.next) {
|
5388
5220
|
case 0:
|
5389
5221
|
if (!e.error) {
|
5390
|
-
|
5222
|
+
_context41.next = 2;
|
5391
5223
|
break;
|
5392
5224
|
}
|
5393
5225
|
throw e.error.message;
|
5394
5226
|
case 2:
|
5395
5227
|
if (this.messages && this.completionsHandlers) {
|
5396
|
-
n = e.headers.get("operation-location"),
|
5228
|
+
n = e.headers.get("operation-location"), s = {
|
5397
5229
|
method: "GET",
|
5398
5230
|
headers: (t = this.requestSettings) == null ? void 0 : t.headers
|
5399
5231
|
};
|
5400
|
-
HTTPRequest.executePollRequest(this, n,
|
5232
|
+
HTTPRequest.executePollRequest(this, n, s, this.messages);
|
5401
5233
|
}
|
5402
|
-
return
|
5234
|
+
return _context41.abrupt("return", {
|
5403
5235
|
pollingInAnotherRequest: !0
|
5404
5236
|
});
|
5405
5237
|
case 4:
|
5406
5238
|
case "end":
|
5407
|
-
return
|
5239
|
+
return _context41.stop();
|
5408
5240
|
}
|
5409
|
-
},
|
5241
|
+
}, _callee41, this);
|
5410
5242
|
}));
|
5411
|
-
function extractResultData(
|
5243
|
+
function extractResultData(_x71) {
|
5412
5244
|
return _extractResultData14.apply(this, arguments);
|
5413
5245
|
}
|
5414
5246
|
return extractResultData;
|
@@ -5416,33 +5248,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5416
5248
|
}, {
|
5417
5249
|
key: "extractPollResultData",
|
5418
5250
|
value: function () {
|
5419
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5251
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
|
5420
5252
|
var t, _iterator, _step, n;
|
5421
|
-
return _regeneratorRuntime().wrap(function
|
5422
|
-
while (1) switch (
|
5253
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5254
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5423
5255
|
case 0:
|
5424
5256
|
if (!e.error) {
|
5425
|
-
|
5257
|
+
_context42.next = 2;
|
5426
5258
|
break;
|
5427
5259
|
}
|
5428
5260
|
throw e.error;
|
5429
5261
|
case 2:
|
5430
5262
|
if (!(e.status === "running")) {
|
5431
|
-
|
5263
|
+
_context42.next = 4;
|
5432
5264
|
break;
|
5433
5265
|
}
|
5434
|
-
return
|
5266
|
+
return _context42.abrupt("return", {
|
5435
5267
|
timeoutMS: 2e3
|
5436
5268
|
});
|
5437
5269
|
case 4:
|
5438
5270
|
if (!(e.errors.length > 0)) {
|
5439
|
-
|
5271
|
+
_context42.next = 6;
|
5440
5272
|
break;
|
5441
5273
|
}
|
5442
5274
|
throw e.errors[0];
|
5443
5275
|
case 6:
|
5444
5276
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5445
|
-
|
5277
|
+
_context42.next = 8;
|
5446
5278
|
break;
|
5447
5279
|
}
|
5448
5280
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5459,16 +5291,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5459
5291
|
} finally {
|
5460
5292
|
_iterator.f();
|
5461
5293
|
}
|
5462
|
-
return
|
5294
|
+
return _context42.abrupt("return", {
|
5463
5295
|
text: t || ""
|
5464
5296
|
});
|
5465
5297
|
case 12:
|
5466
5298
|
case "end":
|
5467
|
-
return
|
5299
|
+
return _context42.stop();
|
5468
5300
|
}
|
5469
|
-
},
|
5301
|
+
}, _callee42);
|
5470
5302
|
}));
|
5471
|
-
function extractPollResultData(
|
5303
|
+
function extractPollResultData(_x72) {
|
5472
5304
|
return _extractPollResultData4.apply(this, arguments);
|
5473
5305
|
}
|
5474
5306
|
return extractPollResultData;
|
@@ -5567,13 +5399,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5567
5399
|
}, {
|
5568
5400
|
key: "callServiceAPI",
|
5569
5401
|
value: function () {
|
5570
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5402
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
|
5571
5403
|
var n;
|
5572
|
-
return _regeneratorRuntime().wrap(function
|
5573
|
-
while (1) switch (
|
5404
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5405
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5574
5406
|
case 0:
|
5575
5407
|
if (this.requestSettings) {
|
5576
|
-
|
5408
|
+
_context43.next = 2;
|
5577
5409
|
break;
|
5578
5410
|
}
|
5579
5411
|
throw new Error("Request settings have not been set up");
|
@@ -5582,11 +5414,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5582
5414
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5583
5415
|
case 4:
|
5584
5416
|
case "end":
|
5585
|
-
return
|
5417
|
+
return _context43.stop();
|
5586
5418
|
}
|
5587
|
-
},
|
5419
|
+
}, _callee43, this);
|
5588
5420
|
}));
|
5589
|
-
function callServiceAPI(
|
5421
|
+
function callServiceAPI(_x73, _x74) {
|
5590
5422
|
return _callServiceAPI11.apply(this, arguments);
|
5591
5423
|
}
|
5592
5424
|
return callServiceAPI;
|
@@ -5594,27 +5426,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5594
5426
|
}, {
|
5595
5427
|
key: "extractResultData",
|
5596
5428
|
value: function () {
|
5597
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5429
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
|
5598
5430
|
var t;
|
5599
|
-
return _regeneratorRuntime().wrap(function
|
5600
|
-
while (1) switch (
|
5431
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5432
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5601
5433
|
case 0:
|
5602
5434
|
if (!e.error) {
|
5603
|
-
|
5435
|
+
_context44.next = 2;
|
5604
5436
|
break;
|
5605
5437
|
}
|
5606
5438
|
throw e.error.message;
|
5607
5439
|
case 2:
|
5608
|
-
return
|
5440
|
+
return _context44.abrupt("return", {
|
5609
5441
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5610
5442
|
});
|
5611
5443
|
case 3:
|
5612
5444
|
case "end":
|
5613
|
-
return
|
5445
|
+
return _context44.stop();
|
5614
5446
|
}
|
5615
|
-
},
|
5447
|
+
}, _callee44);
|
5616
5448
|
}));
|
5617
|
-
function extractResultData(
|
5449
|
+
function extractResultData(_x75) {
|
5618
5450
|
return _extractResultData15.apply(this, arguments);
|
5619
5451
|
}
|
5620
5452
|
return extractResultData;
|
@@ -5629,17 +5461,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5629
5461
|
_createClass(AssemblyAIUtils, null, [{
|
5630
5462
|
key: "poll",
|
5631
5463
|
value: function () {
|
5632
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5464
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
|
5633
5465
|
var n, l, c, d;
|
5634
|
-
return _regeneratorRuntime().wrap(function
|
5635
|
-
while (1) switch (
|
5466
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5467
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5636
5468
|
case 0:
|
5637
5469
|
n = {
|
5638
5470
|
authorization: e,
|
5639
5471
|
"content-type": "application/json"
|
5640
5472
|
};
|
5641
|
-
|
5642
|
-
|
5473
|
+
_context45.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5474
|
+
_context45.next = 4;
|
5643
5475
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5644
5476
|
method: "POST",
|
5645
5477
|
body: JSON.stringify({
|
@@ -5648,55 +5480,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5648
5480
|
headers: n
|
5649
5481
|
});
|
5650
5482
|
case 4:
|
5651
|
-
|
5652
|
-
return
|
5483
|
+
_context45.next = 6;
|
5484
|
+
return _context45.sent.json();
|
5653
5485
|
case 6:
|
5654
|
-
|
5655
|
-
l =
|
5486
|
+
_context45.t1 = _context45.sent.id;
|
5487
|
+
l = _context45.t0.concat.call(_context45.t0, _context45.t1);
|
5656
5488
|
case 8:
|
5657
5489
|
if (c) {
|
5658
|
-
|
5490
|
+
_context45.next = 24;
|
5659
5491
|
break;
|
5660
5492
|
}
|
5661
|
-
|
5493
|
+
_context45.next = 11;
|
5662
5494
|
return fetch(l, {
|
5663
5495
|
headers: n
|
5664
5496
|
});
|
5665
5497
|
case 11:
|
5666
|
-
|
5667
|
-
return
|
5498
|
+
_context45.next = 13;
|
5499
|
+
return _context45.sent.json();
|
5668
5500
|
case 13:
|
5669
|
-
d =
|
5501
|
+
d = _context45.sent;
|
5670
5502
|
if (!(d.status === "completed")) {
|
5671
|
-
|
5503
|
+
_context45.next = 18;
|
5672
5504
|
break;
|
5673
5505
|
}
|
5674
5506
|
c = d;
|
5675
|
-
|
5507
|
+
_context45.next = 22;
|
5676
5508
|
break;
|
5677
5509
|
case 18:
|
5678
5510
|
if (!(d.status === "error")) {
|
5679
|
-
|
5511
|
+
_context45.next = 20;
|
5680
5512
|
break;
|
5681
5513
|
}
|
5682
5514
|
throw new Error("Transcription failed: ".concat(d.error));
|
5683
5515
|
case 20:
|
5684
|
-
|
5516
|
+
_context45.next = 22;
|
5685
5517
|
return new Promise(function (h) {
|
5686
5518
|
return setTimeout(h, 3e3);
|
5687
5519
|
});
|
5688
5520
|
case 22:
|
5689
|
-
|
5521
|
+
_context45.next = 8;
|
5690
5522
|
break;
|
5691
5523
|
case 24:
|
5692
|
-
return
|
5524
|
+
return _context45.abrupt("return", c);
|
5693
5525
|
case 25:
|
5694
5526
|
case "end":
|
5695
|
-
return
|
5527
|
+
return _context45.stop();
|
5696
5528
|
}
|
5697
|
-
},
|
5529
|
+
}, _callee45);
|
5698
5530
|
}));
|
5699
|
-
function poll(
|
5531
|
+
function poll(_x76, _x77) {
|
5700
5532
|
return _poll2.apply(this, arguments);
|
5701
5533
|
}
|
5702
5534
|
return poll;
|
@@ -5744,19 +5576,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5744
5576
|
_createClass(AssemblyAIAudioIO, [{
|
5745
5577
|
key: "callServiceAPI",
|
5746
5578
|
value: function () {
|
5747
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5579
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
|
5748
5580
|
var s;
|
5749
|
-
return _regeneratorRuntime().wrap(function
|
5750
|
-
while (1) switch (
|
5581
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5582
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5751
5583
|
case 0:
|
5752
5584
|
if ((s = this.requestSettings) != null && s.headers) {
|
5753
|
-
|
5585
|
+
_context46.next = 2;
|
5754
5586
|
break;
|
5755
5587
|
}
|
5756
5588
|
throw new Error("Request settings have not been set up");
|
5757
5589
|
case 2:
|
5758
5590
|
if (n != null && n[0]) {
|
5759
|
-
|
5591
|
+
_context46.next = 4;
|
5760
5592
|
break;
|
5761
5593
|
}
|
5762
5594
|
throw new Error("No file was added");
|
@@ -5764,11 +5596,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5764
5596
|
HTTPRequest.request(this, n[0], e, !1);
|
5765
5597
|
case 5:
|
5766
5598
|
case "end":
|
5767
|
-
return
|
5599
|
+
return _context46.stop();
|
5768
5600
|
}
|
5769
|
-
},
|
5601
|
+
}, _callee46, this);
|
5770
5602
|
}));
|
5771
|
-
function callServiceAPI(
|
5603
|
+
function callServiceAPI(_x78, _x79, _x80) {
|
5772
5604
|
return _callServiceAPI12.apply(this, arguments);
|
5773
5605
|
}
|
5774
5606
|
return callServiceAPI;
|
@@ -5776,32 +5608,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5776
5608
|
}, {
|
5777
5609
|
key: "extractResultData",
|
5778
5610
|
value: function () {
|
5779
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5611
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
|
5780
5612
|
var s, o, t;
|
5781
|
-
return _regeneratorRuntime().wrap(function
|
5782
|
-
while (1) switch (
|
5613
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5614
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5783
5615
|
case 0:
|
5784
5616
|
if (!e.error) {
|
5785
|
-
|
5617
|
+
_context47.next = 2;
|
5786
5618
|
break;
|
5787
5619
|
}
|
5788
5620
|
throw e.error;
|
5789
5621
|
case 2:
|
5790
5622
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5791
|
-
|
5623
|
+
_context47.next = 5;
|
5792
5624
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5793
5625
|
case 5:
|
5794
|
-
|
5795
|
-
return
|
5796
|
-
text:
|
5626
|
+
_context47.t0 = _context47.sent.text;
|
5627
|
+
return _context47.abrupt("return", {
|
5628
|
+
text: _context47.t0
|
5797
5629
|
});
|
5798
5630
|
case 7:
|
5799
5631
|
case "end":
|
5800
|
-
return
|
5632
|
+
return _context47.stop();
|
5801
5633
|
}
|
5802
|
-
},
|
5634
|
+
}, _callee47, this);
|
5803
5635
|
}));
|
5804
|
-
function extractResultData(
|
5636
|
+
function extractResultData(_x81) {
|
5805
5637
|
return _extractResultData16.apply(this, arguments);
|
5806
5638
|
}
|
5807
5639
|
return extractResultData;
|
@@ -5851,13 +5683,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5851
5683
|
}, {
|
5852
5684
|
key: "callServiceAPI",
|
5853
5685
|
value: function () {
|
5854
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5686
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
|
5855
5687
|
var n;
|
5856
|
-
return _regeneratorRuntime().wrap(function
|
5857
|
-
while (1) switch (
|
5688
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5689
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5858
5690
|
case 0:
|
5859
5691
|
if (this.requestSettings) {
|
5860
|
-
|
5692
|
+
_context48.next = 2;
|
5861
5693
|
break;
|
5862
5694
|
}
|
5863
5695
|
throw new Error("Request settings have not been set up");
|
@@ -5866,11 +5698,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5866
5698
|
HTTPRequest.request(this, n, e, !1);
|
5867
5699
|
case 4:
|
5868
5700
|
case "end":
|
5869
|
-
return
|
5701
|
+
return _context48.stop();
|
5870
5702
|
}
|
5871
|
-
},
|
5703
|
+
}, _callee48, this);
|
5872
5704
|
}));
|
5873
|
-
function callServiceAPI(
|
5705
|
+
function callServiceAPI(_x82, _x83) {
|
5874
5706
|
return _callServiceAPI13.apply(this, arguments);
|
5875
5707
|
}
|
5876
5708
|
return callServiceAPI;
|
@@ -5878,11 +5710,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5878
5710
|
}, {
|
5879
5711
|
key: "extractResultData",
|
5880
5712
|
value: function () {
|
5881
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5882
|
-
return _regeneratorRuntime().wrap(function
|
5883
|
-
while (1) switch (
|
5713
|
+
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(e) {
|
5714
|
+
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
5715
|
+
while (1) switch (_context49.prev = _context49.next) {
|
5884
5716
|
case 0:
|
5885
|
-
return
|
5717
|
+
return _context49.abrupt("return", new Promise(function (t) {
|
5886
5718
|
var n = new FileReader();
|
5887
5719
|
n.readAsDataURL(e), n.onload = function (s) {
|
5888
5720
|
t({
|
@@ -5895,11 +5727,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5895
5727
|
}));
|
5896
5728
|
case 1:
|
5897
5729
|
case "end":
|
5898
|
-
return
|
5730
|
+
return _context49.stop();
|
5899
5731
|
}
|
5900
|
-
},
|
5732
|
+
}, _callee49);
|
5901
5733
|
}));
|
5902
|
-
function extractResultData(
|
5734
|
+
function extractResultData(_x84) {
|
5903
5735
|
return _extractResultData17.apply(this, arguments);
|
5904
5736
|
}
|
5905
5737
|
return extractResultData;
|
@@ -5935,19 +5767,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5935
5767
|
_createClass(U, [{
|
5936
5768
|
key: "callServiceAPI",
|
5937
5769
|
value: function () {
|
5938
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5770
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
|
5939
5771
|
var s, o;
|
5940
|
-
return _regeneratorRuntime().wrap(function
|
5941
|
-
while (1) switch (
|
5772
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5773
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5942
5774
|
case 0:
|
5943
5775
|
if ((s = this.requestSettings) != null && s.headers) {
|
5944
|
-
|
5776
|
+
_context50.next = 2;
|
5945
5777
|
break;
|
5946
5778
|
}
|
5947
5779
|
throw new Error("Request settings have not been set up");
|
5948
5780
|
case 2:
|
5949
5781
|
if (n != null && n[0]) {
|
5950
|
-
|
5782
|
+
_context50.next = 4;
|
5951
5783
|
break;
|
5952
5784
|
}
|
5953
5785
|
throw new Error("No file was added");
|
@@ -5955,11 +5787,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5955
5787
|
(o = this.requestSettings) != null && o.headers && (this.requestSettings.headers["Content-Type"] = n[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), HTTPRequest.request(this, n[0], e, !1);
|
5956
5788
|
case 5:
|
5957
5789
|
case "end":
|
5958
|
-
return
|
5790
|
+
return _context50.stop();
|
5959
5791
|
}
|
5960
|
-
},
|
5792
|
+
}, _callee50, this);
|
5961
5793
|
}));
|
5962
|
-
function callServiceAPI(
|
5794
|
+
function callServiceAPI(_x85, _x86, _x87) {
|
5963
5795
|
return _callServiceAPI14.apply(this, arguments);
|
5964
5796
|
}
|
5965
5797
|
return callServiceAPI;
|
@@ -5967,26 +5799,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5967
5799
|
}, {
|
5968
5800
|
key: "extractResultData",
|
5969
5801
|
value: function () {
|
5970
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5971
|
-
return _regeneratorRuntime().wrap(function
|
5972
|
-
while (1) switch (
|
5802
|
+
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee51(e) {
|
5803
|
+
return _regeneratorRuntime().wrap(function _callee51$(_context51) {
|
5804
|
+
while (1) switch (_context51.prev = _context51.next) {
|
5973
5805
|
case 0:
|
5974
5806
|
if (!e.error) {
|
5975
|
-
|
5807
|
+
_context51.next = 2;
|
5976
5808
|
break;
|
5977
5809
|
}
|
5978
5810
|
throw e.error;
|
5979
5811
|
case 2:
|
5980
|
-
return
|
5812
|
+
return _context51.abrupt("return", {
|
5981
5813
|
text: e.DisplayText || ""
|
5982
5814
|
});
|
5983
5815
|
case 3:
|
5984
5816
|
case "end":
|
5985
|
-
return
|
5817
|
+
return _context51.stop();
|
5986
5818
|
}
|
5987
|
-
},
|
5819
|
+
}, _callee51);
|
5988
5820
|
}));
|
5989
|
-
function extractResultData(
|
5821
|
+
function extractResultData(_x88) {
|
5990
5822
|
return _extractResultData18.apply(this, arguments);
|
5991
5823
|
}
|
5992
5824
|
return extractResultData;
|
@@ -6029,13 +5861,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6029
5861
|
}, {
|
6030
5862
|
key: "callServiceAPI",
|
6031
5863
|
value: function () {
|
6032
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5864
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
|
6033
5865
|
var n;
|
6034
|
-
return _regeneratorRuntime().wrap(function
|
6035
|
-
while (1) switch (
|
5866
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5867
|
+
while (1) switch (_context52.prev = _context52.next) {
|
6036
5868
|
case 0:
|
6037
5869
|
if (this.requestSettings) {
|
6038
|
-
|
5870
|
+
_context52.next = 2;
|
6039
5871
|
break;
|
6040
5872
|
}
|
6041
5873
|
throw new Error("Request settings have not been set up");
|
@@ -6044,11 +5876,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6044
5876
|
HTTPRequest.request(this, n, e);
|
6045
5877
|
case 4:
|
6046
5878
|
case "end":
|
6047
|
-
return
|
5879
|
+
return _context52.stop();
|
6048
5880
|
}
|
6049
|
-
},
|
5881
|
+
}, _callee52, this);
|
6050
5882
|
}));
|
6051
|
-
function callServiceAPI(
|
5883
|
+
function callServiceAPI(_x89, _x90) {
|
6052
5884
|
return _callServiceAPI15.apply(this, arguments);
|
6053
5885
|
}
|
6054
5886
|
return callServiceAPI;
|
@@ -6056,27 +5888,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6056
5888
|
}, {
|
6057
5889
|
key: "extractResultData",
|
6058
5890
|
value: function () {
|
6059
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5891
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
6060
5892
|
var t;
|
6061
|
-
return _regeneratorRuntime().wrap(function
|
6062
|
-
while (1) switch (
|
5893
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5894
|
+
while (1) switch (_context53.prev = _context53.next) {
|
6063
5895
|
case 0:
|
6064
5896
|
if (!Array.isArray(e)) {
|
6065
|
-
|
5897
|
+
_context53.next = 2;
|
6066
5898
|
break;
|
6067
5899
|
}
|
6068
|
-
return
|
5900
|
+
return _context53.abrupt("return", {
|
6069
5901
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
6070
5902
|
});
|
6071
5903
|
case 2:
|
6072
5904
|
throw e.error;
|
6073
5905
|
case 3:
|
6074
5906
|
case "end":
|
6075
|
-
return
|
5907
|
+
return _context53.stop();
|
6076
5908
|
}
|
6077
|
-
},
|
5909
|
+
}, _callee53);
|
6078
5910
|
}));
|
6079
|
-
function extractResultData(
|
5911
|
+
function extractResultData(_x91) {
|
6080
5912
|
return _extractResultData19.apply(this, arguments);
|
6081
5913
|
}
|
6082
5914
|
return extractResultData;
|
@@ -6085,11 +5917,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6085
5917
|
return AzureTranslationIO;
|
6086
5918
|
}(DirectServiceIO);
|
6087
5919
|
var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
6088
|
-
_inherits(
|
6089
|
-
var _super30 = _createSuper(
|
6090
|
-
function
|
5920
|
+
_inherits(A, _DirectServiceIO9);
|
5921
|
+
var _super30 = _createSuper(A);
|
5922
|
+
function A(e) {
|
6091
5923
|
var _this23;
|
6092
|
-
_classCallCheck(this,
|
5924
|
+
_classCallCheck(this, A);
|
6093
5925
|
var l;
|
6094
5926
|
var t = e.directConnection,
|
6095
5927
|
n = e.textInput,
|
@@ -6113,16 +5945,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6113
5945
|
}
|
6114
5946
|
};
|
6115
5947
|
}
|
6116
|
-
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage =
|
5948
|
+
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
|
6117
5949
|
return _this23;
|
6118
5950
|
}
|
6119
|
-
_createClass(
|
5951
|
+
_createClass(A, [{
|
6120
5952
|
key: "preprocessBody",
|
6121
5953
|
value: function preprocessBody(e, t) {
|
6122
5954
|
var n = JSON.parse(JSON.stringify(e));
|
6123
5955
|
if (t && t !== "") {
|
6124
|
-
var
|
6125
|
-
n.prompt =
|
5956
|
+
var s = t.substring(0, this._maxCharLength);
|
5957
|
+
n.prompt = s;
|
6126
5958
|
}
|
6127
5959
|
return n;
|
6128
5960
|
}
|
@@ -6134,50 +5966,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6134
5966
|
var s;
|
6135
5967
|
var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
|
6136
5968
|
if (n[1] || o && o !== "") {
|
6137
|
-
this.url =
|
5969
|
+
this.url = A.IMAGE_EDIT_URL;
|
6138
5970
|
var c = this.preprocessBody(this.rawBody, o);
|
6139
|
-
s =
|
6140
|
-
} else this.url =
|
5971
|
+
s = A.createFormDataBody(c, n[0], n[1]);
|
5972
|
+
} else this.url = A.IMAGE_VARIATIONS_URL, s = A.createFormDataBody(this.rawBody, n[0]);
|
6141
5973
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
6142
5974
|
}
|
6143
5975
|
}, {
|
6144
5976
|
key: "callServiceAPI",
|
6145
5977
|
value: function () {
|
6146
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6147
|
-
var s,
|
6148
|
-
return _regeneratorRuntime().wrap(function
|
6149
|
-
while (1) switch (
|
5978
|
+
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(e, t, n) {
|
5979
|
+
var s, o;
|
5980
|
+
return _regeneratorRuntime().wrap(function _callee54$(_context54) {
|
5981
|
+
while (1) switch (_context54.prev = _context54.next) {
|
6150
5982
|
case 0:
|
6151
5983
|
if ((s = this.requestSettings) != null && s.headers) {
|
6152
|
-
|
5984
|
+
_context54.next = 2;
|
6153
5985
|
break;
|
6154
5986
|
}
|
6155
5987
|
throw new Error("Request settings have not been set up");
|
6156
5988
|
case 2:
|
6157
5989
|
if (!(n != null && n[0])) {
|
6158
|
-
|
5990
|
+
_context54.next = 6;
|
6159
5991
|
break;
|
6160
5992
|
}
|
6161
5993
|
this.callApiWithImage(e, t, n);
|
6162
|
-
|
5994
|
+
_context54.next = 11;
|
6163
5995
|
break;
|
6164
5996
|
case 6:
|
6165
5997
|
if (this.requestSettings) {
|
6166
|
-
|
5998
|
+
_context54.next = 8;
|
6167
5999
|
break;
|
6168
6000
|
}
|
6169
6001
|
throw new Error("Request settings have not been set up");
|
6170
6002
|
case 8:
|
6171
|
-
this.url =
|
6172
|
-
|
6173
|
-
HTTPRequest.request(this,
|
6003
|
+
this.url = A.IMAGE_GENERATION_URL;
|
6004
|
+
o = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6005
|
+
HTTPRequest.request(this, o, e);
|
6174
6006
|
case 11:
|
6175
6007
|
case "end":
|
6176
|
-
return
|
6008
|
+
return _context54.stop();
|
6177
6009
|
}
|
6178
|
-
},
|
6010
|
+
}, _callee54, this);
|
6179
6011
|
}));
|
6180
|
-
function callServiceAPI(
|
6012
|
+
function callServiceAPI(_x92, _x93, _x94) {
|
6181
6013
|
return _callServiceAPI16.apply(this, arguments);
|
6182
6014
|
}
|
6183
6015
|
return callServiceAPI;
|
@@ -6185,17 +6017,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6185
6017
|
}, {
|
6186
6018
|
key: "extractResultData",
|
6187
6019
|
value: function () {
|
6188
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6189
|
-
return _regeneratorRuntime().wrap(function
|
6190
|
-
while (1) switch (
|
6020
|
+
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee55(e) {
|
6021
|
+
return _regeneratorRuntime().wrap(function _callee55$(_context55) {
|
6022
|
+
while (1) switch (_context55.prev = _context55.next) {
|
6191
6023
|
case 0:
|
6192
6024
|
if (!e.error) {
|
6193
|
-
|
6025
|
+
_context55.next = 2;
|
6194
6026
|
break;
|
6195
6027
|
}
|
6196
6028
|
throw e.error.message;
|
6197
6029
|
case 2:
|
6198
|
-
return
|
6030
|
+
return _context55.abrupt("return", {
|
6199
6031
|
files: e.data.map(function (n) {
|
6200
6032
|
return n.url ? {
|
6201
6033
|
src: n.url,
|
@@ -6208,11 +6040,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6208
6040
|
});
|
6209
6041
|
case 3:
|
6210
6042
|
case "end":
|
6211
|
-
return
|
6043
|
+
return _context55.stop();
|
6212
6044
|
}
|
6213
|
-
},
|
6045
|
+
}, _callee55);
|
6214
6046
|
}));
|
6215
|
-
function extractResultData(
|
6047
|
+
function extractResultData(_x95) {
|
6216
6048
|
return _extractResultData20.apply(this, arguments);
|
6217
6049
|
}
|
6218
6050
|
return extractResultData;
|
@@ -6239,34 +6071,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6239
6071
|
}), s;
|
6240
6072
|
}
|
6241
6073
|
}]);
|
6242
|
-
return
|
6074
|
+
return A;
|
6243
6075
|
}(DirectServiceIO);
|
6244
6076
|
_OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
6245
6077
|
_OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
6246
6078
|
_OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
6247
6079
|
var OpenAIImagesIO = _OpenAIImagesIO;
|
6248
6080
|
var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
6249
|
-
_inherits(
|
6250
|
-
var _super31 = _createSuper(
|
6251
|
-
function
|
6081
|
+
_inherits(M, _DirectServiceIO10);
|
6082
|
+
var _super31 = _createSuper(M);
|
6083
|
+
function M(e) {
|
6252
6084
|
var _l$model2;
|
6253
6085
|
var _this24;
|
6254
|
-
_classCallCheck(this,
|
6086
|
+
_classCallCheck(this, M);
|
6255
6087
|
var a, l;
|
6256
6088
|
var t = e.directConnection,
|
6257
6089
|
n = e.textInput,
|
6258
6090
|
s = t == null ? void 0 : t.openAI;
|
6259
6091
|
_this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
|
6260
6092
|
audio: {}
|
6261
|
-
}), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url =
|
6093
|
+
}), _this24.insertKeyPlaceholderText = "OpenAI API Key", _this24.getKeyLink = "https://platform.openai.com/account/api-keys", _this24.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI Whisper</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text. You can optionally provide text to guide the audio\n processing.\n <p>Click <a href=\"https://platform.openai.com/docs/api-reference/audio/create\">here</a> for more info.</p>", _this24.url = "", _this24.permittedErrorPrefixes = ["Invalid"], _this24._maxCharLength = OpenAIUtils.FILE_MAX_CHAR_LENGTH, _this24._service_url = M.AUDIO_TRANSCRIPTIONS_URL, n != null && n.characterLimit && (_this24._maxCharLength = n.characterLimit);
|
6262
6094
|
var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
|
6263
|
-
_typeof(o) == "object" && (_this24.processConfig(o),
|
6095
|
+
_typeof(o) == "object" && (_this24.processConfig(o), M.cleanConfig(o), Object.assign(_this24.rawBody, o)), (_l$model2 = (l = _this24.rawBody).model) !== null && _l$model2 !== void 0 ? _l$model2 : l.model = M.DEFAULT_MODEL, _this24.rawBody.response_format = "json", _this24.canSendMessage = M.canSendFileMessage;
|
6264
6096
|
return _this24;
|
6265
6097
|
}
|
6266
|
-
_createClass(
|
6098
|
+
_createClass(M, [{
|
6267
6099
|
key: "processConfig",
|
6268
6100
|
value: function processConfig(e) {
|
6269
|
-
e != null && e.type && e.type === "translation" && (this._service_url =
|
6101
|
+
e != null && e.type && e.type === "translation" && (this._service_url = M.AUDIO_TRANSLATIONS_URL, delete e.language);
|
6270
6102
|
}
|
6271
6103
|
}, {
|
6272
6104
|
key: "preprocessBody",
|
@@ -6284,33 +6116,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6284
6116
|
}, {
|
6285
6117
|
key: "callServiceAPI",
|
6286
6118
|
value: function () {
|
6287
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6119
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
|
6288
6120
|
var a, s, o;
|
6289
|
-
return _regeneratorRuntime().wrap(function
|
6290
|
-
while (1) switch (
|
6121
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6122
|
+
while (1) switch (_context56.prev = _context56.next) {
|
6291
6123
|
case 0:
|
6292
6124
|
if ((a = this.requestSettings) != null && a.headers) {
|
6293
|
-
|
6125
|
+
_context56.next = 2;
|
6294
6126
|
break;
|
6295
6127
|
}
|
6296
6128
|
throw new Error("Request settings have not been set up");
|
6297
6129
|
case 2:
|
6298
6130
|
if (n != null && n[0]) {
|
6299
|
-
|
6131
|
+
_context56.next = 4;
|
6300
6132
|
break;
|
6301
6133
|
}
|
6302
6134
|
throw new Error("No file was added");
|
6303
6135
|
case 4:
|
6304
6136
|
this.url = this.requestSettings.url || this._service_url;
|
6305
|
-
s = this.preprocessBody(this.rawBody, t, n), o =
|
6137
|
+
s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
|
6306
6138
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6307
6139
|
case 7:
|
6308
6140
|
case "end":
|
6309
|
-
return
|
6141
|
+
return _context56.stop();
|
6310
6142
|
}
|
6311
|
-
},
|
6143
|
+
}, _callee56, this);
|
6312
6144
|
}));
|
6313
|
-
function callServiceAPI(
|
6145
|
+
function callServiceAPI(_x96, _x97, _x98) {
|
6314
6146
|
return _callServiceAPI17.apply(this, arguments);
|
6315
6147
|
}
|
6316
6148
|
return callServiceAPI;
|
@@ -6318,26 +6150,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6318
6150
|
}, {
|
6319
6151
|
key: "extractResultData",
|
6320
6152
|
value: function () {
|
6321
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6322
|
-
return _regeneratorRuntime().wrap(function
|
6323
|
-
while (1) switch (
|
6153
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee57(e) {
|
6154
|
+
return _regeneratorRuntime().wrap(function _callee57$(_context57) {
|
6155
|
+
while (1) switch (_context57.prev = _context57.next) {
|
6324
6156
|
case 0:
|
6325
6157
|
if (!e.error) {
|
6326
|
-
|
6158
|
+
_context57.next = 2;
|
6327
6159
|
break;
|
6328
6160
|
}
|
6329
6161
|
throw e.error.message;
|
6330
6162
|
case 2:
|
6331
|
-
return
|
6163
|
+
return _context57.abrupt("return", {
|
6332
6164
|
text: e.text
|
6333
6165
|
});
|
6334
6166
|
case 3:
|
6335
6167
|
case "end":
|
6336
|
-
return
|
6168
|
+
return _context57.stop();
|
6337
6169
|
}
|
6338
|
-
},
|
6170
|
+
}, _callee57);
|
6339
6171
|
}));
|
6340
|
-
function extractResultData(
|
6172
|
+
function extractResultData(_x99) {
|
6341
6173
|
return _extractResultData21.apply(this, arguments);
|
6342
6174
|
}
|
6343
6175
|
return extractResultData;
|
@@ -6361,7 +6193,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6361
6193
|
}), n;
|
6362
6194
|
}
|
6363
6195
|
}]);
|
6364
|
-
return
|
6196
|
+
return M;
|
6365
6197
|
}(DirectServiceIO);
|
6366
6198
|
_OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
6367
6199
|
_OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
@@ -6403,13 +6235,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6403
6235
|
}, {
|
6404
6236
|
key: "callServiceAPI",
|
6405
6237
|
value: function () {
|
6406
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6238
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
|
6407
6239
|
var n;
|
6408
|
-
return _regeneratorRuntime().wrap(function
|
6409
|
-
while (1) switch (
|
6240
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6241
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6410
6242
|
case 0:
|
6411
6243
|
if (this.requestSettings) {
|
6412
|
-
|
6244
|
+
_context58.next = 2;
|
6413
6245
|
break;
|
6414
6246
|
}
|
6415
6247
|
throw new Error("Request settings have not been set up");
|
@@ -6418,11 +6250,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6418
6250
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6419
6251
|
case 4:
|
6420
6252
|
case "end":
|
6421
|
-
return
|
6253
|
+
return _context58.stop();
|
6422
6254
|
}
|
6423
|
-
},
|
6255
|
+
}, _callee58, this);
|
6424
6256
|
}));
|
6425
|
-
function callServiceAPI(
|
6257
|
+
function callServiceAPI(_x100, _x101) {
|
6426
6258
|
return _callServiceAPI18.apply(this, arguments);
|
6427
6259
|
}
|
6428
6260
|
return callServiceAPI;
|
@@ -6430,17 +6262,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6430
6262
|
}, {
|
6431
6263
|
key: "extractResultData",
|
6432
6264
|
value: function () {
|
6433
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6434
|
-
return _regeneratorRuntime().wrap(function
|
6435
|
-
while (1) switch (
|
6265
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee59(e) {
|
6266
|
+
return _regeneratorRuntime().wrap(function _callee59$(_context59) {
|
6267
|
+
while (1) switch (_context59.prev = _context59.next) {
|
6436
6268
|
case 0:
|
6437
6269
|
if (!e.error) {
|
6438
|
-
|
6270
|
+
_context59.next = 2;
|
6439
6271
|
break;
|
6440
6272
|
}
|
6441
6273
|
throw e.error.message;
|
6442
6274
|
case 2:
|
6443
|
-
return
|
6275
|
+
return _context59.abrupt("return", e.choices[0].delta ? {
|
6444
6276
|
text: e.choices[0].delta.content || ""
|
6445
6277
|
} : e.choices[0].message ? {
|
6446
6278
|
text: e.choices[0].message.content
|
@@ -6449,11 +6281,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6449
6281
|
});
|
6450
6282
|
case 3:
|
6451
6283
|
case "end":
|
6452
|
-
return
|
6284
|
+
return _context59.stop();
|
6453
6285
|
}
|
6454
|
-
},
|
6286
|
+
}, _callee59);
|
6455
6287
|
}));
|
6456
|
-
function extractResultData(
|
6288
|
+
function extractResultData(_x102) {
|
6457
6289
|
return _extractResultData22.apply(this, arguments);
|
6458
6290
|
}
|
6459
6291
|
return extractResultData;
|
@@ -6501,13 +6333,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6501
6333
|
}, {
|
6502
6334
|
key: "callServiceAPI",
|
6503
6335
|
value: function () {
|
6504
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6336
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
|
6505
6337
|
var n;
|
6506
|
-
return _regeneratorRuntime().wrap(function
|
6507
|
-
while (1) switch (
|
6338
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6339
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6508
6340
|
case 0:
|
6509
6341
|
if (this.requestSettings) {
|
6510
|
-
|
6342
|
+
_context60.next = 2;
|
6511
6343
|
break;
|
6512
6344
|
}
|
6513
6345
|
throw new Error("Request settings have not been set up");
|
@@ -6516,11 +6348,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6516
6348
|
HTTPRequest.request(this, n, e);
|
6517
6349
|
case 4:
|
6518
6350
|
case "end":
|
6519
|
-
return
|
6351
|
+
return _context60.stop();
|
6520
6352
|
}
|
6521
|
-
},
|
6353
|
+
}, _callee60, this);
|
6522
6354
|
}));
|
6523
|
-
function callServiceAPI(
|
6355
|
+
function callServiceAPI(_x103, _x104) {
|
6524
6356
|
return _callServiceAPI19.apply(this, arguments);
|
6525
6357
|
}
|
6526
6358
|
return callServiceAPI;
|
@@ -6528,26 +6360,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6528
6360
|
}, {
|
6529
6361
|
key: "extractResultData",
|
6530
6362
|
value: function () {
|
6531
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6532
|
-
return _regeneratorRuntime().wrap(function
|
6533
|
-
while (1) switch (
|
6363
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee61(e) {
|
6364
|
+
return _regeneratorRuntime().wrap(function _callee61$(_context61) {
|
6365
|
+
while (1) switch (_context61.prev = _context61.next) {
|
6534
6366
|
case 0:
|
6535
6367
|
if (!e.message) {
|
6536
|
-
|
6368
|
+
_context61.next = 2;
|
6537
6369
|
break;
|
6538
6370
|
}
|
6539
6371
|
throw e.message;
|
6540
6372
|
case 2:
|
6541
|
-
return
|
6373
|
+
return _context61.abrupt("return", {
|
6542
6374
|
text: e.text
|
6543
6375
|
});
|
6544
6376
|
case 3:
|
6545
6377
|
case "end":
|
6546
|
-
return
|
6378
|
+
return _context61.stop();
|
6547
6379
|
}
|
6548
|
-
},
|
6380
|
+
}, _callee61);
|
6549
6381
|
}));
|
6550
|
-
function extractResultData(
|
6382
|
+
function extractResultData(_x105) {
|
6551
6383
|
return _extractResultData23.apply(this, arguments);
|
6552
6384
|
}
|
6553
6385
|
return extractResultData;
|
@@ -6714,11 +6546,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
|
|
6714
6546
|
var n = {};
|
6715
6547
|
setTimeout(function () {
|
6716
6548
|
if (_typeof(e) == "object" && (e.lang && (n.lang = e.lang), e.pitch && (n.pitch = e.pitch), e.rate && (n.rate = e.rate), e.volume && (n.volume = e.volume), e.voiceName)) {
|
6717
|
-
var
|
6549
|
+
var s = window.speechSynthesis.getVoices().find(function (o) {
|
6718
6550
|
var a;
|
6719
6551
|
return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
|
6720
6552
|
});
|
6721
|
-
|
6553
|
+
s && (n.voice = s);
|
6722
6554
|
}
|
6723
6555
|
t(n);
|
6724
6556
|
}, $.LOAD_VOICES_MS);
|
@@ -6760,9 +6592,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
|
|
6760
6592
|
key: "applyCustomStylesToElements",
|
6761
6593
|
value: function applyCustomStylesToElements(e, t, n) {
|
6762
6594
|
if (n && (Object.assign(e.outerContainer.style, n.outerContainer), Object.assign(e.innerContainer.style, n.innerContainer), Object.assign(e.bubbleElement.style, n.bubble), t)) {
|
6763
|
-
var
|
6764
|
-
|
6765
|
-
Object.assign(
|
6595
|
+
var s = e.bubbleElement.children[0],
|
6596
|
+
o = s.tagName.toLocaleLowerCase() !== "a" ? s : s.children[0];
|
6597
|
+
Object.assign(o.style, n.media);
|
6766
6598
|
}
|
6767
6599
|
}
|
6768
6600
|
}, {
|
@@ -6905,24 +6737,24 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6905
6737
|
}, {
|
6906
6738
|
key: "addNewImageMessage",
|
6907
6739
|
value: function () {
|
6908
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6740
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
|
6909
6741
|
var s,
|
6910
6742
|
o,
|
6911
6743
|
a,
|
6912
|
-
|
6913
|
-
return _regeneratorRuntime().wrap(function
|
6914
|
-
while (1) switch (
|
6744
|
+
_args62 = arguments;
|
6745
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6746
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6915
6747
|
case 0:
|
6916
|
-
s =
|
6748
|
+
s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
|
6917
6749
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6918
6750
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6919
6751
|
case 3:
|
6920
6752
|
case "end":
|
6921
|
-
return
|
6753
|
+
return _context62.stop();
|
6922
6754
|
}
|
6923
|
-
},
|
6755
|
+
}, _callee62);
|
6924
6756
|
}));
|
6925
|
-
function addNewImageMessage(
|
6757
|
+
function addNewImageMessage(_x106, _x107, _x108) {
|
6926
6758
|
return _addNewImageMessage.apply(this, arguments);
|
6927
6759
|
}
|
6928
6760
|
return addNewImageMessage;
|
@@ -7258,27 +7090,27 @@ var Messages = /*#__PURE__*/function () {
|
|
7258
7090
|
}, {
|
7259
7091
|
key: "addMultipleFiles",
|
7260
7092
|
value: function () {
|
7261
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7093
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
7262
7094
|
var _this31 = this;
|
7263
|
-
return _regeneratorRuntime().wrap(function
|
7264
|
-
while (1) switch (
|
7095
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7096
|
+
while (1) switch (_context63.prev = _context63.next) {
|
7265
7097
|
case 0:
|
7266
|
-
return
|
7098
|
+
return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
|
7267
7099
|
return new Promise(function (n) {
|
7268
7100
|
if (!t.type || t.type === "any") {
|
7269
|
-
var
|
7101
|
+
var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
7270
7102
|
_this31.addNewMessage({
|
7271
7103
|
files: [{
|
7272
|
-
name:
|
7104
|
+
name: s,
|
7273
7105
|
type: "any"
|
7274
7106
|
}]
|
7275
7107
|
}, !1, !0), n(!0);
|
7276
7108
|
} else {
|
7277
|
-
var
|
7278
|
-
|
7109
|
+
var _s = new FileReader();
|
7110
|
+
_s.readAsDataURL(t.file), _s.onload = function () {
|
7279
7111
|
_this31.addNewMessage({
|
7280
7112
|
files: [{
|
7281
|
-
src:
|
7113
|
+
src: _s.result,
|
7282
7114
|
type: t.type
|
7283
7115
|
}]
|
7284
7116
|
}, !1, !0), n(!0);
|
@@ -7288,15 +7120,15 @@ var Messages = /*#__PURE__*/function () {
|
|
7288
7120
|
})));
|
7289
7121
|
case 1:
|
7290
7122
|
case "end":
|
7291
|
-
return
|
7123
|
+
return _context63.stop();
|
7292
7124
|
}
|
7293
|
-
},
|
7125
|
+
}, _callee63);
|
7294
7126
|
}));
|
7295
|
-
function addMultipleFiles(
|
7127
|
+
function addMultipleFiles(_x109) {
|
7296
7128
|
return _addMultipleFiles.apply(this, arguments);
|
7297
7129
|
}
|
7298
7130
|
return addMultipleFiles;
|
7299
|
-
}()
|
7131
|
+
}()
|
7300
7132
|
}, {
|
7301
7133
|
key: "clearMessages",
|
7302
7134
|
value: function clearMessages(e) {
|
@@ -7305,7 +7137,7 @@ var Messages = /*#__PURE__*/function () {
|
|
7305
7137
|
this._messageElementRefs.forEach(function (o) {
|
7306
7138
|
var a = o.bubbleElement.classList;
|
7307
7139
|
a.contains("loading-message-text") || a.contains("streamed-message") ? t.push(o) : o.outerContainer.remove();
|
7308
|
-
}), this._messageElementRefs = t, e !== !1 && ((n = this._introPanel) != null && n._elementRef && this._introPanel.display(), this.addIntroductoryMessage()), (s = this._onClearMessages) == null || s.call(this);
|
7140
|
+
}), this._messageElementRefs = t, e !== !1 && ((n = this._introPanel) != null && n._elementRef && this._introPanel.display(), this.addIntroductoryMessage()), this.messages.splice(0, this.messages.length), (s = this._onClearMessages) == null || s.call(this);
|
7309
7141
|
}
|
7310
7142
|
// this is mostly used for enabling highlight.js to highlight code if it is downloads later
|
7311
7143
|
}, {
|
@@ -7366,10 +7198,10 @@ var Messages = /*#__PURE__*/function () {
|
|
7366
7198
|
return Messages;
|
7367
7199
|
}();
|
7368
7200
|
var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
7369
|
-
function
|
7370
|
-
_classCallCheck(this,
|
7201
|
+
function E() {
|
7202
|
+
_classCallCheck(this, E);
|
7371
7203
|
}
|
7372
|
-
_createClass(
|
7204
|
+
_createClass(E, null, [{
|
7373
7205
|
key: "adjustInputPadding",
|
7374
7206
|
value: function adjustInputPadding(e, t) {
|
7375
7207
|
t["inside-left"].length > 0 && e.classList.add("text-input-inner-left-adjustment"), t["inside-right"].length > 0 && e.classList.add("text-input-inner-right-adjustment");
|
@@ -7377,7 +7209,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7377
7209
|
}, {
|
7378
7210
|
key: "adjustForOutsideButton",
|
7379
7211
|
value: function adjustForOutsideButton(e, t, n) {
|
7380
|
-
n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(
|
7212
|
+
n["outside-right"].length === 0 && n["outside-left"].length > 0 ? (e[0].classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_SMALL_ADJUSTMENT_CLASS)) : n["outside-left"].length === 0 && n["outside-right"].length > 0 && (e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_SMALL_ADJUSTMENT_CLASS));
|
7381
7213
|
}
|
7382
7214
|
// when submit is the only button
|
7383
7215
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -7385,10 +7217,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7385
7217
|
key: "adjustOutsideSubmit",
|
7386
7218
|
value: function adjustOutsideSubmit(e, t, n) {
|
7387
7219
|
if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
|
7388
|
-
if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(
|
7220
|
+
if (n["outside-right"].length === 0 && n["outside-left"].length > 0) return e[0].classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS), n["outside-left"].map(function (s) {
|
7389
7221
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
7390
7222
|
});
|
7391
|
-
if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(
|
7223
|
+
if (n["outside-left"].length === 0 && n["outside-right"].length > 0) return e[3].classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), t.classList.add(E.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS), n["outside-right"].map(function (s) {
|
7392
7224
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
7393
7225
|
});
|
7394
7226
|
}
|
@@ -7396,10 +7228,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7396
7228
|
}, {
|
7397
7229
|
key: "set",
|
7398
7230
|
value: function set(e, t, n, s) {
|
7399
|
-
!!
|
7231
|
+
!!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
|
7400
7232
|
}
|
7401
7233
|
}]);
|
7402
|
-
return
|
7234
|
+
return E;
|
7403
7235
|
}();
|
7404
7236
|
_InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
|
7405
7237
|
_InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
|
@@ -7563,8 +7395,8 @@ var InputButton = /*#__PURE__*/function () {
|
|
7563
7395
|
value: function unsetCustomStateStyles(e) {
|
7564
7396
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
7565
7397
|
var n = e[t],
|
7566
|
-
|
7567
|
-
|
7398
|
+
s = n && this._customStyles[n];
|
7399
|
+
s && ButtonCSS.unsetActionCSS(this.elementRef, s);
|
7568
7400
|
}
|
7569
7401
|
}
|
7570
7402
|
}, {
|
@@ -7928,14 +7760,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
7928
7760
|
key: "addAttachmentBasedOnType",
|
7929
7761
|
value: function addAttachmentBasedOnType(e, t, n) {
|
7930
7762
|
if (e.type.startsWith("image")) {
|
7931
|
-
var
|
7932
|
-
this.addFileAttachment(e, "image",
|
7763
|
+
var s = FileAttachmentsType.createImageAttachment(t);
|
7764
|
+
this.addFileAttachment(e, "image", s, n);
|
7933
7765
|
} else if (e.type.startsWith("audio")) {
|
7934
|
-
var
|
7935
|
-
this.addFileAttachment(e, "audio",
|
7766
|
+
var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
|
7767
|
+
this.addFileAttachment(e, "audio", _s2, n);
|
7936
7768
|
} else {
|
7937
|
-
var
|
7938
|
-
this.addFileAttachment(e, "any",
|
7769
|
+
var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
|
7770
|
+
this.addFileAttachment(e, "any", _s3, n);
|
7939
7771
|
}
|
7940
7772
|
}
|
7941
7773
|
}, {
|
@@ -7997,15 +7829,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
7997
7829
|
value: function isFileTypeValid(e, t) {
|
7998
7830
|
if (t === "") return !0;
|
7999
7831
|
var n = t.split(",");
|
8000
|
-
for (var
|
8001
|
-
var
|
8002
|
-
if (e.type ===
|
8003
|
-
if (
|
8004
|
-
var
|
8005
|
-
if (e.name.endsWith(
|
7832
|
+
for (var s = 0; s < n.length; s++) {
|
7833
|
+
var o = n[s].trim();
|
7834
|
+
if (e.type === o) return !0;
|
7835
|
+
if (o.startsWith(".")) {
|
7836
|
+
var a = o.slice(1);
|
7837
|
+
if (e.name.endsWith(a)) return !0;
|
8006
7838
|
} else {
|
8007
|
-
if (e.name.endsWith(
|
8008
|
-
if (
|
7839
|
+
if (e.name.endsWith(o)) return !0;
|
7840
|
+
if (o.endsWith("/*") && e.type.startsWith(o.slice(0, -2))) return !0;
|
8009
7841
|
}
|
8010
7842
|
}
|
8011
7843
|
return !1;
|
@@ -8038,18 +7870,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
8038
7870
|
var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <title>play</title>\n <path d=\"M5.92 24.096q0 1.088 0.928 1.728 0.512 0.288 1.088 0.288 0.448 0 0.896-0.224l16.16-8.064q0.48-0.256 0.8-0.736t0.288-1.088-0.288-1.056-0.8-0.736l-16.16-8.064q-0.448-0.224-0.896-0.224-0.544 0-1.088 0.288-0.928 0.608-0.928 1.728v16.16z\"></path>\n</svg>",
|
8039
7871
|
STOP_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n<title>stop</title>\n<path d=\"M5.92 24.096q0 0.832 0.576 1.408t1.44 0.608h16.128q0.832 0 1.44-0.608t0.576-1.408v-16.16q0-0.832-0.576-1.44t-1.44-0.576h-16.128q-0.832 0-1.44 0.576t-0.576 1.44v16.16z\"></path>\n</svg>",
|
8040
7872
|
_AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
|
8041
|
-
_inherits(
|
8042
|
-
var _super35 = _createSuper(
|
8043
|
-
function
|
8044
|
-
_classCallCheck(this,
|
7873
|
+
_inherits(k, _FileAttachmentsType);
|
7874
|
+
var _super35 = _createSuper(k);
|
7875
|
+
function k(e, t, n) {
|
7876
|
+
_classCallCheck(this, k);
|
8045
7877
|
return _super35.call(this, e, t, n);
|
8046
7878
|
}
|
8047
|
-
_createClass(
|
7879
|
+
_createClass(k, [{
|
8048
7880
|
key: "createTimer",
|
8049
7881
|
value: function createTimer(e, t) {
|
8050
7882
|
var _this37 = this;
|
8051
7883
|
var n = 0;
|
8052
|
-
var s = t !== void 0 && t <
|
7884
|
+
var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
|
8053
7885
|
return setInterval(function () {
|
8054
7886
|
var l;
|
8055
7887
|
n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -8061,7 +7893,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8061
7893
|
}, {
|
8062
7894
|
key: "createPlaceholderAudioAttachment",
|
8063
7895
|
value: function createPlaceholderAudioAttachment(e) {
|
8064
|
-
var t =
|
7896
|
+
var t = k.createAudioContainer(),
|
8065
7897
|
n = document.createElement("div");
|
8066
7898
|
n.classList.add("audio-placeholder-text-3-digits");
|
8067
7899
|
var s = document.createElement("div");
|
@@ -8098,7 +7930,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8098
7930
|
key: "completePlaceholderAttachment",
|
8099
7931
|
value: function completePlaceholderAttachment(e, t) {
|
8100
7932
|
var n = this._activePlaceholderAttachment;
|
8101
|
-
n && (n.file = e,
|
7933
|
+
n && (n.file = e, k.addAudioElements(n.attachmentContainerElement.children[0], t), n.removeButton = this.createRemoveAttachmentButton(n), n.attachmentContainerElement.appendChild(n.removeButton), this._activePlaceholderAttachment = void 0, this.clearTimer());
|
8102
7934
|
}
|
8103
7935
|
}, {
|
8104
7936
|
key: "removePlaceholderAttachment",
|
@@ -8138,8 +7970,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8138
7970
|
}, {
|
8139
7971
|
key: "createAudioAttachment",
|
8140
7972
|
value: function createAudioAttachment(e) {
|
8141
|
-
var t =
|
8142
|
-
return
|
7973
|
+
var t = k.createAudioContainer();
|
7974
|
+
return k.addAudioElements(t, e), t;
|
8143
7975
|
}
|
8144
7976
|
}, {
|
8145
7977
|
key: "stopAttachmentPlayback",
|
@@ -8148,7 +7980,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8148
7980
|
(s = (n = (t = e.children[0]) == null ? void 0 : t.children) == null ? void 0 : n[0]) != null && s.classList.contains("stop-icon") && e.children[0].click();
|
8149
7981
|
}
|
8150
7982
|
}]);
|
8151
|
-
return
|
7983
|
+
return k;
|
8152
7984
|
}(FileAttachmentsType);
|
8153
7985
|
_AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
|
8154
7986
|
var AudioFileAttachmentType = _AudioFileAttachmentType;
|
@@ -8202,33 +8034,33 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8202
8034
|
}, {
|
8203
8035
|
key: "completePlaceholders",
|
8204
8036
|
value: function () {
|
8205
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8206
|
-
return _regeneratorRuntime().wrap(function
|
8207
|
-
while (1) switch (
|
8037
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee65() {
|
8038
|
+
return _regeneratorRuntime().wrap(function _callee65$(_context65) {
|
8039
|
+
while (1) switch (_context65.prev = _context65.next) {
|
8208
8040
|
case 0:
|
8209
|
-
|
8041
|
+
_context65.next = 2;
|
8210
8042
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
8211
|
-
var
|
8043
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
|
8212
8044
|
var t;
|
8213
|
-
return _regeneratorRuntime().wrap(function
|
8214
|
-
while (1) switch (
|
8045
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
8046
|
+
while (1) switch (_context64.prev = _context64.next) {
|
8215
8047
|
case 0:
|
8216
|
-
return
|
8048
|
+
return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
8217
8049
|
case 1:
|
8218
8050
|
case "end":
|
8219
|
-
return
|
8051
|
+
return _context64.stop();
|
8220
8052
|
}
|
8221
|
-
},
|
8053
|
+
}, _callee64);
|
8222
8054
|
}));
|
8223
|
-
return function (
|
8224
|
-
return
|
8055
|
+
return function (_x110) {
|
8056
|
+
return _ref5.apply(this, arguments);
|
8225
8057
|
};
|
8226
8058
|
}()));
|
8227
8059
|
case 2:
|
8228
8060
|
case "end":
|
8229
|
-
return
|
8061
|
+
return _context65.stop();
|
8230
8062
|
}
|
8231
|
-
},
|
8063
|
+
}, _callee65, this);
|
8232
8064
|
}));
|
8233
8065
|
function completePlaceholders() {
|
8234
8066
|
return _completePlaceholders.apply(this, arguments);
|
@@ -8258,7 +8090,7 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8258
8090
|
e.forEach(function (n) {
|
8259
8091
|
var s = new FileReader();
|
8260
8092
|
s.readAsDataURL(n), s.onload = function (o) {
|
8261
|
-
for (var
|
8093
|
+
for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
|
8262
8094
|
};
|
8263
8095
|
});
|
8264
8096
|
}
|
@@ -8266,11 +8098,11 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8266
8098
|
return FileAttachments;
|
8267
8099
|
}();
|
8268
8100
|
var _Modal = /*#__PURE__*/function () {
|
8269
|
-
function
|
8270
|
-
_classCallCheck(this,
|
8271
|
-
this._isOpen = !1, this._contentRef =
|
8101
|
+
function T(e, t, n) {
|
8102
|
+
_classCallCheck(this, T);
|
8103
|
+
this._isOpen = !1, this._contentRef = T.createModalContent(t, n == null ? void 0 : n.backgroundColor), this._buttonPanel = T.createButtonPanel(n == null ? void 0 : n.backgroundColor), this._elementRef = T.createContainer(this._contentRef, n), this._elementRef.appendChild(this._buttonPanel), e.appendChild(this._elementRef), this._backgroundPanelRef = T.createDarkBackgroundPanel(), e.appendChild(this._backgroundPanelRef), this.addWindowEvents();
|
8272
8104
|
}
|
8273
|
-
_createClass(
|
8105
|
+
_createClass(T, [{
|
8274
8106
|
key: "isOpen",
|
8275
8107
|
value: function isOpen() {
|
8276
8108
|
return this._isOpen;
|
@@ -8292,7 +8124,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8292
8124
|
var _this40 = this;
|
8293
8125
|
this._elementRef.classList.remove("show-modal"), this._elementRef.classList.add("hide-modal"), this._backgroundPanelRef.classList.remove("show-modal-background"), this._backgroundPanelRef.classList.add("hide-modal-background"), this._isOpen = !1, setTimeout(function () {
|
8294
8126
|
_this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
|
8295
|
-
},
|
8127
|
+
}, T.MODAL_CLOSE_TIMEOUT_MS);
|
8296
8128
|
}
|
8297
8129
|
}, {
|
8298
8130
|
key: "displayModalElements",
|
@@ -8308,7 +8140,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8308
8140
|
key: "addCloseButton",
|
8309
8141
|
value: function addCloseButton(e, t, n) {
|
8310
8142
|
var _this41 = this;
|
8311
|
-
var s = t ?
|
8143
|
+
var s = t ? T.createSVGButton(e) : T.createTextButton(e);
|
8312
8144
|
return this.addButtons(s), s.onclick = function () {
|
8313
8145
|
_this41.close(), setTimeout(function () {
|
8314
8146
|
n == null || n();
|
@@ -8368,12 +8200,12 @@ var _Modal = /*#__PURE__*/function () {
|
|
8368
8200
|
value: function createTextModalFunc(e, t, n) {
|
8369
8201
|
var s;
|
8370
8202
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
8371
|
-
var
|
8372
|
-
return
|
8203
|
+
var o = new T(e, ["modal-content"], t.files.infoModal.containerStyle);
|
8204
|
+
return o.addCloseButton("OK", !1, n), o.openTextModal.bind(o, t.infoModalTextMarkUp || "");
|
8373
8205
|
}
|
8374
8206
|
}
|
8375
8207
|
}]);
|
8376
|
-
return
|
8208
|
+
return T;
|
8377
8209
|
}();
|
8378
8210
|
_Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
|
8379
8211
|
var Modal = _Modal;
|
@@ -8384,10 +8216,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
|
|
8384
8216
|
function UploadFileButton(e, t, n, s, o, a) {
|
8385
8217
|
var _this43;
|
8386
8218
|
_classCallCheck(this, UploadFileButton);
|
8387
|
-
var c, u, d, h,
|
8219
|
+
var c, u, d, h, p, f;
|
8388
8220
|
_this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
|
8389
8221
|
var l = _this43.createInnerElements(s, o, _this43._customStyles);
|
8390
|
-
_this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (
|
8222
|
+
_this43._inputElement = UploadFileButton.createInputElement((u = n == null ? void 0 : n.files) == null ? void 0 : u.acceptedFormats), _this43.addClickEvent(e, n), _this43.elementRef.replaceChildren(l.styles), _this43.reapplyStateStyle("styles"), _this43._fileAttachmentsType = t, _this43._openModalOnce = ((h = (d = n.files) == null ? void 0 : d.infoModal) == null ? void 0 : h.openModalOnce) === !1 || (f = (p = n.files) == null ? void 0 : p.infoModal) == null ? void 0 : f.openModalOnce;
|
8391
8223
|
return _this43;
|
8392
8224
|
}
|
8393
8225
|
_createClass(UploadFileButton, [{
|
@@ -8634,7 +8466,7 @@ var Translate = /*#__PURE__*/function () {
|
|
8634
8466
|
key: "translate",
|
8635
8467
|
value: function translate(e, t) {
|
8636
8468
|
var n = text_1$3.Text.breakupIntoWordsArr(e);
|
8637
|
-
for (var
|
8469
|
+
for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
|
8638
8470
|
return n.join("");
|
8639
8471
|
}
|
8640
8472
|
}]);
|
@@ -8654,9 +8486,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
|
|
8654
8486
|
key: "extract",
|
8655
8487
|
value: function extract(e, t, n) {
|
8656
8488
|
var s = "";
|
8657
|
-
for (var
|
8658
|
-
var
|
8659
|
-
n && (
|
8489
|
+
for (var o = e.resultIndex; o < e.results.length; ++o) {
|
8490
|
+
var a = e.results[o][0].transcript;
|
8491
|
+
n && (a = translate_1$1.Translate.translate(a, n)), e.results[o].isFinal ? t += a : s += a;
|
8660
8492
|
}
|
8661
8493
|
return {
|
8662
8494
|
interimTranscript: s,
|
@@ -8669,8 +8501,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
|
|
8669
8501
|
value: function extractSafari(e, t, n) {
|
8670
8502
|
var s = "";
|
8671
8503
|
var o = "";
|
8672
|
-
for (var
|
8673
|
-
var l = e.results[
|
8504
|
+
for (var a = e.resultIndex; a < e.results.length; ++a) {
|
8505
|
+
var l = e.results[a][0].transcript;
|
8674
8506
|
n && (l = translate_1$1.Translate.translate(l, n)), s += l;
|
8675
8507
|
}
|
8676
8508
|
return {
|
@@ -8842,8 +8674,8 @@ var Elements = /*#__PURE__*/function () {
|
|
8842
8674
|
if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
|
8843
8675
|
var n = window.getSelection();
|
8844
8676
|
if (n != null && n.focusNode) {
|
8845
|
-
var
|
8846
|
-
|
8677
|
+
var s = n.getRangeAt(0);
|
8678
|
+
s.insertNode(e.scrollingSpan), s.insertNode(e.interimSpan), s.insertNode(e.finalSpan), s.collapse(!1), n.removeAllRanges(), n.addRange(s);
|
8847
8679
|
return;
|
8848
8680
|
}
|
8849
8681
|
}
|
@@ -8877,20 +8709,20 @@ var Cursor = /*#__PURE__*/function () {
|
|
8877
8709
|
value: function setOffsetForGeneric(e, t) {
|
8878
8710
|
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
8879
8711
|
var s = 0;
|
8880
|
-
for (var
|
8881
|
-
var
|
8882
|
-
if (
|
8883
|
-
var l = Cursor.setOffsetForGeneric(
|
8712
|
+
for (var o = 0; o < e.childNodes.length; o += 1) {
|
8713
|
+
var a = e.childNodes[o];
|
8714
|
+
if (a.childNodes.length > 0) {
|
8715
|
+
var l = Cursor.setOffsetForGeneric(a, t, n);
|
8884
8716
|
if (l === -1) return -1;
|
8885
8717
|
n += l;
|
8886
|
-
} else if (
|
8887
|
-
if (n +
|
8718
|
+
} else if (a.textContent !== null) {
|
8719
|
+
if (n + a.textContent.length > t) {
|
8888
8720
|
var _l = document.createRange();
|
8889
|
-
_l.setStart(
|
8721
|
+
_l.setStart(a, t - n), _l.collapse(!0);
|
8890
8722
|
var c = window.getSelection();
|
8891
8723
|
return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
|
8892
8724
|
}
|
8893
|
-
n +=
|
8725
|
+
n += a.textContent.length, s += a.textContent.length;
|
8894
8726
|
}
|
8895
8727
|
}
|
8896
8728
|
return s;
|
@@ -8908,8 +8740,8 @@ var Cursor = /*#__PURE__*/function () {
|
|
8908
8740
|
value: function setOffsetForSafariGeneric(e, t) {
|
8909
8741
|
var n = window.getSelection();
|
8910
8742
|
if (n) {
|
8911
|
-
var
|
8912
|
-
console.log(
|
8743
|
+
var s = Cursor.getGenericElementCursorOffset(e, n, !0);
|
8744
|
+
console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
|
8913
8745
|
}
|
8914
8746
|
}
|
8915
8747
|
// set to automatically scroll to cursor (scroll does not work in Safari)
|
@@ -8940,9 +8772,9 @@ var Cursor = /*#__PURE__*/function () {
|
|
8940
8772
|
value: function getGenericElementCursorOffset(e, t, n) {
|
8941
8773
|
var s = 0;
|
8942
8774
|
if (t.rangeCount > 0) {
|
8943
|
-
var
|
8944
|
-
|
8945
|
-
|
8775
|
+
var o = t.getRangeAt(0),
|
8776
|
+
a = o.cloneRange();
|
8777
|
+
a.selectNodeContents(e), n ? a.setEnd(o.startContainer, o.startOffset) : a.setEnd(o.endContainer, o.endOffset), s = a.toString().length;
|
8946
8778
|
}
|
8947
8779
|
return s;
|
8948
8780
|
}
|
@@ -9005,10 +8837,10 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
9005
8837
|
key: "checkIfMatchesWord",
|
9006
8838
|
value: function checkIfMatchesWord(e, t, n) {
|
9007
8839
|
var s = e;
|
9008
|
-
for (var
|
9009
|
-
var
|
8840
|
+
for (var o = n.length - 1; o >= 0; o -= 1) {
|
8841
|
+
var a = o,
|
9010
8842
|
l = s.length - 1;
|
9011
|
-
for (; n[
|
8843
|
+
for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
|
9012
8844
|
if (l < 0) return !0;
|
9013
8845
|
}
|
9014
8846
|
return !1;
|
@@ -9022,31 +8854,31 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
9022
8854
|
if (!u || !s || !n) return;
|
9023
8855
|
var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
|
9024
8856
|
h = text_1$2.Text.breakupIntoWordsArr(d),
|
9025
|
-
|
9026
|
-
if (u.commandMode &&
|
8857
|
+
p = ((l = u.settings) === null || l === void 0 ? void 0 : l.substrings) === !1 ? CommandUtils.checkIfMatchesWord : CommandUtils.checkIfMatchesSubstring;
|
8858
|
+
if (u.commandMode && p(u.commandMode, d, h)) return e.setInterimColorToFinal(), setTimeout(function () {
|
9027
8859
|
return CommandUtils.toggleCommandModeOn(e);
|
9028
8860
|
}), {
|
9029
8861
|
doNotProcessTranscription: !1
|
9030
8862
|
};
|
9031
8863
|
if (!(u.commandMode && !e.isWaitingForCommand)) {
|
9032
|
-
if (u.stop &&
|
8864
|
+
if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
|
9033
8865
|
return e.stop();
|
9034
8866
|
}), {
|
9035
8867
|
doNotProcessTranscription: !1
|
9036
8868
|
};
|
9037
|
-
if (u.pause &&
|
9038
|
-
var
|
9039
|
-
e.isPaused = !0, (
|
8869
|
+
if (u.pause && p(u.pause, d, h)) return CommandUtils.toggleCommandModeOff(e), e.setInterimColorToFinal(), setTimeout(function () {
|
8870
|
+
var f;
|
8871
|
+
e.isPaused = !0, (f = e.onPauseTrigger) === null || f === void 0 || f.call(e, !0);
|
9040
8872
|
}), {
|
9041
8873
|
doNotProcessTranscription: !1
|
9042
8874
|
};
|
9043
|
-
if (u.resume &&
|
8875
|
+
if (u.resume && p(u.resume, d, h)) return e.isPaused = !1, (c = e.onPauseTrigger) === null || c === void 0 || c.call(e, !1), CommandUtils.toggleCommandModeOff(e), e.resetRecording(n), {
|
9044
8876
|
doNotProcessTranscription: !0
|
9045
8877
|
};
|
9046
|
-
if (u.reset &&
|
8878
|
+
if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
|
9047
8879
|
doNotProcessTranscription: !0
|
9048
8880
|
};
|
9049
|
-
if (u.removeAllText &&
|
8881
|
+
if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
|
9050
8882
|
doNotProcessTranscription: !0
|
9051
8883
|
};
|
9052
8884
|
}
|
@@ -9077,9 +8909,9 @@ var Highlight = /*#__PURE__*/function () {
|
|
9077
8909
|
value: function setStateForGeneric(e, t) {
|
9078
8910
|
var n = window.getSelection();
|
9079
8911
|
if (n != null && n.focusNode) {
|
9080
|
-
var
|
9081
|
-
|
9082
|
-
e.isHighlighted =
|
8912
|
+
var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0),
|
8913
|
+
o = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !1);
|
8914
|
+
e.isHighlighted = s !== o;
|
9083
8915
|
}
|
9084
8916
|
}
|
9085
8917
|
}, {
|
@@ -9092,8 +8924,8 @@ var Highlight = /*#__PURE__*/function () {
|
|
9092
8924
|
value: function removeForGeneric(e, t) {
|
9093
8925
|
var n = window.getSelection();
|
9094
8926
|
if (n) {
|
9095
|
-
var
|
9096
|
-
n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t,
|
8927
|
+
var s = cursor_1$2.Cursor.getGenericElementCursorOffset(t, n, !0);
|
8928
|
+
n.deleteFromDocument(), cursor_1$2.Cursor.setOffsetForGeneric(t, s), e.isHighlighted = !1;
|
9097
8929
|
}
|
9098
8930
|
}
|
9099
8931
|
}, {
|
@@ -9103,8 +8935,8 @@ var Highlight = /*#__PURE__*/function () {
|
|
9103
8935
|
s = t.selectionEnd,
|
9104
8936
|
o = t.value;
|
9105
8937
|
if (n && s) {
|
9106
|
-
var
|
9107
|
-
t.value =
|
8938
|
+
var a = o.substring(0, n) + o.substring(s);
|
8939
|
+
t.value = a, cursor_1$2.Cursor.setOffsetForPrimitive(t, n, e.autoScroll);
|
9108
8940
|
}
|
9109
8941
|
e.isHighlighted = !1;
|
9110
8942
|
}
|
@@ -9128,11 +8960,11 @@ var Padding = /*#__PURE__*/function () {
|
|
9128
8960
|
key: "setStateForPrimitiveElement",
|
9129
8961
|
value: function setStateForPrimitiveElement(e, t) {
|
9130
8962
|
if (document.activeElement === t && t.selectionStart !== null) {
|
9131
|
-
var
|
9132
|
-
|
9133
|
-
|
9134
|
-
l = t.value[
|
9135
|
-
text_1$1.Text.isCharDefined(
|
8963
|
+
var s = t.selectionStart,
|
8964
|
+
o = t.value[s - 1],
|
8965
|
+
a = t.selectionEnd === null ? s : t.selectionEnd,
|
8966
|
+
l = t.value[a];
|
8967
|
+
text_1$1.Text.isCharDefined(o) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), text_1$1.Text.isCharDefined(l) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === a;
|
9136
8968
|
return;
|
9137
8969
|
}
|
9138
8970
|
var n = t.value[t.value.length - 1];
|
@@ -9203,11 +9035,11 @@ var Speech = /*#__PURE__*/function () {
|
|
9203
9035
|
value: function prepareBeforeStart(e) {
|
9204
9036
|
var t, n;
|
9205
9037
|
if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
|
9206
|
-
var
|
9038
|
+
var o = e.element.find(function (a) {
|
9207
9039
|
return a === document.activeElement;
|
9208
9040
|
}) || e.element[0];
|
9209
|
-
if (!
|
9210
|
-
this.prepare(
|
9041
|
+
if (!o) return;
|
9042
|
+
this.prepare(o);
|
9211
9043
|
} else this.prepare(e.element);
|
9212
9044
|
(e == null ? void 0 : e.displayInterimResults) !== void 0 && (this._displayInterimResults = e.displayInterimResults), e != null && e.textColor && (this._finalTextColor = (t = e == null ? void 0 : e.textColor) === null || t === void 0 ? void 0 : t["final"], elements_1.Elements.applyCustomColors(this, e.textColor)), (e == null ? void 0 : e.insertInCursorLocation) !== void 0 && (this.insertInCursorLocation = e.insertInCursorLocation), (e == null ? void 0 : e.autoScroll) !== void 0 && (this.autoScroll = e.autoScroll), this._onResult = e == null ? void 0 : e.onResult, this._onPreResult = e == null ? void 0 : e.onPreResult, this._onStart = e == null ? void 0 : e.onStart, this._onStop = e == null ? void 0 : e.onStop, this._onError = e == null ? void 0 : e.onError, this.onCommandModeTrigger = e == null ? void 0 : e.onCommandModeTrigger, this.onPauseTrigger = e == null ? void 0 : e.onPauseTrigger, this._options = e, !((n = this._options) === null || n === void 0) && n.commands && (this.commands = commandUtils_1$1.CommandUtils.process(this._options.commands));
|
9213
9045
|
}
|
@@ -9250,8 +9082,8 @@ var Speech = /*#__PURE__*/function () {
|
|
9250
9082
|
this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
|
9251
9083
|
var s = this.startPadding + this.finalTranscript + t;
|
9252
9084
|
if (e.value = s + this.endPadding, !this.isTargetInShadow) {
|
9253
|
-
var
|
9254
|
-
cursor_1.Cursor.setOffsetForPrimitive(e,
|
9085
|
+
var o = s.length + this.numberOfSpacesAfterNewText;
|
9086
|
+
cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
|
9255
9087
|
}
|
9256
9088
|
this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
|
9257
9089
|
}
|
@@ -9352,8 +9184,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
|
|
9352
9184
|
var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
|
9353
9185
|
t = _this46$_extractText.interimTranscript,
|
9354
9186
|
n = _this46$_extractText.finalTranscript,
|
9355
|
-
|
9356
|
-
_this46.updateElements(t, n,
|
9187
|
+
s = _this46$_extractText.newText;
|
9188
|
+
_this46.updateElements(t, n, s);
|
9357
9189
|
}
|
9358
9190
|
});
|
9359
9191
|
}
|
@@ -9448,26 +9280,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9448
9280
|
}, {
|
9449
9281
|
key: "getNewSpeechConfig",
|
9450
9282
|
value: function () {
|
9451
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9452
|
-
return _regeneratorRuntime().wrap(function
|
9453
|
-
while (1) switch (
|
9283
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t) {
|
9284
|
+
return _regeneratorRuntime().wrap(function _callee66$(_context66) {
|
9285
|
+
while (1) switch (_context66.prev = _context66.next) {
|
9454
9286
|
case 0:
|
9455
9287
|
if (!t.region) {
|
9456
|
-
|
9288
|
+
_context66.next = 2;
|
9457
9289
|
break;
|
9458
9290
|
}
|
9459
|
-
return
|
9291
|
+
return _context66.abrupt("return", t.subscriptionKey ? e.fromSubscription(t.subscriptionKey.trim(), t.region.trim()) : t.token ? e.fromAuthorizationToken(t.token.trim(), t.region.trim()) : t.retrieveToken ? t.retrieveToken().then(function (n) {
|
9460
9292
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9461
9293
|
})["catch"](function (n) {
|
9462
9294
|
return console.error(n), null;
|
9463
9295
|
}) : null);
|
9464
9296
|
case 2:
|
9465
9297
|
case "end":
|
9466
|
-
return
|
9298
|
+
return _context66.stop();
|
9467
9299
|
}
|
9468
|
-
},
|
9300
|
+
}, _callee66);
|
9469
9301
|
}));
|
9470
|
-
function getNewSpeechConfig(
|
9302
|
+
function getNewSpeechConfig(_x111, _x112) {
|
9471
9303
|
return _getNewSpeechConfig.apply(this, arguments);
|
9472
9304
|
}
|
9473
9305
|
return getNewSpeechConfig;
|
@@ -9480,23 +9312,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9480
9312
|
}, {
|
9481
9313
|
key: "get",
|
9482
9314
|
value: function () {
|
9483
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9315
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
|
9484
9316
|
var n;
|
9485
|
-
return _regeneratorRuntime().wrap(function
|
9486
|
-
while (1) switch (
|
9317
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
9318
|
+
while (1) switch (_context67.prev = _context67.next) {
|
9487
9319
|
case 0:
|
9488
|
-
|
9320
|
+
_context67.next = 2;
|
9489
9321
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9490
9322
|
case 2:
|
9491
|
-
n =
|
9492
|
-
return
|
9323
|
+
n = _context67.sent;
|
9324
|
+
return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9493
9325
|
case 4:
|
9494
9326
|
case "end":
|
9495
|
-
return
|
9327
|
+
return _context67.stop();
|
9496
9328
|
}
|
9497
|
-
},
|
9329
|
+
}, _callee67);
|
9498
9330
|
}));
|
9499
|
-
function get(
|
9331
|
+
function get(_x113, _x114) {
|
9500
9332
|
return _get.apply(this, arguments);
|
9501
9333
|
}
|
9502
9334
|
return get;
|
@@ -9586,28 +9418,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9586
9418
|
}, {
|
9587
9419
|
key: "startAsync",
|
9588
9420
|
value: function () {
|
9589
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9421
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
|
9590
9422
|
var t;
|
9591
|
-
return _regeneratorRuntime().wrap(function
|
9592
|
-
while (1) switch (
|
9423
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
9424
|
+
while (1) switch (_context68.prev = _context68.next) {
|
9593
9425
|
case 0:
|
9594
|
-
|
9595
|
-
if (!
|
9596
|
-
|
9426
|
+
_context68.t0 = this.validate(e);
|
9427
|
+
if (!_context68.t0) {
|
9428
|
+
_context68.next = 6;
|
9597
9429
|
break;
|
9598
9430
|
}
|
9599
|
-
|
9431
|
+
_context68.next = 4;
|
9600
9432
|
return this.instantiateService(e);
|
9601
9433
|
case 4:
|
9602
9434
|
this._translations = e == null ? void 0 : e.translations;
|
9603
9435
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9604
9436
|
case 6:
|
9605
9437
|
case "end":
|
9606
|
-
return
|
9438
|
+
return _context68.stop();
|
9607
9439
|
}
|
9608
|
-
},
|
9440
|
+
}, _callee68, this);
|
9609
9441
|
}));
|
9610
|
-
function startAsync(
|
9442
|
+
function startAsync(_x115) {
|
9611
9443
|
return _startAsync.apply(this, arguments);
|
9612
9444
|
}
|
9613
9445
|
return startAsync;
|
@@ -9620,28 +9452,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9620
9452
|
}, {
|
9621
9453
|
key: "instantiateService",
|
9622
9454
|
value: function () {
|
9623
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9624
|
-
var t, n, s,
|
9625
|
-
return _regeneratorRuntime().wrap(function
|
9626
|
-
while (1) switch (
|
9455
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee69(e) {
|
9456
|
+
var t, n, s, o;
|
9457
|
+
return _regeneratorRuntime().wrap(function _callee69$(_context69) {
|
9458
|
+
while (1) switch (_context69.prev = _context69.next) {
|
9627
9459
|
case 0:
|
9628
9460
|
t = Azure.getAPI();
|
9629
9461
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9630
|
-
|
9462
|
+
_context69.next = 4;
|
9631
9463
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9632
9464
|
case 4:
|
9633
|
-
s =
|
9465
|
+
s = _context69.sent;
|
9634
9466
|
if (s) {
|
9635
|
-
|
9636
|
-
this.setEvents(
|
9467
|
+
o = new t.SpeechRecognizer(s, n);
|
9468
|
+
this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9637
9469
|
} else this.error("Unable to contact Azure server");
|
9638
9470
|
case 6:
|
9639
9471
|
case "end":
|
9640
|
-
return
|
9472
|
+
return _context69.stop();
|
9641
9473
|
}
|
9642
|
-
},
|
9474
|
+
}, _callee69, this);
|
9643
9475
|
}));
|
9644
|
-
function instantiateService(
|
9476
|
+
function instantiateService(_x116) {
|
9645
9477
|
return _instantiateService.apply(this, arguments);
|
9646
9478
|
}
|
9647
9479
|
return instantiateService;
|
@@ -9678,10 +9510,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9678
9510
|
case window.SpeechSDK.ResultReason.RecognizedSpeech:
|
9679
9511
|
if (n.text && !this._stopping) {
|
9680
9512
|
var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
|
9681
|
-
|
9682
|
-
|
9683
|
-
|
9684
|
-
stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(
|
9513
|
+
s = _azureTranscript_1$Az2.interimTranscript,
|
9514
|
+
o = _azureTranscript_1$Az2.finalTranscript,
|
9515
|
+
a = _azureTranscript_1$Az2.newText;
|
9516
|
+
stopTimeout_1.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(s, o, a), o !== "" && (this._newTextPadding = " ");
|
9685
9517
|
}
|
9686
9518
|
break;
|
9687
9519
|
}
|
@@ -10023,17 +9855,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10023
9855
|
}, {
|
10024
9856
|
key: "submit",
|
10025
9857
|
value: function () {
|
10026
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9858
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
|
10027
9859
|
var l, c, n, s, o, a;
|
10028
|
-
return _regeneratorRuntime().wrap(function
|
10029
|
-
while (1) switch (
|
9860
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9861
|
+
while (1) switch (_context70.prev = _context70.next) {
|
10030
9862
|
case 0:
|
10031
|
-
|
10032
|
-
if (
|
10033
|
-
|
9863
|
+
_context70.t0 = e;
|
9864
|
+
if (_context70.t0) {
|
9865
|
+
_context70.next = 6;
|
10034
9866
|
break;
|
10035
9867
|
}
|
10036
|
-
|
9868
|
+
_context70.next = 4;
|
10037
9869
|
return this._fileAttachments.completePlaceholders();
|
10038
9870
|
case 4:
|
10039
9871
|
n = this._fileAttachments.getAllFileData();
|
@@ -10043,40 +9875,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10043
9875
|
case 6:
|
10044
9876
|
o = t === "" ? void 0 : t;
|
10045
9877
|
if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
|
10046
|
-
|
9878
|
+
_context70.next = 9;
|
10047
9879
|
break;
|
10048
9880
|
}
|
10049
|
-
return
|
9881
|
+
return _context70.abrupt("return");
|
10050
9882
|
case 9:
|
10051
9883
|
if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
|
10052
|
-
|
9884
|
+
_context70.next = 14;
|
10053
9885
|
break;
|
10054
9886
|
}
|
10055
9887
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
10056
|
-
|
9888
|
+
_context70.next = 12;
|
10057
9889
|
break;
|
10058
9890
|
}
|
10059
|
-
return
|
9891
|
+
return _context70.abrupt("return");
|
10060
9892
|
case 12:
|
10061
|
-
|
9893
|
+
_context70.next = 16;
|
10062
9894
|
break;
|
10063
9895
|
case 14:
|
10064
9896
|
if (this._serviceIO.canSendMessage(o, s)) {
|
10065
|
-
|
9897
|
+
_context70.next = 16;
|
10066
9898
|
break;
|
10067
9899
|
}
|
10068
|
-
return
|
9900
|
+
return _context70.abrupt("return");
|
10069
9901
|
case 16:
|
10070
9902
|
this.changeToLoadingIcon();
|
10071
9903
|
t !== "" && this._messages.addNewMessage({
|
10072
9904
|
text: t
|
10073
9905
|
}, !1, !0);
|
10074
|
-
|
10075
|
-
if (!
|
10076
|
-
|
9906
|
+
_context70.t1 = n;
|
9907
|
+
if (!_context70.t1) {
|
9908
|
+
_context70.next = 22;
|
10077
9909
|
break;
|
10078
9910
|
}
|
10079
|
-
|
9911
|
+
_context70.next = 22;
|
10080
9912
|
return this._messages.addMultipleFiles(n);
|
10081
9913
|
case 22:
|
10082
9914
|
this._messages.addLoadingMessage();
|
@@ -10085,17 +9917,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10085
9917
|
text: o,
|
10086
9918
|
files: s
|
10087
9919
|
};
|
10088
|
-
|
9920
|
+
_context70.next = 27;
|
10089
9921
|
return this._serviceIO.callAPI(a, this._messages);
|
10090
9922
|
case 27:
|
10091
9923
|
e || (c = this._fileAttachments) == null || c.removeAllFiles();
|
10092
9924
|
case 28:
|
10093
9925
|
case "end":
|
10094
|
-
return
|
9926
|
+
return _context70.stop();
|
10095
9927
|
}
|
10096
|
-
},
|
9928
|
+
}, _callee70, this);
|
10097
9929
|
}));
|
10098
|
-
function submit(
|
9930
|
+
function submit(_x117, _x118) {
|
10099
9931
|
return _submit.apply(this, arguments);
|
10100
9932
|
}
|
10101
9933
|
return submit;
|
@@ -10230,13 +10062,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
|
|
10230
10062
|
t = new Array(e.length);
|
10231
10063
|
for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
|
10232
10064
|
var n = new Uint8Array(t),
|
10233
|
-
|
10065
|
+
s = new Blob([n], {
|
10234
10066
|
type: this._format
|
10235
10067
|
}),
|
10236
|
-
|
10237
|
-
|
10238
|
-
return new File([
|
10239
|
-
type:
|
10068
|
+
o = this._format === "image/jpeg" ? "jpeg" : "png",
|
10069
|
+
a = NewFileName.getFileName(this._newFilePrefix || "photo", o);
|
10070
|
+
return new File([s], a, {
|
10071
|
+
type: s.type
|
10240
10072
|
});
|
10241
10073
|
}
|
10242
10074
|
}
|
@@ -10371,9 +10203,9 @@ var Input = /*#__PURE__*/function () {
|
|
10371
10203
|
u = _FILE_TYPE_BUTTON_ICO.id,
|
10372
10204
|
d = _FILE_TYPE_BUTTON_ICO.svgString,
|
10373
10205
|
h = _FILE_TYPE_BUTTON_ICO.dropupText,
|
10374
|
-
|
10206
|
+
p = new UploadFileButton(n, c, l, u, d, h);
|
10375
10207
|
s[a] = {
|
10376
|
-
button:
|
10208
|
+
button: p,
|
10377
10209
|
fileType: c
|
10378
10210
|
};
|
10379
10211
|
}
|