deep-chat-dev 9.0.114 → 9.0.117
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 +9751 -9718
- package/dist/deepChat.bundle.js +1 -1
- package/dist/deepChat.d.ts +1 -1
- package/dist/deepChat.d.ts.map +1 -1
- package/dist/deepChat.js +864 -803
- package/dist/services/openAI/openAIAssistantIO.d.ts +4 -0
- package/dist/services/openAI/openAIAssistantIO.d.ts.map +1 -1
- package/dist/types/openAI.d.ts +18 -2
- package/dist/types/openAI.d.ts.map +1 -1
- package/dist/types/openAIResult.d.ts +3 -0
- package/dist/types/openAIResult.d.ts.map +1 -1
- package/dist/utils/HTTP/requestUtils.d.ts +1 -1
- package/dist/utils/HTTP/requestUtils.d.ts.map +1 -1
- package/dist/webModel/webModelConfig.d.ts +18 -0
- package/dist/webModel/webModelConfig.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/deepChat.js
CHANGED
@@ -6,15 +6,15 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
|
|
6
6
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
8
8
|
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
9
|
-
function _construct(
|
9
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
10
10
|
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
11
|
-
function
|
12
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
14
12
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
15
13
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
16
|
-
function _isNativeReflectConstruct() {
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
17
15
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
16
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
17
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
18
18
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
19
19
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
20
20
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
@@ -182,7 +182,7 @@ zn.DEFAULT_COMPONENT_STYLE = {
|
|
182
182
|
// this is also causing the chat to squeeze when there is no space
|
183
183
|
overflow: "hidden"
|
184
184
|
};
|
185
|
-
var
|
185
|
+
var Si = zn;
|
186
186
|
var R = /* @__PURE__ */function (s) {
|
187
187
|
return s.ESCAPE = "Escape", s.ENTER = "Enter", s.TAB = "Tab", s.ARROW_UP = "ArrowUp", s.ARROW_DOWN = "ArrowDown", s.ARROW_RIGHT = "ArrowRight", s.ARROW_LEFT = "ArrowLeft", s.BACKSPACE = "Backspace", s.DELETE = "Delete", s.META = "Meta", s.CONTROL = "Control", s;
|
188
188
|
}(R || {});
|
@@ -191,7 +191,7 @@ var be = /*#__PURE__*/_createClass(function be() {
|
|
191
191
|
});
|
192
192
|
be.IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
193
193
|
be.IS_CHROMIUM = window.chrome;
|
194
|
-
var
|
194
|
+
var qn = /*#__PURE__*/function () {
|
195
195
|
function rt() {
|
196
196
|
_classCallCheck(this, rt);
|
197
197
|
}
|
@@ -223,8 +223,8 @@ var Un = /*#__PURE__*/function () {
|
|
223
223
|
}]);
|
224
224
|
return rt;
|
225
225
|
}();
|
226
|
-
|
227
|
-
var ys =
|
226
|
+
qn.PERMITTED_KEYS = /* @__PURE__ */new Set([R.BACKSPACE, R.DELETE, R.ARROW_RIGHT, R.ARROW_LEFT, R.ARROW_DOWN, R.ARROW_UP, R.META, R.CONTROL, R.ENTER]);
|
227
|
+
var ys = qn;
|
228
228
|
var xs = /*#__PURE__*/function () {
|
229
229
|
function xs() {
|
230
230
|
_classCallCheck(this, xs);
|
@@ -240,7 +240,7 @@ var xs = /*#__PURE__*/function () {
|
|
240
240
|
}]);
|
241
241
|
return xs;
|
242
242
|
}();
|
243
|
-
var
|
243
|
+
var Un = /*#__PURE__*/function () {
|
244
244
|
function He(e, t) {
|
245
245
|
var _this = this;
|
246
246
|
_classCallCheck(this, He);
|
@@ -336,8 +336,8 @@ var qn = /*#__PURE__*/function () {
|
|
336
336
|
}]);
|
337
337
|
return He;
|
338
338
|
}();
|
339
|
-
|
340
|
-
var
|
339
|
+
Un.TEXT_INPUT_ID = "text-input";
|
340
|
+
var Gi = Un;
|
341
341
|
var ti = /*#__PURE__*/function () {
|
342
342
|
function ti() {
|
343
343
|
_classCallCheck(this, ti);
|
@@ -353,7 +353,7 @@ var ti = /*#__PURE__*/function () {
|
|
353
353
|
}, {
|
354
354
|
key: "focusFromParentElement",
|
355
355
|
value: function focusFromParentElement(e) {
|
356
|
-
var t = e.querySelector("#".concat(
|
356
|
+
var t = e.querySelector("#".concat(Gi.TEXT_INPUT_ID));
|
357
357
|
t && ti.focusEndOfInput(t);
|
358
358
|
}
|
359
359
|
}]);
|
@@ -365,28 +365,28 @@ function an(s) {
|
|
365
365
|
function Es(s) {
|
366
366
|
return s && JSON.stringify(s);
|
367
367
|
}
|
368
|
-
function
|
368
|
+
function Vi(s, e, t, i) {
|
369
369
|
var n = "\n".concat(an(e), " message: ").concat(JSON.stringify(s), " \n"),
|
370
370
|
r = t ? "".concat(an(e), " message after interceptor: ").concat(Es(i), " \n") : "";
|
371
371
|
return n + r;
|
372
372
|
}
|
373
|
-
function
|
374
|
-
return "".concat(
|
373
|
+
function _s(s, e, t, i) {
|
374
|
+
return "".concat(Vi(s, e, t, i), "Make sure the ").concat(e, " message is using the Response format: https://deepchat.dev/docs/connect/#Response \nYou can also augment it using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor");
|
375
375
|
}
|
376
376
|
function ws(s, e, t) {
|
377
377
|
var i = "response";
|
378
|
-
return "".concat(
|
378
|
+
return "".concat(Vi(s, i, e, t), "Make sure the ").concat(i, " message is using the {text: string} format, e.g: {text: \"Model Response\"}");
|
379
379
|
}
|
380
|
-
function
|
380
|
+
function Ss(s, e) {
|
381
381
|
var t = "request";
|
382
|
-
return "".concat(
|
382
|
+
return "".concat(Vi(s, t, e), "Make sure the ").concat(t, " message is using the {body: {text: string}} format, e.g: {body: {text: \"Model Response\"}}");
|
383
383
|
}
|
384
384
|
var ln = "Make sure the events are using {text: string} or {html: string} format.\nYou can also augment them using the responseInterceptor property: https://deepchat.dev/docs/interceptors#responseInterceptor",
|
385
385
|
C = {
|
386
386
|
INVALID_KEY: "Invalid API Key",
|
387
387
|
CONNECTION_FAILED: "Failed to connect",
|
388
|
-
INVALID_RESPONSE:
|
389
|
-
INVALID_MODEL_REQUEST:
|
388
|
+
INVALID_RESPONSE: _s,
|
389
|
+
INVALID_MODEL_REQUEST: Ss,
|
390
390
|
INVALID_MODEL_RESPONSE: ws,
|
391
391
|
INVALID_STREAM_EVENT: ln,
|
392
392
|
INVALID_STREAM_EVENT_MIX: "Cannot mix {text: string} and {html: string} responses.",
|
@@ -513,10 +513,10 @@ var Le = /*#__PURE__*/function () {
|
|
513
513
|
return Le;
|
514
514
|
}();
|
515
515
|
var ii = /*#__PURE__*/function () {
|
516
|
-
function
|
517
|
-
_classCallCheck(this,
|
516
|
+
function _e() {
|
517
|
+
_classCallCheck(this, _e);
|
518
518
|
}
|
519
|
-
_createClass(
|
519
|
+
_createClass(_e, null, [{
|
520
520
|
key: "getLastElementsByClass",
|
521
521
|
value: function getLastElementsByClass(e, t, i) {
|
522
522
|
var _loop = function _loop() {
|
@@ -557,8 +557,8 @@ var ii = /*#__PURE__*/function () {
|
|
557
557
|
}, {
|
558
558
|
key: "overwriteMessage",
|
559
559
|
value: function overwriteMessage(e, t, i, n, r, o) {
|
560
|
-
var a =
|
561
|
-
l =
|
560
|
+
var a = _e.getLastElementsByClass(t, [_e.getRoleClass(n), o], ["loading-message-text"]),
|
561
|
+
l = _e.getLastMessage(e, n, r);
|
562
562
|
return l && (l[r] = i), a;
|
563
563
|
}
|
564
564
|
}, {
|
@@ -570,18 +570,18 @@ var ii = /*#__PURE__*/function () {
|
|
570
570
|
}, {
|
571
571
|
key: "fillEmptyMessageElement",
|
572
572
|
value: function fillEmptyMessageElement(e, t) {
|
573
|
-
t.trim().length === 0 && (e.classList.add(
|
573
|
+
t.trim().length === 0 && (e.classList.add(_e.EMPTY_MESSAGE_CLASS), e.innerHTML = '<div style="color:#00000000">.</div>');
|
574
574
|
}
|
575
575
|
}, {
|
576
576
|
key: "unfillEmptyMessageElement",
|
577
577
|
value: function unfillEmptyMessageElement(e, t) {
|
578
|
-
e.classList.contains(
|
578
|
+
e.classList.contains(_e.EMPTY_MESSAGE_CLASS) && t.trim().length > 0 && e.replaceChildren();
|
579
579
|
}
|
580
580
|
}, {
|
581
581
|
key: "getLastMessageBubbleElement",
|
582
582
|
value: function getLastMessageBubbleElement(e) {
|
583
583
|
var t, i, n;
|
584
|
-
return Array.from(((n = (i = (t =
|
584
|
+
return Array.from(((n = (i = (t = _e.getLastMessageElement(e)) == null ? void 0 : t.children) == null ? void 0 : i[0]) == null ? void 0 : n.children) || []).find(function (r) {
|
585
585
|
return r.classList.contains("message-bubble");
|
586
586
|
});
|
587
587
|
}
|
@@ -591,7 +591,7 @@ var ii = /*#__PURE__*/function () {
|
|
591
591
|
return e.children[e.children.length - 1];
|
592
592
|
}
|
593
593
|
}]);
|
594
|
-
return
|
594
|
+
return _e;
|
595
595
|
}();
|
596
596
|
ii.AI_ROLE = "ai";
|
597
597
|
ii.USER_ROLE = "user";
|
@@ -631,7 +631,7 @@ var Ae = /*#__PURE__*/function () {
|
|
631
631
|
}();
|
632
632
|
var Ms = "deep-chat-temporary-message",
|
633
633
|
Ts = "deep-chat-suggestion-button",
|
634
|
-
|
634
|
+
Pi = {
|
635
635
|
"deep-chat-button": {
|
636
636
|
styles: {
|
637
637
|
"default": {
|
@@ -652,7 +652,7 @@ var Ms = "deep-chat-temporary-message",
|
|
652
652
|
}
|
653
653
|
}
|
654
654
|
},
|
655
|
-
cn = Object.keys(
|
655
|
+
cn = Object.keys(Pi);
|
656
656
|
var ve = /*#__PURE__*/function () {
|
657
657
|
function ve() {
|
658
658
|
_classCallCheck(this, ve);
|
@@ -685,7 +685,7 @@ var ve = /*#__PURE__*/function () {
|
|
685
685
|
}, {
|
686
686
|
key: "applyEvents",
|
687
687
|
value: function applyEvents(e, t) {
|
688
|
-
var i =
|
688
|
+
var i = Pi[t].events;
|
689
689
|
Object.keys(i || []).forEach(function (n) {
|
690
690
|
e.addEventListener(n, i == null ? void 0 : i[n]);
|
691
691
|
});
|
@@ -698,7 +698,7 @@ var ve = /*#__PURE__*/function () {
|
|
698
698
|
var c = (d = e[l]) == null ? void 0 : d.styles;
|
699
699
|
return c && e[l].styles && a.push(c), a;
|
700
700
|
}, []),
|
701
|
-
r =
|
701
|
+
r = Pi[i].styles;
|
702
702
|
if (r) {
|
703
703
|
var a = JSON.parse(JSON.stringify(r));
|
704
704
|
a["default"] && T.overwriteDefaultWithAlreadyApplied(a, t), n.unshift(a);
|
@@ -713,7 +713,7 @@ var ve = /*#__PURE__*/function () {
|
|
713
713
|
var o = i.getElementsByClassName(r);
|
714
714
|
Array.from(o || []).forEach(function (a) {
|
715
715
|
var l = ve.getProcessedStyles(t, a, r);
|
716
|
-
|
716
|
+
re.applyStylesToElement(a, l), ve.applyEvents(a, r);
|
717
717
|
});
|
718
718
|
});
|
719
719
|
var n = i.getElementsByClassName(Ts);
|
@@ -724,11 +724,11 @@ var ve = /*#__PURE__*/function () {
|
|
724
724
|
}]);
|
725
725
|
return ve;
|
726
726
|
}();
|
727
|
-
var
|
728
|
-
function
|
729
|
-
_classCallCheck(this,
|
727
|
+
var re = /*#__PURE__*/function () {
|
728
|
+
function re() {
|
729
|
+
_classCallCheck(this, re);
|
730
730
|
}
|
731
|
-
_createClass(
|
731
|
+
_createClass(re, null, [{
|
732
732
|
key: "applyStylesToElement",
|
733
733
|
value: function applyStylesToElement(e, t) {
|
734
734
|
var i = T.processStateful(t, {}, {});
|
@@ -747,7 +747,7 @@ var se = /*#__PURE__*/function () {
|
|
747
747
|
value: function applyClassUtilitiesToElement(e, t) {
|
748
748
|
var i = t.events,
|
749
749
|
n = t.styles;
|
750
|
-
i &&
|
750
|
+
i && re.applyEventsToElement(e, i), n && !ve.doesElementContainDeepChatClass(e) && re.applyStylesToElement(e, n);
|
751
751
|
}
|
752
752
|
}, {
|
753
753
|
key: "applyCustomClassUtilities",
|
@@ -755,17 +755,17 @@ var se = /*#__PURE__*/function () {
|
|
755
755
|
Object.keys(e).forEach(function (i) {
|
756
756
|
var n = t.getElementsByClassName(i);
|
757
757
|
Array.from(n).forEach(function (r) {
|
758
|
-
e[i] &&
|
758
|
+
e[i] && re.applyClassUtilitiesToElement(r, e[i]);
|
759
759
|
});
|
760
760
|
});
|
761
761
|
}
|
762
762
|
}, {
|
763
763
|
key: "apply",
|
764
764
|
value: function apply(e, t) {
|
765
|
-
ve.applyDeepChatUtilities(e, e.htmlClassUtilities, t),
|
765
|
+
ve.applyDeepChatUtilities(e, e.htmlClassUtilities, t), re.applyCustomClassUtilities(e.htmlClassUtilities, t);
|
766
766
|
}
|
767
767
|
}]);
|
768
|
-
return
|
768
|
+
return re;
|
769
769
|
}();
|
770
770
|
var Xe = /*#__PURE__*/function () {
|
771
771
|
function Xe() {
|
@@ -787,7 +787,7 @@ var Xe = /*#__PURE__*/function () {
|
|
787
787
|
value: function overwrite(e, t, i, n) {
|
788
788
|
var r = e.messages,
|
789
789
|
o = v.overwriteMessage(r, n, t, i, "html", "html-message");
|
790
|
-
return o && (o.bubbleElement.innerHTML = t,
|
790
|
+
return o && (o.bubbleElement.innerHTML = t, re.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement)), o;
|
791
791
|
}
|
792
792
|
// prettier-ignore
|
793
793
|
}, {
|
@@ -800,7 +800,7 @@ var Xe = /*#__PURE__*/function () {
|
|
800
800
|
r.status = !1;
|
801
801
|
}
|
802
802
|
var o = Xe.createElements(e, t, i);
|
803
|
-
return v.fillEmptyMessageElement(o.bubbleElement, t),
|
803
|
+
return v.fillEmptyMessageElement(o.bubbleElement, t), re.apply(e, o.outerContainer), Le.flagHTMLUpdateClass(o.bubbleElement), e.applyCustomStyles(o, i, !1, (a = e.messageStyles) == null ? void 0 : a.html), Xe.addElement(e, o.outerContainer), o;
|
804
804
|
}
|
805
805
|
}]);
|
806
806
|
return Xe;
|
@@ -831,7 +831,7 @@ function gt(s) {
|
|
831
831
|
function $n(s) {
|
832
832
|
return !(s >= 55296 && s <= 57343 || s >= 64976 && s <= 65007 || (s & 65535) === 65535 || (s & 65535) === 65534 || s >= 0 && s <= 8 || s === 11 || s >= 14 && s <= 31 || s >= 127 && s <= 159 || s > 1114111);
|
833
833
|
}
|
834
|
-
function
|
834
|
+
function Di(s) {
|
835
835
|
if (s > 65535) {
|
836
836
|
s -= 65536;
|
837
837
|
var e = 55296 + (s >> 10),
|
@@ -845,7 +845,7 @@ var Is = /&([a-z#][a-z0-9]{1,31});/gi,
|
|
845
845
|
function Rs(s, e) {
|
846
846
|
var t = 0,
|
847
847
|
i = Kn(e);
|
848
|
-
return e !== i ? i : e.charCodeAt(0) === 35 && Ls.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), $n(t)) ?
|
848
|
+
return e !== i ? i : e.charCodeAt(0) === 35 && Ls.test(e) && (t = e[1].toLowerCase() === "x" ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10), $n(t)) ? Di(t) : s;
|
849
849
|
}
|
850
850
|
function Re(s) {
|
851
851
|
return s.indexOf("&") < 0 ? s : s.replace(Is, Rs);
|
@@ -1083,14 +1083,14 @@ function Yn(s, e) {
|
|
1083
1083
|
var Oe = m.getBreak = function (e, t) {
|
1084
1084
|
return t = Yn(e, t), t < e.length && e[t].type === "list_item_close" ? "" : "\n";
|
1085
1085
|
};
|
1086
|
-
function
|
1086
|
+
function Wi() {
|
1087
1087
|
this.rules = Jn({}, m), this.getBreak = m.getBreak;
|
1088
1088
|
}
|
1089
|
-
|
1089
|
+
Wi.prototype.renderInline = function (s, e, t) {
|
1090
1090
|
for (var i = this.rules, n = s.length, r = 0, o = ""; n--;) o += i[s[r].type](s, r++, e, t, this);
|
1091
1091
|
return o;
|
1092
1092
|
};
|
1093
|
-
|
1093
|
+
Wi.prototype.render = function (s, e, t) {
|
1094
1094
|
for (var i = this.rules, n = s.length, r = -1, o = ""; ++r < n;) s[r].type === "inline" ? o += this.renderInline(s[r].children, e, t) : o += i[s[r].type](s, r, e, t, this);
|
1095
1095
|
return o;
|
1096
1096
|
};
|
@@ -1237,7 +1237,7 @@ function Bs(s) {
|
|
1237
1237
|
}
|
1238
1238
|
}
|
1239
1239
|
}
|
1240
|
-
function
|
1240
|
+
function ji(s) {
|
1241
1241
|
var e = Re(s);
|
1242
1242
|
try {
|
1243
1243
|
e = decodeURI(e);
|
@@ -1253,7 +1253,7 @@ function Zn(s, e) {
|
|
1253
1253
|
if (s.src.charCodeAt(e) === 60) {
|
1254
1254
|
for (e++; e < o;) {
|
1255
1255
|
if (t = s.src.charCodeAt(e), t === 10) return !1;
|
1256
|
-
if (t === 62) return n =
|
1256
|
+
if (t === 62) return n = ji(gt(s.src.slice(r + 1, e))), s.parser.validateLink(n) ? (s.pos = e + 1, s.linkContent = n, !0) : !1;
|
1257
1257
|
if (t === 92 && e + 1 < o) {
|
1258
1258
|
e += 2;
|
1259
1259
|
continue;
|
@@ -1303,7 +1303,7 @@ function zs(s, e, t, i) {
|
|
1303
1303
|
href: d
|
1304
1304
|
}), o);
|
1305
1305
|
}
|
1306
|
-
function
|
1306
|
+
function qs(s) {
|
1307
1307
|
var e = s.tokens,
|
1308
1308
|
t,
|
1309
1309
|
i,
|
@@ -1316,7 +1316,7 @@ function Us(s) {
|
|
1316
1316
|
}
|
1317
1317
|
}
|
1318
1318
|
}
|
1319
|
-
function
|
1319
|
+
function Us(s) {
|
1320
1320
|
var e = s.tokens,
|
1321
1321
|
t,
|
1322
1322
|
i,
|
@@ -1378,7 +1378,7 @@ function Hs(s) {
|
|
1378
1378
|
}
|
1379
1379
|
}
|
1380
1380
|
var dn = " \n()[]'\".,!?-";
|
1381
|
-
function
|
1381
|
+
function Mi(s) {
|
1382
1382
|
return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1");
|
1383
1383
|
}
|
1384
1384
|
function Gs(s) {
|
@@ -1396,11 +1396,11 @@ function Gs(s) {
|
|
1396
1396
|
p,
|
1397
1397
|
h = s.tokens;
|
1398
1398
|
if (s.env.abbreviations) {
|
1399
|
-
for (s.env.abbrRegExp || (p = "(^|[" + dn.split("").map(
|
1399
|
+
for (s.env.abbrRegExp || (p = "(^|[" + dn.split("").map(Mi).join("") + "])(" + Object.keys(s.env.abbreviations).map(function (g) {
|
1400
1400
|
return g.substr(1);
|
1401
1401
|
}).sort(function (g, f) {
|
1402
1402
|
return f.length - g.length;
|
1403
|
-
}).map(
|
1403
|
+
}).map(Mi).join("|") + ")($|[" + dn.split("").map(Mi).join("") + "])", s.env.abbrRegExp = new RegExp(p, "g")), d = s.env.abbrRegExp, t = 0, i = h.length; t < i; t++) if (h[t].type === "inline") {
|
1404
1404
|
for (n = h[t].children, e = n.length - 1; e >= 0; e--) if (r = n[e], r.type === "text") {
|
1405
1405
|
for (l = 0, o = r.content, d.lastIndex = 0, c = r.level, a = []; u = d.exec(o);) d.lastIndex > l && a.push({
|
1406
1406
|
type: "text",
|
@@ -1453,24 +1453,24 @@ var Ys = /['"]/,
|
|
1453
1453
|
function pn(s, e) {
|
1454
1454
|
return e < 0 || e >= s.length ? !1 : !Zs.test(s[e]);
|
1455
1455
|
}
|
1456
|
-
function
|
1456
|
+
function qe(s, e, t) {
|
1457
1457
|
return s.substr(0, e) + t + s.substr(e + 1);
|
1458
1458
|
}
|
1459
1459
|
function Xs(s) {
|
1460
|
-
var e, t, i, n, r, o, a, l, c, d, u, p, h, g, f,
|
1460
|
+
var e, t, i, n, r, o, a, l, c, d, u, p, h, g, f, _, w;
|
1461
1461
|
if (s.options.typographer) {
|
1462
1462
|
for (w = [], f = s.tokens.length - 1; f >= 0; f--) if (s.tokens[f].type === "inline") {
|
1463
|
-
for (
|
1464
|
-
for (a =
|
1463
|
+
for (_ = s.tokens[f].children, w.length = 0, e = 0; e < _.length; e++) if (t = _[e], !(t.type !== "text" || Ys.test(t.text))) {
|
1464
|
+
for (a = _[e].level, h = w.length - 1; h >= 0 && !(w[h].level <= a); h--);
|
1465
1465
|
w.length = h + 1, i = t.content, r = 0, o = i.length;
|
1466
1466
|
e: for (; r < o && (un.lastIndex = r, n = un.exec(i), !!n);) {
|
1467
1467
|
if (l = !pn(i, n.index - 1), r = n.index + 1, g = n[0] === "'", c = !pn(i, r), !c && !l) {
|
1468
|
-
g && (t.content =
|
1468
|
+
g && (t.content = qe(t.content, n.index, hn));
|
1469
1469
|
continue;
|
1470
1470
|
}
|
1471
1471
|
if (u = !c, p = !l, p) {
|
1472
1472
|
for (h = w.length - 1; h >= 0 && (d = w[h], !(w[h].level < a)); h--) if (d.single === g && w[h].level === a) {
|
1473
|
-
d = w[h], g ? (
|
1473
|
+
d = w[h], g ? (_[d.token].content = qe(_[d.token].content, d.pos, s.options.quotes[2]), t.content = qe(t.content, n.index, s.options.quotes[3])) : (_[d.token].content = qe(_[d.token].content, d.pos, s.options.quotes[0]), t.content = qe(t.content, n.index, s.options.quotes[1])), w.length = h;
|
1474
1474
|
continue e;
|
1475
1475
|
}
|
1476
1476
|
}
|
@@ -1479,16 +1479,16 @@ function Xs(s) {
|
|
1479
1479
|
pos: n.index,
|
1480
1480
|
single: g,
|
1481
1481
|
level: a
|
1482
|
-
}) : p && g && (t.content =
|
1482
|
+
}) : p && g && (t.content = qe(t.content, n.index, hn));
|
1483
1483
|
}
|
1484
1484
|
}
|
1485
1485
|
}
|
1486
1486
|
}
|
1487
1487
|
}
|
1488
|
-
var
|
1488
|
+
var Ti = [["block", js], ["abbr", Bs], ["references", qs], ["inline", Us], ["footnote_tail", Hs], ["abbr2", Gs], ["replacements", $s], ["smartquotes", Xs]];
|
1489
1489
|
function es() {
|
1490
1490
|
this.options = {}, this.ruler = new G();
|
1491
|
-
for (var s = 0; s <
|
1491
|
+
for (var s = 0; s < Ti.length; s++) this.ruler.push(Ti[s][0], Ti[s][1]);
|
1492
1492
|
}
|
1493
1493
|
es.prototype.process = function (s) {
|
1494
1494
|
var e, t, i;
|
@@ -1595,12 +1595,12 @@ function tr(s, e, t, i) {
|
|
1595
1595
|
h,
|
1596
1596
|
g,
|
1597
1597
|
f = s.bMarks[e] + s.tShift[e],
|
1598
|
-
|
1599
|
-
if (f >
|
1598
|
+
_ = s.eMarks[e];
|
1599
|
+
if (f > _ || s.src.charCodeAt(f++) !== 62 || s.level >= s.options.maxNesting) return !1;
|
1600
1600
|
if (i) return !0;
|
1601
|
-
for (s.src.charCodeAt(f) === 32 && f++, l = s.blkIndent, s.blkIndent = 0, a = [s.bMarks[e]], s.bMarks[e] = f, f = f <
|
1601
|
+
for (s.src.charCodeAt(f) === 32 && f++, l = s.blkIndent, s.blkIndent = 0, a = [s.bMarks[e]], s.bMarks[e] = f, f = f < _ ? s.skipSpaces(f) : f, r = f >= _, o = [s.tShift[e]], s.tShift[e] = f - s.bMarks[e], u = s.parser.ruler.getRules("blockquote"), n = e + 1; n < t && (f = s.bMarks[n] + s.tShift[n], _ = s.eMarks[n], !(f >= _)); n++) {
|
1602
1602
|
if (s.src.charCodeAt(f++) === 62) {
|
1603
|
-
s.src.charCodeAt(f) === 32 && f++, a.push(s.bMarks[n]), s.bMarks[n] = f, f = f <
|
1603
|
+
s.src.charCodeAt(f) === 32 && f++, a.push(s.bMarks[n]), s.bMarks[n] = f, f = f < _ ? s.skipSpaces(f) : f, r = f >= _, o.push(s.tShift[n]), s.tShift[n] = f - s.bMarks[n];
|
1604
1604
|
continue;
|
1605
1605
|
}
|
1606
1606
|
if (r) break;
|
@@ -1675,21 +1675,21 @@ function sr(s, e, t, i) {
|
|
1675
1675
|
h,
|
1676
1676
|
g,
|
1677
1677
|
f,
|
1678
|
-
|
1678
|
+
_,
|
1679
1679
|
w,
|
1680
1680
|
V,
|
1681
1681
|
A,
|
1682
1682
|
W,
|
1683
1683
|
Q,
|
1684
|
-
|
1685
|
-
|
1684
|
+
ae = !0,
|
1685
|
+
U,
|
1686
1686
|
O,
|
1687
1687
|
Ee,
|
1688
|
-
|
1689
|
-
if ((u = mn(s, e)) >= 0)
|
1688
|
+
wi;
|
1689
|
+
if ((u = mn(s, e)) >= 0) _ = !0;else if ((u = fn(s, e)) >= 0) _ = !1;else return !1;
|
1690
1690
|
if (s.level >= s.options.maxNesting) return !1;
|
1691
1691
|
if (f = s.src.charCodeAt(u - 1), i) return !0;
|
1692
|
-
for (V = s.tokens.length,
|
1692
|
+
for (V = s.tokens.length, _ ? (d = s.bMarks[e] + s.tShift[e], g = Number(s.src.substr(d, u - d - 1)), s.tokens.push({
|
1693
1693
|
type: "ordered_list_open",
|
1694
1694
|
order: g,
|
1695
1695
|
lines: W = [e, 0],
|
@@ -1698,28 +1698,28 @@ function sr(s, e, t, i) {
|
|
1698
1698
|
type: "bullet_list_open",
|
1699
1699
|
lines: W = [e, 0],
|
1700
1700
|
level: s.level++
|
1701
|
-
}), n = e, A = !1,
|
1701
|
+
}), n = e, A = !1, U = s.parser.ruler.getRules("list"); n < t && (w = s.skipSpaces(u), p = s.eMarks[n], w >= p ? h = 1 : h = w - u, h > 4 && (h = 1), h < 1 && (h = 1), r = u - s.bMarks[n] + h, s.tokens.push({
|
1702
1702
|
type: "list_item_open",
|
1703
1703
|
lines: Q = [e, 0],
|
1704
1704
|
level: s.level++
|
1705
|
-
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = w - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || A) && (
|
1705
|
+
}), a = s.blkIndent, l = s.tight, o = s.tShift[e], c = s.parentType, s.tShift[e] = w - s.bMarks[e], s.blkIndent = r, s.tight = !0, s.parentType = "list", s.parser.tokenize(s, e, t, !0), (!s.tight || A) && (ae = !1), A = s.line - e > 1 && s.isEmpty(s.line - 1), s.blkIndent = a, s.tShift[e] = o, s.tight = l, s.parentType = c, s.tokens.push({
|
1706
1706
|
type: "list_item_close",
|
1707
1707
|
level: --s.level
|
1708
1708
|
}), n = e = s.line, Q[1] = n, w = s.bMarks[e], !(n >= t || s.isEmpty(n) || s.tShift[n] < s.blkIndent));) {
|
1709
|
-
for (
|
1710
|
-
|
1709
|
+
for (wi = !1, O = 0, Ee = U.length; O < Ee; O++) if (U[O](s, n, t, !0)) {
|
1710
|
+
wi = !0;
|
1711
1711
|
break;
|
1712
1712
|
}
|
1713
|
-
if (
|
1714
|
-
if (
|
1713
|
+
if (wi) break;
|
1714
|
+
if (_) {
|
1715
1715
|
if (u = mn(s, n), u < 0) break;
|
1716
1716
|
} else if (u = fn(s, n), u < 0) break;
|
1717
1717
|
if (f !== s.src.charCodeAt(u - 1)) break;
|
1718
1718
|
}
|
1719
1719
|
return s.tokens.push({
|
1720
|
-
type:
|
1720
|
+
type: _ ? "ordered_list_close" : "bullet_list_close",
|
1721
1721
|
level: --s.level
|
1722
|
-
}), W[1] = n, s.line = n,
|
1722
|
+
}), W[1] = n, s.line = n, ae && nr(s, V), !0;
|
1723
1723
|
}
|
1724
1724
|
function rr(s, e, t, i) {
|
1725
1725
|
var n,
|
@@ -1825,14 +1825,14 @@ function ur(s, e, t, i) {
|
|
1825
1825
|
content: s.getLines(e, o, 0, !0)
|
1826
1826
|
}), !0;
|
1827
1827
|
}
|
1828
|
-
function
|
1828
|
+
function Ci(s, e) {
|
1829
1829
|
var t = s.bMarks[e] + s.blkIndent,
|
1830
1830
|
i = s.eMarks[e];
|
1831
1831
|
return s.src.substr(t, i - t);
|
1832
1832
|
}
|
1833
1833
|
function hr(s, e, t, i) {
|
1834
1834
|
var n, r, o, a, l, c, d, u, p, h, g;
|
1835
|
-
if (e + 2 > t || (l = e + 1, s.tShift[l] < s.blkIndent) || (o = s.bMarks[l] + s.tShift[l], o >= s.eMarks[l]) || (n = s.src.charCodeAt(o), n !== 124 && n !== 45 && n !== 58) || (r =
|
1835
|
+
if (e + 2 > t || (l = e + 1, s.tShift[l] < s.blkIndent) || (o = s.bMarks[l] + s.tShift[l], o >= s.eMarks[l]) || (n = s.src.charCodeAt(o), n !== 124 && n !== 45 && n !== 58) || (r = Ci(s, e + 1), !/^[-:| ]+$/.test(r)) || (c = r.split("|"), c <= 2)) return !1;
|
1836
1836
|
for (u = [], a = 0; a < c.length; a++) {
|
1837
1837
|
if (p = c[a].trim(), !p) {
|
1838
1838
|
if (a === 0 || a === c.length - 1) continue;
|
@@ -1841,7 +1841,7 @@ function hr(s, e, t, i) {
|
|
1841
1841
|
if (!/^:?-+:?$/.test(p)) return !1;
|
1842
1842
|
p.charCodeAt(p.length - 1) === 58 ? u.push(p.charCodeAt(0) === 58 ? "center" : "right") : p.charCodeAt(0) === 58 ? u.push("left") : u.push("");
|
1843
1843
|
}
|
1844
|
-
if (r =
|
1844
|
+
if (r = Ci(s, e).trim(), r.indexOf("|") === -1 || (c = r.replace(/^\||\|$/g, "").split("|"), u.length !== c.length)) return !1;
|
1845
1845
|
if (i) return !0;
|
1846
1846
|
for (s.tokens.push({
|
1847
1847
|
type: "table_open",
|
@@ -1880,7 +1880,7 @@ function hr(s, e, t, i) {
|
|
1880
1880
|
type: "tbody_open",
|
1881
1881
|
lines: g = [e + 2, 0],
|
1882
1882
|
level: s.level++
|
1883
|
-
}), l = e + 2; l < t && !(s.tShift[l] < s.blkIndent || (r =
|
1883
|
+
}), l = e + 2; l < t && !(s.tShift[l] < s.blkIndent || (r = Ci(s, l).trim(), r.indexOf("|") === -1)); l++) {
|
1884
1884
|
for (c = r.replace(/^\||\|$/g, "").split("|"), s.tokens.push({
|
1885
1885
|
type: "tr_open",
|
1886
1886
|
level: s.level++
|
@@ -1924,7 +1924,7 @@ function pr(s, e) {
|
|
1924
1924
|
for (t = e + 2, i = s.tokens.length - 2; t < i; t++) s.tokens[t].level === n && s.tokens[t].type === "paragraph_open" && (s.tokens[t + 2].tight = !0, s.tokens[t].tight = !0, t += 2);
|
1925
1925
|
}
|
1926
1926
|
function fr(s, e, t, i) {
|
1927
|
-
var n, r, o, a, l, c, d, u, p, h, g, f,
|
1927
|
+
var n, r, o, a, l, c, d, u, p, h, g, f, _, w;
|
1928
1928
|
if (i) return s.ddIndent < 0 ? !1 : Nt(s, e) >= 0;
|
1929
1929
|
if (d = e + 1, s.isEmpty(d) && ++d > t || s.tShift[d] < s.blkIndent || (n = Nt(s, d), n < 0) || s.level >= s.options.maxNesting) return !1;
|
1930
1930
|
c = s.tokens.length, s.tokens.push({
|
@@ -1933,7 +1933,7 @@ function fr(s, e, t, i) {
|
|
1933
1933
|
level: s.level++
|
1934
1934
|
}), o = e, r = d;
|
1935
1935
|
e: for (;;) {
|
1936
|
-
for (w = !0,
|
1936
|
+
for (w = !0, _ = !1, s.tokens.push({
|
1937
1937
|
type: "dt_open",
|
1938
1938
|
lines: [o, o],
|
1939
1939
|
level: s.level++
|
@@ -1951,7 +1951,7 @@ function fr(s, e, t, i) {
|
|
1951
1951
|
type: "dd_open",
|
1952
1952
|
lines: a = [d, 0],
|
1953
1953
|
level: s.level++
|
1954
|
-
}), f = s.tight, p = s.ddIndent, u = s.blkIndent, g = s.tShift[r], h = s.parentType, s.blkIndent = s.ddIndent = s.tShift[r] + 2, s.tShift[r] = n - s.bMarks[r], s.tight = !0, s.parentType = "deflist", s.parser.tokenize(s, r, t, !0), (!s.tight ||
|
1954
|
+
}), f = s.tight, p = s.ddIndent, u = s.blkIndent, g = s.tShift[r], h = s.parentType, s.blkIndent = s.ddIndent = s.tShift[r] + 2, s.tShift[r] = n - s.bMarks[r], s.tight = !0, s.parentType = "deflist", s.parser.tokenize(s, r, t, !0), (!s.tight || _) && (w = !1), _ = s.line - r > 1 && s.isEmpty(s.line - 1), s.tShift[r] = g, s.tight = f, s.parentType = h, s.blkIndent = u, s.ddIndent = p, s.tokens.push({
|
1955
1955
|
type: "dd_close",
|
1956
1956
|
level: --s.level
|
1957
1957
|
}), a[1] = d = s.line, d >= t || s.tShift[d] < s.blkIndent) break e;
|
@@ -2000,13 +2000,13 @@ function mr(s, e) {
|
|
2000
2000
|
})), !0;
|
2001
2001
|
}
|
2002
2002
|
var Ot = [["code", Qs], ["fences", er, ["paragraph", "blockquote", "list"]], ["blockquote", tr, ["paragraph", "blockquote", "list"]], ["hr", ir, ["paragraph", "blockquote", "list"]], ["list", sr, ["paragraph", "blockquote"]], ["footnote", rr, ["paragraph"]], ["heading", or, ["paragraph", "blockquote"]], ["lheading", ar], ["htmlblock", ur, ["paragraph", "blockquote"]], ["table", hr, ["paragraph"]], ["deflist", fr, ["paragraph"]], ["paragraph", mr]];
|
2003
|
-
function
|
2003
|
+
function Ki() {
|
2004
2004
|
this.ruler = new G();
|
2005
2005
|
for (var s = 0; s < Ot.length; s++) this.ruler.push(Ot[s][0], Ot[s][1], {
|
2006
2006
|
alt: (Ot[s][2] || []).slice()
|
2007
2007
|
});
|
2008
2008
|
}
|
2009
|
-
|
2009
|
+
Ki.prototype.tokenize = function (s, e, t) {
|
2010
2010
|
for (var i = this.ruler.getRules(""), n = i.length, r = e, o = !1, a, l; r < t && (s.line = r = s.skipEmptyLines(r), !(r >= t || s.tShift[r] < s.blkIndent));) {
|
2011
2011
|
for (l = 0; l < n && (a = i[l](s, r, t, !1), !a); l++);
|
2012
2012
|
if (s.tight = !o, s.isEmpty(s.line - 1) && (o = !0), r = s.line, r < t && s.isEmpty(r)) {
|
@@ -2018,7 +2018,7 @@ Wi.prototype.tokenize = function (s, e, t) {
|
|
2018
2018
|
var gr = /[\n\t]/g,
|
2019
2019
|
br = /\r[\n\u0085]|[\u2424\u2028\u0085]/g,
|
2020
2020
|
vr = /\u00a0/g;
|
2021
|
-
|
2021
|
+
Ki.prototype.parse = function (s, e, t, i) {
|
2022
2022
|
var n,
|
2023
2023
|
r = 0,
|
2024
2024
|
o = 0;
|
@@ -2086,18 +2086,18 @@ function Er(s, e) {
|
|
2086
2086
|
for (n++; n < i && s.src.charCodeAt(n) === 32;) n++;
|
2087
2087
|
return s.pos = n, !0;
|
2088
2088
|
}
|
2089
|
-
var
|
2090
|
-
for (var gn = 0; gn < 256; gn++)
|
2089
|
+
var Ji = [];
|
2090
|
+
for (var gn = 0; gn < 256; gn++) Ji.push(0);
|
2091
2091
|
"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function (s) {
|
2092
|
-
|
2092
|
+
Ji[s.charCodeAt(0)] = 1;
|
2093
2093
|
});
|
2094
|
-
function
|
2094
|
+
function _r(s, e) {
|
2095
2095
|
var t,
|
2096
2096
|
i = s.pos,
|
2097
2097
|
n = s.posMax;
|
2098
2098
|
if (s.src.charCodeAt(i) !== 92) return !1;
|
2099
2099
|
if (i++, i < n) {
|
2100
|
-
if (t = s.src.charCodeAt(i), t < 256 &&
|
2100
|
+
if (t = s.src.charCodeAt(i), t < 256 && Ji[t] !== 0) return e || (s.pending += s.src[i]), s.pos += 2, !0;
|
2101
2101
|
if (t === 10) {
|
2102
2102
|
for (e || s.push({
|
2103
2103
|
type: "hardbreak",
|
@@ -2129,7 +2129,7 @@ function wr(s, e) {
|
|
2129
2129
|
}
|
2130
2130
|
return e || (s.pending += n), s.pos += n.length, !0;
|
2131
2131
|
}
|
2132
|
-
function
|
2132
|
+
function Sr(s, e) {
|
2133
2133
|
var t,
|
2134
2134
|
i,
|
2135
2135
|
n,
|
@@ -2408,7 +2408,7 @@ function Fr(s, e) {
|
|
2408
2408
|
r,
|
2409
2409
|
o,
|
2410
2410
|
a = s.pos;
|
2411
|
-
return s.src.charCodeAt(a) !== 60 || (t = s.src.slice(a), t.indexOf(">") < 0) ? !1 : (i = t.match(jr), i ? Pr.indexOf(i[1].toLowerCase()) < 0 || (r = i[0].slice(1, -1), o =
|
2411
|
+
return s.src.charCodeAt(a) !== 60 || (t = s.src.slice(a), t.indexOf(">") < 0) ? !1 : (i = t.match(jr), i ? Pr.indexOf(i[1].toLowerCase()) < 0 || (r = i[0].slice(1, -1), o = ji(r), !s.parser.validateLink(r)) ? !1 : (e || (s.push({
|
2412
2412
|
type: "link_open",
|
2413
2413
|
href: o,
|
2414
2414
|
level: s.level
|
@@ -2419,7 +2419,7 @@ function Fr(s, e) {
|
|
2419
2419
|
}), s.push({
|
2420
2420
|
type: "link_close",
|
2421
2421
|
level: s.level
|
2422
|
-
})), s.pos += i[0].length, !0) : (n = t.match(Dr), n ? (r = n[0].slice(1, -1), o =
|
2422
|
+
})), s.pos += i[0].length, !0) : (n = t.match(Dr), n ? (r = n[0].slice(1, -1), o = ji("mailto:" + r), s.parser.validateLink(o) ? (e || (s.push({
|
2423
2423
|
type: "link_open",
|
2424
2424
|
href: o,
|
2425
2425
|
level: s.level
|
@@ -2439,9 +2439,9 @@ function ni(s, e) {
|
|
2439
2439
|
}
|
2440
2440
|
var Br = /[a-zA-Z_:][a-zA-Z0-9:._-]*/,
|
2441
2441
|
zr = /[^"'=<>`\x00-\x20]+/,
|
2442
|
-
|
2443
|
-
|
2444
|
-
Hr = ni(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", zr)("single_quoted",
|
2442
|
+
qr = /'[^']*'/,
|
2443
|
+
Ur = /"[^"]*"/,
|
2444
|
+
Hr = ni(/(?:unquoted|single_quoted|double_quoted)/)("unquoted", zr)("single_quoted", qr)("double_quoted", Ur)(),
|
2445
2445
|
Gr = ni(/(?:\s+attr_name(?:\s*=\s*attr_value)?)/)("attr_name", Br)("attr_value", Hr)(),
|
2446
2446
|
Vr = ni(/<[A-Za-z][A-Za-z0-9]*attribute*\s*\/?>/)("attribute", Gr)(),
|
2447
2447
|
Wr = /<\/[A-Za-z][A-Za-z0-9]*\s*>/,
|
@@ -2476,7 +2476,7 @@ function io(s, e) {
|
|
2476
2476
|
if (s.src.charCodeAt(r) !== 38) return !1;
|
2477
2477
|
if (r + 1 < o) {
|
2478
2478
|
if (t = s.src.charCodeAt(r + 1), t === 35) {
|
2479
|
-
if (n = s.src.slice(r).match(eo), n) return e || (i = n[1][0].toLowerCase() === "x" ? parseInt(n[1].slice(1), 16) : parseInt(n[1], 10), s.pending += $n(i) ?
|
2479
|
+
if (n = s.src.slice(r).match(eo), n) return e || (i = n[1][0].toLowerCase() === "x" ? parseInt(n[1].slice(1), 16) : parseInt(n[1], 10), s.pending += $n(i) ? Di(i) : Di(65533)), s.pos += n[0].length, !0;
|
2480
2480
|
} else if (n = s.src.slice(r).match(to), n) {
|
2481
2481
|
var a = Kn(n[1]);
|
2482
2482
|
if (n[1] !== a) return e || (s.pending += a), s.pos += n[0].length, !0;
|
@@ -2484,10 +2484,10 @@ function io(s, e) {
|
|
2484
2484
|
}
|
2485
2485
|
return e || (s.pending += "&"), s.pos++, !0;
|
2486
2486
|
}
|
2487
|
-
var
|
2487
|
+
var Ai = [["text", xr], ["newline", Er], ["escape", _r], ["backticks", wr], ["del", Sr], ["ins", Mr], ["mark", Tr], ["emphasis", Cr], ["sub", kr], ["sup", Lr], ["links", Rr], ["footnote_inline", Nr], ["footnote_ref", Or], ["autolink", Fr], ["htmltag", Qr], ["entity", io]];
|
2488
2488
|
function si() {
|
2489
2489
|
this.ruler = new G();
|
2490
|
-
for (var s = 0; s <
|
2490
|
+
for (var s = 0; s < Ai.length; s++) this.ruler.push(Ai[s][0], Ai[s][1]);
|
2491
2491
|
this.validateLink = no;
|
2492
2492
|
}
|
2493
2493
|
si.prototype.skipToken = function (s) {
|
@@ -2644,7 +2644,7 @@ function is(s, e, t) {
|
|
2644
2644
|
this.src = e, this.env = t, this.options = s.options, this.tokens = [], this.inlineMode = !1, this.inline = s.inline, this.block = s.block, this.renderer = s.renderer, this.typographer = s.typographer;
|
2645
2645
|
}
|
2646
2646
|
function he(s, e) {
|
2647
|
-
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new
|
2647
|
+
typeof s != "string" && (e = s, s = "default"), e && e.linkify != null && console.warn("linkify option is removed. Use linkify plugin instead:\n\nimport Remarkable from 'remarkable';\nimport linkify from 'remarkable/linkify';\nnew Remarkable().use(linkify)\n"), this.inline = new si(), this.block = new Ki(), this.core = new es(), this.renderer = new Wi(), this.ruler = new G(), this.options = {}, this.configure(ao[s]), this.set(e || {});
|
2648
2648
|
}
|
2649
2649
|
he.prototype.set = function (s) {
|
2650
2650
|
Jn(this.options, s);
|
@@ -2795,7 +2795,7 @@ var ns = /*#__PURE__*/function () {
|
|
2795
2795
|
return Ge;
|
2796
2796
|
}();
|
2797
2797
|
ns.DEFAULT_FILE_NAME = "file";
|
2798
|
-
var
|
2798
|
+
var se = ns;
|
2799
2799
|
var Bt = /*#__PURE__*/function () {
|
2800
2800
|
function Bt() {
|
2801
2801
|
_classCallCheck(this, Bt);
|
@@ -2808,7 +2808,7 @@ var Bt = /*#__PURE__*/function () {
|
|
2808
2808
|
message: t,
|
2809
2809
|
isInitial: i
|
2810
2810
|
}));
|
2811
|
-
|
2811
|
+
se.reAddFileRefToObject(t, n), (r = e.onNewMessage) == null || r.call(e, n), e.dispatchEvent(new CustomEvent("new-message", {
|
2812
2812
|
detail: n
|
2813
2813
|
}));
|
2814
2814
|
}
|
@@ -2822,7 +2822,9 @@ var Bt = /*#__PURE__*/function () {
|
|
2822
2822
|
key: "onRender",
|
2823
2823
|
value: function onRender(e) {
|
2824
2824
|
var t;
|
2825
|
-
(t = e.onComponentRender) == null || t.call(e), e.dispatchEvent(new CustomEvent("render"
|
2825
|
+
(t = e.onComponentRender) == null || t.call(e, e), e.dispatchEvent(new CustomEvent("render", {
|
2826
|
+
detail: e
|
2827
|
+
}));
|
2826
2828
|
}
|
2827
2829
|
}, {
|
2828
2830
|
key: "onError",
|
@@ -3112,7 +3114,7 @@ var $e = /*#__PURE__*/function () {
|
|
3112
3114
|
}]);
|
3113
3115
|
return $e;
|
3114
3116
|
}();
|
3115
|
-
var
|
3117
|
+
var $i = /*#__PURE__*/function () {
|
3116
3118
|
// used for extracting at end and for isStreaming
|
3117
3119
|
function ot(e) {
|
3118
3120
|
_classCallCheck(this, ot);
|
@@ -3171,14 +3173,14 @@ var Ji = /*#__PURE__*/function () {
|
|
3171
3173
|
var n = {
|
3172
3174
|
role: this._activeMessageRole || v.AI_ROLE
|
3173
3175
|
};
|
3174
|
-
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements &&
|
3176
|
+
this._streamType === "text" ? (e[e.length - 1][1] = this._streamedContent, n.text = this._streamedContent, this._messages.textToSpeech && jt.speak(this._streamedContent, this._messages.textToSpeech)) : this._streamType === "html" && (this._streamedContent === ot.HTML_CONTENT_PLACEHOLDER && (this._streamedContent = ((o = v.getLastMessageBubbleElement(t)) == null ? void 0 : o.innerHTML) || ""), this._elements && re.apply(this._messages, this._elements.outerContainer), n.html = this._streamedContent), n && (this._messages.messages.push(n), this._messages.sendClientUpdate($e.createMessageContent(n), !1)), this._hasStreamEnded = !0;
|
3175
3177
|
}
|
3176
3178
|
}]);
|
3177
3179
|
return ot;
|
3178
3180
|
}();
|
3179
|
-
|
3180
|
-
|
3181
|
-
var Qe =
|
3181
|
+
$i.MESSAGE_CLASS = "streamed-message";
|
3182
|
+
$i.HTML_CONTENT_PLACEHOLDER = "htmlplaceholder";
|
3183
|
+
var Qe = $i;
|
3182
3184
|
var ss = /*#__PURE__*/function () {
|
3183
3185
|
function at() {
|
3184
3186
|
_classCallCheck(this, at);
|
@@ -3313,29 +3315,29 @@ function uo(_x10, _x11) {
|
|
3313
3315
|
return _uo.apply(this, arguments);
|
3314
3316
|
}
|
3315
3317
|
function _uo() {
|
3316
|
-
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
3318
|
+
_uo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee107(s, e) {
|
3317
3319
|
var t, i;
|
3318
|
-
return _regeneratorRuntime().wrap(function
|
3319
|
-
while (1) switch (
|
3320
|
+
return _regeneratorRuntime().wrap(function _callee107$(_context107) {
|
3321
|
+
while (1) switch (_context107.prev = _context107.next) {
|
3320
3322
|
case 0:
|
3321
3323
|
t = s.getReader();
|
3322
3324
|
case 1:
|
3323
|
-
|
3325
|
+
_context107.next = 3;
|
3324
3326
|
return t.read();
|
3325
3327
|
case 3:
|
3326
|
-
if ((i =
|
3327
|
-
|
3328
|
+
if ((i = _context107.sent).done) {
|
3329
|
+
_context107.next = 7;
|
3328
3330
|
break;
|
3329
3331
|
}
|
3330
3332
|
e(i.value);
|
3331
3333
|
case 5:
|
3332
|
-
|
3334
|
+
_context107.next = 1;
|
3333
3335
|
break;
|
3334
3336
|
case 7:
|
3335
3337
|
case "end":
|
3336
|
-
return
|
3338
|
+
return _context107.stop();
|
3337
3339
|
}
|
3338
|
-
},
|
3340
|
+
}, _callee107);
|
3339
3341
|
}));
|
3340
3342
|
return _uo.apply(this, arguments);
|
3341
3343
|
}
|
@@ -3411,7 +3413,7 @@ var mo = globalThis && globalThis.__rest || function (s, e) {
|
|
3411
3413
|
if (s != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, i = Object.getOwnPropertySymbols(s); n < i.length; n++) e.indexOf(i[n]) < 0 && Object.prototype.propertyIsEnumerable.call(s, i[n]) && (t[i[n]] = s[i[n]]);
|
3412
3414
|
return t;
|
3413
3415
|
};
|
3414
|
-
var
|
3416
|
+
var Fi = "text/event-stream",
|
3415
3417
|
go = 1e3,
|
3416
3418
|
xn = "last-event-id";
|
3417
3419
|
function bo(s, e) {
|
@@ -3426,13 +3428,13 @@ function bo(s, e) {
|
|
3426
3428
|
d = mo(e, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
3427
3429
|
return new Promise(function (u, p) {
|
3428
3430
|
var h = Object.assign({}, i);
|
3429
|
-
h.accept || (h.accept =
|
3431
|
+
h.accept || (h.accept = Fi);
|
3430
3432
|
var g;
|
3431
3433
|
function f() {
|
3432
3434
|
g.abort(), document.hidden || Q();
|
3433
3435
|
}
|
3434
3436
|
l || document.addEventListener("visibilitychange", f);
|
3435
|
-
var
|
3437
|
+
var _ = go,
|
3436
3438
|
w = 0;
|
3437
3439
|
function V() {
|
3438
3440
|
document.removeEventListener("visibilitychange", f), window.clearTimeout(w), g.abort();
|
@@ -3447,7 +3449,7 @@ function bo(s, e) {
|
|
3447
3449
|
}
|
3448
3450
|
function _Q() {
|
3449
3451
|
_Q = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
3450
|
-
var
|
3452
|
+
var ae, U, O;
|
3451
3453
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
3452
3454
|
while (1) switch (_context3.prev = _context3.next) {
|
3453
3455
|
case 0:
|
@@ -3459,15 +3461,15 @@ function bo(s, e) {
|
|
3459
3461
|
signal: g.signal
|
3460
3462
|
}));
|
3461
3463
|
case 4:
|
3462
|
-
|
3464
|
+
U = _context3.sent;
|
3463
3465
|
_context3.next = 7;
|
3464
|
-
return W(
|
3466
|
+
return W(U);
|
3465
3467
|
case 7:
|
3466
3468
|
_context3.next = 9;
|
3467
|
-
return uo(
|
3469
|
+
return uo(U.body, ho(po(function (O) {
|
3468
3470
|
O ? h[xn] = O : delete h[xn];
|
3469
3471
|
}, function (O) {
|
3470
|
-
|
3472
|
+
_ = O;
|
3471
3473
|
}, r)));
|
3472
3474
|
case 9:
|
3473
3475
|
o == null || o();
|
@@ -3479,7 +3481,7 @@ function bo(s, e) {
|
|
3479
3481
|
_context3.prev = 14;
|
3480
3482
|
_context3.t0 = _context3["catch"](1);
|
3481
3483
|
if (!g.signal.aborted) try {
|
3482
|
-
O = (
|
3484
|
+
O = (ae = a == null ? void 0 : a(_context3.t0)) !== null && ae !== void 0 ? ae : _;
|
3483
3485
|
window.clearTimeout(w), w = window.setTimeout(Q, O);
|
3484
3486
|
} catch (O) {
|
3485
3487
|
V(), p(O);
|
@@ -3497,7 +3499,7 @@ function bo(s, e) {
|
|
3497
3499
|
}
|
3498
3500
|
function vo(s) {
|
3499
3501
|
var e = s.headers.get("content-type");
|
3500
|
-
if (!(e != null && e.startsWith(
|
3502
|
+
if (!(e != null && e.startsWith(Fi))) throw new Error("Expected content-type to be ".concat(Fi, ", Actual: ").concat(e));
|
3501
3503
|
}
|
3502
3504
|
var rs = /*#__PURE__*/function () {
|
3503
3505
|
function lt() {
|
@@ -3586,7 +3588,7 @@ var I = /*#__PURE__*/function () {
|
|
3586
3588
|
h,
|
3587
3589
|
g,
|
3588
3590
|
f,
|
3589
|
-
|
3591
|
+
_,
|
3590
3592
|
w,
|
3591
3593
|
V,
|
3592
3594
|
r,
|
@@ -3638,7 +3640,7 @@ var I = /*#__PURE__*/function () {
|
|
3638
3640
|
return _context7.abrupt("return", ye.requestStream(i, e.streamHandlers));
|
3639
3641
|
case 18:
|
3640
3642
|
p = new Qe(i);
|
3641
|
-
bo(((
|
3643
|
+
bo(((_ = e.requestSettings) == null ? void 0 : _.url) || e.url || "", {
|
3642
3644
|
method: ((w = e.requestSettings) == null ? void 0 : w.method) || "POST",
|
3643
3645
|
headers: a,
|
3644
3646
|
credentials: (V = e.requestSettings) == null ? void 0 : V.credentials,
|
@@ -3669,7 +3671,7 @@ var I = /*#__PURE__*/function () {
|
|
3669
3671
|
},
|
3670
3672
|
onmessage: function onmessage(A) {
|
3671
3673
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
3672
|
-
var W, Q,
|
3674
|
+
var W, Q, ae, U, O;
|
3673
3675
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
3674
3676
|
while (1) switch (_context6.prev = _context6.next) {
|
3675
3677
|
case 0:
|
@@ -3678,22 +3680,22 @@ var I = /*#__PURE__*/function () {
|
|
3678
3680
|
break;
|
3679
3681
|
}
|
3680
3682
|
try {
|
3681
|
-
|
3683
|
+
U = JSON.parse(A.data);
|
3682
3684
|
} catch (_unused6) {
|
3683
|
-
|
3685
|
+
U = {};
|
3684
3686
|
}
|
3685
3687
|
_context6.next = 4;
|
3686
|
-
return (Q = (W = e.deepChat).responseInterceptor) == null ? void 0 : Q.call(W,
|
3688
|
+
return (Q = (W = e.deepChat).responseInterceptor) == null ? void 0 : Q.call(W, U);
|
3687
3689
|
case 4:
|
3688
3690
|
_context6.t0 = _context6.sent;
|
3689
3691
|
if (_context6.t0) {
|
3690
3692
|
_context6.next = 7;
|
3691
3693
|
break;
|
3692
3694
|
}
|
3693
|
-
_context6.t0 =
|
3695
|
+
_context6.t0 = U;
|
3694
3696
|
case 7:
|
3695
3697
|
O = _context6.t0;
|
3696
|
-
(
|
3698
|
+
(ae = e.extractResultData) == null || ae.call(e, O).then(function (Ee) {
|
3697
3699
|
p.upsertStreamedMessage(Ee);
|
3698
3700
|
})["catch"](function (Ee) {
|
3699
3701
|
return E.displayError(i, Ee);
|
@@ -3940,11 +3942,11 @@ var Ie = /*#__PURE__*/function () {
|
|
3940
3942
|
}]);
|
3941
3943
|
return Ie;
|
3942
3944
|
}();
|
3943
|
-
var
|
3944
|
-
function
|
3945
|
-
_classCallCheck(this,
|
3945
|
+
var S = /*#__PURE__*/function () {
|
3946
|
+
function S() {
|
3947
|
+
_classCallCheck(this, S);
|
3946
3948
|
}
|
3947
|
-
_createClass(
|
3949
|
+
_createClass(S, null, [{
|
3948
3950
|
key: "request",
|
3949
3951
|
value: // prettier-ignore
|
3950
3952
|
function () {
|
@@ -4004,7 +4006,7 @@ var _ = /*#__PURE__*/function () {
|
|
4004
4006
|
return E.processResponseByType(f);
|
4005
4007
|
}).then( /*#__PURE__*/function () {
|
4006
4008
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(f) {
|
4007
|
-
var V, A,
|
4009
|
+
var V, A, _, w;
|
4008
4010
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
4009
4011
|
while (1) switch (_context11.prev = _context11.next) {
|
4010
4012
|
case 0:
|
@@ -4024,9 +4026,9 @@ var _ = /*#__PURE__*/function () {
|
|
4024
4026
|
}
|
4025
4027
|
_context11.t0 = f;
|
4026
4028
|
case 7:
|
4027
|
-
|
4029
|
+
_ = _context11.t0;
|
4028
4030
|
_context11.next = 10;
|
4029
|
-
return e.extractResultData(
|
4031
|
+
return e.extractResultData(_, u, o);
|
4030
4032
|
case 10:
|
4031
4033
|
w = _context11.sent;
|
4032
4034
|
if (d) {
|
@@ -4039,7 +4041,7 @@ var _ = /*#__PURE__*/function () {
|
|
4039
4041
|
_context11.next = 15;
|
4040
4042
|
break;
|
4041
4043
|
}
|
4042
|
-
throw Error(C.INVALID_RESPONSE(f, "response", !!e.deepChat.responseInterceptor,
|
4044
|
+
throw Error(C.INVALID_RESPONSE(f, "response", !!e.deepChat.responseInterceptor, _));
|
4043
4045
|
case 15:
|
4044
4046
|
w.makingAnotherRequest || (I.isSimulation(e.deepChat.stream) ? I.simulate(i, e.streamHandlers, w) : (i.addNewMessage(w), c()));
|
4045
4047
|
case 16:
|
@@ -4100,7 +4102,7 @@ var _ = /*#__PURE__*/function () {
|
|
4100
4102
|
case 11:
|
4101
4103
|
a = _context13.sent;
|
4102
4104
|
a.timeoutMS ? setTimeout(function () {
|
4103
|
-
|
4105
|
+
S.executePollRequest(e, t, i, n);
|
4104
4106
|
}, a.timeoutMS) : I.isSimulation(e.deepChat.stream) ? I.simulate(n, e.streamHandlers, a) : (n.addNewMessage(a), r());
|
4105
4107
|
case 13:
|
4106
4108
|
case "end":
|
@@ -4160,7 +4162,7 @@ var _ = /*#__PURE__*/function () {
|
|
4160
4162
|
body: u,
|
4161
4163
|
headers: a
|
4162
4164
|
};
|
4163
|
-
e.requestSettings.credentials && (p.credentials = e.requestSettings.credentials),
|
4165
|
+
e.requestSettings.credentials && (p.credentials = e.requestSettings.credentials), S.executePollRequest(e, c, p, i);
|
4164
4166
|
case 12:
|
4165
4167
|
case "end":
|
4166
4168
|
return _context14.stop();
|
@@ -4189,7 +4191,7 @@ var _ = /*#__PURE__*/function () {
|
|
4189
4191
|
});
|
4190
4192
|
}
|
4191
4193
|
}]);
|
4192
|
-
return
|
4194
|
+
return S;
|
4193
4195
|
}();
|
4194
4196
|
var et = /*#__PURE__*/function () {
|
4195
4197
|
function et() {
|
@@ -4543,7 +4545,7 @@ var Ne = /*#__PURE__*/function () {
|
|
4543
4545
|
case 0:
|
4544
4546
|
i = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : !0;
|
4545
4547
|
n = this.deepChat.stream;
|
4546
|
-
return _context17.abrupt("return", n && !I.isSimulation(n) ? I.request(this, e, t) :
|
4548
|
+
return _context17.abrupt("return", n && !I.isSimulation(n) ? I.request(this, e, t) : S.request(this, e, t, i));
|
4547
4549
|
case 3:
|
4548
4550
|
case "end":
|
4549
4551
|
return _context17.stop();
|
@@ -4729,18 +4731,17 @@ var Ne = /*#__PURE__*/function () {
|
|
4729
4731
|
}]);
|
4730
4732
|
return Ne;
|
4731
4733
|
}();
|
4732
|
-
var
|
4733
|
-
_inherits(
|
4734
|
-
var _super = _createSuper(U);
|
4734
|
+
var q = /*#__PURE__*/function (_Ne) {
|
4735
|
+
_inherits(q, _Ne);
|
4735
4736
|
// prettier-ignore
|
4736
|
-
function
|
4737
|
+
function q(e, t, i, n, r) {
|
4737
4738
|
var _this6;
|
4738
|
-
_classCallCheck(this,
|
4739
|
+
_classCallCheck(this, q);
|
4739
4740
|
var o;
|
4740
|
-
_this6 =
|
4741
|
+
_this6 = _callSuper(this, q, [e, r]), _this6.insertKeyPlaceholderText = "API Key", _this6.getKeyLink = "", Object.assign(_this6.rawBody, (o = e.request) == null ? void 0 : o.additionalBodyProps), _this6.keyVerificationDetails = t, _this6.buildHeadersFunc = i, n && _this6.setApiKeyProperties(n), _this6.requestSettings = _this6.buildRequestSettings(_this6.key || "", e.request);
|
4741
4742
|
return _this6;
|
4742
4743
|
}
|
4743
|
-
_createClass(
|
4744
|
+
_createClass(q, [{
|
4744
4745
|
key: "setApiKeyProperties",
|
4745
4746
|
value: function setApiKeyProperties(e) {
|
4746
4747
|
this.key = e.key, e.validateKeyProperty && (this.validateConfigKey = e.validateKeyProperty);
|
@@ -4768,7 +4769,7 @@ var U = /*#__PURE__*/function (_Ne) {
|
|
4768
4769
|
o = _this$keyVerification.createHeaders,
|
4769
4770
|
a = _this$keyVerification.body,
|
4770
4771
|
l = (o == null ? void 0 : o(e)) || this.buildHeadersFunc(e);
|
4771
|
-
|
4772
|
+
S.verifyKey(e, i, l, n, this.keyAuthenticated.bind(this, t.onSuccess), t.onFail, t.onLoad, r, a);
|
4772
4773
|
}
|
4773
4774
|
}, {
|
4774
4775
|
key: "isDirectConnection",
|
@@ -4776,7 +4777,7 @@ var U = /*#__PURE__*/function (_Ne) {
|
|
4776
4777
|
return !0;
|
4777
4778
|
}
|
4778
4779
|
}]);
|
4779
|
-
return
|
4780
|
+
return q;
|
4780
4781
|
}(Ne);
|
4781
4782
|
var zt = /*#__PURE__*/function () {
|
4782
4783
|
function zt() {
|
@@ -4797,14 +4798,13 @@ var zt = /*#__PURE__*/function () {
|
|
4797
4798
|
}]);
|
4798
4799
|
return zt;
|
4799
4800
|
}();
|
4800
|
-
var
|
4801
|
+
var Yi = /*#__PURE__*/function (_HTMLElement) {
|
4801
4802
|
_inherits(Ve, _HTMLElement);
|
4802
|
-
var _super2 = _createSuper(Ve);
|
4803
4803
|
// If this is not working, try using propertyName directly
|
4804
4804
|
function Ve() {
|
4805
4805
|
var _this7;
|
4806
4806
|
_classCallCheck(this, Ve);
|
4807
|
-
_this7 =
|
4807
|
+
_this7 = _callSuper(this, Ve), _this7._waitingToRender_ = !1, _this7._propUpdated_ = !1, Object.keys(Ve._attributeToProperty_).forEach(function (e) {
|
4808
4808
|
var t = Ve._attributeToProperty_[e];
|
4809
4809
|
_this7.constructPropertyAccessors(t), _this7.hasOwnProperty(e) || _this7.constructPropertyAccessors(t, e);
|
4810
4810
|
});
|
@@ -4844,9 +4844,9 @@ var $i = /*#__PURE__*/function (_HTMLElement) {
|
|
4844
4844
|
}]);
|
4845
4845
|
return Ve;
|
4846
4846
|
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
|
4847
|
-
|
4848
|
-
|
4849
|
-
var yo =
|
4847
|
+
Yi._attributes_ = {};
|
4848
|
+
Yi._attributeToProperty_ = {};
|
4849
|
+
var yo = Yi;
|
4850
4850
|
var xo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path d=\"\n\t\t\tM669.727,273.516c-22.891-2.476-46.15-3.895-69.727-4.248c-103.025,0.457-209.823,25.517-310.913,73.536\n\t\t\tc-75.058,37.122-148.173,89.529-211.67,154.174C46.232,529.978,6.431,577.76,0,628.74c0.76,44.162,48.153,98.67,77.417,131.764\n\t\t\tc59.543,62.106,130.754,113.013,211.67,154.174c2.75,1.335,5.51,2.654,8.276,3.955l-75.072,131.102l102.005,60.286l551.416-960.033\n\t\t\tl-98.186-60.008L669.727,273.516z M902.563,338.995l-74.927,129.857c34.47,44.782,54.932,100.006,54.932,159.888\n\t\t\tc0,149.257-126.522,270.264-282.642,270.264c-6.749,0-13.29-0.728-19.922-1.172l-49.585,85.84c22.868,2.449,45.99,4.233,69.58,4.541\n\t\t\tc103.123-0.463,209.861-25.812,310.84-73.535c75.058-37.122,148.246-89.529,211.743-154.174\n\t\t\tc31.186-32.999,70.985-80.782,77.417-131.764c-0.76-44.161-48.153-98.669-77.417-131.763\n\t\t\tc-59.543-62.106-130.827-113.013-211.743-154.175C908.108,341.478,905.312,340.287,902.563,338.995L902.563,338.995z\n\t\t\tM599.927,358.478c6.846,0,13.638,0.274,20.361,0.732l-58.081,100.561c-81.514,16.526-142.676,85.88-142.676,168.897\n\t\t\tc0,20.854,3.841,40.819,10.913,59.325c0.008,0.021-0.008,0.053,0,0.074l-58.228,100.854\n\t\t\tc-34.551-44.823-54.932-100.229-54.932-160.182C317.285,479.484,443.808,358.477,599.927,358.478L599.927,358.478z M768.896,570.513\n\t\t\tL638.013,797.271c81.076-16.837,141.797-85.875,141.797-168.603C779.81,608.194,775.724,588.729,768.896,570.513L768.896,570.513z\"\n\t\t\t/>\n</svg>\n",
|
4851
4851
|
Eo = "<?xml version=\"1.0\" standalone=\"no\"?>\n<svg version=\"1.1\"\n\txmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\" xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n\txmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"0.9em\" height=\"0.9em\"\n\tviewBox=\"0 0 1200 1200\" enable-background=\"new 0 0 1200 1200\">\n\t\t<path id=\"path6686\" inkscape:connector-curvature=\"0\" d=\"M779.843,599.925c0,95.331-80.664,172.612-180.169,172.612\n\t\t\tc-99.504,0-180.168-77.281-180.168-172.612c0-95.332,80.664-172.612,180.168-172.612\n\t\t\tC699.179,427.312,779.843,504.594,779.843,599.925z M600,240.521c-103.025,0.457-209.814,25.538-310.904,73.557\n\t\t\tc-75.058,37.122-148.206,89.496-211.702,154.141C46.208,501.218,6.431,549,0,599.981c0.76,44.161,48.13,98.669,77.394,131.763\n\t\t\tc59.543,62.106,130.786,113.018,211.702,154.179c94.271,45.751,198.616,72.092,310.904,73.557\n\t\t\tc103.123-0.464,209.888-25.834,310.866-73.557c75.058-37.122,148.243-89.534,211.74-154.179\n\t\t\tc31.185-32.999,70.962-80.782,77.394-131.763c-0.76-44.161-48.13-98.671-77.394-131.764\n\t\t\tc-59.543-62.106-130.824-112.979-211.74-154.141C816.644,268.36,712.042,242.2,600,240.521z M599.924,329.769\n\t\t\tc156.119,0,282.675,120.994,282.675,270.251c0,149.256-126.556,270.25-282.675,270.25S317.249,749.275,317.249,600.02\n\t\t\tC317.249,450.763,443.805,329.769,599.924,329.769L599.924,329.769z\"/>\n</svg>\n";
|
4852
4852
|
var H = /*#__PURE__*/function () {
|
@@ -4893,7 +4893,7 @@ var os = /*#__PURE__*/function () {
|
|
4893
4893
|
return We;
|
4894
4894
|
}();
|
4895
4895
|
os.VISIBLE_ICON_ID = "visible-icon";
|
4896
|
-
var
|
4896
|
+
var _o = os;
|
4897
4897
|
var P = /*#__PURE__*/function () {
|
4898
4898
|
function P() {
|
4899
4899
|
_classCallCheck(this, P);
|
@@ -4997,7 +4997,7 @@ var P = /*#__PURE__*/function () {
|
|
4997
4997
|
i.id = "insert-key-contents";
|
4998
4998
|
var n = P.createInput(t.insertKeyPlaceholderText),
|
4999
4999
|
r = n.children[0],
|
5000
|
-
o =
|
5000
|
+
o = _o.create(r);
|
5001
5001
|
n.appendChild(o), i.appendChild(n);
|
5002
5002
|
var a = P.createStartButton(),
|
5003
5003
|
_P$createHelpTextCont = P.createHelpTextContainer(t.getKeyLink, (d = t.deepChat._insertKeyViewStyles) == null ? void 0 : d.displayCautionText),
|
@@ -5022,7 +5022,7 @@ var P = /*#__PURE__*/function () {
|
|
5022
5022
|
}]);
|
5023
5023
|
return P;
|
5024
5024
|
}();
|
5025
|
-
var
|
5025
|
+
var _t = /*#__PURE__*/function () {
|
5026
5026
|
function pe() {
|
5027
5027
|
_classCallCheck(this, pe);
|
5028
5028
|
}
|
@@ -5030,7 +5030,7 @@ var St = /*#__PURE__*/function () {
|
|
5030
5030
|
key: "enableButtons",
|
5031
5031
|
value: function enableButtons(e, t) {
|
5032
5032
|
var i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
5033
|
-
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i <
|
5033
|
+
window.webLLM ? (e && (e.disabled = !1), t && (t.disabled = !1)) : i < Zi.MODULE_SEARCH_LIMIT_S * 4 && setTimeout(function () {
|
5034
5034
|
return pe.enableButtons(e, t, i + 1);
|
5035
5035
|
}, 250);
|
5036
5036
|
}
|
@@ -5087,87 +5087,140 @@ var St = /*#__PURE__*/function () {
|
|
5087
5087
|
}]);
|
5088
5088
|
return pe;
|
5089
5089
|
}();
|
5090
|
-
|
5091
|
-
|
5092
|
-
|
5093
|
-
|
5094
|
-
var En =
|
5095
|
-
var
|
5096
|
-
model_list: [
|
5090
|
+
_t.DOWNLOAD_BUTTON_CLASS = "deep-chat-download-button";
|
5091
|
+
_t.UPLOAD_BUTTON_CLASS = "deep-chat-upload-button";
|
5092
|
+
_t.FILE_INPUT_CLASS = "deep-chat-file-input";
|
5093
|
+
_t.EXPORT_BUTTON_CLASS = "deep-chat-export-button";
|
5094
|
+
var En = _t;
|
5095
|
+
var _n = {
|
5096
|
+
model_list: [
|
5097
|
+
// Llama-2
|
5098
|
+
{
|
5097
5099
|
model_url: "https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f32_1-MLC/resolve/main/",
|
5098
5100
|
local_id: "Llama-2-7b-chat-hf-q4f32_1",
|
5099
|
-
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f32_1-ctx4k_cs1k-webgpu.wasm"
|
5101
|
+
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f32_1-ctx4k_cs1k-webgpu.wasm",
|
5102
|
+
vram_required_MB: 9109.03,
|
5103
|
+
low_resource_required: !1
|
5100
5104
|
}, {
|
5101
5105
|
model_url: "https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",
|
5102
5106
|
local_id: "Llama-2-7b-chat-hf-q4f16_1",
|
5103
5107
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",
|
5108
|
+
vram_required_MB: 6749.02,
|
5109
|
+
low_resource_required: !1,
|
5110
|
+
required_features: ["shader-f16"]
|
5111
|
+
}, {
|
5112
|
+
model_url: "https://huggingface.co/mlc-ai/Llama-2-7b-chat-hf-q4f16_1-MLC/resolve/main/",
|
5113
|
+
local_id: "Llama-2-7b-chat-hf-q4f16_1-1k",
|
5114
|
+
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-7b-chat-hf/Llama-2-7b-chat-hf-q4f16_1-ctx1k-webgpu.wasm",
|
5115
|
+
vram_required_MB: 4618.52,
|
5116
|
+
low_resource_required: !1,
|
5104
5117
|
required_features: ["shader-f16"]
|
5105
5118
|
}, {
|
5106
5119
|
model_url: "https://huggingface.co/mlc-ai/Llama-2-13b-chat-hf-q4f16_1-MLC/resolve/main/",
|
5107
5120
|
local_id: "Llama-2-13b-chat-hf-q4f16_1",
|
5108
5121
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-13b-chat-hf/Llama-2-13b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",
|
5122
|
+
vram_required_MB: 11814.09,
|
5123
|
+
low_resource_required: !1,
|
5109
5124
|
required_features: ["shader-f16"]
|
5110
5125
|
}, {
|
5111
5126
|
model_url: "https://huggingface.co/mlc-ai/Llama-2-70b-chat-hf-q4f16_1-MLC/resolve/main/",
|
5112
5127
|
local_id: "Llama-2-70b-chat-hf-q4f16_1",
|
5113
5128
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Llama-2-70b-chat-hf/Llama-2-70b-chat-hf-q4f16_1-ctx4k_cs1k-webgpu.wasm",
|
5129
|
+
vram_required_MB: 43729.05,
|
5130
|
+
low_resource_required: !1,
|
5114
5131
|
required_features: ["shader-f16"]
|
5115
|
-
},
|
5132
|
+
},
|
5133
|
+
// RedPajama
|
5134
|
+
{
|
5116
5135
|
model_url: "https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",
|
5117
5136
|
local_id: "RedPajama-INCITE-Chat-3B-v1-q4f16_1",
|
5118
5137
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx2k-webgpu.wasm",
|
5138
|
+
vram_required_MB: 2972.09,
|
5139
|
+
low_resource_required: !1,
|
5119
5140
|
required_features: ["shader-f16"]
|
5120
5141
|
}, {
|
5121
5142
|
model_url: "https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",
|
5122
5143
|
local_id: "RedPajama-INCITE-Chat-3B-v1-q4f32_1",
|
5123
|
-
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx2k-webgpu.wasm"
|
5144
|
+
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx2k-webgpu.wasm",
|
5145
|
+
vram_required_MB: 3928.09,
|
5146
|
+
low_resource_required: !1
|
5124
5147
|
}, {
|
5148
|
+
model_url: "https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f16_1-MLC/resolve/main/",
|
5149
|
+
local_id: "RedPajama-INCITE-Chat-3B-v1-q4f16_1-1k",
|
5150
|
+
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f16_1-ctx1k-webgpu.wasm",
|
5151
|
+
vram_required_MB: 2041.09,
|
5152
|
+
low_resource_required: !0,
|
5153
|
+
required_features: ["shader-f16"]
|
5154
|
+
}, {
|
5155
|
+
model_url: "https://huggingface.co/mlc-ai/RedPajama-INCITE-Chat-3B-v1-q4f32_1-MLC/resolve/main/",
|
5156
|
+
local_id: "RedPajama-INCITE-Chat-3B-v1-q4f32_1-1k",
|
5157
|
+
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/RedPajama-INCITE-Chat-3B-v1/RedPajama-INCITE-Chat-3B-v1-q4f32_1-ctx1k-webgpu.wasm",
|
5158
|
+
vram_required_MB: 2558.09,
|
5159
|
+
low_resource_required: !0
|
5160
|
+
},
|
5161
|
+
// Mistral variants
|
5162
|
+
{
|
5125
5163
|
model_url: "https://huggingface.co/mlc-ai/WizardMath-7B-V1.1-q4f16_1-MLC/resolve/main/",
|
5126
5164
|
local_id: "WizardMath-7B-V1.1-q4f16_1",
|
5127
5165
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",
|
5166
|
+
vram_required_MB: 6079.02,
|
5167
|
+
low_resource_required: !1,
|
5128
5168
|
required_features: ["shader-f16"]
|
5129
5169
|
}, {
|
5130
5170
|
model_url: "https://huggingface.co/mlc-ai/Mistral-7B-Instruct-v0.2-q4f16_1-MLC/resolve/main/",
|
5131
5171
|
local_id: "Mistral-7B-Instruct-v0.2-q4f16_1",
|
5132
5172
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",
|
5173
|
+
vram_required_MB: 6079.02,
|
5174
|
+
low_resource_required: !1,
|
5133
5175
|
required_features: ["shader-f16"]
|
5134
5176
|
}, {
|
5135
5177
|
model_url: "https://huggingface.co/mlc-ai/OpenHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",
|
5136
5178
|
local_id: "OpenHermes-2.5-Mistral-7B-q4f16_1",
|
5137
5179
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",
|
5180
|
+
vram_required_MB: 6079.02,
|
5181
|
+
low_resource_required: !1,
|
5138
5182
|
required_features: ["shader-f16"]
|
5139
5183
|
}, {
|
5140
5184
|
model_url: "https://huggingface.co/mlc-ai/NeuralHermes-2.5-Mistral-7B-q4f16_1-MLC/resolve/main/",
|
5141
5185
|
local_id: "NeuralHermes-2.5-Mistral-7B-q4f16_1",
|
5142
5186
|
model_lib_url: "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/Mistral-7B-Instruct-v0.2/Mistral-7B-Instruct-v0.2-q4f16_1-sw4k_cs1k-webgpu.wasm",
|
5187
|
+
vram_required_MB: 6079.02,
|
5188
|
+
low_resource_required: !1,
|
5143
5189
|
required_features: ["shader-f16"]
|
5144
5190
|
},
|
5145
|
-
//
|
5191
|
+
// TinyLlama
|
5146
5192
|
{
|
5147
|
-
model_url: "https://huggingface.co/mlc-ai/
|
5148
|
-
local_id: "
|
5149
|
-
model_lib_url: "https://raw.githubusercontent.com/
|
5193
|
+
model_url: "https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f16-MLC/resolve/main/",
|
5194
|
+
local_id: "TinyLlama-1.1B-Chat-v0.4-q0f16",
|
5195
|
+
model_lib_url: "https://raw.githubusercontent.com/CharlieFRuan/binary-mlc-llm-libs/pr-0116-tinyLlama-wasm/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f16-ctx2k-webgpu.wasm",
|
5196
|
+
low_resource_required: !1,
|
5150
5197
|
required_features: ["shader-f16"]
|
5151
5198
|
}, {
|
5152
|
-
model_url: "https://huggingface.co/mlc-ai/
|
5153
|
-
local_id: "
|
5154
|
-
model_lib_url: "https://raw.githubusercontent.com/
|
5199
|
+
model_url: "https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q0f32-MLC/resolve/main/",
|
5200
|
+
local_id: "TinyLlama-1.1B-Chat-v0.4-q0f32",
|
5201
|
+
model_lib_url: "https://raw.githubusercontent.com/CharlieFRuan/binary-mlc-llm-libs/pr-0116-tinyLlama-wasm/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q0f32-ctx2k-webgpu.wasm",
|
5202
|
+
low_resource_required: !1
|
5203
|
+
}, {
|
5204
|
+
model_url: "https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f16_1-MLC/resolve/main/",
|
5205
|
+
local_id: "TinyLlama-1.1B-Chat-v0.4-q4f16_1-1k",
|
5206
|
+
model_lib_url: "https://raw.githubusercontent.com/CharlieFRuan/binary-mlc-llm-libs/pr-0116-tinyLlama-wasm/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f16_1-ctx1k-webgpu.wasm",
|
5207
|
+
low_resource_required: !0,
|
5155
5208
|
required_features: ["shader-f16"]
|
5156
5209
|
}, {
|
5157
|
-
model_url: "https://huggingface.co/mlc-ai/
|
5158
|
-
local_id: "
|
5159
|
-
model_lib_url: "https://raw.githubusercontent.com/
|
5210
|
+
model_url: "https://huggingface.co/mlc-ai/TinyLlama-1.1B-Chat-v0.4-q4f32_1-MLC/resolve/main/",
|
5211
|
+
local_id: "TinyLlama-1.1B-Chat-v0.4-q4f32_1-1k",
|
5212
|
+
model_lib_url: "https://raw.githubusercontent.com/CharlieFRuan/binary-mlc-llm-libs/pr-0116-tinyLlama-wasm/TinyLlama-1.1B-Chat-v0.4/TinyLlama-1.1B-Chat-v0.4-q4f32_1-ctx1k-webgpu.wasm",
|
5213
|
+
low_resource_required: !0
|
5160
5214
|
}],
|
5161
5215
|
use_web_worker: !0
|
5162
5216
|
},
|
5163
5217
|
it = /*#__PURE__*/function (_Ne2) {
|
5164
5218
|
_inherits(M, _Ne2);
|
5165
|
-
var _super3 = _createSuper(M);
|
5166
5219
|
function M(e) {
|
5167
5220
|
var _this8;
|
5168
5221
|
_classCallCheck(this, M);
|
5169
5222
|
var t, i;
|
5170
|
-
_this8 =
|
5223
|
+
_this8 = _callSuper(this, M, [e]), _this8._isModelLoaded = !1, _this8._isModelLoading = !1, _this8._loadOnFirstMessage = !1, _this8._webModel = {}, _this8.permittedErrorPrefixes = [M.MULTIPLE_MODELS_ERROR, M.WEB_LLM_NOT_FOUND_ERROR, M.GENERIC_ERROR], _this8._conversationHistory = [], _typeof(e.webModel) == "object" && (_this8._webModel = e.webModel), (t = _this8._webModel.load) != null && t.clearCache && M.clearAllCache(), _this8.findModelInWindow(e), _this8.canSendMessage = _this8.canSubmit.bind(_assertThisInitialized(_this8)), _this8._chatEl = (i = e.shadowRoot) == null ? void 0 : i.children[0], e.initialMessages && M.setUpHistory(_this8._conversationHistory, e.initialMessages);
|
5171
5224
|
return _this8;
|
5172
5225
|
}
|
5173
5226
|
// need ref of messages object as web model exhibits unique behaviour to manipulate chat
|
@@ -5294,7 +5347,7 @@ var Sn = {
|
|
5294
5347
|
}
|
5295
5348
|
if (this._isModelLoaded || this._isModelLoading) return;
|
5296
5349
|
var e = this._webModel.worker;
|
5297
|
-
return
|
5350
|
+
return _n.use_web_worker && e ? new window.webLLM.ChatWorkerClient(e) : new window.webLLM.ChatModule();
|
5298
5351
|
}
|
5299
5352
|
}, {
|
5300
5353
|
key: "getConfig",
|
@@ -5302,7 +5355,7 @@ var Sn = {
|
|
5302
5355
|
var i;
|
5303
5356
|
var e = M.DEFAULT_MODEL;
|
5304
5357
|
this._webModel.model && (e = this._webModel.model);
|
5305
|
-
var t = JSON.parse(JSON.stringify(
|
5358
|
+
var t = JSON.parse(JSON.stringify(_n));
|
5306
5359
|
if (this._webModel.urls) {
|
5307
5360
|
var n = t.model_list.find(function (r) {
|
5308
5361
|
return r.local_id = e;
|
@@ -5700,12 +5753,12 @@ it.MULTIPLE_MODELS_ERROR = "Cannot run multiple web models";
|
|
5700
5753
|
it.WEB_LLM_NOT_FOUND_ERROR = "WebLLM module not found";
|
5701
5754
|
it.DEFAULT_MODEL = "Llama-2-7b-chat-hf-q4f32_1";
|
5702
5755
|
it.MODULE_SEARCH_LIMIT_S = 5;
|
5703
|
-
var
|
5704
|
-
var
|
5705
|
-
function
|
5706
|
-
_classCallCheck(this,
|
5756
|
+
var Zi = it;
|
5757
|
+
var qt = /*#__PURE__*/function () {
|
5758
|
+
function qt() {
|
5759
|
+
_classCallCheck(this, qt);
|
5707
5760
|
}
|
5708
|
-
_createClass(
|
5761
|
+
_createClass(qt, null, [{
|
5709
5762
|
key: "buildHeaders",
|
5710
5763
|
value: function buildHeaders(e) {
|
5711
5764
|
return {
|
@@ -5727,24 +5780,23 @@ var Ut = /*#__PURE__*/function () {
|
|
5727
5780
|
return {
|
5728
5781
|
url: "https://api-inference.huggingface.co/models/gpt2",
|
5729
5782
|
method: "POST",
|
5730
|
-
handleVerificationResult:
|
5783
|
+
handleVerificationResult: qt.handleVerificationResult
|
5731
5784
|
};
|
5732
5785
|
}
|
5733
5786
|
}]);
|
5734
|
-
return
|
5787
|
+
return qt;
|
5735
5788
|
}();
|
5736
|
-
var as = /*#__PURE__*/function (
|
5737
|
-
_inherits(
|
5738
|
-
var _super4 = _createSuper(Fi);
|
5789
|
+
var as = /*#__PURE__*/function (_q) {
|
5790
|
+
_inherits(Bi, _q);
|
5739
5791
|
// prettier-ignore
|
5740
|
-
function
|
5792
|
+
function Bi(e, t, i, n, r, o) {
|
5741
5793
|
var _this14;
|
5742
|
-
_classCallCheck(this,
|
5743
|
-
_this14 =
|
5794
|
+
_classCallCheck(this, Bi);
|
5795
|
+
_this14 = _callSuper(this, Bi, [e, qt.buildKeyVerificationDetails(), qt.buildHeaders, r, o]), _this14.insertKeyPlaceholderText = "Hugging Face Token", _this14.getKeyLink = "https://huggingface.co/settings/tokens", _this14.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this14.permittedErrorPrefixes = ["Authorization header"], _this14.url = "".concat(Bi.URL_PREFIX).concat(i), _this14.textInputPlaceholderText = t, _typeof(n) == "object" && (n.model && (_this14.url = "".concat(Bi.URL_PREFIX).concat(n.model)), n.options && (_this14.rawBody.options = n.options), n.parameters && (_this14.rawBody.parameters = n.parameters));
|
5744
5796
|
return _this14;
|
5745
5797
|
}
|
5746
5798
|
// prettier-ignore
|
5747
|
-
_createClass(
|
5799
|
+
_createClass(Bi, [{
|
5748
5800
|
key: "preprocessBody",
|
5749
5801
|
value: function preprocessBody(e, t, i) {
|
5750
5802
|
var _n$options;
|
@@ -5769,7 +5821,7 @@ var as = /*#__PURE__*/function (_U) {
|
|
5769
5821
|
throw new Error("Request settings have not been set up");
|
5770
5822
|
case 2:
|
5771
5823
|
n = this.preprocessBody(this.rawBody, t, i);
|
5772
|
-
|
5824
|
+
S.request(this, n, e);
|
5773
5825
|
case 4:
|
5774
5826
|
case "end":
|
5775
5827
|
return _context34.stop();
|
@@ -5782,18 +5834,17 @@ var as = /*#__PURE__*/function (_U) {
|
|
5782
5834
|
return callServiceAPI;
|
5783
5835
|
}()
|
5784
5836
|
}]);
|
5785
|
-
return
|
5786
|
-
}(
|
5837
|
+
return Bi;
|
5838
|
+
}(q);
|
5787
5839
|
as.URL_PREFIX = "https://api-inference.huggingface.co/models/";
|
5788
5840
|
var je = as;
|
5789
5841
|
var wt = /*#__PURE__*/function (_je) {
|
5790
5842
|
_inherits(wt, _je);
|
5791
|
-
var _super5 = _createSuper(wt);
|
5792
5843
|
// prettier-ignore
|
5793
5844
|
function wt(e, t, i, n, r, o) {
|
5794
5845
|
var _this15;
|
5795
5846
|
_classCallCheck(this, wt);
|
5796
|
-
_this15 =
|
5847
|
+
_this15 = _callSuper(this, wt, [e, t, i, n, r, o]), _this15.isTextInputDisabled = !0, _this15.canSendMessage = wt.canSendFile;
|
5797
5848
|
return _this15;
|
5798
5849
|
}
|
5799
5850
|
_createClass(wt, [{
|
@@ -5821,7 +5872,7 @@ var wt = /*#__PURE__*/function (_je) {
|
|
5821
5872
|
}
|
5822
5873
|
throw new Error("No file was added");
|
5823
5874
|
case 4:
|
5824
|
-
|
5875
|
+
S.poll(this, i[0], e, !1);
|
5825
5876
|
case 5:
|
5826
5877
|
case "end":
|
5827
5878
|
return _context35.stop();
|
@@ -5843,16 +5894,15 @@ var wt = /*#__PURE__*/function (_je) {
|
|
5843
5894
|
}(je);
|
5844
5895
|
var wo = /*#__PURE__*/function (_wt) {
|
5845
5896
|
_inherits(wo, _wt);
|
5846
|
-
var _super6 = _createSuper(wo);
|
5847
5897
|
// prettier-ignore
|
5848
5898
|
function wo(e) {
|
5849
5899
|
_classCallCheck(this, wo);
|
5850
5900
|
var n, r, o;
|
5851
5901
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.audioClassification,
|
5852
5902
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
5853
|
-
return
|
5903
|
+
return _callSuper(this, wo, [e, "Attach an audio file", "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition", t, i, {
|
5854
5904
|
audio: {}
|
5855
|
-
});
|
5905
|
+
}]);
|
5856
5906
|
}
|
5857
5907
|
_createClass(wo, [{
|
5858
5908
|
key: "extractPollResultData",
|
@@ -5893,19 +5943,18 @@ var wo = /*#__PURE__*/function (_wt) {
|
|
5893
5943
|
}]);
|
5894
5944
|
return wo;
|
5895
5945
|
}(wt);
|
5896
|
-
var
|
5897
|
-
_inherits(
|
5898
|
-
|
5899
|
-
|
5900
|
-
_classCallCheck(this, _o);
|
5946
|
+
var So = /*#__PURE__*/function (_wt2) {
|
5947
|
+
_inherits(So, _wt2);
|
5948
|
+
function So(e) {
|
5949
|
+
_classCallCheck(this, So);
|
5901
5950
|
var n, r, o;
|
5902
5951
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.imageClassification,
|
5903
5952
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
5904
|
-
return
|
5953
|
+
return _callSuper(this, So, [e, "Attach an image file", "google/vit-base-patch16-224", t, i, {
|
5905
5954
|
images: {}
|
5906
|
-
});
|
5955
|
+
}]);
|
5907
5956
|
}
|
5908
|
-
_createClass(
|
5957
|
+
_createClass(So, [{
|
5909
5958
|
key: "extractPollResultData",
|
5910
5959
|
value: function () {
|
5911
5960
|
var _extractPollResultData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37(e) {
|
@@ -5942,14 +5991,14 @@ var _o = /*#__PURE__*/function (_wt2) {
|
|
5942
5991
|
return extractPollResultData;
|
5943
5992
|
}()
|
5944
5993
|
}]);
|
5945
|
-
return
|
5994
|
+
return So;
|
5946
5995
|
}(wt);
|
5947
|
-
var
|
5948
|
-
var
|
5949
|
-
function
|
5950
|
-
_classCallCheck(this,
|
5996
|
+
var St = "data:image/png;base64,";
|
5997
|
+
var oe = /*#__PURE__*/function () {
|
5998
|
+
function oe() {
|
5999
|
+
_classCallCheck(this, oe);
|
5951
6000
|
}
|
5952
|
-
_createClass(
|
6001
|
+
_createClass(oe, null, [{
|
5953
6002
|
key: "buildHeaders",
|
5954
6003
|
value: function buildHeaders(e) {
|
5955
6004
|
return {
|
@@ -5969,30 +6018,28 @@ var re = /*#__PURE__*/function () {
|
|
5969
6018
|
return {
|
5970
6019
|
url: "https://api.stability.ai/v1/engines/list",
|
5971
6020
|
method: "GET",
|
5972
|
-
handleVerificationResult:
|
6021
|
+
handleVerificationResult: oe.handleVerificationResult
|
5973
6022
|
};
|
5974
6023
|
}
|
5975
6024
|
}]);
|
5976
|
-
return
|
6025
|
+
return oe;
|
5977
6026
|
}();
|
5978
|
-
var ri = /*#__PURE__*/function (
|
5979
|
-
_inherits(ri,
|
5980
|
-
var _super8 = _createSuper(ri);
|
6027
|
+
var ri = /*#__PURE__*/function (_q2) {
|
6028
|
+
_inherits(ri, _q2);
|
5981
6029
|
// prettier-ignore
|
5982
6030
|
function ri(e, t, i, n, r) {
|
5983
6031
|
var _this16;
|
5984
6032
|
_classCallCheck(this, ri);
|
5985
|
-
_this16 =
|
6033
|
+
_this16 = _callSuper(this, ri, [e, t, i, n, r]), _this16.insertKeyPlaceholderText = "Stability AI API Key", _this16.getKeyLink = "https://platform.stability.ai/docs/getting-started/authentication", _this16.permittedErrorPrefixes = ["Incorrect", "invalid_"];
|
5986
6034
|
return _this16;
|
5987
6035
|
}
|
5988
6036
|
return _createClass(ri);
|
5989
|
-
}(
|
5990
|
-
var
|
5991
|
-
_inherits(
|
5992
|
-
|
5993
|
-
function qt(e) {
|
6037
|
+
}(q);
|
6038
|
+
var Ut = /*#__PURE__*/function (_ri) {
|
6039
|
+
_inherits(Ut, _ri);
|
6040
|
+
function Ut(e) {
|
5994
6041
|
var _this17;
|
5995
|
-
_classCallCheck(this,
|
6042
|
+
_classCallCheck(this, Ut);
|
5996
6043
|
var o;
|
5997
6044
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
5998
6045
|
i = t == null ? void 0 : t.stabilityAI,
|
@@ -6004,12 +6051,12 @@ var qt = /*#__PURE__*/function (_ri) {
|
|
6004
6051
|
}
|
6005
6052
|
}
|
6006
6053
|
};
|
6007
|
-
_this17 =
|
6054
|
+
_this17 = _callSuper(this, Ut, [e, oe.buildKeyVerificationDetails(), oe.buildHeaders, i, n]), _this17.url = "https://api.stability.ai/v1/generation/esrgan-v1-x2plus/image-to-image/upscale", _this17.textInputPlaceholderText = "Describe image changes", _this17.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Upscale</b></div>\n <p>Upload an image to generate a new one with higher resolution.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6008
6055
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageUpscale;
|
6009
|
-
_typeof(r) == "object" && (r.engine_id && (_this17.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")),
|
6056
|
+
_typeof(r) == "object" && (r.engine_id && (_this17.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/upscale")), Ut.cleanConfig(r), Object.assign(_this17.rawBody, r)), _this17.canSendMessage = Ut.canSendFileMessage;
|
6010
6057
|
return _this17;
|
6011
6058
|
}
|
6012
|
-
_createClass(
|
6059
|
+
_createClass(Ut, [{
|
6013
6060
|
key: "createFormDataBody",
|
6014
6061
|
value: function createFormDataBody(e, t) {
|
6015
6062
|
var i = new FormData();
|
@@ -6039,7 +6086,7 @@ var qt = /*#__PURE__*/function (_ri) {
|
|
6039
6086
|
throw new Error("Image was not found");
|
6040
6087
|
case 4:
|
6041
6088
|
n = this.createFormDataBody(this.rawBody, i[0]);
|
6042
|
-
E.tempRemoveContentHeader(this.requestSettings,
|
6089
|
+
E.tempRemoveContentHeader(this.requestSettings, S.request.bind(this, this, n, e), !1);
|
6043
6090
|
case 6:
|
6044
6091
|
case "end":
|
6045
6092
|
return _context38.stop();
|
@@ -6067,7 +6114,7 @@ var qt = /*#__PURE__*/function (_ri) {
|
|
6067
6114
|
return _context39.abrupt("return", {
|
6068
6115
|
files: e.artifacts.map(function (i) {
|
6069
6116
|
return {
|
6070
|
-
src: "".concat(
|
6117
|
+
src: "".concat(St).concat(i.base64),
|
6071
6118
|
type: "image"
|
6072
6119
|
};
|
6073
6120
|
})
|
@@ -6094,11 +6141,10 @@ var qt = /*#__PURE__*/function (_ri) {
|
|
6094
6141
|
return !!(t != null && t[0]);
|
6095
6142
|
}
|
6096
6143
|
}]);
|
6097
|
-
return
|
6144
|
+
return Ut;
|
6098
6145
|
}(ri);
|
6099
6146
|
var Ht = /*#__PURE__*/function (_ri2) {
|
6100
6147
|
_inherits(Ht, _ri2);
|
6101
|
-
var _super10 = _createSuper(Ht);
|
6102
6148
|
function Ht(e) {
|
6103
6149
|
var _this18;
|
6104
6150
|
_classCallCheck(this, Ht);
|
@@ -6113,7 +6159,7 @@ var Ht = /*#__PURE__*/function (_ri2) {
|
|
6113
6159
|
}
|
6114
6160
|
}
|
6115
6161
|
};
|
6116
|
-
_this18 =
|
6162
|
+
_this18 = _callSuper(this, Ht, [e, oe.buildKeyVerificationDetails(), oe.buildHeaders, i, n]), _this18.url = "https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/image-to-image/masking", _this18._maskSource = "MASK_IMAGE_WHITE", _this18.textInputPlaceholderText = "Describe image changes", _this18.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI</b></div>\n <div style=\"width: 100%; text-align: center; margin-left: -10px; margin-top: 5px\"><b>Image to Image Masking</b></div>\n <p>Upload an image, its mask image to create a new one based on the changes you have described for the mask area.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6117
6163
|
var r = (o = t == null ? void 0 : t.stabilityAI) == null ? void 0 : o.imageToImageMasking;
|
6118
6164
|
_typeof(r) == "object" && (r.engine_id && (_this18.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/image-to-image/masking")), r.weight !== void 0 && r.weight !== null && (_this18._imageWeight = r.weight), r.mask_source !== void 0 && r.mask_source !== null && (_this18._maskSource = r.mask_source), Ht.cleanConfig(r), Object.assign(_this18.rawBody, r)), _this18.canSendMessage = Ht.canSendFileTextMessage;
|
6119
6165
|
return _this18;
|
@@ -6148,7 +6194,7 @@ var Ht = /*#__PURE__*/function (_ri2) {
|
|
6148
6194
|
throw new Error("Image was not found");
|
6149
6195
|
case 4:
|
6150
6196
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], i[1], n);
|
6151
|
-
E.tempRemoveContentHeader(this.requestSettings,
|
6197
|
+
E.tempRemoveContentHeader(this.requestSettings, S.request.bind(this, this, r, e), !1);
|
6152
6198
|
case 6:
|
6153
6199
|
case "end":
|
6154
6200
|
return _context40.stop();
|
@@ -6176,7 +6222,7 @@ var Ht = /*#__PURE__*/function (_ri2) {
|
|
6176
6222
|
return _context41.abrupt("return", {
|
6177
6223
|
files: e.artifacts.map(function (i) {
|
6178
6224
|
return {
|
6179
|
-
src: "".concat(
|
6225
|
+
src: "".concat(St).concat(i.base64),
|
6180
6226
|
type: "image"
|
6181
6227
|
};
|
6182
6228
|
})
|
@@ -6207,15 +6253,14 @@ var Ht = /*#__PURE__*/function (_ri2) {
|
|
6207
6253
|
}(ri);
|
6208
6254
|
var Mo = /*#__PURE__*/function (_wt3) {
|
6209
6255
|
_inherits(Mo, _wt3);
|
6210
|
-
var _super11 = _createSuper(Mo);
|
6211
6256
|
function Mo(e) {
|
6212
6257
|
_classCallCheck(this, Mo);
|
6213
6258
|
var n, r, o;
|
6214
6259
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.audioSpeechRecognition,
|
6215
6260
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6216
|
-
return
|
6261
|
+
return _callSuper(this, Mo, [e, "Attach an audio file", "facebook/wav2vec2-large-960h-lv60-self", t, i, {
|
6217
6262
|
audio: {}
|
6218
|
-
});
|
6263
|
+
}]);
|
6219
6264
|
}
|
6220
6265
|
_createClass(Mo, [{
|
6221
6266
|
key: "extractPollResultData",
|
@@ -6257,13 +6302,12 @@ var Mo = /*#__PURE__*/function (_wt3) {
|
|
6257
6302
|
}(wt);
|
6258
6303
|
var To = /*#__PURE__*/function (_je2) {
|
6259
6304
|
_inherits(To, _je2);
|
6260
|
-
var _super12 = _createSuper(To);
|
6261
6305
|
function To(e) {
|
6262
6306
|
_classCallCheck(this, To);
|
6263
6307
|
var n, r, o;
|
6264
6308
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.textGeneration,
|
6265
6309
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6266
|
-
return
|
6310
|
+
return _callSuper(this, To, [e, "Once upon a time", "gpt2", t, i]);
|
6267
6311
|
}
|
6268
6312
|
_createClass(To, [{
|
6269
6313
|
key: "extractResultData",
|
@@ -6297,14 +6341,13 @@ var To = /*#__PURE__*/function (_je2) {
|
|
6297
6341
|
}(je);
|
6298
6342
|
var Co = /*#__PURE__*/function (_je3) {
|
6299
6343
|
_inherits(Co, _je3);
|
6300
|
-
var _super13 = _createSuper(Co);
|
6301
6344
|
function Co(e) {
|
6302
6345
|
var _this19;
|
6303
6346
|
_classCallCheck(this, Co);
|
6304
6347
|
var n, r, o;
|
6305
6348
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.questionAnswer,
|
6306
6349
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6307
|
-
_this19 =
|
6350
|
+
_this19 = _callSuper(this, Co, [e, "Ask a question", "bert-large-uncased-whole-word-masking-finetuned-squad", t, i]), _this19.permittedErrorPrefixes = ["Authorization header", "Error in"], _this19.context = t.context;
|
6308
6351
|
return _this19;
|
6309
6352
|
}
|
6310
6353
|
_createClass(Co, [{
|
@@ -6353,13 +6396,12 @@ var Co = /*#__PURE__*/function (_je3) {
|
|
6353
6396
|
}(je);
|
6354
6397
|
var Ao = /*#__PURE__*/function (_je4) {
|
6355
6398
|
_inherits(Ao, _je4);
|
6356
|
-
var _super14 = _createSuper(Ao);
|
6357
6399
|
function Ao(e) {
|
6358
6400
|
_classCallCheck(this, Ao);
|
6359
6401
|
var n, r, o;
|
6360
6402
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.summarization,
|
6361
6403
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6362
|
-
return
|
6404
|
+
return _callSuper(this, Ao, [e, "Insert text to summarize", "facebook/bart-large-cnn", t, i]);
|
6363
6405
|
}
|
6364
6406
|
_createClass(Ao, [{
|
6365
6407
|
key: "extractResultData",
|
@@ -6393,7 +6435,6 @@ var Ao = /*#__PURE__*/function (_je4) {
|
|
6393
6435
|
}(je);
|
6394
6436
|
var ko = /*#__PURE__*/function (_je5) {
|
6395
6437
|
_inherits(ko, _je5);
|
6396
|
-
var _super15 = _createSuper(ko);
|
6397
6438
|
function ko(e) {
|
6398
6439
|
var _this20$maxMessages;
|
6399
6440
|
var _this20;
|
@@ -6401,7 +6442,7 @@ var ko = /*#__PURE__*/function (_je5) {
|
|
6401
6442
|
var n, r, o;
|
6402
6443
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.conversation,
|
6403
6444
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6404
|
-
_this20 =
|
6445
|
+
_this20 = _callSuper(this, ko, [e, "Ask me anything!", "facebook/blenderbot-400M-distill", t, i]), (_this20$maxMessages = _this20.maxMessages) !== null && _this20$maxMessages !== void 0 ? _this20$maxMessages : _this20.maxMessages = -1;
|
6405
6446
|
return _this20;
|
6406
6447
|
}
|
6407
6448
|
// prettier-ignore
|
@@ -6477,7 +6518,6 @@ var ko = /*#__PURE__*/function (_je5) {
|
|
6477
6518
|
}(je);
|
6478
6519
|
var Gt = /*#__PURE__*/function (_ri3) {
|
6479
6520
|
_inherits(Gt, _ri3);
|
6480
|
-
var _super16 = _createSuper(Gt);
|
6481
6521
|
function Gt(e) {
|
6482
6522
|
var _this21;
|
6483
6523
|
_classCallCheck(this, Gt);
|
@@ -6492,7 +6532,7 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6492
6532
|
}
|
6493
6533
|
}
|
6494
6534
|
};
|
6495
|
-
_this21 =
|
6535
|
+
_this21 = _callSuper(this, Gt, [e, oe.buildKeyVerificationDetails(), oe.buildHeaders, i, n]), _this21.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/image-to-image", _this21.textInputPlaceholderText = "Describe image changes", _this21.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Image to Image</b></div>\n <p>Upload an image to create a new one with the changes you have described.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6496
6536
|
var r = (o = t.stabilityAI) == null ? void 0 : o.imageToImage;
|
6497
6537
|
_typeof(r) == "object" && (r.engine_id && (_this21.url = "https://api.stability.ai/v1/generation/".concat(r.engine_id, "/text-to-image")), r.weight !== void 0 && r.weight !== null && (_this21._imageWeight = r.weight), Gt.cleanConfig(r), Object.assign(_this21.rawBody, r)), _this21.canSendMessage = Gt.canSendFileTextMessage;
|
6498
6538
|
return _this21;
|
@@ -6527,7 +6567,7 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6527
6567
|
throw new Error("Image was not found");
|
6528
6568
|
case 4:
|
6529
6569
|
n = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim(), r = this.createFormDataBody(this.rawBody, i[0], n);
|
6530
|
-
E.tempRemoveContentHeader(this.requestSettings,
|
6570
|
+
E.tempRemoveContentHeader(this.requestSettings, S.request.bind(this, this, r, e), !1);
|
6531
6571
|
case 6:
|
6532
6572
|
case "end":
|
6533
6573
|
return _context47.stop();
|
@@ -6555,7 +6595,7 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6555
6595
|
return _context48.abrupt("return", {
|
6556
6596
|
files: e.artifacts.map(function (i) {
|
6557
6597
|
return {
|
6558
|
-
src: "".concat(
|
6598
|
+
src: "".concat(St).concat(i.base64),
|
6559
6599
|
type: "image"
|
6560
6600
|
};
|
6561
6601
|
})
|
@@ -6586,13 +6626,12 @@ var Gt = /*#__PURE__*/function (_ri3) {
|
|
6586
6626
|
}(ri);
|
6587
6627
|
var Io = /*#__PURE__*/function (_je6) {
|
6588
6628
|
_inherits(Io, _je6);
|
6589
|
-
var _super17 = _createSuper(Io);
|
6590
6629
|
function Io(e) {
|
6591
6630
|
_classCallCheck(this, Io);
|
6592
6631
|
var n, r, o;
|
6593
6632
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.translation,
|
6594
6633
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6595
|
-
return
|
6634
|
+
return _callSuper(this, Io, [e, "Insert text to translate", "Helsinki-NLP/opus-tatoeba-en-ja", t, i]);
|
6596
6635
|
}
|
6597
6636
|
_createClass(Io, [{
|
6598
6637
|
key: "extractResultData",
|
@@ -6626,14 +6665,13 @@ var Io = /*#__PURE__*/function (_je6) {
|
|
6626
6665
|
}(je);
|
6627
6666
|
var Vt = /*#__PURE__*/function (_ri4) {
|
6628
6667
|
_inherits(Vt, _ri4);
|
6629
|
-
var _super18 = _createSuper(Vt);
|
6630
6668
|
function Vt(e) {
|
6631
6669
|
var _this22;
|
6632
6670
|
_classCallCheck(this, Vt);
|
6633
6671
|
var r;
|
6634
6672
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
6635
6673
|
i = t.stabilityAI;
|
6636
|
-
_this22 =
|
6674
|
+
_this22 = _callSuper(this, Vt, [e, oe.buildKeyVerificationDetails(), oe.buildHeaders, i]), _this22.url = "https://api.stability.ai/v1/generation/stable-diffusion-v1-6/text-to-image", _this22.textInputPlaceholderText = "Describe an image", _this22.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Stability AI: Text to Image</b></div>\n <p>Insert text to generate an image.</p>\n <p>Click <a href=\"https://platform.stability.ai/\">here</a> for more info.</p>";
|
6637
6675
|
var n = (r = t.stabilityAI) == null ? void 0 : r.textToImage;
|
6638
6676
|
_typeof(n) == "object" && (n.engine_id && (_this22.url = "https://api.stability.ai/v1/generation/".concat(n.engine_id, "/text-to-image")), n.weight !== void 0 && n.weight !== null && (_this22._imageWeight = n.weight), Vt.cleanConfig(n), Object.assign(_this22.rawBody, n)), _this22.canSendMessage = Vt.canSendTextMessage;
|
6639
6677
|
return _this22;
|
@@ -6662,7 +6700,7 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6662
6700
|
throw new Error("Request settings have not been set up");
|
6663
6701
|
case 2:
|
6664
6702
|
i = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
6665
|
-
|
6703
|
+
S.request(this, i, e);
|
6666
6704
|
case 4:
|
6667
6705
|
case "end":
|
6668
6706
|
return _context50.stop();
|
@@ -6690,7 +6728,7 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6690
6728
|
return _context51.abrupt("return", {
|
6691
6729
|
files: e.artifacts.map(function (i) {
|
6692
6730
|
return {
|
6693
|
-
src: "".concat(
|
6731
|
+
src: "".concat(St).concat(i.base64),
|
6694
6732
|
type: "image"
|
6695
6733
|
};
|
6696
6734
|
})
|
@@ -6721,14 +6759,13 @@ var Vt = /*#__PURE__*/function (_ri4) {
|
|
6721
6759
|
}(ri);
|
6722
6760
|
var Lo = /*#__PURE__*/function (_je7) {
|
6723
6761
|
_inherits(Lo, _je7);
|
6724
|
-
var _super19 = _createSuper(Lo);
|
6725
6762
|
function Lo(e) {
|
6726
6763
|
var _this23;
|
6727
6764
|
_classCallCheck(this, Lo);
|
6728
6765
|
var n, r, o;
|
6729
6766
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.huggingFace) == null ? void 0 : r.fillMask,
|
6730
6767
|
i = (o = e.directConnection) == null ? void 0 : o.huggingFace;
|
6731
|
-
_this23 =
|
6768
|
+
_this23 = _callSuper(this, Lo, [e, "The goal of life is [MASK].", "bert-base-uncased", t, i]), _this23.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Hugging Face</b></div>\n <p>Insert a sentence with the word [MASK] and the model will try to fill it for you. E.g. I want [MASK].</p>\n <p>First message may take an extented amount of time to complete as the model needs to be initialized.</p>", _this23.permittedErrorPrefixes = ["Authorization header", "No mask_token"];
|
6732
6769
|
return _this23;
|
6733
6770
|
}
|
6734
6771
|
_createClass(Lo, [{
|
@@ -6796,26 +6833,24 @@ var Wt = /*#__PURE__*/function () {
|
|
6796
6833
|
}]);
|
6797
6834
|
return Wt;
|
6798
6835
|
}();
|
6799
|
-
var
|
6800
|
-
_inherits(
|
6801
|
-
|
6802
|
-
function Zi(e, t, i, n, r) {
|
6836
|
+
var Xi = /*#__PURE__*/function (_q3) {
|
6837
|
+
_inherits(Xi, _q3);
|
6838
|
+
function Xi(e, t, i, n, r) {
|
6803
6839
|
var _this24;
|
6804
|
-
_classCallCheck(this,
|
6805
|
-
_this24 =
|
6840
|
+
_classCallCheck(this, Xi);
|
6841
|
+
_this24 = _callSuper(this, Xi, [e, Wt.buildKeyVerificationDetails(), Wt.buildHeaders, r]), _this24.insertKeyPlaceholderText = "Cohere API Key", _this24.getKeyLink = "https://dashboard.cohere.ai/api-keys", _this24.permittedErrorPrefixes = ["invalid"], _this24.url = t, _this24.textInputPlaceholderText = i, n && _typeof(n) == "object" && Object.assign(_this24.rawBody, n);
|
6806
6842
|
return _this24;
|
6807
6843
|
}
|
6808
|
-
return _createClass(
|
6809
|
-
}(
|
6810
|
-
var Ro = /*#__PURE__*/function (
|
6811
|
-
_inherits(Ro,
|
6812
|
-
var _super21 = _createSuper(Ro);
|
6844
|
+
return _createClass(Xi);
|
6845
|
+
}(q);
|
6846
|
+
var Ro = /*#__PURE__*/function (_Xi) {
|
6847
|
+
_inherits(Ro, _Xi);
|
6813
6848
|
function Ro(e) {
|
6814
6849
|
_classCallCheck(this, Ro);
|
6815
6850
|
var n, r, o;
|
6816
6851
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.cohere) == null ? void 0 : r.textGeneration,
|
6817
6852
|
i = (o = e.directConnection) == null ? void 0 : o.cohere;
|
6818
|
-
return
|
6853
|
+
return _callSuper(this, Ro, [e, "https://api.cohere.ai/v1/generate", "Once upon a time", t, i]);
|
6819
6854
|
}
|
6820
6855
|
_createClass(Ro, [{
|
6821
6856
|
key: "preprocessBody",
|
@@ -6841,7 +6876,7 @@ var Ro = /*#__PURE__*/function (_Zi) {
|
|
6841
6876
|
throw new Error("Request settings have not been set up");
|
6842
6877
|
case 2:
|
6843
6878
|
i = this.preprocessBody(this.rawBody, t);
|
6844
|
-
|
6879
|
+
S.request(this, i, e);
|
6845
6880
|
case 4:
|
6846
6881
|
case "end":
|
6847
6882
|
return _context53.stop();
|
@@ -6883,16 +6918,15 @@ var Ro = /*#__PURE__*/function (_Zi) {
|
|
6883
6918
|
}()
|
6884
6919
|
}]);
|
6885
6920
|
return Ro;
|
6886
|
-
}(
|
6887
|
-
var No = /*#__PURE__*/function (
|
6888
|
-
_inherits(No,
|
6889
|
-
var _super22 = _createSuper(No);
|
6921
|
+
}(Xi);
|
6922
|
+
var No = /*#__PURE__*/function (_Xi2) {
|
6923
|
+
_inherits(No, _Xi2);
|
6890
6924
|
function No(e) {
|
6891
6925
|
_classCallCheck(this, No);
|
6892
6926
|
var n, r, o;
|
6893
6927
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.cohere) == null ? void 0 : r.summarization,
|
6894
6928
|
i = (o = e.directConnection) == null ? void 0 : o.cohere;
|
6895
|
-
return
|
6929
|
+
return _callSuper(this, No, [e, "https://api.cohere.ai/v1/summarize", "Insert text to summarize", t, i]);
|
6896
6930
|
}
|
6897
6931
|
_createClass(No, [{
|
6898
6932
|
key: "preprocessBody",
|
@@ -6918,7 +6952,7 @@ var No = /*#__PURE__*/function (_Zi2) {
|
|
6918
6952
|
throw new Error("Request settings have not been set up");
|
6919
6953
|
case 2:
|
6920
6954
|
i = this.preprocessBody(this.rawBody, t);
|
6921
|
-
|
6955
|
+
S.request(this, i, e);
|
6922
6956
|
case 4:
|
6923
6957
|
case "end":
|
6924
6958
|
return _context55.stop();
|
@@ -6959,7 +6993,7 @@ var No = /*#__PURE__*/function (_Zi2) {
|
|
6959
6993
|
}()
|
6960
6994
|
}]);
|
6961
6995
|
return No;
|
6962
|
-
}(
|
6996
|
+
}(Xi);
|
6963
6997
|
var N = /*#__PURE__*/function () {
|
6964
6998
|
function N() {
|
6965
6999
|
_classCallCheck(this, N);
|
@@ -7028,22 +7062,21 @@ var N = /*#__PURE__*/function () {
|
|
7028
7062
|
}]);
|
7029
7063
|
return N;
|
7030
7064
|
}();
|
7031
|
-
var
|
7032
|
-
_inherits(
|
7033
|
-
|
7034
|
-
function Bi(e) {
|
7065
|
+
var Qi = /*#__PURE__*/function (_q4) {
|
7066
|
+
_inherits(zi, _q4);
|
7067
|
+
function zi(e) {
|
7035
7068
|
var _o$model, _a$voice;
|
7036
7069
|
var _this25;
|
7037
|
-
_classCallCheck(this,
|
7070
|
+
_classCallCheck(this, zi);
|
7038
7071
|
var r, o, a;
|
7039
7072
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7040
7073
|
i = t == null ? void 0 : t.openAI;
|
7041
|
-
_this25 =
|
7074
|
+
_this25 = _callSuper(this, zi, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this25.insertKeyPlaceholderText = "OpenAI API Key", _this25.getKeyLink = "https://platform.openai.com/account/api-keys", _this25.url = "https://api.openai.com/v1/audio/speech", _this25.permittedErrorPrefixes = ["Invalid"], _this25.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Text To Speech</b></div>\n <p>Generate an audio file based on your text input.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/text-to-speech\">here</a> for more information.</p>";
|
7042
7075
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.textToSpeech;
|
7043
|
-
_typeof(n) == "object" && Object.assign(_this25.rawBody, n), (_o$model = (o = _this25.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model =
|
7076
|
+
_typeof(n) == "object" && Object.assign(_this25.rawBody, n), (_o$model = (o = _this25.rawBody).model) !== null && _o$model !== void 0 ? _o$model : o.model = zi.DEFAULT_MODEL, (_a$voice = (a = _this25.rawBody).voice) !== null && _a$voice !== void 0 ? _a$voice : a.voice = zi.DEFAULT_VOIDE, _this25.textInputPlaceholderText = "Insert text to generate audio", _this25.rawBody.response_format = "mp3";
|
7044
7077
|
return _this25;
|
7045
7078
|
}
|
7046
|
-
_createClass(
|
7079
|
+
_createClass(zi, [{
|
7047
7080
|
key: "preprocessBody",
|
7048
7081
|
value: function preprocessBody(e, t) {
|
7049
7082
|
var r, o;
|
@@ -7067,7 +7100,7 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7067
7100
|
case 2:
|
7068
7101
|
this.url = this.requestSettings.url || this.url;
|
7069
7102
|
i = this.preprocessBody(this.rawBody, t);
|
7070
|
-
|
7103
|
+
S.request(this, i, e);
|
7071
7104
|
case 5:
|
7072
7105
|
case "end":
|
7073
7106
|
return _context58.stop();
|
@@ -7123,14 +7156,13 @@ var Xi = /*#__PURE__*/function (_U4) {
|
|
7123
7156
|
return extractResultData;
|
7124
7157
|
}()
|
7125
7158
|
}]);
|
7126
|
-
return
|
7127
|
-
}(
|
7128
|
-
|
7129
|
-
|
7130
|
-
var Oo =
|
7131
|
-
var oi = /*#__PURE__*/function (
|
7132
|
-
_inherits(we,
|
7133
|
-
var _super24 = _createSuper(we);
|
7159
|
+
return zi;
|
7160
|
+
}(q);
|
7161
|
+
Qi.DEFAULT_MODEL = "tts-1";
|
7162
|
+
Qi.DEFAULT_VOIDE = "alloy";
|
7163
|
+
var Oo = Qi;
|
7164
|
+
var oi = /*#__PURE__*/function (_q5) {
|
7165
|
+
_inherits(we, _q5);
|
7134
7166
|
function we(e) {
|
7135
7167
|
var _o$model2;
|
7136
7168
|
var _this26;
|
@@ -7138,9 +7170,9 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7138
7170
|
var r, o;
|
7139
7171
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
7140
7172
|
i = t == null ? void 0 : t.openAI;
|
7141
|
-
_this26 =
|
7173
|
+
_this26 = _callSuper(this, we, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i, {
|
7142
7174
|
audio: {}
|
7143
|
-
}), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</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/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url = we.AUDIO_TRANSCRIPTIONS_URL;
|
7175
|
+
}]), _this26.insertKeyPlaceholderText = "OpenAI API Key", _this26.getKeyLink = "https://platform.openai.com/account/api-keys", _this26.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI : Speech To Text</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/guides/speech-to-text\">here</a> for more info.</p>", _this26.url = "", _this26.permittedErrorPrefixes = ["Invalid"], _this26.textInputPlaceholderText = "Upload an audio file", _this26._service_url = we.AUDIO_TRANSCRIPTIONS_URL;
|
7144
7176
|
var n = (r = t == null ? void 0 : t.openAI) == null ? void 0 : r.audio;
|
7145
7177
|
_typeof(n) == "object" && (_this26.processConfig(n), we.cleanConfig(n), Object.assign(_this26.rawBody, n)), (_o$model2 = (o = _this26.rawBody).model) !== null && _o$model2 !== void 0 ? _o$model2 : o.model = we.DEFAULT_MODEL, _this26.rawBody.response_format = "json", _this26.canSendMessage = we.canSendFileMessage;
|
7146
7178
|
return _this26;
|
@@ -7181,7 +7213,7 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7181
7213
|
case 4:
|
7182
7214
|
this.url = this.requestSettings.url || this._service_url;
|
7183
7215
|
n = this.preprocessBody(this.rawBody, t), r = we.createFormDataBody(n, i[0]);
|
7184
|
-
E.tempRemoveContentHeader(this.requestSettings,
|
7216
|
+
E.tempRemoveContentHeader(this.requestSettings, S.request.bind(this, this, r, e), !1);
|
7185
7217
|
case 7:
|
7186
7218
|
case "end":
|
7187
7219
|
return _context60.stop();
|
@@ -7240,7 +7272,7 @@ var oi = /*#__PURE__*/function (_U5) {
|
|
7240
7272
|
}
|
7241
7273
|
}]);
|
7242
7274
|
return we;
|
7243
|
-
}(
|
7275
|
+
}(q);
|
7244
7276
|
oi.AUDIO_TRANSCRIPTIONS_URL = "https://api.openai.com/v1/audio/transcriptions";
|
7245
7277
|
oi.AUDIO_TRANSLATIONS_URL = "https://api.openai.com/v1/audio/translations";
|
7246
7278
|
oi.DEFAULT_MODEL = "whisper-1";
|
@@ -7347,23 +7379,21 @@ var X = /*#__PURE__*/function () {
|
|
7347
7379
|
}]);
|
7348
7380
|
return X;
|
7349
7381
|
}();
|
7350
|
-
var Do = /*#__PURE__*/function (
|
7351
|
-
_inherits(Do,
|
7352
|
-
var _super25 = _createSuper(Do);
|
7382
|
+
var Do = /*#__PURE__*/function (_q6) {
|
7383
|
+
_inherits(Do, _q6);
|
7353
7384
|
// prettier-ignore
|
7354
7385
|
function Do(e, t, i, n, r) {
|
7355
7386
|
var _this27;
|
7356
7387
|
_classCallCheck(this, Do);
|
7357
|
-
_this27 =
|
7388
|
+
_this27 = _callSuper(this, Do, [e, X.buildLanguageKeyVerificationDetails(i), t, n, r]), _this27.insertKeyPlaceholderText = "Azure Language Subscription Key", _this27.getKeyLink =
|
7358
7389
|
// eslint-disable-next-line max-len
|
7359
7390
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this27.permittedErrorPrefixes = ["Access"];
|
7360
7391
|
return _this27;
|
7361
7392
|
}
|
7362
7393
|
return _createClass(Do);
|
7363
|
-
}(
|
7394
|
+
}(q);
|
7364
7395
|
var jo = /*#__PURE__*/function (_Do) {
|
7365
7396
|
_inherits(jo, _Do);
|
7366
|
-
var _super26 = _createSuper(jo);
|
7367
7397
|
function jo(e) {
|
7368
7398
|
var _a$language;
|
7369
7399
|
var _this28;
|
@@ -7371,7 +7401,7 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7371
7401
|
var n, r, o, a;
|
7372
7402
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.summarization,
|
7373
7403
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7374
|
-
_this28 =
|
7404
|
+
_this28 = _callSuper(this, jo, [e, X.buildSummarizationHeader, t.endpoint, i]), _this28.url = "", _this28.textInputPlaceholderText = "Insert text to summarize", (_a$language = (a = _this28.rawBody).language) !== null && _a$language !== void 0 ? _a$language : a.language = "en", Object.assign(_this28.rawBody, t), _this28.url = "".concat(t.endpoint, "/language/analyze-text/jobs?api-version=2022-10-01-preview");
|
7375
7405
|
return _this28;
|
7376
7406
|
}
|
7377
7407
|
_createClass(jo, [{
|
@@ -7406,7 +7436,7 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7406
7436
|
throw new Error("Request settings have not been set up");
|
7407
7437
|
case 2:
|
7408
7438
|
i = this.preprocessBody(this.rawBody, t);
|
7409
|
-
|
7439
|
+
S.request(this, i, e), this.messages = e;
|
7410
7440
|
case 4:
|
7411
7441
|
case "end":
|
7412
7442
|
return _context62.stop();
|
@@ -7437,7 +7467,7 @@ var jo = /*#__PURE__*/function (_Do) {
|
|
7437
7467
|
method: "GET",
|
7438
7468
|
headers: (t = this.requestSettings) == null ? void 0 : t.headers
|
7439
7469
|
};
|
7440
|
-
|
7470
|
+
S.executePollRequest(this, _i9, n, this.messages);
|
7441
7471
|
}
|
7442
7472
|
return _context63.abrupt("return", {
|
7443
7473
|
makingAnotherRequest: !0
|
@@ -7622,20 +7652,19 @@ var ut = /*#__PURE__*/function () {
|
|
7622
7652
|
}]);
|
7623
7653
|
return ut;
|
7624
7654
|
}();
|
7625
|
-
var
|
7626
|
-
_inherits(
|
7627
|
-
|
7628
|
-
function Qi(e) {
|
7655
|
+
var en = /*#__PURE__*/function (_q7) {
|
7656
|
+
_inherits(en, _q7);
|
7657
|
+
function en(e) {
|
7629
7658
|
var _this29;
|
7630
|
-
_classCallCheck(this,
|
7659
|
+
_classCallCheck(this, en);
|
7631
7660
|
var i;
|
7632
7661
|
var t = (i = e.directConnection) == null ? void 0 : i.assemblyAI;
|
7633
|
-
_this29 =
|
7662
|
+
_this29 = _callSuper(this, en, [e, ut.buildKeyVerificationDetails(), ut.buildHeaders, t, {
|
7634
7663
|
audio: {}
|
7635
|
-
}), _this29.insertKeyPlaceholderText = "AssemblyAI API Key", _this29.getKeyLink = "https://www.assemblyai.com/app/account", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this29.url = "https://api.assemblyai.com/v2/upload", _this29.isTextInputDisabled = !0, _this29.textInputPlaceholderText = "Upload an audio file", _this29.permittedErrorPrefixes = ["Authentication", "Invalid"], _this29.canSendMessage =
|
7664
|
+
}]), _this29.insertKeyPlaceholderText = "AssemblyAI API Key", _this29.getKeyLink = "https://www.assemblyai.com/app/account", _this29.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>AssemblyAI Audio</b></div>\n <p><b>Upload an audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"https://www.assemblyai.com/docs/Guides/transcribing_an_audio_file#get-started\">here</a> for more info.\n </p>", _this29.url = "https://api.assemblyai.com/v2/upload", _this29.isTextInputDisabled = !0, _this29.textInputPlaceholderText = "Upload an audio file", _this29.permittedErrorPrefixes = ["Authentication", "Invalid"], _this29.canSendMessage = en.canFileSendMessage;
|
7636
7665
|
return _this29;
|
7637
7666
|
}
|
7638
|
-
_createClass(
|
7667
|
+
_createClass(en, [{
|
7639
7668
|
key: "callServiceAPI",
|
7640
7669
|
value: function () {
|
7641
7670
|
var _callServiceAPI14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee66(e, t, i) {
|
@@ -7655,7 +7684,7 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7655
7684
|
}
|
7656
7685
|
throw new Error("No file was added");
|
7657
7686
|
case 4:
|
7658
|
-
|
7687
|
+
S.request(this, i[0], e, !1);
|
7659
7688
|
case 5:
|
7660
7689
|
case "end":
|
7661
7690
|
return _context66.stop();
|
@@ -7706,25 +7735,23 @@ var Qi = /*#__PURE__*/function (_U7) {
|
|
7706
7735
|
return !!(t != null && t[0]);
|
7707
7736
|
}
|
7708
7737
|
}]);
|
7709
|
-
return
|
7710
|
-
}(
|
7711
|
-
var ls = /*#__PURE__*/function (
|
7712
|
-
_inherits(ls,
|
7713
|
-
var _super28 = _createSuper(ls);
|
7738
|
+
return en;
|
7739
|
+
}(q);
|
7740
|
+
var ls = /*#__PURE__*/function (_q8) {
|
7741
|
+
_inherits(ls, _q8);
|
7714
7742
|
// prettier-ignore
|
7715
7743
|
function ls(e, t, i, n, r) {
|
7716
7744
|
var _this30;
|
7717
7745
|
_classCallCheck(this, ls);
|
7718
|
-
_this30 =
|
7746
|
+
_this30 = _callSuper(this, ls, [e, X.buildSpeechKeyVerificationDetails(i), t, n, r]), _this30.insertKeyPlaceholderText = "Azure Speech Subscription Key", _this30.getKeyLink =
|
7719
7747
|
// eslint-disable-next-line max-len
|
7720
7748
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal";
|
7721
7749
|
return _this30;
|
7722
7750
|
}
|
7723
7751
|
return _createClass(ls);
|
7724
|
-
}(
|
7752
|
+
}(q);
|
7725
7753
|
var cs = /*#__PURE__*/function (_ls) {
|
7726
7754
|
_inherits(ds, _ls);
|
7727
|
-
var _super29 = _createSuper(ds);
|
7728
7755
|
// prettier-ignore
|
7729
7756
|
function ds(e) {
|
7730
7757
|
var _a$lang, _l$name, _c$gender;
|
@@ -7733,7 +7760,7 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7733
7760
|
var n, r, o, a, l, c;
|
7734
7761
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.textToSpeech,
|
7735
7762
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7736
|
-
_this31 =
|
7763
|
+
_this31 = _callSuper(this, ds, [e, X.buildTextToSpeechHeaders.bind({}, (t == null ? void 0 : t.outputFormat) || "audio-16khz-128kbitrate-mono-mp3"), t.region, i]), _this31.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Text To Speech</b></div>\n <p>Insert text to synthesize it to audio.\n <p>\n Click <a href=\"".concat(ds.HELP_LINK, "\">here</a> for more info.\n </p>"), _this31.url = "", Object.assign(_this31.rawBody, t), (_a$lang = (a = _this31.rawBody).lang) !== null && _a$lang !== void 0 ? _a$lang : a.lang = "en-US", (_l$name = (l = _this31.rawBody).name) !== null && _l$name !== void 0 ? _l$name : l.name = "en-US-JennyNeural", (_c$gender = (c = _this31.rawBody).gender) !== null && _c$gender !== void 0 ? _c$gender : c.gender = "Female", _this31.url = "https://".concat(t.region, ".tts.speech.microsoft.com/cognitiveservices/v1");
|
7737
7764
|
return _this31;
|
7738
7765
|
}
|
7739
7766
|
_createClass(ds, [{
|
@@ -7757,7 +7784,7 @@ var cs = /*#__PURE__*/function (_ls) {
|
|
7757
7784
|
throw new Error("Request settings have not been set up");
|
7758
7785
|
case 2:
|
7759
7786
|
i = this.preprocessBody(this.rawBody, t);
|
7760
|
-
|
7787
|
+
S.request(this, i, e, !1);
|
7761
7788
|
case 4:
|
7762
7789
|
case "end":
|
7763
7790
|
return _context68.stop();
|
@@ -7806,11 +7833,10 @@ cs.HELP_LINK =
|
|
7806
7833
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7807
7834
|
var Fo = cs;
|
7808
7835
|
var us = /*#__PURE__*/function (_ls2) {
|
7809
|
-
_inherits(
|
7810
|
-
|
7811
|
-
function zi(e) {
|
7836
|
+
_inherits(qi, _ls2);
|
7837
|
+
function qi(e) {
|
7812
7838
|
var _this32;
|
7813
|
-
_classCallCheck(this,
|
7839
|
+
_classCallCheck(this, qi);
|
7814
7840
|
var o, a, l;
|
7815
7841
|
var t = (a = (o = e.directConnection) == null ? void 0 : o.azure) == null ? void 0 : a.speechToText,
|
7816
7842
|
i = (l = e.directConnection) == null ? void 0 : l.azure,
|
@@ -7821,12 +7847,12 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7821
7847
|
}
|
7822
7848
|
}
|
7823
7849
|
};
|
7824
|
-
_this32 =
|
7850
|
+
_this32 = _callSuper(this, qi, [e, X.buildSpeechToTextHeaders, t.region, i, n]), _this32.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>Azure Speech To Text</b></div>\n <p><b>Upload a .wav or .ogg audio file</b> to transcribe it into text.\n <p>\n Click <a href=\"".concat(qi.HELP_LINK, "\">here</a> for more info.\n </p>"), _this32.url = "", _this32.isTextInputDisabled = !0, _this32.textInputPlaceholderText = "Upload an audio file", _this32.canSendMessage = qi.canFileSendMessage;
|
7825
7851
|
var r = t.lang || "en-US";
|
7826
7852
|
_this32.url = "https://".concat(t.region, ".stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=").concat(r, "&format=detailed"), _this32.recordAudio = void 0;
|
7827
7853
|
return _this32;
|
7828
7854
|
}
|
7829
|
-
_createClass(
|
7855
|
+
_createClass(qi, [{
|
7830
7856
|
key: "callServiceAPI",
|
7831
7857
|
value: function () {
|
7832
7858
|
var _callServiceAPI16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee70(e, t, i) {
|
@@ -7846,7 +7872,7 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7846
7872
|
}
|
7847
7873
|
throw new Error("No file was added");
|
7848
7874
|
case 4:
|
7849
|
-
(r = this.requestSettings) != null && r.headers && (this.requestSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"),
|
7875
|
+
(r = this.requestSettings) != null && r.headers && (this.requestSettings.headers["Content-Type"] = i[0].name.toLocaleLowerCase().endsWith(".wav") ? "audio/wav; codecs=audio/pcm; samplerate=16000" : "audio/ogg; codecs=opus"), S.request(this, i[0], e, !1);
|
7850
7876
|
case 5:
|
7851
7877
|
case "end":
|
7852
7878
|
return _context70.stop();
|
@@ -7891,15 +7917,14 @@ var us = /*#__PURE__*/function (_ls2) {
|
|
7891
7917
|
return !!(t != null && t[0]);
|
7892
7918
|
}
|
7893
7919
|
}]);
|
7894
|
-
return
|
7920
|
+
return qi;
|
7895
7921
|
}(ls);
|
7896
7922
|
us.HELP_LINK =
|
7897
7923
|
// eslint-disable-next-line max-len
|
7898
7924
|
"https://learn.microsoft.com/en-GB/azure/cognitive-services/speech-service/get-started-text-to-speech?tabs=windows%2Cterminal&pivots=programming-language-rest";
|
7899
7925
|
var Bo = us;
|
7900
|
-
var zo = /*#__PURE__*/function (
|
7901
|
-
_inherits(zo,
|
7902
|
-
var _super31 = _createSuper(zo);
|
7926
|
+
var zo = /*#__PURE__*/function (_q9) {
|
7927
|
+
_inherits(zo, _q9);
|
7903
7928
|
// prettier-ignore
|
7904
7929
|
function zo(e) {
|
7905
7930
|
var _this33;
|
@@ -7907,7 +7932,7 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7907
7932
|
var n, r, o;
|
7908
7933
|
var t = (r = (n = e.directConnection) == null ? void 0 : n.azure) == null ? void 0 : r.translation,
|
7909
7934
|
i = (o = e.directConnection) == null ? void 0 : o.azure;
|
7910
|
-
_this33 =
|
7935
|
+
_this33 = _callSuper(this, zo, [e, X.buildTranslationKeyVerificationDetails(t.region), X.buildTranslationHeaders.bind({}, t == null ? void 0 : t.region), i]), _this33.insertKeyPlaceholderText = "Azure Translate Subscription Key", _this33.getKeyLink =
|
7911
7936
|
// eslint-disable-next-line max-len
|
7912
7937
|
"https://learn.microsoft.com/en-us/azure/api-management/api-management-subscriptions#create-and-manage-subscriptions-in-azure-portal", _this33.url = "", _this33.url = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=".concat(t.language || "es");
|
7913
7938
|
return _this33;
|
@@ -7935,7 +7960,7 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7935
7960
|
throw new Error("Request settings have not been set up");
|
7936
7961
|
case 2:
|
7937
7962
|
i = this.preprocessBody(t);
|
7938
|
-
|
7963
|
+
S.request(this, i, e);
|
7939
7964
|
case 4:
|
7940
7965
|
case "end":
|
7941
7966
|
return _context72.stop();
|
@@ -7977,7 +8002,7 @@ var zo = /*#__PURE__*/function (_U9) {
|
|
7977
8002
|
}()
|
7978
8003
|
}]);
|
7979
8004
|
return zo;
|
7980
|
-
}(
|
8005
|
+
}(q);
|
7981
8006
|
var ge = /*#__PURE__*/function () {
|
7982
8007
|
function ge() {
|
7983
8008
|
_classCallCheck(this, ge);
|
@@ -8184,28 +8209,29 @@ var ge = /*#__PURE__*/function () {
|
|
8184
8209
|
}]);
|
8185
8210
|
return ge;
|
8186
8211
|
}();
|
8187
|
-
var
|
8188
|
-
_inherits(
|
8189
|
-
|
8190
|
-
|
8191
|
-
var _l$headers, _c$OpenAIBeta;
|
8212
|
+
var ai = /*#__PURE__*/function (_q10) {
|
8213
|
+
_inherits(ne, _q10);
|
8214
|
+
function ne(e) {
|
8215
|
+
var _c$headers, _d$OpenAIBeta;
|
8192
8216
|
var _this34;
|
8193
|
-
_classCallCheck(this,
|
8194
|
-
var r, o, a, l, c;
|
8217
|
+
_classCallCheck(this, ne);
|
8218
|
+
var r, o, a, l, c, d;
|
8195
8219
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8196
8220
|
i = t.openAI;
|
8197
|
-
_this34 =
|
8221
|
+
_this34 = _callSuper(this, ne, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this34.insertKeyPlaceholderText = "OpenAI API Key", _this34.getKeyLink = "https://platform.openai.com/account/api-keys", _this34.url = "", _this34.permittedErrorPrefixes = ["Incorrect"], _this34.searchedForThreadId = !1, _this34.config = {}, _this34.newAssistantDetails = {
|
8222
|
+
model: "gpt-4"
|
8223
|
+
};
|
8198
8224
|
var n = (r = t.openAI) == null ? void 0 : r.assistant;
|
8199
8225
|
if (_typeof(n) == "object") {
|
8200
|
-
_this34.
|
8226
|
+
_this34.config = n, Object.assign(_this34.newAssistantDetails, _this34.config.new_assistant);
|
8201
8227
|
var _ref10 = (a = (o = e.directConnection) == null ? void 0 : o.openAI) == null ? void 0 : a.assistant,
|
8202
|
-
|
8203
|
-
|
8204
|
-
}
|
8205
|
-
(
|
8228
|
+
u = _ref10.function_handler;
|
8229
|
+
u && (_this34._functionHandler = u);
|
8230
|
+
} else (l = t.openAI) != null && l.assistant && (t.openAI.assistant = n);
|
8231
|
+
(_c$headers = (c = _this34.requestSettings).headers) !== null && _c$headers !== void 0 ? _c$headers : c.headers = {}, (_d$OpenAIBeta = (d = _this34.requestSettings.headers)["OpenAI-Beta"]) !== null && _d$OpenAIBeta !== void 0 ? _d$OpenAIBeta : d["OpenAI-Beta"] = "assistants=v1", _this34.maxMessages = 1;
|
8206
8232
|
return _this34;
|
8207
8233
|
}
|
8208
|
-
_createClass(
|
8234
|
+
_createClass(ne, [{
|
8209
8235
|
key: "processMessage",
|
8210
8236
|
value: function processMessage(e, t) {
|
8211
8237
|
var i = this.totalMessagesMaxCharLength || -1;
|
@@ -8228,13 +8254,13 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8228
8254
|
key: "callService",
|
8229
8255
|
value: function callService(e, t, i) {
|
8230
8256
|
if (this.sessionId) {
|
8231
|
-
this.url = "".concat(
|
8257
|
+
this.url = "".concat(ne.THREAD_PREFIX, "/").concat(this.sessionId, "/messages");
|
8232
8258
|
var n = this.processMessage(t, i);
|
8233
|
-
|
8259
|
+
S.request(this, n, e);
|
8234
8260
|
} else {
|
8235
|
-
this.url = "".concat(
|
8261
|
+
this.url = "".concat(ne.THREAD_PREFIX, "/runs");
|
8236
8262
|
var _n2 = this.createNewThreadMessages(this.rawBody, t, i);
|
8237
|
-
|
8263
|
+
S.request(this, _n2, e);
|
8238
8264
|
}
|
8239
8265
|
this.messages = e;
|
8240
8266
|
}
|
@@ -8242,7 +8268,8 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8242
8268
|
key: "callServiceAPI",
|
8243
8269
|
value: function () {
|
8244
8270
|
var _callServiceAPI18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee79(e, t, i) {
|
8245
|
-
var
|
8271
|
+
var _r$assistant_id;
|
8272
|
+
var r, n;
|
8246
8273
|
return _regeneratorRuntime().wrap(function _callee79$(_context79) {
|
8247
8274
|
while (1) switch (_context79.prev = _context79.next) {
|
8248
8275
|
case 0:
|
@@ -8252,23 +8279,43 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8252
8279
|
}
|
8253
8280
|
throw new Error("Request settings have not been set up");
|
8254
8281
|
case 2:
|
8282
|
+
if (!((_r$assistant_id = (r = this.rawBody).assistant_id) !== null && _r$assistant_id !== void 0)) {
|
8283
|
+
_context79.next = 6;
|
8284
|
+
break;
|
8285
|
+
}
|
8286
|
+
_r$assistant_id;
|
8287
|
+
_context79.next = 12;
|
8288
|
+
break;
|
8289
|
+
case 6:
|
8290
|
+
_context79.t0 = this.config.assistant_id;
|
8291
|
+
if (_context79.t0) {
|
8292
|
+
_context79.next = 11;
|
8293
|
+
break;
|
8294
|
+
}
|
8295
|
+
_context79.next = 10;
|
8296
|
+
return this.createNewAssistant();
|
8297
|
+
case 10:
|
8298
|
+
_context79.t0 = _context79.sent;
|
8299
|
+
case 11:
|
8300
|
+
r.assistant_id = _context79.t0;
|
8301
|
+
case 12:
|
8255
8302
|
this.searchedForThreadId || this.searchPreviousMessagesForThreadId(e.messages);
|
8256
8303
|
if (!i) {
|
8257
|
-
_context79.next =
|
8304
|
+
_context79.next = 19;
|
8258
8305
|
break;
|
8259
8306
|
}
|
8260
|
-
_context79.next =
|
8307
|
+
_context79.next = 16;
|
8261
8308
|
return ge.storeFiles(this, e, i);
|
8262
|
-
case
|
8263
|
-
_context79.
|
8264
|
-
_context79.next =
|
8309
|
+
case 16:
|
8310
|
+
_context79.t1 = _context79.sent;
|
8311
|
+
_context79.next = 20;
|
8265
8312
|
break;
|
8266
|
-
case
|
8267
|
-
_context79.
|
8268
|
-
case
|
8269
|
-
n = _context79.
|
8313
|
+
case 19:
|
8314
|
+
_context79.t1 = void 0;
|
8315
|
+
case 20:
|
8316
|
+
n = _context79.t1;
|
8270
8317
|
this.requestSettings.method = "POST", this.callService(e, t, n);
|
8271
|
-
case
|
8318
|
+
case 22:
|
8272
8319
|
case "end":
|
8273
8320
|
return _context79.stop();
|
8274
8321
|
}
|
@@ -8279,6 +8326,37 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8279
8326
|
}
|
8280
8327
|
return callServiceAPI;
|
8281
8328
|
}()
|
8329
|
+
}, {
|
8330
|
+
key: "createNewAssistant",
|
8331
|
+
value: function () {
|
8332
|
+
var _createNewAssistant = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee80() {
|
8333
|
+
var e, t;
|
8334
|
+
return _regeneratorRuntime().wrap(function _callee80$(_context80) {
|
8335
|
+
while (1) switch (_context80.prev = _context80.next) {
|
8336
|
+
case 0:
|
8337
|
+
_context80.prev = 0;
|
8338
|
+
this.url = ne.NEW_ASSISTANT_URL;
|
8339
|
+
_context80.next = 4;
|
8340
|
+
return N.directFetch(this, JSON.parse(JSON.stringify(this.newAssistantDetails)), "POST");
|
8341
|
+
case 4:
|
8342
|
+
e = _context80.sent;
|
8343
|
+
t = e.id;
|
8344
|
+
return _context80.abrupt("return", (this.config.assistant_id = t, t));
|
8345
|
+
case 9:
|
8346
|
+
_context80.prev = 9;
|
8347
|
+
_context80.t0 = _context80["catch"](0);
|
8348
|
+
console.error(_context80.t0), console.error("Failed to create a new assistant");
|
8349
|
+
case 12:
|
8350
|
+
case "end":
|
8351
|
+
return _context80.stop();
|
8352
|
+
}
|
8353
|
+
}, _callee80, this, [[0, 9]]);
|
8354
|
+
}));
|
8355
|
+
function createNewAssistant() {
|
8356
|
+
return _createNewAssistant.apply(this, arguments);
|
8357
|
+
}
|
8358
|
+
return createNewAssistant;
|
8359
|
+
}()
|
8282
8360
|
}, {
|
8283
8361
|
key: "searchPreviousMessagesForThreadId",
|
8284
8362
|
value: function searchPreviousMessagesForThreadId(e) {
|
@@ -8290,32 +8368,32 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8290
8368
|
}, {
|
8291
8369
|
key: "extractResultData",
|
8292
8370
|
value: function () {
|
8293
|
-
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8371
|
+
var _extractResultData21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee81(e) {
|
8294
8372
|
var n, t, i;
|
8295
|
-
return _regeneratorRuntime().wrap(function
|
8296
|
-
while (1) switch (
|
8373
|
+
return _regeneratorRuntime().wrap(function _callee81$(_context81) {
|
8374
|
+
while (1) switch (_context81.prev = _context81.next) {
|
8297
8375
|
case 0:
|
8298
8376
|
if (!e.error) {
|
8299
|
-
|
8377
|
+
_context81.next = 2;
|
8300
8378
|
break;
|
8301
8379
|
}
|
8302
8380
|
throw e.error.message;
|
8303
8381
|
case 2:
|
8304
|
-
|
8382
|
+
_context81.next = 4;
|
8305
8383
|
return this.assignThreadAndRun(e);
|
8306
8384
|
case 4:
|
8307
|
-
t = "".concat(
|
8385
|
+
t = "".concat(ne.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id), i = {
|
8308
8386
|
method: "GET",
|
8309
8387
|
headers: (n = this.requestSettings) == null ? void 0 : n.headers
|
8310
8388
|
};
|
8311
|
-
return
|
8389
|
+
return _context81.abrupt("return", (S.executePollRequest(this, t, i, this.messages), {
|
8312
8390
|
makingAnotherRequest: !0
|
8313
8391
|
}));
|
8314
8392
|
case 6:
|
8315
8393
|
case "end":
|
8316
|
-
return
|
8394
|
+
return _context81.stop();
|
8317
8395
|
}
|
8318
|
-
},
|
8396
|
+
}, _callee81, this);
|
8319
8397
|
}));
|
8320
8398
|
function extractResultData(_x151) {
|
8321
8399
|
return _extractResultData21.apply(this, arguments);
|
@@ -8325,30 +8403,30 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8325
8403
|
}, {
|
8326
8404
|
key: "assignThreadAndRun",
|
8327
8405
|
value: function () {
|
8328
|
-
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8406
|
+
var _assignThreadAndRun = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee82(e) {
|
8329
8407
|
var t;
|
8330
|
-
return _regeneratorRuntime().wrap(function
|
8331
|
-
while (1) switch (
|
8408
|
+
return _regeneratorRuntime().wrap(function _callee82$(_context82) {
|
8409
|
+
while (1) switch (_context82.prev = _context82.next) {
|
8332
8410
|
case 0:
|
8333
8411
|
if (!this.sessionId) {
|
8334
|
-
|
8412
|
+
_context82.next = 8;
|
8335
8413
|
break;
|
8336
8414
|
}
|
8337
|
-
this.url = "".concat(
|
8338
|
-
|
8415
|
+
this.url = "".concat(ne.THREAD_PREFIX, "/").concat(this.sessionId, "/runs");
|
8416
|
+
_context82.next = 4;
|
8339
8417
|
return N.directFetch(this, JSON.parse(JSON.stringify(this.rawBody)), "POST");
|
8340
8418
|
case 4:
|
8341
|
-
t =
|
8419
|
+
t = _context82.sent;
|
8342
8420
|
this.run_id = t.id;
|
8343
|
-
|
8421
|
+
_context82.next = 9;
|
8344
8422
|
break;
|
8345
8423
|
case 8:
|
8346
8424
|
this.sessionId = e.thread_id, this.run_id = e.id, this.messages && (this.messages.messages[this.messages.messages.length - 1]._sessionId = this.sessionId);
|
8347
8425
|
case 9:
|
8348
8426
|
case "end":
|
8349
|
-
return
|
8427
|
+
return _context82.stop();
|
8350
8428
|
}
|
8351
|
-
},
|
8429
|
+
}, _callee82, this);
|
8352
8430
|
}));
|
8353
8431
|
function assignThreadAndRun(_x152) {
|
8354
8432
|
return _assignThreadAndRun.apply(this, arguments);
|
@@ -8358,39 +8436,39 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8358
8436
|
}, {
|
8359
8437
|
key: "extractPollResultData",
|
8360
8438
|
value: function () {
|
8361
|
-
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8439
|
+
var _extractPollResultData5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee83(e) {
|
8362
8440
|
var r, t, i, a, l, _yield$ge$getFilesAnd, c, d, n;
|
8363
|
-
return _regeneratorRuntime().wrap(function
|
8364
|
-
while (1) switch (
|
8441
|
+
return _regeneratorRuntime().wrap(function _callee83$(_context83) {
|
8442
|
+
while (1) switch (_context83.prev = _context83.next) {
|
8365
8443
|
case 0:
|
8366
8444
|
t = e.status, i = e.required_action;
|
8367
8445
|
if (!(t === "queued" || t === "in_progress")) {
|
8368
|
-
|
8446
|
+
_context83.next = 3;
|
8369
8447
|
break;
|
8370
8448
|
}
|
8371
|
-
return
|
8372
|
-
timeoutMS:
|
8449
|
+
return _context83.abrupt("return", {
|
8450
|
+
timeoutMS: ne.POLLING_TIMEOUT_MS
|
8373
8451
|
});
|
8374
8452
|
case 3:
|
8375
8453
|
if (!(t === "completed" && this.messages)) {
|
8376
|
-
|
8454
|
+
_context83.next = 15;
|
8377
8455
|
break;
|
8378
8456
|
}
|
8379
|
-
this.url = "".concat(
|
8380
|
-
|
8457
|
+
this.url = "".concat(ne.THREAD_PREFIX, "/").concat(e.thread_id, "/messages");
|
8458
|
+
_context83.next = 7;
|
8381
8459
|
return N.directFetch(this, {}, "GET");
|
8382
8460
|
case 7:
|
8383
|
-
a =
|
8461
|
+
a = _context83.sent.data[0];
|
8384
8462
|
l = a.content.find(function (u) {
|
8385
8463
|
return !!u.text || !!u.image_file;
|
8386
8464
|
});
|
8387
|
-
|
8465
|
+
_context83.next = 11;
|
8388
8466
|
return ge.getFilesAndText(this, a, l);
|
8389
8467
|
case 11:
|
8390
|
-
_yield$ge$getFilesAnd =
|
8468
|
+
_yield$ge$getFilesAnd = _context83.sent;
|
8391
8469
|
c = _yield$ge$getFilesAnd.text;
|
8392
8470
|
d = _yield$ge$getFilesAnd.files;
|
8393
|
-
return
|
8471
|
+
return _context83.abrupt("return", {
|
8394
8472
|
text: c,
|
8395
8473
|
_sessionId: this.sessionId,
|
8396
8474
|
files: d
|
@@ -8398,20 +8476,20 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8398
8476
|
case 15:
|
8399
8477
|
n = (r = i == null ? void 0 : i.submit_tool_outputs) == null ? void 0 : r.tool_calls;
|
8400
8478
|
if (!(t === "requires_action" && n)) {
|
8401
|
-
|
8479
|
+
_context83.next = 20;
|
8402
8480
|
break;
|
8403
8481
|
}
|
8404
|
-
|
8482
|
+
_context83.next = 19;
|
8405
8483
|
return this.handleTools(n);
|
8406
8484
|
case 19:
|
8407
|
-
return
|
8485
|
+
return _context83.abrupt("return", _context83.sent);
|
8408
8486
|
case 20:
|
8409
8487
|
throw Error("Thread run status: ".concat(t));
|
8410
8488
|
case 21:
|
8411
8489
|
case "end":
|
8412
|
-
return
|
8490
|
+
return _context83.stop();
|
8413
8491
|
}
|
8414
|
-
},
|
8492
|
+
}, _callee83, this);
|
8415
8493
|
}));
|
8416
8494
|
function extractPollResultData(_x153) {
|
8417
8495
|
return _extractPollResultData5.apply(this, arguments);
|
@@ -8421,13 +8499,13 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8421
8499
|
}, {
|
8422
8500
|
key: "handleTools",
|
8423
8501
|
value: function () {
|
8424
|
-
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8502
|
+
var _handleTools = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee84(e) {
|
8425
8503
|
var t, i, n;
|
8426
|
-
return _regeneratorRuntime().wrap(function
|
8427
|
-
while (1) switch (
|
8504
|
+
return _regeneratorRuntime().wrap(function _callee84$(_context84) {
|
8505
|
+
while (1) switch (_context84.prev = _context84.next) {
|
8428
8506
|
case 0:
|
8429
8507
|
if (this._functionHandler) {
|
8430
|
-
|
8508
|
+
_context84.next = 2;
|
8431
8509
|
break;
|
8432
8510
|
}
|
8433
8511
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.");
|
@@ -8438,14 +8516,14 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8438
8516
|
arguments: r["function"].arguments
|
8439
8517
|
};
|
8440
8518
|
});
|
8441
|
-
|
8519
|
+
_context84.next = 5;
|
8442
8520
|
return this._functionHandler(t);
|
8443
8521
|
case 5:
|
8444
|
-
i =
|
8522
|
+
i = _context84.sent;
|
8445
8523
|
if (!(!Array.isArray(i) || i.find(function (r) {
|
8446
8524
|
return typeof r != "string";
|
8447
8525
|
}) || e.length !== i.length)) {
|
8448
|
-
|
8526
|
+
_context84.next = 8;
|
8449
8527
|
break;
|
8450
8528
|
}
|
8451
8529
|
throw Error("Response must contain an array of strings for each individual function/tool_call, see https://deepchat.dev/docs/directConnection/OpenAI/#assistant-functions.");
|
@@ -8456,20 +8534,20 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8456
8534
|
output: r
|
8457
8535
|
};
|
8458
8536
|
});
|
8459
|
-
this.url = "".concat(
|
8460
|
-
|
8537
|
+
this.url = "".concat(ne.THREAD_PREFIX, "/").concat(this.sessionId, "/runs/").concat(this.run_id, "/submit_tool_outputs");
|
8538
|
+
_context84.next = 12;
|
8461
8539
|
return N.directFetch(this, {
|
8462
8540
|
tool_outputs: n
|
8463
8541
|
}, "POST");
|
8464
8542
|
case 12:
|
8465
|
-
return
|
8466
|
-
timeoutMS:
|
8543
|
+
return _context84.abrupt("return", {
|
8544
|
+
timeoutMS: ne.POLLING_TIMEOUT_MS
|
8467
8545
|
});
|
8468
8546
|
case 13:
|
8469
8547
|
case "end":
|
8470
|
-
return
|
8548
|
+
return _context84.stop();
|
8471
8549
|
}
|
8472
|
-
},
|
8550
|
+
}, _callee84, this);
|
8473
8551
|
}));
|
8474
8552
|
function handleTools(_x154) {
|
8475
8553
|
return _handleTools.apply(this, arguments);
|
@@ -8477,17 +8555,17 @@ var en = /*#__PURE__*/function (_U10) {
|
|
8477
8555
|
return handleTools;
|
8478
8556
|
}()
|
8479
8557
|
}]);
|
8480
|
-
return
|
8481
|
-
}(
|
8482
|
-
|
8483
|
-
|
8484
|
-
|
8485
|
-
var
|
8486
|
-
|
8487
|
-
|
8488
|
-
function
|
8558
|
+
return ne;
|
8559
|
+
}(q);
|
8560
|
+
ai.THREAD_PREFIX = "https://api.openai.com/v1/threads";
|
8561
|
+
ai.NEW_ASSISTANT_URL = "https://api.openai.com/v1/assistants";
|
8562
|
+
ai.POLLING_TIMEOUT_MS = 800;
|
8563
|
+
var qo = ai;
|
8564
|
+
var li = /*#__PURE__*/function (_q11) {
|
8565
|
+
_inherits(Se, _q11);
|
8566
|
+
function Se(e) {
|
8489
8567
|
var _this35;
|
8490
|
-
_classCallCheck(this,
|
8568
|
+
_classCallCheck(this, Se);
|
8491
8569
|
var o;
|
8492
8570
|
var t = e.directConnection,
|
8493
8571
|
i = t == null ? void 0 : t.openAI,
|
@@ -8499,7 +8577,7 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8499
8577
|
}
|
8500
8578
|
}
|
8501
8579
|
};
|
8502
|
-
_this35 =
|
8580
|
+
_this35 = _callSuper(this, Se, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i, n]), _this35.insertKeyPlaceholderText = "OpenAI API Key", _this35.getKeyLink = "https://platform.openai.com/account/api-keys", _this35.introPanelMarkUp = "\n <div style=\"width: 100%; text-align: center; margin-left: -10px\"><b>OpenAI DALL\xB7E</b></div>\n <p><b>Insert text</b> to generate an image.</p>\n <p><b>Upload 1</b> PNG image to generate its variation and optionally insert text to specify the change.</p>\n <p><b>Upload 2</b> PNG images where the second is a copy of the first with a transparent area where the edit should\n take place and text to specify the edit.</p>\n <p>Click <a href=\"https://platform.openai.com/docs/guides/images/introduction\">here</a> for more info.</p>", _this35.url = "", _this35.permittedErrorPrefixes = ["Incorrect", "Invalid input image"];
|
8503
8581
|
var r = (o = t == null ? void 0 : t.openAI) == null ? void 0 : o.images;
|
8504
8582
|
if (_this35.camera) {
|
8505
8583
|
var a = _typeof(r) == "object" && r.size ? Number.parseInt(r.size) : 1024;
|
@@ -8510,10 +8588,10 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8510
8588
|
}
|
8511
8589
|
};
|
8512
8590
|
}
|
8513
|
-
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage =
|
8591
|
+
_typeof(r) == "object" && Object.assign(_this35.rawBody, r), _this35.canSendMessage = Se.canFileSendMessage;
|
8514
8592
|
return _this35;
|
8515
8593
|
}
|
8516
|
-
_createClass(
|
8594
|
+
_createClass(Se, [{
|
8517
8595
|
key: "preprocessBody",
|
8518
8596
|
value: function preprocessBody(e, t) {
|
8519
8597
|
var i = JSON.parse(JSON.stringify(e));
|
@@ -8527,48 +8605,48 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8527
8605
|
var n;
|
8528
8606
|
var r = (a = (o = t[t.length - 1]) == null ? void 0 : o.text) == null ? void 0 : a.trim();
|
8529
8607
|
if (i[1] || r && r !== "") {
|
8530
|
-
this.url =
|
8608
|
+
this.url = Se.IMAGE_EDIT_URL;
|
8531
8609
|
var l = this.preprocessBody(this.rawBody, r);
|
8532
|
-
n =
|
8533
|
-
} else this.url =
|
8534
|
-
E.tempRemoveContentHeader(this.requestSettings,
|
8610
|
+
n = Se.createFormDataBody(l, i[0], i[1]);
|
8611
|
+
} else this.url = Se.IMAGE_VARIATIONS_URL, n = Se.createFormDataBody(this.rawBody, i[0]);
|
8612
|
+
E.tempRemoveContentHeader(this.requestSettings, S.request.bind(this, this, n, e), !1);
|
8535
8613
|
}
|
8536
8614
|
}, {
|
8537
8615
|
key: "callServiceAPI",
|
8538
8616
|
value: function () {
|
8539
|
-
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8617
|
+
var _callServiceAPI19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee85(e, t, i) {
|
8540
8618
|
var n, r;
|
8541
|
-
return _regeneratorRuntime().wrap(function
|
8542
|
-
while (1) switch (
|
8619
|
+
return _regeneratorRuntime().wrap(function _callee85$(_context85) {
|
8620
|
+
while (1) switch (_context85.prev = _context85.next) {
|
8543
8621
|
case 0:
|
8544
8622
|
if ((n = this.requestSettings) != null && n.headers) {
|
8545
|
-
|
8623
|
+
_context85.next = 2;
|
8546
8624
|
break;
|
8547
8625
|
}
|
8548
8626
|
throw new Error("Request settings have not been set up");
|
8549
8627
|
case 2:
|
8550
8628
|
if (!(i != null && i[0])) {
|
8551
|
-
|
8629
|
+
_context85.next = 6;
|
8552
8630
|
break;
|
8553
8631
|
}
|
8554
8632
|
this.callApiWithImage(e, t, i);
|
8555
|
-
|
8633
|
+
_context85.next = 11;
|
8556
8634
|
break;
|
8557
8635
|
case 6:
|
8558
8636
|
if (this.requestSettings) {
|
8559
|
-
|
8637
|
+
_context85.next = 8;
|
8560
8638
|
break;
|
8561
8639
|
}
|
8562
8640
|
throw new Error("Request settings have not been set up");
|
8563
8641
|
case 8:
|
8564
|
-
this.url =
|
8642
|
+
this.url = Se.IMAGE_GENERATION_URL;
|
8565
8643
|
r = this.preprocessBody(this.rawBody, t[t.length - 1].text);
|
8566
|
-
|
8644
|
+
S.request(this, r, e);
|
8567
8645
|
case 11:
|
8568
8646
|
case "end":
|
8569
|
-
return
|
8647
|
+
return _context85.stop();
|
8570
8648
|
}
|
8571
|
-
},
|
8649
|
+
}, _callee85, this);
|
8572
8650
|
}));
|
8573
8651
|
function callServiceAPI(_x155, _x156, _x157) {
|
8574
8652
|
return _callServiceAPI19.apply(this, arguments);
|
@@ -8578,32 +8656,32 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8578
8656
|
}, {
|
8579
8657
|
key: "extractResultData",
|
8580
8658
|
value: function () {
|
8581
|
-
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8582
|
-
return _regeneratorRuntime().wrap(function
|
8583
|
-
while (1) switch (
|
8659
|
+
var _extractResultData22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee86(e) {
|
8660
|
+
return _regeneratorRuntime().wrap(function _callee86$(_context86) {
|
8661
|
+
while (1) switch (_context86.prev = _context86.next) {
|
8584
8662
|
case 0:
|
8585
8663
|
if (!e.error) {
|
8586
|
-
|
8664
|
+
_context86.next = 2;
|
8587
8665
|
break;
|
8588
8666
|
}
|
8589
8667
|
throw e.error.message;
|
8590
8668
|
case 2:
|
8591
|
-
return
|
8669
|
+
return _context86.abrupt("return", {
|
8592
8670
|
files: e.data.map(function (i) {
|
8593
8671
|
return i.url ? {
|
8594
8672
|
src: i.url,
|
8595
8673
|
type: "image"
|
8596
8674
|
} : {
|
8597
|
-
src: "".concat(
|
8675
|
+
src: "".concat(St).concat(i.b64_json),
|
8598
8676
|
type: "image"
|
8599
8677
|
};
|
8600
8678
|
})
|
8601
8679
|
});
|
8602
8680
|
case 3:
|
8603
8681
|
case "end":
|
8604
|
-
return
|
8682
|
+
return _context86.stop();
|
8605
8683
|
}
|
8606
|
-
},
|
8684
|
+
}, _callee86);
|
8607
8685
|
}));
|
8608
8686
|
function extractResultData(_x158) {
|
8609
8687
|
return _extractResultData22.apply(this, arguments);
|
@@ -8632,15 +8710,14 @@ var ai = /*#__PURE__*/function (_U11) {
|
|
8632
8710
|
}), n;
|
8633
8711
|
}
|
8634
8712
|
}]);
|
8635
|
-
return
|
8636
|
-
}(
|
8637
|
-
|
8638
|
-
|
8639
|
-
|
8640
|
-
var
|
8641
|
-
var ht = /*#__PURE__*/function (
|
8642
|
-
_inherits(ht,
|
8643
|
-
var _super34 = _createSuper(ht);
|
8713
|
+
return Se;
|
8714
|
+
}(q);
|
8715
|
+
li.IMAGE_GENERATION_URL = "https://api.openai.com/v1/images/generations";
|
8716
|
+
li.IMAGE_VARIATIONS_URL = "https://api.openai.com/v1/images/variations";
|
8717
|
+
li.IMAGE_EDIT_URL = "https://api.openai.com/v1/images/edits";
|
8718
|
+
var Uo = li;
|
8719
|
+
var ht = /*#__PURE__*/function (_q12) {
|
8720
|
+
_inherits(ht, _q12);
|
8644
8721
|
function ht(e) {
|
8645
8722
|
var _this36$maxMessages, _l$model;
|
8646
8723
|
var _this36;
|
@@ -8648,7 +8725,7 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8648
8725
|
var r, o, a, l;
|
8649
8726
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8650
8727
|
i = t.openAI;
|
8651
|
-
_this36 =
|
8728
|
+
_this36 = _callSuper(this, ht, [e, N.buildKeyVerificationDetails(), N.buildHeaders, i]), _this36.insertKeyPlaceholderText = "OpenAI API Key", _this36.getKeyLink = "https://platform.openai.com/account/api-keys", _this36.url = "https://api.openai.com/v1/chat/completions", _this36.permittedErrorPrefixes = ["Incorrect"], _this36._systemMessage = ht.generateSystemMessage("You are a helpful assistant.");
|
8652
8729
|
var n = (r = t.openAI) == null ? void 0 : r.chat;
|
8653
8730
|
if (_typeof(n) == "object") {
|
8654
8731
|
n.system_prompt && (_this36._systemMessage = ht.generateSystemMessage(n.system_prompt));
|
@@ -8684,24 +8761,24 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8684
8761
|
}, {
|
8685
8762
|
key: "callServiceAPI",
|
8686
8763
|
value: function () {
|
8687
|
-
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8764
|
+
var _callServiceAPI20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee87(e, t) {
|
8688
8765
|
var i, n;
|
8689
|
-
return _regeneratorRuntime().wrap(function
|
8690
|
-
while (1) switch (
|
8766
|
+
return _regeneratorRuntime().wrap(function _callee87$(_context87) {
|
8767
|
+
while (1) switch (_context87.prev = _context87.next) {
|
8691
8768
|
case 0:
|
8692
8769
|
if (this.requestSettings) {
|
8693
|
-
|
8770
|
+
_context87.next = 2;
|
8694
8771
|
break;
|
8695
8772
|
}
|
8696
8773
|
throw new Error("Request settings have not been set up");
|
8697
8774
|
case 2:
|
8698
8775
|
i = this.preprocessBody(this.rawBody, t), n = this.deepChat.stream;
|
8699
|
-
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, I.request(this, i, e)) :
|
8776
|
+
n && (_typeof(n) != "object" || !n.simulation) || i.stream ? (i.stream = !0, I.request(this, i, e)) : S.request(this, i, e);
|
8700
8777
|
case 4:
|
8701
8778
|
case "end":
|
8702
|
-
return
|
8779
|
+
return _context87.stop();
|
8703
8780
|
}
|
8704
|
-
},
|
8781
|
+
}, _callee87, this);
|
8705
8782
|
}));
|
8706
8783
|
function callServiceAPI(_x159, _x160) {
|
8707
8784
|
return _callServiceAPI20.apply(this, arguments);
|
@@ -8711,17 +8788,17 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8711
8788
|
}, {
|
8712
8789
|
key: "extractResultData",
|
8713
8790
|
value: function () {
|
8714
|
-
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8715
|
-
return _regeneratorRuntime().wrap(function
|
8716
|
-
while (1) switch (
|
8791
|
+
var _extractResultData23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee88(e, t, i) {
|
8792
|
+
return _regeneratorRuntime().wrap(function _callee88$(_context88) {
|
8793
|
+
while (1) switch (_context88.prev = _context88.next) {
|
8717
8794
|
case 0:
|
8718
8795
|
if (!e.error) {
|
8719
|
-
|
8796
|
+
_context88.next = 2;
|
8720
8797
|
break;
|
8721
8798
|
}
|
8722
8799
|
throw e.error.message;
|
8723
8800
|
case 2:
|
8724
|
-
return
|
8801
|
+
return _context88.abrupt("return", e.choices[0].delta ? {
|
8725
8802
|
text: e.choices[0].delta.content || ""
|
8726
8803
|
} : e.choices[0].message ? e.choices[0].message.tool_calls ? this.handleTools(e.choices[0].message, t, i) : {
|
8727
8804
|
text: e.choices[0].message.content
|
@@ -8730,9 +8807,9 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8730
8807
|
});
|
8731
8808
|
case 3:
|
8732
8809
|
case "end":
|
8733
|
-
return
|
8810
|
+
return _context88.stop();
|
8734
8811
|
}
|
8735
|
-
},
|
8812
|
+
}, _callee88, this);
|
8736
8813
|
}));
|
8737
8814
|
function extractResultData(_x161, _x162, _x163) {
|
8738
8815
|
return _extractResultData23.apply(this, arguments);
|
@@ -8742,13 +8819,13 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8742
8819
|
}, {
|
8743
8820
|
key: "handleTools",
|
8744
8821
|
value: function () {
|
8745
|
-
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8822
|
+
var _handleTools2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee89(e, t, i) {
|
8746
8823
|
var a, n, r, o, l;
|
8747
|
-
return _regeneratorRuntime().wrap(function
|
8748
|
-
while (1) switch (
|
8824
|
+
return _regeneratorRuntime().wrap(function _callee89$(_context89) {
|
8825
|
+
while (1) switch (_context89.prev = _context89.next) {
|
8749
8826
|
case 0:
|
8750
8827
|
if (!(!e.tool_calls || !t || !i || !this._functionHandler)) {
|
8751
|
-
|
8828
|
+
_context89.next = 2;
|
8752
8829
|
break;
|
8753
8830
|
}
|
8754
8831
|
throw Error("Please define the `function_handler` property inside the [openAI](https://deepchat.dev/docs/directConnection/openAI#Chat) object.");
|
@@ -8760,22 +8837,22 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8760
8837
|
arguments: l["function"].arguments
|
8761
8838
|
};
|
8762
8839
|
});
|
8763
|
-
|
8840
|
+
_context89.next = 6;
|
8764
8841
|
return (a = this._functionHandler) == null ? void 0 : a.call(this, r);
|
8765
8842
|
case 6:
|
8766
|
-
o =
|
8843
|
+
o = _context89.sent;
|
8767
8844
|
if (!o.text) {
|
8768
|
-
|
8845
|
+
_context89.next = 9;
|
8769
8846
|
break;
|
8770
8847
|
}
|
8771
|
-
return
|
8848
|
+
return _context89.abrupt("return", {
|
8772
8849
|
text: o.text
|
8773
8850
|
});
|
8774
8851
|
case 9:
|
8775
8852
|
if (!(n.messages.push(e), Array.isArray(o) && !o.find(function (l) {
|
8776
8853
|
return typeof l != "string";
|
8777
8854
|
}) || r.length === o.length)) {
|
8778
|
-
|
8855
|
+
_context89.next = 17;
|
8779
8856
|
break;
|
8780
8857
|
}
|
8781
8858
|
o.forEach(function (c, d) {
|
@@ -8788,28 +8865,28 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8788
8865
|
content: c.response
|
8789
8866
|
});
|
8790
8867
|
}), delete n.tools, delete n.tool_choice;
|
8791
|
-
|
8868
|
+
_context89.next = 13;
|
8792
8869
|
return t == null ? void 0 : t(n).then(function (c) {
|
8793
8870
|
return E.processResponseByType(c);
|
8794
8871
|
});
|
8795
8872
|
case 13:
|
8796
|
-
l =
|
8873
|
+
l = _context89.sent;
|
8797
8874
|
if (!l.error) {
|
8798
|
-
|
8875
|
+
_context89.next = 16;
|
8799
8876
|
break;
|
8800
8877
|
}
|
8801
8878
|
throw l.error.message;
|
8802
8879
|
case 16:
|
8803
|
-
return
|
8880
|
+
return _context89.abrupt("return", {
|
8804
8881
|
text: l.choices[0].message.content || ""
|
8805
8882
|
});
|
8806
8883
|
case 17:
|
8807
8884
|
throw Error("Response object must either be {response: string}[] for each individual function or {text: string} for a direct response, see https://deepchat.dev/docs/directConnection/OpenAI#FunctionHandler.");
|
8808
8885
|
case 18:
|
8809
8886
|
case "end":
|
8810
|
-
return
|
8887
|
+
return _context89.stop();
|
8811
8888
|
}
|
8812
|
-
},
|
8889
|
+
}, _callee89, this);
|
8813
8890
|
}));
|
8814
8891
|
function handleTools(_x164, _x165, _x166) {
|
8815
8892
|
return _handleTools2.apply(this, arguments);
|
@@ -8845,10 +8922,9 @@ var ht = /*#__PURE__*/function (_U12) {
|
|
8845
8922
|
}
|
8846
8923
|
}]);
|
8847
8924
|
return ht;
|
8848
|
-
}(
|
8849
|
-
var Ho = /*#__PURE__*/function (
|
8850
|
-
_inherits(Ho,
|
8851
|
-
var _super35 = _createSuper(Ho);
|
8925
|
+
}(q);
|
8926
|
+
var Ho = /*#__PURE__*/function (_Xi3) {
|
8927
|
+
_inherits(Ho, _Xi3);
|
8852
8928
|
function Ho(e) {
|
8853
8929
|
var _this37$maxMessages;
|
8854
8930
|
var _this37;
|
@@ -8857,7 +8933,7 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8857
8933
|
var t = JSON.parse(JSON.stringify(e.directConnection)),
|
8858
8934
|
i = (r = t.cohere) == null ? void 0 : r.chat,
|
8859
8935
|
n = t.cohere;
|
8860
|
-
_this37 =
|
8936
|
+
_this37 = _callSuper(this, Ho, [e, "https://api.cohere.ai/v1/chat", "Ask me anything!", i, n]), _typeof(i) == "object" && Object.assign(_this37.rawBody, i), (_this37$maxMessages = _this37.maxMessages) !== null && _this37$maxMessages !== void 0 ? _this37$maxMessages : _this37.maxMessages = -1;
|
8861
8937
|
return _this37;
|
8862
8938
|
}
|
8863
8939
|
_createClass(Ho, [{
|
@@ -8877,24 +8953,24 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8877
8953
|
}, {
|
8878
8954
|
key: "callServiceAPI",
|
8879
8955
|
value: function () {
|
8880
|
-
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8956
|
+
var _callServiceAPI21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee90(e, t) {
|
8881
8957
|
var i;
|
8882
|
-
return _regeneratorRuntime().wrap(function
|
8883
|
-
while (1) switch (
|
8958
|
+
return _regeneratorRuntime().wrap(function _callee90$(_context90) {
|
8959
|
+
while (1) switch (_context90.prev = _context90.next) {
|
8884
8960
|
case 0:
|
8885
8961
|
if (this.requestSettings) {
|
8886
|
-
|
8962
|
+
_context90.next = 2;
|
8887
8963
|
break;
|
8888
8964
|
}
|
8889
8965
|
throw new Error("Request settings have not been set up");
|
8890
8966
|
case 2:
|
8891
8967
|
i = this.preprocessBody(this.rawBody, t);
|
8892
|
-
|
8968
|
+
S.request(this, i, e);
|
8893
8969
|
case 4:
|
8894
8970
|
case "end":
|
8895
|
-
return
|
8971
|
+
return _context90.stop();
|
8896
8972
|
}
|
8897
|
-
},
|
8973
|
+
}, _callee90, this);
|
8898
8974
|
}));
|
8899
8975
|
function callServiceAPI(_x167, _x168) {
|
8900
8976
|
return _callServiceAPI21.apply(this, arguments);
|
@@ -8904,24 +8980,24 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8904
8980
|
}, {
|
8905
8981
|
key: "extractResultData",
|
8906
8982
|
value: function () {
|
8907
|
-
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
8908
|
-
return _regeneratorRuntime().wrap(function
|
8909
|
-
while (1) switch (
|
8983
|
+
var _extractResultData24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee91(e) {
|
8984
|
+
return _regeneratorRuntime().wrap(function _callee91$(_context91) {
|
8985
|
+
while (1) switch (_context91.prev = _context91.next) {
|
8910
8986
|
case 0:
|
8911
8987
|
if (!e.message) {
|
8912
|
-
|
8988
|
+
_context91.next = 2;
|
8913
8989
|
break;
|
8914
8990
|
}
|
8915
8991
|
throw e.message;
|
8916
8992
|
case 2:
|
8917
|
-
return
|
8993
|
+
return _context91.abrupt("return", {
|
8918
8994
|
text: e.text
|
8919
8995
|
});
|
8920
8996
|
case 3:
|
8921
8997
|
case "end":
|
8922
|
-
return
|
8998
|
+
return _context91.stop();
|
8923
8999
|
}
|
8924
|
-
},
|
9000
|
+
}, _callee91);
|
8925
9001
|
}));
|
8926
9002
|
function extractResultData(_x169) {
|
8927
9003
|
return _extractResultData24.apply(this, arguments);
|
@@ -8930,7 +9006,7 @@ var Ho = /*#__PURE__*/function (_Zi3) {
|
|
8930
9006
|
}()
|
8931
9007
|
}]);
|
8932
9008
|
return Ho;
|
8933
|
-
}(
|
9009
|
+
}(Xi);
|
8934
9010
|
var Go = /*#__PURE__*/function () {
|
8935
9011
|
function Go() {
|
8936
9012
|
_classCallCheck(this, Go);
|
@@ -8944,19 +9020,19 @@ var Go = /*#__PURE__*/function () {
|
|
8944
9020
|
i = e.request,
|
8945
9021
|
n = e.demo,
|
8946
9022
|
r = e.webModel;
|
8947
|
-
if (r) return new
|
9023
|
+
if (r) return new Zi(e);
|
8948
9024
|
if (t) {
|
8949
|
-
if (t.openAI) return t.openAI.images ? new
|
8950
|
-
if (t.assemblyAI) return new
|
9025
|
+
if (t.openAI) return t.openAI.images ? new Uo(e) : t.openAI.speechToText ? new Po(e) : t.openAI.textToSpeech ? new Oo(e) : t.openAI.assistant ? new qo(e) : new ht(e);
|
9026
|
+
if (t.assemblyAI) return new en(e);
|
8951
9027
|
if (t.cohere) return t.cohere.textGeneration ? new Ro(e) : t.cohere.summarization ? new No(e) : new Ho(e);
|
8952
|
-
if (t.huggingFace) return t.huggingFace.textGeneration ? new To(e) : t.huggingFace.summarization ? new Ao(e) : t.huggingFace.translation ? new Io(e) : t.huggingFace.fillMask ? new Lo(e) : t.huggingFace.questionAnswer ? new Co(e) : t.huggingFace.audioSpeechRecognition ? new Mo(e) : t.huggingFace.audioClassification ? new wo(e) : t.huggingFace.imageClassification ? new
|
9028
|
+
if (t.huggingFace) return t.huggingFace.textGeneration ? new To(e) : t.huggingFace.summarization ? new Ao(e) : t.huggingFace.translation ? new Io(e) : t.huggingFace.fillMask ? new Lo(e) : t.huggingFace.questionAnswer ? new Co(e) : t.huggingFace.audioSpeechRecognition ? new Mo(e) : t.huggingFace.audioClassification ? new wo(e) : t.huggingFace.imageClassification ? new So(e) : new ko(e);
|
8953
9029
|
if (t.azure) {
|
8954
9030
|
if (t.azure.speechToText) return new Bo(e);
|
8955
9031
|
if (t.azure.textToSpeech) return new Fo(e);
|
8956
9032
|
if (t.azure.summarization) return new jo(e);
|
8957
9033
|
if (t.azure.translation) return new zo(e);
|
8958
9034
|
}
|
8959
|
-
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Gt(e) : t.stabilityAI.imageToImageUpscale ? new
|
9035
|
+
if (t.stabilityAI) return t.stabilityAI.imageToImage ? new Gt(e) : t.stabilityAI.imageToImageUpscale ? new Ut(e) : t.stabilityAI.imageToImageMasking ? new Ht(e) : new Vt(e);
|
8960
9036
|
}
|
8961
9037
|
return i ? new Ne(e) : new Ne(e, void 0, n || !0);
|
8962
9038
|
}
|
@@ -9081,14 +9157,12 @@ var Wo = /*#__PURE__*/function () {
|
|
9081
9157
|
_createClass(Wo, null, [{
|
9082
9158
|
key: "getText",
|
9083
9159
|
value: function getText(e, t) {
|
9084
|
-
var i
|
9160
|
+
var i;
|
9085
9161
|
if (!e.directConnection && !e.request && !e.webModel && !e.demo) return "Connect to any API using the [request](https://deepchat.dev/docs/connect#Request)\n property or a popular service via\n [directConnection](https://deepchat.dev/docs/directConnection/#directConnection).\n \n Host AI entirely on your browser via a [webModel](https://deepchat.dev/docs/webModel).\n \n To get started checkout the [Start](https://deepchat.dev/start) page and\n live code [examples](https://deepchat.dev/examples/frameworks).\n \n To remove this message set the [demo](https://deepchat.dev/docs/demo#demo) property to true.";
|
9086
9162
|
if (e.directConnection) {
|
9087
9163
|
if (!t.isDirectConnection()) return "Please define a valid service inside\n the [directConnection](https://deepchat.dev/docs/directConnection/#directConnection) object.";
|
9088
|
-
var
|
9089
|
-
if (_typeof(
|
9090
|
-
var o = (n = e.directConnection.openAI) == null ? void 0 : n.assistant;
|
9091
|
-
if (typeof o == "boolean" || o && !o.assistant_id) return "Please define the `assistant_id` property inside the openAI [assistant](https://deepchat.dev/docs/directConnection/openAI#Assistant) object.";
|
9164
|
+
var n = (i = e.directConnection.openAI) == null ? void 0 : i.chat;
|
9165
|
+
if (_typeof(n) == "object" && n.tools && !n.function_handler) return "Please define the `function_handler` property inside the openAI [chat](https://deepchat.dev/docs/directConnection/openAI#Chat) object.";
|
9092
9166
|
} else if (e.request && !e.request.url && !e.request.handler) return "Please define a `url` or a `handler` property inside the [request](https://deepchat.dev/docs/connect#Request) object.";
|
9093
9167
|
return null;
|
9094
9168
|
}
|
@@ -9104,24 +9178,24 @@ var fe = /*#__PURE__*/function () {
|
|
9104
9178
|
key: "createImage",
|
9105
9179
|
value: function createImage(e, t) {
|
9106
9180
|
var i = new Image();
|
9107
|
-
return i.src = e.src,
|
9181
|
+
return i.src = e.src, se.scrollDownOnImageLoad(i.src, t), se.processContent("image", i, i.src, e.name);
|
9108
9182
|
}
|
9109
9183
|
// WORK - image still does not scroll down when loaded
|
9110
9184
|
}, {
|
9111
9185
|
key: "addNewImageMessage",
|
9112
9186
|
value: function () {
|
9113
|
-
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9187
|
+
var _addNewImageMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee92(e, t, i) {
|
9114
9188
|
var n, r;
|
9115
|
-
return _regeneratorRuntime().wrap(function
|
9116
|
-
while (1) switch (
|
9189
|
+
return _regeneratorRuntime().wrap(function _callee92$(_context92) {
|
9190
|
+
while (1) switch (_context92.prev = _context92.next) {
|
9117
9191
|
case 0:
|
9118
9192
|
n = fe.createImage(t, e.elementRef), r = e.createNewMessageElement("", i);
|
9119
|
-
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"),
|
9193
|
+
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("image-message"), se.addMessage(e, r, "image", i);
|
9120
9194
|
case 2:
|
9121
9195
|
case "end":
|
9122
|
-
return
|
9196
|
+
return _context92.stop();
|
9123
9197
|
}
|
9124
|
-
},
|
9198
|
+
}, _callee92);
|
9125
9199
|
}));
|
9126
9200
|
function addNewImageMessage(_x170, _x171, _x172) {
|
9127
9201
|
return _addNewImageMessage.apply(this, arguments);
|
@@ -9139,7 +9213,7 @@ var fe = /*#__PURE__*/function () {
|
|
9139
9213
|
value: function addNewAudioMessage(e, t, i) {
|
9140
9214
|
var n = fe.createAudioElement(t, i),
|
9141
9215
|
r = e.createNewMessageElement("", i);
|
9142
|
-
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"),
|
9216
|
+
r.bubbleElement.appendChild(n), r.bubbleElement.classList.add("audio-message"), se.addMessage(e, r, "audio", i);
|
9143
9217
|
}
|
9144
9218
|
}, {
|
9145
9219
|
key: "createAnyFile",
|
@@ -9151,14 +9225,14 @@ var fe = /*#__PURE__*/function () {
|
|
9151
9225
|
var n = H.createSVGElement(Ko);
|
9152
9226
|
n.classList.add("any-file-message-icon"), i.appendChild(n);
|
9153
9227
|
var r = document.createElement("div");
|
9154
|
-
return r.classList.add("any-file-message-text"), r.textContent = e.name ||
|
9228
|
+
return r.classList.add("any-file-message-text"), r.textContent = e.name || se.DEFAULT_FILE_NAME, t.appendChild(i), t.appendChild(r), se.processContent("any", t, e.src, r.textContent);
|
9155
9229
|
}
|
9156
9230
|
}, {
|
9157
9231
|
key: "addNewAnyFileMessage",
|
9158
9232
|
value: function addNewAnyFileMessage(e, t, i) {
|
9159
9233
|
var n = e.createNewMessageElement("", i),
|
9160
9234
|
r = fe.createAnyFile(t);
|
9161
|
-
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r),
|
9235
|
+
n.bubbleElement.classList.add("any-file-message-bubble"), n.bubbleElement.appendChild(r), se.addMessage(e, n, "file", i);
|
9162
9236
|
}
|
9163
9237
|
// no overwrite previous message logic as it is complex to track which files are to be overwritten
|
9164
9238
|
}, {
|
@@ -9166,7 +9240,7 @@ var fe = /*#__PURE__*/function () {
|
|
9166
9240
|
value: function addMessages(e, t, i) {
|
9167
9241
|
t.forEach(function (n) {
|
9168
9242
|
var r, o;
|
9169
|
-
n.ref && (n =
|
9243
|
+
n.ref && (n = se.removeFileRef(n)), n.type === "audio" || (r = n.src) != null && r.startsWith("data:audio") ? fe.addNewAudioMessage(e, n, i) : n.type === "image" || (o = n.src) != null && o.startsWith("data:image") ? fe.addNewImageMessage(e, n, i) : fe.addNewAnyFileMessage(e, n, i);
|
9170
9244
|
});
|
9171
9245
|
}
|
9172
9246
|
}]);
|
@@ -9174,12 +9248,11 @@ var fe = /*#__PURE__*/function () {
|
|
9174
9248
|
}();
|
9175
9249
|
var me = /*#__PURE__*/function (_$e) {
|
9176
9250
|
_inherits(me, _$e);
|
9177
|
-
var _super36 = _createSuper(me);
|
9178
9251
|
function me(e, t, i) {
|
9179
9252
|
var _this38;
|
9180
9253
|
_classCallCheck(this, me);
|
9181
9254
|
var a, l;
|
9182
|
-
_this38 =
|
9255
|
+
_this38 = _callSuper(this, me, [e]);
|
9183
9256
|
var n = t.permittedErrorPrefixes,
|
9184
9257
|
r = t.introPanelMarkUp,
|
9185
9258
|
o = t.demo;
|
@@ -9328,19 +9401,19 @@ var me = /*#__PURE__*/function (_$e) {
|
|
9328
9401
|
}, {
|
9329
9402
|
key: "populateIntroPanel",
|
9330
9403
|
value: function populateIntroPanel(e, t, i) {
|
9331
|
-
(e || t) && (this._introPanel = new Kt(e, t, i), this._introPanel._elementRef && (
|
9404
|
+
(e || t) && (this._introPanel = new Kt(e, t, i), this._introPanel._elementRef && (re.apply(this, this._introPanel._elementRef), this.elementRef.appendChild(this._introPanel._elementRef)));
|
9332
9405
|
}
|
9333
9406
|
}, {
|
9334
9407
|
key: "addMultipleFiles",
|
9335
9408
|
value: function () {
|
9336
|
-
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
9337
|
-
return _regeneratorRuntime().wrap(function
|
9338
|
-
while (1) switch (
|
9409
|
+
var _addMultipleFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee93(e) {
|
9410
|
+
return _regeneratorRuntime().wrap(function _callee93$(_context93) {
|
9411
|
+
while (1) switch (_context93.prev = _context93.next) {
|
9339
9412
|
case 0:
|
9340
|
-
return
|
9413
|
+
return _context93.abrupt("return", Promise.all((e || []).map(function (t) {
|
9341
9414
|
return new Promise(function (i) {
|
9342
9415
|
if (!t.type || t.type === "any") {
|
9343
|
-
var n = t.file.name ||
|
9416
|
+
var n = t.file.name || se.DEFAULT_FILE_NAME;
|
9344
9417
|
i({
|
9345
9418
|
name: n,
|
9346
9419
|
type: "any",
|
@@ -9360,9 +9433,9 @@ var me = /*#__PURE__*/function (_$e) {
|
|
9360
9433
|
})));
|
9361
9434
|
case 1:
|
9362
9435
|
case "end":
|
9363
|
-
return
|
9436
|
+
return _context93.stop();
|
9364
9437
|
}
|
9365
|
-
},
|
9438
|
+
}, _callee93);
|
9366
9439
|
}));
|
9367
9440
|
function addMultipleFiles(_x173) {
|
9368
9441
|
return _addMultipleFiles.apply(this, arguments);
|
@@ -9744,14 +9817,13 @@ var nn = /*#__PURE__*/function () {
|
|
9744
9817
|
}();
|
9745
9818
|
var Ye = /*#__PURE__*/function (_Tt) {
|
9746
9819
|
_inherits(Ye, _Tt);
|
9747
|
-
var _super37 = _createSuper(Ye);
|
9748
9820
|
function Ye(e, t) {
|
9749
9821
|
var _this41;
|
9750
9822
|
_classCallCheck(this, Ye);
|
9751
9823
|
var n;
|
9752
|
-
_this41 =
|
9824
|
+
_this41 = _callSuper(this, Ye, [Ye.createButtonElement(), void 0, {
|
9753
9825
|
styles: (n = t == null ? void 0 : t.button) == null ? void 0 : n.styles
|
9754
|
-
});
|
9826
|
+
}]);
|
9755
9827
|
var i = _this41.createInnerElements(_this41._customStyles);
|
9756
9828
|
_this41._menu = new nn(e, t == null ? void 0 : t.menu), _this41.addClickEvent(), _this41.buttonContainer = Ye.createButtonContainer(), _this41.elementRef.appendChild(i.styles), _this41.buttonContainer.appendChild(_this41.elementRef), _this41.elementRef.classList.add("dropup-icon", "upload-file-button"), _this41.elementRef.children[0].id = "dropup-icon", _this41.buttonContainer.appendChild(_this41._menu.elementRef), _this41.reapplyStateStyle("styles"), _this41.addContainerEvents(e);
|
9757
9829
|
return _this41;
|
@@ -9936,7 +10008,7 @@ var ue = /*#__PURE__*/function () {
|
|
9936
10008
|
var r = ue.createImageAttachment(t);
|
9937
10009
|
this.addFileAttachment(e, "image", r, i);
|
9938
10010
|
} else if (n === "audio") {
|
9939
|
-
var _r2 =
|
10011
|
+
var _r2 = Hi.createAudioAttachment(t);
|
9940
10012
|
this.addFileAttachment(e, "audio", _r2, i);
|
9941
10013
|
} else {
|
9942
10014
|
var _r3 = ue.createAnyFileAttachment(e.name);
|
@@ -9977,7 +10049,7 @@ var ue = /*#__PURE__*/function () {
|
|
9977
10049
|
return r === e;
|
9978
10050
|
}),
|
9979
10051
|
i = this._attachments[t].attachmentContainerElement;
|
9980
|
-
this._attachments.splice(t, 1),
|
10052
|
+
this._attachments.splice(t, 1), Hi.stopAttachmentPlayback(i), i.remove(), this._toggleContainerDisplay(!1), (n = this._validationHandler) == null || n.call(this);
|
9981
10053
|
}
|
9982
10054
|
}, {
|
9983
10055
|
key: "getFiles",
|
@@ -10049,14 +10121,13 @@ var ue = /*#__PURE__*/function () {
|
|
10049
10121
|
return ue;
|
10050
10122
|
}();
|
10051
10123
|
var ta = "<?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>",
|
10052
|
-
|
10124
|
+
Sn = "<?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>",
|
10053
10125
|
fs = /*#__PURE__*/function (_ue) {
|
10054
10126
|
_inherits(Me, _ue);
|
10055
|
-
var _super38 = _createSuper(Me);
|
10056
10127
|
// prettier-ignore
|
10057
10128
|
function Me(e, t, i, n) {
|
10058
10129
|
_classCallCheck(this, Me);
|
10059
|
-
return
|
10130
|
+
return _callSuper(this, Me, [e, t, i, n]);
|
10060
10131
|
}
|
10061
10132
|
_createClass(Me, [{
|
10062
10133
|
key: "createTimer",
|
@@ -10080,7 +10151,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10080
10151
|
i.classList.add("audio-placeholder-text-3-digits");
|
10081
10152
|
var n = document.createElement("div");
|
10082
10153
|
n.classList.add("file-attachment-text-container", "audio-placeholder-text-3-digits-container"), n.appendChild(i);
|
10083
|
-
var r = H.createSVGElement(
|
10154
|
+
var r = H.createSVGElement(Sn);
|
10084
10155
|
return r.classList.add("attachment-icon", "stop-icon", "not-removable-attachment-icon"), i.textContent = "0:00", this._activePlaceholderTimer = this.createTimer(i, e), t.appendChild(n), this.addPlaceholderAudioAttachmentEvents(t, r, n), t;
|
10085
10156
|
}
|
10086
10157
|
}, {
|
@@ -10138,7 +10209,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10138
10209
|
n.src = t;
|
10139
10210
|
var r = H.createSVGElement(ta);
|
10140
10211
|
r.classList.add("attachment-icon", "play-icon");
|
10141
|
-
var o = H.createSVGElement(
|
10212
|
+
var o = H.createSVGElement(Sn);
|
10142
10213
|
o.classList.add("attachment-icon", "stop-icon"), i.replaceChildren(r), n.onplay = function () {
|
10143
10214
|
i.replaceChildren(o);
|
10144
10215
|
}, n.onpause = function () {
|
@@ -10165,7 +10236,7 @@ var ta = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\"
|
|
10165
10236
|
return Me;
|
10166
10237
|
}(ue);
|
10167
10238
|
fs.TIMER_LIMIT_S = 5999;
|
10168
|
-
var
|
10239
|
+
var Hi = fs;
|
10169
10240
|
var ia = /*#__PURE__*/function () {
|
10170
10241
|
function ia() {
|
10171
10242
|
_classCallCheck(this, ia);
|
@@ -10175,7 +10246,7 @@ var ia = /*#__PURE__*/function () {
|
|
10175
10246
|
value:
|
10176
10247
|
// prettier-ignore
|
10177
10248
|
function create(e, t, i, n, r) {
|
10178
|
-
return r === "audio" ? new
|
10249
|
+
return r === "audio" ? new Hi(e, t, i, n) : new ue(e, t, i, n);
|
10179
10250
|
}
|
10180
10251
|
}]);
|
10181
10252
|
return ia;
|
@@ -10216,23 +10287,23 @@ var Ct = /*#__PURE__*/function () {
|
|
10216
10287
|
}, {
|
10217
10288
|
key: "completePlaceholders",
|
10218
10289
|
value: function () {
|
10219
|
-
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10220
|
-
return _regeneratorRuntime().wrap(function
|
10221
|
-
while (1) switch (
|
10290
|
+
var _completePlaceholders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee95() {
|
10291
|
+
return _regeneratorRuntime().wrap(function _callee95$(_context95) {
|
10292
|
+
while (1) switch (_context95.prev = _context95.next) {
|
10222
10293
|
case 0:
|
10223
|
-
|
10294
|
+
_context95.next = 2;
|
10224
10295
|
return Promise.all(this._fileAttachmentsTypes.map( /*#__PURE__*/function () {
|
10225
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10296
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee94(e) {
|
10226
10297
|
var t;
|
10227
|
-
return _regeneratorRuntime().wrap(function
|
10228
|
-
while (1) switch (
|
10298
|
+
return _regeneratorRuntime().wrap(function _callee94$(_context94) {
|
10299
|
+
while (1) switch (_context94.prev = _context94.next) {
|
10229
10300
|
case 0:
|
10230
|
-
return
|
10301
|
+
return _context94.abrupt("return", (t = e.stopPlaceholderCallback) == null ? void 0 : t.call(e));
|
10231
10302
|
case 1:
|
10232
10303
|
case "end":
|
10233
|
-
return
|
10304
|
+
return _context94.stop();
|
10234
10305
|
}
|
10235
|
-
},
|
10306
|
+
}, _callee94);
|
10236
10307
|
}));
|
10237
10308
|
return function (_x174) {
|
10238
10309
|
return _ref12.apply(this, arguments);
|
@@ -10240,9 +10311,9 @@ var Ct = /*#__PURE__*/function () {
|
|
10240
10311
|
}()));
|
10241
10312
|
case 2:
|
10242
10313
|
case "end":
|
10243
|
-
return
|
10314
|
+
return _context95.stop();
|
10244
10315
|
}
|
10245
|
-
},
|
10316
|
+
}, _callee95, this);
|
10246
10317
|
}));
|
10247
10318
|
function completePlaceholders() {
|
10248
10319
|
return _completePlaceholders.apply(this, arguments);
|
@@ -10395,13 +10466,12 @@ ms.MODAL_CLOSE_TIMEOUT_MS = 190;
|
|
10395
10466
|
var ct = ms;
|
10396
10467
|
var pt = /*#__PURE__*/function (_Tt2) {
|
10397
10468
|
_inherits(pt, _Tt2);
|
10398
|
-
var _super39 = _createSuper(pt);
|
10399
10469
|
// prettier-ignore
|
10400
10470
|
function pt(e, t, i, n, r, o) {
|
10401
10471
|
var _this49;
|
10402
10472
|
_classCallCheck(this, pt);
|
10403
10473
|
var l, c, d, u, p, h;
|
10404
|
-
_this49 =
|
10474
|
+
_this49 = _callSuper(this, pt, [pt.createButtonElement(), (l = i.button) == null ? void 0 : l.position, i.button, o]);
|
10405
10475
|
var a = _this49.createInnerElements(n, r, _this49._customStyles);
|
10406
10476
|
_this49._inputElement = pt.createInputElement((c = i == null ? void 0 : i.files) == null ? void 0 : c.acceptedFormats), _this49.addClickEvent(e, i), _this49.elementRef.replaceChildren(a.styles), _this49.reapplyStateStyle("styles"), _this49._fileAttachmentsType = t, _this49._openModalOnce = ((u = (d = i.files) == null ? void 0 : d.infoModal) == null ? void 0 : u.openModalOnce) === !1 || (h = (p = i.files) == null ? void 0 : p.infoModal) == null ? void 0 : h.openModalOnce;
|
10407
10477
|
return _this49;
|
@@ -10532,24 +10602,24 @@ var Ce = /*#__PURE__*/function () {
|
|
10532
10602
|
}, {
|
10533
10603
|
key: "useValidationFunc",
|
10534
10604
|
value: function () {
|
10535
|
-
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10605
|
+
var _useValidationFunc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee96(e, t, i, n) {
|
10536
10606
|
var r, o, a, l;
|
10537
|
-
return _regeneratorRuntime().wrap(function
|
10538
|
-
while (1) switch (
|
10607
|
+
return _regeneratorRuntime().wrap(function _callee96$(_context96) {
|
10608
|
+
while (1) switch (_context96.prev = _context96.next) {
|
10539
10609
|
case 0:
|
10540
10610
|
r = t.inputElementRef, o = r.classList.contains("text-input-placeholder") ? "" : r.textContent;
|
10541
|
-
|
10611
|
+
_context96.next = 3;
|
10542
10612
|
return i.completePlaceholders();
|
10543
10613
|
case 3:
|
10544
10614
|
a = i.getAllFileData(), l = a == null ? void 0 : a.map(function (c) {
|
10545
10615
|
return c.file;
|
10546
10616
|
});
|
10547
|
-
return
|
10617
|
+
return _context96.abrupt("return", Ce.validate(e, n, o, l));
|
10548
10618
|
case 5:
|
10549
10619
|
case "end":
|
10550
|
-
return
|
10620
|
+
return _context96.stop();
|
10551
10621
|
}
|
10552
|
-
},
|
10622
|
+
}, _callee96);
|
10553
10623
|
}));
|
10554
10624
|
function useValidationFunc(_x175, _x176, _x177, _x178) {
|
10555
10625
|
return _useValidationFunc.apply(this, arguments);
|
@@ -10559,20 +10629,20 @@ var Ce = /*#__PURE__*/function () {
|
|
10559
10629
|
}, {
|
10560
10630
|
key: "useValidationFuncProgrammatic",
|
10561
10631
|
value: function () {
|
10562
|
-
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10632
|
+
var _useValidationFuncProgrammatic = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee97(e, t, i) {
|
10563
10633
|
var r, n;
|
10564
|
-
return _regeneratorRuntime().wrap(function
|
10565
|
-
while (1) switch (
|
10634
|
+
return _regeneratorRuntime().wrap(function _callee97$(_context97) {
|
10635
|
+
while (1) switch (_context97.prev = _context97.next) {
|
10566
10636
|
case 0:
|
10567
10637
|
n = (r = t.files) == null ? void 0 : r.map(function (o) {
|
10568
10638
|
return o.file;
|
10569
10639
|
});
|
10570
|
-
return
|
10640
|
+
return _context97.abrupt("return", Ce.validate(e, i, t.text, n, !0));
|
10571
10641
|
case 2:
|
10572
10642
|
case "end":
|
10573
|
-
return
|
10643
|
+
return _context97.stop();
|
10574
10644
|
}
|
10575
|
-
},
|
10645
|
+
}, _callee97);
|
10576
10646
|
}));
|
10577
10647
|
function useValidationFuncProgrammatic(_x179, _x180, _x181) {
|
10578
10648
|
return _useValidationFuncProgrammatic.apply(this, arguments);
|
@@ -10590,24 +10660,24 @@ var Ce = /*#__PURE__*/function () {
|
|
10590
10660
|
value: function attach(e, t, i, n, r) {
|
10591
10661
|
var o = e.validateInput || Le.processValidateInput(e);
|
10592
10662
|
e._validationHandler = /*#__PURE__*/function () {
|
10593
|
-
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
10663
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee98(a) {
|
10594
10664
|
var l;
|
10595
|
-
return _regeneratorRuntime().wrap(function
|
10596
|
-
while (1) switch (
|
10665
|
+
return _regeneratorRuntime().wrap(function _callee98$(_context98) {
|
10666
|
+
while (1) switch (_context98.prev = _context98.next) {
|
10597
10667
|
case 0:
|
10598
10668
|
if (!(r.status.loadingActive || r.status.requestInProgress || t.isSubmitProgrammaticallyDisabled === !0 || !Ce.validateWebsocket(t, r))) {
|
10599
|
-
|
10669
|
+
_context98.next = 2;
|
10600
10670
|
break;
|
10601
10671
|
}
|
10602
|
-
return
|
10672
|
+
return _context98.abrupt("return", !1);
|
10603
10673
|
case 2:
|
10604
10674
|
l = o || t.canSendMessage;
|
10605
|
-
return
|
10675
|
+
return _context98.abrupt("return", l ? a ? Ce.useValidationFuncProgrammatic(l, a, r) : Ce.useValidationFunc(l, i, n, r) : null);
|
10606
10676
|
case 4:
|
10607
10677
|
case "end":
|
10608
|
-
return
|
10678
|
+
return _context98.stop();
|
10609
10679
|
}
|
10610
|
-
},
|
10680
|
+
}, _callee98);
|
10611
10681
|
}));
|
10612
10682
|
return function (_x182) {
|
10613
10683
|
return _ref13.apply(this, arguments);
|
@@ -10620,11 +10690,10 @@ var Ce = /*#__PURE__*/function () {
|
|
10620
10690
|
var na = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<svg height=\"1.4em\" width=\"1.4em\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\t viewBox=\"0 0 490.9 490.9\" xml:space=\"preserve\">\n\t<g>\n\t\t<g>\n\t\t\t<path d=\"M245.5,322.9c53,0,96.2-43.2,96.2-96.2V96.2c0-53-43.2-96.2-96.2-96.2s-96.2,43.2-96.2,96.2v130.5\n\t\t\t\tC149.3,279.8,192.5,322.9,245.5,322.9z M173.8,96.2c0-39.5,32.2-71.7,71.7-71.7s71.7,32.2,71.7,71.7v130.5\n\t\t\t\tc0,39.5-32.2,71.7-71.7,71.7s-71.7-32.2-71.7-71.7V96.2z\"/>\n\t\t\t<path d=\"M94.4,214.5c-6.8,0-12.3,5.5-12.3,12.3c0,85.9,66.7,156.6,151.1,162.8v76.7h-63.9c-6.8,0-12.3,5.5-12.3,12.3\n\t\t\t\ts5.5,12.3,12.3,12.3h152.3c6.8,0,12.3-5.5,12.3-12.3s-5.5-12.3-12.3-12.3h-63.9v-76.7c84.4-6.3,151.1-76.9,151.1-162.8\n\t\t\t\tc0-6.8-5.5-12.3-12.3-12.3s-12.3,5.5-12.3,12.3c0,76.6-62.3,138.9-138.9,138.9s-138.9-62.3-138.9-138.9\n\t\t\t\tC106.6,220,101.2,214.5,94.4,214.5z\"/>\n\t\t</g>\n\t</g>\n</svg>\n";
|
10621
10691
|
var xt = /*#__PURE__*/function (_Tt3) {
|
10622
10692
|
_inherits(xt, _Tt3);
|
10623
|
-
var _super40 = _createSuper(xt);
|
10624
10693
|
function xt(e) {
|
10625
10694
|
var _this50;
|
10626
10695
|
_classCallCheck(this, xt);
|
10627
|
-
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this50 =
|
10696
|
+
(e == null ? void 0 : e.position) === "dropup-menu" && (e.position = "outside-right"), _this50 = _callSuper(this, xt, [xt.createMicrophoneElement(), e == null ? void 0 : e.position, e]), _this50.isActive = !1, _this50._innerElements = _this50.createInnerElements(_this50._customStyles), _this50.changeToDefault();
|
10628
10697
|
return _this50;
|
10629
10698
|
}
|
10630
10699
|
_createClass(xt, [{
|
@@ -10696,8 +10765,8 @@ var xt = /*#__PURE__*/function (_Tt3) {
|
|
10696
10765
|
return xt;
|
10697
10766
|
}(Tt);
|
10698
10767
|
var gs = {},
|
10699
|
-
li = {},
|
10700
10768
|
ci = {},
|
10769
|
+
di = {},
|
10701
10770
|
At = {},
|
10702
10771
|
Fe = {};
|
10703
10772
|
Object.defineProperty(Fe, "__esModule", {
|
@@ -10758,10 +10827,10 @@ var ra = /*#__PURE__*/function () {
|
|
10758
10827
|
return ra;
|
10759
10828
|
}();
|
10760
10829
|
At.Translate = ra;
|
10761
|
-
Object.defineProperty(
|
10830
|
+
Object.defineProperty(di, "__esModule", {
|
10762
10831
|
value: !0
|
10763
10832
|
});
|
10764
|
-
|
10833
|
+
di.WebSpeechTranscript = void 0;
|
10765
10834
|
var Mn = At;
|
10766
10835
|
var oa = /*#__PURE__*/function () {
|
10767
10836
|
function oa() {
|
@@ -10799,7 +10868,7 @@ var oa = /*#__PURE__*/function () {
|
|
10799
10868
|
}]);
|
10800
10869
|
return oa;
|
10801
10870
|
}();
|
10802
|
-
|
10871
|
+
di.WebSpeechTranscript = oa;
|
10803
10872
|
var nt = {};
|
10804
10873
|
Object.defineProperty(nt, "__esModule", {
|
10805
10874
|
value: !0
|
@@ -10813,11 +10882,11 @@ dt.IS_SAFARI = function () {
|
|
10813
10882
|
return dt._IS_SAFARI === void 0 && (dt._IS_SAFARI = /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), dt._IS_SAFARI;
|
10814
10883
|
};
|
10815
10884
|
var kt = {},
|
10816
|
-
|
10817
|
-
Object.defineProperty(
|
10885
|
+
ui = {};
|
10886
|
+
Object.defineProperty(ui, "__esModule", {
|
10818
10887
|
value: !0
|
10819
10888
|
});
|
10820
|
-
|
10889
|
+
ui.EventListeners = void 0;
|
10821
10890
|
var $ = /*#__PURE__*/function () {
|
10822
10891
|
function $() {
|
10823
10892
|
_classCallCheck(this, $);
|
@@ -10861,13 +10930,13 @@ var $ = /*#__PURE__*/function () {
|
|
10861
10930
|
}]);
|
10862
10931
|
return $;
|
10863
10932
|
}();
|
10864
|
-
|
10933
|
+
ui.EventListeners = $;
|
10865
10934
|
$.KEY_DOWN_TIMEOUT = null;
|
10866
|
-
var
|
10867
|
-
Object.defineProperty(
|
10935
|
+
var hi = {};
|
10936
|
+
Object.defineProperty(hi, "__esModule", {
|
10868
10937
|
value: !0
|
10869
10938
|
});
|
10870
|
-
|
10939
|
+
hi.PreResultUtils = void 0;
|
10871
10940
|
var aa = /*#__PURE__*/function () {
|
10872
10941
|
function aa() {
|
10873
10942
|
_classCallCheck(this, aa);
|
@@ -10883,7 +10952,7 @@ var aa = /*#__PURE__*/function () {
|
|
10883
10952
|
}]);
|
10884
10953
|
return aa;
|
10885
10954
|
}();
|
10886
|
-
|
10955
|
+
hi.PreResultUtils = aa;
|
10887
10956
|
var It = {},
|
10888
10957
|
Lt = {};
|
10889
10958
|
Object.defineProperty(Lt, "__esModule", {
|
@@ -11172,11 +11241,11 @@ var J = /*#__PURE__*/function () {
|
|
11172
11241
|
return J;
|
11173
11242
|
}();
|
11174
11243
|
It.CommandUtils = J;
|
11175
|
-
var
|
11176
|
-
Object.defineProperty(
|
11244
|
+
var pi = {};
|
11245
|
+
Object.defineProperty(pi, "__esModule", {
|
11177
11246
|
value: !0
|
11178
11247
|
});
|
11179
|
-
|
11248
|
+
pi.Highlight = void 0;
|
11180
11249
|
var ua = Be,
|
11181
11250
|
st = ze;
|
11182
11251
|
var Jt = /*#__PURE__*/function () {
|
@@ -11228,15 +11297,15 @@ var Jt = /*#__PURE__*/function () {
|
|
11228
11297
|
}]);
|
11229
11298
|
return Jt;
|
11230
11299
|
}();
|
11231
|
-
|
11232
|
-
var
|
11233
|
-
Object.defineProperty(
|
11300
|
+
pi.Highlight = Jt;
|
11301
|
+
var fi = {};
|
11302
|
+
Object.defineProperty(fi, "__esModule", {
|
11234
11303
|
value: !0
|
11235
11304
|
});
|
11236
|
-
|
11305
|
+
fi.Padding = void 0;
|
11237
11306
|
var ha = Be,
|
11238
11307
|
kn = ze,
|
11239
|
-
|
11308
|
+
Ue = Fe;
|
11240
11309
|
var $t = /*#__PURE__*/function () {
|
11241
11310
|
function $t() {
|
11242
11311
|
_classCallCheck(this, $t);
|
@@ -11249,11 +11318,11 @@ var $t = /*#__PURE__*/function () {
|
|
11249
11318
|
r = t.value[n - 1],
|
11250
11319
|
o = t.selectionEnd === null ? n : t.selectionEnd,
|
11251
11320
|
a = t.value[o];
|
11252
|
-
|
11321
|
+
Ue.Text.isCharDefined(r) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), Ue.Text.isCharDefined(a) && (e.endPadding = " ", e.numberOfSpacesAfterNewText = 1), e.isCursorAtEnd = t.value.length === o;
|
11253
11322
|
return;
|
11254
11323
|
}
|
11255
11324
|
var i = t.value[t.value.length - 1];
|
11256
|
-
|
11325
|
+
Ue.Text.isCharDefined(i) && (e.startPadding = " ", e.numberOfSpacesBeforeNewText = 1), e.isCursorAtEnd = !0;
|
11257
11326
|
}
|
11258
11327
|
}, {
|
11259
11328
|
key: "setStateForGenericElement",
|
@@ -11266,12 +11335,12 @@ var $t = /*#__PURE__*/function () {
|
|
11266
11335
|
c = (i = t.textContent) === null || i === void 0 ? void 0 : i[l - 1],
|
11267
11336
|
d = kn.Cursor.getGenericElementCursorOffset(t, a, !1),
|
11268
11337
|
u = (n = t.textContent) === null || n === void 0 ? void 0 : n[d];
|
11269
|
-
|
11338
|
+
Ue.Text.isCharDefined(c) && (e.startPadding = " "), Ue.Text.isCharDefined(u) && (e.endPadding = " "), e.isCursorAtEnd = ((r = t.textContent) === null || r === void 0 ? void 0 : r.length) === d;
|
11270
11339
|
return;
|
11271
11340
|
}
|
11272
11341
|
}
|
11273
11342
|
var o = t.innerText.charAt(t.innerText.length - 1);
|
11274
|
-
|
11343
|
+
Ue.Text.isCharDefined(o) && (e.startPadding = " "), e.isCursorAtEnd = !0;
|
11275
11344
|
}
|
11276
11345
|
}, {
|
11277
11346
|
key: "setState",
|
@@ -11295,21 +11364,21 @@ var $t = /*#__PURE__*/function () {
|
|
11295
11364
|
}]);
|
11296
11365
|
return $t;
|
11297
11366
|
}();
|
11298
|
-
|
11367
|
+
fi.Padding = $t;
|
11299
11368
|
Object.defineProperty(kt, "__esModule", {
|
11300
11369
|
value: !0
|
11301
11370
|
});
|
11302
11371
|
kt.Speech = void 0;
|
11303
|
-
var In =
|
11304
|
-
pa =
|
11372
|
+
var In = ui,
|
11373
|
+
pa = hi,
|
11305
11374
|
Ln = It,
|
11306
11375
|
Pt = Lt,
|
11307
|
-
Ai = hi,
|
11308
|
-
ie = Be,
|
11309
11376
|
ki = pi,
|
11377
|
+
ie = Be,
|
11378
|
+
Ii = fi,
|
11310
11379
|
Rn = nt,
|
11311
11380
|
Nn = ze,
|
11312
|
-
|
11381
|
+
Li = Fe;
|
11313
11382
|
var fa = /*#__PURE__*/function () {
|
11314
11383
|
function fa() {
|
11315
11384
|
_classCallCheck(this, fa);
|
@@ -11331,7 +11400,7 @@ var fa = /*#__PURE__*/function () {
|
|
11331
11400
|
}, {
|
11332
11401
|
key: "prepare",
|
11333
11402
|
value: function prepare(e) {
|
11334
|
-
|
11403
|
+
Ii.Padding.setState(this, e), ki.Highlight.setState(this, e), this.isTargetInShadow = ie.Elements.isInsideShadowDOM(e), ie.Elements.isPrimitiveElement(e) ? (this._primitiveElement = e, this._originalText = this._primitiveElement.value) : (this._genericElement = e, this._originalText = this._genericElement.textContent);
|
11335
11404
|
}
|
11336
11405
|
// there was an attempt to optimize this by not having to restart the service and just reset state:
|
11337
11406
|
// unfortunately it did not work because the service would still continue firing the intermediate and final results
|
@@ -11346,7 +11415,7 @@ var fa = /*#__PURE__*/function () {
|
|
11346
11415
|
key: "updateElements",
|
11347
11416
|
value: function updateElements(e, t, i) {
|
11348
11417
|
var n;
|
11349
|
-
var r =
|
11418
|
+
var r = Li.Text.capitalize(t);
|
11350
11419
|
if (this.finalTranscript === r && e === "") return;
|
11351
11420
|
pa.PreResultUtils.process(this, i, e === "", this._onPreResult, this._options) && (e = "", i = "");
|
11352
11421
|
var o = this.commands && Ln.CommandUtils.execCommand(this, i, this._options, this._primitiveElement || this._genericElement, this._originalText);
|
@@ -11364,7 +11433,7 @@ var fa = /*#__PURE__*/function () {
|
|
11364
11433
|
}, {
|
11365
11434
|
key: "updatePrimitiveElement",
|
11366
11435
|
value: function updatePrimitiveElement(e, t, i) {
|
11367
|
-
this.isHighlighted &&
|
11436
|
+
this.isHighlighted && ki.Highlight.removeForPrimitive(this, e), this.primitiveTextRecorded || Ii.Padding.adjustStateAfterRecodingPrimitiveElement(this, e), i && Ii.Padding.adjustSateForNoTextPrimitiveElement(this);
|
11368
11437
|
var n = this.startPadding + this.finalTranscript + t;
|
11369
11438
|
if (e.value = n + this.endPadding, !this.isTargetInShadow) {
|
11370
11439
|
var r = n.length + this.numberOfSpacesAfterNewText;
|
@@ -11375,12 +11444,12 @@ var fa = /*#__PURE__*/function () {
|
|
11375
11444
|
}, {
|
11376
11445
|
key: "updateGenericElement",
|
11377
11446
|
value: function updateGenericElement(e, t, i) {
|
11378
|
-
this.isHighlighted &&
|
11379
|
-
var n = (i ? "" : this.startPadding) +
|
11447
|
+
this.isHighlighted && ki.Highlight.removeForGeneric(this, e), this.spansPopulated || ie.Elements.appendSpans(this, e);
|
11448
|
+
var n = (i ? "" : this.startPadding) + Li.Text.lineBreak(this.finalTranscript);
|
11380
11449
|
this.finalSpan.innerHTML = n;
|
11381
11450
|
var r = Pt.AutoScroll.isRequired(this.autoScroll, e);
|
11382
11451
|
Pt.AutoScroll.changeStateIfNeeded(this, r);
|
11383
|
-
var o =
|
11452
|
+
var o = Li.Text.lineBreak(t) + (i ? "" : this.endPadding);
|
11384
11453
|
this.interimSpan.innerHTML = o, Rn.Browser.IS_SAFARI() && this.insertInCursorLocation && Nn.Cursor.setOffsetForSafariGeneric(e, n.length + o.length), r && Pt.AutoScroll.scrollGeneric(this, e), i && (this.scrollingSpan.innerHTML = "");
|
11385
11454
|
}
|
11386
11455
|
}, {
|
@@ -11420,19 +11489,18 @@ var fa = /*#__PURE__*/function () {
|
|
11420
11489
|
return fa;
|
11421
11490
|
}();
|
11422
11491
|
kt.Speech = fa;
|
11423
|
-
Object.defineProperty(
|
11492
|
+
Object.defineProperty(ci, "__esModule", {
|
11424
11493
|
value: !0
|
11425
11494
|
});
|
11426
|
-
|
11427
|
-
var On =
|
11495
|
+
ci.WebSpeech = void 0;
|
11496
|
+
var On = di,
|
11428
11497
|
Pn = nt,
|
11429
11498
|
ma = kt;
|
11430
11499
|
var Yt = /*#__PURE__*/function (_ma$Speech) {
|
11431
11500
|
_inherits(Yt, _ma$Speech);
|
11432
|
-
var _super41 = _createSuper(Yt);
|
11433
11501
|
function Yt() {
|
11434
11502
|
_classCallCheck(this, Yt);
|
11435
|
-
return
|
11503
|
+
return _callSuper(this, Yt);
|
11436
11504
|
}
|
11437
11505
|
_createClass(Yt, [{
|
11438
11506
|
key: "start",
|
@@ -11493,12 +11561,12 @@ var Yt = /*#__PURE__*/function (_ma$Speech) {
|
|
11493
11561
|
}]);
|
11494
11562
|
return Yt;
|
11495
11563
|
}(ma.Speech);
|
11496
|
-
|
11497
|
-
var
|
11498
|
-
Object.defineProperty(
|
11564
|
+
ci.WebSpeech = Yt;
|
11565
|
+
var mi = {};
|
11566
|
+
Object.defineProperty(mi, "__esModule", {
|
11499
11567
|
value: !0
|
11500
11568
|
});
|
11501
|
-
|
11569
|
+
mi.GlobalState = void 0;
|
11502
11570
|
var Ze = /*#__PURE__*/function () {
|
11503
11571
|
function Ze() {
|
11504
11572
|
_classCallCheck(this, Ze);
|
@@ -11513,14 +11581,14 @@ var Ze = /*#__PURE__*/function () {
|
|
11513
11581
|
}]);
|
11514
11582
|
return Ze;
|
11515
11583
|
}();
|
11516
|
-
|
11584
|
+
mi.GlobalState = Ze;
|
11517
11585
|
Ze.doubleClickPending = !1;
|
11518
|
-
var
|
11519
|
-
|
11520
|
-
Object.defineProperty(
|
11586
|
+
var gi = {},
|
11587
|
+
bi = {};
|
11588
|
+
Object.defineProperty(bi, "__esModule", {
|
11521
11589
|
value: !0
|
11522
11590
|
});
|
11523
|
-
|
11591
|
+
bi.PreventConnectionStop = void 0;
|
11524
11592
|
var ga = /*#__PURE__*/function () {
|
11525
11593
|
function ga() {
|
11526
11594
|
_classCallCheck(this, ga);
|
@@ -11540,19 +11608,19 @@ var ga = /*#__PURE__*/function () {
|
|
11540
11608
|
}]);
|
11541
11609
|
return ga;
|
11542
11610
|
}();
|
11543
|
-
|
11544
|
-
var
|
11545
|
-
|
11546
|
-
Object.defineProperty(
|
11611
|
+
bi.PreventConnectionStop = ga;
|
11612
|
+
var vi = {},
|
11613
|
+
yi = {};
|
11614
|
+
Object.defineProperty(yi, "__esModule", {
|
11547
11615
|
value: !0
|
11548
11616
|
});
|
11549
|
-
|
11550
|
-
|
11551
|
-
Object.defineProperty(
|
11617
|
+
yi.README_URL = void 0;
|
11618
|
+
yi.README_URL = "https://github.com/OvidijusParsiunas/speech-to-element";
|
11619
|
+
Object.defineProperty(vi, "__esModule", {
|
11552
11620
|
value: !0
|
11553
11621
|
});
|
11554
|
-
|
11555
|
-
var
|
11622
|
+
vi.AzureSpeechConfig = void 0;
|
11623
|
+
var Ri = yi;
|
11556
11624
|
var Zt = /*#__PURE__*/function () {
|
11557
11625
|
function Zt() {
|
11558
11626
|
_classCallCheck(this, Zt);
|
@@ -11560,29 +11628,29 @@ var Zt = /*#__PURE__*/function () {
|
|
11560
11628
|
_createClass(Zt, null, [{
|
11561
11629
|
key: "validateOptions",
|
11562
11630
|
value: function validateOptions(e, t) {
|
11563
|
-
return t ? !t.subscriptionKey && !t.token && !t.retrieveToken ? (e("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(
|
11631
|
+
return t ? !t.subscriptionKey && !t.token && !t.retrieveToken ? (e("Please define a 'subscriptionKey', 'token' or 'retrieveToken' property - more info: ".concat(Ri.README_URL)), !1) : t.region ? !0 : (e("Please define a 'region' property - more info: ".concat(Ri.README_URL)), !1) : (e("Please provide subscription details - more info: ".concat(Ri.README_URL)), !1);
|
11564
11632
|
}
|
11565
11633
|
}, {
|
11566
11634
|
key: "getNewSpeechConfig",
|
11567
11635
|
value: function () {
|
11568
|
-
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11569
|
-
return _regeneratorRuntime().wrap(function
|
11570
|
-
while (1) switch (
|
11636
|
+
var _getNewSpeechConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee99(e, t) {
|
11637
|
+
return _regeneratorRuntime().wrap(function _callee99$(_context99) {
|
11638
|
+
while (1) switch (_context99.prev = _context99.next) {
|
11571
11639
|
case 0:
|
11572
11640
|
if (!t.region) {
|
11573
|
-
|
11641
|
+
_context99.next = 2;
|
11574
11642
|
break;
|
11575
11643
|
}
|
11576
|
-
return
|
11644
|
+
return _context99.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 (i) {
|
11577
11645
|
return t.region ? e.fromAuthorizationToken((i == null ? void 0 : i.trim()) || "", t.region.trim()) : null;
|
11578
11646
|
})["catch"](function (i) {
|
11579
11647
|
return console.error(i), null;
|
11580
11648
|
}) : null);
|
11581
11649
|
case 2:
|
11582
11650
|
case "end":
|
11583
|
-
return
|
11651
|
+
return _context99.stop();
|
11584
11652
|
}
|
11585
|
-
},
|
11653
|
+
}, _callee99);
|
11586
11654
|
}));
|
11587
11655
|
function getNewSpeechConfig(_x183, _x184) {
|
11588
11656
|
return _getNewSpeechConfig.apply(this, arguments);
|
@@ -11597,21 +11665,21 @@ var Zt = /*#__PURE__*/function () {
|
|
11597
11665
|
}, {
|
11598
11666
|
key: "get",
|
11599
11667
|
value: function () {
|
11600
|
-
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11668
|
+
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee100(e, t) {
|
11601
11669
|
var i;
|
11602
|
-
return _regeneratorRuntime().wrap(function
|
11603
|
-
while (1) switch (
|
11670
|
+
return _regeneratorRuntime().wrap(function _callee100$(_context100) {
|
11671
|
+
while (1) switch (_context100.prev = _context100.next) {
|
11604
11672
|
case 0:
|
11605
|
-
|
11673
|
+
_context100.next = 2;
|
11606
11674
|
return Zt.getNewSpeechConfig(e, t);
|
11607
11675
|
case 2:
|
11608
|
-
i =
|
11609
|
-
return
|
11676
|
+
i = _context100.sent;
|
11677
|
+
return _context100.abrupt("return", (i && Zt.process(i, t), i));
|
11610
11678
|
case 4:
|
11611
11679
|
case "end":
|
11612
|
-
return
|
11680
|
+
return _context100.stop();
|
11613
11681
|
}
|
11614
|
-
},
|
11682
|
+
}, _callee100);
|
11615
11683
|
}));
|
11616
11684
|
function get(_x185, _x186) {
|
11617
11685
|
return _get.apply(this, arguments);
|
@@ -11621,12 +11689,12 @@ var Zt = /*#__PURE__*/function () {
|
|
11621
11689
|
}]);
|
11622
11690
|
return Zt;
|
11623
11691
|
}();
|
11624
|
-
|
11625
|
-
var
|
11626
|
-
Object.defineProperty(
|
11692
|
+
vi.AzureSpeechConfig = Zt;
|
11693
|
+
var xi = {};
|
11694
|
+
Object.defineProperty(xi, "__esModule", {
|
11627
11695
|
value: !0
|
11628
11696
|
});
|
11629
|
-
|
11697
|
+
xi.StopTimeout = void 0;
|
11630
11698
|
var Et = /*#__PURE__*/function () {
|
11631
11699
|
function Et() {
|
11632
11700
|
_classCallCheck(this, Et);
|
@@ -11646,13 +11714,13 @@ var Et = /*#__PURE__*/function () {
|
|
11646
11714
|
}]);
|
11647
11715
|
return Et;
|
11648
11716
|
}();
|
11649
|
-
|
11717
|
+
xi.StopTimeout = Et;
|
11650
11718
|
Et.DEFAULT_MS = 2e4;
|
11651
|
-
var
|
11652
|
-
Object.defineProperty(
|
11719
|
+
var Ei = {};
|
11720
|
+
Object.defineProperty(Ei, "__esModule", {
|
11653
11721
|
value: !0
|
11654
11722
|
});
|
11655
|
-
|
11723
|
+
Ei.AzureTranscript = void 0;
|
11656
11724
|
var ba = At;
|
11657
11725
|
var va = /*#__PURE__*/function () {
|
11658
11726
|
function va() {
|
@@ -11676,53 +11744,52 @@ var va = /*#__PURE__*/function () {
|
|
11676
11744
|
}]);
|
11677
11745
|
return va;
|
11678
11746
|
}();
|
11679
|
-
|
11680
|
-
Object.defineProperty(
|
11747
|
+
Ei.AzureTranscript = va;
|
11748
|
+
Object.defineProperty(gi, "__esModule", {
|
11681
11749
|
value: !0
|
11682
11750
|
});
|
11683
|
-
|
11684
|
-
var Dn =
|
11685
|
-
jn =
|
11686
|
-
|
11687
|
-
Fn =
|
11751
|
+
gi.Azure = void 0;
|
11752
|
+
var Dn = bi,
|
11753
|
+
jn = vi,
|
11754
|
+
Ni = xi,
|
11755
|
+
Fn = Ei,
|
11688
11756
|
ya = kt;
|
11689
11757
|
var Xt = /*#__PURE__*/function (_ya$Speech) {
|
11690
11758
|
_inherits(Xt, _ya$Speech);
|
11691
|
-
var _super42 = _createSuper(Xt);
|
11692
11759
|
function Xt() {
|
11693
11760
|
var _this53;
|
11694
11761
|
_classCallCheck(this, Xt);
|
11695
|
-
_this53 =
|
11762
|
+
_this53 = _callSuper(this, Xt, arguments), _this53._newTextPadding = "";
|
11696
11763
|
return _this53;
|
11697
11764
|
}
|
11698
11765
|
_createClass(Xt, [{
|
11699
11766
|
key: "start",
|
11700
11767
|
value: function start(e, t) {
|
11701
|
-
this._newTextPadding = "", this.stopTimeout === void 0 &&
|
11768
|
+
this._newTextPadding = "", this.stopTimeout === void 0 && Ni.StopTimeout.reset(this, e == null ? void 0 : e.stopAfterSilenceMs), this.prepareBeforeStart(e), this.startAsync(e), t || Dn.PreventConnectionStop.applyPrevention(this);
|
11702
11769
|
}
|
11703
11770
|
}, {
|
11704
11771
|
key: "startAsync",
|
11705
11772
|
value: function () {
|
11706
|
-
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11773
|
+
var _startAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee101(e) {
|
11707
11774
|
var t;
|
11708
|
-
return _regeneratorRuntime().wrap(function
|
11709
|
-
while (1) switch (
|
11775
|
+
return _regeneratorRuntime().wrap(function _callee101$(_context101) {
|
11776
|
+
while (1) switch (_context101.prev = _context101.next) {
|
11710
11777
|
case 0:
|
11711
|
-
|
11712
|
-
if (!
|
11713
|
-
|
11778
|
+
_context101.t0 = this.validate(e);
|
11779
|
+
if (!_context101.t0) {
|
11780
|
+
_context101.next = 6;
|
11714
11781
|
break;
|
11715
11782
|
}
|
11716
|
-
|
11783
|
+
_context101.next = 4;
|
11717
11784
|
return this.instantiateService(e);
|
11718
11785
|
case 4:
|
11719
11786
|
this._translations = e == null ? void 0 : e.translations;
|
11720
11787
|
(t = this._service) === null || t === void 0 || t.startContinuousRecognitionAsync(function () {}, this.error);
|
11721
11788
|
case 6:
|
11722
11789
|
case "end":
|
11723
|
-
return
|
11790
|
+
return _context101.stop();
|
11724
11791
|
}
|
11725
|
-
},
|
11792
|
+
}, _callee101, this);
|
11726
11793
|
}));
|
11727
11794
|
function startAsync(_x187) {
|
11728
11795
|
return _startAsync.apply(this, arguments);
|
@@ -11737,26 +11804,26 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11737
11804
|
}, {
|
11738
11805
|
key: "instantiateService",
|
11739
11806
|
value: function () {
|
11740
|
-
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
11807
|
+
var _instantiateService = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee102(e) {
|
11741
11808
|
var t, i, n, r;
|
11742
|
-
return _regeneratorRuntime().wrap(function
|
11743
|
-
while (1) switch (
|
11809
|
+
return _regeneratorRuntime().wrap(function _callee102$(_context102) {
|
11810
|
+
while (1) switch (_context102.prev = _context102.next) {
|
11744
11811
|
case 0:
|
11745
11812
|
t = Xt.getAPI();
|
11746
11813
|
i = t.AudioConfig.fromDefaultMicrophoneInput();
|
11747
|
-
|
11814
|
+
_context102.next = 4;
|
11748
11815
|
return jn.AzureSpeechConfig.get(t.SpeechConfig, e);
|
11749
11816
|
case 4:
|
11750
|
-
n =
|
11817
|
+
n = _context102.sent;
|
11751
11818
|
if (n) {
|
11752
11819
|
r = new t.SpeechRecognizer(n, i);
|
11753
11820
|
this.setEvents(r), this._service = r, e.retrieveToken && this.retrieveTokenInterval(e.retrieveToken);
|
11754
11821
|
} else this.error("Unable to contact Azure server");
|
11755
11822
|
case 6:
|
11756
11823
|
case "end":
|
11757
|
-
return
|
11824
|
+
return _context102.stop();
|
11758
11825
|
}
|
11759
|
-
},
|
11826
|
+
}, _callee102, this);
|
11760
11827
|
}));
|
11761
11828
|
function instantiateService(_x188) {
|
11762
11829
|
return _instantiateService.apply(this, arguments);
|
@@ -11777,7 +11844,7 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11777
11844
|
i = _Fn$AzureTranscript$e.interimTranscript,
|
11778
11845
|
n = _Fn$AzureTranscript$e.finalTranscript,
|
11779
11846
|
r = _Fn$AzureTranscript$e.newText;
|
11780
|
-
|
11847
|
+
Ni.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(i, n, r);
|
11781
11848
|
}
|
11782
11849
|
// WORK - huge opportunity to fix this in the repo!!!!!
|
11783
11850
|
// function onRecognized(sender, recognitionEventArgs) {
|
@@ -11798,7 +11865,7 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11798
11865
|
n = _Fn$AzureTranscript$e2.interimTranscript,
|
11799
11866
|
r = _Fn$AzureTranscript$e2.finalTranscript,
|
11800
11867
|
o = _Fn$AzureTranscript$e2.newText;
|
11801
|
-
|
11868
|
+
Ni.StopTimeout.reset(this, this.stopTimeoutMS), this.updateElements(n, r, o), r !== "" && (this._newTextPadding = " ");
|
11802
11869
|
}
|
11803
11870
|
break;
|
11804
11871
|
}
|
@@ -11854,14 +11921,14 @@ var Xt = /*#__PURE__*/function (_ya$Speech) {
|
|
11854
11921
|
}]);
|
11855
11922
|
return Xt;
|
11856
11923
|
}(ya.Speech);
|
11857
|
-
|
11924
|
+
gi.Azure = Xt;
|
11858
11925
|
Object.defineProperty(gs, "__esModule", {
|
11859
11926
|
value: !0
|
11860
11927
|
});
|
11861
|
-
var Bn =
|
11928
|
+
var Bn = ci,
|
11862
11929
|
xa = It,
|
11863
|
-
ee =
|
11864
|
-
Ea =
|
11930
|
+
ee = mi,
|
11931
|
+
Ea = gi;
|
11865
11932
|
var Je = /*#__PURE__*/function () {
|
11866
11933
|
function Je() {
|
11867
11934
|
_classCallCheck(this, Je);
|
@@ -11903,19 +11970,18 @@ var Je = /*#__PURE__*/function () {
|
|
11903
11970
|
}]);
|
11904
11971
|
return Je;
|
11905
11972
|
}();
|
11906
|
-
var
|
11973
|
+
var Oi = gs["default"] = Je;
|
11907
11974
|
var Qt = /*#__PURE__*/function (_xt) {
|
11908
11975
|
_inherits(Qt, _xt);
|
11909
|
-
var _super43 = _createSuper(Qt);
|
11910
11976
|
function Qt(e, t, i) {
|
11911
11977
|
var _this55;
|
11912
11978
|
_classCallCheck(this, Qt);
|
11913
11979
|
var o;
|
11914
|
-
_this55 =
|
11980
|
+
_this55 = _callSuper(this, Qt, [_typeof(e.speechToText) == "object" ? (o = e.speechToText) == null ? void 0 : o.button : {}]);
|
11915
11981
|
var _Qt$processConfigurat = Qt.processConfiguration(t, e.speechToText),
|
11916
11982
|
n = _Qt$processConfigurat.serviceName,
|
11917
11983
|
r = _Qt$processConfigurat.processedConfig;
|
11918
|
-
if (_this55._addErrorMessage = i, n === "webspeech" && !
|
11984
|
+
if (_this55._addErrorMessage = i, n === "webspeech" && !Oi.isWebSpeechSupported()) _this55.changeToUnsupported();else {
|
11919
11985
|
var a = !e.textInput || !e.textInput.disabled;
|
11920
11986
|
_this55.elementRef.onclick = _this55.buttonClick.bind(_assertThisInitialized(_this55), t, a, n, r);
|
11921
11987
|
}
|
@@ -11925,7 +11991,7 @@ var Qt = /*#__PURE__*/function (_xt) {
|
|
11925
11991
|
_createClass(Qt, [{
|
11926
11992
|
key: "buttonClick",
|
11927
11993
|
value: function buttonClick(e, t, i, n) {
|
11928
|
-
e.removeTextIfPlaceholder(),
|
11994
|
+
e.removeTextIfPlaceholder(), Oi.toggle(i, _objectSpread({
|
11929
11995
|
insertInCursorLocation: !1,
|
11930
11996
|
element: t ? e.inputElementRef : void 0,
|
11931
11997
|
onError: this.onError.bind(this),
|
@@ -11963,7 +12029,7 @@ var Qt = /*#__PURE__*/function (_xt) {
|
|
11963
12029
|
return d.toLowerCase().includes(a) ? (setTimeout(function () {
|
11964
12030
|
var u;
|
11965
12031
|
return (u = e.submit) == null ? void 0 : u.call(e);
|
11966
|
-
}),
|
12032
|
+
}), Oi.endCommandMode(), {
|
11967
12033
|
restart: !0,
|
11968
12034
|
removeNewText: !0
|
11969
12035
|
}) : null;
|
@@ -11996,17 +12062,16 @@ var bs = /*#__PURE__*/function () {
|
|
11996
12062
|
}]);
|
11997
12063
|
return bs;
|
11998
12064
|
}();
|
11999
|
-
var
|
12000
|
-
_inherits(
|
12001
|
-
|
12002
|
-
function Sa(e, t) {
|
12065
|
+
var _a = /*#__PURE__*/function (_xt2) {
|
12066
|
+
_inherits(_a, _xt2);
|
12067
|
+
function _a(e, t) {
|
12003
12068
|
var _this56;
|
12004
|
-
_classCallCheck(this,
|
12069
|
+
_classCallCheck(this, _a);
|
12005
12070
|
var i, n;
|
12006
|
-
_this56 =
|
12071
|
+
_this56 = _callSuper(this, _a, [t.button]), _this56._waitingForBrowserApproval = !1, _this56._audioType = e, _this56._extension = ((i = t.files) == null ? void 0 : i.format) || "mp3", _this56._maxDurationSeconds = (n = t.files) == null ? void 0 : n.maxDurationSeconds, _this56.elementRef.onclick = _this56.buttonClick.bind(_assertThisInitialized(_this56));
|
12007
12072
|
return _this56;
|
12008
12073
|
}
|
12009
|
-
_createClass(
|
12074
|
+
_createClass(_a, [{
|
12010
12075
|
key: "buttonClick",
|
12011
12076
|
value: function buttonClick() {
|
12012
12077
|
this._waitingForBrowserApproval || (this.isActive ? this.stop() : (this._waitingForBrowserApproval = !0, this.record()));
|
@@ -12057,7 +12122,7 @@ var Sa = /*#__PURE__*/function (_xt2) {
|
|
12057
12122
|
};
|
12058
12123
|
}
|
12059
12124
|
}]);
|
12060
|
-
return
|
12125
|
+
return _a;
|
12061
12126
|
}(xt);
|
12062
12127
|
var wa = "<?xml version=\"1.0\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" stroke=\"currentColor\" fill=\"none\" stroke-width=\"1\" viewBox=\"0 0 24 24\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"22\" y1=\"2\" x2=\"11\" y2=\"14\"></line>\n <polygon points=\"22 2 15 22 11 14 2 10 22 2\"></polygon>\n</svg>\n";
|
12063
12128
|
var B = /*#__PURE__*/function () {
|
@@ -12128,15 +12193,14 @@ var ke = /*#__PURE__*/function () {
|
|
12128
12193
|
}]);
|
12129
12194
|
return ke;
|
12130
12195
|
}();
|
12131
|
-
var
|
12196
|
+
var _i = /*#__PURE__*/function (_Tt4) {
|
12132
12197
|
_inherits(k, _Tt4);
|
12133
|
-
var _super45 = _createSuper(k);
|
12134
12198
|
// prettier-ignore
|
12135
12199
|
function k(e, t, i, n, r) {
|
12136
12200
|
var _this60;
|
12137
12201
|
_classCallCheck(this, k);
|
12138
12202
|
var o = ke.process(e.submitButtonStyles);
|
12139
|
-
_this60 =
|
12203
|
+
_this60 = _callSuper(this, k, [k.createButtonContainerElement(), o == null ? void 0 : o.position, o]), _this60._isSVGLoadingIconOverriden = !1, _this60.status = {
|
12140
12204
|
requestInProgress: !1,
|
12141
12205
|
loadingActive: !1
|
12142
12206
|
}, _this60._messages = i, _this60._inputElementRef = t, _this60._fileAttachments = r, _this60._innerElements = _this60.createInnerElements(), _this60._abortStream = new AbortController(), _this60._stopClicked = {
|
@@ -12200,12 +12264,12 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12200
12264
|
}, {
|
12201
12265
|
key: "submitFromInput",
|
12202
12266
|
value: function () {
|
12203
|
-
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12267
|
+
var _submitFromInput = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee103() {
|
12204
12268
|
var t, e, _i18;
|
12205
|
-
return _regeneratorRuntime().wrap(function
|
12206
|
-
while (1) switch (
|
12269
|
+
return _regeneratorRuntime().wrap(function _callee103$(_context103) {
|
12270
|
+
while (1) switch (_context103.prev = _context103.next) {
|
12207
12271
|
case 0:
|
12208
|
-
|
12272
|
+
_context103.next = 2;
|
12209
12273
|
return this._fileAttachments.completePlaceholders();
|
12210
12274
|
case 2:
|
12211
12275
|
e = this._fileAttachments.getAllFileData();
|
@@ -12221,9 +12285,9 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12221
12285
|
}
|
12222
12286
|
case 4:
|
12223
12287
|
case "end":
|
12224
|
-
return
|
12288
|
+
return _context103.stop();
|
12225
12289
|
}
|
12226
|
-
},
|
12290
|
+
}, _callee103, this);
|
12227
12291
|
}));
|
12228
12292
|
function submitFromInput() {
|
12229
12293
|
return _submitFromInput.apply(this, arguments);
|
@@ -12233,11 +12297,11 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12233
12297
|
}, {
|
12234
12298
|
key: "programmaticSubmit",
|
12235
12299
|
value: function () {
|
12236
|
-
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12300
|
+
var _programmaticSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee104(e) {
|
12237
12301
|
var _this61 = this;
|
12238
12302
|
var t;
|
12239
|
-
return _regeneratorRuntime().wrap(function
|
12240
|
-
while (1) switch (
|
12303
|
+
return _regeneratorRuntime().wrap(function _callee104$(_context104) {
|
12304
|
+
while (1) switch (_context104.prev = _context104.next) {
|
12241
12305
|
case 0:
|
12242
12306
|
typeof e == "string" && (e = Le.processSubmitUserMessage(e));
|
12243
12307
|
t = {
|
@@ -12253,9 +12317,9 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12253
12317
|
});
|
12254
12318
|
case 3:
|
12255
12319
|
case "end":
|
12256
|
-
return
|
12320
|
+
return _context104.stop();
|
12257
12321
|
}
|
12258
|
-
},
|
12322
|
+
}, _callee104);
|
12259
12323
|
}));
|
12260
12324
|
function programmaticSubmit(_x189) {
|
12261
12325
|
return _programmaticSubmit.apply(this, arguments);
|
@@ -12265,50 +12329,50 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12265
12329
|
}, {
|
12266
12330
|
key: "attemptSubmit",
|
12267
12331
|
value: function () {
|
12268
|
-
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12332
|
+
var _attemptSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee105(e) {
|
12269
12333
|
var t,
|
12270
12334
|
r,
|
12271
12335
|
o,
|
12272
12336
|
a,
|
12273
12337
|
i,
|
12274
12338
|
n,
|
12275
|
-
|
12276
|
-
return _regeneratorRuntime().wrap(function
|
12277
|
-
while (1) switch (
|
12339
|
+
_args105 = arguments;
|
12340
|
+
return _regeneratorRuntime().wrap(function _callee105$(_context105) {
|
12341
|
+
while (1) switch (_context105.prev = _context105.next) {
|
12278
12342
|
case 0:
|
12279
|
-
t =
|
12280
|
-
|
12343
|
+
t = _args105.length > 1 && _args105[1] !== undefined ? _args105[1] : !1;
|
12344
|
+
_context105.next = 3;
|
12281
12345
|
return (r = this._validationHandler) == null ? void 0 : r.call(this, t ? e : void 0);
|
12282
12346
|
case 3:
|
12283
|
-
|
12284
|
-
|
12285
|
-
if (!(
|
12286
|
-
|
12347
|
+
_context105.t0 = _context105.sent;
|
12348
|
+
_context105.t1 = !1;
|
12349
|
+
if (!(_context105.t0 === _context105.t1)) {
|
12350
|
+
_context105.next = 7;
|
12287
12351
|
break;
|
12288
12352
|
}
|
12289
|
-
return
|
12353
|
+
return _context105.abrupt("return");
|
12290
12354
|
case 7:
|
12291
12355
|
this.changeToLoadingIcon();
|
12292
|
-
|
12356
|
+
_context105.next = 10;
|
12293
12357
|
return this.addNewMessage(e);
|
12294
12358
|
case 10:
|
12295
12359
|
this._serviceIO.isWebModel() || this._messages.addLoadingMessage();
|
12296
|
-
|
12360
|
+
Gi.clear(this._inputElementRef);
|
12297
12361
|
i = (o = e.files) == null ? void 0 : o.map(function (l) {
|
12298
12362
|
return l.file;
|
12299
12363
|
}), n = {
|
12300
12364
|
text: e.text === "" ? void 0 : e.text,
|
12301
12365
|
files: i
|
12302
12366
|
};
|
12303
|
-
|
12367
|
+
_context105.next = 15;
|
12304
12368
|
return this._serviceIO.callAPI(n, this._messages);
|
12305
12369
|
case 15:
|
12306
12370
|
(a = this._fileAttachments) == null || a.removeAllFiles();
|
12307
12371
|
case 16:
|
12308
12372
|
case "end":
|
12309
|
-
return
|
12373
|
+
return _context105.stop();
|
12310
12374
|
}
|
12311
|
-
},
|
12375
|
+
}, _callee105, this);
|
12312
12376
|
}));
|
12313
12377
|
function attemptSubmit(_x190) {
|
12314
12378
|
return _attemptSubmit.apply(this, arguments);
|
@@ -12318,33 +12382,33 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12318
12382
|
}, {
|
12319
12383
|
key: "addNewMessage",
|
12320
12384
|
value: function () {
|
12321
|
-
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
12385
|
+
var _addNewMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee106(_ref14) {
|
12322
12386
|
var e, t, i;
|
12323
|
-
return _regeneratorRuntime().wrap(function
|
12324
|
-
while (1) switch (
|
12387
|
+
return _regeneratorRuntime().wrap(function _callee106$(_context106) {
|
12388
|
+
while (1) switch (_context106.prev = _context106.next) {
|
12325
12389
|
case 0:
|
12326
12390
|
e = _ref14.text, t = _ref14.files;
|
12327
12391
|
i = {
|
12328
12392
|
role: v.USER_ROLE
|
12329
12393
|
};
|
12330
12394
|
e && (i.text = e);
|
12331
|
-
|
12332
|
-
if (!
|
12333
|
-
|
12395
|
+
_context106.t0 = t;
|
12396
|
+
if (!_context106.t0) {
|
12397
|
+
_context106.next = 8;
|
12334
12398
|
break;
|
12335
12399
|
}
|
12336
|
-
|
12400
|
+
_context106.next = 7;
|
12337
12401
|
return this._messages.addMultipleFiles(t);
|
12338
12402
|
case 7:
|
12339
|
-
i.files =
|
12403
|
+
i.files = _context106.sent;
|
12340
12404
|
case 8:
|
12341
12405
|
this._serviceIO.sessionId && (i._sessionId = this._serviceIO.sessionId);
|
12342
12406
|
Object.keys(i).length > 0 && this._messages.addNewMessage(i);
|
12343
12407
|
case 10:
|
12344
12408
|
case "end":
|
12345
|
-
return
|
12409
|
+
return _context106.stop();
|
12346
12410
|
}
|
12347
|
-
},
|
12411
|
+
}, _callee106, this);
|
12348
12412
|
}));
|
12349
12413
|
function addNewMessage(_x191) {
|
12350
12414
|
return _addNewMessage.apply(this, arguments);
|
@@ -12414,22 +12478,21 @@ var Ei = /*#__PURE__*/function (_Tt4) {
|
|
12414
12478
|
}]);
|
12415
12479
|
return k;
|
12416
12480
|
}(Tt);
|
12417
|
-
|
12418
|
-
|
12419
|
-
|
12420
|
-
var
|
12481
|
+
_i.SUBMIT_CLASS = "submit-button";
|
12482
|
+
_i.LOADING_CLASS = "loading-button";
|
12483
|
+
_i.DISABLED_CLASS = "disabled-button";
|
12484
|
+
var Sa = _i;
|
12421
12485
|
var Ma = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M27.1 14.313V5.396L24.158 8.34c-2.33-2.325-5.033-3.503-8.11-3.503C9.902 4.837 4.901 9.847 4.899 16c.001 6.152 5.003 11.158 11.15 11.16 4.276 0 9.369-2.227 10.836-8.478l.028-.122h-3.23l-.022.068c-1.078 3.242-4.138 5.421-7.613 5.421a8 8 0 0 1-5.691-2.359A7.993 7.993 0 0 1 8 16.001c0-4.438 3.611-8.049 8.05-8.049 2.069 0 3.638.58 5.924 2.573l-3.792 3.789H27.1z\"/>\n</svg>\n",
|
12422
12486
|
Ta = "<?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>capture</title>\n <path d=\"M0 16q0 3.264 1.28 6.208t3.392 5.12 5.12 3.424 6.208 1.248 6.208-1.248 5.12-3.424 3.392-5.12 1.28-6.208-1.28-6.208-3.392-5.12-5.088-3.392-6.24-1.28q-3.264 0-6.208 1.28t-5.12 3.392-3.392 5.12-1.28 6.208zM4 16q0-3.264 1.6-6.016t4.384-4.352 6.016-1.632 6.016 1.632 4.384 4.352 1.6 6.016-1.6 6.048-4.384 4.352-6.016 1.6-6.016-1.6-4.384-4.352-1.6-6.048z\"></path>\n</svg>\n",
|
12423
12487
|
Ca = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z\"/>\n</svg>",
|
12424
12488
|
Aa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M4.89163 13.2687L9.16582 17.5427L18.7085 8\" stroke=\"#000000\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>";
|
12425
12489
|
var rn = /*#__PURE__*/function (_ct) {
|
12426
12490
|
_inherits(rn, _ct);
|
12427
|
-
var _super46 = _createSuper(rn);
|
12428
12491
|
// prettier-ignore
|
12429
12492
|
function rn(e, t, i, n) {
|
12430
12493
|
var _this62;
|
12431
12494
|
_classCallCheck(this, rn);
|
12432
|
-
_this62 =
|
12495
|
+
_this62 = _callSuper(this, rn, [e, ["modal-content", "modal-camera-content"], i]), _this62._stopped = !1, _this62._format = "image/png", _this62._canvas = document.createElement("canvas"), _this62._canvas.classList.add("camera-modal-canvas");
|
12433
12496
|
var _this62$addButtonsAnd = _this62.addButtonsAndTheirEvents(t),
|
12434
12497
|
r = _this62$addButtonsAnd.captureButton,
|
12435
12498
|
o = _this62$addButtonsAnd.submitButton;
|
@@ -12540,12 +12603,11 @@ var rn = /*#__PURE__*/function (_ct) {
|
|
12540
12603
|
var ka = "<?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 <path d=\"M29 7h-4.599l-2.401-4h-12l-2.4 4h-4.6c-1 0-3 1-3 2.969v16.031c0 1.657 1.5 3 2.792 3h26.271c1.313 0 2.938-1.406 2.938-2.968v-16.032c0-1-1-3-3-3zM30 26.032c0 0.395-0.639 0.947-0.937 0.969h-26.265c-0.232-0.019-0.797-0.47-0.797-1v-16.031c0-0.634 0.851-0.953 1-0.969h5.732l2.4-4h9.802l1.785 3.030 0.55 0.97h5.731c0.705 0 0.99 0.921 1 1v16.032zM16 10c-3.866 0-7 3.134-7 7s3.134 7 7 7 7-3.134 7-7-3.134-7-7-7zM16 22c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z\"></path>\n</svg>";
|
12541
12604
|
var ei = /*#__PURE__*/function (_Tt5) {
|
12542
12605
|
_inherits(ei, _Tt5);
|
12543
|
-
var _super47 = _createSuper(ei);
|
12544
12606
|
function ei(e, t, i) {
|
12545
12607
|
var _this66;
|
12546
12608
|
_classCallCheck(this, ei);
|
12547
12609
|
var r;
|
12548
|
-
_this66 =
|
12610
|
+
_this66 = _callSuper(this, ei, [ei.createButtonElement(), (r = i == null ? void 0 : i.button) == null ? void 0 : r.position, (i == null ? void 0 : i.button) || {}, "Photo"]);
|
12549
12611
|
var n = _this66.createInnerElements(_this66._customStyles);
|
12550
12612
|
i && _this66.addClickEvent(e, t, i.modalContainerStyle, i.files), _this66.elementRef.classList.add("upload-file-button"), _this66.elementRef.appendChild(n.styles), _this66.reapplyStateStyle("styles");
|
12551
12613
|
return _this66;
|
@@ -12589,13 +12651,13 @@ var mt = /*#__PURE__*/function () {
|
|
12589
12651
|
function mt(e, t, i, n) {
|
12590
12652
|
_classCallCheck(this, mt);
|
12591
12653
|
this.elementRef = mt.createPanelElement(e.inputAreaStyle);
|
12592
|
-
var r = new
|
12654
|
+
var r = new Gi(e, i),
|
12593
12655
|
o = {},
|
12594
12656
|
a = this.createFileUploadComponents(e, i, n, o);
|
12595
12657
|
e.speechToText && !o.microphone && (o.microphone = {
|
12596
12658
|
button: new Qt(e, r, t.addNewErrorMessage.bind(t))
|
12597
12659
|
});
|
12598
|
-
var l = new
|
12660
|
+
var l = new Sa(e, r.inputElementRef, t, i, a);
|
12599
12661
|
r.submit = l.submitFromInput.bind(l), Ce.attach(e, i, r, a, l), e.submitUserMessage = l.programmaticSubmit.bind(l), o.submit = {
|
12600
12662
|
button: l
|
12601
12663
|
}, mt.addElements(this.elementRef, r, o, n, a, e.dropupStyles);
|
@@ -12616,7 +12678,7 @@ var mt = /*#__PURE__*/function () {
|
|
12616
12678
|
if ((l = t.recordAudio) != null && l.files) {
|
12617
12679
|
var _d = ((c = n.audio) == null ? void 0 : c.fileType) || r.addType(e, t.recordAudio.files, "audio");
|
12618
12680
|
n.microphone = {
|
12619
|
-
button: new
|
12681
|
+
button: new _a(_d, t.recordAudio)
|
12620
12682
|
};
|
12621
12683
|
}
|
12622
12684
|
return de.isEnabled(r, e.dragAndDrop) && de.create(i, r, e.dragAndDrop), r;
|
@@ -12692,11 +12754,10 @@ var La = Object.defineProperty,
|
|
12692
12754
|
};
|
12693
12755
|
var b = /*#__PURE__*/function (_yo) {
|
12694
12756
|
_inherits(b, _yo);
|
12695
|
-
var _super48 = _createSuper(b);
|
12696
12757
|
function b() {
|
12697
12758
|
var _this67;
|
12698
12759
|
_classCallCheck(this, b);
|
12699
|
-
_this67 =
|
12760
|
+
_this67 = _callSuper(this, b), _this67.getMessages = function () {
|
12700
12761
|
return [];
|
12701
12762
|
}, _this67.submitUserMessage = function () {
|
12702
12763
|
return console.warn("submitUserMessage failed - please wait for chat view to render before calling this property.");
|
@@ -12706,7 +12767,7 @@ var b = /*#__PURE__*/function (_yo) {
|
|
12706
12767
|
return console.warn("addMessage failed - please wait for chat view to render before calling this property.");
|
12707
12768
|
}, Vo.appendStyleSheetToHead(), _this67._elementRef = document.createElement("div"), _this67._elementRef.id = "container", _this67.attachShadow({
|
12708
12769
|
mode: "open"
|
12709
|
-
}).appendChild(_this67._elementRef),
|
12770
|
+
}).appendChild(_this67._elementRef), Si.apply(Ia, _this67.shadowRoot), setTimeout(function () {
|
12710
12771
|
_this67._hasBeenRendered || _this67.onRender();
|
12711
12772
|
}, 20);
|
12712
12773
|
return _this67;
|
@@ -12721,12 +12782,12 @@ var b = /*#__PURE__*/function (_yo) {
|
|
12721
12782
|
key: "onRender",
|
12722
12783
|
value: function onRender() {
|
12723
12784
|
var _this$_childElement;
|
12724
|
-
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (
|
12785
|
+
(!this._activeService || this._activeService.demo) && (this._activeService = Go.create(this)), this.auxiliaryStyle && !this._auxiliaryStyleApplied && (Si.apply(this.auxiliaryStyle, this.shadowRoot), this._auxiliaryStyleApplied = !0), Si.applyDefaultStyleToComponent(this.style, this.chatStyle), Le.checkForContainerStyles(this, this._elementRef), this._activeService.key && this._activeService.validateConfigKey ? Ft.render(this._elementRef, this.changeToChatView.bind(this), this._activeService) : !(this._activeService instanceof q) || this._activeService.key ? ((_this$_childElement = this._childElement) !== null && _this$_childElement !== void 0 ? _this$_childElement : this._childElement = this.children[0], on.render(this, this._elementRef, this._activeService, this._childElement)) : this._activeService instanceof q && P.render(this._elementRef, this.changeToChatView.bind(this), this._activeService), this._hasBeenRendered = !0, Bt.onRender(this);
|
12725
12786
|
}
|
12726
12787
|
}, {
|
12727
12788
|
key: "disconnectedCallback",
|
12728
12789
|
value: function disconnectedCallback() {
|
12729
|
-
|
12790
|
+
Zi.chat = void 0;
|
12730
12791
|
}
|
12731
12792
|
}]);
|
12732
12793
|
return b;
|