@tellyouai/plugin 0.1.3 → 0.1.4
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/README.md +1 -1
- package/dist/package/index.js +55 -55
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ it can be used from React, Vue, Svelte, or a plain browser application.
|
|
|
9
9
|
Pin an exact release when application behavior must remain stable:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-exact @tellyouai/plugin@0.1.
|
|
12
|
+
npm install --save-exact @tellyouai/plugin@0.1.4
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Initialize the plugin after the page has loaded:
|
package/dist/package/index.js
CHANGED
|
@@ -23234,7 +23234,7 @@ var j, M, N, P, F, I, te, ne, re, ie, ae, L, oe, se, ce, le, ue, de, fe, R, pe,
|
|
|
23234
23234
|
}
|
|
23235
23235
|
r.withSources === void 0 && (r.withSources = !1);
|
|
23236
23236
|
let a = window.__tellyouaiEntryUrl || import.meta.url, o = new URLSearchParams(new URL(a).search), s = r.thingId || o.get("id") || void 0, c = r.entityId || o.get("entityId") || void 0, l = r.widgetId || o.get("widget") || o.get("widgetId") || void 0;
|
|
23237
|
-
return !s && !c &&
|
|
23237
|
+
return !s && !c && console.error(Rl + ": id missing"), r.thingId = s, r.entityId = c, r.widgetId = l, r;
|
|
23238
23238
|
}, on = (0, nn.createContext)({
|
|
23239
23239
|
thingId: void 0,
|
|
23240
23240
|
entityId: void 0,
|
|
@@ -66824,15 +66824,14 @@ var QB, $B, Vpe = o((() => {
|
|
|
66824
66824
|
borderRadius: k
|
|
66825
66825
|
},
|
|
66826
66826
|
inputStyle: {
|
|
66827
|
-
width: e === "input" ? M || n ? "calc(560px
|
|
66827
|
+
width: e === "input" ? M || n ? "calc(560px)" : "calc(400px)" : void 0,
|
|
66828
66828
|
maxWidth: "100%",
|
|
66829
66829
|
transition: "width " + C,
|
|
66830
66830
|
borderRadius: k,
|
|
66831
66831
|
whiteSpace: "nowrap",
|
|
66832
66832
|
fontSize: "initial",
|
|
66833
66833
|
borderWidth: 0,
|
|
66834
|
-
background: "none"
|
|
66835
|
-
marginRight: "60px"
|
|
66834
|
+
background: "none"
|
|
66836
66835
|
},
|
|
66837
66836
|
onFocus: () => {
|
|
66838
66837
|
N(!0);
|
|
@@ -84832,31 +84831,31 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
84832
84831
|
};
|
|
84833
84832
|
})), C9, w9, T9, Eje, Dje, Oje = o((() => {
|
|
84834
84833
|
C9 = /* @__PURE__ */ u(m(), 1), _A(), dV(), Il(), _V(), xV(), m(), Pq(), Tje(), w9 = tn(), T9 = ({ message: e, style: t = {}, sendMessage: n, onClickKnowledges: r, withTextAnimation: i = !1, onTextAnimate: a }) => {
|
|
84835
|
-
let { formatMessage: o } = oA(), s = Eje(e.content), c = e.mcpApps || [], { getDynamic: l } = Wl(), { withSources: u, consent: d } = l(), f = pu(d), { config: { entityId: p
|
|
84836
|
-
(0, C9.useEffect)(() =>
|
|
84837
|
-
let
|
|
84838
|
-
if (!
|
|
84839
|
-
let n =
|
|
84840
|
-
|
|
84834
|
+
let { formatMessage: o } = oA(), s = Eje(e.content), c = e.mcpApps || [], { getDynamic: l } = Wl(), { withSources: u, consent: d } = l(), f = pu(d), { config: { entityId: p } } = Ul(), { entityId: m } = vu(), h = e.reactions?.find((e) => e.entityId === m)?.emotion, [g, _] = (0, C9.useState)(h), [v, y] = (0, C9.useState)(!1);
|
|
84835
|
+
(0, C9.useEffect)(() => _(h), [h]);
|
|
84836
|
+
let b = async (t) => {
|
|
84837
|
+
if (!m || v) return;
|
|
84838
|
+
let n = g, r = g === t ? void 0 : t;
|
|
84839
|
+
_(r), y(!0);
|
|
84841
84840
|
try {
|
|
84842
84841
|
let t = await fetch(Bl + "/message/reaction", {
|
|
84843
84842
|
method: "POST",
|
|
84844
84843
|
body: JSON.stringify({
|
|
84845
84844
|
messageId: e.id,
|
|
84846
|
-
entityId:
|
|
84845
|
+
entityId: m,
|
|
84847
84846
|
emotion: r || null
|
|
84848
84847
|
}),
|
|
84849
84848
|
headers: { "Content-Type": "application/json" }
|
|
84850
84849
|
});
|
|
84851
84850
|
if (!t.ok) throw Error(`Reaction failed: ${t.status}`);
|
|
84852
84851
|
} catch (e) {
|
|
84853
|
-
|
|
84852
|
+
_(n), console.warn("Failed to save message reaction:", e);
|
|
84854
84853
|
} finally {
|
|
84855
|
-
|
|
84854
|
+
y(!1);
|
|
84856
84855
|
}
|
|
84857
|
-
},
|
|
84856
|
+
}, x = e.entityId === p, S = e.entityId === m, { styles: { themeColors: C, colorBright: w, colorDark: T, foregroundColor70: E, color: D, spacingXS: O, spacingSM: ee, borderRadius: k, borderColor: A, shadow: j, fontWeightBold: M } } = mA(), N = C?.[0], P = C?.[1] ?? E, F = e.status === "saving", I = un(N), te = un(P), ne = un(D), re = (0, C9.useRef)(null), ie = (t) => {
|
|
84858
84857
|
let r = t.target.tagName === "BUTTON", i = t.target.tagName === "A";
|
|
84859
|
-
if (r && !
|
|
84858
|
+
if (r && !S) {
|
|
84860
84859
|
let e = t.target.innerHTML || void 0;
|
|
84861
84860
|
e && n?.(e);
|
|
84862
84861
|
}
|
|
@@ -84873,44 +84872,44 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
84873
84872
|
let o = (e) => e.replace("https://", "").replace("http://", "").replace("www.", "");
|
|
84874
84873
|
n.href = i.toString(), r && !o(r).startsWith(o(window.location.origin)) ? (n.target = "_blank", n.rel = "noopener noreferrer") : (n.removeAttribute("target"), n.removeAttribute("rel"));
|
|
84875
84874
|
}
|
|
84876
|
-
},
|
|
84875
|
+
}, ae = hn(e.content) ? e.content : mn(e.content) || "", L = Ace(ae, i, 500, a), oe = !!(i ? L : ae).trim().length, se = oe || c.length > 0, ce = i && L.length < ae.length, le = c.length > 0 && !F && !ce, ue = "Please review the original sources for potential inaccuracies before acting on any advice.";
|
|
84877
84876
|
return /* @__PURE__ */ (0, w9.jsxs)("div", {
|
|
84878
84877
|
style: {
|
|
84879
|
-
alignItems:
|
|
84878
|
+
alignItems: S ? "flex-end" : "flex-start",
|
|
84880
84879
|
width: "100%",
|
|
84881
84880
|
display: "flex",
|
|
84882
84881
|
flexDirection: "column",
|
|
84883
|
-
gap:
|
|
84882
|
+
gap: O,
|
|
84884
84883
|
...t
|
|
84885
84884
|
},
|
|
84886
|
-
ref:
|
|
84885
|
+
ref: re,
|
|
84887
84886
|
children: [/* @__PURE__ */ (0, w9.jsxs)("div", {
|
|
84888
84887
|
style: {
|
|
84889
84888
|
display: "flex",
|
|
84890
84889
|
gap: "4px",
|
|
84891
84890
|
maxWidth: "90%"
|
|
84892
84891
|
},
|
|
84893
|
-
children: [
|
|
84894
|
-
avatarId: e.entity
|
|
84895
|
-
avatarMediaUrl: e.entity
|
|
84892
|
+
children: [!S && /* @__PURE__ */ (0, w9.jsx)(Nq, {
|
|
84893
|
+
avatarId: e.entity?.avatarId,
|
|
84894
|
+
avatarMediaUrl: e.entity?.mediaUrl,
|
|
84896
84895
|
animation: "appear"
|
|
84897
84896
|
}), /* @__PURE__ */ (0, w9.jsxs)("div", {
|
|
84898
84897
|
style: {
|
|
84899
84898
|
fontSize: s === "emoji" ? "2em" : void 0,
|
|
84900
84899
|
wordBreak: "break-word",
|
|
84901
84900
|
boxSizing: "border-box",
|
|
84902
|
-
border: s === "text" ? `0.5px solid ${
|
|
84903
|
-
boxShadow:
|
|
84901
|
+
border: s === "text" ? `0.5px solid ${A}` : "",
|
|
84902
|
+
boxShadow: j,
|
|
84904
84903
|
backdropFilter: "blur(24px)",
|
|
84905
84904
|
display: "flex",
|
|
84906
84905
|
flexDirection: "column",
|
|
84907
|
-
padding: s === "text" ?
|
|
84908
|
-
borderRadius:
|
|
84909
|
-
backgroundColor: s === "text" ?
|
|
84910
|
-
color: s === "text" ?
|
|
84906
|
+
padding: s === "text" ? O + " " + ee : O + " 0",
|
|
84907
|
+
borderRadius: k,
|
|
84908
|
+
backgroundColor: s === "text" ? S ? N : P : "",
|
|
84909
|
+
color: s === "text" ? S ? I === !0 ? T : I === !1 ? w : void 0 : te === !0 ? T : te === !1 ? w : D : ""
|
|
84911
84910
|
},
|
|
84912
84911
|
children: [
|
|
84913
|
-
|
|
84912
|
+
x && se && /* @__PURE__ */ (0, w9.jsxs)("div", {
|
|
84914
84913
|
onClick: e.knowledges?.length ? () => r?.(e.knowledges?.map((e) => e.id) || []) : void 0,
|
|
84915
84914
|
style: {
|
|
84916
84915
|
opacity: .5,
|
|
@@ -84925,47 +84924,47 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
84925
84924
|
/* @__PURE__ */ (0, w9.jsx)(bV, {
|
|
84926
84925
|
id: "questionmark",
|
|
84927
84926
|
size: "sm",
|
|
84928
|
-
title:
|
|
84927
|
+
title: ue
|
|
84929
84928
|
}),
|
|
84930
84929
|
/* @__PURE__ */ (0, w9.jsx)("span", {
|
|
84931
84930
|
className: "tellyouai-sr-only",
|
|
84932
|
-
children:
|
|
84931
|
+
children: ue
|
|
84933
84932
|
}),
|
|
84934
84933
|
!!e.knowledges?.length && /* @__PURE__ */ (0, w9.jsxs)("span", {
|
|
84935
84934
|
style: {
|
|
84936
84935
|
fontSize: "0.6em",
|
|
84937
|
-
fontWeight:
|
|
84938
|
-
backgroundColor:
|
|
84939
|
-
color:
|
|
84936
|
+
fontWeight: M,
|
|
84937
|
+
backgroundColor: D,
|
|
84938
|
+
color: ne === !0 ? T : ne === !1 ? w : void 0,
|
|
84940
84939
|
padding: "2px 3px",
|
|
84941
84940
|
lineHeight: 1,
|
|
84942
84941
|
cursor: "pointer",
|
|
84943
84942
|
borderRadius: "100%",
|
|
84944
|
-
border: `0.5px solid ${
|
|
84943
|
+
border: `0.5px solid ${A}`
|
|
84945
84944
|
},
|
|
84946
84945
|
children: [e.knowledges.length, " "]
|
|
84947
84946
|
})
|
|
84948
84947
|
]
|
|
84949
84948
|
}),
|
|
84950
|
-
|
|
84949
|
+
oe && /* @__PURE__ */ (0, w9.jsx)("div", {
|
|
84951
84950
|
className: "tellyouai-message-item-content",
|
|
84952
|
-
dangerouslySetInnerHTML: { __html:
|
|
84953
|
-
onClick:
|
|
84951
|
+
dangerouslySetInnerHTML: { __html: L },
|
|
84952
|
+
onClick: ie
|
|
84954
84953
|
}),
|
|
84955
|
-
F && !
|
|
84954
|
+
F && !oe && /* @__PURE__ */ (0, w9.jsxs)("div", { children: [
|
|
84956
84955
|
/* @__PURE__ */ (0, w9.jsx)(sV, {}),
|
|
84957
84956
|
" ",
|
|
84958
84957
|
!e.steps?.length && /* @__PURE__ */ (0, w9.jsx)("b", {
|
|
84959
84958
|
style: {
|
|
84960
84959
|
opacity: .5,
|
|
84961
|
-
fontWeight:
|
|
84960
|
+
fontWeight: M,
|
|
84962
84961
|
marginLeft: "8px",
|
|
84963
84962
|
marginRight: "48px"
|
|
84964
84963
|
},
|
|
84965
84964
|
children: o({ id: "thinking" })
|
|
84966
84965
|
})
|
|
84967
84966
|
] }),
|
|
84968
|
-
|
|
84967
|
+
x && se && !ce && /* @__PURE__ */ (0, w9.jsxs)("div", {
|
|
84969
84968
|
style: {
|
|
84970
84969
|
display: "flex",
|
|
84971
84970
|
gap: "4px",
|
|
@@ -84974,12 +84973,12 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
84974
84973
|
opacity: .5
|
|
84975
84974
|
},
|
|
84976
84975
|
children: [/* @__PURE__ */ (0, w9.jsxs)(gV, {
|
|
84977
|
-
onClick: () => void
|
|
84978
|
-
look:
|
|
84976
|
+
onClick: () => void b("👍"),
|
|
84977
|
+
look: g === "👍" ? "primary" : "inline",
|
|
84979
84978
|
size: "sm",
|
|
84980
|
-
disabled: !
|
|
84979
|
+
disabled: !m || v,
|
|
84981
84980
|
type: "radio",
|
|
84982
|
-
checked:
|
|
84981
|
+
checked: g === "👍",
|
|
84983
84982
|
name: `reaction-${e.id || "local"}`,
|
|
84984
84983
|
children: [/* @__PURE__ */ (0, w9.jsx)(bV, {
|
|
84985
84984
|
id: "thumbs-up",
|
|
@@ -84992,12 +84991,12 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
84992
84991
|
})
|
|
84993
84992
|
})]
|
|
84994
84993
|
}), /* @__PURE__ */ (0, w9.jsxs)(gV, {
|
|
84995
|
-
onClick: () => void
|
|
84996
|
-
look:
|
|
84994
|
+
onClick: () => void b("👎"),
|
|
84995
|
+
look: g === "👎" ? "primary" : "inline",
|
|
84997
84996
|
size: "sm",
|
|
84998
|
-
disabled: !
|
|
84997
|
+
disabled: !m || v,
|
|
84999
84998
|
type: "radio",
|
|
85000
|
-
checked:
|
|
84999
|
+
checked: g === "👎",
|
|
85001
85000
|
name: `reaction-${e.id || "local"}`,
|
|
85002
85001
|
children: [/* @__PURE__ */ (0, w9.jsx)(bV, {
|
|
85003
85002
|
id: "thumbs-down",
|
|
@@ -85013,11 +85012,11 @@ var x4, S4, ZOe, QOe, C4, $Oe, eke, w4, T4, tke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
85013
85012
|
})
|
|
85014
85013
|
]
|
|
85015
85014
|
})]
|
|
85016
|
-
}),
|
|
85015
|
+
}), le && /* @__PURE__ */ (0, w9.jsx)("div", {
|
|
85017
85016
|
style: {
|
|
85018
85017
|
display: "grid",
|
|
85019
|
-
gap:
|
|
85020
|
-
paddingTop:
|
|
85018
|
+
gap: O,
|
|
85019
|
+
paddingTop: O,
|
|
85021
85020
|
width: "100%"
|
|
85022
85021
|
},
|
|
85023
85022
|
children: c.map((e) => /* @__PURE__ */ (0, w9.jsx)(wje, { app: e }, `${e.resourceUri}:${e.resourceToken || "local"}`))
|
|
@@ -86548,8 +86547,8 @@ var X9, Z9, iMe, aMe = o((() => {
|
|
|
86548
86547
|
display: flex;
|
|
86549
86548
|
align-items: center;
|
|
86550
86549
|
justify-content: center;
|
|
86551
|
-
background-color:
|
|
86552
|
-
color: var(--tellyouai-theme-color
|
|
86550
|
+
background-color: transparent;
|
|
86551
|
+
color: var(--tellyouai-theme-color);
|
|
86553
86552
|
}`,
|
|
86554
86553
|
`#${e} .tellyouai-avatar.xxl { --tellyouai-avatar-size: 6rem; }`,
|
|
86555
86554
|
`#${e} .tellyouai-avatar.xl { --tellyouai-avatar-size: 5rem; }`,
|
|
@@ -86575,7 +86574,7 @@ var X9, Z9, iMe, aMe = o((() => {
|
|
|
86575
86574
|
width: 100%;
|
|
86576
86575
|
height: 100%;
|
|
86577
86576
|
}`,
|
|
86578
|
-
`#${e} .tellyouai-button {
|
|
86577
|
+
`#${e} .tellyouai-button {margin:0;
|
|
86579
86578
|
box-sizing: border-box;
|
|
86580
86579
|
width: auto;
|
|
86581
86580
|
height: auto;
|
|
@@ -86700,6 +86699,7 @@ var X9, Z9, iMe, aMe = o((() => {
|
|
|
86700
86699
|
border: 0;
|
|
86701
86700
|
}`,
|
|
86702
86701
|
`#${e} .tellyouai-input {
|
|
86702
|
+
margin:0;
|
|
86703
86703
|
box-sizing: border-box;
|
|
86704
86704
|
field-sizing: content;
|
|
86705
86705
|
width: auto;
|