lr-chatbot 0.39.17 → 0.39.19
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/index.js +69 -64
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -14142,7 +14142,7 @@ function M2(t, r, e) {
|
|
|
14142
14142
|
}
|
|
14143
14143
|
const P2 = /^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;
|
|
14144
14144
|
function Ql(t) {
|
|
14145
|
-
return typeof t != "string" ? t :
|
|
14145
|
+
return typeof t != "string" ? t : P2.exec(t) ? parseFloat(t) : t;
|
|
14146
14146
|
}
|
|
14147
14147
|
function ec(t, r) {
|
|
14148
14148
|
return t.substr(-r.length) === r;
|
|
@@ -14400,13 +14400,13 @@ function Ci(t) {
|
|
|
14400
14400
|
if (typeof t != "string")
|
|
14401
14401
|
throw new lt(3);
|
|
14402
14402
|
const r = N2(t);
|
|
14403
|
-
if (
|
|
14403
|
+
if (j2.exec(r))
|
|
14404
14404
|
return {
|
|
14405
14405
|
red: parseInt(`${r[1]}${r[2]}`, 16),
|
|
14406
14406
|
green: parseInt(`${r[3]}${r[4]}`, 16),
|
|
14407
14407
|
blue: parseInt(`${r[5]}${r[6]}`, 16)
|
|
14408
14408
|
};
|
|
14409
|
-
if (
|
|
14409
|
+
if (H2.exec(r)) {
|
|
14410
14410
|
const s = parseFloat((parseInt(`${r[7]}${r[8]}`, 16) / 255).toFixed(2));
|
|
14411
14411
|
return {
|
|
14412
14412
|
red: parseInt(`${r[1]}${r[2]}`, 16),
|
|
@@ -14415,13 +14415,13 @@ function Ci(t) {
|
|
|
14415
14415
|
alpha: s
|
|
14416
14416
|
};
|
|
14417
14417
|
}
|
|
14418
|
-
if (
|
|
14418
|
+
if (U2.exec(r))
|
|
14419
14419
|
return {
|
|
14420
14420
|
red: parseInt(`${r[1]}${r[1]}`, 16),
|
|
14421
14421
|
green: parseInt(`${r[2]}${r[2]}`, 16),
|
|
14422
14422
|
blue: parseInt(`${r[3]}${r[3]}`, 16)
|
|
14423
14423
|
};
|
|
14424
|
-
if (
|
|
14424
|
+
if (z2.exec(r)) {
|
|
14425
14425
|
const s = parseFloat((parseInt(`${r[4]}${r[4]}`, 16) / 255).toFixed(2));
|
|
14426
14426
|
return {
|
|
14427
14427
|
red: parseInt(`${r[1]}${r[1]}`, 16),
|
|
@@ -18763,8 +18763,7 @@ class db extends $d {
|
|
|
18763
18763
|
}
|
|
18764
18764
|
async loadTranslations(r) {
|
|
18765
18765
|
var s;
|
|
18766
|
-
const { fetchServerTranslations: e = !0, updateHost: n = !1 } = r, i = this.translationsLoaderGetter();
|
|
18767
|
-
let a = await i.getLanguageTranslations({ fetchServerTranslations: e });
|
|
18766
|
+
const { fetchServerTranslations: e = !0, updateHost: n = !1 } = r, i = this.translationsLoaderGetter(), a = await i.getLanguageTranslations({ fetchServerTranslations: e });
|
|
18768
18767
|
await this.setI18nResources(i.config.language, a), e && ((s = this.resolveServerTranslationsLoadedPromise) == null || s.call(this)), n && this.host.requestUpdate();
|
|
18769
18768
|
}
|
|
18770
18769
|
async setI18nResources(r, e) {
|
|
@@ -18948,7 +18947,7 @@ const Va = {
|
|
|
18948
18947
|
uk: []
|
|
18949
18948
|
}, vb = /((([a-zA-Z]+(-[a-zA-Z0-9]+){0,2})|\*)(;q=[0-1](\.[0-9]+)?)?)*/g;
|
|
18950
18949
|
function yb(t) {
|
|
18951
|
-
return ((t || "").match(vb)
|
|
18950
|
+
return ((t || "").match(vb) ?? []).map(function(e) {
|
|
18952
18951
|
if (!e)
|
|
18953
18952
|
return;
|
|
18954
18953
|
const n = e.split(";"), i = n[0].split("-"), a = i.length === 3;
|
|
@@ -18997,7 +18996,7 @@ const on = (t) => (Array.isArray(Va[t]) ? Va[t] : [Va[t]]).filter((e) => !!e), w
|
|
|
18997
18996
|
}, Cb = (t, r) => {
|
|
18998
18997
|
var a;
|
|
18999
18998
|
if (!t || !r) return null;
|
|
19000
|
-
const e =
|
|
18999
|
+
const e = /^\/([a-z]{2})(\/|$)/i.exec(t), n = (a = e == null ? void 0 : e[1]) == null ? void 0 : a.toLowerCase();
|
|
19001
19000
|
return n ? on(r).find((s) => s.toLowerCase().startsWith(n)) ?? null : null;
|
|
19002
19001
|
}, xb = (t, r) => on(r).find((i) => i.toLowerCase().startsWith(`${t}-${r}`.toLowerCase())), Eb = (t, r) => on(r).filter((i) => Cs(r, i)).find((i) => i.toLowerCase() === t.toLowerCase()), Ab = (t) => {
|
|
19003
19002
|
const r = on(t);
|
|
@@ -20754,39 +20753,38 @@ class vo {
|
|
|
20754
20753
|
});
|
|
20755
20754
|
});
|
|
20756
20755
|
B(this, "request", async ({
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
...o
|
|
20756
|
+
path: r,
|
|
20757
|
+
type: e,
|
|
20758
|
+
query: n,
|
|
20759
|
+
format: i,
|
|
20760
|
+
body: a,
|
|
20761
|
+
...s
|
|
20764
20762
|
}) => {
|
|
20765
|
-
const
|
|
20766
|
-
return
|
|
20767
|
-
...
|
|
20763
|
+
const o = (i && this.format) ?? void 0;
|
|
20764
|
+
return e === "multipart/form-data" && a && a !== null && typeof a == "object" && (s.headers && (s.headers.common = "Accept: */*", s.headers.post = "", s.headers.put = ""), a = this.createFormData(a)), this.instance.request({
|
|
20765
|
+
...s,
|
|
20768
20766
|
headers: {
|
|
20769
|
-
...
|
|
20770
|
-
...
|
|
20767
|
+
...e && e !== "multipart/form-data" ? { "Content-Type": e } : {},
|
|
20768
|
+
...s.headers ?? {}
|
|
20771
20769
|
},
|
|
20772
|
-
params:
|
|
20773
|
-
responseType:
|
|
20774
|
-
data:
|
|
20775
|
-
url:
|
|
20770
|
+
params: n,
|
|
20771
|
+
responseType: o,
|
|
20772
|
+
data: a,
|
|
20773
|
+
url: r,
|
|
20776
20774
|
topMostError: new Error("Enhanced stack trace")
|
|
20777
|
-
}).then(this.successHandler ?? ((
|
|
20778
|
-
this.axiosErrorHandler((
|
|
20779
|
-
var u, d, h
|
|
20780
|
-
if (
|
|
20781
|
-
const
|
|
20782
|
-
|
|
20783
|
-
headers: (
|
|
20784
|
-
method: (
|
|
20785
|
-
data: (
|
|
20786
|
-
baseURL: (
|
|
20775
|
+
}).then(this.successHandler ?? ((l) => l.data)).catch(
|
|
20776
|
+
this.axiosErrorHandler((l) => {
|
|
20777
|
+
var c, u, d, h;
|
|
20778
|
+
if (l.type === "axios-error") {
|
|
20779
|
+
const p = l.error;
|
|
20780
|
+
p.config = {
|
|
20781
|
+
headers: (c = p.config) == null ? void 0 : c.headers,
|
|
20782
|
+
method: (u = p.config) == null ? void 0 : u.method,
|
|
20783
|
+
data: (d = p.config) == null ? void 0 : d.data,
|
|
20784
|
+
baseURL: (h = p.config) == null ? void 0 : h.baseURL
|
|
20787
20785
|
};
|
|
20788
20786
|
}
|
|
20789
|
-
throw
|
|
20787
|
+
throw l.error;
|
|
20790
20788
|
})
|
|
20791
20789
|
);
|
|
20792
20790
|
});
|
|
@@ -21868,11 +21866,11 @@ const Ge = class Ge extends vo {
|
|
|
21868
21866
|
* @summary Gets a conversation
|
|
21869
21867
|
* @request GET:/api/chatbot/conversations/{id}
|
|
21870
21868
|
*/
|
|
21871
|
-
B(this, "chatbotConversationsGet", (e, n = {}) => this.request({
|
|
21869
|
+
B(this, "chatbotConversationsGet", ({ id: e, ...n }, i = {}) => this.request({
|
|
21872
21870
|
path: Ge.Endpoints.chatbotConversationsGet({ id: e }),
|
|
21873
21871
|
method: "GET",
|
|
21874
21872
|
format: "json",
|
|
21875
|
-
...
|
|
21873
|
+
...i
|
|
21876
21874
|
}));
|
|
21877
21875
|
/**
|
|
21878
21876
|
* @description Gets a current user conversation summary
|
|
@@ -21881,11 +21879,11 @@ const Ge = class Ge extends vo {
|
|
|
21881
21879
|
* @summary Gets a conversation summary
|
|
21882
21880
|
* @request GET:/api/chatbot/conversations/{id}/summary
|
|
21883
21881
|
*/
|
|
21884
|
-
B(this, "chatbotConversationsSummaryGet", (e, n = {}) => this.request({
|
|
21882
|
+
B(this, "chatbotConversationsSummaryGet", ({ id: e, ...n }, i = {}) => this.request({
|
|
21885
21883
|
path: Ge.Endpoints.chatbotConversationsSummaryGet({ id: e }),
|
|
21886
21884
|
method: "GET",
|
|
21887
21885
|
format: "json",
|
|
21888
|
-
...
|
|
21886
|
+
...i
|
|
21889
21887
|
}));
|
|
21890
21888
|
/**
|
|
21891
21889
|
* @description Asks a new question on the current or new conversation
|
|
@@ -21909,12 +21907,12 @@ const Ge = class Ge extends vo {
|
|
|
21909
21907
|
* @summary Rates a conversation
|
|
21910
21908
|
* @request POST:/api/chatbot/conversations/{id}/rate
|
|
21911
21909
|
*/
|
|
21912
|
-
B(this, "chatbotConversationsRatePost", (e, n, i = {}) => this.request({
|
|
21910
|
+
B(this, "chatbotConversationsRatePost", ({ id: e, ...n }, i, a = {}) => this.request({
|
|
21913
21911
|
path: Ge.Endpoints.chatbotConversationsRatePost({ id: e }),
|
|
21914
21912
|
method: "POST",
|
|
21915
|
-
body:
|
|
21913
|
+
body: i,
|
|
21916
21914
|
type: "application/json",
|
|
21917
|
-
...
|
|
21915
|
+
...a
|
|
21918
21916
|
}));
|
|
21919
21917
|
/**
|
|
21920
21918
|
* @description Rates an existing message from within a conversation
|
|
@@ -21923,12 +21921,15 @@ const Ge = class Ge extends vo {
|
|
|
21923
21921
|
* @summary Rates a message inside a conversation
|
|
21924
21922
|
* @request POST:/api/chatbot/conversations/{id}/messages/{message_id}/rate
|
|
21925
21923
|
*/
|
|
21926
|
-
B(this, "chatbotConversationsMessagesRatePost", (e, n, i, a = {}) => this.request({
|
|
21927
|
-
path: Ge.Endpoints.chatbotConversationsMessagesRatePost({
|
|
21924
|
+
B(this, "chatbotConversationsMessagesRatePost", ({ id: e, messageId: n, ...i }, a, s = {}) => this.request({
|
|
21925
|
+
path: Ge.Endpoints.chatbotConversationsMessagesRatePost({
|
|
21926
|
+
id: e,
|
|
21927
|
+
messageId: n
|
|
21928
|
+
}),
|
|
21928
21929
|
method: "POST",
|
|
21929
|
-
body:
|
|
21930
|
+
body: a,
|
|
21930
21931
|
type: "application/json",
|
|
21931
|
-
...
|
|
21932
|
+
...s
|
|
21932
21933
|
}));
|
|
21933
21934
|
/**
|
|
21934
21935
|
* @description Rates an existing message from within a conversation
|
|
@@ -21937,13 +21938,13 @@ const Ge = class Ge extends vo {
|
|
|
21937
21938
|
* @summary Summarizes a conversation and wraps with a hermes ticket
|
|
21938
21939
|
* @request POST:/api/chatbot/conversations/{id}/interactions/summarize
|
|
21939
21940
|
*/
|
|
21940
|
-
B(this, "chatbotConversationsInteractionsSummarizePost", (e, n, i = {}) => this.request({
|
|
21941
|
+
B(this, "chatbotConversationsInteractionsSummarizePost", ({ id: e, ...n }, i, a = {}) => this.request({
|
|
21941
21942
|
path: Ge.Endpoints.chatbotConversationsInteractionsSummarizePost({ id: e }),
|
|
21942
21943
|
method: "POST",
|
|
21943
|
-
body:
|
|
21944
|
+
body: i,
|
|
21944
21945
|
type: "application/json",
|
|
21945
21946
|
format: "json",
|
|
21946
|
-
...
|
|
21947
|
+
...a
|
|
21947
21948
|
}));
|
|
21948
21949
|
/**
|
|
21949
21950
|
* No description
|
|
@@ -22608,10 +22609,13 @@ let Ln = class extends On {
|
|
|
22608
22609
|
baseURL: this.messageContext.apiUrl,
|
|
22609
22610
|
withCredentials: !0,
|
|
22610
22611
|
method: "POST"
|
|
22611
|
-
}), { ticketId: a } = await i.chatbotConversationsInteractionsSummarizePost(
|
|
22612
|
-
|
|
22613
|
-
|
|
22614
|
-
|
|
22612
|
+
}), { ticketId: a } = await i.chatbotConversationsInteractionsSummarizePost(
|
|
22613
|
+
{ id: n },
|
|
22614
|
+
{
|
|
22615
|
+
language: this.language,
|
|
22616
|
+
origin: ""
|
|
22617
|
+
}
|
|
22618
|
+
), s = this.channel === "whatsapp" ? `HERMES ${a}` : a;
|
|
22615
22619
|
t = be("chatbot:escalation.message", {
|
|
22616
22620
|
context: this.channel,
|
|
22617
22621
|
conversationId: s
|
|
@@ -22721,8 +22725,7 @@ let Yt = class extends fe {
|
|
|
22721
22725
|
feedback: ""
|
|
22722
22726
|
};
|
|
22723
22727
|
await r.chatbotConversationsMessagesRatePost(
|
|
22724
|
-
this.messageContext.conversationId,
|
|
22725
|
-
this.messageContext.messageId,
|
|
22728
|
+
{ id: this.messageContext.conversationId, messageId: this.messageContext.messageId },
|
|
22726
22729
|
e
|
|
22727
22730
|
), await So(500);
|
|
22728
22731
|
}
|
|
@@ -22846,6 +22849,7 @@ let Ot = class extends fe {
|
|
|
22846
22849
|
formResetCallback() {
|
|
22847
22850
|
this.value = 0;
|
|
22848
22851
|
}
|
|
22852
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22849
22853
|
formStateRestoreCallback(t) {
|
|
22850
22854
|
this.value = t;
|
|
22851
22855
|
}
|
|
@@ -23152,7 +23156,7 @@ let Lt = class extends fe {
|
|
|
23152
23156
|
score: s,
|
|
23153
23157
|
feedback: this.feedback
|
|
23154
23158
|
};
|
|
23155
|
-
await a.chatbotConversationsRatePost(this.messageContext.conversationId, l);
|
|
23159
|
+
await a.chatbotConversationsRatePost({ id: this.messageContext.conversationId }, l);
|
|
23156
23160
|
}
|
|
23157
23161
|
this.getConversationId() || !this.feedback && this.score && this._broadcastController.send({
|
|
23158
23162
|
action: "addMessage",
|
|
@@ -23332,6 +23336,7 @@ let In = class extends fe {
|
|
|
23332
23336
|
firstUpdated() {
|
|
23333
23337
|
this._isMobileDevice && this.setElement();
|
|
23334
23338
|
}
|
|
23339
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23335
23340
|
updated(t) {
|
|
23336
23341
|
t.has("_isDragging") && !this._isDragging && this._isClickEventRemoved && setTimeout(() => {
|
|
23337
23342
|
this._isClickEventRemoved = !1;
|
|
@@ -23420,7 +23425,7 @@ let It = class extends fe {
|
|
|
23420
23425
|
Jn(this, mi, t);
|
|
23421
23426
|
}
|
|
23422
23427
|
getVersion() {
|
|
23423
|
-
return "LR Chatbot - v0.
|
|
23428
|
+
return "LR Chatbot - v0.39.18";
|
|
23424
23429
|
}
|
|
23425
23430
|
async connectedCallback() {
|
|
23426
23431
|
super.connectedCallback(), this._conversationHistoryTask.run();
|
|
@@ -23482,7 +23487,7 @@ let It = class extends fe {
|
|
|
23482
23487
|
baseURL: this.apiUrl,
|
|
23483
23488
|
withCredentials: !0,
|
|
23484
23489
|
method: "GET"
|
|
23485
|
-
}).chatbotConversationsGet(t);
|
|
23490
|
+
}).chatbotConversationsGet({ id: t });
|
|
23486
23491
|
} catch {
|
|
23487
23492
|
console.error("Error while fetching chatbot conversation history"), localStorage.removeItem(kn);
|
|
23488
23493
|
}
|
|
@@ -23505,18 +23510,18 @@ let It = class extends fe {
|
|
|
23505
23510
|
if (!this.deepChat)
|
|
23506
23511
|
throw Error("Deep Chat should be initialized at this point");
|
|
23507
23512
|
this.disableDeepChatTextInput(), [qa.INITIAL, qa.ERROR].includes(this._conversationHistoryTask.status) && this._conversationHistoryTask.run();
|
|
23508
|
-
|
|
23513
|
+
const t = await this._conversationHistoryTask.taskComplete;
|
|
23509
23514
|
this.setInitialMessages(), t != null && t.messages && (this.deepChat.history = [
|
|
23510
23515
|
...this.deepChat.history ?? [],
|
|
23511
23516
|
...t.messages.map((r) => ({
|
|
23512
23517
|
role: r.sender === "system" ? "ai" : "user",
|
|
23513
23518
|
html: Wn({
|
|
23514
23519
|
apiUrl: this.apiUrl,
|
|
23515
|
-
conversationId: this.getCurrentConversationId() ??
|
|
23520
|
+
conversationId: this.getCurrentConversationId() ?? "",
|
|
23516
23521
|
messageId: r.messageId ?? "",
|
|
23517
23522
|
score: r.score ?? void 0,
|
|
23518
23523
|
slot: r.message ?? "",
|
|
23519
|
-
showMessageRating: r.popUpRate
|
|
23524
|
+
showMessageRating: r.popUpRate ?? !1
|
|
23520
23525
|
})
|
|
23521
23526
|
}))
|
|
23522
23527
|
]), this.enableDeepChatTextInput(), this._conversationHistoryTask = this.createConversationHistoryTask();
|
|
@@ -23589,11 +23594,11 @@ let It = class extends fe {
|
|
|
23589
23594
|
});
|
|
23590
23595
|
this._shouldEndConversation = s.message_status === "end_conversation", this.setConversationTimeout(), this.observeInputChanges(), r.onResponse({ html: o, role: "ai" });
|
|
23591
23596
|
} catch {
|
|
23592
|
-
const
|
|
23597
|
+
const e = Wn({
|
|
23593
23598
|
slot: be("chatbot:errorMessage")
|
|
23594
23599
|
});
|
|
23595
23600
|
r.onResponse({
|
|
23596
|
-
html:
|
|
23601
|
+
html: e
|
|
23597
23602
|
});
|
|
23598
23603
|
}
|
|
23599
23604
|
}
|