deep-chat-dev 9.0.5 → 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 +2028 -2022
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.js +1138 -1313
- package/dist/types/handler.d.ts +4 -4
- 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,164 +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 = !0;
|
869
|
-
o = /*#__PURE__*/function () {
|
870
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(c) {
|
871
|
-
var d, h, u;
|
872
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
873
|
-
while (1) switch (_context7.prev = _context7.next) {
|
874
|
-
case 0:
|
875
|
-
if (s) {
|
876
|
-
_context7.next = 2;
|
877
|
-
break;
|
878
|
-
}
|
879
|
-
return _context7.abrupt("return");
|
880
|
-
case 2:
|
881
|
-
_context7.next = 4;
|
882
|
-
return (h = (d = e.deepChat).responseInterceptor) == null ? void 0 : h.call(d, c);
|
883
|
-
case 4:
|
884
|
-
_context7.t0 = _context7.sent;
|
885
|
-
if (_context7.t0) {
|
886
|
-
_context7.next = 7;
|
887
|
-
break;
|
888
|
-
}
|
889
|
-
_context7.t0 = c;
|
890
|
-
case 7:
|
891
|
-
u = _context7.t0;
|
892
|
-
!u || _typeof(u) != "object" || typeof u.error != "string" && typeof u.text != "string" ? (console.error(ErrorMessages.INVALID_RESPONSE(c, "server", !!e.deepChat.responseInterceptor, u)), n.addNewErrorMessage("service", "Error in server message"), e.completionsHandlers.onFinish()) : typeof u.error == "string" ? (console.error(u.error), n.addNewErrorMessage("service", u.error), e.completionsHandlers.onFinish()) : e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : (n.addNewMessage(u, !0, !0), e.completionsHandlers.onFinish()), s = !1;
|
893
|
-
case 9:
|
894
|
-
case "end":
|
895
|
-
return _context7.stop();
|
896
|
-
}
|
897
|
-
}, _callee7);
|
898
|
-
}));
|
899
|
-
return function o(_x15) {
|
900
|
-
return _ref2.apply(this, arguments);
|
901
|
-
};
|
902
|
-
}();
|
903
|
-
(l = (a = e.requestSettings).handler) == null || l.call(a, t, {
|
904
|
-
onResponse: o
|
905
|
-
});
|
906
|
-
case 3:
|
907
|
-
case "end":
|
908
|
-
return _context8.stop();
|
909
|
-
}
|
910
|
-
}, _callee8);
|
911
|
-
}));
|
912
|
-
function request(_x12, _x13, _x14) {
|
913
|
-
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?";
|
914
779
|
}
|
915
|
-
return
|
916
|
-
}
|
780
|
+
return "Hi there! This is a demo response!";
|
781
|
+
}
|
917
782
|
}, {
|
918
|
-
key: "
|
919
|
-
value: function () {
|
920
|
-
var
|
921
|
-
|
922
|
-
|
923
|
-
|
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) {
|
924
814
|
case 0:
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
}
|
933
|
-
|
934
|
-
n.finaliseStreamedMessage(), e.streamHandlers.onClose(), s = !1;
|
935
|
-
};
|
936
|
-
d = {
|
937
|
-
onOpen: l,
|
938
|
-
onResponse: u,
|
939
|
-
onClose: c,
|
940
|
-
stopClicked: e.streamHandlers.stopClicked
|
941
|
-
};
|
942
|
-
(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;
|
943
824
|
case 5:
|
825
|
+
o = _context6.t0;
|
826
|
+
o.error ? e.addNewErrorMessage("service", o.error) : e.addNewMessage(o, !0, !0), t();
|
827
|
+
case 7:
|
944
828
|
case "end":
|
945
|
-
return
|
829
|
+
return _context6.stop();
|
946
830
|
}
|
947
|
-
},
|
948
|
-
}));
|
949
|
-
|
950
|
-
|
951
|
-
}
|
952
|
-
return stream;
|
953
|
-
}()
|
831
|
+
}, _callee6);
|
832
|
+
})), 400);
|
833
|
+
}
|
834
|
+
// timeout is used to simulate a timeout for a response to come back
|
954
835
|
}, {
|
955
|
-
key: "
|
956
|
-
value: function
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
}
|
963
|
-
};
|
964
|
-
e.websocket = n;
|
965
|
-
var l = {
|
966
|
-
onOpen: function onOpen() {
|
967
|
-
t.removeError(), n.isOpen = !0;
|
968
|
-
},
|
969
|
-
onResponse: function () {
|
970
|
-
var _onResponse = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(d) {
|
971
|
-
var f, p, h;
|
972
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
973
|
-
while (1) switch (_context10.prev = _context10.next) {
|
974
|
-
case 0:
|
975
|
-
if (n.isOpen) {
|
976
|
-
_context10.next = 2;
|
977
|
-
break;
|
978
|
-
}
|
979
|
-
return _context10.abrupt("return");
|
980
|
-
case 2:
|
981
|
-
_context10.next = 4;
|
982
|
-
return (p = (f = e.deepChat).responseInterceptor) == null ? void 0 : p.call(f, d);
|
983
|
-
case 4:
|
984
|
-
_context10.t0 = _context10.sent;
|
985
|
-
if (_context10.t0) {
|
986
|
-
_context10.next = 7;
|
987
|
-
break;
|
988
|
-
}
|
989
|
-
_context10.t0 = d;
|
990
|
-
case 7:
|
991
|
-
h = _context10.t0;
|
992
|
-
!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);
|
993
|
-
case 9:
|
994
|
-
case "end":
|
995
|
-
return _context10.stop();
|
996
|
-
}
|
997
|
-
}, _callee10);
|
998
|
-
}));
|
999
|
-
function onResponse(_x19) {
|
1000
|
-
return _onResponse.apply(this, arguments);
|
1001
|
-
}
|
1002
|
-
return onResponse;
|
1003
|
-
}(),
|
1004
|
-
onClose: function onClose() {
|
1005
|
-
n.isOpen = !1;
|
1006
|
-
},
|
1007
|
-
newUserMessage: n.newUserMessage
|
1008
|
-
};
|
1009
|
-
(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);
|
1010
843
|
}
|
1011
844
|
}]);
|
1012
|
-
return
|
845
|
+
return C;
|
1013
846
|
}();
|
847
|
+
_Demo.URL = "deep-chat-demo";
|
848
|
+
var Demo = _Demo;
|
1014
849
|
var HTTPRequest = /*#__PURE__*/function () {
|
1015
850
|
function HTTPRequest() {
|
1016
851
|
_classCallCheck(this, HTTPRequest);
|
@@ -1019,13 +854,12 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1019
854
|
key: "request",
|
1020
855
|
value: // prettier-ignore
|
1021
856
|
function () {
|
1022
|
-
var
|
857
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(e, t, n) {
|
1023
858
|
var s,
|
1024
859
|
h,
|
1025
|
-
f,
|
1026
860
|
p,
|
861
|
+
f,
|
1027
862
|
b,
|
1028
|
-
m,
|
1029
863
|
o,
|
1030
864
|
_yield$RequestUtils$p2,
|
1031
865
|
a,
|
@@ -1033,110 +867,104 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1033
867
|
c,
|
1034
868
|
u,
|
1035
869
|
d,
|
1036
|
-
|
1037
|
-
return _regeneratorRuntime().wrap(function
|
1038
|
-
while (1) switch (
|
870
|
+
_args8 = arguments;
|
871
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
872
|
+
while (1) switch (_context8.prev = _context8.next) {
|
1039
873
|
case 0:
|
1040
|
-
s =
|
874
|
+
s = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : !0;
|
1041
875
|
o = {
|
1042
876
|
body: t,
|
1043
877
|
headers: (h = e.requestSettings) == null ? void 0 : h.headers
|
1044
878
|
};
|
1045
|
-
|
879
|
+
_context8.next = 4;
|
1046
880
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
1047
881
|
case 4:
|
1048
|
-
_yield$RequestUtils$p2 =
|
882
|
+
_yield$RequestUtils$p2 = _context8.sent;
|
1049
883
|
a = _yield$RequestUtils$p2.body;
|
1050
884
|
l = _yield$RequestUtils$p2.headers;
|
1051
885
|
c = _yield$RequestUtils$p2.error;
|
1052
886
|
u = e.completionsHandlers.onFinish;
|
1053
887
|
if (!c) {
|
1054
|
-
|
888
|
+
_context8.next = 11;
|
1055
889
|
break;
|
1056
890
|
}
|
1057
|
-
return
|
891
|
+
return _context8.abrupt("return", HTTPRequest.onInterceptorError(n, c, u));
|
1058
892
|
case 11:
|
1059
|
-
if (!((f = e.requestSettings) != null && f.handler)) {
|
1060
|
-
_context12.next = 13;
|
1061
|
-
break;
|
1062
|
-
}
|
1063
|
-
return _context12.abrupt("return", CustomHandler.request(e, a, n));
|
1064
|
-
case 13:
|
1065
893
|
if (!(((p = e.requestSettings) == null ? void 0 : p.url) === Demo.URL)) {
|
1066
|
-
|
894
|
+
_context8.next = 13;
|
1067
895
|
break;
|
1068
896
|
}
|
1069
|
-
return
|
1070
|
-
case
|
897
|
+
return _context8.abrupt("return", Demo.request(n, u, e.deepChat.responseInterceptor));
|
898
|
+
case 13:
|
1071
899
|
d = !0;
|
1072
|
-
fetch(((
|
1073
|
-
method: ((
|
900
|
+
fetch(((f = e.requestSettings) == null ? void 0 : f.url) || e.url || "", {
|
901
|
+
method: ((b = e.requestSettings) == null ? void 0 : b.method) || "POST",
|
1074
902
|
headers: l,
|
1075
903
|
body: s ? JSON.stringify(a) : a
|
1076
|
-
}).then(function (
|
1077
|
-
return d = !!
|
1078
|
-
}).then(function (
|
1079
|
-
return RequestUtils.processResponseByType(
|
904
|
+
}).then(function (m) {
|
905
|
+
return d = !!m.ok, m;
|
906
|
+
}).then(function (m) {
|
907
|
+
return RequestUtils.processResponseByType(m);
|
1080
908
|
}).then( /*#__PURE__*/function () {
|
1081
|
-
var
|
1082
|
-
var
|
1083
|
-
return _regeneratorRuntime().wrap(function
|
1084
|
-
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) {
|
1085
913
|
case 0:
|
1086
914
|
if (e.extractResultData) {
|
1087
|
-
|
915
|
+
_context7.next = 2;
|
1088
916
|
break;
|
1089
917
|
}
|
1090
|
-
return
|
918
|
+
return _context7.abrupt("return");
|
1091
919
|
case 2:
|
1092
|
-
|
1093
|
-
return (
|
920
|
+
_context7.next = 4;
|
921
|
+
return (x = (y = e.deepChat).responseInterceptor) == null ? void 0 : x.call(y, m);
|
1094
922
|
case 4:
|
1095
|
-
|
1096
|
-
if (
|
1097
|
-
|
923
|
+
_context7.t0 = _context7.sent;
|
924
|
+
if (_context7.t0) {
|
925
|
+
_context7.next = 7;
|
1098
926
|
break;
|
1099
927
|
}
|
1100
|
-
|
928
|
+
_context7.t0 = m;
|
1101
929
|
case 7:
|
1102
|
-
v =
|
1103
|
-
|
930
|
+
v = _context7.t0;
|
931
|
+
_context7.next = 10;
|
1104
932
|
return e.extractResultData(v);
|
1105
933
|
case 10:
|
1106
|
-
|
934
|
+
g = _context7.sent;
|
1107
935
|
if (d) {
|
1108
|
-
|
936
|
+
_context7.next = 13;
|
1109
937
|
break;
|
1110
938
|
}
|
1111
|
-
throw
|
939
|
+
throw m;
|
1112
940
|
case 13:
|
1113
|
-
if (!(!
|
1114
|
-
|
941
|
+
if (!(!g || _typeof(g) != "object")) {
|
942
|
+
_context7.next = 15;
|
1115
943
|
break;
|
1116
944
|
}
|
1117
|
-
throw Error(ErrorMessages.INVALID_RESPONSE(
|
945
|
+
throw Error(ErrorMessages.INVALID_RESPONSE(m, "response", !!e.deepChat.responseInterceptor, v));
|
1118
946
|
case 15:
|
1119
|
-
|
947
|
+
g.pollingInAnotherRequest || (e.deepChat.stream && g.text ? Stream.simulate(n, e.streamHandlers, g.text) : (n.addNewMessage(g, !0, !0), u()));
|
1120
948
|
case 16:
|
1121
949
|
case "end":
|
1122
|
-
return
|
950
|
+
return _context7.stop();
|
1123
951
|
}
|
1124
|
-
},
|
952
|
+
}, _callee7);
|
1125
953
|
}));
|
1126
|
-
return function (
|
1127
|
-
return
|
954
|
+
return function (_x14) {
|
955
|
+
return _ref2.apply(this, arguments);
|
1128
956
|
};
|
1129
|
-
}())["catch"](function (
|
1130
|
-
RequestUtils.displayError(n,
|
957
|
+
}())["catch"](function (m) {
|
958
|
+
RequestUtils.displayError(n, m), u();
|
1131
959
|
});
|
1132
|
-
case
|
960
|
+
case 15:
|
1133
961
|
case "end":
|
1134
|
-
return
|
962
|
+
return _context8.stop();
|
1135
963
|
}
|
1136
|
-
},
|
964
|
+
}, _callee8);
|
1137
965
|
}));
|
1138
|
-
function request(
|
1139
|
-
return
|
966
|
+
function request(_x11, _x12, _x13) {
|
967
|
+
return _request2.apply(this, arguments);
|
1140
968
|
}
|
1141
969
|
return request;
|
1142
970
|
}() // prettier-ignore
|
@@ -1148,44 +976,44 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1148
976
|
fetch(t, n).then(function (a) {
|
1149
977
|
return a.json();
|
1150
978
|
}).then( /*#__PURE__*/function () {
|
1151
|
-
var
|
979
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(a) {
|
1152
980
|
var c, u, l;
|
1153
|
-
return _regeneratorRuntime().wrap(function
|
1154
|
-
while (1) switch (
|
981
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
982
|
+
while (1) switch (_context9.prev = _context9.next) {
|
1155
983
|
case 0:
|
1156
984
|
if (e.extractPollResultData) {
|
1157
|
-
|
985
|
+
_context9.next = 2;
|
1158
986
|
break;
|
1159
987
|
}
|
1160
|
-
return
|
988
|
+
return _context9.abrupt("return");
|
1161
989
|
case 2:
|
1162
|
-
|
1163
|
-
|
990
|
+
_context9.t0 = e;
|
991
|
+
_context9.next = 5;
|
1164
992
|
return (u = (c = e.deepChat).responseInterceptor) == null ? void 0 : u.call(c, a);
|
1165
993
|
case 5:
|
1166
|
-
|
1167
|
-
if (
|
1168
|
-
|
994
|
+
_context9.t1 = _context9.sent;
|
995
|
+
if (_context9.t1) {
|
996
|
+
_context9.next = 8;
|
1169
997
|
break;
|
1170
998
|
}
|
1171
|
-
|
999
|
+
_context9.t1 = a;
|
1172
1000
|
case 8:
|
1173
|
-
|
1174
|
-
|
1175
|
-
return
|
1001
|
+
_context9.t2 = _context9.t1;
|
1002
|
+
_context9.next = 11;
|
1003
|
+
return _context9.t0.extractPollResultData.call(_context9.t0, _context9.t2);
|
1176
1004
|
case 11:
|
1177
|
-
l =
|
1005
|
+
l = _context9.sent;
|
1178
1006
|
l.timeoutMS ? setTimeout(function () {
|
1179
1007
|
HTTPRequest.executePollRequest(e, t, n, s);
|
1180
1008
|
}, l.timeoutMS) : (console.log("finished polling"), s.addNewMessage(l, !0, !0), o());
|
1181
1009
|
case 13:
|
1182
1010
|
case "end":
|
1183
|
-
return
|
1011
|
+
return _context9.stop();
|
1184
1012
|
}
|
1185
|
-
},
|
1013
|
+
}, _callee9);
|
1186
1014
|
}));
|
1187
|
-
return function (
|
1188
|
-
return
|
1015
|
+
return function (_x15) {
|
1016
|
+
return _ref3.apply(this, arguments);
|
1189
1017
|
};
|
1190
1018
|
}())["catch"](function (a) {
|
1191
1019
|
RequestUtils.displayError(s, a), o();
|
@@ -1195,9 +1023,9 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1195
1023
|
}, {
|
1196
1024
|
key: "poll",
|
1197
1025
|
value: function () {
|
1198
|
-
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1026
|
+
var _poll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(e, t, n) {
|
1199
1027
|
var s,
|
1200
|
-
|
1028
|
+
f,
|
1201
1029
|
b,
|
1202
1030
|
m,
|
1203
1031
|
o,
|
@@ -1208,42 +1036,42 @@ var HTTPRequest = /*#__PURE__*/function () {
|
|
1208
1036
|
u,
|
1209
1037
|
d,
|
1210
1038
|
h,
|
1211
|
-
|
1212
|
-
|
1213
|
-
return _regeneratorRuntime().wrap(function
|
1214
|
-
while (1) switch (
|
1039
|
+
p,
|
1040
|
+
_args10 = arguments;
|
1041
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
1042
|
+
while (1) switch (_context10.prev = _context10.next) {
|
1215
1043
|
case 0:
|
1216
|
-
s =
|
1044
|
+
s = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : !0;
|
1217
1045
|
o = {
|
1218
1046
|
body: t,
|
1219
|
-
headers: (
|
1047
|
+
headers: (f = e.requestSettings) == null ? void 0 : f.headers
|
1220
1048
|
};
|
1221
|
-
|
1049
|
+
_context10.next = 4;
|
1222
1050
|
return RequestUtils.processRequestInterceptor(e.deepChat, o);
|
1223
1051
|
case 4:
|
1224
|
-
_yield$RequestUtils$p3 =
|
1052
|
+
_yield$RequestUtils$p3 = _context10.sent;
|
1225
1053
|
a = _yield$RequestUtils$p3.body;
|
1226
1054
|
l = _yield$RequestUtils$p3.headers;
|
1227
1055
|
c = _yield$RequestUtils$p3.error;
|
1228
1056
|
if (!c) {
|
1229
|
-
|
1057
|
+
_context10.next = 10;
|
1230
1058
|
break;
|
1231
1059
|
}
|
1232
|
-
return
|
1060
|
+
return _context10.abrupt("return", HTTPRequest.onInterceptorError(n, c));
|
1233
1061
|
case 10:
|
1234
|
-
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 = {
|
1235
1063
|
method: d,
|
1236
1064
|
body: h,
|
1237
1065
|
headers: l
|
1238
1066
|
};
|
1239
|
-
HTTPRequest.executePollRequest(e, u,
|
1067
|
+
HTTPRequest.executePollRequest(e, u, p, n);
|
1240
1068
|
case 12:
|
1241
1069
|
case "end":
|
1242
|
-
return
|
1070
|
+
return _context10.stop();
|
1243
1071
|
}
|
1244
|
-
},
|
1072
|
+
}, _callee10);
|
1245
1073
|
}));
|
1246
|
-
function poll(
|
1074
|
+
function poll(_x16, _x17, _x18) {
|
1247
1075
|
return _poll.apply(this, arguments);
|
1248
1076
|
}
|
1249
1077
|
return poll;
|
@@ -1284,9 +1112,9 @@ var MessageLimitUtils = /*#__PURE__*/function () {
|
|
1284
1112
|
var n = 0,
|
1285
1113
|
s = e.length - 1;
|
1286
1114
|
for (s; s >= 0; s -= 1) {
|
1287
|
-
var
|
1288
|
-
if (
|
1289
|
-
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));
|
1290
1118
|
break;
|
1291
1119
|
}
|
1292
1120
|
}
|
@@ -1336,19 +1164,16 @@ var Websocket = /*#__PURE__*/function () {
|
|
1336
1164
|
value: function createConnection(e, t) {
|
1337
1165
|
if (!document.body.contains(e.deepChat)) return;
|
1338
1166
|
var n = e.requestSettings.websocket;
|
1339
|
-
if (n) {
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
} catch (s) {
|
1350
|
-
console.error(s), Websocket.retryConnection(e, t);
|
1351
|
-
}
|
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);
|
1352
1177
|
}
|
1353
1178
|
}
|
1354
1179
|
}, {
|
@@ -1362,53 +1187,53 @@ var Websocket = /*#__PURE__*/function () {
|
|
1362
1187
|
key: "assignListeners",
|
1363
1188
|
value: function assignListeners(e, t, n) {
|
1364
1189
|
t.onmessage = /*#__PURE__*/function () {
|
1365
|
-
var
|
1190
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(s) {
|
1366
1191
|
var o, a, l, c, u;
|
1367
|
-
return _regeneratorRuntime().wrap(function
|
1368
|
-
while (1) switch (
|
1192
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
1193
|
+
while (1) switch (_context11.prev = _context11.next) {
|
1369
1194
|
case 0:
|
1370
1195
|
if (!e.extractResultData) {
|
1371
|
-
|
1196
|
+
_context11.next = 20;
|
1372
1197
|
break;
|
1373
1198
|
}
|
1374
|
-
|
1199
|
+
_context11.prev = 1;
|
1375
1200
|
l = JSON.parse(s.data);
|
1376
|
-
|
1201
|
+
_context11.next = 5;
|
1377
1202
|
return (a = (o = e.deepChat).responseInterceptor) == null ? void 0 : a.call(o, l);
|
1378
1203
|
case 5:
|
1379
|
-
|
1380
|
-
if (
|
1381
|
-
|
1204
|
+
_context11.t0 = _context11.sent;
|
1205
|
+
if (_context11.t0) {
|
1206
|
+
_context11.next = 8;
|
1382
1207
|
break;
|
1383
1208
|
}
|
1384
|
-
|
1209
|
+
_context11.t0 = l;
|
1385
1210
|
case 8:
|
1386
|
-
c =
|
1387
|
-
|
1211
|
+
c = _context11.t0;
|
1212
|
+
_context11.next = 11;
|
1388
1213
|
return e.extractResultData(c);
|
1389
1214
|
case 11:
|
1390
|
-
u =
|
1215
|
+
u = _context11.sent;
|
1391
1216
|
if (!(!u || _typeof(u) != "object")) {
|
1392
|
-
|
1217
|
+
_context11.next = 14;
|
1393
1218
|
break;
|
1394
1219
|
}
|
1395
1220
|
throw Error(ErrorMessages.INVALID_RESPONSE(l, "server", !!e.deepChat.responseInterceptor, c));
|
1396
1221
|
case 14:
|
1397
1222
|
e.deepChat.stream && u.text ? Stream.simulate(n, e.streamHandlers, u.text) : n.addNewMessage(u, !0, !0);
|
1398
|
-
|
1223
|
+
_context11.next = 20;
|
1399
1224
|
break;
|
1400
1225
|
case 17:
|
1401
|
-
|
1402
|
-
|
1403
|
-
RequestUtils.displayError(n,
|
1226
|
+
_context11.prev = 17;
|
1227
|
+
_context11.t1 = _context11["catch"](1);
|
1228
|
+
RequestUtils.displayError(n, _context11.t1, "Error in server message");
|
1404
1229
|
case 20:
|
1405
1230
|
case "end":
|
1406
|
-
return
|
1231
|
+
return _context11.stop();
|
1407
1232
|
}
|
1408
|
-
},
|
1233
|
+
}, _callee11, null, [[1, 17]]);
|
1409
1234
|
}));
|
1410
|
-
return function (
|
1411
|
-
return
|
1235
|
+
return function (_x19) {
|
1236
|
+
return _ref4.apply(this, arguments);
|
1412
1237
|
};
|
1413
1238
|
}(), t.onclose = function () {
|
1414
1239
|
console.error("Connection closed"), n.isLastMessageError() || n.addNewErrorMessage("service", "Connection error"), Websocket.createConnection(e, n);
|
@@ -1417,7 +1242,7 @@ var Websocket = /*#__PURE__*/function () {
|
|
1417
1242
|
}, {
|
1418
1243
|
key: "sendWebsocket",
|
1419
1244
|
value: function () {
|
1420
|
-
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
1245
|
+
var _sendWebsocket = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(e, t, n) {
|
1421
1246
|
var s,
|
1422
1247
|
d,
|
1423
1248
|
h,
|
@@ -1427,55 +1252,55 @@ var Websocket = /*#__PURE__*/function () {
|
|
1427
1252
|
l,
|
1428
1253
|
c,
|
1429
1254
|
u,
|
1430
|
-
|
1431
|
-
return _regeneratorRuntime().wrap(function
|
1432
|
-
while (1) switch (
|
1255
|
+
_args12 = arguments;
|
1256
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
1257
|
+
while (1) switch (_context12.prev = _context12.next) {
|
1433
1258
|
case 0:
|
1434
|
-
s =
|
1259
|
+
s = _args12.length > 3 && _args12[3] !== undefined ? _args12[3] : !0;
|
1435
1260
|
o = e.websocket;
|
1436
1261
|
if (!(!o || o === "pending")) {
|
1437
|
-
|
1262
|
+
_context12.next = 4;
|
1438
1263
|
break;
|
1439
1264
|
}
|
1440
|
-
return
|
1265
|
+
return _context12.abrupt("return");
|
1441
1266
|
case 4:
|
1442
1267
|
a = {
|
1443
1268
|
body: t,
|
1444
1269
|
headers: (d = e.requestSettings) == null ? void 0 : d.headers
|
1445
1270
|
};
|
1446
|
-
|
1271
|
+
_context12.next = 7;
|
1447
1272
|
return RequestUtils.processRequestInterceptor(e.deepChat, a);
|
1448
1273
|
case 7:
|
1449
|
-
_yield$RequestUtils$p4 =
|
1274
|
+
_yield$RequestUtils$p4 = _context12.sent;
|
1450
1275
|
l = _yield$RequestUtils$p4.body;
|
1451
1276
|
c = _yield$RequestUtils$p4.error;
|
1452
1277
|
if (!c) {
|
1453
|
-
|
1278
|
+
_context12.next = 12;
|
1454
1279
|
break;
|
1455
1280
|
}
|
1456
|
-
return
|
1281
|
+
return _context12.abrupt("return", n.addNewErrorMessage("service", c));
|
1457
1282
|
case 12:
|
1458
1283
|
if (Websocket.isWebSocket(o)) {
|
1459
|
-
|
1284
|
+
_context12.next = 14;
|
1460
1285
|
break;
|
1461
1286
|
}
|
1462
|
-
return
|
1287
|
+
return _context12.abrupt("return", o.newUserMessage.listener(l));
|
1463
1288
|
case 14:
|
1464
1289
|
u = s ? JSON.stringify(l) : l;
|
1465
1290
|
if (!(((h = e.requestSettings) == null ? void 0 : h.url) === Demo.URL)) {
|
1466
|
-
|
1291
|
+
_context12.next = 17;
|
1467
1292
|
break;
|
1468
1293
|
}
|
1469
|
-
return
|
1294
|
+
return _context12.abrupt("return", Demo.request(n, e.completionsHandlers.onFinish, e.deepChat.responseInterceptor));
|
1470
1295
|
case 17:
|
1471
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));
|
1472
1297
|
case 18:
|
1473
1298
|
case "end":
|
1474
|
-
return
|
1299
|
+
return _context12.stop();
|
1475
1300
|
}
|
1476
|
-
},
|
1301
|
+
}, _callee12);
|
1477
1302
|
}));
|
1478
|
-
function sendWebsocket(
|
1303
|
+
function sendWebsocket(_x20, _x21, _x22) {
|
1479
1304
|
return _sendWebsocket.apply(this, arguments);
|
1480
1305
|
}
|
1481
1306
|
return sendWebsocket;
|
@@ -1981,13 +1806,13 @@ function normalizeReference(r) {
|
|
1981
1806
|
return r.trim().replace(/\s+/g, " ").toUpperCase();
|
1982
1807
|
}
|
1983
1808
|
function parseReference(r, e, t, n) {
|
1984
|
-
var s, o, a, l, c, u, d, h,
|
1809
|
+
var s, o, a, l, c, u, d, h, p;
|
1985
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;
|
1986
1811
|
for (l = s.posMax, a = o + 2; a < l && (c = s.src.charCodeAt(a), !(c !== 32 && c !== 10)); a++);
|
1987
1812
|
if (!parseLinkDestination(s, a)) return -1;
|
1988
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++);
|
1989
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++;
|
1990
|
-
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] = {
|
1991
1816
|
title: h,
|
1992
1817
|
href: d
|
1993
1818
|
}), a);
|
@@ -2024,9 +1849,9 @@ function footnote_block(r) {
|
|
2024
1849
|
u,
|
2025
1850
|
d = 0,
|
2026
1851
|
h = !1,
|
2027
|
-
|
2028
|
-
if (r.env.footnotes && (r.tokens = r.tokens.filter(function (
|
2029
|
-
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);
|
2030
1855
|
}), !!r.env.footnotes.list)) {
|
2031
1856
|
for (a = r.env.footnotes.list, r.tokens.push({
|
2032
1857
|
type: "footnote_block_open",
|
@@ -2049,7 +1874,7 @@ function footnote_block(r) {
|
|
2049
1874
|
type: "paragraph_close",
|
2050
1875
|
tight: !1,
|
2051
1876
|
level: --d
|
2052
|
-
})) : 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({
|
2053
1878
|
type: "footnote_anchor",
|
2054
1879
|
id: e,
|
2055
1880
|
subId: n,
|
@@ -2082,15 +1907,15 @@ function abbr2(r) {
|
|
2082
1907
|
u,
|
2083
1908
|
d,
|
2084
1909
|
h,
|
2085
|
-
|
2086
|
-
|
1910
|
+
p,
|
1911
|
+
f = r.tokens;
|
2087
1912
|
if (r.env.abbreviations) {
|
2088
|
-
for (r.env.abbrRegExp || (
|
1913
|
+
for (r.env.abbrRegExp || (p = "(^|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])(" + Object.keys(r.env.abbreviations).map(function (b) {
|
2089
1914
|
return b.substr(1);
|
2090
1915
|
}).sort(function (b, m) {
|
2091
1916
|
return m.length - b.length;
|
2092
|
-
}).map(regEscape).join("|") + ")($|[" + PUNCT_CHARS.split("").map(regEscape).join("") + "])", r.env.abbrRegExp = new RegExp(
|
2093
|
-
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") {
|
2094
1919
|
for (c = 0, a = o.content, d.lastIndex = 0, u = o.level, l = []; h = d.exec(a);) d.lastIndex > c && l.push({
|
2095
1920
|
type: "text",
|
2096
1921
|
content: a.slice(c, h.index + h[1].length),
|
@@ -2111,7 +1936,7 @@ function abbr2(r) {
|
|
2111
1936
|
type: "text",
|
2112
1937
|
content: a.slice(c),
|
2113
1938
|
level: u
|
2114
|
-
}),
|
1939
|
+
}), f[t].children = s = [].concat(s.slice(0, e), l, s.slice(e + 1)));
|
2115
1940
|
}
|
2116
1941
|
}
|
2117
1942
|
}
|
@@ -2146,29 +1971,29 @@ function replaceAt(r, e, t) {
|
|
2146
1971
|
return r.substr(0, e) + t + r.substr(e + 1);
|
2147
1972
|
}
|
2148
1973
|
function smartquotes(r) {
|
2149
|
-
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;
|
2150
1975
|
if (r.options.typographer) {
|
2151
|
-
for (
|
2152
|
-
for (
|
2153
|
-
for (l =
|
2154
|
-
|
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;
|
2155
1980
|
e: for (; o < a && (QUOTE_RE.lastIndex = o, s = QUOTE_RE.exec(n), !!s);) {
|
2156
1981
|
if (c = !isLetter(n, s.index - 1), o = s.index + 1, b = s[0] === "'", u = !isLetter(n, o), !u && !c) {
|
2157
1982
|
b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2158
1983
|
continue;
|
2159
1984
|
}
|
2160
|
-
if (h = !u,
|
2161
|
-
for (
|
2162
|
-
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;
|
2163
1988
|
continue e;
|
2164
1989
|
}
|
2165
1990
|
}
|
2166
|
-
h ?
|
1991
|
+
h ? g.push({
|
2167
1992
|
token: e,
|
2168
1993
|
pos: s.index,
|
2169
1994
|
single: b,
|
2170
1995
|
level: l
|
2171
|
-
}) :
|
1996
|
+
}) : p && b && (t.content = replaceAt(t.content, s.index, APOSTROPHE));
|
2172
1997
|
}
|
2173
1998
|
}
|
2174
1999
|
}
|
@@ -2280,20 +2105,20 @@ function blockquote(r, e, t, n) {
|
|
2280
2105
|
u,
|
2281
2106
|
d,
|
2282
2107
|
h,
|
2283
|
-
f,
|
2284
2108
|
p,
|
2109
|
+
f,
|
2285
2110
|
b,
|
2286
2111
|
m = r.bMarks[e] + r.tShift[e],
|
2287
|
-
|
2288
|
-
if (m >
|
2112
|
+
v = r.eMarks[e];
|
2113
|
+
if (m > v || r.src.charCodeAt(m++) !== 62 || r.level >= r.options.maxNesting) return !1;
|
2289
2114
|
if (n) return !0;
|
2290
|
-
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++) {
|
2291
2116
|
if (r.src.charCodeAt(m++) === 62) {
|
2292
|
-
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];
|
2293
2118
|
continue;
|
2294
2119
|
}
|
2295
2120
|
if (o) break;
|
2296
|
-
for (b = !1,
|
2121
|
+
for (b = !1, p = 0, f = h.length; p < f; p++) if (h[p](r, s, t, !0)) {
|
2297
2122
|
b = !0;
|
2298
2123
|
break;
|
2299
2124
|
}
|
@@ -2307,7 +2132,7 @@ function blockquote(r, e, t, n) {
|
|
2307
2132
|
}), r.parser.tokenize(r, e, s), r.tokens.push({
|
2308
2133
|
type: "blockquote_close",
|
2309
2134
|
level: --r.level
|
2310
|
-
}), 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];
|
2311
2136
|
return r.blkIndent = c, !0;
|
2312
2137
|
}
|
2313
2138
|
function hr(r, e, t, n) {
|
@@ -2360,55 +2185,55 @@ function list(r, e, t, n) {
|
|
2360
2185
|
u,
|
2361
2186
|
d,
|
2362
2187
|
h,
|
2363
|
-
f,
|
2364
2188
|
p,
|
2189
|
+
f,
|
2365
2190
|
b,
|
2366
2191
|
m,
|
2367
|
-
g,
|
2368
2192
|
v,
|
2193
|
+
g,
|
2369
2194
|
y,
|
2370
|
-
S,
|
2371
|
-
E,
|
2372
2195
|
x,
|
2373
|
-
R = !0,
|
2374
|
-
C,
|
2375
2196
|
_,
|
2197
|
+
I,
|
2198
|
+
R = !0,
|
2199
|
+
w,
|
2200
|
+
S,
|
2376
2201
|
H,
|
2377
2202
|
F;
|
2378
|
-
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;
|
2379
2204
|
if (r.level >= r.options.maxNesting) return !1;
|
2380
2205
|
if (m = r.src.charCodeAt(h - 1), n) return !0;
|
2381
|
-
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({
|
2382
2207
|
type: "ordered_list_open",
|
2383
2208
|
order: b,
|
2384
|
-
lines:
|
2209
|
+
lines: _ = [e, 0],
|
2385
2210
|
level: r.level++
|
2386
2211
|
})) : r.tokens.push({
|
2387
2212
|
type: "bullet_list_open",
|
2388
|
-
lines:
|
2213
|
+
lines: _ = [e, 0],
|
2389
2214
|
level: r.level++
|
2390
|
-
}), 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({
|
2391
2216
|
type: "list_item_open",
|
2392
|
-
lines:
|
2217
|
+
lines: I = [e, 0],
|
2393
2218
|
level: r.level++
|
2394
|
-
}), 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({
|
2395
2220
|
type: "list_item_close",
|
2396
2221
|
level: --r.level
|
2397
|
-
}), s = e = r.line,
|
2398
|
-
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)) {
|
2399
2224
|
F = !0;
|
2400
2225
|
break;
|
2401
2226
|
}
|
2402
2227
|
if (F) break;
|
2403
|
-
if (
|
2228
|
+
if (v) {
|
2404
2229
|
if (h = skipOrderedListMarker(r, s), h < 0) break;
|
2405
2230
|
} else if (h = skipBulletListMarker(r, s), h < 0) break;
|
2406
2231
|
if (m !== r.src.charCodeAt(h - 1)) break;
|
2407
2232
|
}
|
2408
2233
|
return r.tokens.push({
|
2409
|
-
type:
|
2234
|
+
type: v ? "ordered_list_close" : "bullet_list_close",
|
2410
2235
|
level: --r.level
|
2411
|
-
}),
|
2236
|
+
}), _[1] = s, r.line = s, R && markTightParagraphs(r, y), !0;
|
2412
2237
|
}
|
2413
2238
|
function footnote(r, e, t, n) {
|
2414
2239
|
var s,
|
@@ -2520,21 +2345,21 @@ function getLine(r, e) {
|
|
2520
2345
|
return r.src.substr(t, n - t);
|
2521
2346
|
}
|
2522
2347
|
function table(r, e, t, n) {
|
2523
|
-
var s, o, a, l, c, u, d, h,
|
2348
|
+
var s, o, a, l, c, u, d, h, p, f, b;
|
2524
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;
|
2525
2350
|
for (h = [], l = 0; l < u.length; l++) {
|
2526
|
-
if (
|
2351
|
+
if (p = u[l].trim(), !p) {
|
2527
2352
|
if (l === 0 || l === u.length - 1) continue;
|
2528
2353
|
return !1;
|
2529
2354
|
}
|
2530
|
-
if (!/^:?-+:?$/.test(
|
2531
|
-
|
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("");
|
2532
2357
|
}
|
2533
2358
|
if (o = getLine(r, e).trim(), o.indexOf("|") === -1 || (u = o.replace(/^\||\|$/g, "").split("|"), h.length !== u.length)) return !1;
|
2534
2359
|
if (n) return !0;
|
2535
2360
|
for (r.tokens.push({
|
2536
2361
|
type: "table_open",
|
2537
|
-
lines:
|
2362
|
+
lines: f = [e, 0],
|
2538
2363
|
level: r.level++
|
2539
2364
|
}), r.tokens.push({
|
2540
2365
|
type: "thead_open",
|
@@ -2597,7 +2422,7 @@ function table(r, e, t, n) {
|
|
2597
2422
|
}), r.tokens.push({
|
2598
2423
|
type: "table_close",
|
2599
2424
|
level: --r.level
|
2600
|
-
}),
|
2425
|
+
}), f[1] = b[1] = c, r.line = c, !0;
|
2601
2426
|
}
|
2602
2427
|
function skipMarker(r, e) {
|
2603
2428
|
var t,
|
@@ -2613,7 +2438,7 @@ function markTightParagraphs$1(r, e) {
|
|
2613
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);
|
2614
2439
|
}
|
2615
2440
|
function deflist(r, e, t, n) {
|
2616
|
-
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;
|
2617
2442
|
if (n) return r.ddIndent < 0 ? !1 : skipMarker(r, e) >= 0;
|
2618
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;
|
2619
2444
|
u = r.tokens.length, r.tokens.push({
|
@@ -2622,7 +2447,7 @@ function deflist(r, e, t, n) {
|
|
2622
2447
|
level: r.level++
|
2623
2448
|
}), a = e, o = d;
|
2624
2449
|
e: for (;;) {
|
2625
|
-
for (
|
2450
|
+
for (g = !0, v = !1, r.tokens.push({
|
2626
2451
|
type: "dt_open",
|
2627
2452
|
lines: [a, a],
|
2628
2453
|
level: r.level++
|
@@ -2640,7 +2465,7 @@ function deflist(r, e, t, n) {
|
|
2640
2465
|
type: "dd_open",
|
2641
2466
|
lines: l = [d, 0],
|
2642
2467
|
level: r.level++
|
2643
|
-
}), 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({
|
2644
2469
|
type: "dd_close",
|
2645
2470
|
level: --r.level
|
2646
2471
|
}), l[1] = d = r.line, d >= t || r.tShift[d] < r.blkIndent) break e;
|
@@ -2652,7 +2477,7 @@ function deflist(r, e, t, n) {
|
|
2652
2477
|
return r.tokens.push({
|
2653
2478
|
type: "dl_close",
|
2654
2479
|
level: --r.level
|
2655
|
-
}), c[1] = d, r.line = d,
|
2480
|
+
}), c[1] = d, r.line = d, g && markTightParagraphs$1(r, u), !0;
|
2656
2481
|
}
|
2657
2482
|
function paragraph(r, e) {
|
2658
2483
|
var t,
|
@@ -3017,21 +2842,21 @@ function links(r, e) {
|
|
3017
2842
|
u,
|
3018
2843
|
d = !1,
|
3019
2844
|
h = r.pos,
|
3020
|
-
|
3021
|
-
|
3022
|
-
b = r.src.charCodeAt(
|
3023
|
-
if (b === 33 && (d = !0, b = r.src.charCodeAt(++
|
3024
|
-
if (l = n + 1, l <
|
3025
|
-
for (l++; l <
|
3026
|
-
if (l >=
|
3027
|
-
for (
|
3028
|
-
if (l <
|
3029
|
-
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;
|
3030
2855
|
l++;
|
3031
2856
|
} else {
|
3032
2857
|
if (r.linkLevel > 0) return !1;
|
3033
|
-
for (; l <
|
3034
|
-
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;
|
3035
2860
|
o = c.href, a = c.title;
|
3036
2861
|
}
|
3037
2862
|
return e || (r.pos = t, r.posMax = n, d ? r.push({
|
@@ -3048,7 +2873,7 @@ function links(r, e) {
|
|
3048
2873
|
}), r.linkLevel++, r.parser.tokenize(r), r.linkLevel--, r.push({
|
3049
2874
|
type: "link_close",
|
3050
2875
|
level: --r.level
|
3051
|
-
}))), r.pos = l, r.posMax =
|
2876
|
+
}))), r.pos = l, r.posMax = p, !0;
|
3052
2877
|
}
|
3053
2878
|
function footnote_inline(r, e) {
|
3054
2879
|
var t,
|
@@ -3433,10 +3258,10 @@ var SetFileTypes = /*#__PURE__*/function () {
|
|
3433
3258
|
key: "processMixedFiles",
|
3434
3259
|
value: function processMixedFiles(e, t, n) {
|
3435
3260
|
if (n) {
|
3436
|
-
var
|
3261
|
+
var s = {
|
3437
3262
|
acceptedFormats: ""
|
3438
3263
|
};
|
3439
|
-
e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings,
|
3264
|
+
e.fileTypes.mixedFiles = SetFileTypes.parseConfig(e.requestSettings, s, t, n);
|
3440
3265
|
}
|
3441
3266
|
}
|
3442
3267
|
// needs to be set after audio to overwrite maxNumberOfFiles
|
@@ -3444,12 +3269,12 @@ var SetFileTypes = /*#__PURE__*/function () {
|
|
3444
3269
|
}, {
|
3445
3270
|
key: "processMicrophone",
|
3446
3271
|
value: function processMicrophone(e, t, n, s) {
|
3447
|
-
var _c$files,
|
3448
|
-
var l, c, u, d, h,
|
3272
|
+
var _c$files, _p$maxNumberOfFiles;
|
3273
|
+
var l, c, u, d, h, p;
|
3449
3274
|
var a = _objectSpread({
|
3450
3275
|
acceptedFormats: "audio/*"
|
3451
3276
|
}, ((l = e.fileTypes.audio) == null ? void 0 : l.files) || {});
|
3452
|
-
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)));
|
3453
3278
|
}
|
3454
3279
|
// prettier-ignore
|
3455
3280
|
}, {
|
@@ -3535,11 +3360,11 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3535
3360
|
}, {
|
3536
3361
|
key: "callServiceAPI",
|
3537
3362
|
value: function () {
|
3538
|
-
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3363
|
+
var _callServiceAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(e, t, n) {
|
3539
3364
|
var _c$headers, _u$ContentType;
|
3540
3365
|
var l, c, u, d, s, o, a;
|
3541
|
-
return _regeneratorRuntime().wrap(function
|
3542
|
-
while (1) switch (
|
3366
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
3367
|
+
while (1) switch (_context13.prev = _context13.next) {
|
3543
3368
|
case 0:
|
3544
3369
|
s = _objectSpread({
|
3545
3370
|
messages: t
|
@@ -3548,26 +3373,26 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3548
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);
|
3549
3374
|
a = this.deepChat.stream;
|
3550
3375
|
if (!(a && (this.demo || _typeof(a) != "object" || !a.simulation))) {
|
3551
|
-
|
3376
|
+
_context13.next = 9;
|
3552
3377
|
break;
|
3553
3378
|
}
|
3554
|
-
|
3379
|
+
_context13.next = 7;
|
3555
3380
|
return Stream.request(this, s, e);
|
3556
3381
|
case 7:
|
3557
|
-
|
3382
|
+
_context13.next = 11;
|
3558
3383
|
break;
|
3559
3384
|
case 9:
|
3560
|
-
|
3385
|
+
_context13.next = 11;
|
3561
3386
|
return HTTPRequest.request(this, s, e);
|
3562
3387
|
case 11:
|
3563
3388
|
o && ((d = this.requestSettings.headers) == null || delete d["Content-Type"]);
|
3564
3389
|
case 12:
|
3565
3390
|
case "end":
|
3566
|
-
return
|
3391
|
+
return _context13.stop();
|
3567
3392
|
}
|
3568
|
-
},
|
3393
|
+
}, _callee13, this);
|
3569
3394
|
}));
|
3570
|
-
function callServiceAPI(
|
3395
|
+
function callServiceAPI(_x23, _x24, _x25) {
|
3571
3396
|
return _callServiceAPI.apply(this, arguments);
|
3572
3397
|
}
|
3573
3398
|
return callServiceAPI;
|
@@ -3575,24 +3400,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3575
3400
|
}, {
|
3576
3401
|
key: "callApiWithFiles",
|
3577
3402
|
value: function () {
|
3578
|
-
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3403
|
+
var _callApiWithFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(e, t, n, s) {
|
3579
3404
|
var o, a, l;
|
3580
|
-
return _regeneratorRuntime().wrap(function
|
3581
|
-
while (1) switch (
|
3405
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
3406
|
+
while (1) switch (_context14.prev = _context14.next) {
|
3582
3407
|
case 0:
|
3583
3408
|
o = BaseServiceIO.createCustomFormDataBody(e, n, s), a = this.requestSettings, l = this.getServiceIOByType(s[0]);
|
3584
3409
|
this.requestSettings = (l == null ? void 0 : l.request) || this.requestSettings;
|
3585
|
-
|
3410
|
+
_context14.next = 4;
|
3586
3411
|
return HTTPRequest.request(this, o, t, !1);
|
3587
3412
|
case 4:
|
3588
3413
|
this.requestSettings = a;
|
3589
3414
|
case 5:
|
3590
3415
|
case "end":
|
3591
|
-
return
|
3416
|
+
return _context14.stop();
|
3592
3417
|
}
|
3593
|
-
},
|
3418
|
+
}, _callee14, this);
|
3594
3419
|
}));
|
3595
|
-
function callApiWithFiles(
|
3420
|
+
function callApiWithFiles(_x26, _x27, _x28, _x29) {
|
3596
3421
|
return _callApiWithFiles.apply(this, arguments);
|
3597
3422
|
}
|
3598
3423
|
return callApiWithFiles;
|
@@ -3600,31 +3425,31 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3600
3425
|
}, {
|
3601
3426
|
key: "callAPI",
|
3602
3427
|
value: function () {
|
3603
|
-
var _callAPI = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3604
|
-
var n,
|
3605
|
-
return _regeneratorRuntime().wrap(function
|
3606
|
-
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) {
|
3607
3432
|
case 0:
|
3608
3433
|
if (this.requestSettings) {
|
3609
|
-
|
3434
|
+
_context15.next = 2;
|
3610
3435
|
break;
|
3611
3436
|
}
|
3612
3437
|
throw new Error("Request settings have not been set up");
|
3613
3438
|
case 2:
|
3614
3439
|
n = MessageLimitUtils.processMessages(e, t.messages, this.maxMessages, this.totalMessagesMaxCharLength);
|
3615
3440
|
if (this.requestSettings.websocket) {
|
3616
|
-
|
3441
|
+
s = _objectSpread({
|
3617
3442
|
messages: n
|
3618
3443
|
}, this.rawBody);
|
3619
|
-
Websocket.sendWebsocket(this,
|
3444
|
+
Websocket.sendWebsocket(this, s, t, !1);
|
3620
3445
|
} else e.files && !this._directServiceRequiresFiles ? this.callApiWithFiles(this.rawBody, t, n, e.files) : this.callServiceAPI(t, n, e.files);
|
3621
3446
|
case 4:
|
3622
3447
|
case "end":
|
3623
|
-
return
|
3448
|
+
return _context15.stop();
|
3624
3449
|
}
|
3625
|
-
},
|
3450
|
+
}, _callee15, this);
|
3626
3451
|
}));
|
3627
|
-
function callAPI(
|
3452
|
+
function callAPI(_x30, _x31) {
|
3628
3453
|
return _callAPI.apply(this, arguments);
|
3629
3454
|
}
|
3630
3455
|
return callAPI;
|
@@ -3633,24 +3458,24 @@ var BaseServiceIO = /*#__PURE__*/function () {
|
|
3633
3458
|
}, {
|
3634
3459
|
key: "extractResultData",
|
3635
3460
|
value: function () {
|
3636
|
-
var _extractResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3637
|
-
return _regeneratorRuntime().wrap(function
|
3638
|
-
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) {
|
3639
3464
|
case 0:
|
3640
3465
|
if (!e.error) {
|
3641
|
-
|
3466
|
+
_context16.next = 2;
|
3642
3467
|
break;
|
3643
3468
|
}
|
3644
3469
|
throw e.error;
|
3645
3470
|
case 2:
|
3646
|
-
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);
|
3647
3472
|
case 3:
|
3648
3473
|
case "end":
|
3649
|
-
return
|
3474
|
+
return _context16.stop();
|
3650
3475
|
}
|
3651
|
-
},
|
3476
|
+
}, _callee16);
|
3652
3477
|
}));
|
3653
|
-
function extractResultData(
|
3478
|
+
function extractResultData(_x32) {
|
3654
3479
|
return _extractResultData.apply(this, arguments);
|
3655
3480
|
}
|
3656
3481
|
return extractResultData;
|
@@ -3867,8 +3692,8 @@ var InsertKeyView = /*#__PURE__*/function () {
|
|
3867
3692
|
n.id = "insert-key-help-text-contents";
|
3868
3693
|
var s = InsertKeyView.createFailText();
|
3869
3694
|
if (n.appendChild(s), e) {
|
3870
|
-
var
|
3871
|
-
n.appendChild(
|
3695
|
+
var a = InsertKeyView.createHelpLink(e);
|
3696
|
+
n.appendChild(a);
|
3872
3697
|
}
|
3873
3698
|
var o = InsertKeyView.createCautionText();
|
3874
3699
|
return n.appendChild(o), t.appendChild(n), {
|
@@ -4014,13 +3839,13 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
4014
3839
|
}, {
|
4015
3840
|
key: "callServiceAPI",
|
4016
3841
|
value: function () {
|
4017
|
-
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3842
|
+
var _callServiceAPI2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(e, t, n) {
|
4018
3843
|
var s;
|
4019
|
-
return _regeneratorRuntime().wrap(function
|
4020
|
-
while (1) switch (
|
3844
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
3845
|
+
while (1) switch (_context17.prev = _context17.next) {
|
4021
3846
|
case 0:
|
4022
3847
|
if (this.requestSettings) {
|
4023
|
-
|
3848
|
+
_context17.next = 2;
|
4024
3849
|
break;
|
4025
3850
|
}
|
4026
3851
|
throw new Error("Request settings have not been set up");
|
@@ -4029,11 +3854,11 @@ var _HuggingFaceIO = /*#__PURE__*/function (_DirectServiceIO) {
|
|
4029
3854
|
HTTPRequest.request(this, s, e);
|
4030
3855
|
case 4:
|
4031
3856
|
case "end":
|
4032
|
-
return
|
3857
|
+
return _context17.stop();
|
4033
3858
|
}
|
4034
|
-
},
|
3859
|
+
}, _callee17, this);
|
4035
3860
|
}));
|
4036
|
-
function callServiceAPI(
|
3861
|
+
function callServiceAPI(_x33, _x34, _x35) {
|
4037
3862
|
return _callServiceAPI2.apply(this, arguments);
|
4038
3863
|
}
|
4039
3864
|
return callServiceAPI;
|
@@ -4062,18 +3887,18 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
4062
3887
|
}, {
|
4063
3888
|
key: "callServiceAPI",
|
4064
3889
|
value: function () {
|
4065
|
-
var _callServiceAPI3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4066
|
-
return _regeneratorRuntime().wrap(function
|
4067
|
-
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) {
|
4068
3893
|
case 0:
|
4069
3894
|
if (this.requestSettings) {
|
4070
|
-
|
3895
|
+
_context18.next = 2;
|
4071
3896
|
break;
|
4072
3897
|
}
|
4073
3898
|
throw new Error("Request settings have not been set up");
|
4074
3899
|
case 2:
|
4075
3900
|
if (n != null && n[0]) {
|
4076
|
-
|
3901
|
+
_context18.next = 4;
|
4077
3902
|
break;
|
4078
3903
|
}
|
4079
3904
|
throw new Error("No file was added");
|
@@ -4081,11 +3906,11 @@ var HuggingFaceFileIO = /*#__PURE__*/function (_HuggingFaceIO2) {
|
|
4081
3906
|
HTTPRequest.poll(this, n[0], e, !1);
|
4082
3907
|
case 5:
|
4083
3908
|
case "end":
|
4084
|
-
return
|
3909
|
+
return _context18.stop();
|
4085
3910
|
}
|
4086
|
-
},
|
3911
|
+
}, _callee18, this);
|
4087
3912
|
}));
|
4088
|
-
function callServiceAPI(
|
3913
|
+
function callServiceAPI(_x36, _x37, _x38) {
|
4089
3914
|
return _callServiceAPI3.apply(this, arguments);
|
4090
3915
|
}
|
4091
3916
|
return callServiceAPI;
|
@@ -4114,35 +3939,35 @@ var HuggingFaceAudioClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4114
3939
|
_createClass(HuggingFaceAudioClassificationIO, [{
|
4115
3940
|
key: "extractPollResultData",
|
4116
3941
|
value: function () {
|
4117
|
-
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3942
|
+
var _extractPollResultData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(e) {
|
4118
3943
|
var t;
|
4119
|
-
return _regeneratorRuntime().wrap(function
|
4120
|
-
while (1) switch (
|
3944
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
3945
|
+
while (1) switch (_context19.prev = _context19.next) {
|
4121
3946
|
case 0:
|
4122
3947
|
if (!e.estimated_time) {
|
4123
|
-
|
3948
|
+
_context19.next = 2;
|
4124
3949
|
break;
|
4125
3950
|
}
|
4126
|
-
return
|
3951
|
+
return _context19.abrupt("return", {
|
4127
3952
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4128
3953
|
});
|
4129
3954
|
case 2:
|
4130
3955
|
if (!e.error) {
|
4131
|
-
|
3956
|
+
_context19.next = 4;
|
4132
3957
|
break;
|
4133
3958
|
}
|
4134
3959
|
throw e.error;
|
4135
3960
|
case 4:
|
4136
|
-
return
|
3961
|
+
return _context19.abrupt("return", {
|
4137
3962
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4138
3963
|
});
|
4139
3964
|
case 5:
|
4140
3965
|
case "end":
|
4141
|
-
return
|
3966
|
+
return _context19.stop();
|
4142
3967
|
}
|
4143
|
-
},
|
3968
|
+
}, _callee19);
|
4144
3969
|
}));
|
4145
|
-
function extractPollResultData(
|
3970
|
+
function extractPollResultData(_x39) {
|
4146
3971
|
return _extractPollResultData.apply(this, arguments);
|
4147
3972
|
}
|
4148
3973
|
return extractPollResultData;
|
@@ -4165,35 +3990,35 @@ var HuggingFaceImageClassificationIO = /*#__PURE__*/function (_HuggingFaceFileIO
|
|
4165
3990
|
_createClass(HuggingFaceImageClassificationIO, [{
|
4166
3991
|
key: "extractPollResultData",
|
4167
3992
|
value: function () {
|
4168
|
-
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3993
|
+
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(e) {
|
4169
3994
|
var t;
|
4170
|
-
return _regeneratorRuntime().wrap(function
|
4171
|
-
while (1) switch (
|
3995
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
3996
|
+
while (1) switch (_context20.prev = _context20.next) {
|
4172
3997
|
case 0:
|
4173
3998
|
if (!e.estimated_time) {
|
4174
|
-
|
3999
|
+
_context20.next = 2;
|
4175
4000
|
break;
|
4176
4001
|
}
|
4177
|
-
return
|
4002
|
+
return _context20.abrupt("return", {
|
4178
4003
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4179
4004
|
});
|
4180
4005
|
case 2:
|
4181
4006
|
if (!e.error) {
|
4182
|
-
|
4007
|
+
_context20.next = 4;
|
4183
4008
|
break;
|
4184
4009
|
}
|
4185
4010
|
throw e.error;
|
4186
4011
|
case 4:
|
4187
|
-
return
|
4012
|
+
return _context20.abrupt("return", {
|
4188
4013
|
text: ((t = e[0]) == null ? void 0 : t.label) || ""
|
4189
4014
|
});
|
4190
4015
|
case 5:
|
4191
4016
|
case "end":
|
4192
|
-
return
|
4017
|
+
return _context20.stop();
|
4193
4018
|
}
|
4194
|
-
},
|
4019
|
+
}, _callee20);
|
4195
4020
|
}));
|
4196
|
-
function extractPollResultData(
|
4021
|
+
function extractPollResultData(_x40) {
|
4197
4022
|
return _extractPollResultData2.apply(this, arguments);
|
4198
4023
|
}
|
4199
4024
|
return extractPollResultData;
|
@@ -4278,19 +4103,19 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4278
4103
|
}, {
|
4279
4104
|
key: "callServiceAPI",
|
4280
4105
|
value: function () {
|
4281
|
-
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4106
|
+
var _callServiceAPI4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(e, t, n) {
|
4282
4107
|
var s;
|
4283
|
-
return _regeneratorRuntime().wrap(function
|
4284
|
-
while (1) switch (
|
4108
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
4109
|
+
while (1) switch (_context21.prev = _context21.next) {
|
4285
4110
|
case 0:
|
4286
4111
|
if (this.requestSettings) {
|
4287
|
-
|
4112
|
+
_context21.next = 2;
|
4288
4113
|
break;
|
4289
4114
|
}
|
4290
4115
|
throw new Error("Request settings have not been set up");
|
4291
4116
|
case 2:
|
4292
4117
|
if (n) {
|
4293
|
-
|
4118
|
+
_context21.next = 4;
|
4294
4119
|
break;
|
4295
4120
|
}
|
4296
4121
|
throw new Error("Image was not found");
|
@@ -4299,11 +4124,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4299
4124
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
4300
4125
|
case 6:
|
4301
4126
|
case "end":
|
4302
|
-
return
|
4127
|
+
return _context21.stop();
|
4303
4128
|
}
|
4304
|
-
},
|
4129
|
+
}, _callee21, this);
|
4305
4130
|
}));
|
4306
|
-
function callServiceAPI(
|
4131
|
+
function callServiceAPI(_x41, _x42, _x43) {
|
4307
4132
|
return _callServiceAPI4.apply(this, arguments);
|
4308
4133
|
}
|
4309
4134
|
return callServiceAPI;
|
@@ -4311,17 +4136,17 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4311
4136
|
}, {
|
4312
4137
|
key: "extractResultData",
|
4313
4138
|
value: function () {
|
4314
|
-
var _extractResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4315
|
-
return _regeneratorRuntime().wrap(function
|
4316
|
-
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) {
|
4317
4142
|
case 0:
|
4318
4143
|
if (!e.message) {
|
4319
|
-
|
4144
|
+
_context22.next = 2;
|
4320
4145
|
break;
|
4321
4146
|
}
|
4322
4147
|
throw e.message;
|
4323
4148
|
case 2:
|
4324
|
-
return
|
4149
|
+
return _context22.abrupt("return", {
|
4325
4150
|
files: e.artifacts.map(function (n) {
|
4326
4151
|
return {
|
4327
4152
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4331,11 +4156,11 @@ var StabilityAIImageToImageUpscaleIO = /*#__PURE__*/function (_StabilityAIIO) {
|
|
4331
4156
|
});
|
4332
4157
|
case 3:
|
4333
4158
|
case "end":
|
4334
|
-
return
|
4159
|
+
return _context22.stop();
|
4335
4160
|
}
|
4336
|
-
},
|
4161
|
+
}, _callee22);
|
4337
4162
|
}));
|
4338
|
-
function extractResultData(
|
4163
|
+
function extractResultData(_x44) {
|
4339
4164
|
return _extractResultData2.apply(this, arguments);
|
4340
4165
|
}
|
4341
4166
|
return extractResultData;
|
@@ -4387,19 +4212,19 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4387
4212
|
}, {
|
4388
4213
|
key: "callServiceAPI",
|
4389
4214
|
value: function () {
|
4390
|
-
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4215
|
+
var _callServiceAPI5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23(e, t, n) {
|
4391
4216
|
var a, l, s, o;
|
4392
|
-
return _regeneratorRuntime().wrap(function
|
4393
|
-
while (1) switch (
|
4217
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
4218
|
+
while (1) switch (_context23.prev = _context23.next) {
|
4394
4219
|
case 0:
|
4395
4220
|
if (this.requestSettings) {
|
4396
|
-
|
4221
|
+
_context23.next = 2;
|
4397
4222
|
break;
|
4398
4223
|
}
|
4399
4224
|
throw new Error("Request settings have not been set up");
|
4400
4225
|
case 2:
|
4401
4226
|
if (!(!n || !n[0] || !n[1])) {
|
4402
|
-
|
4227
|
+
_context23.next = 4;
|
4403
4228
|
break;
|
4404
4229
|
}
|
4405
4230
|
throw new Error("Image was not found");
|
@@ -4408,11 +4233,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4408
4233
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4409
4234
|
case 6:
|
4410
4235
|
case "end":
|
4411
|
-
return
|
4236
|
+
return _context23.stop();
|
4412
4237
|
}
|
4413
|
-
},
|
4238
|
+
}, _callee23, this);
|
4414
4239
|
}));
|
4415
|
-
function callServiceAPI(
|
4240
|
+
function callServiceAPI(_x45, _x46, _x47) {
|
4416
4241
|
return _callServiceAPI5.apply(this, arguments);
|
4417
4242
|
}
|
4418
4243
|
return callServiceAPI;
|
@@ -4420,17 +4245,17 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4420
4245
|
}, {
|
4421
4246
|
key: "extractResultData",
|
4422
4247
|
value: function () {
|
4423
|
-
var _extractResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4424
|
-
return _regeneratorRuntime().wrap(function
|
4425
|
-
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) {
|
4426
4251
|
case 0:
|
4427
4252
|
if (!e.message) {
|
4428
|
-
|
4253
|
+
_context24.next = 2;
|
4429
4254
|
break;
|
4430
4255
|
}
|
4431
4256
|
throw e.message;
|
4432
4257
|
case 2:
|
4433
|
-
return
|
4258
|
+
return _context24.abrupt("return", {
|
4434
4259
|
files: e.artifacts.map(function (n) {
|
4435
4260
|
return {
|
4436
4261
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4440,11 +4265,11 @@ var StabilityAIImageToImageMaskingIO = /*#__PURE__*/function (_StabilityAIIO2) {
|
|
4440
4265
|
});
|
4441
4266
|
case 3:
|
4442
4267
|
case "end":
|
4443
|
-
return
|
4268
|
+
return _context24.stop();
|
4444
4269
|
}
|
4445
|
-
},
|
4270
|
+
}, _callee24);
|
4446
4271
|
}));
|
4447
|
-
function extractResultData(
|
4272
|
+
function extractResultData(_x48) {
|
4448
4273
|
return _extractResultData3.apply(this, arguments);
|
4449
4274
|
}
|
4450
4275
|
return extractResultData;
|
@@ -4477,34 +4302,34 @@ var HuggingFaceAudioRecognitionIO = /*#__PURE__*/function (_HuggingFaceFileIO3)
|
|
4477
4302
|
_createClass(HuggingFaceAudioRecognitionIO, [{
|
4478
4303
|
key: "extractPollResultData",
|
4479
4304
|
value: function () {
|
4480
|
-
var _extractPollResultData3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4481
|
-
return _regeneratorRuntime().wrap(function
|
4482
|
-
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) {
|
4483
4308
|
case 0:
|
4484
4309
|
if (!e.estimated_time) {
|
4485
|
-
|
4310
|
+
_context25.next = 2;
|
4486
4311
|
break;
|
4487
4312
|
}
|
4488
|
-
return
|
4313
|
+
return _context25.abrupt("return", {
|
4489
4314
|
timeoutMS: (e.estimated_time + 1) * 1e3
|
4490
4315
|
});
|
4491
4316
|
case 2:
|
4492
4317
|
if (!e.error) {
|
4493
|
-
|
4318
|
+
_context25.next = 4;
|
4494
4319
|
break;
|
4495
4320
|
}
|
4496
4321
|
throw e.error;
|
4497
4322
|
case 4:
|
4498
|
-
return
|
4323
|
+
return _context25.abrupt("return", {
|
4499
4324
|
text: e.text || ""
|
4500
4325
|
});
|
4501
4326
|
case 5:
|
4502
4327
|
case "end":
|
4503
|
-
return
|
4328
|
+
return _context25.stop();
|
4504
4329
|
}
|
4505
|
-
},
|
4330
|
+
}, _callee25);
|
4506
4331
|
}));
|
4507
|
-
function extractPollResultData(
|
4332
|
+
function extractPollResultData(_x49) {
|
4508
4333
|
return _extractPollResultData3.apply(this, arguments);
|
4509
4334
|
}
|
4510
4335
|
return extractPollResultData;
|
@@ -4525,26 +4350,26 @@ var HuggingFaceTextGenerationIO = /*#__PURE__*/function (_HuggingFaceIO3) {
|
|
4525
4350
|
_createClass(HuggingFaceTextGenerationIO, [{
|
4526
4351
|
key: "extractResultData",
|
4527
4352
|
value: function () {
|
4528
|
-
var _extractResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4529
|
-
return _regeneratorRuntime().wrap(function
|
4530
|
-
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) {
|
4531
4356
|
case 0:
|
4532
4357
|
if (!e.error) {
|
4533
|
-
|
4358
|
+
_context26.next = 2;
|
4534
4359
|
break;
|
4535
4360
|
}
|
4536
4361
|
throw e.error;
|
4537
4362
|
case 2:
|
4538
|
-
return
|
4363
|
+
return _context26.abrupt("return", {
|
4539
4364
|
text: e[0].generated_text || ""
|
4540
4365
|
});
|
4541
4366
|
case 3:
|
4542
4367
|
case "end":
|
4543
|
-
return
|
4368
|
+
return _context26.stop();
|
4544
4369
|
}
|
4545
|
-
},
|
4370
|
+
}, _callee26);
|
4546
4371
|
}));
|
4547
|
-
function extractResultData(
|
4372
|
+
function extractResultData(_x50) {
|
4548
4373
|
return _extractResultData4.apply(this, arguments);
|
4549
4374
|
}
|
4550
4375
|
return extractResultData;
|
@@ -4581,26 +4406,26 @@ var HuggingFaceQuestionAnswerIO = /*#__PURE__*/function (_HuggingFaceIO4) {
|
|
4581
4406
|
}, {
|
4582
4407
|
key: "extractResultData",
|
4583
4408
|
value: function () {
|
4584
|
-
var _extractResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4585
|
-
return _regeneratorRuntime().wrap(function
|
4586
|
-
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) {
|
4587
4412
|
case 0:
|
4588
4413
|
if (!e.error) {
|
4589
|
-
|
4414
|
+
_context27.next = 2;
|
4590
4415
|
break;
|
4591
4416
|
}
|
4592
4417
|
throw e.error;
|
4593
4418
|
case 2:
|
4594
|
-
return
|
4419
|
+
return _context27.abrupt("return", {
|
4595
4420
|
text: e.answer || ""
|
4596
4421
|
});
|
4597
4422
|
case 3:
|
4598
4423
|
case "end":
|
4599
|
-
return
|
4424
|
+
return _context27.stop();
|
4600
4425
|
}
|
4601
|
-
},
|
4426
|
+
}, _callee27);
|
4602
4427
|
}));
|
4603
|
-
function extractResultData(
|
4428
|
+
function extractResultData(_x51) {
|
4604
4429
|
return _extractResultData5.apply(this, arguments);
|
4605
4430
|
}
|
4606
4431
|
return extractResultData;
|
@@ -4621,26 +4446,26 @@ var HuggingFaceSummarizationIO = /*#__PURE__*/function (_HuggingFaceIO5) {
|
|
4621
4446
|
_createClass(HuggingFaceSummarizationIO, [{
|
4622
4447
|
key: "extractResultData",
|
4623
4448
|
value: function () {
|
4624
|
-
var _extractResultData6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4625
|
-
return _regeneratorRuntime().wrap(function
|
4626
|
-
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) {
|
4627
4452
|
case 0:
|
4628
4453
|
if (!e.error) {
|
4629
|
-
|
4454
|
+
_context28.next = 2;
|
4630
4455
|
break;
|
4631
4456
|
}
|
4632
4457
|
throw e.error;
|
4633
4458
|
case 2:
|
4634
|
-
return
|
4459
|
+
return _context28.abrupt("return", {
|
4635
4460
|
text: e[0].summary_text || ""
|
4636
4461
|
});
|
4637
4462
|
case 3:
|
4638
4463
|
case "end":
|
4639
|
-
return
|
4464
|
+
return _context28.stop();
|
4640
4465
|
}
|
4641
|
-
},
|
4466
|
+
}, _callee28);
|
4642
4467
|
}));
|
4643
|
-
function extractResultData(
|
4468
|
+
function extractResultData(_x52) {
|
4644
4469
|
return _extractResultData6.apply(this, arguments);
|
4645
4470
|
}
|
4646
4471
|
return extractResultData;
|
@@ -4701,26 +4526,26 @@ var HuggingFaceConversationIO = /*#__PURE__*/function (_HuggingFaceIO6) {
|
|
4701
4526
|
}, {
|
4702
4527
|
key: "extractResultData",
|
4703
4528
|
value: function () {
|
4704
|
-
var _extractResultData7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4705
|
-
return _regeneratorRuntime().wrap(function
|
4706
|
-
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) {
|
4707
4532
|
case 0:
|
4708
4533
|
if (!e.error) {
|
4709
|
-
|
4534
|
+
_context29.next = 2;
|
4710
4535
|
break;
|
4711
4536
|
}
|
4712
4537
|
throw e.error;
|
4713
4538
|
case 2:
|
4714
|
-
return
|
4539
|
+
return _context29.abrupt("return", {
|
4715
4540
|
text: e.generated_text || ""
|
4716
4541
|
});
|
4717
4542
|
case 3:
|
4718
4543
|
case "end":
|
4719
|
-
return
|
4544
|
+
return _context29.stop();
|
4720
4545
|
}
|
4721
|
-
},
|
4546
|
+
}, _callee29);
|
4722
4547
|
}));
|
4723
|
-
function extractResultData(
|
4548
|
+
function extractResultData(_x53) {
|
4724
4549
|
return _extractResultData7.apply(this, arguments);
|
4725
4550
|
}
|
4726
4551
|
return extractResultData;
|
@@ -4762,19 +4587,19 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4762
4587
|
}, {
|
4763
4588
|
key: "callServiceAPI",
|
4764
4589
|
value: function () {
|
4765
|
-
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4590
|
+
var _callServiceAPI6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30(e, t, n) {
|
4766
4591
|
var a, l, s, o;
|
4767
|
-
return _regeneratorRuntime().wrap(function
|
4768
|
-
while (1) switch (
|
4592
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
4593
|
+
while (1) switch (_context30.prev = _context30.next) {
|
4769
4594
|
case 0:
|
4770
4595
|
if (this.requestSettings) {
|
4771
|
-
|
4596
|
+
_context30.next = 2;
|
4772
4597
|
break;
|
4773
4598
|
}
|
4774
4599
|
throw new Error("Request settings have not been set up");
|
4775
4600
|
case 2:
|
4776
4601
|
if (n) {
|
4777
|
-
|
4602
|
+
_context30.next = 4;
|
4778
4603
|
break;
|
4779
4604
|
}
|
4780
4605
|
throw new Error("Image was not found");
|
@@ -4783,11 +4608,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4783
4608
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
4784
4609
|
case 6:
|
4785
4610
|
case "end":
|
4786
|
-
return
|
4611
|
+
return _context30.stop();
|
4787
4612
|
}
|
4788
|
-
},
|
4613
|
+
}, _callee30, this);
|
4789
4614
|
}));
|
4790
|
-
function callServiceAPI(
|
4615
|
+
function callServiceAPI(_x54, _x55, _x56) {
|
4791
4616
|
return _callServiceAPI6.apply(this, arguments);
|
4792
4617
|
}
|
4793
4618
|
return callServiceAPI;
|
@@ -4795,17 +4620,17 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4795
4620
|
}, {
|
4796
4621
|
key: "extractResultData",
|
4797
4622
|
value: function () {
|
4798
|
-
var _extractResultData8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4799
|
-
return _regeneratorRuntime().wrap(function
|
4800
|
-
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) {
|
4801
4626
|
case 0:
|
4802
4627
|
if (!e.message) {
|
4803
|
-
|
4628
|
+
_context31.next = 2;
|
4804
4629
|
break;
|
4805
4630
|
}
|
4806
4631
|
throw e.message;
|
4807
4632
|
case 2:
|
4808
|
-
return
|
4633
|
+
return _context31.abrupt("return", {
|
4809
4634
|
files: e.artifacts.map(function (n) {
|
4810
4635
|
return {
|
4811
4636
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4815,11 +4640,11 @@ var StabilityAIImageToImageIO = /*#__PURE__*/function (_StabilityAIIO3) {
|
|
4815
4640
|
});
|
4816
4641
|
case 3:
|
4817
4642
|
case "end":
|
4818
|
-
return
|
4643
|
+
return _context31.stop();
|
4819
4644
|
}
|
4820
|
-
},
|
4645
|
+
}, _callee31);
|
4821
4646
|
}));
|
4822
|
-
function extractResultData(
|
4647
|
+
function extractResultData(_x57) {
|
4823
4648
|
return _extractResultData8.apply(this, arguments);
|
4824
4649
|
}
|
4825
4650
|
return extractResultData;
|
@@ -4850,26 +4675,26 @@ var HuggingFaceTranslationIO = /*#__PURE__*/function (_HuggingFaceIO7) {
|
|
4850
4675
|
_createClass(HuggingFaceTranslationIO, [{
|
4851
4676
|
key: "extractResultData",
|
4852
4677
|
value: function () {
|
4853
|
-
var _extractResultData9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4854
|
-
return _regeneratorRuntime().wrap(function
|
4855
|
-
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) {
|
4856
4681
|
case 0:
|
4857
4682
|
if (!e.error) {
|
4858
|
-
|
4683
|
+
_context32.next = 2;
|
4859
4684
|
break;
|
4860
4685
|
}
|
4861
4686
|
throw e.error;
|
4862
4687
|
case 2:
|
4863
|
-
return
|
4688
|
+
return _context32.abrupt("return", {
|
4864
4689
|
text: e[0].translation_text || ""
|
4865
4690
|
});
|
4866
4691
|
case 3:
|
4867
4692
|
case "end":
|
4868
|
-
return
|
4693
|
+
return _context32.stop();
|
4869
4694
|
}
|
4870
|
-
},
|
4695
|
+
}, _callee32);
|
4871
4696
|
}));
|
4872
|
-
function extractResultData(
|
4697
|
+
function extractResultData(_x58) {
|
4873
4698
|
return _extractResultData9.apply(this, arguments);
|
4874
4699
|
}
|
4875
4700
|
return extractResultData;
|
@@ -4903,13 +4728,13 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4903
4728
|
}, {
|
4904
4729
|
key: "callServiceAPI",
|
4905
4730
|
value: function () {
|
4906
|
-
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4731
|
+
var _callServiceAPI7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33(e, t) {
|
4907
4732
|
var n;
|
4908
|
-
return _regeneratorRuntime().wrap(function
|
4909
|
-
while (1) switch (
|
4733
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
4734
|
+
while (1) switch (_context33.prev = _context33.next) {
|
4910
4735
|
case 0:
|
4911
4736
|
if (this.requestSettings) {
|
4912
|
-
|
4737
|
+
_context33.next = 2;
|
4913
4738
|
break;
|
4914
4739
|
}
|
4915
4740
|
throw new Error("Request settings have not been set up");
|
@@ -4918,11 +4743,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4918
4743
|
HTTPRequest.request(this, n, e);
|
4919
4744
|
case 4:
|
4920
4745
|
case "end":
|
4921
|
-
return
|
4746
|
+
return _context33.stop();
|
4922
4747
|
}
|
4923
|
-
},
|
4748
|
+
}, _callee33, this);
|
4924
4749
|
}));
|
4925
|
-
function callServiceAPI(
|
4750
|
+
function callServiceAPI(_x59, _x60) {
|
4926
4751
|
return _callServiceAPI7.apply(this, arguments);
|
4927
4752
|
}
|
4928
4753
|
return callServiceAPI;
|
@@ -4930,17 +4755,17 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4930
4755
|
}, {
|
4931
4756
|
key: "extractResultData",
|
4932
4757
|
value: function () {
|
4933
|
-
var _extractResultData10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4934
|
-
return _regeneratorRuntime().wrap(function
|
4935
|
-
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) {
|
4936
4761
|
case 0:
|
4937
4762
|
if (!e.message) {
|
4938
|
-
|
4763
|
+
_context34.next = 2;
|
4939
4764
|
break;
|
4940
4765
|
}
|
4941
4766
|
throw e.message;
|
4942
4767
|
case 2:
|
4943
|
-
return
|
4768
|
+
return _context34.abrupt("return", {
|
4944
4769
|
files: e.artifacts.map(function (n) {
|
4945
4770
|
return {
|
4946
4771
|
src: "".concat(BASE_64_PREFIX).concat(n.base64),
|
@@ -4950,11 +4775,11 @@ var StabilityAITextToImageIO = /*#__PURE__*/function (_StabilityAIIO4) {
|
|
4950
4775
|
});
|
4951
4776
|
case 3:
|
4952
4777
|
case "end":
|
4953
|
-
return
|
4778
|
+
return _context34.stop();
|
4954
4779
|
}
|
4955
|
-
},
|
4780
|
+
}, _callee34);
|
4956
4781
|
}));
|
4957
|
-
function extractResultData(
|
4782
|
+
function extractResultData(_x61) {
|
4958
4783
|
return _extractResultData10.apply(this, arguments);
|
4959
4784
|
}
|
4960
4785
|
return extractResultData;
|
@@ -4987,26 +4812,26 @@ var HuggingFaceFillMaskIO = /*#__PURE__*/function (_HuggingFaceIO8) {
|
|
4987
4812
|
_createClass(HuggingFaceFillMaskIO, [{
|
4988
4813
|
key: "extractResultData",
|
4989
4814
|
value: function () {
|
4990
|
-
var _extractResultData11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4991
|
-
return _regeneratorRuntime().wrap(function
|
4992
|
-
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) {
|
4993
4818
|
case 0:
|
4994
4819
|
if (!e.error) {
|
4995
|
-
|
4820
|
+
_context35.next = 2;
|
4996
4821
|
break;
|
4997
4822
|
}
|
4998
4823
|
throw e.error;
|
4999
4824
|
case 2:
|
5000
|
-
return
|
4825
|
+
return _context35.abrupt("return", {
|
5001
4826
|
text: e[0].sequence || ""
|
5002
4827
|
});
|
5003
4828
|
case 3:
|
5004
4829
|
case "end":
|
5005
|
-
return
|
4830
|
+
return _context35.stop();
|
5006
4831
|
}
|
5007
|
-
},
|
4832
|
+
}, _callee35);
|
5008
4833
|
}));
|
5009
|
-
function extractResultData(
|
4834
|
+
function extractResultData(_x62) {
|
5010
4835
|
return _extractResultData11.apply(this, arguments);
|
5011
4836
|
}
|
5012
4837
|
return extractResultData;
|
@@ -5081,13 +4906,13 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5081
4906
|
}, {
|
5082
4907
|
key: "callServiceAPI",
|
5083
4908
|
value: function () {
|
5084
|
-
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4909
|
+
var _callServiceAPI8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36(e, t) {
|
5085
4910
|
var n;
|
5086
|
-
return _regeneratorRuntime().wrap(function
|
5087
|
-
while (1) switch (
|
4911
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
4912
|
+
while (1) switch (_context36.prev = _context36.next) {
|
5088
4913
|
case 0:
|
5089
4914
|
if (this.requestSettings) {
|
5090
|
-
|
4915
|
+
_context36.next = 2;
|
5091
4916
|
break;
|
5092
4917
|
}
|
5093
4918
|
throw new Error("Request settings have not been set up");
|
@@ -5096,11 +4921,11 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5096
4921
|
HTTPRequest.request(this, n, e);
|
5097
4922
|
case 4:
|
5098
4923
|
case "end":
|
5099
|
-
return
|
4924
|
+
return _context36.stop();
|
5100
4925
|
}
|
5101
|
-
},
|
4926
|
+
}, _callee36, this);
|
5102
4927
|
}));
|
5103
|
-
function callServiceAPI(
|
4928
|
+
function callServiceAPI(_x63, _x64) {
|
5104
4929
|
return _callServiceAPI8.apply(this, arguments);
|
5105
4930
|
}
|
5106
4931
|
return callServiceAPI;
|
@@ -5108,27 +4933,27 @@ var CohereTextGenerationIO = /*#__PURE__*/function (_CohereIO) {
|
|
5108
4933
|
}, {
|
5109
4934
|
key: "extractResultData",
|
5110
4935
|
value: function () {
|
5111
|
-
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4936
|
+
var _extractResultData12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
5112
4937
|
var t;
|
5113
|
-
return _regeneratorRuntime().wrap(function
|
5114
|
-
while (1) switch (
|
4938
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
4939
|
+
while (1) switch (_context37.prev = _context37.next) {
|
5115
4940
|
case 0:
|
5116
4941
|
if (!e.message) {
|
5117
|
-
|
4942
|
+
_context37.next = 2;
|
5118
4943
|
break;
|
5119
4944
|
}
|
5120
4945
|
throw e.message;
|
5121
4946
|
case 2:
|
5122
|
-
return
|
4947
|
+
return _context37.abrupt("return", {
|
5123
4948
|
text: ((t = e.generations) == null ? void 0 : t[0].text) || ""
|
5124
4949
|
});
|
5125
4950
|
case 3:
|
5126
4951
|
case "end":
|
5127
|
-
return
|
4952
|
+
return _context37.stop();
|
5128
4953
|
}
|
5129
|
-
},
|
4954
|
+
}, _callee37);
|
5130
4955
|
}));
|
5131
|
-
function extractResultData(
|
4956
|
+
function extractResultData(_x65) {
|
5132
4957
|
return _extractResultData12.apply(this, arguments);
|
5133
4958
|
}
|
5134
4959
|
return extractResultData;
|
@@ -5158,13 +4983,13 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5158
4983
|
}, {
|
5159
4984
|
key: "callServiceAPI",
|
5160
4985
|
value: function () {
|
5161
|
-
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
4986
|
+
var _callServiceAPI9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38(e, t) {
|
5162
4987
|
var n;
|
5163
|
-
return _regeneratorRuntime().wrap(function
|
5164
|
-
while (1) switch (
|
4988
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
4989
|
+
while (1) switch (_context38.prev = _context38.next) {
|
5165
4990
|
case 0:
|
5166
4991
|
if (this.requestSettings) {
|
5167
|
-
|
4992
|
+
_context38.next = 2;
|
5168
4993
|
break;
|
5169
4994
|
}
|
5170
4995
|
throw new Error("Request settings have not been set up");
|
@@ -5173,11 +4998,11 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5173
4998
|
HTTPRequest.request(this, n, e);
|
5174
4999
|
case 4:
|
5175
5000
|
case "end":
|
5176
|
-
return
|
5001
|
+
return _context38.stop();
|
5177
5002
|
}
|
5178
|
-
},
|
5003
|
+
}, _callee38, this);
|
5179
5004
|
}));
|
5180
|
-
function callServiceAPI(
|
5005
|
+
function callServiceAPI(_x66, _x67) {
|
5181
5006
|
return _callServiceAPI9.apply(this, arguments);
|
5182
5007
|
}
|
5183
5008
|
return callServiceAPI;
|
@@ -5185,26 +5010,26 @@ var CohereSummarizationIO = /*#__PURE__*/function (_CohereIO2) {
|
|
5185
5010
|
}, {
|
5186
5011
|
key: "extractResultData",
|
5187
5012
|
value: function () {
|
5188
|
-
var _extractResultData13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5189
|
-
return _regeneratorRuntime().wrap(function
|
5190
|
-
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) {
|
5191
5016
|
case 0:
|
5192
5017
|
if (!e.message) {
|
5193
|
-
|
5018
|
+
_context39.next = 2;
|
5194
5019
|
break;
|
5195
5020
|
}
|
5196
5021
|
throw e.message;
|
5197
5022
|
case 2:
|
5198
|
-
return
|
5023
|
+
return _context39.abrupt("return", {
|
5199
5024
|
text: e.summary || ""
|
5200
5025
|
});
|
5201
5026
|
case 3:
|
5202
5027
|
case "end":
|
5203
|
-
return
|
5028
|
+
return _context39.stop();
|
5204
5029
|
}
|
5205
|
-
},
|
5030
|
+
}, _callee39);
|
5206
5031
|
}));
|
5207
|
-
function extractResultData(
|
5032
|
+
function extractResultData(_x68) {
|
5208
5033
|
return _extractResultData13.apply(this, arguments);
|
5209
5034
|
}
|
5210
5035
|
return extractResultData;
|
@@ -5361,13 +5186,13 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5361
5186
|
}, {
|
5362
5187
|
key: "callServiceAPI",
|
5363
5188
|
value: function () {
|
5364
|
-
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5189
|
+
var _callServiceAPI10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40(e, t) {
|
5365
5190
|
var n;
|
5366
|
-
return _regeneratorRuntime().wrap(function
|
5367
|
-
while (1) switch (
|
5191
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
5192
|
+
while (1) switch (_context40.prev = _context40.next) {
|
5368
5193
|
case 0:
|
5369
5194
|
if (this.requestSettings) {
|
5370
|
-
|
5195
|
+
_context40.next = 2;
|
5371
5196
|
break;
|
5372
5197
|
}
|
5373
5198
|
throw new Error("Request settings have not been set up");
|
@@ -5376,11 +5201,11 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5376
5201
|
HTTPRequest.request(this, n, e), this.messages = e;
|
5377
5202
|
case 4:
|
5378
5203
|
case "end":
|
5379
|
-
return
|
5204
|
+
return _context40.stop();
|
5380
5205
|
}
|
5381
|
-
},
|
5206
|
+
}, _callee40, this);
|
5382
5207
|
}));
|
5383
|
-
function callServiceAPI(
|
5208
|
+
function callServiceAPI(_x69, _x70) {
|
5384
5209
|
return _callServiceAPI10.apply(this, arguments);
|
5385
5210
|
}
|
5386
5211
|
return callServiceAPI;
|
@@ -5388,34 +5213,34 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5388
5213
|
}, {
|
5389
5214
|
key: "extractResultData",
|
5390
5215
|
value: function () {
|
5391
|
-
var _extractResultData14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5392
|
-
var t, n,
|
5393
|
-
return _regeneratorRuntime().wrap(function
|
5394
|
-
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) {
|
5395
5220
|
case 0:
|
5396
5221
|
if (!e.error) {
|
5397
|
-
|
5222
|
+
_context41.next = 2;
|
5398
5223
|
break;
|
5399
5224
|
}
|
5400
5225
|
throw e.error.message;
|
5401
5226
|
case 2:
|
5402
5227
|
if (this.messages && this.completionsHandlers) {
|
5403
|
-
n = e.headers.get("operation-location"),
|
5228
|
+
n = e.headers.get("operation-location"), s = {
|
5404
5229
|
method: "GET",
|
5405
5230
|
headers: (t = this.requestSettings) == null ? void 0 : t.headers
|
5406
5231
|
};
|
5407
|
-
HTTPRequest.executePollRequest(this, n,
|
5232
|
+
HTTPRequest.executePollRequest(this, n, s, this.messages);
|
5408
5233
|
}
|
5409
|
-
return
|
5234
|
+
return _context41.abrupt("return", {
|
5410
5235
|
pollingInAnotherRequest: !0
|
5411
5236
|
});
|
5412
5237
|
case 4:
|
5413
5238
|
case "end":
|
5414
|
-
return
|
5239
|
+
return _context41.stop();
|
5415
5240
|
}
|
5416
|
-
},
|
5241
|
+
}, _callee41, this);
|
5417
5242
|
}));
|
5418
|
-
function extractResultData(
|
5243
|
+
function extractResultData(_x71) {
|
5419
5244
|
return _extractResultData14.apply(this, arguments);
|
5420
5245
|
}
|
5421
5246
|
return extractResultData;
|
@@ -5423,33 +5248,33 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5423
5248
|
}, {
|
5424
5249
|
key: "extractPollResultData",
|
5425
5250
|
value: function () {
|
5426
|
-
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5251
|
+
var _extractPollResultData4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee42(e) {
|
5427
5252
|
var t, _iterator, _step, n;
|
5428
|
-
return _regeneratorRuntime().wrap(function
|
5429
|
-
while (1) switch (
|
5253
|
+
return _regeneratorRuntime().wrap(function _callee42$(_context42) {
|
5254
|
+
while (1) switch (_context42.prev = _context42.next) {
|
5430
5255
|
case 0:
|
5431
5256
|
if (!e.error) {
|
5432
|
-
|
5257
|
+
_context42.next = 2;
|
5433
5258
|
break;
|
5434
5259
|
}
|
5435
5260
|
throw e.error;
|
5436
5261
|
case 2:
|
5437
5262
|
if (!(e.status === "running")) {
|
5438
|
-
|
5263
|
+
_context42.next = 4;
|
5439
5264
|
break;
|
5440
5265
|
}
|
5441
|
-
return
|
5266
|
+
return _context42.abrupt("return", {
|
5442
5267
|
timeoutMS: 2e3
|
5443
5268
|
});
|
5444
5269
|
case 4:
|
5445
5270
|
if (!(e.errors.length > 0)) {
|
5446
|
-
|
5271
|
+
_context42.next = 6;
|
5447
5272
|
break;
|
5448
5273
|
}
|
5449
5274
|
throw e.errors[0];
|
5450
5275
|
case 6:
|
5451
5276
|
if (!(e.tasks.items[0].results.errors.length > 0)) {
|
5452
|
-
|
5277
|
+
_context42.next = 8;
|
5453
5278
|
break;
|
5454
5279
|
}
|
5455
5280
|
throw e.tasks.items[0].results.errors[0];
|
@@ -5466,16 +5291,16 @@ var AzureSummarizationIO = /*#__PURE__*/function (_AzureLanguageIO) {
|
|
5466
5291
|
} finally {
|
5467
5292
|
_iterator.f();
|
5468
5293
|
}
|
5469
|
-
return
|
5294
|
+
return _context42.abrupt("return", {
|
5470
5295
|
text: t || ""
|
5471
5296
|
});
|
5472
5297
|
case 12:
|
5473
5298
|
case "end":
|
5474
|
-
return
|
5299
|
+
return _context42.stop();
|
5475
5300
|
}
|
5476
|
-
},
|
5301
|
+
}, _callee42);
|
5477
5302
|
}));
|
5478
|
-
function extractPollResultData(
|
5303
|
+
function extractPollResultData(_x72) {
|
5479
5304
|
return _extractPollResultData4.apply(this, arguments);
|
5480
5305
|
}
|
5481
5306
|
return extractPollResultData;
|
@@ -5574,13 +5399,13 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5574
5399
|
}, {
|
5575
5400
|
key: "callServiceAPI",
|
5576
5401
|
value: function () {
|
5577
|
-
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5402
|
+
var _callServiceAPI11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(e, t) {
|
5578
5403
|
var n;
|
5579
|
-
return _regeneratorRuntime().wrap(function
|
5580
|
-
while (1) switch (
|
5404
|
+
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
5405
|
+
while (1) switch (_context43.prev = _context43.next) {
|
5581
5406
|
case 0:
|
5582
5407
|
if (this.requestSettings) {
|
5583
|
-
|
5408
|
+
_context43.next = 2;
|
5584
5409
|
break;
|
5585
5410
|
}
|
5586
5411
|
throw new Error("Request settings have not been set up");
|
@@ -5589,11 +5414,11 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5589
5414
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
5590
5415
|
case 4:
|
5591
5416
|
case "end":
|
5592
|
-
return
|
5417
|
+
return _context43.stop();
|
5593
5418
|
}
|
5594
|
-
},
|
5419
|
+
}, _callee43, this);
|
5595
5420
|
}));
|
5596
|
-
function callServiceAPI(
|
5421
|
+
function callServiceAPI(_x73, _x74) {
|
5597
5422
|
return _callServiceAPI11.apply(this, arguments);
|
5598
5423
|
}
|
5599
5424
|
return callServiceAPI;
|
@@ -5601,27 +5426,27 @@ var OpenAICompletionsIO = /*#__PURE__*/function (_DirectServiceIO5) {
|
|
5601
5426
|
}, {
|
5602
5427
|
key: "extractResultData",
|
5603
5428
|
value: function () {
|
5604
|
-
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5429
|
+
var _extractResultData15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(e) {
|
5605
5430
|
var t;
|
5606
|
-
return _regeneratorRuntime().wrap(function
|
5607
|
-
while (1) switch (
|
5431
|
+
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
5432
|
+
while (1) switch (_context44.prev = _context44.next) {
|
5608
5433
|
case 0:
|
5609
5434
|
if (!e.error) {
|
5610
|
-
|
5435
|
+
_context44.next = 2;
|
5611
5436
|
break;
|
5612
5437
|
}
|
5613
5438
|
throw e.error.message;
|
5614
5439
|
case 2:
|
5615
|
-
return
|
5440
|
+
return _context44.abrupt("return", {
|
5616
5441
|
text: ((t = e.choices[0]) == null ? void 0 : t.text) || ""
|
5617
5442
|
});
|
5618
5443
|
case 3:
|
5619
5444
|
case "end":
|
5620
|
-
return
|
5445
|
+
return _context44.stop();
|
5621
5446
|
}
|
5622
|
-
},
|
5447
|
+
}, _callee44);
|
5623
5448
|
}));
|
5624
|
-
function extractResultData(
|
5449
|
+
function extractResultData(_x75) {
|
5625
5450
|
return _extractResultData15.apply(this, arguments);
|
5626
5451
|
}
|
5627
5452
|
return extractResultData;
|
@@ -5636,17 +5461,17 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5636
5461
|
_createClass(AssemblyAIUtils, null, [{
|
5637
5462
|
key: "poll",
|
5638
5463
|
value: function () {
|
5639
|
-
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5464
|
+
var _poll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee45(e, t) {
|
5640
5465
|
var n, l, c, d;
|
5641
|
-
return _regeneratorRuntime().wrap(function
|
5642
|
-
while (1) switch (
|
5466
|
+
return _regeneratorRuntime().wrap(function _callee45$(_context45) {
|
5467
|
+
while (1) switch (_context45.prev = _context45.next) {
|
5643
5468
|
case 0:
|
5644
5469
|
n = {
|
5645
5470
|
authorization: e,
|
5646
5471
|
"content-type": "application/json"
|
5647
5472
|
};
|
5648
|
-
|
5649
|
-
|
5473
|
+
_context45.t0 = "https://api.assemblyai.com/v2/transcript/";
|
5474
|
+
_context45.next = 4;
|
5650
5475
|
return fetch("https://api.assemblyai.com/v2/transcript", {
|
5651
5476
|
method: "POST",
|
5652
5477
|
body: JSON.stringify({
|
@@ -5655,55 +5480,55 @@ var AssemblyAIUtils = /*#__PURE__*/function () {
|
|
5655
5480
|
headers: n
|
5656
5481
|
});
|
5657
5482
|
case 4:
|
5658
|
-
|
5659
|
-
return
|
5483
|
+
_context45.next = 6;
|
5484
|
+
return _context45.sent.json();
|
5660
5485
|
case 6:
|
5661
|
-
|
5662
|
-
l =
|
5486
|
+
_context45.t1 = _context45.sent.id;
|
5487
|
+
l = _context45.t0.concat.call(_context45.t0, _context45.t1);
|
5663
5488
|
case 8:
|
5664
5489
|
if (c) {
|
5665
|
-
|
5490
|
+
_context45.next = 24;
|
5666
5491
|
break;
|
5667
5492
|
}
|
5668
|
-
|
5493
|
+
_context45.next = 11;
|
5669
5494
|
return fetch(l, {
|
5670
5495
|
headers: n
|
5671
5496
|
});
|
5672
5497
|
case 11:
|
5673
|
-
|
5674
|
-
return
|
5498
|
+
_context45.next = 13;
|
5499
|
+
return _context45.sent.json();
|
5675
5500
|
case 13:
|
5676
|
-
d =
|
5501
|
+
d = _context45.sent;
|
5677
5502
|
if (!(d.status === "completed")) {
|
5678
|
-
|
5503
|
+
_context45.next = 18;
|
5679
5504
|
break;
|
5680
5505
|
}
|
5681
5506
|
c = d;
|
5682
|
-
|
5507
|
+
_context45.next = 22;
|
5683
5508
|
break;
|
5684
5509
|
case 18:
|
5685
5510
|
if (!(d.status === "error")) {
|
5686
|
-
|
5511
|
+
_context45.next = 20;
|
5687
5512
|
break;
|
5688
5513
|
}
|
5689
5514
|
throw new Error("Transcription failed: ".concat(d.error));
|
5690
5515
|
case 20:
|
5691
|
-
|
5516
|
+
_context45.next = 22;
|
5692
5517
|
return new Promise(function (h) {
|
5693
5518
|
return setTimeout(h, 3e3);
|
5694
5519
|
});
|
5695
5520
|
case 22:
|
5696
|
-
|
5521
|
+
_context45.next = 8;
|
5697
5522
|
break;
|
5698
5523
|
case 24:
|
5699
|
-
return
|
5524
|
+
return _context45.abrupt("return", c);
|
5700
5525
|
case 25:
|
5701
5526
|
case "end":
|
5702
|
-
return
|
5527
|
+
return _context45.stop();
|
5703
5528
|
}
|
5704
|
-
},
|
5529
|
+
}, _callee45);
|
5705
5530
|
}));
|
5706
|
-
function poll(
|
5531
|
+
function poll(_x76, _x77) {
|
5707
5532
|
return _poll2.apply(this, arguments);
|
5708
5533
|
}
|
5709
5534
|
return poll;
|
@@ -5751,19 +5576,19 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5751
5576
|
_createClass(AssemblyAIAudioIO, [{
|
5752
5577
|
key: "callServiceAPI",
|
5753
5578
|
value: function () {
|
5754
|
-
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5579
|
+
var _callServiceAPI12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(e, t, n) {
|
5755
5580
|
var s;
|
5756
|
-
return _regeneratorRuntime().wrap(function
|
5757
|
-
while (1) switch (
|
5581
|
+
return _regeneratorRuntime().wrap(function _callee46$(_context46) {
|
5582
|
+
while (1) switch (_context46.prev = _context46.next) {
|
5758
5583
|
case 0:
|
5759
5584
|
if ((s = this.requestSettings) != null && s.headers) {
|
5760
|
-
|
5585
|
+
_context46.next = 2;
|
5761
5586
|
break;
|
5762
5587
|
}
|
5763
5588
|
throw new Error("Request settings have not been set up");
|
5764
5589
|
case 2:
|
5765
5590
|
if (n != null && n[0]) {
|
5766
|
-
|
5591
|
+
_context46.next = 4;
|
5767
5592
|
break;
|
5768
5593
|
}
|
5769
5594
|
throw new Error("No file was added");
|
@@ -5771,11 +5596,11 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5771
5596
|
HTTPRequest.request(this, n[0], e, !1);
|
5772
5597
|
case 5:
|
5773
5598
|
case "end":
|
5774
|
-
return
|
5599
|
+
return _context46.stop();
|
5775
5600
|
}
|
5776
|
-
},
|
5601
|
+
}, _callee46, this);
|
5777
5602
|
}));
|
5778
|
-
function callServiceAPI(
|
5603
|
+
function callServiceAPI(_x78, _x79, _x80) {
|
5779
5604
|
return _callServiceAPI12.apply(this, arguments);
|
5780
5605
|
}
|
5781
5606
|
return callServiceAPI;
|
@@ -5783,32 +5608,32 @@ var AssemblyAIAudioIO = /*#__PURE__*/function (_DirectServiceIO6) {
|
|
5783
5608
|
}, {
|
5784
5609
|
key: "extractResultData",
|
5785
5610
|
value: function () {
|
5786
|
-
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5611
|
+
var _extractResultData16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee47(e) {
|
5787
5612
|
var s, o, t;
|
5788
|
-
return _regeneratorRuntime().wrap(function
|
5789
|
-
while (1) switch (
|
5613
|
+
return _regeneratorRuntime().wrap(function _callee47$(_context47) {
|
5614
|
+
while (1) switch (_context47.prev = _context47.next) {
|
5790
5615
|
case 0:
|
5791
5616
|
if (!e.error) {
|
5792
|
-
|
5617
|
+
_context47.next = 2;
|
5793
5618
|
break;
|
5794
5619
|
}
|
5795
5620
|
throw e.error;
|
5796
5621
|
case 2:
|
5797
5622
|
t = (o = (s = this.requestSettings) == null ? void 0 : s.headers) == null ? void 0 : o.Authorization;
|
5798
|
-
|
5623
|
+
_context47.next = 5;
|
5799
5624
|
return AssemblyAIUtils.poll(t, e.upload_url);
|
5800
5625
|
case 5:
|
5801
|
-
|
5802
|
-
return
|
5803
|
-
text:
|
5626
|
+
_context47.t0 = _context47.sent.text;
|
5627
|
+
return _context47.abrupt("return", {
|
5628
|
+
text: _context47.t0
|
5804
5629
|
});
|
5805
5630
|
case 7:
|
5806
5631
|
case "end":
|
5807
|
-
return
|
5632
|
+
return _context47.stop();
|
5808
5633
|
}
|
5809
|
-
},
|
5634
|
+
}, _callee47, this);
|
5810
5635
|
}));
|
5811
|
-
function extractResultData(
|
5636
|
+
function extractResultData(_x81) {
|
5812
5637
|
return _extractResultData16.apply(this, arguments);
|
5813
5638
|
}
|
5814
5639
|
return extractResultData;
|
@@ -5858,13 +5683,13 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5858
5683
|
}, {
|
5859
5684
|
key: "callServiceAPI",
|
5860
5685
|
value: function () {
|
5861
|
-
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5686
|
+
var _callServiceAPI13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee48(e, t) {
|
5862
5687
|
var n;
|
5863
|
-
return _regeneratorRuntime().wrap(function
|
5864
|
-
while (1) switch (
|
5688
|
+
return _regeneratorRuntime().wrap(function _callee48$(_context48) {
|
5689
|
+
while (1) switch (_context48.prev = _context48.next) {
|
5865
5690
|
case 0:
|
5866
5691
|
if (this.requestSettings) {
|
5867
|
-
|
5692
|
+
_context48.next = 2;
|
5868
5693
|
break;
|
5869
5694
|
}
|
5870
5695
|
throw new Error("Request settings have not been set up");
|
@@ -5873,11 +5698,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5873
5698
|
HTTPRequest.request(this, n, e, !1);
|
5874
5699
|
case 4:
|
5875
5700
|
case "end":
|
5876
|
-
return
|
5701
|
+
return _context48.stop();
|
5877
5702
|
}
|
5878
|
-
},
|
5703
|
+
}, _callee48, this);
|
5879
5704
|
}));
|
5880
|
-
function callServiceAPI(
|
5705
|
+
function callServiceAPI(_x82, _x83) {
|
5881
5706
|
return _callServiceAPI13.apply(this, arguments);
|
5882
5707
|
}
|
5883
5708
|
return callServiceAPI;
|
@@ -5885,11 +5710,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5885
5710
|
}, {
|
5886
5711
|
key: "extractResultData",
|
5887
5712
|
value: function () {
|
5888
|
-
var _extractResultData17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5889
|
-
return _regeneratorRuntime().wrap(function
|
5890
|
-
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) {
|
5891
5716
|
case 0:
|
5892
|
-
return
|
5717
|
+
return _context49.abrupt("return", new Promise(function (t) {
|
5893
5718
|
var n = new FileReader();
|
5894
5719
|
n.readAsDataURL(e), n.onload = function (s) {
|
5895
5720
|
t({
|
@@ -5902,11 +5727,11 @@ var _AzureTextToSpeechIO = /*#__PURE__*/function (_AzureSpeechIO) {
|
|
5902
5727
|
}));
|
5903
5728
|
case 1:
|
5904
5729
|
case "end":
|
5905
|
-
return
|
5730
|
+
return _context49.stop();
|
5906
5731
|
}
|
5907
|
-
},
|
5732
|
+
}, _callee49);
|
5908
5733
|
}));
|
5909
|
-
function extractResultData(
|
5734
|
+
function extractResultData(_x84) {
|
5910
5735
|
return _extractResultData17.apply(this, arguments);
|
5911
5736
|
}
|
5912
5737
|
return extractResultData;
|
@@ -5942,19 +5767,19 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5942
5767
|
_createClass(U, [{
|
5943
5768
|
key: "callServiceAPI",
|
5944
5769
|
value: function () {
|
5945
|
-
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5770
|
+
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee50(e, t, n) {
|
5946
5771
|
var s, o;
|
5947
|
-
return _regeneratorRuntime().wrap(function
|
5948
|
-
while (1) switch (
|
5772
|
+
return _regeneratorRuntime().wrap(function _callee50$(_context50) {
|
5773
|
+
while (1) switch (_context50.prev = _context50.next) {
|
5949
5774
|
case 0:
|
5950
5775
|
if ((s = this.requestSettings) != null && s.headers) {
|
5951
|
-
|
5776
|
+
_context50.next = 2;
|
5952
5777
|
break;
|
5953
5778
|
}
|
5954
5779
|
throw new Error("Request settings have not been set up");
|
5955
5780
|
case 2:
|
5956
5781
|
if (n != null && n[0]) {
|
5957
|
-
|
5782
|
+
_context50.next = 4;
|
5958
5783
|
break;
|
5959
5784
|
}
|
5960
5785
|
throw new Error("No file was added");
|
@@ -5962,11 +5787,11 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5962
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);
|
5963
5788
|
case 5:
|
5964
5789
|
case "end":
|
5965
|
-
return
|
5790
|
+
return _context50.stop();
|
5966
5791
|
}
|
5967
|
-
},
|
5792
|
+
}, _callee50, this);
|
5968
5793
|
}));
|
5969
|
-
function callServiceAPI(
|
5794
|
+
function callServiceAPI(_x85, _x86, _x87) {
|
5970
5795
|
return _callServiceAPI14.apply(this, arguments);
|
5971
5796
|
}
|
5972
5797
|
return callServiceAPI;
|
@@ -5974,26 +5799,26 @@ var _AzureSpeechToTextIO = /*#__PURE__*/function (_AzureSpeechIO2) {
|
|
5974
5799
|
}, {
|
5975
5800
|
key: "extractResultData",
|
5976
5801
|
value: function () {
|
5977
|
-
var _extractResultData18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5978
|
-
return _regeneratorRuntime().wrap(function
|
5979
|
-
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) {
|
5980
5805
|
case 0:
|
5981
5806
|
if (!e.error) {
|
5982
|
-
|
5807
|
+
_context51.next = 2;
|
5983
5808
|
break;
|
5984
5809
|
}
|
5985
5810
|
throw e.error;
|
5986
5811
|
case 2:
|
5987
|
-
return
|
5812
|
+
return _context51.abrupt("return", {
|
5988
5813
|
text: e.DisplayText || ""
|
5989
5814
|
});
|
5990
5815
|
case 3:
|
5991
5816
|
case "end":
|
5992
|
-
return
|
5817
|
+
return _context51.stop();
|
5993
5818
|
}
|
5994
|
-
},
|
5819
|
+
}, _callee51);
|
5995
5820
|
}));
|
5996
|
-
function extractResultData(
|
5821
|
+
function extractResultData(_x88) {
|
5997
5822
|
return _extractResultData18.apply(this, arguments);
|
5998
5823
|
}
|
5999
5824
|
return extractResultData;
|
@@ -6036,13 +5861,13 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6036
5861
|
}, {
|
6037
5862
|
key: "callServiceAPI",
|
6038
5863
|
value: function () {
|
6039
|
-
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5864
|
+
var _callServiceAPI15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee52(e, t) {
|
6040
5865
|
var n;
|
6041
|
-
return _regeneratorRuntime().wrap(function
|
6042
|
-
while (1) switch (
|
5866
|
+
return _regeneratorRuntime().wrap(function _callee52$(_context52) {
|
5867
|
+
while (1) switch (_context52.prev = _context52.next) {
|
6043
5868
|
case 0:
|
6044
5869
|
if (this.requestSettings) {
|
6045
|
-
|
5870
|
+
_context52.next = 2;
|
6046
5871
|
break;
|
6047
5872
|
}
|
6048
5873
|
throw new Error("Request settings have not been set up");
|
@@ -6051,11 +5876,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6051
5876
|
HTTPRequest.request(this, n, e);
|
6052
5877
|
case 4:
|
6053
5878
|
case "end":
|
6054
|
-
return
|
5879
|
+
return _context52.stop();
|
6055
5880
|
}
|
6056
|
-
},
|
5881
|
+
}, _callee52, this);
|
6057
5882
|
}));
|
6058
|
-
function callServiceAPI(
|
5883
|
+
function callServiceAPI(_x89, _x90) {
|
6059
5884
|
return _callServiceAPI15.apply(this, arguments);
|
6060
5885
|
}
|
6061
5886
|
return callServiceAPI;
|
@@ -6063,27 +5888,27 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6063
5888
|
}, {
|
6064
5889
|
key: "extractResultData",
|
6065
5890
|
value: function () {
|
6066
|
-
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
5891
|
+
var _extractResultData19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee53(e) {
|
6067
5892
|
var t;
|
6068
|
-
return _regeneratorRuntime().wrap(function
|
6069
|
-
while (1) switch (
|
5893
|
+
return _regeneratorRuntime().wrap(function _callee53$(_context53) {
|
5894
|
+
while (1) switch (_context53.prev = _context53.next) {
|
6070
5895
|
case 0:
|
6071
5896
|
if (!Array.isArray(e)) {
|
6072
|
-
|
5897
|
+
_context53.next = 2;
|
6073
5898
|
break;
|
6074
5899
|
}
|
6075
|
-
return
|
5900
|
+
return _context53.abrupt("return", {
|
6076
5901
|
text: ((t = e[0].translations) == null ? void 0 : t[0].text) || ""
|
6077
5902
|
});
|
6078
5903
|
case 2:
|
6079
5904
|
throw e.error;
|
6080
5905
|
case 3:
|
6081
5906
|
case "end":
|
6082
|
-
return
|
5907
|
+
return _context53.stop();
|
6083
5908
|
}
|
6084
|
-
},
|
5909
|
+
}, _callee53);
|
6085
5910
|
}));
|
6086
|
-
function extractResultData(
|
5911
|
+
function extractResultData(_x91) {
|
6087
5912
|
return _extractResultData19.apply(this, arguments);
|
6088
5913
|
}
|
6089
5914
|
return extractResultData;
|
@@ -6092,11 +5917,11 @@ var AzureTranslationIO = /*#__PURE__*/function (_DirectServiceIO8) {
|
|
6092
5917
|
return AzureTranslationIO;
|
6093
5918
|
}(DirectServiceIO);
|
6094
5919
|
var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
6095
|
-
_inherits(
|
6096
|
-
var _super30 = _createSuper(
|
6097
|
-
function
|
5920
|
+
_inherits(A, _DirectServiceIO9);
|
5921
|
+
var _super30 = _createSuper(A);
|
5922
|
+
function A(e) {
|
6098
5923
|
var _this23;
|
6099
|
-
_classCallCheck(this,
|
5924
|
+
_classCallCheck(this, A);
|
6100
5925
|
var l;
|
6101
5926
|
var t = e.directConnection,
|
6102
5927
|
n = e.textInput,
|
@@ -6120,16 +5945,16 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6120
5945
|
}
|
6121
5946
|
};
|
6122
5947
|
}
|
6123
|
-
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage =
|
5948
|
+
_typeof(a) == "object" && Object.assign(_this23.rawBody, a), _this23.canSendMessage = A.canFileSendMessage;
|
6124
5949
|
return _this23;
|
6125
5950
|
}
|
6126
|
-
_createClass(
|
5951
|
+
_createClass(A, [{
|
6127
5952
|
key: "preprocessBody",
|
6128
5953
|
value: function preprocessBody(e, t) {
|
6129
5954
|
var n = JSON.parse(JSON.stringify(e));
|
6130
5955
|
if (t && t !== "") {
|
6131
|
-
var
|
6132
|
-
n.prompt =
|
5956
|
+
var s = t.substring(0, this._maxCharLength);
|
5957
|
+
n.prompt = s;
|
6133
5958
|
}
|
6134
5959
|
return n;
|
6135
5960
|
}
|
@@ -6141,50 +5966,50 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6141
5966
|
var s;
|
6142
5967
|
var o = (l = (a = t[t.length - 1]) == null ? void 0 : a.text) == null ? void 0 : l.trim();
|
6143
5968
|
if (n[1] || o && o !== "") {
|
6144
|
-
this.url =
|
5969
|
+
this.url = A.IMAGE_EDIT_URL;
|
6145
5970
|
var c = this.preprocessBody(this.rawBody, o);
|
6146
|
-
s =
|
6147
|
-
} 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]);
|
6148
5973
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, s, e), !1);
|
6149
5974
|
}
|
6150
5975
|
}, {
|
6151
5976
|
key: "callServiceAPI",
|
6152
5977
|
value: function () {
|
6153
|
-
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6154
|
-
var s,
|
6155
|
-
return _regeneratorRuntime().wrap(function
|
6156
|
-
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) {
|
6157
5982
|
case 0:
|
6158
5983
|
if ((s = this.requestSettings) != null && s.headers) {
|
6159
|
-
|
5984
|
+
_context54.next = 2;
|
6160
5985
|
break;
|
6161
5986
|
}
|
6162
5987
|
throw new Error("Request settings have not been set up");
|
6163
5988
|
case 2:
|
6164
5989
|
if (!(n != null && n[0])) {
|
6165
|
-
|
5990
|
+
_context54.next = 6;
|
6166
5991
|
break;
|
6167
5992
|
}
|
6168
5993
|
this.callApiWithImage(e, t, n);
|
6169
|
-
|
5994
|
+
_context54.next = 11;
|
6170
5995
|
break;
|
6171
5996
|
case 6:
|
6172
5997
|
if (this.requestSettings) {
|
6173
|
-
|
5998
|
+
_context54.next = 8;
|
6174
5999
|
break;
|
6175
6000
|
}
|
6176
6001
|
throw new Error("Request settings have not been set up");
|
6177
6002
|
case 8:
|
6178
|
-
this.url =
|
6179
|
-
|
6180
|
-
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);
|
6181
6006
|
case 11:
|
6182
6007
|
case "end":
|
6183
|
-
return
|
6008
|
+
return _context54.stop();
|
6184
6009
|
}
|
6185
|
-
},
|
6010
|
+
}, _callee54, this);
|
6186
6011
|
}));
|
6187
|
-
function callServiceAPI(
|
6012
|
+
function callServiceAPI(_x92, _x93, _x94) {
|
6188
6013
|
return _callServiceAPI16.apply(this, arguments);
|
6189
6014
|
}
|
6190
6015
|
return callServiceAPI;
|
@@ -6192,17 +6017,17 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6192
6017
|
}, {
|
6193
6018
|
key: "extractResultData",
|
6194
6019
|
value: function () {
|
6195
|
-
var _extractResultData20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6196
|
-
return _regeneratorRuntime().wrap(function
|
6197
|
-
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) {
|
6198
6023
|
case 0:
|
6199
6024
|
if (!e.error) {
|
6200
|
-
|
6025
|
+
_context55.next = 2;
|
6201
6026
|
break;
|
6202
6027
|
}
|
6203
6028
|
throw e.error.message;
|
6204
6029
|
case 2:
|
6205
|
-
return
|
6030
|
+
return _context55.abrupt("return", {
|
6206
6031
|
files: e.data.map(function (n) {
|
6207
6032
|
return n.url ? {
|
6208
6033
|
src: n.url,
|
@@ -6215,11 +6040,11 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6215
6040
|
});
|
6216
6041
|
case 3:
|
6217
6042
|
case "end":
|
6218
|
-
return
|
6043
|
+
return _context55.stop();
|
6219
6044
|
}
|
6220
|
-
},
|
6045
|
+
}, _callee55);
|
6221
6046
|
}));
|
6222
|
-
function extractResultData(
|
6047
|
+
function extractResultData(_x95) {
|
6223
6048
|
return _extractResultData20.apply(this, arguments);
|
6224
6049
|
}
|
6225
6050
|
return extractResultData;
|
@@ -6246,34 +6071,34 @@ var _OpenAIImagesIO = /*#__PURE__*/function (_DirectServiceIO9) {
|
|
6246
6071
|
}), s;
|
6247
6072
|
}
|
6248
6073
|
}]);
|
6249
|
-
return
|
6074
|
+
return A;
|
6250
6075
|
}(DirectServiceIO);
|
6251
6076
|
_OpenAIImagesIO.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
6252
6077
|
_OpenAIImagesIO.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
6253
6078
|
_OpenAIImagesIO.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
6254
6079
|
var OpenAIImagesIO = _OpenAIImagesIO;
|
6255
6080
|
var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
6256
|
-
_inherits(
|
6257
|
-
var _super31 = _createSuper(
|
6258
|
-
function
|
6081
|
+
_inherits(M, _DirectServiceIO10);
|
6082
|
+
var _super31 = _createSuper(M);
|
6083
|
+
function M(e) {
|
6259
6084
|
var _l$model2;
|
6260
6085
|
var _this24;
|
6261
|
-
_classCallCheck(this,
|
6086
|
+
_classCallCheck(this, M);
|
6262
6087
|
var a, l;
|
6263
6088
|
var t = e.directConnection,
|
6264
6089
|
n = e.textInput,
|
6265
6090
|
s = t == null ? void 0 : t.openAI;
|
6266
6091
|
_this24 = _super31.call(this, e, OpenAIUtils.buildKeyVerificationDetails(), OpenAIUtils.buildHeaders, s, {
|
6267
6092
|
audio: {}
|
6268
|
-
}), _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);
|
6269
6094
|
var o = (a = t == null ? void 0 : t.openAI) == null ? void 0 : a.audio;
|
6270
|
-
_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;
|
6271
6096
|
return _this24;
|
6272
6097
|
}
|
6273
|
-
_createClass(
|
6098
|
+
_createClass(M, [{
|
6274
6099
|
key: "processConfig",
|
6275
6100
|
value: function processConfig(e) {
|
6276
|
-
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);
|
6277
6102
|
}
|
6278
6103
|
}, {
|
6279
6104
|
key: "preprocessBody",
|
@@ -6291,33 +6116,33 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6291
6116
|
}, {
|
6292
6117
|
key: "callServiceAPI",
|
6293
6118
|
value: function () {
|
6294
|
-
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6119
|
+
var _callServiceAPI17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee56(e, t, n) {
|
6295
6120
|
var a, s, o;
|
6296
|
-
return _regeneratorRuntime().wrap(function
|
6297
|
-
while (1) switch (
|
6121
|
+
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
6122
|
+
while (1) switch (_context56.prev = _context56.next) {
|
6298
6123
|
case 0:
|
6299
6124
|
if ((a = this.requestSettings) != null && a.headers) {
|
6300
|
-
|
6125
|
+
_context56.next = 2;
|
6301
6126
|
break;
|
6302
6127
|
}
|
6303
6128
|
throw new Error("Request settings have not been set up");
|
6304
6129
|
case 2:
|
6305
6130
|
if (n != null && n[0]) {
|
6306
|
-
|
6131
|
+
_context56.next = 4;
|
6307
6132
|
break;
|
6308
6133
|
}
|
6309
6134
|
throw new Error("No file was added");
|
6310
6135
|
case 4:
|
6311
6136
|
this.url = this.requestSettings.url || this._service_url;
|
6312
|
-
s = this.preprocessBody(this.rawBody, t, n), o =
|
6137
|
+
s = this.preprocessBody(this.rawBody, t, n), o = M.createFormDataBody(s, n[0]);
|
6313
6138
|
RequestUtils.temporarilyRemoveHeader(this.requestSettings, HTTPRequest.request.bind(this, this, o, e), !1);
|
6314
6139
|
case 7:
|
6315
6140
|
case "end":
|
6316
|
-
return
|
6141
|
+
return _context56.stop();
|
6317
6142
|
}
|
6318
|
-
},
|
6143
|
+
}, _callee56, this);
|
6319
6144
|
}));
|
6320
|
-
function callServiceAPI(
|
6145
|
+
function callServiceAPI(_x96, _x97, _x98) {
|
6321
6146
|
return _callServiceAPI17.apply(this, arguments);
|
6322
6147
|
}
|
6323
6148
|
return callServiceAPI;
|
@@ -6325,26 +6150,26 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6325
6150
|
}, {
|
6326
6151
|
key: "extractResultData",
|
6327
6152
|
value: function () {
|
6328
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6329
|
-
return _regeneratorRuntime().wrap(function
|
6330
|
-
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) {
|
6331
6156
|
case 0:
|
6332
6157
|
if (!e.error) {
|
6333
|
-
|
6158
|
+
_context57.next = 2;
|
6334
6159
|
break;
|
6335
6160
|
}
|
6336
6161
|
throw e.error.message;
|
6337
6162
|
case 2:
|
6338
|
-
return
|
6163
|
+
return _context57.abrupt("return", {
|
6339
6164
|
text: e.text
|
6340
6165
|
});
|
6341
6166
|
case 3:
|
6342
6167
|
case "end":
|
6343
|
-
return
|
6168
|
+
return _context57.stop();
|
6344
6169
|
}
|
6345
|
-
},
|
6170
|
+
}, _callee57);
|
6346
6171
|
}));
|
6347
|
-
function extractResultData(
|
6172
|
+
function extractResultData(_x99) {
|
6348
6173
|
return _extractResultData21.apply(this, arguments);
|
6349
6174
|
}
|
6350
6175
|
return extractResultData;
|
@@ -6368,7 +6193,7 @@ var _OpenAIAudioIO = /*#__PURE__*/function (_DirectServiceIO10) {
|
|
6368
6193
|
}), n;
|
6369
6194
|
}
|
6370
6195
|
}]);
|
6371
|
-
return
|
6196
|
+
return M;
|
6372
6197
|
}(DirectServiceIO);
|
6373
6198
|
_OpenAIAudioIO.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
6374
6199
|
_OpenAIAudioIO.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
@@ -6410,13 +6235,13 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6410
6235
|
}, {
|
6411
6236
|
key: "callServiceAPI",
|
6412
6237
|
value: function () {
|
6413
|
-
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6238
|
+
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee58(e, t) {
|
6414
6239
|
var n;
|
6415
|
-
return _regeneratorRuntime().wrap(function
|
6416
|
-
while (1) switch (
|
6240
|
+
return _regeneratorRuntime().wrap(function _callee58$(_context58) {
|
6241
|
+
while (1) switch (_context58.prev = _context58.next) {
|
6417
6242
|
case 0:
|
6418
6243
|
if (this.requestSettings) {
|
6419
|
-
|
6244
|
+
_context58.next = 2;
|
6420
6245
|
break;
|
6421
6246
|
}
|
6422
6247
|
throw new Error("Request settings have not been set up");
|
@@ -6425,11 +6250,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6425
6250
|
this.deepChat.stream || n.stream ? (n.stream = !0, Stream.request(this, n, e)) : HTTPRequest.request(this, n, e);
|
6426
6251
|
case 4:
|
6427
6252
|
case "end":
|
6428
|
-
return
|
6253
|
+
return _context58.stop();
|
6429
6254
|
}
|
6430
|
-
},
|
6255
|
+
}, _callee58, this);
|
6431
6256
|
}));
|
6432
|
-
function callServiceAPI(
|
6257
|
+
function callServiceAPI(_x100, _x101) {
|
6433
6258
|
return _callServiceAPI18.apply(this, arguments);
|
6434
6259
|
}
|
6435
6260
|
return callServiceAPI;
|
@@ -6437,17 +6262,17 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6437
6262
|
}, {
|
6438
6263
|
key: "extractResultData",
|
6439
6264
|
value: function () {
|
6440
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6441
|
-
return _regeneratorRuntime().wrap(function
|
6442
|
-
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) {
|
6443
6268
|
case 0:
|
6444
6269
|
if (!e.error) {
|
6445
|
-
|
6270
|
+
_context59.next = 2;
|
6446
6271
|
break;
|
6447
6272
|
}
|
6448
6273
|
throw e.error.message;
|
6449
6274
|
case 2:
|
6450
|
-
return
|
6275
|
+
return _context59.abrupt("return", e.choices[0].delta ? {
|
6451
6276
|
text: e.choices[0].delta.content || ""
|
6452
6277
|
} : e.choices[0].message ? {
|
6453
6278
|
text: e.choices[0].message.content
|
@@ -6456,11 +6281,11 @@ var OpenAIChatIO = /*#__PURE__*/function (_DirectServiceIO11) {
|
|
6456
6281
|
});
|
6457
6282
|
case 3:
|
6458
6283
|
case "end":
|
6459
|
-
return
|
6284
|
+
return _context59.stop();
|
6460
6285
|
}
|
6461
|
-
},
|
6286
|
+
}, _callee59);
|
6462
6287
|
}));
|
6463
|
-
function extractResultData(
|
6288
|
+
function extractResultData(_x102) {
|
6464
6289
|
return _extractResultData22.apply(this, arguments);
|
6465
6290
|
}
|
6466
6291
|
return extractResultData;
|
@@ -6508,13 +6333,13 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6508
6333
|
}, {
|
6509
6334
|
key: "callServiceAPI",
|
6510
6335
|
value: function () {
|
6511
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6336
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee60(e, t) {
|
6512
6337
|
var n;
|
6513
|
-
return _regeneratorRuntime().wrap(function
|
6514
|
-
while (1) switch (
|
6338
|
+
return _regeneratorRuntime().wrap(function _callee60$(_context60) {
|
6339
|
+
while (1) switch (_context60.prev = _context60.next) {
|
6515
6340
|
case 0:
|
6516
6341
|
if (this.requestSettings) {
|
6517
|
-
|
6342
|
+
_context60.next = 2;
|
6518
6343
|
break;
|
6519
6344
|
}
|
6520
6345
|
throw new Error("Request settings have not been set up");
|
@@ -6523,11 +6348,11 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6523
6348
|
HTTPRequest.request(this, n, e);
|
6524
6349
|
case 4:
|
6525
6350
|
case "end":
|
6526
|
-
return
|
6351
|
+
return _context60.stop();
|
6527
6352
|
}
|
6528
|
-
},
|
6353
|
+
}, _callee60, this);
|
6529
6354
|
}));
|
6530
|
-
function callServiceAPI(
|
6355
|
+
function callServiceAPI(_x103, _x104) {
|
6531
6356
|
return _callServiceAPI19.apply(this, arguments);
|
6532
6357
|
}
|
6533
6358
|
return callServiceAPI;
|
@@ -6535,26 +6360,26 @@ var CohereChatIO = /*#__PURE__*/function (_CohereIO3) {
|
|
6535
6360
|
}, {
|
6536
6361
|
key: "extractResultData",
|
6537
6362
|
value: function () {
|
6538
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6539
|
-
return _regeneratorRuntime().wrap(function
|
6540
|
-
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) {
|
6541
6366
|
case 0:
|
6542
6367
|
if (!e.message) {
|
6543
|
-
|
6368
|
+
_context61.next = 2;
|
6544
6369
|
break;
|
6545
6370
|
}
|
6546
6371
|
throw e.message;
|
6547
6372
|
case 2:
|
6548
|
-
return
|
6373
|
+
return _context61.abrupt("return", {
|
6549
6374
|
text: e.text
|
6550
6375
|
});
|
6551
6376
|
case 3:
|
6552
6377
|
case "end":
|
6553
|
-
return
|
6378
|
+
return _context61.stop();
|
6554
6379
|
}
|
6555
|
-
},
|
6380
|
+
}, _callee61);
|
6556
6381
|
}));
|
6557
|
-
function extractResultData(
|
6382
|
+
function extractResultData(_x105) {
|
6558
6383
|
return _extractResultData23.apply(this, arguments);
|
6559
6384
|
}
|
6560
6385
|
return extractResultData;
|
@@ -6721,11 +6546,11 @@ var _TextToSpeech = /*#__PURE__*/function () {
|
|
6721
6546
|
var n = {};
|
6722
6547
|
setTimeout(function () {
|
6723
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)) {
|
6724
|
-
var
|
6549
|
+
var s = window.speechSynthesis.getVoices().find(function (o) {
|
6725
6550
|
var a;
|
6726
6551
|
return o.name.toLocaleLowerCase() === ((a = e.voiceName) == null ? void 0 : a.toLocaleLowerCase());
|
6727
6552
|
});
|
6728
|
-
|
6553
|
+
s && (n.voice = s);
|
6729
6554
|
}
|
6730
6555
|
t(n);
|
6731
6556
|
}, $.LOAD_VOICES_MS);
|
@@ -6767,9 +6592,9 @@ var MessageStyleUtils = /*#__PURE__*/function () {
|
|
6767
6592
|
key: "applyCustomStylesToElements",
|
6768
6593
|
value: function applyCustomStylesToElements(e, t, n) {
|
6769
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)) {
|
6770
|
-
var
|
6771
|
-
|
6772
|
-
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);
|
6773
6598
|
}
|
6774
6599
|
}
|
6775
6600
|
}, {
|
@@ -6912,24 +6737,24 @@ var FileMessages = /*#__PURE__*/function () {
|
|
6912
6737
|
}, {
|
6913
6738
|
key: "addNewImageMessage",
|
6914
6739
|
value: function () {
|
6915
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
6740
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee62(e, t, n) {
|
6916
6741
|
var s,
|
6917
6742
|
o,
|
6918
6743
|
a,
|
6919
|
-
|
6920
|
-
return _regeneratorRuntime().wrap(function
|
6921
|
-
while (1) switch (
|
6744
|
+
_args62 = arguments;
|
6745
|
+
return _regeneratorRuntime().wrap(function _callee62$(_context62) {
|
6746
|
+
while (1) switch (_context62.prev = _context62.next) {
|
6922
6747
|
case 0:
|
6923
|
-
s =
|
6748
|
+
s = _args62.length > 3 && _args62[3] !== undefined ? _args62[3] : !1;
|
6924
6749
|
o = FileMessages.createImage(t, e.elementRef), a = e.createNewMessageElement("", n);
|
6925
6750
|
a.bubbleElement.appendChild(o), a.bubbleElement.classList.add("image-message"), e.elementRef.appendChild(a.outerContainer), FileMessageUtils.updateMessages(e, a, t, "image", n, s);
|
6926
6751
|
case 3:
|
6927
6752
|
case "end":
|
6928
|
-
return
|
6753
|
+
return _context62.stop();
|
6929
6754
|
}
|
6930
|
-
},
|
6755
|
+
}, _callee62);
|
6931
6756
|
}));
|
6932
|
-
function addNewImageMessage(
|
6757
|
+
function addNewImageMessage(_x106, _x107, _x108) {
|
6933
6758
|
return _addNewImageMessage.apply(this, arguments);
|
6934
6759
|
}
|
6935
6760
|
return addNewImageMessage;
|
@@ -7265,27 +7090,27 @@ var Messages = /*#__PURE__*/function () {
|
|
7265
7090
|
}, {
|
7266
7091
|
key: "addMultipleFiles",
|
7267
7092
|
value: function () {
|
7268
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
7093
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee63(e) {
|
7269
7094
|
var _this31 = this;
|
7270
|
-
return _regeneratorRuntime().wrap(function
|
7271
|
-
while (1) switch (
|
7095
|
+
return _regeneratorRuntime().wrap(function _callee63$(_context63) {
|
7096
|
+
while (1) switch (_context63.prev = _context63.next) {
|
7272
7097
|
case 0:
|
7273
|
-
return
|
7098
|
+
return _context63.abrupt("return", Promise.all((e || []).map(function (t) {
|
7274
7099
|
return new Promise(function (n) {
|
7275
7100
|
if (!t.type || t.type === "any") {
|
7276
|
-
var
|
7101
|
+
var s = t.file.name || FileMessageUtils.DEFAULT_FILE_NAME;
|
7277
7102
|
_this31.addNewMessage({
|
7278
7103
|
files: [{
|
7279
|
-
name:
|
7104
|
+
name: s,
|
7280
7105
|
type: "any"
|
7281
7106
|
}]
|
7282
7107
|
}, !1, !0), n(!0);
|
7283
7108
|
} else {
|
7284
|
-
var
|
7285
|
-
|
7109
|
+
var _s = new FileReader();
|
7110
|
+
_s.readAsDataURL(t.file), _s.onload = function () {
|
7286
7111
|
_this31.addNewMessage({
|
7287
7112
|
files: [{
|
7288
|
-
src:
|
7113
|
+
src: _s.result,
|
7289
7114
|
type: t.type
|
7290
7115
|
}]
|
7291
7116
|
}, !1, !0), n(!0);
|
@@ -7295,15 +7120,15 @@ var Messages = /*#__PURE__*/function () {
|
|
7295
7120
|
})));
|
7296
7121
|
case 1:
|
7297
7122
|
case "end":
|
7298
|
-
return
|
7123
|
+
return _context63.stop();
|
7299
7124
|
}
|
7300
|
-
},
|
7125
|
+
}, _callee63);
|
7301
7126
|
}));
|
7302
|
-
function addMultipleFiles(
|
7127
|
+
function addMultipleFiles(_x109) {
|
7303
7128
|
return _addMultipleFiles.apply(this, arguments);
|
7304
7129
|
}
|
7305
7130
|
return addMultipleFiles;
|
7306
|
-
}()
|
7131
|
+
}()
|
7307
7132
|
}, {
|
7308
7133
|
key: "clearMessages",
|
7309
7134
|
value: function clearMessages(e) {
|
@@ -7312,7 +7137,7 @@ var Messages = /*#__PURE__*/function () {
|
|
7312
7137
|
this._messageElementRefs.forEach(function (o) {
|
7313
7138
|
var a = o.bubbleElement.classList;
|
7314
7139
|
a.contains("loading-message-text") || a.contains("streamed-message") ? t.push(o) : o.outerContainer.remove();
|
7315
|
-
}), 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);
|
7316
7141
|
}
|
7317
7142
|
// this is mostly used for enabling highlight.js to highlight code if it is downloads later
|
7318
7143
|
}, {
|
@@ -7373,10 +7198,10 @@ var Messages = /*#__PURE__*/function () {
|
|
7373
7198
|
return Messages;
|
7374
7199
|
}();
|
7375
7200
|
var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
7376
|
-
function
|
7377
|
-
_classCallCheck(this,
|
7201
|
+
function E() {
|
7202
|
+
_classCallCheck(this, E);
|
7378
7203
|
}
|
7379
|
-
_createClass(
|
7204
|
+
_createClass(E, null, [{
|
7380
7205
|
key: "adjustInputPadding",
|
7381
7206
|
value: function adjustInputPadding(e, t) {
|
7382
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");
|
@@ -7384,7 +7209,7 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7384
7209
|
}, {
|
7385
7210
|
key: "adjustForOutsideButton",
|
7386
7211
|
value: function adjustForOutsideButton(e, t, n) {
|
7387
|
-
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));
|
7388
7213
|
}
|
7389
7214
|
// when submit is the only button
|
7390
7215
|
// when submit button is outside by itself - we increase the height for a better look
|
@@ -7392,10 +7217,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7392
7217
|
key: "adjustOutsideSubmit",
|
7393
7218
|
value: function adjustOutsideSubmit(e, t, n) {
|
7394
7219
|
if (!(n["inside-left"].length > 0 || n["inside-right"].length > 0)) {
|
7395
|
-
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) {
|
7396
7221
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
7397
7222
|
});
|
7398
|
-
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) {
|
7399
7224
|
return s.button.elementRef.classList.add("submit-button-enlarged");
|
7400
7225
|
});
|
7401
7226
|
}
|
@@ -7403,10 +7228,10 @@ var _InputButtonStyleAdjustments = /*#__PURE__*/function () {
|
|
7403
7228
|
}, {
|
7404
7229
|
key: "set",
|
7405
7230
|
value: function set(e, t, n, s) {
|
7406
|
-
!!
|
7231
|
+
!!E.adjustOutsideSubmit(t, n, s) || E.adjustForOutsideButton(t, n, s), E.adjustInputPadding(e, s);
|
7407
7232
|
}
|
7408
7233
|
}]);
|
7409
|
-
return
|
7234
|
+
return E;
|
7410
7235
|
}();
|
7411
7236
|
_InputButtonStyleAdjustments.INPUT_OUTSIDE_LEFT_ADJUSTMENT_CLASS = "text-input-container-left-adjustment";
|
7412
7237
|
_InputButtonStyleAdjustments.INPUT_OUTSIDE_RIGHT_ADJUSTMENT_CLASS = "text-input-container-right-adjustment";
|
@@ -7570,8 +7395,8 @@ var InputButton = /*#__PURE__*/function () {
|
|
7570
7395
|
value: function unsetCustomStateStyles(e) {
|
7571
7396
|
if (this._customStyles) for (var t = 0; t < e.length; t += 1) {
|
7572
7397
|
var n = e[t],
|
7573
|
-
|
7574
|
-
|
7398
|
+
s = n && this._customStyles[n];
|
7399
|
+
s && ButtonCSS.unsetActionCSS(this.elementRef, s);
|
7575
7400
|
}
|
7576
7401
|
}
|
7577
7402
|
}, {
|
@@ -7935,14 +7760,14 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
7935
7760
|
key: "addAttachmentBasedOnType",
|
7936
7761
|
value: function addAttachmentBasedOnType(e, t, n) {
|
7937
7762
|
if (e.type.startsWith("image")) {
|
7938
|
-
var
|
7939
|
-
this.addFileAttachment(e, "image",
|
7763
|
+
var s = FileAttachmentsType.createImageAttachment(t);
|
7764
|
+
this.addFileAttachment(e, "image", s, n);
|
7940
7765
|
} else if (e.type.startsWith("audio")) {
|
7941
|
-
var
|
7942
|
-
this.addFileAttachment(e, "audio",
|
7766
|
+
var _s2 = AudioFileAttachmentType.createAudioAttachment(t);
|
7767
|
+
this.addFileAttachment(e, "audio", _s2, n);
|
7943
7768
|
} else {
|
7944
|
-
var
|
7945
|
-
this.addFileAttachment(e, "any",
|
7769
|
+
var _s3 = FileAttachmentsType.createAnyFileAttachment(e.name);
|
7770
|
+
this.addFileAttachment(e, "any", _s3, n);
|
7946
7771
|
}
|
7947
7772
|
}
|
7948
7773
|
}, {
|
@@ -8004,15 +7829,15 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
8004
7829
|
value: function isFileTypeValid(e, t) {
|
8005
7830
|
if (t === "") return !0;
|
8006
7831
|
var n = t.split(",");
|
8007
|
-
for (var
|
8008
|
-
var
|
8009
|
-
if (e.type ===
|
8010
|
-
if (
|
8011
|
-
var
|
8012
|
-
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;
|
8013
7838
|
} else {
|
8014
|
-
if (e.name.endsWith(
|
8015
|
-
if (
|
7839
|
+
if (e.name.endsWith(o)) return !0;
|
7840
|
+
if (o.endsWith("/*") && e.type.startsWith(o.slice(0, -2))) return !0;
|
8016
7841
|
}
|
8017
7842
|
}
|
8018
7843
|
return !1;
|
@@ -8045,18 +7870,18 @@ var FileAttachmentsType = /*#__PURE__*/function () {
|
|
8045
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>",
|
8046
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>",
|
8047
7872
|
_AudioFileAttachmentType = /*#__PURE__*/function (_FileAttachmentsType) {
|
8048
|
-
_inherits(
|
8049
|
-
var _super35 = _createSuper(
|
8050
|
-
function
|
8051
|
-
_classCallCheck(this,
|
7873
|
+
_inherits(k, _FileAttachmentsType);
|
7874
|
+
var _super35 = _createSuper(k);
|
7875
|
+
function k(e, t, n) {
|
7876
|
+
_classCallCheck(this, k);
|
8052
7877
|
return _super35.call(this, e, t, n);
|
8053
7878
|
}
|
8054
|
-
_createClass(
|
7879
|
+
_createClass(k, [{
|
8055
7880
|
key: "createTimer",
|
8056
7881
|
value: function createTimer(e, t) {
|
8057
7882
|
var _this37 = this;
|
8058
7883
|
var n = 0;
|
8059
|
-
var s = t !== void 0 && t <
|
7884
|
+
var s = t !== void 0 && t < k.TIMER_LIMIT_S ? t : k.TIMER_LIMIT_S;
|
8060
7885
|
return setInterval(function () {
|
8061
7886
|
var l;
|
8062
7887
|
n += 1, n === s && ((l = _this37.stopPlaceholderCallback) == null || l.call(_this37), _this37.clearTimer()), n === 600 && e.classList.add("audio-placeholder-text-4-digits");
|
@@ -8068,7 +7893,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8068
7893
|
}, {
|
8069
7894
|
key: "createPlaceholderAudioAttachment",
|
8070
7895
|
value: function createPlaceholderAudioAttachment(e) {
|
8071
|
-
var t =
|
7896
|
+
var t = k.createAudioContainer(),
|
8072
7897
|
n = document.createElement("div");
|
8073
7898
|
n.classList.add("audio-placeholder-text-3-digits");
|
8074
7899
|
var s = document.createElement("div");
|
@@ -8105,7 +7930,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8105
7930
|
key: "completePlaceholderAttachment",
|
8106
7931
|
value: function completePlaceholderAttachment(e, t) {
|
8107
7932
|
var n = this._activePlaceholderAttachment;
|
8108
|
-
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());
|
8109
7934
|
}
|
8110
7935
|
}, {
|
8111
7936
|
key: "removePlaceholderAttachment",
|
@@ -8145,8 +7970,8 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8145
7970
|
}, {
|
8146
7971
|
key: "createAudioAttachment",
|
8147
7972
|
value: function createAudioAttachment(e) {
|
8148
|
-
var t =
|
8149
|
-
return
|
7973
|
+
var t = k.createAudioContainer();
|
7974
|
+
return k.addAudioElements(t, e), t;
|
8150
7975
|
}
|
8151
7976
|
}, {
|
8152
7977
|
key: "stopAttachmentPlayback",
|
@@ -8155,7 +7980,7 @@ var PLAY_ICON_STRING = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox
|
|
8155
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();
|
8156
7981
|
}
|
8157
7982
|
}]);
|
8158
|
-
return
|
7983
|
+
return k;
|
8159
7984
|
}(FileAttachmentsType);
|
8160
7985
|
_AudioFileAttachmentType.TIMER_LIMIT_S = 5999;
|
8161
7986
|
var AudioFileAttachmentType = _AudioFileAttachmentType;
|
@@ -8209,33 +8034,33 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8209
8034
|
}, {
|
8210
8035
|
key: "completePlaceholders",
|
8211
8036
|
value: function () {
|
8212
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8213
|
-
return _regeneratorRuntime().wrap(function
|
8214
|
-
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) {
|
8215
8040
|
case 0:
|
8216
|
-
|
8041
|
+
_context65.next = 2;
|
8217
8042
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
8218
|
-
var
|
8043
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee64(e) {
|
8219
8044
|
var t;
|
8220
|
-
return _regeneratorRuntime().wrap(function
|
8221
|
-
while (1) switch (
|
8045
|
+
return _regeneratorRuntime().wrap(function _callee64$(_context64) {
|
8046
|
+
while (1) switch (_context64.prev = _context64.next) {
|
8222
8047
|
case 0:
|
8223
|
-
return
|
8048
|
+
return _context64.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
8224
8049
|
case 1:
|
8225
8050
|
case "end":
|
8226
|
-
return
|
8051
|
+
return _context64.stop();
|
8227
8052
|
}
|
8228
|
-
},
|
8053
|
+
}, _callee64);
|
8229
8054
|
}));
|
8230
|
-
return function (
|
8231
|
-
return
|
8055
|
+
return function (_x110) {
|
8056
|
+
return _ref5.apply(this, arguments);
|
8232
8057
|
};
|
8233
8058
|
}()));
|
8234
8059
|
case 2:
|
8235
8060
|
case "end":
|
8236
|
-
return
|
8061
|
+
return _context65.stop();
|
8237
8062
|
}
|
8238
|
-
},
|
8063
|
+
}, _callee65, this);
|
8239
8064
|
}));
|
8240
8065
|
function completePlaceholders() {
|
8241
8066
|
return _completePlaceholders.apply(this, arguments);
|
@@ -8265,7 +8090,7 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8265
8090
|
e.forEach(function (n) {
|
8266
8091
|
var s = new FileReader();
|
8267
8092
|
s.readAsDataURL(n), s.onload = function (o) {
|
8268
|
-
for (var
|
8093
|
+
for (var a = 0; a < t.length && !t[a].attemptAddFile(n, o.target.result); a += 1);
|
8269
8094
|
};
|
8270
8095
|
});
|
8271
8096
|
}
|
@@ -8273,11 +8098,11 @@ var FileAttachments = /*#__PURE__*/function () {
|
|
8273
8098
|
return FileAttachments;
|
8274
8099
|
}();
|
8275
8100
|
var _Modal = /*#__PURE__*/function () {
|
8276
|
-
function
|
8277
|
-
_classCallCheck(this,
|
8278
|
-
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();
|
8279
8104
|
}
|
8280
|
-
_createClass(
|
8105
|
+
_createClass(T, [{
|
8281
8106
|
key: "isOpen",
|
8282
8107
|
value: function isOpen() {
|
8283
8108
|
return this._isOpen;
|
@@ -8299,7 +8124,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8299
8124
|
var _this40 = this;
|
8300
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 () {
|
8301
8126
|
_this40._elementRef.style.display = "none", _this40._backgroundPanelRef.style.display = "none";
|
8302
|
-
},
|
8127
|
+
}, T.MODAL_CLOSE_TIMEOUT_MS);
|
8303
8128
|
}
|
8304
8129
|
}, {
|
8305
8130
|
key: "displayModalElements",
|
@@ -8315,7 +8140,7 @@ var _Modal = /*#__PURE__*/function () {
|
|
8315
8140
|
key: "addCloseButton",
|
8316
8141
|
value: function addCloseButton(e, t, n) {
|
8317
8142
|
var _this41 = this;
|
8318
|
-
var s = t ?
|
8143
|
+
var s = t ? T.createSVGButton(e) : T.createTextButton(e);
|
8319
8144
|
return this.addButtons(s), s.onclick = function () {
|
8320
8145
|
_this41.close(), setTimeout(function () {
|
8321
8146
|
n == null || n();
|
@@ -8375,12 +8200,12 @@ var _Modal = /*#__PURE__*/function () {
|
|
8375
8200
|
value: function createTextModalFunc(e, t, n) {
|
8376
8201
|
var s;
|
8377
8202
|
if (_typeof(t) == "object" && (s = t.files) != null && s.infoModal) {
|
8378
|
-
var
|
8379
|
-
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 || "");
|
8380
8205
|
}
|
8381
8206
|
}
|
8382
8207
|
}]);
|
8383
|
-
return
|
8208
|
+
return T;
|
8384
8209
|
}();
|
8385
8210
|
_Modal.MODAL_CLOSE_TIMEOUT_MS = 190;
|
8386
8211
|
var Modal = _Modal;
|
@@ -8391,10 +8216,10 @@ var UploadFileButton = /*#__PURE__*/function (_InputButton2) {
|
|
8391
8216
|
function UploadFileButton(e, t, n, s, o, a) {
|
8392
8217
|
var _this43;
|
8393
8218
|
_classCallCheck(this, UploadFileButton);
|
8394
|
-
var c, u, d, h,
|
8219
|
+
var c, u, d, h, p, f;
|
8395
8220
|
_this43 = _super36.call(this, UploadFileButton.createButtonElement(), (c = n.button) == null ? void 0 : c.position, n.button, a);
|
8396
8221
|
var l = _this43.createInnerElements(s, o, _this43._customStyles);
|
8397
|
-
_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;
|
8398
8223
|
return _this43;
|
8399
8224
|
}
|
8400
8225
|
_createClass(UploadFileButton, [{
|
@@ -8641,7 +8466,7 @@ var Translate = /*#__PURE__*/function () {
|
|
8641
8466
|
key: "translate",
|
8642
8467
|
value: function translate(e, t) {
|
8643
8468
|
var n = text_1$3.Text.breakupIntoWordsArr(e);
|
8644
|
-
for (var
|
8469
|
+
for (var s = 0; s < n.length; s += 1) t[n[s]] && (n[s] = t[n[s]]);
|
8645
8470
|
return n.join("");
|
8646
8471
|
}
|
8647
8472
|
}]);
|
@@ -8661,9 +8486,9 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
|
|
8661
8486
|
key: "extract",
|
8662
8487
|
value: function extract(e, t, n) {
|
8663
8488
|
var s = "";
|
8664
|
-
for (var
|
8665
|
-
var
|
8666
|
-
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;
|
8667
8492
|
}
|
8668
8493
|
return {
|
8669
8494
|
interimTranscript: s,
|
@@ -8676,8 +8501,8 @@ var WebSpeechTranscript = /*#__PURE__*/function () {
|
|
8676
8501
|
value: function extractSafari(e, t, n) {
|
8677
8502
|
var s = "";
|
8678
8503
|
var o = "";
|
8679
|
-
for (var
|
8680
|
-
var l = e.results[
|
8504
|
+
for (var a = e.resultIndex; a < e.results.length; ++a) {
|
8505
|
+
var l = e.results[a][0].transcript;
|
8681
8506
|
n && (l = translate_1$1.Translate.translate(l, n)), s += l;
|
8682
8507
|
}
|
8683
8508
|
return {
|
@@ -8849,8 +8674,8 @@ var Elements = /*#__PURE__*/function () {
|
|
8849
8674
|
if (e.spansPopulated = !0, e.insertInCursorLocation && document.activeElement === t) {
|
8850
8675
|
var n = window.getSelection();
|
8851
8676
|
if (n != null && n.focusNode) {
|
8852
|
-
var
|
8853
|
-
|
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);
|
8854
8679
|
return;
|
8855
8680
|
}
|
8856
8681
|
}
|
@@ -8884,20 +8709,20 @@ var Cursor = /*#__PURE__*/function () {
|
|
8884
8709
|
value: function setOffsetForGeneric(e, t) {
|
8885
8710
|
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
8886
8711
|
var s = 0;
|
8887
|
-
for (var
|
8888
|
-
var
|
8889
|
-
if (
|
8890
|
-
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);
|
8891
8716
|
if (l === -1) return -1;
|
8892
8717
|
n += l;
|
8893
|
-
} else if (
|
8894
|
-
if (n +
|
8718
|
+
} else if (a.textContent !== null) {
|
8719
|
+
if (n + a.textContent.length > t) {
|
8895
8720
|
var _l = document.createRange();
|
8896
|
-
_l.setStart(
|
8721
|
+
_l.setStart(a, t - n), _l.collapse(!0);
|
8897
8722
|
var c = window.getSelection();
|
8898
8723
|
return c == null || c.removeAllRanges(), c == null || c.addRange(_l), e.focus(), -1;
|
8899
8724
|
}
|
8900
|
-
n +=
|
8725
|
+
n += a.textContent.length, s += a.textContent.length;
|
8901
8726
|
}
|
8902
8727
|
}
|
8903
8728
|
return s;
|
@@ -8915,8 +8740,8 @@ var Cursor = /*#__PURE__*/function () {
|
|
8915
8740
|
value: function setOffsetForSafariGeneric(e, t) {
|
8916
8741
|
var n = window.getSelection();
|
8917
8742
|
if (n) {
|
8918
|
-
var
|
8919
|
-
console.log(
|
8743
|
+
var s = Cursor.getGenericElementCursorOffset(e, n, !0);
|
8744
|
+
console.log(s), setTimeout(function () {}, 100), Cursor.setOffsetForGeneric(e, s + t);
|
8920
8745
|
}
|
8921
8746
|
}
|
8922
8747
|
// set to automatically scroll to cursor (scroll does not work in Safari)
|
@@ -8947,9 +8772,9 @@ var Cursor = /*#__PURE__*/function () {
|
|
8947
8772
|
value: function getGenericElementCursorOffset(e, t, n) {
|
8948
8773
|
var s = 0;
|
8949
8774
|
if (t.rangeCount > 0) {
|
8950
|
-
var
|
8951
|
-
|
8952
|
-
|
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;
|
8953
8778
|
}
|
8954
8779
|
return s;
|
8955
8780
|
}
|
@@ -9012,10 +8837,10 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
9012
8837
|
key: "checkIfMatchesWord",
|
9013
8838
|
value: function checkIfMatchesWord(e, t, n) {
|
9014
8839
|
var s = e;
|
9015
|
-
for (var
|
9016
|
-
var
|
8840
|
+
for (var o = n.length - 1; o >= 0; o -= 1) {
|
8841
|
+
var a = o,
|
9017
8842
|
l = s.length - 1;
|
9018
|
-
for (; n[
|
8843
|
+
for (; n[a] === s[l] && l >= 0;) a -= 1, l -= 1;
|
9019
8844
|
if (l < 0) return !0;
|
9020
8845
|
}
|
9021
8846
|
return !1;
|
@@ -9029,31 +8854,31 @@ var CommandUtils = /*#__PURE__*/function () {
|
|
9029
8854
|
if (!u || !s || !n) return;
|
9030
8855
|
var d = ((a = u.settings) === null || a === void 0 ? void 0 : a.caseSensitive) === !0 ? t : t.toLowerCase(),
|
9031
8856
|
h = text_1$2.Text.breakupIntoWordsArr(d),
|
9032
|
-
|
9033
|
-
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 () {
|
9034
8859
|
return CommandUtils.toggleCommandModeOn(e);
|
9035
8860
|
}), {
|
9036
8861
|
doNotProcessTranscription: !1
|
9037
8862
|
};
|
9038
8863
|
if (!(u.commandMode && !e.isWaitingForCommand)) {
|
9039
|
-
if (u.stop &&
|
8864
|
+
if (u.stop && p(u.stop, d, h)) return CommandUtils.toggleCommandModeOff(e), setTimeout(function () {
|
9040
8865
|
return e.stop();
|
9041
8866
|
}), {
|
9042
8867
|
doNotProcessTranscription: !1
|
9043
8868
|
};
|
9044
|
-
if (u.pause &&
|
9045
|
-
var
|
9046
|
-
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);
|
9047
8872
|
}), {
|
9048
8873
|
doNotProcessTranscription: !1
|
9049
8874
|
};
|
9050
|
-
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), {
|
9051
8876
|
doNotProcessTranscription: !0
|
9052
8877
|
};
|
9053
|
-
if (u.reset &&
|
8878
|
+
if (u.reset && p(u.reset, d, h)) return o !== void 0 && CommandUtils.setText(e, n, o, s), {
|
9054
8879
|
doNotProcessTranscription: !0
|
9055
8880
|
};
|
9056
|
-
if (u.removeAllText &&
|
8881
|
+
if (u.removeAllText && p(u.removeAllText, d, h)) return CommandUtils.setText(e, n, "", s), {
|
9057
8882
|
doNotProcessTranscription: !0
|
9058
8883
|
};
|
9059
8884
|
}
|
@@ -9084,9 +8909,9 @@ var Highlight = /*#__PURE__*/function () {
|
|
9084
8909
|
value: function setStateForGeneric(e, t) {
|
9085
8910
|
var n = window.getSelection();
|
9086
8911
|
if (n != null && n.focusNode) {
|
9087
|
-
var
|
9088
|
-
|
9089
|
-
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;
|
9090
8915
|
}
|
9091
8916
|
}
|
9092
8917
|
}, {
|
@@ -9099,8 +8924,8 @@ var Highlight = /*#__PURE__*/function () {
|
|
9099
8924
|
value: function removeForGeneric(e, t) {
|
9100
8925
|
var n = window.getSelection();
|
9101
8926
|
if (n) {
|
9102
|
-
var
|
9103
|
-
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;
|
9104
8929
|
}
|
9105
8930
|
}
|
9106
8931
|
}, {
|
@@ -9110,8 +8935,8 @@ var Highlight = /*#__PURE__*/function () {
|
|
9110
8935
|
s = t.selectionEnd,
|
9111
8936
|
o = t.value;
|
9112
8937
|
if (n && s) {
|
9113
|
-
var
|
9114
|
-
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);
|
9115
8940
|
}
|
9116
8941
|
e.isHighlighted = !1;
|
9117
8942
|
}
|
@@ -9135,11 +8960,11 @@ var Padding = /*#__PURE__*/function () {
|
|
9135
8960
|
key: "setStateForPrimitiveElement",
|
9136
8961
|
value: function setStateForPrimitiveElement(e, t) {
|
9137
8962
|
if (document.activeElement === t && t.selectionStart !== null) {
|
9138
|
-
var
|
9139
|
-
|
9140
|
-
|
9141
|
-
l = t.value[
|
9142
|
-
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;
|
9143
8968
|
return;
|
9144
8969
|
}
|
9145
8970
|
var n = t.value[t.value.length - 1];
|
@@ -9210,11 +9035,11 @@ var Speech = /*#__PURE__*/function () {
|
|
9210
9035
|
value: function prepareBeforeStart(e) {
|
9211
9036
|
var t, n;
|
9212
9037
|
if (e != null && e.element) if (eventListeners_1.EventListeners.add(this, e), Array.isArray(e.element)) {
|
9213
|
-
var
|
9038
|
+
var o = e.element.find(function (a) {
|
9214
9039
|
return a === document.activeElement;
|
9215
9040
|
}) || e.element[0];
|
9216
|
-
if (!
|
9217
|
-
this.prepare(
|
9041
|
+
if (!o) return;
|
9042
|
+
this.prepare(o);
|
9218
9043
|
} else this.prepare(e.element);
|
9219
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));
|
9220
9045
|
}
|
@@ -9257,8 +9082,8 @@ var Speech = /*#__PURE__*/function () {
|
|
9257
9082
|
this.isHighlighted && highlight_1.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || padding_1.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), n && padding_1.Padding.adjustSateForNoTextPrimitiveElement(this);
|
9258
9083
|
var s = this.startPadding + this.finalTranscript + t;
|
9259
9084
|
if (e.value = s + this.endPadding, !this.isTargetInShadow) {
|
9260
|
-
var
|
9261
|
-
cursor_1.Cursor.setOffsetForPrimitive(e,
|
9085
|
+
var o = s.length + this.numberOfSpacesAfterNewText;
|
9086
|
+
cursor_1.Cursor.setOffsetForPrimitive(e, o, this.autoScroll);
|
9262
9087
|
}
|
9263
9088
|
this.autoScroll && browser_1$1.Browser.IS_SAFARI() && this.isCursorAtEnd && autoScroll_1.AutoScroll.scrollSafariPrimitiveToEnd(e);
|
9264
9089
|
}
|
@@ -9359,8 +9184,8 @@ var WebSpeech = /*#__PURE__*/function (_speech_1$1$Speech) {
|
|
9359
9184
|
var _this46$_extractText = _this46._extractText(e, _this46.finalTranscript, _this46._translations),
|
9360
9185
|
t = _this46$_extractText.interimTranscript,
|
9361
9186
|
n = _this46$_extractText.finalTranscript,
|
9362
|
-
|
9363
|
-
_this46.updateElements(t, n,
|
9187
|
+
s = _this46$_extractText.newText;
|
9188
|
+
_this46.updateElements(t, n, s);
|
9364
9189
|
}
|
9365
9190
|
});
|
9366
9191
|
}
|
@@ -9455,26 +9280,26 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9455
9280
|
}, {
|
9456
9281
|
key: "getNewSpeechConfig",
|
9457
9282
|
value: function () {
|
9458
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9459
|
-
return _regeneratorRuntime().wrap(function
|
9460
|
-
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) {
|
9461
9286
|
case 0:
|
9462
9287
|
if (!t.region) {
|
9463
|
-
|
9288
|
+
_context66.next = 2;
|
9464
9289
|
break;
|
9465
9290
|
}
|
9466
|
-
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) {
|
9467
9292
|
return t.region ? e.fromAuthorizationToken((n == null ? void 0 : n.trim()) || "", t.region.trim()) : null;
|
9468
9293
|
})["catch"](function (n) {
|
9469
9294
|
return console.error(n), null;
|
9470
9295
|
}) : null);
|
9471
9296
|
case 2:
|
9472
9297
|
case "end":
|
9473
|
-
return
|
9298
|
+
return _context66.stop();
|
9474
9299
|
}
|
9475
|
-
},
|
9300
|
+
}, _callee66);
|
9476
9301
|
}));
|
9477
|
-
function getNewSpeechConfig(
|
9302
|
+
function getNewSpeechConfig(_x111, _x112) {
|
9478
9303
|
return _getNewSpeechConfig.apply(this, arguments);
|
9479
9304
|
}
|
9480
9305
|
return getNewSpeechConfig;
|
@@ -9487,23 +9312,23 @@ var AzureSpeechConfig = /*#__PURE__*/function () {
|
|
9487
9312
|
}, {
|
9488
9313
|
key: "get",
|
9489
9314
|
value: function () {
|
9490
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9315
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee67(e, t) {
|
9491
9316
|
var n;
|
9492
|
-
return _regeneratorRuntime().wrap(function
|
9493
|
-
while (1) switch (
|
9317
|
+
return _regeneratorRuntime().wrap(function _callee67$(_context67) {
|
9318
|
+
while (1) switch (_context67.prev = _context67.next) {
|
9494
9319
|
case 0:
|
9495
|
-
|
9320
|
+
_context67.next = 2;
|
9496
9321
|
return AzureSpeechConfig.getNewSpeechConfig(e, t);
|
9497
9322
|
case 2:
|
9498
|
-
n =
|
9499
|
-
return
|
9323
|
+
n = _context67.sent;
|
9324
|
+
return _context67.abrupt("return", (n && AzureSpeechConfig.process(n, t), n));
|
9500
9325
|
case 4:
|
9501
9326
|
case "end":
|
9502
|
-
return
|
9327
|
+
return _context67.stop();
|
9503
9328
|
}
|
9504
|
-
},
|
9329
|
+
}, _callee67);
|
9505
9330
|
}));
|
9506
|
-
function get(
|
9331
|
+
function get(_x113, _x114) {
|
9507
9332
|
return _get.apply(this, arguments);
|
9508
9333
|
}
|
9509
9334
|
return get;
|
@@ -9593,28 +9418,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9593
9418
|
}, {
|
9594
9419
|
key: "startAsync",
|
9595
9420
|
value: function () {
|
9596
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9421
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee68(e) {
|
9597
9422
|
var t;
|
9598
|
-
return _regeneratorRuntime().wrap(function
|
9599
|
-
while (1) switch (
|
9423
|
+
return _regeneratorRuntime().wrap(function _callee68$(_context68) {
|
9424
|
+
while (1) switch (_context68.prev = _context68.next) {
|
9600
9425
|
case 0:
|
9601
|
-
|
9602
|
-
if (!
|
9603
|
-
|
9426
|
+
_context68.t0 = this.validate(e);
|
9427
|
+
if (!_context68.t0) {
|
9428
|
+
_context68.next = 6;
|
9604
9429
|
break;
|
9605
9430
|
}
|
9606
|
-
|
9431
|
+
_context68.next = 4;
|
9607
9432
|
return this.instantiateService(e);
|
9608
9433
|
case 4:
|
9609
9434
|
this._translations = e == null ? void 0 : e.translations;
|
9610
9435
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
9611
9436
|
case 6:
|
9612
9437
|
case "end":
|
9613
|
-
return
|
9438
|
+
return _context68.stop();
|
9614
9439
|
}
|
9615
|
-
},
|
9440
|
+
}, _callee68, this);
|
9616
9441
|
}));
|
9617
|
-
function startAsync(
|
9442
|
+
function startAsync(_x115) {
|
9618
9443
|
return _startAsync.apply(this, arguments);
|
9619
9444
|
}
|
9620
9445
|
return startAsync;
|
@@ -9627,28 +9452,28 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9627
9452
|
}, {
|
9628
9453
|
key: "instantiateService",
|
9629
9454
|
value: function () {
|
9630
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9631
|
-
var t, n, s,
|
9632
|
-
return _regeneratorRuntime().wrap(function
|
9633
|
-
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) {
|
9634
9459
|
case 0:
|
9635
9460
|
t = Azure.getAPI();
|
9636
9461
|
n = t.AudioConfig.fromDefaultMicrophoneInput();
|
9637
|
-
|
9462
|
+
_context69.next = 4;
|
9638
9463
|
return azureSpeechConfig_1.AzureSpeechConfig.get(t.SpeechConfig, e);
|
9639
9464
|
case 4:
|
9640
|
-
s =
|
9465
|
+
s = _context69.sent;
|
9641
9466
|
if (s) {
|
9642
|
-
|
9643
|
-
this.setEvents(
|
9467
|
+
o = new t.SpeechRecognizer(s, n);
|
9468
|
+
this.setEvents(o), this._service = o, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
9644
9469
|
} else this.error("Unable to contact Azure server");
|
9645
9470
|
case 6:
|
9646
9471
|
case "end":
|
9647
|
-
return
|
9472
|
+
return _context69.stop();
|
9648
9473
|
}
|
9649
|
-
},
|
9474
|
+
}, _callee69, this);
|
9650
9475
|
}));
|
9651
|
-
function instantiateService(
|
9476
|
+
function instantiateService(_x116) {
|
9652
9477
|
return _instantiateService.apply(this, arguments);
|
9653
9478
|
}
|
9654
9479
|
return instantiateService;
|
@@ -9685,10 +9510,10 @@ var Azure = /*#__PURE__*/function (_speech_1$Speech) {
|
|
9685
9510
|
case window.SpeechSDK.ResultReason.RecognizedSpeech:
|
9686
9511
|
if (n.text && !this._stopping) {
|
9687
9512
|
var _azureTranscript_1$Az2 = azureTranscript_1.AzureTranscript.extract(this._newTextPadding + n.text, this.finalTranscript, !0, this._translations),
|
9688
|
-
|
9689
|
-
|
9690
|
-
|
9691
|
-
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 = " ");
|
9692
9517
|
}
|
9693
9518
|
break;
|
9694
9519
|
}
|
@@ -10030,17 +9855,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10030
9855
|
}, {
|
10031
9856
|
key: "submit",
|
10032
9857
|
value: function () {
|
10033
|
-
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9858
|
+
var _submit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t) {
|
10034
9859
|
var l, c, n, s, o, a;
|
10035
|
-
return _regeneratorRuntime().wrap(function
|
10036
|
-
while (1) switch (
|
9860
|
+
return _regeneratorRuntime().wrap(function _callee70$(_context70) {
|
9861
|
+
while (1) switch (_context70.prev = _context70.next) {
|
10037
9862
|
case 0:
|
10038
|
-
|
10039
|
-
if (
|
10040
|
-
|
9863
|
+
_context70.t0 = e;
|
9864
|
+
if (_context70.t0) {
|
9865
|
+
_context70.next = 6;
|
10041
9866
|
break;
|
10042
9867
|
}
|
10043
|
-
|
9868
|
+
_context70.next = 4;
|
10044
9869
|
return this._fileAttachments.completePlaceholders();
|
10045
9870
|
case 4:
|
10046
9871
|
n = this._fileAttachments.getAllFileData();
|
@@ -10050,40 +9875,40 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10050
9875
|
case 6:
|
10051
9876
|
o = t === "" ? void 0 : t;
|
10052
9877
|
if (!(this._isRequestInProgress || !Websocket.canSendMessage(this._serviceIO.websocket))) {
|
10053
|
-
|
9878
|
+
_context70.next = 9;
|
10054
9879
|
break;
|
10055
9880
|
}
|
10056
|
-
return
|
9881
|
+
return _context70.abrupt("return");
|
10057
9882
|
case 9:
|
10058
9883
|
if (!((l = this._serviceIO.deepChat) != null && l.validateMessageBeforeSending)) {
|
10059
|
-
|
9884
|
+
_context70.next = 14;
|
10060
9885
|
break;
|
10061
9886
|
}
|
10062
9887
|
if (this._serviceIO.deepChat.validateMessageBeforeSending(o, s)) {
|
10063
|
-
|
9888
|
+
_context70.next = 12;
|
10064
9889
|
break;
|
10065
9890
|
}
|
10066
|
-
return
|
9891
|
+
return _context70.abrupt("return");
|
10067
9892
|
case 12:
|
10068
|
-
|
9893
|
+
_context70.next = 16;
|
10069
9894
|
break;
|
10070
9895
|
case 14:
|
10071
9896
|
if (this._serviceIO.canSendMessage(o, s)) {
|
10072
|
-
|
9897
|
+
_context70.next = 16;
|
10073
9898
|
break;
|
10074
9899
|
}
|
10075
|
-
return
|
9900
|
+
return _context70.abrupt("return");
|
10076
9901
|
case 16:
|
10077
9902
|
this.changeToLoadingIcon();
|
10078
9903
|
t !== "" && this._messages.addNewMessage({
|
10079
9904
|
text: t
|
10080
9905
|
}, !1, !0);
|
10081
|
-
|
10082
|
-
if (!
|
10083
|
-
|
9906
|
+
_context70.t1 = n;
|
9907
|
+
if (!_context70.t1) {
|
9908
|
+
_context70.next = 22;
|
10084
9909
|
break;
|
10085
9910
|
}
|
10086
|
-
|
9911
|
+
_context70.next = 22;
|
10087
9912
|
return this._messages.addMultipleFiles(n);
|
10088
9913
|
case 22:
|
10089
9914
|
this._messages.addLoadingMessage();
|
@@ -10092,17 +9917,17 @@ var SubmitButton = /*#__PURE__*/function (_InputButton4) {
|
|
10092
9917
|
text: o,
|
10093
9918
|
files: s
|
10094
9919
|
};
|
10095
|
-
|
9920
|
+
_context70.next = 27;
|
10096
9921
|
return this._serviceIO.callAPI(a, this._messages);
|
10097
9922
|
case 27:
|
10098
9923
|
e || (c = this._fileAttachments) == null || c.removeAllFiles();
|
10099
9924
|
case 28:
|
10100
9925
|
case "end":
|
10101
|
-
return
|
9926
|
+
return _context70.stop();
|
10102
9927
|
}
|
10103
|
-
},
|
9928
|
+
}, _callee70, this);
|
10104
9929
|
}));
|
10105
|
-
function submit(
|
9930
|
+
function submit(_x117, _x118) {
|
10106
9931
|
return _submit.apply(this, arguments);
|
10107
9932
|
}
|
10108
9933
|
return submit;
|
@@ -10237,13 +10062,13 @@ var CameraModal = /*#__PURE__*/function (_Modal2) {
|
|
10237
10062
|
t = new Array(e.length);
|
10238
10063
|
for (var l = 0; l < e.length; l++) t[l] = e.charCodeAt(l);
|
10239
10064
|
var n = new Uint8Array(t),
|
10240
|
-
|
10065
|
+
s = new Blob([n], {
|
10241
10066
|
type: this._format
|
10242
10067
|
}),
|
10243
|
-
|
10244
|
-
|
10245
|
-
return new File([
|
10246
|
-
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
|
10247
10072
|
});
|
10248
10073
|
}
|
10249
10074
|
}
|
@@ -10378,9 +10203,9 @@ var Input = /*#__PURE__*/function () {
|
|
10378
10203
|
u = _FILE_TYPE_BUTTON_ICO.id,
|
10379
10204
|
d = _FILE_TYPE_BUTTON_ICO.svgString,
|
10380
10205
|
h = _FILE_TYPE_BUTTON_ICO.dropupText,
|
10381
|
-
|
10206
|
+
p = new UploadFileButton(n, c, l, u, d, h);
|
10382
10207
|
s[a] = {
|
10383
|
-
button:
|
10208
|
+
button: p,
|
10384
10209
|
fileType: c
|
10385
10210
|
};
|
10386
10211
|
}
|