@anvaka/vue-llm 0.1.1 → 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 +94 -28
- package/dist/providers/AnthropicProvider.js +76 -21
- package/dist/providers/BaseProvider.js +89 -62
- package/dist/providers/BedrockProvider.js +172 -0
- package/dist/providers/CustomProvider.js +1 -1
- package/dist/providers/GeminiProvider.js +1 -1
- package/dist/providers/GrokProvider.js +1 -1
- package/dist/providers/LlamaServerProvider.js +1 -1
- package/dist/providers/OllamaProvider.js +1 -1
- package/dist/providers/OpenAIProvider.js +82 -35
- package/dist/providers/OpenRouterProvider.js +72 -39
- package/dist/providers/factory.js +23 -18
- package/dist/providers/index.js +11 -6
- package/dist/vue/components/LLMConfigModal.vue.js +114 -110
- package/dist/vue/components/ProviderSelector.vue.js +3 -3
- package/dist/vue/components/StoredKeysManager.vue.js +8 -8
- package/dist/vue-llm.css +1 -1
- 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";
|
|
@@ -31,7 +31,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
31
31
|
}, Ul = { class: "llm-provider-details-row" }, Al = ["onClick", "disabled"], El = { class: "llm-provider-details" }, Ll = ["onClick", "title"], Il = ["onClick", "title"], xl = ["onClick"], Vl = ["onClick"], $l = {
|
|
32
32
|
key: 1,
|
|
33
33
|
class: "llm-empty-state"
|
|
34
|
-
}, Dl = { class: "llm-modal-footer" }, Fl = ["disabled"],
|
|
34
|
+
}, Dl = { class: "llm-modal-footer" }, Fl = ["disabled"], H = "judge-provider", Nl = {
|
|
35
35
|
__name: "LLMConfigModal",
|
|
36
36
|
props: {
|
|
37
37
|
isVisible: Boolean,
|
|
@@ -42,32 +42,32 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
42
42
|
},
|
|
43
43
|
emits: ["close", "configChanged"],
|
|
44
44
|
setup(x, { emit: ve }) {
|
|
45
|
-
const
|
|
45
|
+
const g = x, j = ve, V = Be, {
|
|
46
46
|
client: Jl,
|
|
47
47
|
configStore: Rl,
|
|
48
48
|
getEnabledConfigs: jl,
|
|
49
49
|
getAllConfigs: ce,
|
|
50
|
-
getActiveProviderId:
|
|
51
|
-
setActiveProviderId:
|
|
50
|
+
getActiveProviderId: Q,
|
|
51
|
+
setActiveProviderId: X,
|
|
52
52
|
saveConfig: me,
|
|
53
53
|
deleteConfig: fe,
|
|
54
54
|
enableProvider: be,
|
|
55
55
|
disableProvider: ge,
|
|
56
56
|
getAvailableModels: pe,
|
|
57
|
-
testConnection:
|
|
57
|
+
testConnection: Z,
|
|
58
58
|
refresh: $,
|
|
59
|
-
getStoredKey:
|
|
60
|
-
hasStoredKey:
|
|
59
|
+
getStoredKey: ee,
|
|
60
|
+
hasStoredKey: le,
|
|
61
61
|
getAllStoredKeys: ye,
|
|
62
62
|
storeKey: ql
|
|
63
|
-
} = Oe(), t = u(de("")), T = u([]), M = u(null),
|
|
63
|
+
} = Oe(), t = u(de("")), T = u([]), M = u(null), k = u(null), v = u(!1), f = u(null), K = u(!1), c = u(null), U = u([]), _ = u(!1), h = u(null), C = u(/* @__PURE__ */ new Map()), q = u(!1), te = u(0), P = u(null), A = L(
|
|
64
64
|
() => t.value.provider ? V[t.value.provider] : null
|
|
65
|
-
),
|
|
65
|
+
), b = u(/* @__PURE__ */ new Set()), ke = L(() => t.value.model && b.value.has("thinking")), D = L(() => {
|
|
66
66
|
var e, i;
|
|
67
67
|
if (!((e = t.value) != null && e.provider) || !((i = t.value) != null && i.model) || t.value.provider !== "openai") return !1;
|
|
68
68
|
const l = String(t.value.model).toLowerCase();
|
|
69
|
-
return
|
|
70
|
-
}), he = L(() =>
|
|
69
|
+
return b.value.has("thinking") || l.startsWith("o1") || l.startsWith("o2") || l.startsWith("o3") || l.startsWith("o-") || l.includes("gpt-5") || l === "gpt5" || l.includes("reasoning");
|
|
70
|
+
}), he = L(() => te.value > 0), se = L(() => {
|
|
71
71
|
var l;
|
|
72
72
|
return !(!t.value.name || !t.value.provider || !t.value.baseUrl || (l = A.value) != null && l.requiresApiKey && !t.value.apiKey);
|
|
73
73
|
}), Ce = (l) => {
|
|
@@ -82,23 +82,23 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
82
82
|
"llm-test-default": !e || e === "default"
|
|
83
83
|
};
|
|
84
84
|
}, F = () => {
|
|
85
|
-
if (T.value = ce(), M.value =
|
|
85
|
+
if (T.value = ce(), M.value = Q() || "", g.showJudge)
|
|
86
86
|
try {
|
|
87
|
-
|
|
87
|
+
k.value = localStorage.getItem("llm:" + H) || null;
|
|
88
88
|
} catch {
|
|
89
|
-
|
|
89
|
+
k.value = null;
|
|
90
90
|
}
|
|
91
91
|
}, O = () => {
|
|
92
92
|
const l = ye();
|
|
93
|
-
|
|
93
|
+
te.value = Object.keys(l).length;
|
|
94
94
|
}, Pe = async () => {
|
|
95
95
|
const l = A.value;
|
|
96
96
|
if (l) {
|
|
97
|
-
t.value.baseUrl = l.baseUrl, t.value.model = "", t.value.enableThinking = !1,
|
|
98
|
-
const e =
|
|
97
|
+
t.value.baseUrl = l.baseUrl, t.value.model = "", t.value.enableThinking = !1, b.value.clear(), f.value || (t.value.name = "");
|
|
98
|
+
const e = ee(t.value.provider);
|
|
99
99
|
e && !t.value.apiKey && (t.value.apiKey = e), await B();
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
c.value = null, h.value = null;
|
|
102
102
|
}, B = async () => {
|
|
103
103
|
if (!t.value.provider || !t.value.baseUrl) {
|
|
104
104
|
U.value = [], h.value = null;
|
|
@@ -115,14 +115,14 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
115
115
|
}
|
|
116
116
|
}, W = async () => {
|
|
117
117
|
if (!t.value.provider || !t.value.model) {
|
|
118
|
-
|
|
118
|
+
b.value.clear();
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
try {
|
|
122
122
|
const l = { ...t.value }, e = We(l.provider, l);
|
|
123
|
-
await e.initialize(),
|
|
123
|
+
await e.initialize(), b.value = new Set(e.capabilities), b.value.has("thinking") || (t.value.enableThinking = !1);
|
|
124
124
|
} catch (l) {
|
|
125
|
-
console.warn("Failed to detect model capabilities:", l),
|
|
125
|
+
console.warn("Failed to detect model capabilities:", l), b.value.clear();
|
|
126
126
|
}
|
|
127
127
|
}, we = () => `provider_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, Se = () => {
|
|
128
128
|
if (!t.value.provider) return "";
|
|
@@ -132,52 +132,52 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
132
132
|
if (!t.value.provider || !t.value.model) return "";
|
|
133
133
|
const l = V[t.value.provider], e = (l == null ? void 0 : l.name) || "Provider";
|
|
134
134
|
let i = t.value.model;
|
|
135
|
-
return i.includes("/") && (i = i.split("/").pop()), i = i.replace(/-(instruct|chat|base|completion)$/i, "").replace(/^(gpt-|claude-|llama-|gemini-)/i, "").replace(/-vision$/, "").replace(/-\d+b?$/i, ""), i = i.split("-").map((
|
|
135
|
+
return i.includes("/") && (i = i.split("/").pop()), i = i.replace(/-(instruct|chat|base|completion)$/i, "").replace(/^(gpt-|claude-|llama-|gemini-)/i, "").replace(/-vision$/, "").replace(/-\d+b?$/i, ""), i = i.split("-").map((m) => m.charAt(0).toUpperCase() + m.slice(1)).join(" ").substring(0, 20), `${e} ${i}`.trim();
|
|
136
136
|
}, Me = async () => {
|
|
137
|
-
if (
|
|
138
|
-
K.value = !0,
|
|
137
|
+
if (se.value) {
|
|
138
|
+
K.value = !0, c.value = null;
|
|
139
139
|
try {
|
|
140
|
-
await
|
|
141
|
-
const l = v.value &&
|
|
142
|
-
me(l, t.value) ? (
|
|
140
|
+
await Z(t.value);
|
|
141
|
+
const l = v.value && f.value ? f.value : we();
|
|
142
|
+
me(l, t.value) ? (Q() || (X(l), M.value = l), await $(), c.value = {
|
|
143
143
|
success: !0,
|
|
144
144
|
message: v.value ? "Provider updated!" : "Provider added!"
|
|
145
|
-
}, F(), w(), E(), setTimeout(() => j("close"), 1500)) :
|
|
145
|
+
}, F(), w(), E(), setTimeout(() => j("close"), 1500)) : c.value = { success: !1, message: "Failed to save configuration." };
|
|
146
146
|
} catch (l) {
|
|
147
|
-
console.error("LLM connection test failed:", l),
|
|
147
|
+
console.error("LLM connection test failed:", l), c.value = { success: !1, message: `Connection failed: ${l.message}` };
|
|
148
148
|
} finally {
|
|
149
149
|
K.value = !1;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}, Ke = (l) => {
|
|
153
|
-
|
|
153
|
+
X(l) && (M.value = l, $(), E());
|
|
154
154
|
}, Ue = async (l) => {
|
|
155
155
|
C.value.set(l.id, "testing");
|
|
156
156
|
try {
|
|
157
|
-
await
|
|
157
|
+
await Z(l), C.value.set(l.id, "success"), setTimeout(() => C.value.set(l.id, "default"), 3e3);
|
|
158
158
|
} catch (e) {
|
|
159
159
|
console.error("LLM connection test failed:", e), C.value.set(l.id, "failed"), setTimeout(() => C.value.set(l.id, "default"), 5e3);
|
|
160
160
|
}
|
|
161
|
-
},
|
|
161
|
+
}, ae = (l) => {
|
|
162
162
|
var e;
|
|
163
|
-
t.value = { ...l }, v.value = !0,
|
|
163
|
+
t.value = { ...l }, v.value = !0, f.value = l.id, c.value = null, B().then(() => {
|
|
164
164
|
t.value.model && W();
|
|
165
|
-
}), (e =
|
|
166
|
-
var i,
|
|
167
|
-
|
|
165
|
+
}), (e = g.editTarget) != null && e.focusField && qe(() => {
|
|
166
|
+
var i, m;
|
|
167
|
+
g.editTarget.focusField === "maxTokens" && (P != null && P.value) && (P.value.focus(), (m = (i = P.value).select) == null || m.call(i));
|
|
168
168
|
});
|
|
169
169
|
}, Ae = () => {
|
|
170
|
-
w(), v.value = !0,
|
|
170
|
+
w(), v.value = !0, f.value = null;
|
|
171
171
|
}, Ee = () => w(), Le = (l) => {
|
|
172
|
-
confirm("Are you sure you want to delete this provider?") && fe(l) && (F(), l ===
|
|
172
|
+
confirm("Are you sure you want to delete this provider?") && fe(l) && (F(), l === f.value && w(), $(), E());
|
|
173
173
|
}, Ie = (l) => {
|
|
174
174
|
(l.enabled !== !1 ? ge(l.id) : be(l.id)) && (F(), $(), E());
|
|
175
175
|
}, w = () => {
|
|
176
|
-
t.value = de(""), v.value = !1,
|
|
176
|
+
t.value = de(""), v.value = !1, f.value = null, c.value = null, U.value = [], h.value = null, b.value.clear();
|
|
177
177
|
}, N = () => {
|
|
178
178
|
w(), j("close");
|
|
179
|
-
},
|
|
180
|
-
|
|
179
|
+
}, oe = (l) => {
|
|
180
|
+
g.isVisible && l.key === "Escape" && (l.preventDefault(), N());
|
|
181
181
|
}, E = () => {
|
|
182
182
|
j("configChanged");
|
|
183
183
|
try {
|
|
@@ -185,48 +185,48 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
185
185
|
} catch {
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
|
-
G(() =>
|
|
188
|
+
G(() => g.isVisible, (l) => {
|
|
189
189
|
var e;
|
|
190
|
-
if (l && (F(), O(), w(), (e =
|
|
191
|
-
const i = T.value.find((
|
|
192
|
-
i &&
|
|
190
|
+
if (l && (F(), O(), w(), (e = g.editTarget) != null && e.name && T.value.length > 0)) {
|
|
191
|
+
const i = T.value.find((m) => m.name === g.editTarget.name);
|
|
192
|
+
i && ae(i);
|
|
193
193
|
}
|
|
194
194
|
}), G(() => t.value.model, (l) => {
|
|
195
195
|
if (l) {
|
|
196
|
-
if (W(), !
|
|
196
|
+
if (W(), !f.value) {
|
|
197
197
|
const e = Te();
|
|
198
198
|
e && (t.value.name = e);
|
|
199
199
|
}
|
|
200
200
|
D.value && (t.value.temperature = 1);
|
|
201
201
|
} else
|
|
202
|
-
|
|
202
|
+
b.value.clear(), t.value.enableThinking = !1;
|
|
203
203
|
}), G(() => t.value.temperature, (l) => {
|
|
204
204
|
D.value && l !== 1 && (t.value.temperature = 1);
|
|
205
205
|
});
|
|
206
206
|
const xe = () => {
|
|
207
207
|
q.value = !0;
|
|
208
|
-
},
|
|
208
|
+
}, ne = () => {
|
|
209
209
|
q.value = !1;
|
|
210
210
|
}, Ve = () => {
|
|
211
211
|
O();
|
|
212
|
-
}, $e = () => t.value.provider === "custom" ? "Enter your API key (optional)" :
|
|
213
|
-
const l =
|
|
212
|
+
}, $e = () => t.value.provider === "custom" ? "Enter your API key (optional)" : le(t.value.provider) ? "Using stored key (or enter new)" : "Enter your API key", De = () => {
|
|
213
|
+
const l = ee(t.value.provider);
|
|
214
214
|
l && (t.value.apiKey = l);
|
|
215
215
|
}, Fe = (l) => {
|
|
216
|
-
if (!
|
|
217
|
-
const e = l.id ===
|
|
216
|
+
if (!g.showJudge) return;
|
|
217
|
+
const e = l.id === k.value ? null : l.id;
|
|
218
218
|
try {
|
|
219
|
-
e ? localStorage.setItem("llm:" +
|
|
219
|
+
e ? localStorage.setItem("llm:" + H, e) : localStorage.removeItem("llm:" + H), k.value = e, E();
|
|
220
220
|
} catch {
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
return Ne(() => {
|
|
224
|
-
document.addEventListener("keydown",
|
|
224
|
+
document.addEventListener("keydown", oe), O();
|
|
225
225
|
}), Je(() => {
|
|
226
|
-
document.removeEventListener("keydown",
|
|
226
|
+
document.removeEventListener("keydown", oe);
|
|
227
227
|
}), (l, e) => {
|
|
228
|
-
var i,
|
|
229
|
-
return x.isVisible ? (
|
|
228
|
+
var i, m, ie;
|
|
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,25 +247,25 @@ 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", {
|
|
254
254
|
"onUpdate:modelValue": e[0] || (e[0] = (a) => t.value.provider = a),
|
|
255
255
|
onChange: Pe,
|
|
256
256
|
class: "llm-form-control"
|
|
257
257
|
}, [
|
|
258
258
|
e[13] || (e[13] = s("option", { value: "" }, "Select a provider...", -1)),
|
|
259
|
-
(
|
|
260
|
-
key:
|
|
261
|
-
value:
|
|
259
|
+
(o(!0), n(S, null, z(re(V), (a, p) => (o(), n("option", {
|
|
260
|
+
key: p,
|
|
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),
|
|
270
270
|
type: "text",
|
|
271
271
|
placeholder: Se(),
|
|
@@ -275,9 +275,9 @@ 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),
|
|
282
282
|
type: "url",
|
|
283
283
|
placeholder: (i = A.value) == null ? void 0 : i.baseUrl,
|
|
@@ -286,20 +286,20 @@ 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
|
-
(
|
|
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, [
|
|
293
|
-
|
|
293
|
+
y(s("input", {
|
|
294
294
|
"onUpdate:modelValue": e[3] || (e[3] = (a) => t.value.apiKey = a),
|
|
295
295
|
type: "password",
|
|
296
296
|
placeholder: $e(),
|
|
297
297
|
class: "llm-form-control",
|
|
298
|
-
required: (
|
|
298
|
+
required: (ie = A.value) == null ? void 0 : ie.requiresApiKey
|
|
299
299
|
}, null, 8, ol), [
|
|
300
300
|
[I, t.value.apiKey]
|
|
301
301
|
]),
|
|
302
|
-
|
|
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,24 +309,24 @@ 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),
|
|
316
316
|
e[19] || (e[19] = s("label", { class: "llm-field-label" }, "Model:", -1)),
|
|
317
317
|
s("div", rl, [
|
|
318
|
-
|
|
318
|
+
y(s("select", {
|
|
319
319
|
"onUpdate:modelValue": e[4] || (e[4] = (a) => t.value.model = a),
|
|
320
320
|
disabled: _.value,
|
|
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))
|
|
328
328
|
], 8, ul), [
|
|
329
|
-
[
|
|
329
|
+
[ue, t.value.model]
|
|
330
330
|
]),
|
|
331
331
|
s("button", {
|
|
332
332
|
class: "llm-btn llm-btn--ghost llm-btn--sm llm-refresh-btn",
|
|
@@ -334,10 +334,10 @@ 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",
|
|
342
342
|
"onUpdate:modelValue": e[5] || (e[5] = (a) => t.value.enableThinking = a),
|
|
343
343
|
class: "llm-checkbox"
|
|
@@ -350,7 +350,7 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
350
350
|
]),
|
|
351
351
|
e[20] || (e[20] = s("label", { class: "llm-field-label" }, "Temperature:", -1)),
|
|
352
352
|
s("div", gl, [
|
|
353
|
-
|
|
353
|
+
y(s("input", {
|
|
354
354
|
"onUpdate:modelValue": e[6] || (e[6] = (a) => t.value.temperature = a),
|
|
355
355
|
type: "number",
|
|
356
356
|
min: "0",
|
|
@@ -366,10 +366,10 @@ 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", {
|
|
373
373
|
"onUpdate:modelValue": e[7] || (e[7] = (a) => t.value.maxTokens = a),
|
|
374
374
|
type: "number",
|
|
375
375
|
min: "1",
|
|
@@ -386,31 +386,35 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
386
386
|
]
|
|
387
387
|
])
|
|
388
388
|
], 64)) : r("", !0)
|
|
389
|
-
])
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
]),
|
|
390
|
+
c.value ? (o(), n("div", {
|
|
391
|
+
key: 0,
|
|
392
|
+
class: Y(["llm-test-result", c.value.success ? "llm-test-result--success" : "llm-test-result--error"])
|
|
393
|
+
}, d(c.value.message), 3)) : r("", !0)
|
|
394
|
+
])) : (o(), n("div", hl, [
|
|
395
|
+
T.value.length > 0 ? (o(), n("div", Cl, [
|
|
392
396
|
e[23] || (e[23] = s("h3", null, "Configured Providers", -1)),
|
|
393
|
-
(
|
|
397
|
+
(o(!0), n(S, null, z(T.value, (a) => (o(), n("div", {
|
|
394
398
|
key: a.id,
|
|
395
|
-
class:
|
|
399
|
+
class: Y(["llm-provider-item", {
|
|
396
400
|
active: a.id === M.value,
|
|
397
401
|
disabled: a.enabled === !1
|
|
398
402
|
}]),
|
|
399
|
-
onClick: (
|
|
403
|
+
onClick: (p) => a.enabled !== !1 ? Ke(a.id) : null
|
|
400
404
|
}, [
|
|
401
405
|
s("div", Pl, [
|
|
402
406
|
s("div", wl, [
|
|
403
407
|
s("div", Sl, [
|
|
404
408
|
R(d(a.name) + " ", 1),
|
|
405
|
-
a.enabled === !1 ? (
|
|
409
|
+
a.enabled === !1 ? (o(), n("span", Tl, "Disabled")) : r("", !0)
|
|
406
410
|
]),
|
|
407
|
-
a.id === M.value ? (
|
|
408
|
-
x.showJudge && a.id ===
|
|
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)
|
|
409
413
|
]),
|
|
410
414
|
s("div", Ul, [
|
|
411
415
|
s("button", {
|
|
412
|
-
class:
|
|
413
|
-
onClick: J((
|
|
416
|
+
class: Y(["llm-test-status-btn", _e(a.id)]),
|
|
417
|
+
onClick: J((p) => Ue(a), ["stop"]),
|
|
414
418
|
disabled: K.value
|
|
415
419
|
}, d(Ce(a.id)), 11, Al),
|
|
416
420
|
s("div", El, d(a.provider) + " • " + d(a.baseUrl), 1)
|
|
@@ -421,37 +425,37 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
421
425
|
onClick: e[8] || (e[8] = J(() => {
|
|
422
426
|
}, ["stop"]))
|
|
423
427
|
}, [
|
|
424
|
-
x.showJudge && a.enabled !== !1 ? (
|
|
428
|
+
x.showJudge && a.enabled !== !1 ? (o(), n("button", {
|
|
425
429
|
key: 0,
|
|
426
430
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
427
|
-
onClick: (
|
|
428
|
-
title: a.id ===
|
|
429
|
-
}, d(a.id ===
|
|
431
|
+
onClick: (p) => Fe(a),
|
|
432
|
+
title: a.id === k.value ? "Unset as judge" : "Set as judge"
|
|
433
|
+
}, d(a.id === k.value ? "Unmark Judge" : "Mark Judge"), 9, Ll)) : r("", !0),
|
|
430
434
|
s("button", {
|
|
431
435
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
432
|
-
onClick: (
|
|
436
|
+
onClick: (p) => Ie(a),
|
|
433
437
|
title: a.enabled === !1 ? "Enable provider" : "Disable provider"
|
|
434
438
|
}, d(a.enabled === !1 ? "Enable" : "Disable"), 9, Il),
|
|
435
439
|
s("button", {
|
|
436
440
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
437
|
-
onClick: (
|
|
441
|
+
onClick: (p) => ae(a)
|
|
438
442
|
}, " Edit ", 8, xl),
|
|
439
443
|
s("button", {
|
|
440
444
|
class: "llm-btn llm-btn--sm llm-btn--danger",
|
|
441
|
-
onClick: (
|
|
445
|
+
onClick: (p) => Le(a.id)
|
|
442
446
|
}, " Delete ", 8, Vl)
|
|
443
447
|
])
|
|
444
448
|
], 10, _l))), 128))
|
|
445
|
-
])) : (
|
|
449
|
+
])) : (o(), n("div", $l, [...e[24] || (e[24] = [
|
|
446
450
|
s("p", null, "Connect your first AI provider to start chatting.", -1),
|
|
447
451
|
s("p", null, `Click "Add New Provider" below. You'll need a base URL and, for some providers, an API key.`, -1),
|
|
448
452
|
s("p", { class: "llm-security-note" }, "API keys are stored locally in your browser.", -1)
|
|
449
453
|
])]))
|
|
450
454
|
])),
|
|
451
|
-
q.value ? (
|
|
455
|
+
q.value ? (o(), n("div", {
|
|
452
456
|
key: 2,
|
|
453
457
|
class: "llm-keys-manager-overlay",
|
|
454
|
-
onClick:
|
|
458
|
+
onClick: ne
|
|
455
459
|
}, [
|
|
456
460
|
s("div", {
|
|
457
461
|
class: "llm-keys-manager-content",
|
|
@@ -459,19 +463,19 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
459
463
|
}, ["stop"]))
|
|
460
464
|
}, [
|
|
461
465
|
je(Ge, {
|
|
462
|
-
onClose:
|
|
466
|
+
onClose: ne,
|
|
463
467
|
onKeysUpdated: Ve
|
|
464
468
|
})
|
|
465
469
|
])
|
|
466
470
|
])) : r("", !0)
|
|
467
471
|
]),
|
|
468
472
|
s("div", Dl, [
|
|
469
|
-
v.value ? r("", !0) : (
|
|
473
|
+
v.value ? r("", !0) : (o(), n("button", {
|
|
470
474
|
key: 0,
|
|
471
475
|
class: "llm-btn llm-btn--secondary",
|
|
472
476
|
onClick: Ae
|
|
473
477
|
}, " Add New Provider ")),
|
|
474
|
-
!v.value && he.value ? (
|
|
478
|
+
!v.value && he.value ? (o(), n("button", {
|
|
475
479
|
key: 1,
|
|
476
480
|
class: "llm-btn llm-btn--ghost",
|
|
477
481
|
onClick: xe
|
|
@@ -481,18 +485,18 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
481
485
|
class: "llm-btn llm-btn--ghost",
|
|
482
486
|
onClick: e[10] || (e[10] = (a) => v.value ? Ee() : N())
|
|
483
487
|
}, " Close "),
|
|
484
|
-
v.value ? (
|
|
488
|
+
v.value ? (o(), n("button", {
|
|
485
489
|
key: 2,
|
|
486
490
|
class: "llm-btn llm-btn--primary",
|
|
487
491
|
onClick: Me,
|
|
488
|
-
disabled: !
|
|
492
|
+
disabled: !se.value || K.value
|
|
489
493
|
}, d(K.value ? "Testing..." : "Save"), 9, Fl)) : r("", !0)
|
|
490
494
|
])
|
|
491
495
|
])
|
|
492
496
|
])) : r("", !0);
|
|
493
497
|
};
|
|
494
498
|
}
|
|
495
|
-
}, Hl = /* @__PURE__ */ ze(Nl, [["__scopeId", "data-v-
|
|
499
|
+
}, Hl = /* @__PURE__ */ ze(Nl, [["__scopeId", "data-v-0835d20f"]]);
|
|
496
500
|
export {
|
|
497
501
|
Hl as default
|
|
498
502
|
};
|
|
@@ -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)
|