@acarmisc/backstage-plugin-litellm 0.21.0 → 0.21.1
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/budget.d.ts +4 -3
- package/dist/index.cjs.js +22 -11
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.esm.js +22 -11
- package/dist/index.esm.js.map +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2802,16 +2802,14 @@ function buildBudgetSummary(user, teams, keys, maxKeys = 3) {
|
|
|
2802
2802
|
};
|
|
2803
2803
|
}
|
|
2804
2804
|
function budgetHeadline(summary) {
|
|
2805
|
-
const
|
|
2806
|
-
...summary.keys
|
|
2807
|
-
...summary.user ? [summary.user
|
|
2808
|
-
...summary.teams
|
|
2805
|
+
const all = [
|
|
2806
|
+
...summary.keys,
|
|
2807
|
+
...summary.user ? [summary.user] : [],
|
|
2808
|
+
...summary.teams
|
|
2809
2809
|
];
|
|
2810
2810
|
const count = summary.keys.length + summary.hiddenBudgetedKeys + (summary.user ? 1 : 0) + summary.teams.length;
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
closestPct: pcts.length ? Math.max(...pcts) : null
|
|
2814
|
-
};
|
|
2811
|
+
const closest = all.length ? all.reduce((a, b) => b.pct > a.pct ? b : a) : null;
|
|
2812
|
+
return { count, closest };
|
|
2815
2813
|
}
|
|
2816
2814
|
function fmtBudgetDuration(duration) {
|
|
2817
2815
|
if (!duration) return null;
|
|
@@ -2861,7 +2859,7 @@ function levelToneColor(tone, theme) {
|
|
|
2861
2859
|
return theme.palette.primary.main;
|
|
2862
2860
|
}
|
|
2863
2861
|
}
|
|
2864
|
-
var LevelFrame, EmptyLimitCard, LimitCard, TaggedLimit, FullBody, CompactBody, LiteLLMBudgetWidget;
|
|
2862
|
+
var LevelFrame, EmptyLimitCard, LimitCard, CLOSEST_LEVEL_LABEL, TaggedLimit, FullBody, CompactBody, LiteLLMBudgetWidget;
|
|
2865
2863
|
var init_LiteLLMBudgetWidget = __esm({
|
|
2866
2864
|
"src/components/LiteLLMBudgetWidget.tsx"() {
|
|
2867
2865
|
"use strict";
|
|
@@ -2973,6 +2971,11 @@ var init_LiteLLMBudgetWidget = __esm({
|
|
|
2973
2971
|
/* @__PURE__ */ React7.createElement(Typography7, { variant: "caption", color: "text.secondary" }, fmtBudgetDuration(limit.budgetDuration) ? `resets ${fmtBudgetDuration(limit.budgetDuration)}` : "never resets")
|
|
2974
2972
|
));
|
|
2975
2973
|
};
|
|
2974
|
+
CLOSEST_LEVEL_LABEL = {
|
|
2975
|
+
key: "key",
|
|
2976
|
+
user: "personal",
|
|
2977
|
+
team: "team"
|
|
2978
|
+
};
|
|
2976
2979
|
TaggedLimit = ({ limit }) => {
|
|
2977
2980
|
const tone = budgetTone2(limit.pct);
|
|
2978
2981
|
return /* @__PURE__ */ React7.createElement(Box7, null, /* @__PURE__ */ React7.createElement(
|
|
@@ -3079,7 +3082,9 @@ var init_LiteLLMBudgetWidget = __esm({
|
|
|
3079
3082
|
);
|
|
3080
3083
|
const headline = useMemo6(() => budgetHeadline(summary), [summary]);
|
|
3081
3084
|
const limitsWord = `${headline.count} limit${headline.count === 1 ? "" : "s"}`;
|
|
3082
|
-
const closestWord = headline.
|
|
3085
|
+
const closestWord = headline.closest === null ? "" : ` \xB7 closest: ${CLOSEST_LEVEL_LABEL[headline.closest.kind]} ${Math.round(
|
|
3086
|
+
headline.closest.pct
|
|
3087
|
+
)}%`;
|
|
3083
3088
|
const summaryText = headline.count === 0 ? "no limits apply" : `${limitsWord}${closestWord}`;
|
|
3084
3089
|
const body = /* @__PURE__ */ React7.createElement(React7.Fragment, null, loading && /* @__PURE__ */ React7.createElement(Box7, { display: "flex", justifyContent: "center", alignItems: "center", minHeight: 140 }, /* @__PURE__ */ React7.createElement(CircularProgress4, { size: 32 })), !loading && error && /* @__PURE__ */ React7.createElement(Alert3, { severity: "error", sx: { mt: 0.5 } }, error), !loading && !error && (compact ? /* @__PURE__ */ React7.createElement(CompactBody, { summary }) : /* @__PURE__ */ React7.createElement(FullBody, { summary })));
|
|
3085
3090
|
return /* @__PURE__ */ React7.createElement(Paper5, { sx: { p: 2 } }, collapsible ? /* @__PURE__ */ React7.createElement(
|
|
@@ -3095,7 +3100,13 @@ var init_LiteLLMBudgetWidget = __esm({
|
|
|
3095
3100
|
mb: expanded ? 1.5 : 0
|
|
3096
3101
|
}
|
|
3097
3102
|
},
|
|
3098
|
-
/* @__PURE__ */ React7.createElement(Box7, { sx: { minWidth: 0, flex: 1
|
|
3103
|
+
/* @__PURE__ */ React7.createElement(Box7, { sx: { minWidth: 0, flex: 1 } }, /* @__PURE__ */ React7.createElement(Typography7, { variant: "h6", lineHeight: 1.2 }, title), !loading && !error && /* @__PURE__ */ React7.createElement(Box7, { sx: { mt: 0.5 } }, /* @__PURE__ */ React7.createElement(
|
|
3104
|
+
StatusPill,
|
|
3105
|
+
{
|
|
3106
|
+
label: summaryText,
|
|
3107
|
+
tone: budgetTone2(headline.closest?.pct ?? 0)
|
|
3108
|
+
}
|
|
3109
|
+
))),
|
|
3099
3110
|
/* @__PURE__ */ React7.createElement(
|
|
3100
3111
|
IconButton4,
|
|
3101
3112
|
{
|