@acarmisc/backstage-plugin-litellm 0.21.2 → 0.21.3
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/index.cjs.js +58 -7
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.esm.js +57 -6
- package/dist/index.esm.js.map +3 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3393,6 +3393,7 @@ import TableCell5 from "@mui/material/TableCell";
|
|
|
3393
3393
|
import TableContainer5 from "@mui/material/TableContainer";
|
|
3394
3394
|
import TableHead5 from "@mui/material/TableHead";
|
|
3395
3395
|
import TableRow5 from "@mui/material/TableRow";
|
|
3396
|
+
import TableSortLabel2 from "@mui/material/TableSortLabel";
|
|
3396
3397
|
import Typography9 from "@mui/material/Typography";
|
|
3397
3398
|
import MenuItem4 from "@mui/material/MenuItem";
|
|
3398
3399
|
import Select from "@mui/material/Select";
|
|
@@ -3434,6 +3435,8 @@ var init_ModelsTable = __esm({
|
|
|
3434
3435
|
const [selectedTeamId, setSelectedTeamId] = useState7("");
|
|
3435
3436
|
const [filterText, setFilterText] = useState7("");
|
|
3436
3437
|
const [copiedSnackbar, setCopiedSnackbar] = useState7(false);
|
|
3438
|
+
const [sortKey, setSortKey] = useState7("model_name");
|
|
3439
|
+
const [sortDirection, setSortDirection] = useState7("asc");
|
|
3437
3440
|
const selectedTeam = useMemo7(
|
|
3438
3441
|
() => teams.find((t) => t.team_id === selectedTeamId) ?? null,
|
|
3439
3442
|
[teams, selectedTeamId]
|
|
@@ -3444,14 +3447,62 @@ var init_ModelsTable = __esm({
|
|
|
3444
3447
|
}, [allModels, selectedTeam]);
|
|
3445
3448
|
const filteredModels = useMemo7(() => {
|
|
3446
3449
|
const q = filterText.trim().toLowerCase();
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3450
|
+
let models = teamModels;
|
|
3451
|
+
if (q) {
|
|
3452
|
+
models = teamModels.filter(
|
|
3453
|
+
(model) => model.model_name.toLowerCase().includes(q) || (model.access_groups || []).some((group) => group.toLowerCase().includes(q))
|
|
3454
|
+
);
|
|
3455
|
+
}
|
|
3456
|
+
return [...models].sort((a, b) => {
|
|
3457
|
+
let aVal;
|
|
3458
|
+
let bVal;
|
|
3459
|
+
switch (sortKey) {
|
|
3460
|
+
case "model_name":
|
|
3461
|
+
aVal = a.model_name;
|
|
3462
|
+
bVal = b.model_name;
|
|
3463
|
+
break;
|
|
3464
|
+
case "mode":
|
|
3465
|
+
aVal = a.mode;
|
|
3466
|
+
bVal = b.mode;
|
|
3467
|
+
break;
|
|
3468
|
+
case "input_cost_per_token":
|
|
3469
|
+
aVal = a.input_cost_per_token ?? 0;
|
|
3470
|
+
bVal = b.input_cost_per_token ?? 0;
|
|
3471
|
+
break;
|
|
3472
|
+
case "output_cost_per_token":
|
|
3473
|
+
aVal = a.output_cost_per_token ?? 0;
|
|
3474
|
+
bVal = b.output_cost_per_token ?? 0;
|
|
3475
|
+
break;
|
|
3476
|
+
case "max_input_tokens":
|
|
3477
|
+
aVal = a.max_input_tokens ?? 0;
|
|
3478
|
+
bVal = b.max_input_tokens ?? 0;
|
|
3479
|
+
break;
|
|
3480
|
+
case "max_output_tokens":
|
|
3481
|
+
aVal = a.max_output_tokens ?? 0;
|
|
3482
|
+
bVal = b.max_output_tokens ?? 0;
|
|
3483
|
+
break;
|
|
3484
|
+
default:
|
|
3485
|
+
return 0;
|
|
3486
|
+
}
|
|
3487
|
+
if (aVal === void 0 || aVal === null) aVal = "";
|
|
3488
|
+
if (bVal === void 0 || bVal === null) bVal = "";
|
|
3489
|
+
if (typeof aVal === "string" && typeof bVal === "string") {
|
|
3490
|
+
return sortDirection === "asc" ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal);
|
|
3491
|
+
}
|
|
3492
|
+
return sortDirection === "asc" ? aVal - bVal : bVal - aVal;
|
|
3493
|
+
});
|
|
3494
|
+
}, [teamModels, filterText, sortKey, sortDirection]);
|
|
3452
3495
|
const handleCopyModelId = useCallback((modelId) => {
|
|
3453
3496
|
navigator.clipboard.writeText(modelId).then(() => setCopiedSnackbar(true));
|
|
3454
3497
|
}, []);
|
|
3498
|
+
const handleSort = useCallback((key) => {
|
|
3499
|
+
if (sortKey === key) {
|
|
3500
|
+
setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
|
|
3501
|
+
} else {
|
|
3502
|
+
setSortKey(key);
|
|
3503
|
+
setSortDirection("asc");
|
|
3504
|
+
}
|
|
3505
|
+
}, [sortKey]);
|
|
3455
3506
|
const modeColor = (mode) => {
|
|
3456
3507
|
switch (mode) {
|
|
3457
3508
|
case "chat":
|
|
@@ -3517,7 +3568,7 @@ var init_ModelsTable = __esm({
|
|
|
3517
3568
|
hint: "Try a different search term"
|
|
3518
3569
|
}
|
|
3519
3570
|
),
|
|
3520
|
-
!loading && filteredModels.length > 0 && /* @__PURE__ */ React9.createElement(TableContainer5, null, /* @__PURE__ */ React9.createElement(Table5, { size: "small", sx: dataTableSx }, /* @__PURE__ */ React9.createElement(TableHead5, null, /* @__PURE__ */ React9.createElement(TableRow5, null, /* @__PURE__ */ React9.createElement(TableCell5,
|
|
3571
|
+
!loading && filteredModels.length > 0 && /* @__PURE__ */ React9.createElement(TableContainer5, null, /* @__PURE__ */ React9.createElement(Table5, { size: "small", sx: dataTableSx }, /* @__PURE__ */ React9.createElement(TableHead5, null, /* @__PURE__ */ React9.createElement(TableRow5, null, /* @__PURE__ */ React9.createElement(TableCell5, { sortDirection: sortKey === "model_name" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "model_name", direction: sortKey === "model_name" ? sortDirection : "asc", onClick: () => handleSort("model_name") }, "Model ID")), /* @__PURE__ */ React9.createElement(TableCell5, { sortDirection: sortKey === "mode" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "mode", direction: sortKey === "mode" ? sortDirection : "asc", onClick: () => handleSort("mode") }, "Mode")), /* @__PURE__ */ React9.createElement(TableCell5, { align: "right", sortDirection: sortKey === "input_cost_per_token" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "input_cost_per_token", direction: sortKey === "input_cost_per_token" ? sortDirection : "asc", onClick: () => handleSort("input_cost_per_token") }, "Input Cost")), /* @__PURE__ */ React9.createElement(TableCell5, { align: "right", sortDirection: sortKey === "output_cost_per_token" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "output_cost_per_token", direction: sortKey === "output_cost_per_token" ? sortDirection : "asc", onClick: () => handleSort("output_cost_per_token") }, "Output Cost")), /* @__PURE__ */ React9.createElement(TableCell5, { align: "right", sortDirection: sortKey === "max_input_tokens" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "max_input_tokens", direction: sortKey === "max_input_tokens" ? sortDirection : "asc", onClick: () => handleSort("max_input_tokens") }, "Max Input")), /* @__PURE__ */ React9.createElement(TableCell5, { align: "right", sortDirection: sortKey === "max_output_tokens" ? sortDirection : false }, /* @__PURE__ */ React9.createElement(TableSortLabel2, { active: sortKey === "max_output_tokens", direction: sortKey === "max_output_tokens" ? sortDirection : "asc", onClick: () => handleSort("max_output_tokens") }, "Max Output")), /* @__PURE__ */ React9.createElement(TableCell5, null, "Capabilities"))), /* @__PURE__ */ React9.createElement(TableBody5, null, filteredModels.map((m) => /* @__PURE__ */ React9.createElement(TableRow5, { key: m.model_name, hover: true }, /* @__PURE__ */ React9.createElement(TableCell5, null, /* @__PURE__ */ React9.createElement(Box9, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React9.createElement(Tooltip3, { title: m.model_name, placement: "top" }, /* @__PURE__ */ React9.createElement(
|
|
3521
3572
|
"span",
|
|
3522
3573
|
{
|
|
3523
3574
|
role: "button",
|