@anvaka/vue-llm 0.1.2 → 0.2.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/core/LLMClient.js +92 -26
- package/dist/providers/AnthropicProvider.js +75 -20
- package/dist/providers/BaseProvider.js +89 -62
- package/dist/providers/BedrockProvider.js +172 -0
- package/dist/providers/OpenAIProvider.js +81 -34
- package/dist/providers/OpenRouterProvider.js +71 -38
- package/dist/providers/factory.js +23 -18
- package/dist/providers/index.js +11 -6
- package/dist/vue/components/LLMConfigModal.vue.js +27 -27
- package/dist/vue/components/ProviderSelector.vue.js +3 -3
- package/dist/vue/components/StoredKeysManager.vue.js +8 -8
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as u, computed as L, watch as G, onMounted as Ne, onUnmounted as Je,
|
|
1
|
+
import { ref as u, computed as L, watch as G, onMounted as Ne, onUnmounted as Je, openBlock as o, createElementBlock as n, createElementVNode as s, withModifiers as J, createTextVNode as R, toDisplayString as d, createCommentVNode as r, withDirectives as y, Fragment as S, renderList as z, unref as re, vModelSelect as ue, vModelText as I, vModelCheckbox as Re, normalizeClass as Y, createVNode as je, nextTick as qe } from "vue";
|
|
2
2
|
import { useLLM as Oe, createDefaultConfig as de } from "../useLLM.js";
|
|
3
3
|
import { DEFAULT_CONFIGS as Be, createProvider as We } from "../../providers/factory.js";
|
|
4
4
|
import Ge from "./StoredKeysManager.vue.js";
|
|
@@ -226,7 +226,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
226
226
|
document.removeEventListener("keydown", oe);
|
|
227
227
|
}), (l, e) => {
|
|
228
228
|
var i, m, ie;
|
|
229
|
-
return x.isVisible ? (
|
|
229
|
+
return x.isVisible ? (o(), n("div", {
|
|
230
230
|
key: 0,
|
|
231
231
|
class: "llm-modal-overlay",
|
|
232
232
|
onClick: N
|
|
@@ -239,7 +239,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
239
239
|
s("div", Ye, [
|
|
240
240
|
s("h2", null, [
|
|
241
241
|
e[12] || (e[12] = R(" Manage LLM Providers ", -1)),
|
|
242
|
-
v.value ? (
|
|
242
|
+
v.value ? (o(), n("span", He, d(f.value ? " - Edit" : " - Add"), 1)) : r("", !0)
|
|
243
243
|
]),
|
|
244
244
|
s("button", {
|
|
245
245
|
class: "llm-btn llm-btn--ghost llm-btn--sm llm-close-btn",
|
|
@@ -247,7 +247,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
247
247
|
}, "×")
|
|
248
248
|
]),
|
|
249
249
|
s("div", Qe, [
|
|
250
|
-
v.value ? (
|
|
250
|
+
v.value ? (o(), n("div", Xe, [
|
|
251
251
|
s("div", Ze, [
|
|
252
252
|
e[22] || (e[22] = s("label", { class: "llm-field-label" }, "Provider Type:", -1)),
|
|
253
253
|
y(s("select", {
|
|
@@ -256,14 +256,14 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
256
256
|
class: "llm-form-control"
|
|
257
257
|
}, [
|
|
258
258
|
e[13] || (e[13] = s("option", { value: "" }, "Select a provider...", -1)),
|
|
259
|
-
(
|
|
259
|
+
(o(!0), n(S, null, z(re(V), (a, p) => (o(), n("option", {
|
|
260
260
|
key: p,
|
|
261
261
|
value: p
|
|
262
262
|
}, d(a.name), 9, el))), 128))
|
|
263
263
|
], 544), [
|
|
264
264
|
[ue, t.value.provider]
|
|
265
265
|
]),
|
|
266
|
-
t.value.provider ? (
|
|
266
|
+
t.value.provider ? (o(), n(S, { key: 0 }, [
|
|
267
267
|
e[14] || (e[14] = s("label", { class: "llm-field-label" }, "Provider Name:", -1)),
|
|
268
268
|
y(s("input", {
|
|
269
269
|
"onUpdate:modelValue": e[1] || (e[1] = (a) => t.value.name = a),
|
|
@@ -275,7 +275,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
275
275
|
[I, t.value.name]
|
|
276
276
|
])
|
|
277
277
|
], 64)) : r("", !0),
|
|
278
|
-
t.value.provider ? (
|
|
278
|
+
t.value.provider ? (o(), n(S, { key: 1 }, [
|
|
279
279
|
e[18] || (e[18] = s("label", { class: "llm-field-label" }, "Base URL:", -1)),
|
|
280
280
|
y(s("input", {
|
|
281
281
|
"onUpdate:modelValue": e[2] || (e[2] = (a) => t.value.baseUrl = a),
|
|
@@ -286,7 +286,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
286
286
|
}, null, 8, tl), [
|
|
287
287
|
[I, t.value.baseUrl]
|
|
288
288
|
]),
|
|
289
|
-
(m = A.value) != null && m.requiresApiKey || t.value.provider === "custom" ? (
|
|
289
|
+
(m = A.value) != null && m.requiresApiKey || t.value.provider === "custom" ? (o(), n(S, { key: 0 }, [
|
|
290
290
|
e[16] || (e[16] = s("label", { class: "llm-field-label" }, "API Key:", -1)),
|
|
291
291
|
s("div", sl, [
|
|
292
292
|
s("div", al, [
|
|
@@ -299,7 +299,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
299
299
|
}, null, 8, ol), [
|
|
300
300
|
[I, t.value.apiKey]
|
|
301
301
|
]),
|
|
302
|
-
re(le)(t.value.provider) ? (
|
|
302
|
+
re(le)(t.value.provider) ? (o(), n("button", {
|
|
303
303
|
key: 0,
|
|
304
304
|
type: "button",
|
|
305
305
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
@@ -309,7 +309,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
309
309
|
]),
|
|
310
310
|
s("small", nl, [
|
|
311
311
|
e[15] || (e[15] = R(" ⚠️ API key is stored locally in your browser ", -1)),
|
|
312
|
-
t.value.provider === "custom" ? (
|
|
312
|
+
t.value.provider === "custom" ? (o(), n("span", il, " (optional for custom providers)")) : r("", !0)
|
|
313
313
|
])
|
|
314
314
|
])
|
|
315
315
|
], 64)) : r("", !0),
|
|
@@ -321,7 +321,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
321
321
|
class: "llm-form-control"
|
|
322
322
|
}, [
|
|
323
323
|
s("option", dl, d(_.value ? "Loading models..." : "Select a model..."), 1),
|
|
324
|
-
(
|
|
324
|
+
(o(!0), n(S, null, z(U.value, (a) => (o(), n("option", {
|
|
325
325
|
key: a,
|
|
326
326
|
value: a
|
|
327
327
|
}, d(a), 9, vl))), 128))
|
|
@@ -334,8 +334,8 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
334
334
|
disabled: !t.value.baseUrl || _.value,
|
|
335
335
|
title: "Refresh models list"
|
|
336
336
|
}, d(_.value ? "Loading..." : "Refresh"), 9, cl),
|
|
337
|
-
h.value ? (
|
|
338
|
-
ke.value ? (
|
|
337
|
+
h.value ? (o(), n("div", ml, d(h.value), 1)) : r("", !0),
|
|
338
|
+
ke.value ? (o(), n("div", fl, [
|
|
339
339
|
s("label", bl, [
|
|
340
340
|
y(s("input", {
|
|
341
341
|
type: "checkbox",
|
|
@@ -366,7 +366,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
366
366
|
{ number: !0 }
|
|
367
367
|
]
|
|
368
368
|
]),
|
|
369
|
-
D.value ? (
|
|
369
|
+
D.value ? (o(), n("small", kl, " This model uses a fixed temperature of 1. ")) : (o(), n("small", yl, " Controls randomness: 0 = deterministic, 2 = very creative "))
|
|
370
370
|
]),
|
|
371
371
|
e[21] || (e[21] = s("label", { class: "llm-field-label" }, "Max Tokens:", -1)),
|
|
372
372
|
y(s("input", {
|
|
@@ -387,14 +387,14 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
387
387
|
])
|
|
388
388
|
], 64)) : r("", !0)
|
|
389
389
|
]),
|
|
390
|
-
c.value ? (
|
|
390
|
+
c.value ? (o(), n("div", {
|
|
391
391
|
key: 0,
|
|
392
392
|
class: Y(["llm-test-result", c.value.success ? "llm-test-result--success" : "llm-test-result--error"])
|
|
393
393
|
}, d(c.value.message), 3)) : r("", !0)
|
|
394
|
-
])) : (
|
|
395
|
-
T.value.length > 0 ? (
|
|
394
|
+
])) : (o(), n("div", hl, [
|
|
395
|
+
T.value.length > 0 ? (o(), n("div", Cl, [
|
|
396
396
|
e[23] || (e[23] = s("h3", null, "Configured Providers", -1)),
|
|
397
|
-
(
|
|
397
|
+
(o(!0), n(S, null, z(T.value, (a) => (o(), n("div", {
|
|
398
398
|
key: a.id,
|
|
399
399
|
class: Y(["llm-provider-item", {
|
|
400
400
|
active: a.id === M.value,
|
|
@@ -406,10 +406,10 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
406
406
|
s("div", wl, [
|
|
407
407
|
s("div", Sl, [
|
|
408
408
|
R(d(a.name) + " ", 1),
|
|
409
|
-
a.enabled === !1 ? (
|
|
409
|
+
a.enabled === !1 ? (o(), n("span", Tl, "Disabled")) : r("", !0)
|
|
410
410
|
]),
|
|
411
|
-
a.id === M.value ? (
|
|
412
|
-
x.showJudge && a.id === k.value ? (
|
|
411
|
+
a.id === M.value ? (o(), n("span", Ml, "Active")) : r("", !0),
|
|
412
|
+
x.showJudge && a.id === k.value ? (o(), n("span", Kl, "Judge")) : r("", !0)
|
|
413
413
|
]),
|
|
414
414
|
s("div", Ul, [
|
|
415
415
|
s("button", {
|
|
@@ -425,7 +425,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
425
425
|
onClick: e[8] || (e[8] = J(() => {
|
|
426
426
|
}, ["stop"]))
|
|
427
427
|
}, [
|
|
428
|
-
x.showJudge && a.enabled !== !1 ? (
|
|
428
|
+
x.showJudge && a.enabled !== !1 ? (o(), n("button", {
|
|
429
429
|
key: 0,
|
|
430
430
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
431
431
|
onClick: (p) => Fe(a),
|
|
@@ -446,13 +446,13 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
446
446
|
}, " Delete ", 8, Vl)
|
|
447
447
|
])
|
|
448
448
|
], 10, _l))), 128))
|
|
449
|
-
])) : (
|
|
449
|
+
])) : (o(), n("div", $l, [...e[24] || (e[24] = [
|
|
450
450
|
s("p", null, "Connect your first AI provider to start chatting.", -1),
|
|
451
451
|
s("p", null, `Click "Add New Provider" below. You'll need a base URL and, for some providers, an API key.`, -1),
|
|
452
452
|
s("p", { class: "llm-security-note" }, "API keys are stored locally in your browser.", -1)
|
|
453
453
|
])]))
|
|
454
454
|
])),
|
|
455
|
-
q.value ? (
|
|
455
|
+
q.value ? (o(), n("div", {
|
|
456
456
|
key: 2,
|
|
457
457
|
class: "llm-keys-manager-overlay",
|
|
458
458
|
onClick: ne
|
|
@@ -470,12 +470,12 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
470
470
|
])) : r("", !0)
|
|
471
471
|
]),
|
|
472
472
|
s("div", Dl, [
|
|
473
|
-
v.value ? r("", !0) : (
|
|
473
|
+
v.value ? r("", !0) : (o(), n("button", {
|
|
474
474
|
key: 0,
|
|
475
475
|
class: "llm-btn llm-btn--secondary",
|
|
476
476
|
onClick: Ae
|
|
477
477
|
}, " Add New Provider ")),
|
|
478
|
-
!v.value && he.value ? (
|
|
478
|
+
!v.value && he.value ? (o(), n("button", {
|
|
479
479
|
key: 1,
|
|
480
480
|
class: "llm-btn llm-btn--ghost",
|
|
481
481
|
onClick: xe
|
|
@@ -485,7 +485,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
485
485
|
class: "llm-btn llm-btn--ghost",
|
|
486
486
|
onClick: e[10] || (e[10] = (a) => v.value ? Ee() : N())
|
|
487
487
|
}, " Close "),
|
|
488
|
-
v.value ? (
|
|
488
|
+
v.value ? (o(), n("button", {
|
|
489
489
|
key: 2,
|
|
490
490
|
class: "llm-btn llm-btn--primary",
|
|
491
491
|
onClick: Me,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as c, onMounted as _,
|
|
1
|
+
import { ref as c, onMounted as _, openBlock as r, createElementBlock as n, withDirectives as g, createElementVNode as i, Fragment as P, renderList as h, toDisplayString as S, vModelSelect as y } from "vue";
|
|
2
2
|
import { useLLM as I } from "../useLLM.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import M from "../../_virtual/_plugin-vue_export-helper.js";
|
|
@@ -24,7 +24,7 @@ const k = { class: "llm-provider-selector" }, x = ["value"], C = {
|
|
|
24
24
|
};
|
|
25
25
|
return _(() => {
|
|
26
26
|
m();
|
|
27
|
-
}), (b, t) => (
|
|
27
|
+
}), (b, t) => (r(), n("div", k, [
|
|
28
28
|
g(i("select", {
|
|
29
29
|
"onUpdate:modelValue": t[0] || (t[0] = (o) => e.value = o),
|
|
30
30
|
onChange: f,
|
|
@@ -34,7 +34,7 @@ const k = { class: "llm-provider-selector" }, x = ["value"], C = {
|
|
|
34
34
|
value: "",
|
|
35
35
|
disabled: ""
|
|
36
36
|
}, "Select Provider...", -1)),
|
|
37
|
-
(
|
|
37
|
+
(r(!0), n(P, null, h(a.value, (o) => (r(), n("option", {
|
|
38
38
|
key: o.id,
|
|
39
39
|
value: o.id
|
|
40
40
|
}, S(o.name), 9, x))), 128)),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as v, watch as R, onMounted as G,
|
|
1
|
+
import { ref as v, watch as R, onMounted as G, openBlock as d, createElementBlock as c, createElementVNode as s, createCommentVNode as b, Fragment as D, renderList as V, toDisplayString as p, withDirectives as S, withKeys as K, vModelDynamic as U, unref as q, vModelSelect as z, nextTick as J } from "vue";
|
|
2
2
|
import { useLLM as Q } from "../useLLM.js";
|
|
3
3
|
import { DEFAULT_CONFIGS as W } from "../../providers/factory.js";
|
|
4
4
|
import { maskApiKey as X } from "../../core/keyStore.js";
|
|
@@ -98,7 +98,7 @@ This action cannot be undone.`) && F(e) && (h(), w("keysUpdated"));
|
|
|
98
98
|
}, 500);
|
|
99
99
|
}), G(() => {
|
|
100
100
|
h();
|
|
101
|
-
}), (e, t) => (
|
|
101
|
+
}), (e, t) => (d(), c("div", Z, [
|
|
102
102
|
s("div", I, [
|
|
103
103
|
t[5] || (t[5] = s("h3", null, "Stored API Keys", -1)),
|
|
104
104
|
s("button", {
|
|
@@ -108,12 +108,12 @@ This action cannot be undone.`) && F(e) && (h(), w("keysUpdated"));
|
|
|
108
108
|
]),
|
|
109
109
|
s("div", ee, [
|
|
110
110
|
s("div", te, [
|
|
111
|
-
Object.keys(y.value).length === 0 && !f.value ? (
|
|
111
|
+
Object.keys(y.value).length === 0 && !f.value ? (d(), c("div", le, [...t[6] || (t[6] = [
|
|
112
112
|
s("p", null, "No API keys stored yet.", -1),
|
|
113
113
|
s("small", null, "Keys are automatically stored when you save a provider configuration.", -1)
|
|
114
114
|
])])) : b("", !0),
|
|
115
|
-
Object.keys(y.value).length > 0 || f.value ? (
|
|
116
|
-
(
|
|
115
|
+
Object.keys(y.value).length > 0 || f.value ? (d(), c("div", se, [
|
|
116
|
+
(d(!0), c(D, null, V(y.value, (o, l) => (d(), c("div", {
|
|
117
117
|
key: l,
|
|
118
118
|
class: "llm-key-item"
|
|
119
119
|
}, [
|
|
@@ -123,7 +123,7 @@ This action cannot be undone.`) && F(e) && (h(), w("keysUpdated"));
|
|
|
123
123
|
s("div", re, p(E(l)), 1),
|
|
124
124
|
s("span", ae, p(O(o.storedAt)), 1)
|
|
125
125
|
]),
|
|
126
|
-
o.serviceEndpoint ? (
|
|
126
|
+
o.serviceEndpoint ? (d(), c("div", de, [
|
|
127
127
|
s("small", null, p(o.serviceEndpoint), 1)
|
|
128
128
|
])) : b("", !0),
|
|
129
129
|
s("div", ce, [
|
|
@@ -155,7 +155,7 @@ This action cannot be undone.`) && F(e) && (h(), w("keysUpdated"));
|
|
|
155
155
|
])
|
|
156
156
|
])
|
|
157
157
|
]))), 128)),
|
|
158
|
-
f.value ? (
|
|
158
|
+
f.value ? (d(), c("div", pe, [
|
|
159
159
|
s("div", ye, [
|
|
160
160
|
s("div", fe, [
|
|
161
161
|
s("div", _e, [
|
|
@@ -164,7 +164,7 @@ This action cannot be undone.`) && F(e) && (h(), w("keysUpdated"));
|
|
|
164
164
|
class: "llm-form-control llm-provider-select"
|
|
165
165
|
}, [
|
|
166
166
|
t[7] || (t[7] = s("option", { value: "" }, "Select provider type...", -1)),
|
|
167
|
-
(
|
|
167
|
+
(d(!0), c(D, null, V(q(_), (o, l) => (d(), c("option", {
|
|
168
168
|
key: l,
|
|
169
169
|
value: l,
|
|
170
170
|
disabled: l !== "custom" && k(l)
|