@tradalab/lyra 3.14.0 → 3.16.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/blocks/index.d.ts +127 -4
- package/dist/blocks/index.js +474 -170
- package/dist/blocks/index.js.map +1 -1
- package/dist/chunk-5XFDQRXV.js +9 -0
- package/dist/chunk-5XFDQRXV.js.map +1 -0
- package/dist/{chunk-4ILJ3M7K.js → chunk-ASSRDIKG.js} +138 -5
- package/dist/chunk-ASSRDIKG.js.map +1 -0
- package/dist/chunk-DRBRT57F.js +3 -0
- package/dist/{chunk-PL37KFRJ.js.map → chunk-DRBRT57F.js.map} +1 -1
- package/dist/{chunk-U4HIZXI6.js → chunk-KSF233MC.js} +3 -3
- package/dist/chunk-KSF233MC.js.map +1 -0
- package/dist/{chunk-VEWKPOMS.js → chunk-OH3OMK7A.js} +13 -3
- package/dist/{chunk-VEWKPOMS.js.map → chunk-OH3OMK7A.js.map} +1 -1
- package/dist/{chunk-SQELPQZU.js → chunk-UNRT3B6P.js} +6 -16
- package/dist/chunk-UNRT3B6P.js.map +1 -0
- package/dist/data-table/index.d.ts +182 -5
- package/dist/data-table/index.js +657 -78
- package/dist/data-table/index.js.map +1 -1
- package/dist/people/index.js +25 -10
- package/dist/people/index.js.map +1 -1
- package/dist/shell/index.d.ts +3 -1
- package/dist/shell/index.js +11 -5
- package/dist/shell/index.js.map +1 -1
- package/dist/ui/index.d.ts +17 -1
- package/dist/ui/index.js +4 -4
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.js +2 -1
- package/package.json +3 -1
- package/dist/chunk-4ILJ3M7K.js.map +0 -1
- package/dist/chunk-PL37KFRJ.js +0 -3
- package/dist/chunk-SQELPQZU.js.map +0 -1
- package/dist/chunk-U4HIZXI6.js.map +0 -1
package/dist/blocks/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Label, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, Badge, FieldSeparator, Progress } from '../chunk-
|
|
3
|
-
export { PreferenceScript } from '../chunk-
|
|
4
|
-
import { NativeSelect, NativeSelectOption } from '../chunk-
|
|
2
|
+
import { Label, Combobox, ComboboxInput, ComboboxContent, ComboboxEmpty, ComboboxList, ComboboxItem, Drawer, DrawerTrigger, DrawerContent, DrawerHeader, DrawerTitle, DrawerDescription, Spinner, Alert, AlertDescription, FieldGroup, FieldSet, FieldLegend, FieldDescription, Field, FieldContent, FieldLabel, Badge, FieldSeparator, Progress } from '../chunk-ASSRDIKG.js';
|
|
3
|
+
export { PreferenceScript } from '../chunk-ASSRDIKG.js';
|
|
4
|
+
import { NativeSelect, NativeSelectOption } from '../chunk-KSF233MC.js';
|
|
5
5
|
export { useCompact, usePlate } from '../chunk-AIULLZYM.js';
|
|
6
|
-
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, RadioGroup, RadioGroupItem, Switch } from '../chunk-
|
|
7
|
-
export { PlatePicker } from '../chunk-
|
|
6
|
+
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, RadioGroup, RadioGroupItem, Switch } from '../chunk-UNRT3B6P.js';
|
|
7
|
+
export { PlatePicker } from '../chunk-UNRT3B6P.js';
|
|
8
8
|
export { BEARING_PLATES, PLATES, derivePlate, isPlate } from '../chunk-D7DMRCDY.js';
|
|
9
|
-
import '../chunk-
|
|
9
|
+
import '../chunk-OH3OMK7A.js';
|
|
10
10
|
import { Dialog, DialogOverlay, DialogContent, DialogTitle, DialogDescription } from '../chunk-L4LQCVOF.js';
|
|
11
|
+
import { foldText } from '../chunk-5XFDQRXV.js';
|
|
11
12
|
import { Avatar, AvatarImage, AvatarFallback } from '../chunk-VXW3K5O5.js';
|
|
12
13
|
import { Button, Input } from '../chunk-VGOGWZCF.js';
|
|
13
14
|
import { cn } from '../chunk-XH55BHUU.js';
|
|
14
15
|
import * as React5 from 'react';
|
|
15
|
-
import { createContext, useState, useContext, useCallback, useId } from 'react';
|
|
16
|
+
import { createContext, useState, useContext, useCallback, useMemo, useId } from 'react';
|
|
16
17
|
import { Slot } from 'radix-ui';
|
|
17
18
|
import { FormProvider, Controller, useFormContext } from 'react-hook-form';
|
|
18
19
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
|
-
import { ChevronRight, CheckIcon, CopyIcon, PlusIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
20
|
+
import { ChevronRight, CheckIcon, CopyIcon, RefreshCwIcon, PlusIcon, ListIcon, FolderOpen, Folder, File } from 'lucide-react';
|
|
20
21
|
|
|
21
22
|
var Form = FormProvider;
|
|
22
23
|
var FormFieldContext = React5.createContext(null);
|
|
@@ -171,12 +172,8 @@ var useConfirm = () => {
|
|
|
171
172
|
};
|
|
172
173
|
|
|
173
174
|
// src/blocks/tree/data.ts
|
|
174
|
-
var ASCII = /^[ -~]*$/;
|
|
175
175
|
var DIGITS = /\d+/g;
|
|
176
|
-
var naturalKey = (name) =>
|
|
177
|
-
const s = ASCII.test(name) ? name.toLowerCase() : name.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/đ/g, "d");
|
|
178
|
-
return s.replace(DIGITS, (d) => d.padStart(20, "0"));
|
|
179
|
-
};
|
|
176
|
+
var naturalKey = (name) => foldText(name).replace(DIGITS, (d) => d.padStart(20, "0"));
|
|
180
177
|
var rank = (item) => item.isGroup ? 0 : 1;
|
|
181
178
|
var cmp = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
182
179
|
function sortTree(items, compare) {
|
|
@@ -222,6 +219,133 @@ function moveId(ids, id, targetId, pos) {
|
|
|
222
219
|
return [...rest.slice(0, at), id, ...rest.slice(at)];
|
|
223
220
|
}
|
|
224
221
|
var sameOrder = (a, b) => a.length === b.length && a.every((id, i) => id === b[i]);
|
|
222
|
+
function planDrop(tree, dragId, targetId, pos) {
|
|
223
|
+
if (dragId === targetId) return null;
|
|
224
|
+
const groups = tree.filter((i) => i.isGroup);
|
|
225
|
+
const isGroup = (id) => groups.some((g) => g.id === id);
|
|
226
|
+
const leafIds = (groupId2) => (groupId2 ? groups.find((g) => g.id === groupId2)?.children ?? [] : tree.filter((i) => !i.isGroup)).map((c) => c.id);
|
|
227
|
+
const parentOf = (id) => {
|
|
228
|
+
if (tree.some((i) => !i.isGroup && i.id === id)) return "";
|
|
229
|
+
return groups.find((g) => g.children?.some((c) => c.id === id))?.id;
|
|
230
|
+
};
|
|
231
|
+
if (isGroup(dragId)) {
|
|
232
|
+
if (pos === "inside" || !isGroup(targetId)) return null;
|
|
233
|
+
const current = groups.map((g) => g.id);
|
|
234
|
+
const ids2 = moveId(current, dragId, targetId, pos);
|
|
235
|
+
return sameOrder(ids2, current) ? null : { kind: "group", ids: ids2 };
|
|
236
|
+
}
|
|
237
|
+
const from = parentOf(dragId);
|
|
238
|
+
if (from === void 0) return null;
|
|
239
|
+
let groupId;
|
|
240
|
+
let ids;
|
|
241
|
+
if (pos === "inside") {
|
|
242
|
+
if (targetId && !isGroup(targetId)) return null;
|
|
243
|
+
groupId = targetId;
|
|
244
|
+
ids = [...leafIds(groupId).filter((id) => id !== dragId), dragId];
|
|
245
|
+
} else {
|
|
246
|
+
const parent = parentOf(targetId);
|
|
247
|
+
if (parent === void 0) return null;
|
|
248
|
+
groupId = parent;
|
|
249
|
+
ids = moveId(leafIds(groupId), dragId, targetId, pos);
|
|
250
|
+
}
|
|
251
|
+
if (groupId === from && sameOrder(ids, leafIds(groupId))) return null;
|
|
252
|
+
return { kind: "leaf", groupId, ids };
|
|
253
|
+
}
|
|
254
|
+
var TreeDndContext = createContext(null);
|
|
255
|
+
function TreeDndProvider({ tree, enabled = true, onDrop, children }) {
|
|
256
|
+
const [drag, setDrag] = useState(null);
|
|
257
|
+
const [target, setTarget] = useState(null);
|
|
258
|
+
const end = useCallback(() => {
|
|
259
|
+
setDrag(null);
|
|
260
|
+
setTarget(null);
|
|
261
|
+
}, []);
|
|
262
|
+
const drop = useCallback(
|
|
263
|
+
(targetId, pos) => {
|
|
264
|
+
const plan = drag && planDrop(tree, drag.id, targetId, pos);
|
|
265
|
+
end();
|
|
266
|
+
if (plan) onDrop(plan);
|
|
267
|
+
},
|
|
268
|
+
[drag, tree, end, onDrop]
|
|
269
|
+
);
|
|
270
|
+
const value = useMemo(() => ({ enabled, drag, target, setDrag, setTarget, drop, end }), [enabled, drag, target, drop, end]);
|
|
271
|
+
return /* @__PURE__ */ jsx(TreeDndContext.Provider, { value, children });
|
|
272
|
+
}
|
|
273
|
+
var TREE_ATTR = "data-tree-dnd";
|
|
274
|
+
function useTreeDndRoot() {
|
|
275
|
+
const dnd = useContext(TreeDndContext);
|
|
276
|
+
const dropping = dnd?.target?.id === "";
|
|
277
|
+
return {
|
|
278
|
+
className: cn(dropping && "ring-1 ring-inset ring-primary"),
|
|
279
|
+
treeProps: { [TREE_ATTR]: "" },
|
|
280
|
+
rootProps: dnd && {
|
|
281
|
+
onDragOver: (e) => {
|
|
282
|
+
if (!dnd.drag || dnd.drag.isGroup) return;
|
|
283
|
+
if (e.target.closest(`[${TREE_ATTR}]`)) {
|
|
284
|
+
if (dropping) dnd.setTarget(null);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
if (!dropping) dnd.setTarget({ id: "", pos: "inside" });
|
|
289
|
+
},
|
|
290
|
+
onDragLeave: (e) => {
|
|
291
|
+
if (dropping && !e.currentTarget.contains(e.relatedTarget)) dnd.setTarget(null);
|
|
292
|
+
},
|
|
293
|
+
onDrop: (e) => {
|
|
294
|
+
e.preventDefault();
|
|
295
|
+
if (dropping) dnd.drop("", "inside");
|
|
296
|
+
else dnd.end();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function positionAt(e, isGroup, dragIsGroup) {
|
|
302
|
+
if (dragIsGroup !== isGroup) return !dragIsGroup && isGroup ? "inside" : null;
|
|
303
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
304
|
+
return e.clientY < rect.top + rect.height / 2 ? "before" : "after";
|
|
305
|
+
}
|
|
306
|
+
function useTreeDndNode(item) {
|
|
307
|
+
const dnd = useContext(TreeDndContext);
|
|
308
|
+
const pos = dnd?.target?.id === item.id ? dnd.target.pos : null;
|
|
309
|
+
const isGroup = Boolean(item.isGroup);
|
|
310
|
+
return {
|
|
311
|
+
className: cn(
|
|
312
|
+
dnd?.drag?.id === item.id && "opacity-50",
|
|
313
|
+
pos === "before" && "shadow-[inset_0_2px_0_0_var(--primary)]",
|
|
314
|
+
pos === "after" && "shadow-[inset_0_-2px_0_0_var(--primary)]",
|
|
315
|
+
pos === "inside" && "rounded-md ring-1 ring-inset ring-primary"
|
|
316
|
+
),
|
|
317
|
+
props: dnd && {
|
|
318
|
+
draggable: dnd.enabled,
|
|
319
|
+
onDragStart: (e) => {
|
|
320
|
+
e.stopPropagation();
|
|
321
|
+
e.dataTransfer.effectAllowed = "move";
|
|
322
|
+
e.dataTransfer.setData("text/plain", item.id);
|
|
323
|
+
dnd.setDrag({ id: item.id, isGroup });
|
|
324
|
+
},
|
|
325
|
+
onDragEnd: () => dnd.end(),
|
|
326
|
+
onDragLeave: (e) => {
|
|
327
|
+
if (pos && !e.currentTarget.contains(e.relatedTarget)) dnd.setTarget(null);
|
|
328
|
+
},
|
|
329
|
+
onDragOver: (e) => {
|
|
330
|
+
if (!dnd.drag) return;
|
|
331
|
+
e.stopPropagation();
|
|
332
|
+
const next = positionAt(e, isGroup, dnd.drag.isGroup);
|
|
333
|
+
if (!next || dnd.drag.id === item.id) {
|
|
334
|
+
if (dnd.target) dnd.setTarget(null);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
e.preventDefault();
|
|
338
|
+
if (dnd.target?.id !== item.id || dnd.target.pos !== next) dnd.setTarget({ id: item.id, pos: next });
|
|
339
|
+
},
|
|
340
|
+
onDrop: (e) => {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
e.stopPropagation();
|
|
343
|
+
if (pos) dnd.drop(item.id, pos);
|
|
344
|
+
else dnd.end();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
225
349
|
var TreeContext = createContext(void 0);
|
|
226
350
|
var useTree = () => {
|
|
227
351
|
const context = useContext(TreeContext);
|
|
@@ -633,6 +757,22 @@ function AvatarTile({ src, alt, fallback, className }) {
|
|
|
633
757
|
/* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-none text-xs", children: fallback })
|
|
634
758
|
] });
|
|
635
759
|
}
|
|
760
|
+
function AuthCard({ title, description, logo, brand, footer, children, className }) {
|
|
761
|
+
return /* @__PURE__ */ jsx("main", { className: cn("flex min-h-svh items-center justify-center p-4", className), children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-sm flex-col gap-6", children: [
|
|
762
|
+
logo || brand ? /* @__PURE__ */ jsxs("div", { "data-slot": "auth-card-brand", className: "flex items-center justify-center gap-2 font-semibold", children: [
|
|
763
|
+
logo,
|
|
764
|
+
brand ? /* @__PURE__ */ jsx("span", { children: brand }) : null
|
|
765
|
+
] }) : null,
|
|
766
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
767
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
768
|
+
/* @__PURE__ */ jsx(CardTitle, { className: "text-xl", children: title }),
|
|
769
|
+
description ? /* @__PURE__ */ jsx(CardDescription, { children: description }) : null
|
|
770
|
+
] }),
|
|
771
|
+
children ? /* @__PURE__ */ jsx(CardContent, { children }) : null
|
|
772
|
+
] }),
|
|
773
|
+
footer
|
|
774
|
+
] }) });
|
|
775
|
+
}
|
|
636
776
|
function MobileSheet({ title, description, trigger, open, onOpenChange, className, children }) {
|
|
637
777
|
return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange, children: [
|
|
638
778
|
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
|
|
@@ -933,7 +1073,15 @@ var FALLBACK3 = {
|
|
|
933
1073
|
keyRemove: "Remove key",
|
|
934
1074
|
running: "Running on this computer",
|
|
935
1075
|
addFound: "Add",
|
|
936
|
-
retry: "Retry"
|
|
1076
|
+
retry: "Retry",
|
|
1077
|
+
readOnly: "These settings were saved by a newer version of this app, so they can only be read here.",
|
|
1078
|
+
driversFailed: "Provider types could not be loaded, so no provider can be added or edited.",
|
|
1079
|
+
driverUnknown: "This app does not know this provider's type, so it cannot be edited here.",
|
|
1080
|
+
refresh: "Refresh",
|
|
1081
|
+
models: "Models",
|
|
1082
|
+
modelsEmpty: "No model downloaded yet.",
|
|
1083
|
+
deleteModel: "Delete",
|
|
1084
|
+
pullPlaceholder: "Model name to download"
|
|
937
1085
|
};
|
|
938
1086
|
var CAPABILITY = {
|
|
939
1087
|
chat: "chat",
|
|
@@ -964,16 +1112,26 @@ function serves(slot, p) {
|
|
|
964
1112
|
return slot.needs.every((c) => p.capabilities.includes(c)) && (!slot.local_only || p.local);
|
|
965
1113
|
}
|
|
966
1114
|
var pullKey = (provider, model) => `${provider}/${model}`;
|
|
967
|
-
function
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1115
|
+
function totals(p) {
|
|
1116
|
+
let done = 0;
|
|
1117
|
+
let total = 0;
|
|
1118
|
+
for (const l of Object.values(p.layers)) {
|
|
1119
|
+
done += l.done;
|
|
1120
|
+
total += l.total;
|
|
1121
|
+
}
|
|
1122
|
+
return { done, total };
|
|
1123
|
+
}
|
|
1124
|
+
function LlmSettings({ api, labels, className, header, footer }) {
|
|
972
1125
|
const t = { ...FALLBACK3, ...labels };
|
|
1126
|
+
const f = labels?.format ?? {};
|
|
973
1127
|
const cap = (c) => labels?.capabilities?.[c] ?? CAPABILITY[c] ?? c;
|
|
1128
|
+
const size = (bytes) => f.size?.(bytes) ?? sizeOf(bytes);
|
|
1129
|
+
const nameOf = (pid) => api.providerName?.(pid) ?? pid;
|
|
1130
|
+
const slotLabel = (s) => f.slotLabel?.(s) ?? s.label;
|
|
974
1131
|
const id = React5.useId();
|
|
975
1132
|
const [state, setState] = React5.useState(null);
|
|
976
1133
|
const [drivers, setDrivers] = React5.useState([]);
|
|
1134
|
+
const [driversError, setDriversError] = React5.useState(null);
|
|
977
1135
|
const [found, setFound] = React5.useState([]);
|
|
978
1136
|
const [loadError, setLoadError] = React5.useState(null);
|
|
979
1137
|
const [error, setError] = React5.useState(null);
|
|
@@ -984,22 +1142,29 @@ function LlmSettings({
|
|
|
984
1142
|
const [models, setModels] = React5.useState({});
|
|
985
1143
|
const [typed, setTyped] = React5.useState({});
|
|
986
1144
|
const [pulls, setPulls] = React5.useState({});
|
|
1145
|
+
const [library, setLibrary] = React5.useState(null);
|
|
1146
|
+
const [pullName, setPullName] = React5.useState("");
|
|
1147
|
+
const failed = (err) => {
|
|
1148
|
+
if (!api.isCanceled?.(err)) setError(messageOf2(err));
|
|
1149
|
+
};
|
|
987
1150
|
const load = React5.useCallback(() => {
|
|
988
1151
|
setLoadError(null);
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
setDrivers(d);
|
|
993
|
-
},
|
|
994
|
-
(err) => setLoadError(messageOf2(err))
|
|
995
|
-
);
|
|
1152
|
+
setDriversError(null);
|
|
1153
|
+
api.state().then(setState, (err) => setLoadError(messageOf2(err)));
|
|
1154
|
+
api.drivers().then(setDrivers, (err) => setDriversError(messageOf2(err)));
|
|
996
1155
|
api.detect?.().then(setFound, () => {
|
|
997
1156
|
});
|
|
998
1157
|
}, [api]);
|
|
999
1158
|
React5.useEffect(load, [load]);
|
|
1000
1159
|
React5.useEffect(() => {
|
|
1001
1160
|
if (!api.onPull) return;
|
|
1002
|
-
return api.onPull(
|
|
1161
|
+
return api.onPull(
|
|
1162
|
+
(p) => setPulls((prev) => {
|
|
1163
|
+
const key = pullKey(p.provider, p.model);
|
|
1164
|
+
const was = prev[key] ?? { provider: p.provider, model: p.model, status: "", layers: {} };
|
|
1165
|
+
return { ...prev, [key]: { ...was, status: p.status, layers: { ...was.layers, [p.digest ?? ""]: { done: p.done, total: p.total } } } };
|
|
1166
|
+
})
|
|
1167
|
+
);
|
|
1003
1168
|
}, [api]);
|
|
1004
1169
|
const listModels = React5.useCallback(
|
|
1005
1170
|
(provider2) => {
|
|
@@ -1020,12 +1185,36 @@ function LlmSettings({
|
|
|
1020
1185
|
setError(null);
|
|
1021
1186
|
try {
|
|
1022
1187
|
setState(await action());
|
|
1188
|
+
return true;
|
|
1023
1189
|
} catch (err) {
|
|
1024
|
-
|
|
1190
|
+
failed(err);
|
|
1191
|
+
return false;
|
|
1025
1192
|
} finally {
|
|
1026
1193
|
setBusy(false);
|
|
1027
1194
|
}
|
|
1028
1195
|
};
|
|
1196
|
+
const bindSlot = async (slot, provider2, model) => {
|
|
1197
|
+
if (await change(() => api.bind(slot, provider2, model))) api.onBound?.(slot, provider2, model);
|
|
1198
|
+
};
|
|
1199
|
+
const startPull = (provider2, model) => {
|
|
1200
|
+
const key = pullKey(provider2, model);
|
|
1201
|
+
const end = () => setPulls((prev) => {
|
|
1202
|
+
const rest = { ...prev };
|
|
1203
|
+
delete rest[key];
|
|
1204
|
+
return rest;
|
|
1205
|
+
});
|
|
1206
|
+
setPulls((prev) => ({ ...prev, [key]: { provider: provider2, model, status: "", layers: {} } }));
|
|
1207
|
+
api.pull?.(provider2, model).then(
|
|
1208
|
+
(done) => {
|
|
1209
|
+
end();
|
|
1210
|
+
if (done) listModels(provider2);
|
|
1211
|
+
},
|
|
1212
|
+
(err) => {
|
|
1213
|
+
end();
|
|
1214
|
+
failed(err);
|
|
1215
|
+
}
|
|
1216
|
+
);
|
|
1217
|
+
};
|
|
1029
1218
|
if (!state) {
|
|
1030
1219
|
if (!loadError) return /* @__PURE__ */ jsx(Spinner, { className });
|
|
1031
1220
|
return /* @__PURE__ */ jsx(Alert, { variant: "destructive", className, children: /* @__PURE__ */ jsxs(AlertDescription, { className: "flex items-center justify-between gap-3", children: [
|
|
@@ -1033,17 +1222,19 @@ function LlmSettings({
|
|
|
1033
1222
|
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", onClick: load, children: t.retry })
|
|
1034
1223
|
] }) });
|
|
1035
1224
|
}
|
|
1225
|
+
const readOnly = Boolean(state.read_only);
|
|
1226
|
+
const locked = busy || readOnly;
|
|
1036
1227
|
const provider = (pid) => state.providers.find((p) => p.id === pid);
|
|
1037
1228
|
const saveDraft = async () => {
|
|
1038
1229
|
if (!draft) return;
|
|
1039
1230
|
const d = drivers.find((x) => x.name === draft.driver);
|
|
1040
1231
|
const values = {};
|
|
1041
1232
|
const secrets = {};
|
|
1042
|
-
for (const
|
|
1043
|
-
if (
|
|
1044
|
-
if (draft.values[
|
|
1045
|
-
} else if (
|
|
1046
|
-
secrets[
|
|
1233
|
+
for (const f2 of d?.fields ?? []) {
|
|
1234
|
+
if (f2.kind !== "secret") {
|
|
1235
|
+
if (draft.values[f2.key]) values[f2.key] = draft.values[f2.key];
|
|
1236
|
+
} else if (f2.key in draft.secrets) {
|
|
1237
|
+
secrets[f2.key] = draft.secrets[f2.key];
|
|
1047
1238
|
}
|
|
1048
1239
|
}
|
|
1049
1240
|
setBusy(true);
|
|
@@ -1057,7 +1248,7 @@ function LlmSettings({
|
|
|
1057
1248
|
});
|
|
1058
1249
|
setDraft(null);
|
|
1059
1250
|
} catch (err) {
|
|
1060
|
-
setDraftError(messageOf2(err));
|
|
1251
|
+
if (!api.isCanceled?.(err)) setDraftError(messageOf2(err));
|
|
1061
1252
|
} finally {
|
|
1062
1253
|
setBusy(false);
|
|
1063
1254
|
}
|
|
@@ -1073,11 +1264,29 @@ function LlmSettings({
|
|
|
1073
1264
|
for (let i = 2; taken.has(pid); i++) pid = `${name}-${i}`;
|
|
1074
1265
|
return { driver, id: pid, values, secrets: {} };
|
|
1075
1266
|
};
|
|
1267
|
+
const removeProvider = (p) => {
|
|
1268
|
+
if (api.confirmsDelete) void change(() => api.deleteProvider(p.id));
|
|
1269
|
+
else setRemoving(p.id);
|
|
1270
|
+
};
|
|
1271
|
+
const removeModel = async (pid, model) => {
|
|
1272
|
+
setRemoving(null);
|
|
1273
|
+
setBusy(true);
|
|
1274
|
+
setError(null);
|
|
1275
|
+
try {
|
|
1276
|
+
await api.deleteModel?.(pid, model);
|
|
1277
|
+
listModels(pid);
|
|
1278
|
+
} catch (err) {
|
|
1279
|
+
failed(err);
|
|
1280
|
+
} finally {
|
|
1281
|
+
setBusy(false);
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1076
1284
|
const form = (d) => {
|
|
1077
1285
|
const spec = drivers.find((x) => x.name === d.driver);
|
|
1078
1286
|
const set = (patch) => setDraft({ ...d, ...patch });
|
|
1079
1287
|
return /* @__PURE__ */ jsxs("div", { className: "bg-muted/30 flex flex-col gap-3 border px-3 py-3", "data-testid": "provider-form", children: [
|
|
1080
1288
|
draftError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: draftError }) }) : null,
|
|
1289
|
+
d.existing && !spec ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: t.driverUnknown }) : null,
|
|
1081
1290
|
d.existing ? null : /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
1082
1291
|
/* @__PURE__ */ jsxs(Field, { children: [
|
|
1083
1292
|
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: `${id}-driver`, children: t.driver }),
|
|
@@ -1089,23 +1298,25 @@ function LlmSettings({
|
|
|
1089
1298
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.idHint })
|
|
1090
1299
|
] })
|
|
1091
1300
|
] }),
|
|
1092
|
-
spec?.fields.map((
|
|
1093
|
-
const fid = `${id}-f-${
|
|
1094
|
-
|
|
1095
|
-
|
|
1301
|
+
spec?.fields.map((fd) => {
|
|
1302
|
+
const fid = `${id}-f-${fd.key}`;
|
|
1303
|
+
const label = f.fieldLabel?.(d.driver, fd) ?? fd.label;
|
|
1304
|
+
const description = f.fieldDescription?.(d.driver, fd) ?? fd.description;
|
|
1305
|
+
if (fd.kind === "bool") {
|
|
1306
|
+
const on = (d.values[fd.key] ?? fd.default ?? "false") === "true";
|
|
1096
1307
|
return /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
1097
1308
|
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
1098
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1099
|
-
|
|
1309
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1310
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1100
1311
|
] }),
|
|
1101
|
-
/* @__PURE__ */ jsx(Switch, { id: fid, size: "sm", checked: on, onCheckedChange: (v) => set({ values: { ...d.values, [
|
|
1102
|
-
] },
|
|
1312
|
+
/* @__PURE__ */ jsx(Switch, { id: fid, size: "sm", checked: on, onCheckedChange: (v) => set({ values: { ...d.values, [fd.key]: v ? "true" : "false" } }) })
|
|
1313
|
+
] }, fd.key);
|
|
1103
1314
|
}
|
|
1104
|
-
if (
|
|
1105
|
-
const saved = d.existing?.secrets.includes(
|
|
1106
|
-
const cleared = d.secrets[
|
|
1315
|
+
if (fd.kind === "secret") {
|
|
1316
|
+
const saved = d.existing?.secrets.includes(fd.key) ?? false;
|
|
1317
|
+
const cleared = d.secrets[fd.key] === "" && saved;
|
|
1107
1318
|
return /* @__PURE__ */ jsxs(Field, { children: [
|
|
1108
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1319
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1109
1320
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1110
1321
|
/* @__PURE__ */ jsx(
|
|
1111
1322
|
Input,
|
|
@@ -1114,52 +1325,123 @@ function LlmSettings({
|
|
|
1114
1325
|
type: "password",
|
|
1115
1326
|
autoComplete: "off",
|
|
1116
1327
|
placeholder: saved && !cleared ? t.keyKeep : void 0,
|
|
1117
|
-
value: d.secrets[
|
|
1328
|
+
value: d.secrets[fd.key] ?? "",
|
|
1118
1329
|
onChange: (e) => {
|
|
1119
|
-
const secrets = { ...d.secrets, [
|
|
1120
|
-
if (e.target.value === "" && !cleared) delete secrets[
|
|
1330
|
+
const secrets = { ...d.secrets, [fd.key]: e.target.value };
|
|
1331
|
+
if (e.target.value === "" && !cleared) delete secrets[fd.key];
|
|
1121
1332
|
set({ secrets });
|
|
1122
1333
|
}
|
|
1123
1334
|
}
|
|
1124
1335
|
),
|
|
1125
|
-
saved && !cleared ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: () => set({ secrets: { ...d.secrets, [
|
|
1336
|
+
saved && !cleared ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: () => set({ secrets: { ...d.secrets, [fd.key]: "" } }), children: t.keyRemove }) : null
|
|
1126
1337
|
] }),
|
|
1127
|
-
|
|
1128
|
-
] },
|
|
1338
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1339
|
+
] }, fd.key);
|
|
1129
1340
|
}
|
|
1130
1341
|
return /* @__PURE__ */ jsxs(Field, { children: [
|
|
1131
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1342
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1132
1343
|
/* @__PURE__ */ jsx(
|
|
1133
1344
|
Input,
|
|
1134
1345
|
{
|
|
1135
1346
|
id: fid,
|
|
1136
|
-
type:
|
|
1347
|
+
type: fd.kind === "url" ? "url" : "text",
|
|
1137
1348
|
spellCheck: false,
|
|
1138
|
-
placeholder:
|
|
1139
|
-
required:
|
|
1140
|
-
value: d.values[
|
|
1141
|
-
onChange: (e) => set({ values: { ...d.values, [
|
|
1349
|
+
placeholder: fd.default,
|
|
1350
|
+
required: fd.required,
|
|
1351
|
+
value: d.values[fd.key] ?? "",
|
|
1352
|
+
onChange: (e) => set({ values: { ...d.values, [fd.key]: e.target.value } })
|
|
1142
1353
|
}
|
|
1143
1354
|
),
|
|
1144
|
-
|
|
1145
|
-
] },
|
|
1355
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1356
|
+
] }, fd.key);
|
|
1146
1357
|
}),
|
|
1147
1358
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
1148
1359
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setDraft(null), children: t.cancel }),
|
|
1149
|
-
/* @__PURE__ */ jsx(Button, { size: "sm", disabled:
|
|
1360
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", disabled: locked || !d.id || !spec, onClick: () => void saveDraft(), children: t.save })
|
|
1150
1361
|
] })
|
|
1151
1362
|
] });
|
|
1152
1363
|
};
|
|
1153
|
-
const
|
|
1364
|
+
const progress = (p, testId) => {
|
|
1365
|
+
const { done, total } = totals(p);
|
|
1366
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", "data-testid": testId, children: [
|
|
1367
|
+
/* @__PURE__ */ jsx(Progress, { className: "flex-1", value: total > 0 ? done / total * 100 : 0 }),
|
|
1368
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground w-28 text-right text-xs tabular-nums", children: total > 0 ? `${size(done)} / ${size(total)}` : f.pullStatus?.(p.status) ?? p.status }),
|
|
1369
|
+
api.cancelPull ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => void api.cancelPull?.(p.provider, p.model), children: t.cancel }) : null
|
|
1370
|
+
] });
|
|
1371
|
+
};
|
|
1372
|
+
const modelLibrary = (p) => {
|
|
1373
|
+
const list = models[p.id];
|
|
1374
|
+
const pending = Object.values(pulls).filter((x) => x.provider === p.id);
|
|
1375
|
+
const slots = state.slots.filter((s) => serves(s, p));
|
|
1376
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-muted/30 flex flex-col gap-2 border-t px-3 py-3", "data-testid": `models-${p.id}`, children: [
|
|
1377
|
+
list === void 0 ? /* @__PURE__ */ jsx(Spinner, {}) : list.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: t.modelsEmpty }) : /* @__PURE__ */ jsx("ul", { className: "divide-y border", children: list.map((m) => {
|
|
1378
|
+
const confirm = removing === `model:${p.id}/${m.id}`;
|
|
1379
|
+
return /* @__PURE__ */ jsxs("li", { className: "flex flex-wrap items-center gap-2 px-3 py-2", "data-testid": `model-${m.id}`, children: [
|
|
1380
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: m.id }),
|
|
1381
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: [m.parameter_size, m.quantization, m.size ? size(m.size) : ""].filter(Boolean).join(" \xB7 ") }),
|
|
1382
|
+
slots.filter((s) => !(s.provider === p.id && s.model === m.id)).map((s) => /* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", disabled: locked, onClick: () => void bindSlot(s.name, p.id, m.id), children: f.useFor?.(slotLabel(s)) ?? `Use for ${slotLabel(s)}` }, s.name)),
|
|
1383
|
+
api.deleteModel ? confirm ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1384
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => setRemoving(null), children: t.keep }),
|
|
1385
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "destructive", disabled: locked, onClick: () => void removeModel(p.id, m.id), children: t.deleteModel })
|
|
1386
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1387
|
+
Button,
|
|
1388
|
+
{
|
|
1389
|
+
size: "xs",
|
|
1390
|
+
variant: "ghost",
|
|
1391
|
+
disabled: locked,
|
|
1392
|
+
onClick: () => api.confirmsDelete ? void removeModel(p.id, m.id) : setRemoving(`model:${p.id}/${m.id}`),
|
|
1393
|
+
children: t.deleteModel
|
|
1394
|
+
}
|
|
1395
|
+
) : null
|
|
1396
|
+
] }, m.id);
|
|
1397
|
+
}) }),
|
|
1398
|
+
pending.map((x) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1399
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: x.model }),
|
|
1400
|
+
progress(x, `library-pull-${x.model}`)
|
|
1401
|
+
] }, x.model)),
|
|
1402
|
+
api.pull ? /* @__PURE__ */ jsxs(
|
|
1403
|
+
"form",
|
|
1404
|
+
{
|
|
1405
|
+
className: "flex gap-2",
|
|
1406
|
+
onSubmit: (e) => {
|
|
1407
|
+
e.preventDefault();
|
|
1408
|
+
const name = pullName.trim();
|
|
1409
|
+
if (!name) return;
|
|
1410
|
+
startPull(p.id, name);
|
|
1411
|
+
setPullName("");
|
|
1412
|
+
},
|
|
1413
|
+
children: [
|
|
1414
|
+
/* @__PURE__ */ jsx(
|
|
1415
|
+
Input,
|
|
1416
|
+
{
|
|
1417
|
+
"aria-label": t.pullPlaceholder,
|
|
1418
|
+
placeholder: t.pullPlaceholder,
|
|
1419
|
+
spellCheck: false,
|
|
1420
|
+
disabled: locked,
|
|
1421
|
+
value: pullName,
|
|
1422
|
+
onChange: (e) => setPullName(e.target.value)
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", size: "sm", variant: "outline", disabled: locked || !pullName.trim(), children: t.download })
|
|
1426
|
+
]
|
|
1427
|
+
}
|
|
1428
|
+
) : null
|
|
1429
|
+
] });
|
|
1430
|
+
};
|
|
1431
|
+
const unused = found.filter((f2) => !state.providers.some((p) => p.values.base_url === f2.base_url));
|
|
1154
1432
|
return (
|
|
1155
1433
|
// min-w-0 on every FieldSet: a fieldset is min-content wide by default, so one long URL
|
|
1156
1434
|
// would widen the whole screen instead of truncating.
|
|
1157
1435
|
/* @__PURE__ */ jsxs(FieldGroup, { className, children: [
|
|
1436
|
+
readOnly ? /* @__PURE__ */ jsx(Alert, { "data-testid": "llm-read-only", children: /* @__PURE__ */ jsx(AlertDescription, { children: t.readOnly }) }) : null,
|
|
1158
1437
|
error ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: error }) }) : null,
|
|
1438
|
+
header,
|
|
1159
1439
|
/* @__PURE__ */ jsxs(FieldSet, { className: "min-w-0", children: [
|
|
1160
1440
|
/* @__PURE__ */ jsx(FieldLegend, { children: t.slots }),
|
|
1161
1441
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.slotsHint }),
|
|
1162
1442
|
/* @__PURE__ */ jsx("ul", { className: "divide-y border", children: state.slots.map((slot) => {
|
|
1443
|
+
const label = slotLabel(slot);
|
|
1444
|
+
const description = f.slotDescription?.(slot) ?? slot.description;
|
|
1163
1445
|
const current = provider(slot.provider);
|
|
1164
1446
|
const choices = state.providers.filter((p) => p.id === slot.provider || serves(slot, p));
|
|
1165
1447
|
const known = slot.provider ? models[slot.provider] : void 0;
|
|
@@ -1170,25 +1452,25 @@ function LlmSettings({
|
|
|
1170
1452
|
const missing = known !== void 0 && chosen !== "" && !known.some((m) => m.id === chosen);
|
|
1171
1453
|
const commit = () => {
|
|
1172
1454
|
if (!slot.provider || draftModel === (slot.model ?? "")) return;
|
|
1173
|
-
void
|
|
1455
|
+
void bindSlot(slot.name, slot.provider, draftModel);
|
|
1174
1456
|
};
|
|
1175
1457
|
return /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-2 px-3 py-3", "data-testid": `slot-${slot.name}`, children: [
|
|
1176
1458
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2", children: [
|
|
1177
1459
|
/* @__PURE__ */ jsxs("div", { className: "min-w-40 flex-1", children: [
|
|
1178
1460
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1179
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children:
|
|
1461
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: label }),
|
|
1180
1462
|
slot.local_only ? /* @__PURE__ */ jsx(Badge, { variant: "outline", title: t.localOnlyHint, children: t.localOnly }) : null
|
|
1181
1463
|
] }),
|
|
1182
|
-
|
|
1464
|
+
description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: description }) : null
|
|
1183
1465
|
] }),
|
|
1184
1466
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full gap-2 sm:w-auto", children: [
|
|
1185
1467
|
/* @__PURE__ */ jsxs(
|
|
1186
1468
|
NativeSelect,
|
|
1187
1469
|
{
|
|
1188
|
-
"aria-label": `${
|
|
1470
|
+
"aria-label": f.slotProvider?.(label) ?? `${label}: ${t.providers}`,
|
|
1189
1471
|
className: "sm:w-40",
|
|
1190
1472
|
value: slot.provider ?? "",
|
|
1191
|
-
disabled:
|
|
1473
|
+
disabled: locked,
|
|
1192
1474
|
onChange: (e) => {
|
|
1193
1475
|
const next = e.target.value;
|
|
1194
1476
|
setTyped((prev) => {
|
|
@@ -1196,24 +1478,42 @@ function LlmSettings({
|
|
|
1196
1478
|
delete rest[slot.name];
|
|
1197
1479
|
return rest;
|
|
1198
1480
|
});
|
|
1199
|
-
|
|
1481
|
+
if (!next) {
|
|
1482
|
+
void change(() => api.unbind(slot.name));
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
const was = slot.model ?? "";
|
|
1486
|
+
const have = models[next];
|
|
1487
|
+
const keep = (list) => was && list.some((m) => m.id === was) ? was : "";
|
|
1488
|
+
if (have || !was) {
|
|
1489
|
+
void bindSlot(slot.name, next, keep(have ?? []));
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
setBusy(true);
|
|
1493
|
+
api.models(next).then(
|
|
1494
|
+
(ms) => {
|
|
1495
|
+
setModels((prev) => ({ ...prev, [next]: ms }));
|
|
1496
|
+
void bindSlot(slot.name, next, keep(ms));
|
|
1497
|
+
},
|
|
1498
|
+
() => void bindSlot(slot.name, next, "")
|
|
1499
|
+
);
|
|
1200
1500
|
},
|
|
1201
1501
|
children: [
|
|
1202
1502
|
/* @__PURE__ */ jsx(NativeSelectOption, { value: "", children: t.notSet }),
|
|
1203
|
-
choices.map((p) => /* @__PURE__ */ jsx(NativeSelectOption, { value: p.id, children: p.id }, p.id))
|
|
1503
|
+
choices.map((p) => /* @__PURE__ */ jsx(NativeSelectOption, { value: p.id, children: nameOf(p.id) }, p.id))
|
|
1204
1504
|
]
|
|
1205
1505
|
}
|
|
1206
1506
|
),
|
|
1207
1507
|
/* @__PURE__ */ jsx(
|
|
1208
1508
|
Input,
|
|
1209
1509
|
{
|
|
1210
|
-
"aria-label": `${
|
|
1510
|
+
"aria-label": f.slotModel?.(label) ?? `${label}: ${t.model}`,
|
|
1211
1511
|
title: t.modelHint,
|
|
1212
1512
|
className: "sm:w-56 [&::-webkit-calendar-picker-indicator]:opacity-30",
|
|
1213
1513
|
list: `${id}-models-${slot.name}`,
|
|
1214
1514
|
spellCheck: false,
|
|
1215
1515
|
placeholder: t.model,
|
|
1216
|
-
disabled:
|
|
1516
|
+
disabled: locked || !slot.provider,
|
|
1217
1517
|
value: draftModel,
|
|
1218
1518
|
onChange: (e) => setTyped((prev) => ({ ...prev, [slot.name]: e.target.value })),
|
|
1219
1519
|
onBlur: commit,
|
|
@@ -1222,51 +1522,16 @@ function LlmSettings({
|
|
|
1222
1522
|
}
|
|
1223
1523
|
}
|
|
1224
1524
|
),
|
|
1225
|
-
/* @__PURE__ */ jsx("datalist", { id: `${id}-models-${slot.name}`, children: known?.map((m) => /* @__PURE__ */ jsx("option", { value: m.id, children: [m.parameter_size, m.quantization, m.size ?
|
|
1525
|
+
/* @__PURE__ */ jsx("datalist", { id: `${id}-models-${slot.name}`, children: known?.map((m) => /* @__PURE__ */ jsx("option", { value: m.id, children: [m.parameter_size, m.quantization, m.size ? size(m.size) : ""].filter(Boolean).join(" \xB7 ") }, m.id)) })
|
|
1226
1526
|
] })
|
|
1227
1527
|
] }),
|
|
1228
1528
|
slot.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: slot.error }) : null,
|
|
1229
1529
|
api.slotNote?.(slot.name),
|
|
1230
1530
|
current?.manages && api.pull && missing && !pulling ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-3", children: [
|
|
1231
1531
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: t.notDownloaded }),
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
Button,
|
|
1234
|
-
{
|
|
1235
|
-
size: "xs",
|
|
1236
|
-
variant: "outline",
|
|
1237
|
-
disabled: busy,
|
|
1238
|
-
onClick: () => {
|
|
1239
|
-
const key = pullKey(current.id, chosen);
|
|
1240
|
-
const end = () => setPulls((prev) => {
|
|
1241
|
-
const rest = { ...prev };
|
|
1242
|
-
delete rest[key];
|
|
1243
|
-
return rest;
|
|
1244
|
-
});
|
|
1245
|
-
setPulls((prev) => ({ ...prev, [key]: { provider: current.id, model: chosen, status: "", done: 0, total: 0 } }));
|
|
1246
|
-
api.pull?.(current.id, chosen).then(
|
|
1247
|
-
(done) => {
|
|
1248
|
-
end();
|
|
1249
|
-
if (done) listModels(current.id);
|
|
1250
|
-
},
|
|
1251
|
-
(err) => {
|
|
1252
|
-
end();
|
|
1253
|
-
setError(messageOf2(err));
|
|
1254
|
-
}
|
|
1255
|
-
);
|
|
1256
|
-
},
|
|
1257
|
-
children: [
|
|
1258
|
-
t.download,
|
|
1259
|
-
" ",
|
|
1260
|
-
chosen
|
|
1261
|
-
]
|
|
1262
|
-
}
|
|
1263
|
-
)
|
|
1532
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", disabled: locked, onClick: () => startPull(current.id, chosen), children: f.downloadModel?.(chosen) ?? `${t.download} ${chosen}` })
|
|
1264
1533
|
] }) : null,
|
|
1265
|
-
pulling && current ?
|
|
1266
|
-
/* @__PURE__ */ jsx(Progress, { className: "flex-1", value: pull.total > 0 ? pull.done / pull.total * 100 : 0 }),
|
|
1267
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground w-28 text-right text-xs tabular-nums", children: pull.total > 0 ? `${sizeOf(pull.done)} / ${sizeOf(pull.total)}` : pull.status }),
|
|
1268
|
-
api.cancelPull ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => void api.cancelPull?.(current.id, pull.model), children: t.cancel }) : null
|
|
1269
|
-
] }) : null
|
|
1534
|
+
pulling && current ? progress(pull, `pull-${slot.name}`) : null
|
|
1270
1535
|
] }, slot.name);
|
|
1271
1536
|
}) })
|
|
1272
1537
|
] }),
|
|
@@ -1277,95 +1542,134 @@ function LlmSettings({
|
|
|
1277
1542
|
/* @__PURE__ */ jsx(FieldLegend, { children: t.providers }),
|
|
1278
1543
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.providersHint })
|
|
1279
1544
|
] }),
|
|
1280
|
-
/* @__PURE__ */ jsxs(
|
|
1281
|
-
Button,
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1545
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1546
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", disabled: busy, "aria-label": t.refresh, title: t.refresh, onClick: () => {
|
|
1547
|
+
setModels({});
|
|
1548
|
+
load();
|
|
1549
|
+
}, children: /* @__PURE__ */ jsx(RefreshCwIcon, {}) }),
|
|
1550
|
+
/* @__PURE__ */ jsxs(
|
|
1551
|
+
Button,
|
|
1552
|
+
{
|
|
1553
|
+
size: "sm",
|
|
1554
|
+
variant: "outline",
|
|
1555
|
+
disabled: locked || drivers.length === 0,
|
|
1556
|
+
onClick: () => startDraft(newDraft(drivers[0]?.name ?? "")),
|
|
1557
|
+
children: [
|
|
1558
|
+
/* @__PURE__ */ jsx(PlusIcon, {}),
|
|
1559
|
+
t.add
|
|
1560
|
+
]
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1563
|
+
] })
|
|
1293
1564
|
] }),
|
|
1565
|
+
driversError ? /* @__PURE__ */ jsxs("p", { className: "text-destructive text-xs", "data-testid": "drivers-failed", children: [
|
|
1566
|
+
t.driversFailed,
|
|
1567
|
+
" ",
|
|
1568
|
+
driversError
|
|
1569
|
+
] }) : null,
|
|
1294
1570
|
draft && !draft.existing ? form(draft) : null,
|
|
1295
1571
|
state.providers.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: t.providersEmpty }) : /* @__PURE__ */ jsx("ul", { className: "divide-y border", children: state.providers.map(
|
|
1296
|
-
(p) => draft?.existing?.id === p.id ? /* @__PURE__ */ jsx("li", { className: "p-0", children: form(draft) }, p.id) : /* @__PURE__ */ jsxs("li", {
|
|
1297
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1298
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1299
|
-
/* @__PURE__ */
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1572
|
+
(p) => draft?.existing?.id === p.id ? /* @__PURE__ */ jsx("li", { className: "p-0", children: form(draft) }, p.id) : /* @__PURE__ */ jsxs("li", { "data-testid": `provider-${p.id}`, children: [
|
|
1573
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
1574
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1575
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1576
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", children: nameOf(p.id) }),
|
|
1577
|
+
p.driver !== p.id ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: p.driver ?? t.byApp }) : null
|
|
1578
|
+
] }),
|
|
1579
|
+
/* @__PURE__ */ jsxs("div", { className: "text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs [&>*:not(:first-child)]:before:mr-2 [&>*:not(:first-child)]:before:content-['\xB7']", children: [
|
|
1580
|
+
p.values.base_url ? /* @__PURE__ */ jsx("span", { className: "max-w-64 truncate font-mono", title: p.values.base_url, children: hostOf(p.values.base_url) }) : null,
|
|
1581
|
+
/* @__PURE__ */ jsx("span", { children: p.local ? t.thisMachine : t.remote }),
|
|
1582
|
+
p.secrets.length > 0 ? /* @__PURE__ */ jsx("span", { children: t.keySaved }) : null,
|
|
1583
|
+
p.capabilities.length > 0 ? /* @__PURE__ */ jsx("span", { children: p.capabilities.map(cap).join(", ") }) : null
|
|
1584
|
+
] }),
|
|
1585
|
+
p.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: p.error }) : null
|
|
1307
1586
|
] }),
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
p.editable ? removing === p.id ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1311
|
-
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => setRemoving(null), children: t.keep }),
|
|
1312
|
-
/* @__PURE__ */ jsxs(
|
|
1587
|
+
api.providerExtra?.(p),
|
|
1588
|
+
p.manages ? /* @__PURE__ */ jsxs(
|
|
1313
1589
|
Button,
|
|
1314
1590
|
{
|
|
1315
1591
|
size: "xs",
|
|
1316
|
-
variant: "
|
|
1317
|
-
|
|
1592
|
+
variant: library === p.id ? "secondary" : "ghost",
|
|
1593
|
+
"aria-expanded": library === p.id,
|
|
1318
1594
|
onClick: () => {
|
|
1319
|
-
|
|
1320
|
-
|
|
1595
|
+
const open = library === p.id ? null : p.id;
|
|
1596
|
+
setLibrary(open);
|
|
1597
|
+
if (open) listModels(open);
|
|
1321
1598
|
},
|
|
1322
1599
|
children: [
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
p.id
|
|
1600
|
+
/* @__PURE__ */ jsx(ListIcon, {}),
|
|
1601
|
+
t.models
|
|
1326
1602
|
]
|
|
1327
1603
|
}
|
|
1328
|
-
)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1604
|
+
) : null,
|
|
1605
|
+
p.editable ? removing === p.id ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1606
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => setRemoving(null), children: t.keep }),
|
|
1607
|
+
/* @__PURE__ */ jsx(
|
|
1608
|
+
Button,
|
|
1609
|
+
{
|
|
1610
|
+
size: "xs",
|
|
1611
|
+
variant: "destructive",
|
|
1612
|
+
disabled: locked,
|
|
1613
|
+
onClick: () => {
|
|
1614
|
+
setRemoving(null);
|
|
1615
|
+
void change(() => api.deleteProvider(p.id));
|
|
1616
|
+
},
|
|
1617
|
+
children: f.removeProvider?.(nameOf(p.id)) ?? `${t.removeConfirm} ${nameOf(p.id)}`
|
|
1618
|
+
}
|
|
1619
|
+
)
|
|
1620
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1621
|
+
/* @__PURE__ */ jsx(
|
|
1622
|
+
Button,
|
|
1623
|
+
{
|
|
1624
|
+
size: "xs",
|
|
1625
|
+
variant: "ghost",
|
|
1626
|
+
"aria-label": f.editProvider?.(nameOf(p.id)) ?? `${t.edit} ${nameOf(p.id)}`,
|
|
1627
|
+
disabled: locked,
|
|
1628
|
+
onClick: () => startDraft({ existing: p, driver: p.driver ?? "", id: p.id, values: { ...p.values }, secrets: {} }),
|
|
1629
|
+
children: t.edit
|
|
1630
|
+
}
|
|
1631
|
+
),
|
|
1632
|
+
/* @__PURE__ */ jsx(
|
|
1633
|
+
Button,
|
|
1634
|
+
{
|
|
1635
|
+
size: "xs",
|
|
1636
|
+
variant: "ghost",
|
|
1637
|
+
"aria-label": f.removeProvider?.(nameOf(p.id)) ?? `${t.remove} ${nameOf(p.id)}`,
|
|
1638
|
+
disabled: locked,
|
|
1639
|
+
onClick: () => removeProvider(p),
|
|
1640
|
+
children: t.remove
|
|
1641
|
+
}
|
|
1642
|
+
)
|
|
1643
|
+
] }) : null
|
|
1644
|
+
] }),
|
|
1645
|
+
library === p.id ? modelLibrary(p) : null
|
|
1343
1646
|
] }, p.id)
|
|
1344
1647
|
) }),
|
|
1345
1648
|
unused.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1346
1649
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: t.running }),
|
|
1347
|
-
/* @__PURE__ */ jsx("ul", { className: "divide-y border border-dashed", children: unused.map((
|
|
1348
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children:
|
|
1349
|
-
|
|
1350
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate font-mono text-xs", children:
|
|
1650
|
+
/* @__PURE__ */ jsx("ul", { className: "divide-y border border-dashed", children: unused.map((f2) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3 px-3 py-2", children: [
|
|
1651
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: f2.name }),
|
|
1652
|
+
f2.version ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: f2.version }) : null,
|
|
1653
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate font-mono text-xs", children: f2.base_url }),
|
|
1351
1654
|
/* @__PURE__ */ jsx(
|
|
1352
1655
|
Button,
|
|
1353
1656
|
{
|
|
1354
1657
|
size: "xs",
|
|
1355
1658
|
variant: "outline",
|
|
1356
|
-
"aria-label": `${t.addFound} ${
|
|
1357
|
-
disabled:
|
|
1358
|
-
onClick: () => startDraft(newDraft(
|
|
1659
|
+
"aria-label": labels?.format?.addFound?.(f2.name) ?? `${t.addFound} ${f2.name}`,
|
|
1660
|
+
disabled: locked || !drivers.some((d) => d.name === f2.driver),
|
|
1661
|
+
onClick: () => startDraft(newDraft(f2.driver, { base_url: f2.base_url }, f2.name)),
|
|
1359
1662
|
children: t.addFound
|
|
1360
1663
|
}
|
|
1361
1664
|
)
|
|
1362
|
-
] },
|
|
1665
|
+
] }, f2.base_url)) })
|
|
1363
1666
|
] }) : null
|
|
1364
|
-
] })
|
|
1667
|
+
] }),
|
|
1668
|
+
footer
|
|
1365
1669
|
] })
|
|
1366
1670
|
);
|
|
1367
1671
|
}
|
|
1368
1672
|
|
|
1369
|
-
export { AvatarTile, ChoiceDrawer, ConfirmContext, ConfirmDialog, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, McpSettings, MobileSheet, OptionPicker, Panel, PanelCard, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, filterTree, flattenTree, moveId, sameOrder, sortTree, useConfirm, useFormField };
|
|
1673
|
+
export { AuthCard, AvatarTile, ChoiceDrawer, ConfirmContext, ConfirmDialog, ConfirmProvider, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, LlmSettings, McpSettings, MobileSheet, OptionPicker, Panel, PanelCard, TreeDndProvider, TreeExpander, TreeIcon, TreeLabel, TreeLines, TreeNode, TreeNodeContent, TreeNodeTrigger, TreeProvider, TreeView, TzPicker, filterTree, flattenTree, moveId, planDrop, sameOrder, sortTree, useConfirm, useFormField, useTreeDndNode, useTreeDndRoot };
|
|
1370
1674
|
//# sourceMappingURL=index.js.map
|
|
1371
1675
|
//# sourceMappingURL=index.js.map
|