@anvaka/vue-llm 0.3.1 → 0.4.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/README.md +2 -1
- package/dist/pricing/rates.js +20 -3
- package/dist/providers/AnthropicProvider.js +17 -13
- package/dist/providers/BedrockMantleProvider.js +265 -0
- package/dist/providers/BedrockProvider.js +87 -59
- package/dist/providers/factory.js +84 -50
- package/dist/providers/index.js +12 -9
- package/dist/vue/components/LLMConfigModal.vue.js +357 -297
- package/dist/vue/useLLM.js +10 -8
- package/dist/vue-llm.css +1 -1
- package/package.json +1 -1
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useLLM as
|
|
3
|
-
import { DEFAULT_CONFIGS as
|
|
4
|
-
import
|
|
1
|
+
import { ref as d, computed as P, watch as Q, onMounted as ze, onUnmounted as Ye, openBlock as o, createElementBlock as n, createElementVNode as a, withModifiers as J, createTextVNode as O, toDisplayString as c, createCommentVNode as r, withDirectives as k, Fragment as f, renderList as $, unref as me, vModelSelect as X, vModelText as R, normalizeClass as q, vModelCheckbox as He, createVNode as Qe, nextTick as Xe } from "vue";
|
|
2
|
+
import { useLLM as Ze, createDefaultConfig as be } from "../useLLM.js";
|
|
3
|
+
import { DEFAULT_CONFIGS as el, createProvider as ll } from "../../providers/factory.js";
|
|
4
|
+
import tl from "./StoredKeysManager.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import sl from "../../_virtual/_plugin-vue_export-helper.js";
|
|
7
|
+
const al = { class: "llm-modal-header" }, ol = { key: 0 }, nl = { class: "llm-modal-body" }, il = { key: 0 }, rl = { class: "llm-form-grid" }, ul = ["value"], dl = ["placeholder"], cl = { class: "llm-region-row" }, vl = ["value"], ml = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "llm-backend-toggle"
|
|
10
|
+
}, bl = ["onClick"], fl = ["placeholder"], gl = { class: "llm-api-key-field" }, pl = { class: "llm-api-key-input-row" }, yl = ["placeholder", "required"], kl = { class: "llm-security-note" }, hl = { key: 0 }, Cl = { class: "llm-model-selector" }, _l = ["disabled"], wl = { value: "" }, Ul = ["value"], Pl = ["disabled"], Tl = {
|
|
8
11
|
key: 0,
|
|
9
12
|
class: "llm-model-error"
|
|
10
|
-
},
|
|
13
|
+
}, Sl = {
|
|
11
14
|
key: 1,
|
|
12
15
|
class: "llm-thinking-toggle"
|
|
13
|
-
},
|
|
16
|
+
}, Ml = { class: "llm-checkbox-label" }, Kl = { class: "llm-temperature-field" }, Al = ["disabled"], El = {
|
|
14
17
|
key: 0,
|
|
15
18
|
class: "llm-field-note"
|
|
16
|
-
},
|
|
19
|
+
}, Ll = {
|
|
17
20
|
key: 1,
|
|
18
21
|
class: "llm-field-note"
|
|
19
|
-
},
|
|
22
|
+
}, xl = { key: 1 }, Il = {
|
|
20
23
|
key: 0,
|
|
21
24
|
class: "llm-provider-list"
|
|
22
|
-
},
|
|
25
|
+
}, Vl = ["onClick"], $l = { class: "llm-provider-info" }, Rl = { class: "llm-provider-name-row" }, Bl = { class: "llm-provider-name" }, Dl = {
|
|
23
26
|
key: 0,
|
|
24
27
|
class: "llm-disabled-badge"
|
|
25
|
-
},
|
|
28
|
+
}, Fl = {
|
|
26
29
|
key: 0,
|
|
27
30
|
class: "llm-active-badge"
|
|
28
|
-
},
|
|
31
|
+
}, Nl = {
|
|
29
32
|
key: 1,
|
|
30
33
|
class: "llm-judge-badge"
|
|
31
|
-
},
|
|
34
|
+
}, jl = { class: "llm-provider-details-row" }, Jl = ["onClick", "disabled"], Ol = { class: "llm-provider-details" }, ql = ["onClick", "title"], Wl = ["onClick", "title"], Gl = ["onClick"], zl = ["onClick"], Yl = {
|
|
32
35
|
key: 1,
|
|
33
36
|
class: "llm-empty-state"
|
|
34
|
-
},
|
|
37
|
+
}, Hl = { class: "llm-modal-footer" }, Ql = ["disabled"], Z = "judge-provider", Xl = {
|
|
35
38
|
__name: "LLMConfigModal",
|
|
36
39
|
props: {
|
|
37
40
|
isVisible: Boolean,
|
|
@@ -41,345 +44,402 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
41
44
|
showAllMode: { type: Boolean, default: !1 }
|
|
42
45
|
},
|
|
43
46
|
emits: ["close", "configChanged"],
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
46
|
-
client:
|
|
47
|
-
configStore:
|
|
48
|
-
getEnabledConfigs:
|
|
49
|
-
getAllConfigs:
|
|
50
|
-
getActiveProviderId:
|
|
51
|
-
setActiveProviderId:
|
|
52
|
-
saveConfig:
|
|
53
|
-
deleteConfig:
|
|
54
|
-
enableProvider:
|
|
55
|
-
disableProvider:
|
|
56
|
-
getAvailableModels:
|
|
57
|
-
testConnection:
|
|
58
|
-
refresh:
|
|
59
|
-
getStoredKey:
|
|
60
|
-
hasStoredKey:
|
|
61
|
-
getAllStoredKeys:
|
|
62
|
-
storeKey:
|
|
63
|
-
} =
|
|
64
|
-
() => t.value.provider ?
|
|
65
|
-
),
|
|
47
|
+
setup(B, { emit: fe }) {
|
|
48
|
+
const h = B, ee = fe, K = el, {
|
|
49
|
+
client: Zl,
|
|
50
|
+
configStore: et,
|
|
51
|
+
getEnabledConfigs: lt,
|
|
52
|
+
getAllConfigs: ge,
|
|
53
|
+
getActiveProviderId: le,
|
|
54
|
+
setActiveProviderId: te,
|
|
55
|
+
saveConfig: pe,
|
|
56
|
+
deleteConfig: ye,
|
|
57
|
+
enableProvider: ke,
|
|
58
|
+
disableProvider: he,
|
|
59
|
+
getAvailableModels: Ce,
|
|
60
|
+
testConnection: se,
|
|
61
|
+
refresh: D,
|
|
62
|
+
getStoredKey: ae,
|
|
63
|
+
hasStoredKey: oe,
|
|
64
|
+
getAllStoredKeys: _e,
|
|
65
|
+
storeKey: tt
|
|
66
|
+
} = Ze(), t = d(be("")), A = d([]), E = d(null), _ = d(null), v = d(!1), g = d(null), L = d(!1), m = d(null), x = d([]), T = d(!1), w = d(null), U = d(/* @__PURE__ */ new Map()), W = d(!1), ne = d(0), S = d(null), C = P(
|
|
67
|
+
() => t.value.provider ? K[t.value.provider] : null
|
|
68
|
+
), ie = P(() => {
|
|
69
|
+
var l;
|
|
70
|
+
return ((l = C.value) == null ? void 0 : l.regions) || [];
|
|
71
|
+
}), re = P(() => {
|
|
72
|
+
var e;
|
|
73
|
+
const l = (e = C.value) == null ? void 0 : e.backends;
|
|
74
|
+
return l ? Object.entries(l).map(([i, u]) => ({ key: i, label: u.label || i, baseUrlTemplate: u.baseUrlTemplate })) : [];
|
|
75
|
+
}), we = () => {
|
|
76
|
+
var e;
|
|
77
|
+
const l = C.value;
|
|
78
|
+
return l != null && l.backends && t.value.backend ? (e = l.backends[t.value.backend]) == null ? void 0 : e.baseUrlTemplate : l == null ? void 0 : l.baseUrlTemplate;
|
|
79
|
+
}, G = () => {
|
|
80
|
+
const l = we();
|
|
81
|
+
l && t.value.region && (t.value.baseUrl = l.replace("{region}", t.value.region));
|
|
82
|
+
}, Ue = () => {
|
|
83
|
+
G(), t.value.model = "", I();
|
|
84
|
+
}, Pe = (l) => {
|
|
85
|
+
t.value.backend !== l && (t.value.backend = l, G(), t.value.model = "", I());
|
|
86
|
+
}, z = (l, e) => {
|
|
87
|
+
if (!l || !e) return null;
|
|
88
|
+
const i = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), u = new RegExp("^" + i.replace("\\{region\\}", "([^.]+)") + "$"), b = e.match(u);
|
|
89
|
+
return b ? b[1] : null;
|
|
90
|
+
}, Te = (l, e) => {
|
|
91
|
+
const i = l == null ? void 0 : l.backends;
|
|
92
|
+
if (!i) return "";
|
|
93
|
+
for (const [u, b] of Object.entries(i))
|
|
94
|
+
if (z(b.baseUrlTemplate, e) != null) return u;
|
|
95
|
+
return l.defaultBackend || Object.keys(i)[0];
|
|
96
|
+
}, p = d(/* @__PURE__ */ new Set()), Se = P(() => t.value.model && p.value.has("thinking")), F = P(() => {
|
|
66
97
|
var e, i;
|
|
67
98
|
if (!((e = t.value) != null && e.provider) || !((i = t.value) != null && i.model) || t.value.provider !== "openai") return !1;
|
|
68
99
|
const l = String(t.value.model).toLowerCase();
|
|
69
|
-
return
|
|
70
|
-
}),
|
|
100
|
+
return p.value.has("thinking") || l.startsWith("o1") || l.startsWith("o2") || l.startsWith("o3") || l.startsWith("o-") || l.includes("gpt-5") || l === "gpt5" || l.includes("reasoning");
|
|
101
|
+
}), Me = P(() => ne.value > 0), ue = P(() => {
|
|
71
102
|
var l;
|
|
72
|
-
return !(!t.value.name || !t.value.provider || !t.value.baseUrl || (l =
|
|
73
|
-
}),
|
|
74
|
-
const e =
|
|
103
|
+
return !(!t.value.name || !t.value.provider || !t.value.baseUrl || (l = C.value) != null && l.requiresApiKey && !t.value.apiKey);
|
|
104
|
+
}), Ke = (l) => {
|
|
105
|
+
const e = U.value.get(l);
|
|
75
106
|
return e === "testing" ? "Testing..." : e === "success" ? "Ok" : e === "failed" ? "Failed" : "Test";
|
|
76
|
-
},
|
|
77
|
-
const e =
|
|
107
|
+
}, Ae = (l) => {
|
|
108
|
+
const e = U.value.get(l);
|
|
78
109
|
return {
|
|
79
110
|
"llm-test-testing": e === "testing",
|
|
80
111
|
"llm-test-success": e === "success",
|
|
81
112
|
"llm-test-failed": e === "failed",
|
|
82
113
|
"llm-test-default": !e || e === "default"
|
|
83
114
|
};
|
|
84
|
-
},
|
|
85
|
-
if (
|
|
115
|
+
}, N = () => {
|
|
116
|
+
if (A.value = ge(), E.value = le() || "", h.showJudge)
|
|
86
117
|
try {
|
|
87
|
-
|
|
118
|
+
_.value = localStorage.getItem("llm:" + Z) || null;
|
|
88
119
|
} catch {
|
|
89
|
-
|
|
120
|
+
_.value = null;
|
|
90
121
|
}
|
|
91
|
-
},
|
|
92
|
-
const l =
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
122
|
+
}, Y = () => {
|
|
123
|
+
const l = _e();
|
|
124
|
+
ne.value = Object.keys(l).length;
|
|
125
|
+
}, Ee = async () => {
|
|
126
|
+
var e;
|
|
127
|
+
const l = C.value;
|
|
96
128
|
if (l) {
|
|
97
|
-
t.value.baseUrl = l.baseUrl, t.value.model = "", t.value.enableThinking = !1,
|
|
98
|
-
const
|
|
99
|
-
|
|
129
|
+
(e = l.regions) != null && e.length ? (t.value.region = l.defaultRegion, t.value.backend = l.defaultBackend || "", G()) : (t.value.region = "", t.value.backend = "", t.value.baseUrl = l.baseUrl), t.value.model = "", t.value.enableThinking = !1, p.value.clear(), g.value || (t.value.name = "");
|
|
130
|
+
const i = ae(t.value.provider);
|
|
131
|
+
i && !t.value.apiKey && (t.value.apiKey = i), await I();
|
|
100
132
|
}
|
|
101
|
-
|
|
102
|
-
},
|
|
133
|
+
m.value = null, w.value = null;
|
|
134
|
+
}, Le = () => I({ force: !0 }), I = async (l = {}) => {
|
|
103
135
|
if (!t.value.provider || !t.value.baseUrl) {
|
|
104
|
-
|
|
136
|
+
x.value = [], w.value = null;
|
|
105
137
|
return;
|
|
106
138
|
}
|
|
107
|
-
|
|
139
|
+
T.value = !0, w.value = null;
|
|
108
140
|
try {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
} catch (
|
|
112
|
-
console.warn("Failed to load models:",
|
|
141
|
+
const e = await Ce(t.value.provider, t.value, l);
|
|
142
|
+
x.value = e, e.length > 0 && !t.value.model && (t.value.model = e[0], await H());
|
|
143
|
+
} catch (e) {
|
|
144
|
+
console.warn("Failed to load models:", e), x.value = [], w.value = e.message || "Failed to load models";
|
|
113
145
|
} finally {
|
|
114
|
-
|
|
146
|
+
T.value = !1;
|
|
115
147
|
}
|
|
116
|
-
},
|
|
148
|
+
}, H = async () => {
|
|
117
149
|
if (!t.value.provider || !t.value.model) {
|
|
118
|
-
|
|
150
|
+
p.value.clear();
|
|
119
151
|
return;
|
|
120
152
|
}
|
|
121
153
|
try {
|
|
122
|
-
const l = { ...t.value }, e =
|
|
123
|
-
await e.initialize(),
|
|
154
|
+
const l = { ...t.value }, e = ll(l.provider, l);
|
|
155
|
+
await e.initialize(), p.value = new Set(e.capabilities), p.value.has("thinking") || (t.value.enableThinking = !1);
|
|
124
156
|
} catch (l) {
|
|
125
|
-
console.warn("Failed to detect model capabilities:", l),
|
|
157
|
+
console.warn("Failed to detect model capabilities:", l), p.value.clear();
|
|
126
158
|
}
|
|
127
|
-
},
|
|
159
|
+
}, xe = () => `provider_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, Ie = () => {
|
|
128
160
|
if (!t.value.provider) return "";
|
|
129
|
-
const l =
|
|
161
|
+
const l = K[t.value.provider];
|
|
130
162
|
return `e.g., My ${(l == null ? void 0 : l.name) || "Provider"}`;
|
|
131
|
-
},
|
|
163
|
+
}, Ve = () => {
|
|
132
164
|
if (!t.value.provider || !t.value.model) return "";
|
|
133
|
-
const l =
|
|
165
|
+
const l = K[t.value.provider], e = (l == null ? void 0 : l.name) || "Provider";
|
|
134
166
|
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((
|
|
136
|
-
},
|
|
137
|
-
if (
|
|
138
|
-
|
|
167
|
+
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((u) => u.charAt(0).toUpperCase() + u.slice(1)).join(" ").substring(0, 20), `${e} ${i}`.trim();
|
|
168
|
+
}, $e = async () => {
|
|
169
|
+
if (ue.value) {
|
|
170
|
+
L.value = !0, m.value = null;
|
|
139
171
|
try {
|
|
140
|
-
await
|
|
141
|
-
const l = v.value &&
|
|
142
|
-
|
|
172
|
+
await se(t.value);
|
|
173
|
+
const l = v.value && g.value ? g.value : xe();
|
|
174
|
+
pe(l, t.value) ? (le() || (te(l), E.value = l), await D(), m.value = {
|
|
143
175
|
success: !0,
|
|
144
176
|
message: v.value ? "Provider updated!" : "Provider added!"
|
|
145
|
-
},
|
|
177
|
+
}, N(), M(), V()) : m.value = { success: !1, message: "Failed to save configuration." };
|
|
146
178
|
} catch (l) {
|
|
147
|
-
console.error("LLM connection test failed:", l),
|
|
179
|
+
console.error("LLM connection test failed:", l), m.value = { success: !1, message: `Connection failed: ${l.message}` };
|
|
148
180
|
} finally {
|
|
149
|
-
|
|
181
|
+
L.value = !1;
|
|
150
182
|
}
|
|
151
183
|
}
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
184
|
+
}, Re = (l) => {
|
|
185
|
+
te(l) && (E.value = l, D(), V());
|
|
186
|
+
}, Be = async (l) => {
|
|
187
|
+
U.value.set(l.id, "testing");
|
|
156
188
|
try {
|
|
157
|
-
await
|
|
189
|
+
await se(l), U.value.set(l.id, "success"), setTimeout(() => U.value.set(l.id, "default"), 3e3);
|
|
158
190
|
} catch (e) {
|
|
159
|
-
console.error("LLM connection test failed:", e),
|
|
191
|
+
console.error("LLM connection test failed:", e), U.value.set(l.id, "failed"), setTimeout(() => U.value.set(l.id, "default"), 5e3);
|
|
160
192
|
}
|
|
161
|
-
},
|
|
162
|
-
var
|
|
163
|
-
t.value = { ...l }
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
193
|
+
}, de = (l) => {
|
|
194
|
+
var i, u;
|
|
195
|
+
t.value = { ...l };
|
|
196
|
+
const e = K[l.provider];
|
|
197
|
+
e != null && e.backends ? (t.value.backend || (t.value.backend = Te(e, l.baseUrl)), t.value.region || (t.value.region = z((i = e.backends[t.value.backend]) == null ? void 0 : i.baseUrlTemplate, l.baseUrl) || e.defaultRegion)) : e != null && e.baseUrlTemplate && !t.value.region && (t.value.region = z(e.baseUrlTemplate, l.baseUrl) || e.defaultRegion), v.value = !0, g.value = l.id, m.value = null, I().then(() => {
|
|
198
|
+
t.value.model && H();
|
|
199
|
+
}), (u = h.editTarget) != null && u.focusField && Xe(() => {
|
|
200
|
+
var b, s;
|
|
201
|
+
h.editTarget.focusField === "maxTokens" && (S != null && S.value) && (S.value.focus(), (s = (b = S.value).select) == null || s.call(b));
|
|
168
202
|
});
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
confirm("Are you sure you want to delete this provider?") &&
|
|
173
|
-
},
|
|
174
|
-
(l.enabled !== !1 ?
|
|
175
|
-
},
|
|
176
|
-
t.value =
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
|
|
203
|
+
}, De = () => {
|
|
204
|
+
M(), v.value = !0, g.value = null;
|
|
205
|
+
}, Fe = () => M(), Ne = (l) => {
|
|
206
|
+
confirm("Are you sure you want to delete this provider?") && ye(l) && (N(), l === g.value && M(), D(), V());
|
|
207
|
+
}, je = (l) => {
|
|
208
|
+
(l.enabled !== !1 ? he(l.id) : ke(l.id)) && (N(), D(), V());
|
|
209
|
+
}, M = () => {
|
|
210
|
+
t.value = be(""), v.value = !1, g.value = null, m.value = null, x.value = [], w.value = null, p.value.clear();
|
|
211
|
+
}, j = () => {
|
|
212
|
+
M(), ee("close");
|
|
213
|
+
}, ce = (l) => {
|
|
214
|
+
h.isVisible && l.key === "Escape" && (l.preventDefault(), j());
|
|
215
|
+
}, V = () => {
|
|
216
|
+
ee("configChanged");
|
|
183
217
|
try {
|
|
184
218
|
window.dispatchEvent(new CustomEvent("llm-config-changed"));
|
|
185
219
|
} catch {
|
|
186
220
|
}
|
|
187
221
|
};
|
|
188
|
-
|
|
222
|
+
Q(() => h.isVisible, (l) => {
|
|
189
223
|
var e;
|
|
190
|
-
if (l && (
|
|
191
|
-
const i =
|
|
192
|
-
i &&
|
|
224
|
+
if (l && (N(), Y(), M(), (e = h.editTarget) != null && e.name && A.value.length > 0)) {
|
|
225
|
+
const i = A.value.find((u) => u.name === h.editTarget.name);
|
|
226
|
+
i && de(i);
|
|
193
227
|
}
|
|
194
|
-
}),
|
|
228
|
+
}), Q(() => t.value.model, (l) => {
|
|
195
229
|
if (l) {
|
|
196
|
-
if (
|
|
197
|
-
const e =
|
|
230
|
+
if (H(), !g.value) {
|
|
231
|
+
const e = Ve();
|
|
198
232
|
e && (t.value.name = e);
|
|
199
233
|
}
|
|
200
|
-
|
|
234
|
+
F.value && (t.value.temperature = 1);
|
|
201
235
|
} else
|
|
202
|
-
|
|
203
|
-
}),
|
|
204
|
-
|
|
236
|
+
p.value.clear(), t.value.enableThinking = !1;
|
|
237
|
+
}), Q(() => t.value.temperature, (l) => {
|
|
238
|
+
F.value && l !== 1 && (t.value.temperature = 1);
|
|
205
239
|
});
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
},
|
|
213
|
-
const l =
|
|
240
|
+
const Je = () => {
|
|
241
|
+
W.value = !0;
|
|
242
|
+
}, ve = () => {
|
|
243
|
+
W.value = !1;
|
|
244
|
+
}, Oe = () => {
|
|
245
|
+
Y();
|
|
246
|
+
}, qe = () => t.value.provider === "custom" ? "Enter your API key (optional)" : oe(t.value.provider) ? "Using stored key (or enter new)" : "Enter your API key", We = () => {
|
|
247
|
+
const l = ae(t.value.provider);
|
|
214
248
|
l && (t.value.apiKey = l);
|
|
215
|
-
},
|
|
216
|
-
if (!
|
|
217
|
-
const e = l.id ===
|
|
249
|
+
}, Ge = (l) => {
|
|
250
|
+
if (!h.showJudge) return;
|
|
251
|
+
const e = l.id === _.value ? null : l.id;
|
|
218
252
|
try {
|
|
219
|
-
e ? localStorage.setItem("llm:" +
|
|
253
|
+
e ? localStorage.setItem("llm:" + Z, e) : localStorage.removeItem("llm:" + Z), _.value = e, V();
|
|
220
254
|
} catch {
|
|
221
255
|
}
|
|
222
256
|
};
|
|
223
|
-
return
|
|
224
|
-
document.addEventListener("keydown",
|
|
225
|
-
}),
|
|
226
|
-
document.removeEventListener("keydown",
|
|
257
|
+
return ze(() => {
|
|
258
|
+
document.addEventListener("keydown", ce), Y();
|
|
259
|
+
}), Ye(() => {
|
|
260
|
+
document.removeEventListener("keydown", ce);
|
|
227
261
|
}), (l, e) => {
|
|
228
|
-
var i,
|
|
229
|
-
return
|
|
262
|
+
var i, u, b;
|
|
263
|
+
return B.isVisible ? (o(), n("div", {
|
|
230
264
|
key: 0,
|
|
231
265
|
class: "llm-modal-overlay",
|
|
232
|
-
onClick:
|
|
266
|
+
onClick: j
|
|
233
267
|
}, [
|
|
234
|
-
|
|
268
|
+
a("div", {
|
|
235
269
|
class: "llm-modal",
|
|
236
|
-
onClick: e[
|
|
270
|
+
onClick: e[12] || (e[12] = J(() => {
|
|
237
271
|
}, ["stop"]))
|
|
238
272
|
}, [
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
e[
|
|
242
|
-
v.value ? (o(), n("span",
|
|
273
|
+
a("div", al, [
|
|
274
|
+
a("h2", null, [
|
|
275
|
+
e[13] || (e[13] = O(" Manage LLM Providers ", -1)),
|
|
276
|
+
v.value ? (o(), n("span", ol, c(g.value ? " - Edit" : " - Add"), 1)) : r("", !0)
|
|
243
277
|
]),
|
|
244
|
-
|
|
278
|
+
a("button", {
|
|
245
279
|
class: "llm-btn llm-btn--ghost llm-btn--sm llm-close-btn",
|
|
246
|
-
onClick:
|
|
280
|
+
onClick: j
|
|
247
281
|
}, "×")
|
|
248
282
|
]),
|
|
249
|
-
|
|
250
|
-
v.value ? (o(), n("div",
|
|
251
|
-
|
|
252
|
-
e[
|
|
253
|
-
|
|
254
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
255
|
-
onChange:
|
|
283
|
+
a("div", nl, [
|
|
284
|
+
v.value ? (o(), n("div", il, [
|
|
285
|
+
a("div", rl, [
|
|
286
|
+
e[24] || (e[24] = a("label", { class: "llm-field-label" }, "Provider Type:", -1)),
|
|
287
|
+
k(a("select", {
|
|
288
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => t.value.provider = s),
|
|
289
|
+
onChange: Ee,
|
|
256
290
|
class: "llm-form-control"
|
|
257
291
|
}, [
|
|
258
|
-
e[
|
|
259
|
-
(o(!0), n(
|
|
260
|
-
key:
|
|
261
|
-
value:
|
|
262
|
-
},
|
|
292
|
+
e[14] || (e[14] = a("option", { value: "" }, "Select a provider...", -1)),
|
|
293
|
+
(o(!0), n(f, null, $(me(K), (s, y) => (o(), n("option", {
|
|
294
|
+
key: y,
|
|
295
|
+
value: y
|
|
296
|
+
}, c(s.name), 9, ul))), 128))
|
|
263
297
|
], 544), [
|
|
264
|
-
[
|
|
298
|
+
[X, t.value.provider]
|
|
265
299
|
]),
|
|
266
|
-
t.value.provider ? (o(), n(
|
|
267
|
-
e[
|
|
268
|
-
|
|
269
|
-
"onUpdate:modelValue": e[1] || (e[1] = (
|
|
300
|
+
t.value.provider ? (o(), n(f, { key: 0 }, [
|
|
301
|
+
e[15] || (e[15] = a("label", { class: "llm-field-label" }, "Provider Name:", -1)),
|
|
302
|
+
k(a("input", {
|
|
303
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => t.value.name = s),
|
|
270
304
|
type: "text",
|
|
271
|
-
placeholder:
|
|
305
|
+
placeholder: Ie(),
|
|
272
306
|
class: "llm-form-control",
|
|
273
307
|
required: ""
|
|
274
|
-
}, null, 8,
|
|
275
|
-
[
|
|
308
|
+
}, null, 8, dl), [
|
|
309
|
+
[R, t.value.name]
|
|
276
310
|
])
|
|
277
311
|
], 64)) : r("", !0),
|
|
278
|
-
t.value.provider ? (o(), n(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
312
|
+
t.value.provider ? (o(), n(f, { key: 1 }, [
|
|
313
|
+
ie.value.length ? (o(), n(f, { key: 0 }, [
|
|
314
|
+
e[16] || (e[16] = a("label", { class: "llm-field-label" }, "Region:", -1)),
|
|
315
|
+
a("div", cl, [
|
|
316
|
+
k(a("select", {
|
|
317
|
+
"onUpdate:modelValue": e[2] || (e[2] = (s) => t.value.region = s),
|
|
318
|
+
onChange: Ue,
|
|
319
|
+
class: "llm-form-control"
|
|
320
|
+
}, [
|
|
321
|
+
(o(!0), n(f, null, $(ie.value, (s) => (o(), n("option", {
|
|
322
|
+
key: s,
|
|
323
|
+
value: s
|
|
324
|
+
}, c(s), 9, vl))), 128))
|
|
325
|
+
], 544), [
|
|
326
|
+
[X, t.value.region]
|
|
327
|
+
]),
|
|
328
|
+
re.value.length > 1 ? (o(), n("div", ml, [
|
|
329
|
+
(o(!0), n(f, null, $(re.value, (s) => (o(), n("button", {
|
|
330
|
+
key: s.key,
|
|
331
|
+
type: "button",
|
|
332
|
+
class: q(["llm-backend-btn", { active: t.value.backend === s.key }]),
|
|
333
|
+
onClick: (y) => Pe(s.key)
|
|
334
|
+
}, c(s.label), 11, bl))), 128))
|
|
335
|
+
])) : r("", !0)
|
|
336
|
+
])
|
|
337
|
+
], 64)) : (o(), n(f, { key: 1 }, [
|
|
338
|
+
e[17] || (e[17] = a("label", { class: "llm-field-label" }, "Base URL:", -1)),
|
|
339
|
+
k(a("input", {
|
|
340
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => t.value.baseUrl = s),
|
|
341
|
+
type: "url",
|
|
342
|
+
placeholder: (i = C.value) == null ? void 0 : i.baseUrl,
|
|
343
|
+
class: "llm-form-control",
|
|
344
|
+
required: ""
|
|
345
|
+
}, null, 8, fl), [
|
|
346
|
+
[R, t.value.baseUrl]
|
|
347
|
+
])
|
|
348
|
+
], 64)),
|
|
349
|
+
(u = C.value) != null && u.requiresApiKey || t.value.provider === "custom" ? (o(), n(f, { key: 2 }, [
|
|
350
|
+
e[19] || (e[19] = a("label", { class: "llm-field-label" }, "API Key:", -1)),
|
|
351
|
+
a("div", gl, [
|
|
352
|
+
a("div", pl, [
|
|
353
|
+
k(a("input", {
|
|
354
|
+
"onUpdate:modelValue": e[4] || (e[4] = (s) => t.value.apiKey = s),
|
|
295
355
|
type: "password",
|
|
296
|
-
placeholder:
|
|
356
|
+
placeholder: qe(),
|
|
297
357
|
class: "llm-form-control",
|
|
298
|
-
required: (
|
|
299
|
-
}, null, 8,
|
|
300
|
-
[
|
|
358
|
+
required: (b = C.value) == null ? void 0 : b.requiresApiKey
|
|
359
|
+
}, null, 8, yl), [
|
|
360
|
+
[R, t.value.apiKey]
|
|
301
361
|
]),
|
|
302
|
-
|
|
362
|
+
me(oe)(t.value.provider) ? (o(), n("button", {
|
|
303
363
|
key: 0,
|
|
304
364
|
type: "button",
|
|
305
365
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
306
|
-
onClick:
|
|
366
|
+
onClick: We,
|
|
307
367
|
title: "Use stored key"
|
|
308
368
|
}, " Use Stored ")) : r("", !0)
|
|
309
369
|
]),
|
|
310
|
-
|
|
311
|
-
e[
|
|
312
|
-
t.value.provider === "custom" ? (o(), n("span",
|
|
370
|
+
a("small", kl, [
|
|
371
|
+
e[18] || (e[18] = O(" ⚠️ API key is stored locally in your browser ", -1)),
|
|
372
|
+
t.value.provider === "custom" ? (o(), n("span", hl, " (optional for custom providers)")) : r("", !0)
|
|
313
373
|
])
|
|
314
374
|
])
|
|
315
375
|
], 64)) : r("", !0),
|
|
316
|
-
e[
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
"onUpdate:modelValue": e[
|
|
320
|
-
disabled:
|
|
376
|
+
e[21] || (e[21] = a("label", { class: "llm-field-label" }, "Model:", -1)),
|
|
377
|
+
a("div", Cl, [
|
|
378
|
+
k(a("select", {
|
|
379
|
+
"onUpdate:modelValue": e[5] || (e[5] = (s) => t.value.model = s),
|
|
380
|
+
disabled: T.value,
|
|
321
381
|
class: "llm-form-control"
|
|
322
382
|
}, [
|
|
323
|
-
|
|
324
|
-
(o(!0), n(
|
|
325
|
-
key:
|
|
326
|
-
value:
|
|
327
|
-
},
|
|
328
|
-
], 8,
|
|
329
|
-
[
|
|
383
|
+
a("option", wl, c(T.value ? "Loading models..." : "Select a model..."), 1),
|
|
384
|
+
(o(!0), n(f, null, $(x.value, (s) => (o(), n("option", {
|
|
385
|
+
key: s,
|
|
386
|
+
value: s
|
|
387
|
+
}, c(s), 9, Ul))), 128))
|
|
388
|
+
], 8, _l), [
|
|
389
|
+
[X, t.value.model]
|
|
330
390
|
]),
|
|
331
|
-
|
|
391
|
+
a("button", {
|
|
332
392
|
class: "llm-btn llm-btn--ghost llm-btn--sm llm-refresh-btn",
|
|
333
|
-
onClick:
|
|
334
|
-
disabled: !t.value.baseUrl ||
|
|
393
|
+
onClick: Le,
|
|
394
|
+
disabled: !t.value.baseUrl || T.value,
|
|
335
395
|
title: "Refresh models list"
|
|
336
|
-
},
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
396
|
+
}, c(T.value ? "Loading..." : "Refresh"), 9, Pl),
|
|
397
|
+
w.value ? (o(), n("div", Tl, c(w.value), 1)) : r("", !0),
|
|
398
|
+
Se.value ? (o(), n("div", Sl, [
|
|
399
|
+
a("label", Ml, [
|
|
400
|
+
k(a("input", {
|
|
341
401
|
type: "checkbox",
|
|
342
|
-
"onUpdate:modelValue": e[
|
|
402
|
+
"onUpdate:modelValue": e[6] || (e[6] = (s) => t.value.enableThinking = s),
|
|
343
403
|
class: "llm-checkbox"
|
|
344
404
|
}, null, 512), [
|
|
345
|
-
[
|
|
405
|
+
[He, t.value.enableThinking]
|
|
346
406
|
]),
|
|
347
|
-
e[
|
|
407
|
+
e[20] || (e[20] = O(" Enable Thinking: Show model's reasoning process ", -1))
|
|
348
408
|
])
|
|
349
409
|
])) : r("", !0)
|
|
350
410
|
]),
|
|
351
|
-
e[
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
"onUpdate:modelValue": e[
|
|
411
|
+
e[22] || (e[22] = a("label", { class: "llm-field-label" }, "Temperature:", -1)),
|
|
412
|
+
a("div", Kl, [
|
|
413
|
+
k(a("input", {
|
|
414
|
+
"onUpdate:modelValue": e[7] || (e[7] = (s) => t.value.temperature = s),
|
|
355
415
|
type: "number",
|
|
356
416
|
min: "0",
|
|
357
417
|
max: "2",
|
|
358
418
|
step: "0.1",
|
|
359
419
|
class: "llm-form-control",
|
|
360
|
-
disabled:
|
|
361
|
-
}, null, 8,
|
|
420
|
+
disabled: F.value
|
|
421
|
+
}, null, 8, Al), [
|
|
362
422
|
[
|
|
363
|
-
|
|
423
|
+
R,
|
|
364
424
|
t.value.temperature,
|
|
365
425
|
void 0,
|
|
366
426
|
{ number: !0 }
|
|
367
427
|
]
|
|
368
428
|
]),
|
|
369
|
-
|
|
429
|
+
F.value ? (o(), n("small", Ll, " This model uses a fixed temperature of 1. ")) : (o(), n("small", El, " Controls randomness: 0 = deterministic, 2 = very creative "))
|
|
370
430
|
]),
|
|
371
|
-
e[
|
|
372
|
-
|
|
373
|
-
"onUpdate:modelValue": e[
|
|
431
|
+
e[23] || (e[23] = a("label", { class: "llm-field-label" }, "Max Tokens:", -1)),
|
|
432
|
+
k(a("input", {
|
|
433
|
+
"onUpdate:modelValue": e[8] || (e[8] = (s) => t.value.maxTokens = s),
|
|
374
434
|
type: "number",
|
|
375
435
|
min: "1",
|
|
376
436
|
max: "100000",
|
|
377
437
|
class: "llm-form-control",
|
|
378
438
|
ref_key: "maxTokensInput",
|
|
379
|
-
ref:
|
|
439
|
+
ref: S
|
|
380
440
|
}, null, 512), [
|
|
381
441
|
[
|
|
382
|
-
|
|
442
|
+
R,
|
|
383
443
|
t.value.maxTokens,
|
|
384
444
|
void 0,
|
|
385
445
|
{ number: !0 }
|
|
@@ -387,116 +447,116 @@ const Ye = { class: "llm-modal-header" }, He = { key: 0 }, Qe = { class: "llm-mo
|
|
|
387
447
|
])
|
|
388
448
|
], 64)) : r("", !0)
|
|
389
449
|
]),
|
|
390
|
-
|
|
450
|
+
m.value ? (o(), n("div", {
|
|
391
451
|
key: 0,
|
|
392
|
-
class:
|
|
393
|
-
},
|
|
394
|
-
])) : (o(), n("div",
|
|
395
|
-
|
|
396
|
-
e[
|
|
397
|
-
(o(!0), n(
|
|
398
|
-
key:
|
|
399
|
-
class:
|
|
400
|
-
active:
|
|
401
|
-
disabled:
|
|
452
|
+
class: q(["llm-test-result", m.value.success ? "llm-test-result--success" : "llm-test-result--error"])
|
|
453
|
+
}, c(m.value.message), 3)) : r("", !0)
|
|
454
|
+
])) : (o(), n("div", xl, [
|
|
455
|
+
A.value.length > 0 ? (o(), n("div", Il, [
|
|
456
|
+
e[25] || (e[25] = a("h3", null, "Configured Providers", -1)),
|
|
457
|
+
(o(!0), n(f, null, $(A.value, (s) => (o(), n("div", {
|
|
458
|
+
key: s.id,
|
|
459
|
+
class: q(["llm-provider-item", {
|
|
460
|
+
active: s.id === E.value,
|
|
461
|
+
disabled: s.enabled === !1
|
|
402
462
|
}]),
|
|
403
|
-
onClick: (
|
|
463
|
+
onClick: (y) => s.enabled !== !1 ? Re(s.id) : null
|
|
404
464
|
}, [
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
465
|
+
a("div", $l, [
|
|
466
|
+
a("div", Rl, [
|
|
467
|
+
a("div", Bl, [
|
|
468
|
+
O(c(s.name) + " ", 1),
|
|
469
|
+
s.enabled === !1 ? (o(), n("span", Dl, "Disabled")) : r("", !0)
|
|
410
470
|
]),
|
|
411
|
-
|
|
412
|
-
|
|
471
|
+
s.id === E.value ? (o(), n("span", Fl, "Active")) : r("", !0),
|
|
472
|
+
B.showJudge && s.id === _.value ? (o(), n("span", Nl, "Judge")) : r("", !0)
|
|
413
473
|
]),
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
class:
|
|
417
|
-
onClick: J((
|
|
418
|
-
disabled:
|
|
419
|
-
},
|
|
420
|
-
|
|
474
|
+
a("div", jl, [
|
|
475
|
+
a("button", {
|
|
476
|
+
class: q(["llm-test-status-btn", Ae(s.id)]),
|
|
477
|
+
onClick: J((y) => Be(s), ["stop"]),
|
|
478
|
+
disabled: L.value
|
|
479
|
+
}, c(Ke(s.id)), 11, Jl),
|
|
480
|
+
a("div", Ol, c(s.provider) + " • " + c(s.baseUrl), 1)
|
|
421
481
|
])
|
|
422
482
|
]),
|
|
423
|
-
|
|
483
|
+
a("div", {
|
|
424
484
|
class: "llm-provider-actions",
|
|
425
|
-
onClick: e[
|
|
485
|
+
onClick: e[9] || (e[9] = J(() => {
|
|
426
486
|
}, ["stop"]))
|
|
427
487
|
}, [
|
|
428
|
-
|
|
488
|
+
B.showJudge && s.enabled !== !1 ? (o(), n("button", {
|
|
429
489
|
key: 0,
|
|
430
490
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
431
|
-
onClick: (
|
|
432
|
-
title:
|
|
433
|
-
},
|
|
434
|
-
|
|
491
|
+
onClick: (y) => Ge(s),
|
|
492
|
+
title: s.id === _.value ? "Unset as judge" : "Set as judge"
|
|
493
|
+
}, c(s.id === _.value ? "Unmark Judge" : "Mark Judge"), 9, ql)) : r("", !0),
|
|
494
|
+
a("button", {
|
|
435
495
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
436
|
-
onClick: (
|
|
437
|
-
title:
|
|
438
|
-
},
|
|
439
|
-
|
|
496
|
+
onClick: (y) => je(s),
|
|
497
|
+
title: s.enabled === !1 ? "Enable provider" : "Disable provider"
|
|
498
|
+
}, c(s.enabled === !1 ? "Enable" : "Disable"), 9, Wl),
|
|
499
|
+
a("button", {
|
|
440
500
|
class: "llm-btn llm-btn--ghost llm-btn--sm",
|
|
441
|
-
onClick: (
|
|
442
|
-
}, " Edit ", 8,
|
|
443
|
-
|
|
501
|
+
onClick: (y) => de(s)
|
|
502
|
+
}, " Edit ", 8, Gl),
|
|
503
|
+
a("button", {
|
|
444
504
|
class: "llm-btn llm-btn--sm llm-btn--danger",
|
|
445
|
-
onClick: (
|
|
446
|
-
}, " Delete ", 8,
|
|
505
|
+
onClick: (y) => Ne(s.id)
|
|
506
|
+
}, " Delete ", 8, zl)
|
|
447
507
|
])
|
|
448
|
-
], 10,
|
|
449
|
-
])) : (o(), n("div",
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
508
|
+
], 10, Vl))), 128))
|
|
509
|
+
])) : (o(), n("div", Yl, [...e[26] || (e[26] = [
|
|
510
|
+
a("p", null, "Connect your first AI provider to start chatting.", -1),
|
|
511
|
+
a("p", null, `Click "Add New Provider" below. You'll need a base URL and, for some providers, an API key.`, -1),
|
|
512
|
+
a("p", { class: "llm-security-note" }, "API keys are stored locally in your browser.", -1)
|
|
453
513
|
])]))
|
|
454
514
|
])),
|
|
455
|
-
|
|
515
|
+
W.value ? (o(), n("div", {
|
|
456
516
|
key: 2,
|
|
457
517
|
class: "llm-keys-manager-overlay",
|
|
458
|
-
onClick:
|
|
518
|
+
onClick: ve
|
|
459
519
|
}, [
|
|
460
|
-
|
|
520
|
+
a("div", {
|
|
461
521
|
class: "llm-keys-manager-content",
|
|
462
|
-
onClick: e[
|
|
522
|
+
onClick: e[10] || (e[10] = J(() => {
|
|
463
523
|
}, ["stop"]))
|
|
464
524
|
}, [
|
|
465
|
-
|
|
466
|
-
onClose:
|
|
467
|
-
onKeysUpdated:
|
|
525
|
+
Qe(tl, {
|
|
526
|
+
onClose: ve,
|
|
527
|
+
onKeysUpdated: Oe
|
|
468
528
|
})
|
|
469
529
|
])
|
|
470
530
|
])) : r("", !0)
|
|
471
531
|
]),
|
|
472
|
-
|
|
532
|
+
a("div", Hl, [
|
|
473
533
|
v.value ? r("", !0) : (o(), n("button", {
|
|
474
534
|
key: 0,
|
|
475
535
|
class: "llm-btn llm-btn--secondary",
|
|
476
|
-
onClick:
|
|
536
|
+
onClick: De
|
|
477
537
|
}, " Add New Provider ")),
|
|
478
|
-
!v.value &&
|
|
538
|
+
!v.value && Me.value ? (o(), n("button", {
|
|
479
539
|
key: 1,
|
|
480
540
|
class: "llm-btn llm-btn--ghost",
|
|
481
|
-
onClick:
|
|
541
|
+
onClick: Je
|
|
482
542
|
}, " Manage Keys ")) : r("", !0),
|
|
483
|
-
e[
|
|
484
|
-
|
|
543
|
+
e[27] || (e[27] = a("div", { class: "llm-footer-spacer" }, null, -1)),
|
|
544
|
+
a("button", {
|
|
485
545
|
class: "llm-btn llm-btn--ghost",
|
|
486
|
-
onClick: e[
|
|
546
|
+
onClick: e[11] || (e[11] = (s) => v.value ? Fe() : j())
|
|
487
547
|
}, " Close "),
|
|
488
548
|
v.value ? (o(), n("button", {
|
|
489
549
|
key: 2,
|
|
490
550
|
class: "llm-btn llm-btn--primary",
|
|
491
|
-
onClick:
|
|
492
|
-
disabled: !
|
|
493
|
-
},
|
|
551
|
+
onClick: $e,
|
|
552
|
+
disabled: !ue.value || L.value
|
|
553
|
+
}, c(L.value ? "Testing..." : "Save"), 9, Ql)) : r("", !0)
|
|
494
554
|
])
|
|
495
555
|
])
|
|
496
556
|
])) : r("", !0);
|
|
497
557
|
};
|
|
498
558
|
}
|
|
499
|
-
},
|
|
559
|
+
}, ut = /* @__PURE__ */ sl(Xl, [["__scopeId", "data-v-13e351e0"]]);
|
|
500
560
|
export {
|
|
501
|
-
|
|
561
|
+
ut as default
|
|
502
562
|
};
|