@1024pix/epreuves-components 0.4.2 → 0.6.0
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/dist/LLMMessage.ce-CHtRURwX.js +3120 -0
- package/dist/_plugin-vue_export-helper-BDNE3C4u.js +4073 -0
- package/dist/components/llm-compare-messages.ce.js.js +61 -0
- package/dist/components/llm-messages.ce.js.js +28 -0
- package/dist/components/llm-prompt-select.ce.js.js +67 -0
- package/dist/components/{message-conversation.js → message-conversation.ce.js.js} +14 -14
- package/dist/components/{qcu-image.js → qcu-image.ce.js.js} +7 -7
- package/dist/index.js +5 -2
- package/package.json +1 -1
- package/dist/_plugin-vue_export-helper-4Cw9-CIo.js +0 -4011
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { d as m, c as a, o as n, a as s, t, F as i, r as d, b as r, _ as p, e as u } from "../_plugin-vue_export-helper-BDNE3C4u.js";
|
|
2
|
+
import { p as f, L as l } from "../LLMMessage.ce-CHtRURwX.js";
|
|
3
|
+
const g = {
|
|
4
|
+
class: "header",
|
|
5
|
+
"aria-hidden": "true"
|
|
6
|
+
}, h = { class: "sr-only" }, v = { class: "llm-compare-messages" }, _ = { class: "conversation1" }, y = { class: "conversation2" }, b = { class: "conversation1" }, w = {
|
|
7
|
+
"aria-hidden": "true",
|
|
8
|
+
class: "conversation2"
|
|
9
|
+
}, x = /* @__PURE__ */ m({
|
|
10
|
+
__name: "LLMCompareMessages.ce",
|
|
11
|
+
props: {
|
|
12
|
+
conversation1: { type: Object },
|
|
13
|
+
conversation2: { type: Object },
|
|
14
|
+
userName: { type: String },
|
|
15
|
+
messages: { type: Array }
|
|
16
|
+
},
|
|
17
|
+
setup(N) {
|
|
18
|
+
return f(), (e, C) => (n(), a(i, null, [
|
|
19
|
+
s("div", g, [
|
|
20
|
+
s("p", null, t(e.conversation1.title), 1),
|
|
21
|
+
s("p", null, t(e.conversation2.title), 1)
|
|
22
|
+
]),
|
|
23
|
+
s("p", h, " Comparaison entre la conversation " + t(e.conversation1.title) + " et la conversation " + t(e.conversation2.title), 1),
|
|
24
|
+
s("div", v, [
|
|
25
|
+
(n(!0), a(i, null, d(e.messages, (o, c) => (n(), a("div", {
|
|
26
|
+
key: c,
|
|
27
|
+
class: "llm-compare-messages__row"
|
|
28
|
+
}, [
|
|
29
|
+
Array.isArray(o) ? (n(), a(i, { key: 0 }, [
|
|
30
|
+
s("div", _, [
|
|
31
|
+
r(l, {
|
|
32
|
+
message: o[0],
|
|
33
|
+
name: e.conversation1.llmName
|
|
34
|
+
}, null, 8, ["message", "name"])
|
|
35
|
+
]),
|
|
36
|
+
s("div", y, [
|
|
37
|
+
r(l, {
|
|
38
|
+
message: o[1],
|
|
39
|
+
name: e.conversation2.llmName
|
|
40
|
+
}, null, 8, ["message", "name"])
|
|
41
|
+
])
|
|
42
|
+
], 64)) : (n(), a(i, { key: 1 }, [
|
|
43
|
+
s("div", b, [
|
|
44
|
+
r(l, {
|
|
45
|
+
message: o,
|
|
46
|
+
name: e.userName
|
|
47
|
+
}, null, 8, ["message", "name"])
|
|
48
|
+
]),
|
|
49
|
+
s("div", w, [
|
|
50
|
+
r(l, {
|
|
51
|
+
message: o,
|
|
52
|
+
name: e.userName
|
|
53
|
+
}, null, 8, ["message", "name"])
|
|
54
|
+
])
|
|
55
|
+
], 64))
|
|
56
|
+
]))), 128))
|
|
57
|
+
])
|
|
58
|
+
], 64));
|
|
59
|
+
}
|
|
60
|
+
}), L = '*{box-sizing:border-box}:host{display:flex;flex-direction:column}.llm-compare-messages{display:flex;flex-direction:column;padding:24px;gap:24px;position:relative;height:100%;overflow:auto}.llm-compare-messages:after{content:"";position:absolute;height:100%;top:0;left:50%;border-left:dashed 1px grey}.llm-compare-messages__row{display:flex;flex-direction:row;justify-content:space-between}.llm-compare-messages__row>div{display:flex;flex-direction:column;width:calc(50% - 12px)}.conversation1 .inbound .bubble{background:#e9f4c3}.header{display:flex}.header p{background:#e6eaf2;display:flex;width:50%;justify-content:center;align-items:center;padding:1rem;margin:0;font-size:1.2rem;font-weight:700}.header p:first-child{background:#e9f4c3}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}', k = /* @__PURE__ */ p(x, [["styles", [L]]]);
|
|
61
|
+
window.customElements.define("llm-compare-messages", u(k));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { d as m, u as i, w as p, c as o, o as e, F as d, r as u, i as g, _ as f, e as h } from "../_plugin-vue_export-helper-BDNE3C4u.js";
|
|
2
|
+
import { p as _, L as v } from "../LLMMessage.ce-CHtRURwX.js";
|
|
3
|
+
const w = {
|
|
4
|
+
class: "llm-messages",
|
|
5
|
+
"aria-live": "polite"
|
|
6
|
+
}, y = /* @__PURE__ */ m({
|
|
7
|
+
__name: "LLMMessages.ce",
|
|
8
|
+
props: {
|
|
9
|
+
messages: { type: Array }
|
|
10
|
+
},
|
|
11
|
+
setup(t) {
|
|
12
|
+
const a = t;
|
|
13
|
+
_();
|
|
14
|
+
const s = i();
|
|
15
|
+
function r() {
|
|
16
|
+
s.scrollTop = s.scrollHeight;
|
|
17
|
+
}
|
|
18
|
+
return p(async () => {
|
|
19
|
+
a.messages, r();
|
|
20
|
+
}), (l, B) => (e(), o("div", w, [
|
|
21
|
+
(e(!0), o(d, null, u(l.messages, (n, c) => (e(), g(v, {
|
|
22
|
+
key: c,
|
|
23
|
+
message: n
|
|
24
|
+
}, null, 8, ["message"]))), 128))
|
|
25
|
+
]));
|
|
26
|
+
}
|
|
27
|
+
}), L = ":host{height:100%;overflow:auto;scroll-behavior:smooth}@media (prefers-reduced-motion: reduce){:host{scroll-behavior:auto}}.llm-messages{display:flex;flex-direction:column;gap:24px;padding:24px}", x = /* @__PURE__ */ f(y, [["styles", [L]]]);
|
|
28
|
+
window.customElements.define("llm-messages", h(x));
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { d as h, f as c, g as y, c as i, o as d, b as x, a as l, h as w, F as _, r as k, t as S, _ as C, e as L } from "../_plugin-vue_export-helper-BDNE3C4u.js";
|
|
2
|
+
import "./llm-messages.ce.js.js";
|
|
3
|
+
const N = { class: "prompt-select" }, P = { class: "prompt-select__options" }, B = ["disabled", "onClick"], E = /* @__PURE__ */ h({
|
|
4
|
+
__name: "LLMPromptSelect.ce",
|
|
5
|
+
props: {
|
|
6
|
+
messages: { type: Array },
|
|
7
|
+
prompts: { type: Array },
|
|
8
|
+
speed: { type: Number }
|
|
9
|
+
},
|
|
10
|
+
setup(f, { expose: b }) {
|
|
11
|
+
const t = f, s = c(t.messages), m = c(t.prompts.map((e) => ({
|
|
12
|
+
...e,
|
|
13
|
+
disabled: !1
|
|
14
|
+
}))), r = c(!1);
|
|
15
|
+
function g() {
|
|
16
|
+
s.value = t.messages, m.value = t.prompts.map((e) => ({
|
|
17
|
+
...e,
|
|
18
|
+
disabled: !1
|
|
19
|
+
})), r.value = !1;
|
|
20
|
+
}
|
|
21
|
+
b({
|
|
22
|
+
reset: g
|
|
23
|
+
});
|
|
24
|
+
async function v(e) {
|
|
25
|
+
const o = t.speed === 0 || window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
26
|
+
if (s.value = [
|
|
27
|
+
...s.value,
|
|
28
|
+
{
|
|
29
|
+
direction: "outbound",
|
|
30
|
+
content: e.prompt
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
direction: "inbound",
|
|
34
|
+
content: o ? e.response : ""
|
|
35
|
+
}
|
|
36
|
+
], e.disabled = !0, o) return;
|
|
37
|
+
const a = s.value.length - 1;
|
|
38
|
+
r.value = !0;
|
|
39
|
+
const n = e.response.split(/(\s+|<[^>]+>)/);
|
|
40
|
+
for (const p of n)
|
|
41
|
+
await new Promise((u) => {
|
|
42
|
+
setTimeout(u, t.speed ?? 20);
|
|
43
|
+
}), s.value = [...s.value], s.value[a].content += p;
|
|
44
|
+
r.value = !1;
|
|
45
|
+
}
|
|
46
|
+
return (e, o) => {
|
|
47
|
+
const a = y("llm-messages");
|
|
48
|
+
return d(), i(_, null, [
|
|
49
|
+
x(a, { messages: s.value }, null, 8, ["messages"]),
|
|
50
|
+
l("div", N, [
|
|
51
|
+
o[0] || (o[0] = l("p", { class: "prompt-select__label" }, [
|
|
52
|
+
w(" Sélectionner un des prompts "),
|
|
53
|
+
l("span", { class: "sr-only" }, " une fois sélectionnés, les prompts ne sont plus disponibles. ")
|
|
54
|
+
], -1)),
|
|
55
|
+
l("div", P, [
|
|
56
|
+
(d(!0), i(_, null, k(m.value, (n, p) => (d(), i("button", {
|
|
57
|
+
key: p,
|
|
58
|
+
disabled: n.disabled || r.value,
|
|
59
|
+
onClick: (u) => v(n)
|
|
60
|
+
}, S(n.prompt), 9, B))), 128))
|
|
61
|
+
])
|
|
62
|
+
])
|
|
63
|
+
], 64);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}), M = ".sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}llm-messages{display:block;height:400px}.prompt-select{border-top:solid 1px grey;padding:24px}.prompt-select__label{margin-top:0;font-weight:700}.prompt-select__options{display:flex;gap:1rem;justify-content:left;padding-bottom:1rem;flex-wrap:wrap}.prompt-select__options>button{padding:.5rem 1.5rem;border:none;background:#cec3f4;border-radius:5px}.prompt-select__options>button:hover:not(:disabled){background:#9a8dc7;color:#fff;cursor:pointer}.prompt-select__options>button:disabled{cursor:not-allowed}", V = /* @__PURE__ */ C(E, [["styles", [M]]]);
|
|
67
|
+
window.customElements.define("llm-prompt-select", L(V));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as f, c as i, o as t, d as x,
|
|
1
|
+
import { _ as f, c as i, o as t, d as x, f as D, p as v, q as S, n as h, v as u, a as p, h as b, t as _, b as $, F as y, r as w, i as M, e as A } from "../_plugin-vue_export-helper-BDNE3C4u.js";
|
|
2
2
|
const C = ".loader{width:8px;aspect-ratio:1;border-radius:50%;animation:l5 1s infinite linear alternate;transform:translate(100%)}@keyframes l5{0%{box-shadow:13px 0 #000,-13px 0 #0002;background:#000}33%{box-shadow:13px 0 #000,-13px 0 #0002;background:#0002}66%{box-shadow:13px 0 #0002,-13px 0 #000;background:#0002}to{box-shadow:13px 0 #0002,-13px 0 #000;background:#000}}@media (prefers-reduced-motion: reduce){.loader{display:none}}", B = {}, V = { class: "loader" };
|
|
3
3
|
function E(n, s) {
|
|
4
4
|
return t(), i("div", V);
|
|
5
5
|
}
|
|
6
|
-
const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]),
|
|
6
|
+
const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), z = ["part"], L = {
|
|
7
7
|
key: 1,
|
|
8
8
|
class: "message__loader message__content",
|
|
9
9
|
"aria-hidden": "true"
|
|
10
|
-
},
|
|
10
|
+
}, T = ["part"], j = { key: 0 }, q = /* @__PURE__ */ x({
|
|
11
11
|
__name: "Message.ce",
|
|
12
12
|
props: {
|
|
13
13
|
displaySender: { type: Boolean, default: !0 },
|
|
@@ -17,7 +17,7 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), j = ["part"],
|
|
|
17
17
|
loadingDuration: { type: Number }
|
|
18
18
|
},
|
|
19
19
|
setup(n) {
|
|
20
|
-
const s =
|
|
20
|
+
const s = D("hidden"), m = v(() => n.message.content.split(`
|
|
21
21
|
`));
|
|
22
22
|
function r(e) {
|
|
23
23
|
return new Promise((a) => setTimeout(a, e));
|
|
@@ -37,22 +37,22 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), j = ["part"],
|
|
|
37
37
|
}, [
|
|
38
38
|
a[0] || (a[0] = p("span", { class: "sr-only" }, "Message de ", -1)),
|
|
39
39
|
b(_(e.message.userName), 1)
|
|
40
|
-
], 8,
|
|
41
|
-
s.value === "loading" ? (t(), i("div",
|
|
40
|
+
], 8, z)) : u("", !0),
|
|
41
|
+
s.value === "loading" ? (t(), i("div", L, [
|
|
42
42
|
$(F)
|
|
43
43
|
])) : u("", !0),
|
|
44
44
|
p("p", {
|
|
45
45
|
class: h(["message__content", { "hidden-state": s.value !== "visible" }]),
|
|
46
46
|
part: `message ${e.message.direction}`
|
|
47
47
|
}, [
|
|
48
|
-
(t(!0), i(y, null,
|
|
49
|
-
o > 0 ? (t(), i("br",
|
|
48
|
+
(t(!0), i(y, null, w(m.value, (d, o) => (t(), i(y, { key: o }, [
|
|
49
|
+
o > 0 ? (t(), i("br", j)) : u("", !0),
|
|
50
50
|
b(" " + _(d), 1)
|
|
51
51
|
], 64))), 128))
|
|
52
|
-
], 10,
|
|
52
|
+
], 10, T)
|
|
53
53
|
], 2));
|
|
54
54
|
}
|
|
55
|
-
}),
|
|
55
|
+
}), O = ".message{max-width:80%;position:relative}.message--incoming{align-self:start}.message--incoming .message__sender{padding-left:10px}.message--incoming .message__loader{left:10px}.message--incoming .message__content{background-color:#e8e8e8}.message--outgoing{align-self:end}.message--outgoing .message__sender{padding-right:10px;text-align:right}.message--outgoing .message__loader{right:10px}.message--outgoing .message__content{background-color:#d1eaff}.message__sender{color:#444;font-size:.8rem;font-weight:700;margin:0}.message__loader{position:absolute;width:24px}.message__content{border-radius:16px;margin:0;padding:10px 14px}.message__content:not(.hidden-state){animation:fade .3s ease-in-out both}.hidden-state{visibility:hidden}@keyframes fade{0%{opacity:0}to{opacity:1}}@media (prefers-reduced-motion: reduce){.message__content:not(.hidden-state){animation:none}.message__loader{display:none}.hidden-state{visibility:visible}}", P = /* @__PURE__ */ f(q, [["styles", [O]]]), G = { part: "conversation" }, H = { class: "sr-only" }, I = /* @__PURE__ */ x({
|
|
56
56
|
__name: "MessageConversation.ce",
|
|
57
57
|
props: {
|
|
58
58
|
title: { default: "Conversation par messages", type: String },
|
|
@@ -70,8 +70,8 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), j = ["part"],
|
|
|
70
70
|
message: l,
|
|
71
71
|
startAnimation: c,
|
|
72
72
|
animationDuration: g
|
|
73
|
-
} = e.at(-1),
|
|
74
|
-
return [...e, { message: a, displaySender:
|
|
73
|
+
} = e.at(-1), k = a.direction !== l.direction || a.userName !== l.userName, N = c + g + s;
|
|
74
|
+
return [...e, { message: a, displaySender: k, startAnimation: N, animationDuration: o }];
|
|
75
75
|
},
|
|
76
76
|
[]
|
|
77
77
|
)
|
|
@@ -81,7 +81,7 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), j = ["part"],
|
|
|
81
81
|
}
|
|
82
82
|
return (e, a) => (t(), i("figure", G, [
|
|
83
83
|
p("figcaption", H, _(e.title), 1),
|
|
84
|
-
(t(!0), i(y, null,
|
|
84
|
+
(t(!0), i(y, null, w(m.value, ({ message: d, displaySender: o, startAnimation: l, animationDuration: c }, g) => (t(), M(P, {
|
|
85
85
|
message: d,
|
|
86
86
|
"start-animation": l,
|
|
87
87
|
"animation-duration": c,
|
|
@@ -92,4 +92,4 @@ const F = /* @__PURE__ */ f(B, [["render", E], ["styles", [C]]]), j = ["part"],
|
|
|
92
92
|
]));
|
|
93
93
|
}
|
|
94
94
|
}), J = "figure{background-color:#fff;border-radius:16px;display:flex;flex-direction:column;gap:8px;margin:0;padding:16px}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}", K = /* @__PURE__ */ f(I, [["styles", [J]]]);
|
|
95
|
-
window.customElements.define("message-conversation",
|
|
95
|
+
window.customElements.define("message-conversation", A(K));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as y,
|
|
2
|
-
function
|
|
1
|
+
import { d as y, f as w, j as C, c as l, o as n, k as p, l as h, n as x, a as k, m as $, t as v, _ as b, p as g, s as N, F as P, r as B, i as S, e as z } from "../_plugin-vue_export-helper-BDNE3C4u.js";
|
|
2
|
+
function j(c, t = L) {
|
|
3
3
|
const a = [...c];
|
|
4
4
|
for (let o = a.length - 1; o > 0; o--) {
|
|
5
5
|
const e = t() % (o + 1);
|
|
@@ -7,7 +7,7 @@ function L(c, t = j) {
|
|
|
7
7
|
}
|
|
8
8
|
return a;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function L() {
|
|
11
11
|
return Math.floor(Math.random() * 2 ** 32);
|
|
12
12
|
}
|
|
13
13
|
const E = ["aria-checked", "tabindex"], I = { key: 0 }, q = /* @__PURE__ */ y({
|
|
@@ -38,9 +38,9 @@ const E = ["aria-checked", "tabindex"], I = { key: 0 }, q = /* @__PURE__ */ y({
|
|
|
38
38
|
tabindex: e.focusable ? 0 : -1,
|
|
39
39
|
onClick: i[0] || (i[0] = h((r) => e.$emit("check"), ["stop"])),
|
|
40
40
|
onKeydown: [
|
|
41
|
-
i[1] || (i[1] =
|
|
42
|
-
i[2] || (i[2] =
|
|
43
|
-
i[3] || (i[3] =
|
|
41
|
+
i[1] || (i[1] = p(h((r) => e.$emit("check"), ["stop", "prevent"]), ["enter", "space"])),
|
|
42
|
+
i[2] || (i[2] = p(h((r) => e.$emit("checkPrevious"), ["stop", "prevent"]), ["up", "left"])),
|
|
43
|
+
i[3] || (i[3] = p(h((r) => e.$emit("checkNext"), ["stop", "prevent"]), ["down", "right"]))
|
|
44
44
|
]
|
|
45
45
|
}, [
|
|
46
46
|
e.choice.image ? (n(), l("figure", I, [
|
|
@@ -70,7 +70,7 @@ const E = ["aria-checked", "tabindex"], I = { key: 0 }, q = /* @__PURE__ */ y({
|
|
|
70
70
|
},
|
|
71
71
|
emits: ["answer"],
|
|
72
72
|
setup(c, { emit: t }) {
|
|
73
|
-
const a = t, o =
|
|
73
|
+
const a = t, o = g(() => c.hideChoicesName ? "sr-only" : ""), e = g(() => c.orderChoices ? c.choices : j(c.choices)), i = N(), r = g(() => i.value ?? e.value[0]);
|
|
74
74
|
function u(s) {
|
|
75
75
|
s === -1 ? i.value = e.value[e.value.length - 1] : s === e.value.length ? i.value = e.value[0] : i.value = e.value[s], a("answer", i.value.response ?? i.value.name);
|
|
76
76
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import "./components/message-conversation.js";
|
|
2
|
-
import "./components/
|
|
1
|
+
import "./components/message-conversation.ce.js.js";
|
|
2
|
+
import "./components/llm-messages.ce.js.js";
|
|
3
|
+
import "./components/llm-compare-messages.ce.js.js";
|
|
4
|
+
import "./components/llm-prompt-select.ce.js.js";
|
|
5
|
+
import "./components/qcu-image.ce.js.js";
|