@aitronos/freddy-plugins 0.4.16 → 0.4.18
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/CHANGELOG.md +17 -0
- package/dist/index.cjs +154 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +943 -47
- package/dist/index.js +61202 -3513
- package/dist/index.js.map +1 -1
- package/dist/web-components.iife.js +1 -1
- package/dist/web-components.iife.js.map +1 -1
- package/dist/web-components.js +87 -36
- package/dist/web-components.js.map +1 -1
- package/package.json +2 -1
package/dist/web-components.js
CHANGED
|
@@ -59628,13 +59628,41 @@ const handleClick = () => {
|
|
|
59628
59628
|
emits: ["send", "sendWithContext"],
|
|
59629
59629
|
setup(t, { emit: e }) {
|
|
59630
59630
|
const r = t, n = e, o = V(""), a = V(null), s = V(null), i = () => [
|
|
59631
|
-
{
|
|
59632
|
-
|
|
59633
|
-
|
|
59631
|
+
{
|
|
59632
|
+
id: "assistant-1",
|
|
59633
|
+
name: "General Assistant",
|
|
59634
|
+
description: "A helpful general-purpose assistant",
|
|
59635
|
+
default: !0
|
|
59636
|
+
},
|
|
59637
|
+
{
|
|
59638
|
+
id: "assistant-2",
|
|
59639
|
+
name: "Code Assistant",
|
|
59640
|
+
description: "Specialized in programming and development"
|
|
59641
|
+
},
|
|
59642
|
+
{
|
|
59643
|
+
id: "assistant-3",
|
|
59644
|
+
name: "Writing Assistant",
|
|
59645
|
+
description: "Focused on writing and content creation"
|
|
59646
|
+
}
|
|
59634
59647
|
], l = () => [
|
|
59635
|
-
{
|
|
59636
|
-
|
|
59637
|
-
|
|
59648
|
+
{
|
|
59649
|
+
id: "gpt-4",
|
|
59650
|
+
name: "GPT-4",
|
|
59651
|
+
description: "Most capable model",
|
|
59652
|
+
owned_by: "openai"
|
|
59653
|
+
},
|
|
59654
|
+
{
|
|
59655
|
+
id: "gpt-4-turbo",
|
|
59656
|
+
name: "GPT-4 Turbo",
|
|
59657
|
+
description: "Faster and more efficient",
|
|
59658
|
+
owned_by: "openai"
|
|
59659
|
+
},
|
|
59660
|
+
{
|
|
59661
|
+
id: "gpt-3.5-turbo",
|
|
59662
|
+
name: "GPT-3.5 Turbo",
|
|
59663
|
+
description: "Fast and cost-effective",
|
|
59664
|
+
owned_by: "openai"
|
|
59665
|
+
}
|
|
59638
59666
|
], c = V([]), u = V([]), _ = V(!1), m = V(!1), f = V(null), p = V(null), h = W(() => r.debugMode), b = V("None"), T = V(!1), S = V({
|
|
59639
59667
|
requestSent: 0,
|
|
59640
59668
|
apiResponseReceived: 0,
|
|
@@ -59642,16 +59670,22 @@ const handleClick = () => {
|
|
|
59642
59670
|
ourStreamStart: 0,
|
|
59643
59671
|
apiStreamEnd: 0,
|
|
59644
59672
|
ourStreamEnd: 0
|
|
59645
|
-
}), C = V(
|
|
59646
|
-
|
|
59647
|
-
|
|
59648
|
-
|
|
59649
|
-
|
|
59650
|
-
|
|
59651
|
-
|
|
59652
|
-
|
|
59653
|
-
|
|
59654
|
-
|
|
59673
|
+
}), C = V(
|
|
59674
|
+
new Xs({
|
|
59675
|
+
apiKey: r.apiKey,
|
|
59676
|
+
baseUrl: r.apiBaseUrl
|
|
59677
|
+
})
|
|
59678
|
+
);
|
|
59679
|
+
je(
|
|
59680
|
+
[() => r.apiKey, () => r.apiBaseUrl],
|
|
59681
|
+
([L, k]) => {
|
|
59682
|
+
C.value = new Xs({
|
|
59683
|
+
apiKey: L,
|
|
59684
|
+
baseUrl: k
|
|
59685
|
+
});
|
|
59686
|
+
},
|
|
59687
|
+
{ immediate: !1 }
|
|
59688
|
+
);
|
|
59655
59689
|
const v = async () => {
|
|
59656
59690
|
var L, k;
|
|
59657
59691
|
if (!r.apiKey) {
|
|
@@ -59671,7 +59705,9 @@ const handleClick = () => {
|
|
|
59671
59705
|
signal: se.signal
|
|
59672
59706
|
});
|
|
59673
59707
|
if (clearTimeout(ye), !ue.ok)
|
|
59674
|
-
throw new Error(
|
|
59708
|
+
throw new Error(
|
|
59709
|
+
`Failed to fetch assistants: ${ue.status} ${ue.statusText}`
|
|
59710
|
+
);
|
|
59675
59711
|
const le = await ue.json(), Le = Array.isArray(le) ? le : le.data || [];
|
|
59676
59712
|
c.value = Le.map((fe) => ({
|
|
59677
59713
|
id: fe.id.toString(),
|
|
@@ -59681,7 +59717,9 @@ const handleClick = () => {
|
|
|
59681
59717
|
})), c.value.length > 0 && !c.value.some((fe) => fe.default) && (c.value[0].default = !0);
|
|
59682
59718
|
} catch (U) {
|
|
59683
59719
|
const G = U instanceof Error ? U.message : "Failed to fetch assistants";
|
|
59684
|
-
f.value = G, U.name !== "AbortError" && (G.includes("CORS") || G.includes("Access-Control-Allow-Origin") ? (L = s.value) == null || L.showErrorBanner(
|
|
59720
|
+
f.value = G, U.name !== "AbortError" && (G.includes("CORS") || G.includes("Access-Control-Allow-Origin") ? (L = s.value) == null || L.showErrorBanner(
|
|
59721
|
+
"CORS Error: Cannot connect to Freddy API from localhost. Try using the production build or configure CORS."
|
|
59722
|
+
) : (k = s.value) == null || k.showErrorBanner(`API Error: ${G}`)), c.value = [];
|
|
59685
59723
|
} finally {
|
|
59686
59724
|
_.value = !1;
|
|
59687
59725
|
}
|
|
@@ -59704,7 +59742,9 @@ const handleClick = () => {
|
|
|
59704
59742
|
signal: se.signal
|
|
59705
59743
|
});
|
|
59706
59744
|
if (clearTimeout(ye), !ue.ok)
|
|
59707
|
-
throw new Error(
|
|
59745
|
+
throw new Error(
|
|
59746
|
+
`Failed to fetch models: ${ue.status} ${ue.statusText}`
|
|
59747
|
+
);
|
|
59708
59748
|
const le = await ue.json(), fe = (Array.isArray(le) ? le : le.data || []).map((J) => ({
|
|
59709
59749
|
id: J.id.toString(),
|
|
59710
59750
|
name: J.title || J.name || `Model ${J.id}`,
|
|
@@ -59715,23 +59755,28 @@ const handleClick = () => {
|
|
|
59715
59755
|
fe.length > 0 && (fe[0].default = !0), u.value = fe;
|
|
59716
59756
|
} catch (U) {
|
|
59717
59757
|
const G = U instanceof Error ? U.message : "Failed to fetch models";
|
|
59718
|
-
f.value = G, U.name !== "AbortError" && (G.includes("CORS") || G.includes("Access-Control-Allow-Origin") ? (L = s.value) == null || L.showErrorBanner(
|
|
59758
|
+
f.value = G, U.name !== "AbortError" && (G.includes("CORS") || G.includes("Access-Control-Allow-Origin") ? (L = s.value) == null || L.showErrorBanner(
|
|
59759
|
+
"CORS Error: Cannot connect to Freddy API from localhost. Try using the production build or configure CORS."
|
|
59760
|
+
) : (k = s.value) == null || k.showErrorBanner(`API Error: ${G}`)), u.value = [];
|
|
59719
59761
|
} finally {
|
|
59720
59762
|
m.value = !1;
|
|
59721
59763
|
}
|
|
59722
59764
|
}, R = async () => {
|
|
59723
59765
|
if (!r.apiKey) return Promise.resolve();
|
|
59724
59766
|
try {
|
|
59725
|
-
const L = new AbortController(), k = setTimeout(() => L.abort(), 5e3), U = await fetch(
|
|
59726
|
-
|
|
59727
|
-
|
|
59728
|
-
"
|
|
59729
|
-
|
|
59730
|
-
|
|
59731
|
-
|
|
59732
|
-
|
|
59733
|
-
|
|
59734
|
-
|
|
59767
|
+
const L = new AbortController(), k = setTimeout(() => L.abort(), 5e3), U = await fetch(
|
|
59768
|
+
`${r.apiBaseUrl}/v1/organizations/${r.organizationId}/models`,
|
|
59769
|
+
{
|
|
59770
|
+
method: "GET",
|
|
59771
|
+
headers: {
|
|
59772
|
+
"api-key": r.apiKey,
|
|
59773
|
+
"Content-Type": "application/json",
|
|
59774
|
+
accept: "application/json"
|
|
59775
|
+
},
|
|
59776
|
+
mode: "cors",
|
|
59777
|
+
signal: L.signal
|
|
59778
|
+
}
|
|
59779
|
+
);
|
|
59735
59780
|
if (clearTimeout(k), !U.ok) {
|
|
59736
59781
|
const G = await U.text();
|
|
59737
59782
|
}
|
|
@@ -59779,7 +59824,9 @@ const handleClick = () => {
|
|
|
59779
59824
|
// streaming handled by server; request stays JSON here
|
|
59780
59825
|
};
|
|
59781
59826
|
p.value;
|
|
59782
|
-
const J = F.value.findIndex(
|
|
59827
|
+
const J = F.value.findIndex(
|
|
59828
|
+
(ne) => ne.id === G
|
|
59829
|
+
);
|
|
59783
59830
|
let Oe = "";
|
|
59784
59831
|
b.value = `🔍 INDEX LOOKUP: ${G} -> ${J} (total: ${F.value.length})`, T.value = !0, b.value = "Starting stream...", S.value = {
|
|
59785
59832
|
requestSent: 0,
|
|
@@ -59846,11 +59893,15 @@ const handleClick = () => {
|
|
|
59846
59893
|
}
|
|
59847
59894
|
} catch (fe) {
|
|
59848
59895
|
T.value = !1;
|
|
59849
|
-
const J = F.value.findIndex(
|
|
59896
|
+
const J = F.value.findIndex(
|
|
59897
|
+
(Oe) => Oe.id === G
|
|
59898
|
+
);
|
|
59850
59899
|
J !== -1 && (F.value[J] = {
|
|
59851
59900
|
...F.value[J],
|
|
59852
59901
|
content: "Sorry, I encountered an error while processing your message. Please try again."
|
|
59853
|
-
}), (Le = s.value) == null || Le.showErrorBanner(
|
|
59902
|
+
}), (Le = s.value) == null || Le.showErrorBanner(
|
|
59903
|
+
`Failed to send message: ${fe instanceof Error ? fe.message : "Unknown error"}`
|
|
59904
|
+
);
|
|
59854
59905
|
}
|
|
59855
59906
|
}, A = new ct({
|
|
59856
59907
|
html: !0,
|
|
@@ -60123,7 +60174,7 @@ This should give you a solid foundation for building **maintainable**, **type-sa
|
|
|
60123
60174
|
]),
|
|
60124
60175
|
S.value.ourStreamEnd && S.value.requestSent ? (g(), E("div", Iv, [
|
|
60125
60176
|
k[12] || (k[12] = d("strong", null, "🕒 Total Time:", -1)),
|
|
60126
|
-
_e(" " + w(S.value.ourStreamEnd - S.value.requestSent) + "ms", 1)
|
|
60177
|
+
_e(" " + w(S.value.ourStreamEnd - S.value.requestSent) + "ms ", 1)
|
|
60127
60178
|
])) : K("", !0)
|
|
60128
60179
|
]),
|
|
60129
60180
|
F.value.length > 0 ? (g(), E("div", Dv, [
|
|
@@ -60152,7 +60203,7 @@ This should give you a solid foundation for building **maintainable**, **type-sa
|
|
|
60152
60203
|
])])) : D.value.length === 0 ? (g(), E("div", Lv, [...k[16] || (k[16] = [
|
|
60153
60204
|
d("div", { class: "chat-interface__welcome-icon" }, "💬", -1),
|
|
60154
60205
|
d("h3", { class: "chat-interface__welcome-title" }, "Start a conversation", -1),
|
|
60155
|
-
d("p", { class: "chat-interface__welcome-text" }, "Type a message below to begin chatting with your AI assistant.", -1)
|
|
60206
|
+
d("p", { class: "chat-interface__welcome-text" }, " Type a message below to begin chatting with your AI assistant. ", -1)
|
|
60156
60207
|
])])) : (g(!0), E(be, { key: 2 }, ve(D.value, (U) => (g(), E("div", {
|
|
60157
60208
|
key: U.id,
|
|
60158
60209
|
class: "chat-interface__message-container"
|
|
@@ -60184,7 +60235,7 @@ This should give you a solid foundation for building **maintainable**, **type-sa
|
|
|
60184
60235
|
])
|
|
60185
60236
|
]));
|
|
60186
60237
|
}
|
|
60187
|
-
}), Uv = ".chat-interface{display:flex;flex-direction:column;height:100%;width:100%;background:var(--freddy-bg-primary);border-radius:12px;box-shadow:0 4px 6px -1px var(--border-light);overflow:visible;position:relative}.chat-interface__debug-panel{background:#1f2937;color:#f9fafb;border-bottom:2px solid #374151;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:11px;max-height:200px;overflow-y:auto}.chat-interface__debug-header{background:#111827;padding:8px 12px;font-weight:700;border-bottom:1px solid #374151}.chat-interface__debug-content{padding:8px 12px;line-height:1.4}.chat-interface__debug-content>div{margin-bottom:4px}.chat-interface__debug-messages{margin-top:8px;padding-top:8px;border-top:1px solid #374151;max-height:100px;overflow-y:auto}.chat-interface__debug-message{font-size:10px;margin-bottom:2px;color:#d1d5db}.chat-interface__debug-timing{margin-top:8px;padding-top:8px;border-top:1px solid #374151;font-size:10px;line-height:1.3}.chat-interface__debug-timing>div{margin-bottom:2px}.chat-interface__thread-indicator{display:flex;align-items:center;gap:8px;padding:8px 16px;background:#f0f9ff;border-bottom:1px solid #bae6fd;font-size:12px;color:#0369a1}.chat-interface__thread-icon{font-size:14px}.chat-interface__thread-text{font-weight:500}.chat-interface__loading{display:flex;align-items:center;justify-content:center;gap:12px;padding:24px;color:#6b7280;font-size:14px}.chat-interface__loading-spinner{width:20px;height:20px;border:2px solid #e5e7eb;border-top:2px solid #3b82f6;border-radius:50%;animation:freddy-plugin-spin 1s linear infinite}.chat-interface__loading-text{font-weight:500}@keyframes freddy-plugin-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chat-interface__welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px 24px;text-align:center;color:#6b7280}.chat-interface__welcome-icon{font-size:48px;margin-bottom:16px}.chat-interface__welcome-title{font-size:20px;font-weight:600;color:#374151;margin:0 0 8px}.chat-interface__welcome-text{font-size:14px;margin:0;line-height:1.5}.chat-interface__messages{flex:1;overflow-y:auto;overflow-x:visible;padding:32px;min-height:400px
|
|
60238
|
+
}), Uv = ".chat-interface{display:flex;flex-direction:column;height:100%;width:100%;background:var(--freddy-bg-primary);border-radius:12px;box-shadow:0 4px 6px -1px var(--border-light);overflow:visible;position:relative}.chat-interface__debug-panel{background:#1f2937;color:#f9fafb;border-bottom:2px solid #374151;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:11px;max-height:200px;overflow-y:auto}.chat-interface__debug-header{background:#111827;padding:8px 12px;font-weight:700;border-bottom:1px solid #374151}.chat-interface__debug-content{padding:8px 12px;line-height:1.4}.chat-interface__debug-content>div{margin-bottom:4px}.chat-interface__debug-messages{margin-top:8px;padding-top:8px;border-top:1px solid #374151;max-height:100px;overflow-y:auto}.chat-interface__debug-message{font-size:10px;margin-bottom:2px;color:#d1d5db}.chat-interface__debug-timing{margin-top:8px;padding-top:8px;border-top:1px solid #374151;font-size:10px;line-height:1.3}.chat-interface__debug-timing>div{margin-bottom:2px}.chat-interface__thread-indicator{display:flex;align-items:center;gap:8px;padding:8px 16px;background:#f0f9ff;border-bottom:1px solid #bae6fd;font-size:12px;color:#0369a1}.chat-interface__thread-icon{font-size:14px}.chat-interface__thread-text{font-weight:500}.chat-interface__loading{display:flex;align-items:center;justify-content:center;gap:12px;padding:24px;color:#6b7280;font-size:14px}.chat-interface__loading-spinner{width:20px;height:20px;border:2px solid #e5e7eb;border-top:2px solid #3b82f6;border-radius:50%;animation:freddy-plugin-spin 1s linear infinite}.chat-interface__loading-text{font-weight:500}@keyframes freddy-plugin-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.chat-interface__welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px 24px;text-align:center;color:#6b7280}.chat-interface__welcome-icon{font-size:48px;margin-bottom:16px}.chat-interface__welcome-title{font-size:20px;font-weight:600;color:#374151;margin:0 0 8px}.chat-interface__welcome-text{font-size:14px;margin:0;line-height:1.5}.chat-interface__messages{flex:1;overflow-y:auto;overflow-x:visible;padding:32px;min-height:400px}@media (max-width: 768px){.chat-interface__messages{padding:20px 8px}}.chat-interface__message-container{margin-bottom:20px}.chat-interface__message-container:last-child{margin-bottom:0}.chat-interface__input-bar{padding:0 24px 12px;background:transparent!important;overflow:visible}", Gv = /* @__PURE__ */ N(Bv, [["styles", [Uv]]]), Yv = { class: "freddy-plugin-color-comparison" }, Hv = {
|
|
60188
60239
|
key: 0,
|
|
60189
60240
|
class: "freddy-plugin-loading"
|
|
60190
60241
|
}, Vv = {
|