@tradalab/lyra 3.15.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 +69 -3
- package/dist/blocks/index.js +346 -169
- 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,13 +1,14 @@
|
|
|
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';
|
|
@@ -16,7 +17,7 @@ import { createContext, useState, useContext, useCallback, useMemo, useId } from
|
|
|
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) {
|
|
@@ -760,6 +757,22 @@ function AvatarTile({ src, alt, fallback, className }) {
|
|
|
760
757
|
/* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-none text-xs", children: fallback })
|
|
761
758
|
] });
|
|
762
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
|
+
}
|
|
763
776
|
function MobileSheet({ title, description, trigger, open, onOpenChange, className, children }) {
|
|
764
777
|
return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange, children: [
|
|
765
778
|
trigger && /* @__PURE__ */ jsx(DrawerTrigger, { asChild: true, children: trigger }),
|
|
@@ -1060,7 +1073,15 @@ var FALLBACK3 = {
|
|
|
1060
1073
|
keyRemove: "Remove key",
|
|
1061
1074
|
running: "Running on this computer",
|
|
1062
1075
|
addFound: "Add",
|
|
1063
|
-
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"
|
|
1064
1085
|
};
|
|
1065
1086
|
var CAPABILITY = {
|
|
1066
1087
|
chat: "chat",
|
|
@@ -1091,16 +1112,26 @@ function serves(slot, p) {
|
|
|
1091
1112
|
return slot.needs.every((c) => p.capabilities.includes(c)) && (!slot.local_only || p.local);
|
|
1092
1113
|
}
|
|
1093
1114
|
var pullKey = (provider, model) => `${provider}/${model}`;
|
|
1094
|
-
function
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
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 }) {
|
|
1099
1125
|
const t = { ...FALLBACK3, ...labels };
|
|
1126
|
+
const f = labels?.format ?? {};
|
|
1100
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;
|
|
1101
1131
|
const id = React5.useId();
|
|
1102
1132
|
const [state, setState] = React5.useState(null);
|
|
1103
1133
|
const [drivers, setDrivers] = React5.useState([]);
|
|
1134
|
+
const [driversError, setDriversError] = React5.useState(null);
|
|
1104
1135
|
const [found, setFound] = React5.useState([]);
|
|
1105
1136
|
const [loadError, setLoadError] = React5.useState(null);
|
|
1106
1137
|
const [error, setError] = React5.useState(null);
|
|
@@ -1111,22 +1142,29 @@ function LlmSettings({
|
|
|
1111
1142
|
const [models, setModels] = React5.useState({});
|
|
1112
1143
|
const [typed, setTyped] = React5.useState({});
|
|
1113
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
|
+
};
|
|
1114
1150
|
const load = React5.useCallback(() => {
|
|
1115
1151
|
setLoadError(null);
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
setDrivers(d);
|
|
1120
|
-
},
|
|
1121
|
-
(err) => setLoadError(messageOf2(err))
|
|
1122
|
-
);
|
|
1152
|
+
setDriversError(null);
|
|
1153
|
+
api.state().then(setState, (err) => setLoadError(messageOf2(err)));
|
|
1154
|
+
api.drivers().then(setDrivers, (err) => setDriversError(messageOf2(err)));
|
|
1123
1155
|
api.detect?.().then(setFound, () => {
|
|
1124
1156
|
});
|
|
1125
1157
|
}, [api]);
|
|
1126
1158
|
React5.useEffect(load, [load]);
|
|
1127
1159
|
React5.useEffect(() => {
|
|
1128
1160
|
if (!api.onPull) return;
|
|
1129
|
-
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
|
+
);
|
|
1130
1168
|
}, [api]);
|
|
1131
1169
|
const listModels = React5.useCallback(
|
|
1132
1170
|
(provider2) => {
|
|
@@ -1147,12 +1185,36 @@ function LlmSettings({
|
|
|
1147
1185
|
setError(null);
|
|
1148
1186
|
try {
|
|
1149
1187
|
setState(await action());
|
|
1188
|
+
return true;
|
|
1150
1189
|
} catch (err) {
|
|
1151
|
-
|
|
1190
|
+
failed(err);
|
|
1191
|
+
return false;
|
|
1152
1192
|
} finally {
|
|
1153
1193
|
setBusy(false);
|
|
1154
1194
|
}
|
|
1155
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
|
+
};
|
|
1156
1218
|
if (!state) {
|
|
1157
1219
|
if (!loadError) return /* @__PURE__ */ jsx(Spinner, { className });
|
|
1158
1220
|
return /* @__PURE__ */ jsx(Alert, { variant: "destructive", className, children: /* @__PURE__ */ jsxs(AlertDescription, { className: "flex items-center justify-between gap-3", children: [
|
|
@@ -1160,17 +1222,19 @@ function LlmSettings({
|
|
|
1160
1222
|
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", onClick: load, children: t.retry })
|
|
1161
1223
|
] }) });
|
|
1162
1224
|
}
|
|
1225
|
+
const readOnly = Boolean(state.read_only);
|
|
1226
|
+
const locked = busy || readOnly;
|
|
1163
1227
|
const provider = (pid) => state.providers.find((p) => p.id === pid);
|
|
1164
1228
|
const saveDraft = async () => {
|
|
1165
1229
|
if (!draft) return;
|
|
1166
1230
|
const d = drivers.find((x) => x.name === draft.driver);
|
|
1167
1231
|
const values = {};
|
|
1168
1232
|
const secrets = {};
|
|
1169
|
-
for (const
|
|
1170
|
-
if (
|
|
1171
|
-
if (draft.values[
|
|
1172
|
-
} else if (
|
|
1173
|
-
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];
|
|
1174
1238
|
}
|
|
1175
1239
|
}
|
|
1176
1240
|
setBusy(true);
|
|
@@ -1184,7 +1248,7 @@ function LlmSettings({
|
|
|
1184
1248
|
});
|
|
1185
1249
|
setDraft(null);
|
|
1186
1250
|
} catch (err) {
|
|
1187
|
-
setDraftError(messageOf2(err));
|
|
1251
|
+
if (!api.isCanceled?.(err)) setDraftError(messageOf2(err));
|
|
1188
1252
|
} finally {
|
|
1189
1253
|
setBusy(false);
|
|
1190
1254
|
}
|
|
@@ -1200,11 +1264,29 @@ function LlmSettings({
|
|
|
1200
1264
|
for (let i = 2; taken.has(pid); i++) pid = `${name}-${i}`;
|
|
1201
1265
|
return { driver, id: pid, values, secrets: {} };
|
|
1202
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
|
+
};
|
|
1203
1284
|
const form = (d) => {
|
|
1204
1285
|
const spec = drivers.find((x) => x.name === d.driver);
|
|
1205
1286
|
const set = (patch) => setDraft({ ...d, ...patch });
|
|
1206
1287
|
return /* @__PURE__ */ jsxs("div", { className: "bg-muted/30 flex flex-col gap-3 border px-3 py-3", "data-testid": "provider-form", children: [
|
|
1207
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,
|
|
1208
1290
|
d.existing ? null : /* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
1209
1291
|
/* @__PURE__ */ jsxs(Field, { children: [
|
|
1210
1292
|
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: `${id}-driver`, children: t.driver }),
|
|
@@ -1216,23 +1298,25 @@ function LlmSettings({
|
|
|
1216
1298
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.idHint })
|
|
1217
1299
|
] })
|
|
1218
1300
|
] }),
|
|
1219
|
-
spec?.fields.map((
|
|
1220
|
-
const fid = `${id}-f-${
|
|
1221
|
-
|
|
1222
|
-
|
|
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";
|
|
1223
1307
|
return /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", children: [
|
|
1224
1308
|
/* @__PURE__ */ jsxs(FieldContent, { children: [
|
|
1225
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1226
|
-
|
|
1309
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1310
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1227
1311
|
] }),
|
|
1228
|
-
/* @__PURE__ */ jsx(Switch, { id: fid, size: "sm", checked: on, onCheckedChange: (v) => set({ values: { ...d.values, [
|
|
1229
|
-
] },
|
|
1312
|
+
/* @__PURE__ */ jsx(Switch, { id: fid, size: "sm", checked: on, onCheckedChange: (v) => set({ values: { ...d.values, [fd.key]: v ? "true" : "false" } }) })
|
|
1313
|
+
] }, fd.key);
|
|
1230
1314
|
}
|
|
1231
|
-
if (
|
|
1232
|
-
const saved = d.existing?.secrets.includes(
|
|
1233
|
-
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;
|
|
1234
1318
|
return /* @__PURE__ */ jsxs(Field, { children: [
|
|
1235
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1319
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1236
1320
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
1237
1321
|
/* @__PURE__ */ jsx(
|
|
1238
1322
|
Input,
|
|
@@ -1241,52 +1325,123 @@ function LlmSettings({
|
|
|
1241
1325
|
type: "password",
|
|
1242
1326
|
autoComplete: "off",
|
|
1243
1327
|
placeholder: saved && !cleared ? t.keyKeep : void 0,
|
|
1244
|
-
value: d.secrets[
|
|
1328
|
+
value: d.secrets[fd.key] ?? "",
|
|
1245
1329
|
onChange: (e) => {
|
|
1246
|
-
const secrets = { ...d.secrets, [
|
|
1247
|
-
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];
|
|
1248
1332
|
set({ secrets });
|
|
1249
1333
|
}
|
|
1250
1334
|
}
|
|
1251
1335
|
),
|
|
1252
|
-
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
|
|
1253
1337
|
] }),
|
|
1254
|
-
|
|
1255
|
-
] },
|
|
1338
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1339
|
+
] }, fd.key);
|
|
1256
1340
|
}
|
|
1257
1341
|
return /* @__PURE__ */ jsxs(Field, { children: [
|
|
1258
|
-
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children:
|
|
1342
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: fid, children: label }),
|
|
1259
1343
|
/* @__PURE__ */ jsx(
|
|
1260
1344
|
Input,
|
|
1261
1345
|
{
|
|
1262
1346
|
id: fid,
|
|
1263
|
-
type:
|
|
1347
|
+
type: fd.kind === "url" ? "url" : "text",
|
|
1264
1348
|
spellCheck: false,
|
|
1265
|
-
placeholder:
|
|
1266
|
-
required:
|
|
1267
|
-
value: d.values[
|
|
1268
|
-
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 } })
|
|
1269
1353
|
}
|
|
1270
1354
|
),
|
|
1271
|
-
|
|
1272
|
-
] },
|
|
1355
|
+
description ? /* @__PURE__ */ jsx(FieldDescription, { children: description }) : null
|
|
1356
|
+
] }, fd.key);
|
|
1273
1357
|
}),
|
|
1274
1358
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
1275
1359
|
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", disabled: busy, onClick: () => setDraft(null), children: t.cancel }),
|
|
1276
|
-
/* @__PURE__ */ jsx(Button, { size: "sm", disabled:
|
|
1360
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", disabled: locked || !d.id || !spec, onClick: () => void saveDraft(), children: t.save })
|
|
1277
1361
|
] })
|
|
1278
1362
|
] });
|
|
1279
1363
|
};
|
|
1280
|
-
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));
|
|
1281
1432
|
return (
|
|
1282
1433
|
// min-w-0 on every FieldSet: a fieldset is min-content wide by default, so one long URL
|
|
1283
1434
|
// would widen the whole screen instead of truncating.
|
|
1284
1435
|
/* @__PURE__ */ jsxs(FieldGroup, { className, children: [
|
|
1436
|
+
readOnly ? /* @__PURE__ */ jsx(Alert, { "data-testid": "llm-read-only", children: /* @__PURE__ */ jsx(AlertDescription, { children: t.readOnly }) }) : null,
|
|
1285
1437
|
error ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: error }) }) : null,
|
|
1438
|
+
header,
|
|
1286
1439
|
/* @__PURE__ */ jsxs(FieldSet, { className: "min-w-0", children: [
|
|
1287
1440
|
/* @__PURE__ */ jsx(FieldLegend, { children: t.slots }),
|
|
1288
1441
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.slotsHint }),
|
|
1289
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;
|
|
1290
1445
|
const current = provider(slot.provider);
|
|
1291
1446
|
const choices = state.providers.filter((p) => p.id === slot.provider || serves(slot, p));
|
|
1292
1447
|
const known = slot.provider ? models[slot.provider] : void 0;
|
|
@@ -1297,25 +1452,25 @@ function LlmSettings({
|
|
|
1297
1452
|
const missing = known !== void 0 && chosen !== "" && !known.some((m) => m.id === chosen);
|
|
1298
1453
|
const commit = () => {
|
|
1299
1454
|
if (!slot.provider || draftModel === (slot.model ?? "")) return;
|
|
1300
|
-
void
|
|
1455
|
+
void bindSlot(slot.name, slot.provider, draftModel);
|
|
1301
1456
|
};
|
|
1302
1457
|
return /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-2 px-3 py-3", "data-testid": `slot-${slot.name}`, children: [
|
|
1303
1458
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start gap-x-6 gap-y-2", children: [
|
|
1304
1459
|
/* @__PURE__ */ jsxs("div", { className: "min-w-40 flex-1", children: [
|
|
1305
1460
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1306
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children:
|
|
1461
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: label }),
|
|
1307
1462
|
slot.local_only ? /* @__PURE__ */ jsx(Badge, { variant: "outline", title: t.localOnlyHint, children: t.localOnly }) : null
|
|
1308
1463
|
] }),
|
|
1309
|
-
|
|
1464
|
+
description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: description }) : null
|
|
1310
1465
|
] }),
|
|
1311
1466
|
/* @__PURE__ */ jsxs("div", { className: "flex w-full gap-2 sm:w-auto", children: [
|
|
1312
1467
|
/* @__PURE__ */ jsxs(
|
|
1313
1468
|
NativeSelect,
|
|
1314
1469
|
{
|
|
1315
|
-
"aria-label": `${
|
|
1470
|
+
"aria-label": f.slotProvider?.(label) ?? `${label}: ${t.providers}`,
|
|
1316
1471
|
className: "sm:w-40",
|
|
1317
1472
|
value: slot.provider ?? "",
|
|
1318
|
-
disabled:
|
|
1473
|
+
disabled: locked,
|
|
1319
1474
|
onChange: (e) => {
|
|
1320
1475
|
const next = e.target.value;
|
|
1321
1476
|
setTyped((prev) => {
|
|
@@ -1323,24 +1478,42 @@ function LlmSettings({
|
|
|
1323
1478
|
delete rest[slot.name];
|
|
1324
1479
|
return rest;
|
|
1325
1480
|
});
|
|
1326
|
-
|
|
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
|
+
);
|
|
1327
1500
|
},
|
|
1328
1501
|
children: [
|
|
1329
1502
|
/* @__PURE__ */ jsx(NativeSelectOption, { value: "", children: t.notSet }),
|
|
1330
|
-
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))
|
|
1331
1504
|
]
|
|
1332
1505
|
}
|
|
1333
1506
|
),
|
|
1334
1507
|
/* @__PURE__ */ jsx(
|
|
1335
1508
|
Input,
|
|
1336
1509
|
{
|
|
1337
|
-
"aria-label": `${
|
|
1510
|
+
"aria-label": f.slotModel?.(label) ?? `${label}: ${t.model}`,
|
|
1338
1511
|
title: t.modelHint,
|
|
1339
1512
|
className: "sm:w-56 [&::-webkit-calendar-picker-indicator]:opacity-30",
|
|
1340
1513
|
list: `${id}-models-${slot.name}`,
|
|
1341
1514
|
spellCheck: false,
|
|
1342
1515
|
placeholder: t.model,
|
|
1343
|
-
disabled:
|
|
1516
|
+
disabled: locked || !slot.provider,
|
|
1344
1517
|
value: draftModel,
|
|
1345
1518
|
onChange: (e) => setTyped((prev) => ({ ...prev, [slot.name]: e.target.value })),
|
|
1346
1519
|
onBlur: commit,
|
|
@@ -1349,51 +1522,16 @@ function LlmSettings({
|
|
|
1349
1522
|
}
|
|
1350
1523
|
}
|
|
1351
1524
|
),
|
|
1352
|
-
/* @__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)) })
|
|
1353
1526
|
] })
|
|
1354
1527
|
] }),
|
|
1355
1528
|
slot.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: slot.error }) : null,
|
|
1356
1529
|
api.slotNote?.(slot.name),
|
|
1357
1530
|
current?.manages && api.pull && missing && !pulling ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-3", children: [
|
|
1358
1531
|
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: t.notDownloaded }),
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
Button,
|
|
1361
|
-
{
|
|
1362
|
-
size: "xs",
|
|
1363
|
-
variant: "outline",
|
|
1364
|
-
disabled: busy,
|
|
1365
|
-
onClick: () => {
|
|
1366
|
-
const key = pullKey(current.id, chosen);
|
|
1367
|
-
const end = () => setPulls((prev) => {
|
|
1368
|
-
const rest = { ...prev };
|
|
1369
|
-
delete rest[key];
|
|
1370
|
-
return rest;
|
|
1371
|
-
});
|
|
1372
|
-
setPulls((prev) => ({ ...prev, [key]: { provider: current.id, model: chosen, status: "", done: 0, total: 0 } }));
|
|
1373
|
-
api.pull?.(current.id, chosen).then(
|
|
1374
|
-
(done) => {
|
|
1375
|
-
end();
|
|
1376
|
-
if (done) listModels(current.id);
|
|
1377
|
-
},
|
|
1378
|
-
(err) => {
|
|
1379
|
-
end();
|
|
1380
|
-
setError(messageOf2(err));
|
|
1381
|
-
}
|
|
1382
|
-
);
|
|
1383
|
-
},
|
|
1384
|
-
children: [
|
|
1385
|
-
t.download,
|
|
1386
|
-
" ",
|
|
1387
|
-
chosen
|
|
1388
|
-
]
|
|
1389
|
-
}
|
|
1390
|
-
)
|
|
1532
|
+
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "outline", disabled: locked, onClick: () => startPull(current.id, chosen), children: f.downloadModel?.(chosen) ?? `${t.download} ${chosen}` })
|
|
1391
1533
|
] }) : null,
|
|
1392
|
-
pulling && current ?
|
|
1393
|
-
/* @__PURE__ */ jsx(Progress, { className: "flex-1", value: pull.total > 0 ? pull.done / pull.total * 100 : 0 }),
|
|
1394
|
-
/* @__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 }),
|
|
1395
|
-
api.cancelPull ? /* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => void api.cancelPull?.(current.id, pull.model), children: t.cancel }) : null
|
|
1396
|
-
] }) : null
|
|
1534
|
+
pulling && current ? progress(pull, `pull-${slot.name}`) : null
|
|
1397
1535
|
] }, slot.name);
|
|
1398
1536
|
}) })
|
|
1399
1537
|
] }),
|
|
@@ -1404,95 +1542,134 @@ function LlmSettings({
|
|
|
1404
1542
|
/* @__PURE__ */ jsx(FieldLegend, { children: t.providers }),
|
|
1405
1543
|
/* @__PURE__ */ jsx(FieldDescription, { children: t.providersHint })
|
|
1406
1544
|
] }),
|
|
1407
|
-
/* @__PURE__ */ jsxs(
|
|
1408
|
-
Button,
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
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
|
+
] })
|
|
1420
1564
|
] }),
|
|
1565
|
+
driversError ? /* @__PURE__ */ jsxs("p", { className: "text-destructive text-xs", "data-testid": "drivers-failed", children: [
|
|
1566
|
+
t.driversFailed,
|
|
1567
|
+
" ",
|
|
1568
|
+
driversError
|
|
1569
|
+
] }) : null,
|
|
1421
1570
|
draft && !draft.existing ? form(draft) : null,
|
|
1422
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(
|
|
1423
|
-
(p) => draft?.existing?.id === p.id ? /* @__PURE__ */ jsx("li", { className: "p-0", children: form(draft) }, p.id) : /* @__PURE__ */ jsxs("li", {
|
|
1424
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1425
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
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
|
|
1434
1586
|
] }),
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
p.editable ? removing === p.id ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1438
|
-
/* @__PURE__ */ jsx(Button, { size: "xs", variant: "ghost", onClick: () => setRemoving(null), children: t.keep }),
|
|
1439
|
-
/* @__PURE__ */ jsxs(
|
|
1587
|
+
api.providerExtra?.(p),
|
|
1588
|
+
p.manages ? /* @__PURE__ */ jsxs(
|
|
1440
1589
|
Button,
|
|
1441
1590
|
{
|
|
1442
1591
|
size: "xs",
|
|
1443
|
-
variant: "
|
|
1444
|
-
|
|
1592
|
+
variant: library === p.id ? "secondary" : "ghost",
|
|
1593
|
+
"aria-expanded": library === p.id,
|
|
1445
1594
|
onClick: () => {
|
|
1446
|
-
|
|
1447
|
-
|
|
1595
|
+
const open = library === p.id ? null : p.id;
|
|
1596
|
+
setLibrary(open);
|
|
1597
|
+
if (open) listModels(open);
|
|
1448
1598
|
},
|
|
1449
1599
|
children: [
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
p.id
|
|
1600
|
+
/* @__PURE__ */ jsx(ListIcon, {}),
|
|
1601
|
+
t.models
|
|
1453
1602
|
]
|
|
1454
1603
|
}
|
|
1455
|
-
)
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
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
|
|
1470
1646
|
] }, p.id)
|
|
1471
1647
|
) }),
|
|
1472
1648
|
unused.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1473
1649
|
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: t.running }),
|
|
1474
|
-
/* @__PURE__ */ jsx("ul", { className: "divide-y border border-dashed", children: unused.map((
|
|
1475
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children:
|
|
1476
|
-
|
|
1477
|
-
/* @__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 }),
|
|
1478
1654
|
/* @__PURE__ */ jsx(
|
|
1479
1655
|
Button,
|
|
1480
1656
|
{
|
|
1481
1657
|
size: "xs",
|
|
1482
1658
|
variant: "outline",
|
|
1483
|
-
"aria-label": `${t.addFound} ${
|
|
1484
|
-
disabled:
|
|
1485
|
-
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)),
|
|
1486
1662
|
children: t.addFound
|
|
1487
1663
|
}
|
|
1488
1664
|
)
|
|
1489
|
-
] },
|
|
1665
|
+
] }, f2.base_url)) })
|
|
1490
1666
|
] }) : null
|
|
1491
|
-
] })
|
|
1667
|
+
] }),
|
|
1668
|
+
footer
|
|
1492
1669
|
] })
|
|
1493
1670
|
);
|
|
1494
1671
|
}
|
|
1495
1672
|
|
|
1496
|
-
export { 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 };
|
|
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 };
|
|
1497
1674
|
//# sourceMappingURL=index.js.map
|
|
1498
1675
|
//# sourceMappingURL=index.js.map
|