@acarmisc/backstage-plugin-litellm 0.35.0 → 0.36.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/api.d.ts +9 -0
- package/dist/components/ConnectPage.d.ts +7 -0
- package/dist/connect.d.ts +8 -0
- package/dist/index.cjs.js +289 -150
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +274 -135
- package/dist/index.esm.js.map +4 -4
- package/dist/plugin.d.ts +40 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -235,6 +235,10 @@ var init_api = __esm({
|
|
|
235
235
|
async listModels() {
|
|
236
236
|
return this.get("/models");
|
|
237
237
|
}
|
|
238
|
+
/** Mints (or rotates) the caller's connect-flow key, optionally bound to one of their teams. */
|
|
239
|
+
async connectLocalClient(redirectUri, team) {
|
|
240
|
+
return this.post("/opencode/connect", { redirect_uri: redirectUri, team });
|
|
241
|
+
}
|
|
238
242
|
async getTeams() {
|
|
239
243
|
return this.get("/teams");
|
|
240
244
|
}
|
|
@@ -6739,6 +6743,131 @@ var init_LiteLLMPage = __esm({
|
|
|
6739
6743
|
}
|
|
6740
6744
|
});
|
|
6741
6745
|
|
|
6746
|
+
// src/connect.ts
|
|
6747
|
+
function isLoopbackCallback(uri) {
|
|
6748
|
+
if (!uri) return false;
|
|
6749
|
+
try {
|
|
6750
|
+
const url = new URL(uri);
|
|
6751
|
+
return url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1") && url.pathname === "/callback" && url.search === "" && url.hash === "";
|
|
6752
|
+
} catch {
|
|
6753
|
+
return false;
|
|
6754
|
+
}
|
|
6755
|
+
}
|
|
6756
|
+
function postToLoopback(redirectUri, fields) {
|
|
6757
|
+
const form = document.createElement("form");
|
|
6758
|
+
form.method = "POST";
|
|
6759
|
+
form.action = redirectUri;
|
|
6760
|
+
for (const [name, value] of fields) {
|
|
6761
|
+
const input = document.createElement("input");
|
|
6762
|
+
input.type = "hidden";
|
|
6763
|
+
input.name = name;
|
|
6764
|
+
input.value = value;
|
|
6765
|
+
form.appendChild(input);
|
|
6766
|
+
}
|
|
6767
|
+
document.body.appendChild(form);
|
|
6768
|
+
form.submit();
|
|
6769
|
+
}
|
|
6770
|
+
var init_connect = __esm({
|
|
6771
|
+
"src/connect.ts"() {
|
|
6772
|
+
"use strict";
|
|
6773
|
+
}
|
|
6774
|
+
});
|
|
6775
|
+
|
|
6776
|
+
// src/components/ConnectPage.tsx
|
|
6777
|
+
var ConnectPage_exports = {};
|
|
6778
|
+
__export(ConnectPage_exports, {
|
|
6779
|
+
ConnectPage: () => ConnectPage
|
|
6780
|
+
});
|
|
6781
|
+
import { useState as useState13 } from "react";
|
|
6782
|
+
import Alert7 from "@mui/material/Alert";
|
|
6783
|
+
import Box18 from "@mui/material/Box";
|
|
6784
|
+
import Button8 from "@mui/material/Button";
|
|
6785
|
+
import Checkbox3 from "@mui/material/Checkbox";
|
|
6786
|
+
import FormControlLabel3 from "@mui/material/FormControlLabel";
|
|
6787
|
+
import FormGroup from "@mui/material/FormGroup";
|
|
6788
|
+
import Paper9 from "@mui/material/Paper";
|
|
6789
|
+
import Typography16 from "@mui/material/Typography";
|
|
6790
|
+
import { useSearchParams as useSearchParams2 } from "react-router-dom";
|
|
6791
|
+
import { useAsync as useAsync3 } from "react-use";
|
|
6792
|
+
import { useApi as useApi5 } from "@backstage/core-plugin-api";
|
|
6793
|
+
import { Content as Content2, Progress as Progress2 } from "@backstage/core-components";
|
|
6794
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6795
|
+
var ConnectPage;
|
|
6796
|
+
var init_ConnectPage = __esm({
|
|
6797
|
+
"src/components/ConnectPage.tsx"() {
|
|
6798
|
+
"use strict";
|
|
6799
|
+
init_api();
|
|
6800
|
+
init_connect();
|
|
6801
|
+
ConnectPage = () => {
|
|
6802
|
+
const api = useApi5(liteLlmApiRef);
|
|
6803
|
+
const [params] = useSearchParams2();
|
|
6804
|
+
const redirectUri = params.get("redirect_uri");
|
|
6805
|
+
const state = params.get("state") ?? "";
|
|
6806
|
+
const client = params.get("client") || "a local application";
|
|
6807
|
+
const teams = useAsync3(() => api.getTeams(), [api]);
|
|
6808
|
+
const [selected, setSelected] = useState13();
|
|
6809
|
+
const [busy, setBusy] = useState13(false);
|
|
6810
|
+
const [error, setError] = useState13();
|
|
6811
|
+
if (!isLoopbackCallback(redirectUri)) {
|
|
6812
|
+
return /* @__PURE__ */ jsx19(Content2, { children: /* @__PURE__ */ jsx19(Alert7, { severity: "error", children: "Invalid connection link: redirect_uri must be http://localhost:<port>/callback." }) });
|
|
6813
|
+
}
|
|
6814
|
+
if (teams.loading) return /* @__PURE__ */ jsx19(Progress2, {});
|
|
6815
|
+
const all = teams.value ?? [];
|
|
6816
|
+
const chosen = selected ?? new Set(all.map((t) => t.team_id));
|
|
6817
|
+
const toggle = (id) => {
|
|
6818
|
+
const next = new Set(chosen);
|
|
6819
|
+
if (!next.delete(id)) next.add(id);
|
|
6820
|
+
setSelected(next);
|
|
6821
|
+
};
|
|
6822
|
+
const connect = async () => {
|
|
6823
|
+
setBusy(true);
|
|
6824
|
+
setError(void 0);
|
|
6825
|
+
try {
|
|
6826
|
+
const ids = all.length ? all.filter((t) => chosen.has(t.team_id)).map((t) => t.team_id) : [void 0];
|
|
6827
|
+
const keys = [];
|
|
6828
|
+
for (const id of ids) keys.push(["key", (await api.connectLocalClient(redirectUri, id)).key]);
|
|
6829
|
+
postToLoopback(redirectUri, [["state", state], ...keys]);
|
|
6830
|
+
} catch (e) {
|
|
6831
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
6832
|
+
setBusy(false);
|
|
6833
|
+
}
|
|
6834
|
+
};
|
|
6835
|
+
return /* @__PURE__ */ jsx19(Content2, { children: /* @__PURE__ */ jsx19(Box18, { maxWidth: 520, mx: "auto", mt: 4, children: /* @__PURE__ */ jsxs18(Paper9, { sx: { p: 3 }, children: [
|
|
6836
|
+
/* @__PURE__ */ jsxs18(Typography16, { variant: "h5", gutterBottom: true, children: [
|
|
6837
|
+
"Connect ",
|
|
6838
|
+
client
|
|
6839
|
+
] }),
|
|
6840
|
+
/* @__PURE__ */ jsxs18(Typography16, { variant: "body2", color: "text.secondary", paragraph: true, children: [
|
|
6841
|
+
client,
|
|
6842
|
+
" will receive an API key for each selected team. Connecting again replaces the keys created by a previous connection."
|
|
6843
|
+
] }),
|
|
6844
|
+
teams.error && /* @__PURE__ */ jsxs18(Alert7, { severity: "error", children: [
|
|
6845
|
+
"Could not load your teams: ",
|
|
6846
|
+
teams.error.message
|
|
6847
|
+
] }),
|
|
6848
|
+
all.length > 0 && /* @__PURE__ */ jsx19(FormGroup, { sx: { mb: 2 }, children: all.map((t) => /* @__PURE__ */ jsx19(
|
|
6849
|
+
FormControlLabel3,
|
|
6850
|
+
{
|
|
6851
|
+
control: /* @__PURE__ */ jsx19(Checkbox3, { checked: chosen.has(t.team_id), onChange: () => toggle(t.team_id) }),
|
|
6852
|
+
label: t.team_alias ?? t.team_id
|
|
6853
|
+
},
|
|
6854
|
+
t.team_id
|
|
6855
|
+
)) }),
|
|
6856
|
+
error && /* @__PURE__ */ jsx19(Alert7, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
6857
|
+
/* @__PURE__ */ jsx19(
|
|
6858
|
+
Button8,
|
|
6859
|
+
{
|
|
6860
|
+
variant: "contained",
|
|
6861
|
+
onClick: connect,
|
|
6862
|
+
disabled: busy || !!teams.error || all.length > 0 && chosen.size === 0,
|
|
6863
|
+
children: busy ? "Connecting\u2026" : "Connect"
|
|
6864
|
+
}
|
|
6865
|
+
)
|
|
6866
|
+
] }) }) });
|
|
6867
|
+
};
|
|
6868
|
+
}
|
|
6869
|
+
});
|
|
6870
|
+
|
|
6742
6871
|
// src/plugin.tsx
|
|
6743
6872
|
init_api();
|
|
6744
6873
|
init_routes();
|
|
@@ -6750,7 +6879,7 @@ import {
|
|
|
6750
6879
|
fetchApiRef,
|
|
6751
6880
|
discoveryApiRef
|
|
6752
6881
|
} from "@backstage/frontend-plugin-api";
|
|
6753
|
-
import { jsx as
|
|
6882
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
6754
6883
|
var liteLlmApi = ApiBlueprint.make({
|
|
6755
6884
|
params: (defineParams) => defineParams({
|
|
6756
6885
|
api: liteLlmApiRef,
|
|
@@ -6762,11 +6891,21 @@ var liteLlmPage = PageBlueprint.make({
|
|
|
6762
6891
|
params: {
|
|
6763
6892
|
path: "/litellm",
|
|
6764
6893
|
title: "LiteLLM",
|
|
6765
|
-
icon: /* @__PURE__ */
|
|
6894
|
+
icon: /* @__PURE__ */ jsx20(TrendingUpIcon, {}),
|
|
6766
6895
|
routeRef: rootRouteRef,
|
|
6767
6896
|
loader: async () => {
|
|
6768
6897
|
const { LiteLLMPage: LiteLLMPage2 } = await Promise.resolve().then(() => (init_LiteLLMPage(), LiteLLMPage_exports));
|
|
6769
|
-
return /* @__PURE__ */
|
|
6898
|
+
return /* @__PURE__ */ jsx20(LiteLLMPage2, {});
|
|
6899
|
+
}
|
|
6900
|
+
}
|
|
6901
|
+
});
|
|
6902
|
+
var liteLlmConnectPage = PageBlueprint.make({
|
|
6903
|
+
name: "connect",
|
|
6904
|
+
params: {
|
|
6905
|
+
path: "/litellm/connect",
|
|
6906
|
+
loader: async () => {
|
|
6907
|
+
const { ConnectPage: ConnectPage2 } = await Promise.resolve().then(() => (init_ConnectPage(), ConnectPage_exports));
|
|
6908
|
+
return /* @__PURE__ */ jsx20(ConnectPage2, {});
|
|
6770
6909
|
}
|
|
6771
6910
|
}
|
|
6772
6911
|
});
|
|
@@ -6775,7 +6914,7 @@ var litellmPlugin = createFrontendPlugin({
|
|
|
6775
6914
|
routes: {
|
|
6776
6915
|
root: rootRouteRef
|
|
6777
6916
|
},
|
|
6778
|
-
extensions: [liteLlmApi, liteLlmPage]
|
|
6917
|
+
extensions: [liteLlmApi, liteLlmPage, liteLlmConnectPage]
|
|
6779
6918
|
});
|
|
6780
6919
|
|
|
6781
6920
|
// src/index.ts
|
|
@@ -6793,16 +6932,16 @@ init_format();
|
|
|
6793
6932
|
init_dates();
|
|
6794
6933
|
init_ui();
|
|
6795
6934
|
init_widgetState();
|
|
6796
|
-
import { useEffect as useEffect7, useMemo as useMemo10, useState as
|
|
6797
|
-
import
|
|
6798
|
-
import
|
|
6799
|
-
import
|
|
6935
|
+
import { useEffect as useEffect7, useMemo as useMemo10, useState as useState14 } from "react";
|
|
6936
|
+
import Paper10 from "@mui/material/Paper";
|
|
6937
|
+
import Box19 from "@mui/material/Box";
|
|
6938
|
+
import Typography17 from "@mui/material/Typography";
|
|
6800
6939
|
import FormControl2 from "@mui/material/FormControl";
|
|
6801
6940
|
import Select2 from "@mui/material/Select";
|
|
6802
6941
|
import MenuItem6 from "@mui/material/MenuItem";
|
|
6803
6942
|
import Skeleton7 from "@mui/material/Skeleton";
|
|
6804
6943
|
import { AreaChart as AreaChart3, Area as Area3, XAxis as XAxis3, Tooltip as Tooltip8, ResponsiveContainer as ResponsiveContainer3 } from "recharts";
|
|
6805
|
-
import { useApi as
|
|
6944
|
+
import { useApi as useApi6 } from "@backstage/core-plugin-api";
|
|
6806
6945
|
import { useRouteRef as useRouteRef2 } from "@backstage/frontend-plugin-api";
|
|
6807
6946
|
import { Link as Link3 } from "@backstage/core-components";
|
|
6808
6947
|
|
|
@@ -6849,7 +6988,7 @@ function usageSummary(usage) {
|
|
|
6849
6988
|
}
|
|
6850
6989
|
|
|
6851
6990
|
// src/components/LiteLLMHomeWidget.tsx
|
|
6852
|
-
import { Fragment as Fragment10, jsx as
|
|
6991
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6853
6992
|
function presetToDateRange(preset) {
|
|
6854
6993
|
const end = /* @__PURE__ */ new Date();
|
|
6855
6994
|
const start = /* @__PURE__ */ new Date();
|
|
@@ -6867,13 +7006,13 @@ var LiteLLMHomeWidget = ({
|
|
|
6867
7006
|
title = "LiteLLM Usage",
|
|
6868
7007
|
bare = false
|
|
6869
7008
|
}) => {
|
|
6870
|
-
const api =
|
|
7009
|
+
const api = useApi6(liteLlmApiRef);
|
|
6871
7010
|
const moduleRouteRef = useRouteRef2(rootRouteRef);
|
|
6872
7011
|
const { userInfo, keys, loading: profileLoading, error: profileError } = useLiteLLMProfile();
|
|
6873
|
-
const [period, setPeriod] =
|
|
6874
|
-
const [usageLoading, setUsageLoading] =
|
|
6875
|
-
const [usageError, setUsageError] =
|
|
6876
|
-
const [usage, setUsage] =
|
|
7012
|
+
const [period, setPeriod] = useState14(defaultPeriod);
|
|
7013
|
+
const [usageLoading, setUsageLoading] = useState14(true);
|
|
7014
|
+
const [usageError, setUsageError] = useState14(null);
|
|
7015
|
+
const [usage, setUsage] = useState14(null);
|
|
6877
7016
|
useEffect7(() => {
|
|
6878
7017
|
let cancelled = false;
|
|
6879
7018
|
setUsageLoading(true);
|
|
@@ -6906,7 +7045,7 @@ var LiteLLMHomeWidget = ({
|
|
|
6906
7045
|
}),
|
|
6907
7046
|
[profileLoading, usageLoading, profileError, userInfo, usageError, keys]
|
|
6908
7047
|
);
|
|
6909
|
-
const Wrapper = bare ?
|
|
7048
|
+
const Wrapper = bare ? Box19 : Paper10;
|
|
6910
7049
|
const partialFailure = !usageLoading && usageError && usage;
|
|
6911
7050
|
const dailyData = (usage?.daily_usage ?? []).map((d) => ({
|
|
6912
7051
|
date: d.date,
|
|
@@ -6918,10 +7057,10 @@ var LiteLLMHomeWidget = ({
|
|
|
6918
7057
|
const endDate = toLocalDay(end);
|
|
6919
7058
|
const dateRangeCaption = rangeCaption(startDate, endDate);
|
|
6920
7059
|
const sparklineAriaLabelText = sparklineAriaLabel(dailyData);
|
|
6921
|
-
return /* @__PURE__ */
|
|
6922
|
-
/* @__PURE__ */
|
|
6923
|
-
!bare && /* @__PURE__ */
|
|
6924
|
-
/* @__PURE__ */
|
|
7060
|
+
return /* @__PURE__ */ jsxs19(Wrapper, { sx: bare ? { height: "100%" } : { p: 2, height: "100%" }, children: [
|
|
7061
|
+
/* @__PURE__ */ jsxs19(Box19, { display: "flex", justifyContent: bare ? "flex-end" : "space-between", alignItems: "center", mb: 1.5, children: [
|
|
7062
|
+
!bare && /* @__PURE__ */ jsx21(Typography17, { variant: "h6", children: title }),
|
|
7063
|
+
/* @__PURE__ */ jsx21(FormControl2, { size: "small", sx: { minWidth: 90 }, children: /* @__PURE__ */ jsxs19(
|
|
6925
7064
|
Select2,
|
|
6926
7065
|
{
|
|
6927
7066
|
value: period,
|
|
@@ -6929,23 +7068,23 @@ var LiteLLMHomeWidget = ({
|
|
|
6929
7068
|
displayEmpty: true,
|
|
6930
7069
|
inputProps: { "aria-label": "Usage period" },
|
|
6931
7070
|
children: [
|
|
6932
|
-
/* @__PURE__ */
|
|
6933
|
-
/* @__PURE__ */
|
|
6934
|
-
/* @__PURE__ */
|
|
7071
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "today", children: "Today" }),
|
|
7072
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "7d", children: "7d" }),
|
|
7073
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "30d", children: "30d" })
|
|
6935
7074
|
]
|
|
6936
7075
|
}
|
|
6937
7076
|
) })
|
|
6938
7077
|
] }),
|
|
6939
|
-
viewState.kind === "loading" && /* @__PURE__ */
|
|
6940
|
-
/* @__PURE__ */
|
|
6941
|
-
/* @__PURE__ */
|
|
7078
|
+
viewState.kind === "loading" && /* @__PURE__ */ jsxs19(Box19, { sx: { minHeight: 120 }, children: [
|
|
7079
|
+
/* @__PURE__ */ jsx21(Skeleton7, { variant: "text", width: "60%", height: 20, sx: { mb: 1 } }),
|
|
7080
|
+
/* @__PURE__ */ jsx21(Skeleton7, { variant: "rectangular", width: "100%", height: 100 })
|
|
6942
7081
|
] }),
|
|
6943
|
-
viewState.kind === "error" && /* @__PURE__ */
|
|
6944
|
-
viewState.kind === "unprovisioned" && /* @__PURE__ */
|
|
6945
|
-
viewState.kind === "ready" && partialFailure && /* @__PURE__ */
|
|
6946
|
-
viewState.kind === "ready" && /* @__PURE__ */
|
|
6947
|
-
/* @__PURE__ */
|
|
6948
|
-
|
|
7082
|
+
viewState.kind === "error" && /* @__PURE__ */ jsx21(Typography17, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: viewState.message }),
|
|
7083
|
+
viewState.kind === "unprovisioned" && /* @__PURE__ */ jsx21(Typography17, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: UNPROVISIONED_MSG }),
|
|
7084
|
+
viewState.kind === "ready" && partialFailure && /* @__PURE__ */ jsx21(Box19, { sx: { mt: 1, mb: 1, p: 1, backgroundColor: "action.hover", borderRadius: 1 }, children: /* @__PURE__ */ jsx21(Typography17, { variant: "body2", color: "text.secondary", children: USAGE_UNAVAILABLE_MSG }) }),
|
|
7085
|
+
viewState.kind === "ready" && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
7086
|
+
/* @__PURE__ */ jsx21(
|
|
7087
|
+
Typography17,
|
|
6949
7088
|
{
|
|
6950
7089
|
variant: "body2",
|
|
6951
7090
|
sx: {
|
|
@@ -6956,18 +7095,18 @@ var LiteLLMHomeWidget = ({
|
|
|
6956
7095
|
children: viewState.usageUnavailable ? USAGE_UNAVAILABLE_MSG : usageSummary(usage)
|
|
6957
7096
|
}
|
|
6958
7097
|
),
|
|
6959
|
-
hasSparkline && !viewState.usageUnavailable && /* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
|
|
7098
|
+
hasSparkline && !viewState.usageUnavailable && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
7099
|
+
/* @__PURE__ */ jsx21(
|
|
7100
|
+
Box19,
|
|
6962
7101
|
{
|
|
6963
7102
|
height: 80,
|
|
6964
7103
|
role: "img",
|
|
6965
7104
|
"aria-label": sparklineAriaLabelText,
|
|
6966
7105
|
sx: { mb: 0.5 },
|
|
6967
|
-
children: /* @__PURE__ */
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6970
|
-
/* @__PURE__ */
|
|
7106
|
+
children: /* @__PURE__ */ jsx21(ResponsiveContainer3, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs19(AreaChart3, { data: dailyData, margin: { top: 4, right: 0, bottom: 0, left: 0 }, children: [
|
|
7107
|
+
/* @__PURE__ */ jsx21(XAxis3, { dataKey: "date", hide: true }),
|
|
7108
|
+
/* @__PURE__ */ jsx21(Tooltip8, { content: /* @__PURE__ */ jsx21(ChartTooltip, { valueFormatter: fmtUsd }) }),
|
|
7109
|
+
/* @__PURE__ */ jsx21(
|
|
6971
7110
|
Area3,
|
|
6972
7111
|
{
|
|
6973
7112
|
type: "monotone",
|
|
@@ -6983,13 +7122,13 @@ var LiteLLMHomeWidget = ({
|
|
|
6983
7122
|
] }) })
|
|
6984
7123
|
}
|
|
6985
7124
|
),
|
|
6986
|
-
/* @__PURE__ */
|
|
7125
|
+
/* @__PURE__ */ jsxs19(Typography17, { variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: [
|
|
6987
7126
|
"daily spend (",
|
|
6988
7127
|
dateRangeCaption,
|
|
6989
7128
|
")"
|
|
6990
7129
|
] })
|
|
6991
7130
|
] }),
|
|
6992
|
-
moduleRouteRef?.() && /* @__PURE__ */
|
|
7131
|
+
moduleRouteRef?.() && /* @__PURE__ */ jsx21(Typography17, { variant: "caption", sx: { mt: 1, display: "block" }, children: /* @__PURE__ */ jsx21(Link3, { to: moduleRouteRef(), color: "primary", children: "Open LiteLLM \u2192" }) })
|
|
6993
7132
|
] })
|
|
6994
7133
|
] });
|
|
6995
7134
|
};
|
|
@@ -7002,19 +7141,19 @@ init_useLiteLLMProfile();
|
|
|
7002
7141
|
init_api();
|
|
7003
7142
|
init_format();
|
|
7004
7143
|
init_dates();
|
|
7005
|
-
import { useCallback as useCallback5, useEffect as useEffect8, useId as useId2, useMemo as useMemo11, useState as
|
|
7144
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useId as useId2, useMemo as useMemo11, useState as useState15 } from "react";
|
|
7006
7145
|
import { useRouteRef as useRouteRef3 } from "@backstage/frontend-plugin-api";
|
|
7007
|
-
import
|
|
7008
|
-
import
|
|
7009
|
-
import
|
|
7010
|
-
import
|
|
7146
|
+
import Paper11 from "@mui/material/Paper";
|
|
7147
|
+
import Box20 from "@mui/material/Box";
|
|
7148
|
+
import Button9 from "@mui/material/Button";
|
|
7149
|
+
import Typography18 from "@mui/material/Typography";
|
|
7011
7150
|
import Skeleton8 from "@mui/material/Skeleton";
|
|
7012
7151
|
import Collapse4 from "@mui/material/Collapse";
|
|
7013
7152
|
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
7014
7153
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
7015
7154
|
import { ExpandMore as ExpandMore4 } from "@mui/icons-material";
|
|
7016
7155
|
import { AreaChart as AreaChart4, Area as Area4, ResponsiveContainer as ResponsiveContainer4, Tooltip as Tooltip9, ReferenceLine as ReferenceLine2, XAxis as XAxis4 } from "recharts";
|
|
7017
|
-
import { useApi as
|
|
7156
|
+
import { useApi as useApi7 } from "@backstage/core-plugin-api";
|
|
7018
7157
|
import { Link as Link4 } from "@backstage/core-components";
|
|
7019
7158
|
|
|
7020
7159
|
// src/ctas.ts
|
|
@@ -7042,7 +7181,7 @@ init_GenerateKeyButton();
|
|
|
7042
7181
|
init_BudgetLimitList();
|
|
7043
7182
|
init_budget();
|
|
7044
7183
|
init_routes();
|
|
7045
|
-
import { Fragment as Fragment11, jsx as
|
|
7184
|
+
import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7046
7185
|
var LEVEL = {
|
|
7047
7186
|
key: { name: "Key", none: "No cap (unlimited)" },
|
|
7048
7187
|
user: { name: "User", none: "No personal budget" },
|
|
@@ -7066,8 +7205,8 @@ function resetLabel(limit) {
|
|
|
7066
7205
|
const window2 = fmtBudgetDuration(limit.budgetDuration);
|
|
7067
7206
|
return window2 ? `resets ${window2}` : "never resets";
|
|
7068
7207
|
}
|
|
7069
|
-
var Tag = ({ children, tone, title }) => /* @__PURE__ */
|
|
7070
|
-
|
|
7208
|
+
var Tag = ({ children, tone, title }) => /* @__PURE__ */ jsx22(
|
|
7209
|
+
Typography18,
|
|
7071
7210
|
{
|
|
7072
7211
|
title,
|
|
7073
7212
|
sx: (theme) => ({
|
|
@@ -7084,10 +7223,10 @@ var Tag = ({ children, tone, title }) => /* @__PURE__ */ jsx21(
|
|
|
7084
7223
|
children
|
|
7085
7224
|
}
|
|
7086
7225
|
);
|
|
7087
|
-
var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE__ */
|
|
7088
|
-
/* @__PURE__ */
|
|
7089
|
-
/* @__PURE__ */
|
|
7090
|
-
|
|
7226
|
+
var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0, flex: 1 }, children: [
|
|
7227
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "center", gap: 0.625, minWidth: 0 }, children: [
|
|
7228
|
+
/* @__PURE__ */ jsx22(
|
|
7229
|
+
Box20,
|
|
7091
7230
|
{
|
|
7092
7231
|
sx: (theme) => ({
|
|
7093
7232
|
width: 6,
|
|
@@ -7098,10 +7237,10 @@ var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE_
|
|
|
7098
7237
|
})
|
|
7099
7238
|
}
|
|
7100
7239
|
),
|
|
7101
|
-
/* @__PURE__ */
|
|
7240
|
+
/* @__PURE__ */ jsx22(Tag, { children: label })
|
|
7102
7241
|
] }),
|
|
7103
|
-
/* @__PURE__ */
|
|
7104
|
-
|
|
7242
|
+
/* @__PURE__ */ jsx22(
|
|
7243
|
+
Typography18,
|
|
7105
7244
|
{
|
|
7106
7245
|
title,
|
|
7107
7246
|
sx: {
|
|
@@ -7117,8 +7256,8 @@ var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE_
|
|
|
7117
7256
|
children: value
|
|
7118
7257
|
}
|
|
7119
7258
|
),
|
|
7120
|
-
/* @__PURE__ */
|
|
7121
|
-
|
|
7259
|
+
/* @__PURE__ */ jsx22(
|
|
7260
|
+
Typography18,
|
|
7122
7261
|
{
|
|
7123
7262
|
variant: "caption",
|
|
7124
7263
|
color: "text.secondary",
|
|
@@ -7148,8 +7287,8 @@ var LevelRow = ({
|
|
|
7148
7287
|
const subNote = () => {
|
|
7149
7288
|
if (overCap) return "Over cap";
|
|
7150
7289
|
if (extra > 0 && keysHref) {
|
|
7151
|
-
return /* @__PURE__ */
|
|
7152
|
-
|
|
7290
|
+
return /* @__PURE__ */ jsxs20(
|
|
7291
|
+
Typography18,
|
|
7153
7292
|
{
|
|
7154
7293
|
component: Link4,
|
|
7155
7294
|
to: keysHref,
|
|
@@ -7171,8 +7310,8 @@ var LevelRow = ({
|
|
|
7171
7310
|
return limit?.sublabel ?? null;
|
|
7172
7311
|
};
|
|
7173
7312
|
const gaugeAriaLabel = limit ? `${name} budget used: ${Math.round(limit.pct)}%` : `${name} \u2014 no cap`;
|
|
7174
|
-
return /* @__PURE__ */
|
|
7175
|
-
|
|
7313
|
+
return /* @__PURE__ */ jsxs20(
|
|
7314
|
+
Box20,
|
|
7176
7315
|
{
|
|
7177
7316
|
sx: {
|
|
7178
7317
|
display: "grid",
|
|
@@ -7183,7 +7322,7 @@ var LevelRow = ({
|
|
|
7183
7322
|
minWidth: 0
|
|
7184
7323
|
},
|
|
7185
7324
|
children: [
|
|
7186
|
-
/* @__PURE__ */
|
|
7325
|
+
/* @__PURE__ */ jsx22(
|
|
7187
7326
|
Gauge,
|
|
7188
7327
|
{
|
|
7189
7328
|
value: limit?.pct ?? 0,
|
|
@@ -7193,11 +7332,11 @@ var LevelRow = ({
|
|
|
7193
7332
|
ariaLabel: gaugeAriaLabel
|
|
7194
7333
|
}
|
|
7195
7334
|
),
|
|
7196
|
-
/* @__PURE__ */
|
|
7197
|
-
/* @__PURE__ */
|
|
7198
|
-
limit ? /* @__PURE__ */
|
|
7199
|
-
/* @__PURE__ */
|
|
7200
|
-
|
|
7335
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0 }, children: [
|
|
7336
|
+
/* @__PURE__ */ jsx22(Tag, { tone: tone === "warning" || tone === "danger" ? tone : void 0, children: name }),
|
|
7337
|
+
limit ? /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
7338
|
+
/* @__PURE__ */ jsx22(
|
|
7339
|
+
Typography18,
|
|
7201
7340
|
{
|
|
7202
7341
|
variant: "caption",
|
|
7203
7342
|
title: limit.sublabel ? `${limit.label} \xB7 ${limit.sublabel}` : limit.label,
|
|
@@ -7213,8 +7352,8 @@ var LevelRow = ({
|
|
|
7213
7352
|
children: limit.label
|
|
7214
7353
|
}
|
|
7215
7354
|
),
|
|
7216
|
-
/* @__PURE__ */
|
|
7217
|
-
|
|
7355
|
+
/* @__PURE__ */ jsx22(
|
|
7356
|
+
Typography18,
|
|
7218
7357
|
{
|
|
7219
7358
|
variant: "caption",
|
|
7220
7359
|
color: overCap ? "error" : "text.secondary",
|
|
@@ -7230,8 +7369,8 @@ var LevelRow = ({
|
|
|
7230
7369
|
children: subNote()
|
|
7231
7370
|
}
|
|
7232
7371
|
)
|
|
7233
|
-
] }) : /* @__PURE__ */
|
|
7234
|
-
|
|
7372
|
+
] }) : /* @__PURE__ */ jsx22(
|
|
7373
|
+
Typography18,
|
|
7235
7374
|
{
|
|
7236
7375
|
variant: "caption",
|
|
7237
7376
|
color: "text.secondary",
|
|
@@ -7247,9 +7386,9 @@ var LevelRow = ({
|
|
|
7247
7386
|
}
|
|
7248
7387
|
)
|
|
7249
7388
|
] }),
|
|
7250
|
-
/* @__PURE__ */
|
|
7251
|
-
/* @__PURE__ */
|
|
7252
|
-
|
|
7389
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0, textAlign: "right" }, children: [
|
|
7390
|
+
/* @__PURE__ */ jsx22(
|
|
7391
|
+
Typography18,
|
|
7253
7392
|
{
|
|
7254
7393
|
title: limit ? `${fmtUsd(limit.spend)} of ${fmtUsd(limit.budget)}` : void 0,
|
|
7255
7394
|
sx: {
|
|
@@ -7266,8 +7405,8 @@ var LevelRow = ({
|
|
|
7266
7405
|
children: amountCaption(limit)
|
|
7267
7406
|
}
|
|
7268
7407
|
),
|
|
7269
|
-
/* @__PURE__ */
|
|
7270
|
-
|
|
7408
|
+
/* @__PURE__ */ jsx22(
|
|
7409
|
+
Typography18,
|
|
7271
7410
|
{
|
|
7272
7411
|
variant: "caption",
|
|
7273
7412
|
color: "text.secondary",
|
|
@@ -7298,11 +7437,11 @@ function amountNote(limit) {
|
|
|
7298
7437
|
var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, maxBudget }) => {
|
|
7299
7438
|
const renderPlot = () => {
|
|
7300
7439
|
if (loading) {
|
|
7301
|
-
return /* @__PURE__ */
|
|
7440
|
+
return /* @__PURE__ */ jsx22(Skeleton8, { variant: "rectangular", width: "100%", height: "100%" });
|
|
7302
7441
|
}
|
|
7303
7442
|
if (data.length === 0) {
|
|
7304
|
-
return /* @__PURE__ */
|
|
7305
|
-
|
|
7443
|
+
return /* @__PURE__ */ jsx22(
|
|
7444
|
+
Box20,
|
|
7306
7445
|
{
|
|
7307
7446
|
display: "flex",
|
|
7308
7447
|
justifyContent: "center",
|
|
@@ -7313,10 +7452,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7313
7452
|
}
|
|
7314
7453
|
);
|
|
7315
7454
|
}
|
|
7316
|
-
return /* @__PURE__ */
|
|
7317
|
-
/* @__PURE__ */
|
|
7318
|
-
/* @__PURE__ */
|
|
7319
|
-
maxBudget !== void 0 && /* @__PURE__ */
|
|
7455
|
+
return /* @__PURE__ */ jsx22(ResponsiveContainer4, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs20(AreaChart4, { data, margin: { top: 4, right: 0, bottom: 0, left: 0 }, children: [
|
|
7456
|
+
/* @__PURE__ */ jsx22(XAxis4, { dataKey: "date", hide: true }),
|
|
7457
|
+
/* @__PURE__ */ jsx22(Tooltip9, { content: /* @__PURE__ */ jsx22(ChartTooltip, { valueFormatter: fmtUsd }) }),
|
|
7458
|
+
maxBudget !== void 0 && /* @__PURE__ */ jsx22(
|
|
7320
7459
|
ReferenceLine2,
|
|
7321
7460
|
{
|
|
7322
7461
|
y: maxBudget,
|
|
@@ -7325,7 +7464,7 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7325
7464
|
strokeWidth: 1
|
|
7326
7465
|
}
|
|
7327
7466
|
),
|
|
7328
|
-
/* @__PURE__ */
|
|
7467
|
+
/* @__PURE__ */ jsx22(
|
|
7329
7468
|
Area4,
|
|
7330
7469
|
{
|
|
7331
7470
|
type: "monotone",
|
|
@@ -7347,10 +7486,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7347
7486
|
if (data.length === 0) return "No spend this month";
|
|
7348
7487
|
return mtdCaption();
|
|
7349
7488
|
})();
|
|
7350
|
-
return /* @__PURE__ */
|
|
7351
|
-
/* @__PURE__ */
|
|
7352
|
-
/* @__PURE__ */
|
|
7353
|
-
|
|
7489
|
+
return /* @__PURE__ */ jsxs20(Box20, { role: "img", "aria-label": sparklineAriaLabel(data), sx: { minWidth: 0 }, children: [
|
|
7490
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { height, width: "100%" }, children: renderPlot() }),
|
|
7491
|
+
/* @__PURE__ */ jsxs20(
|
|
7492
|
+
Box20,
|
|
7354
7493
|
{
|
|
7355
7494
|
sx: {
|
|
7356
7495
|
display: "flex",
|
|
@@ -7361,10 +7500,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7361
7500
|
minWidth: 0
|
|
7362
7501
|
},
|
|
7363
7502
|
children: [
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
/* @__PURE__ */
|
|
7366
|
-
/* @__PURE__ */
|
|
7367
|
-
|
|
7503
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "baseline", gap: 0.75, minWidth: 0 }, children: [
|
|
7504
|
+
/* @__PURE__ */ jsx22(Tag, { children: "Spent (mtd)" }),
|
|
7505
|
+
/* @__PURE__ */ jsx22(
|
|
7506
|
+
Typography18,
|
|
7368
7507
|
{
|
|
7369
7508
|
variant: "caption",
|
|
7370
7509
|
color: "text.secondary",
|
|
@@ -7373,8 +7512,8 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7373
7512
|
}
|
|
7374
7513
|
)
|
|
7375
7514
|
] }),
|
|
7376
|
-
/* @__PURE__ */
|
|
7377
|
-
|
|
7515
|
+
/* @__PURE__ */ jsx22(
|
|
7516
|
+
Typography18,
|
|
7378
7517
|
{
|
|
7379
7518
|
title: loading || usageUnavailable ? void 0 : `${fmtUsd(mtdSpend)} spent month to date`,
|
|
7380
7519
|
sx: {
|
|
@@ -7418,7 +7557,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7418
7557
|
teams: propTeams,
|
|
7419
7558
|
keys: propKeys
|
|
7420
7559
|
}) => {
|
|
7421
|
-
const api =
|
|
7560
|
+
const api = useApi7(liteLlmApiRef);
|
|
7422
7561
|
const theme = useTheme4();
|
|
7423
7562
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
|
7424
7563
|
const gaugeSize = isSmallScreen ? Math.min(48, size) : size;
|
|
@@ -7426,17 +7565,17 @@ var LiteLLMBudgetGauges = ({
|
|
|
7426
7565
|
const moduleRouteRef = useRouteRef3(rootRouteRef);
|
|
7427
7566
|
const moduleHref = propModuleHref ?? moduleRouteRef?.();
|
|
7428
7567
|
const { userInfo: hookUserInfo, teams: hookTeams, keys: hookKeys, loading: profileLoading, error: profileError } = useLiteLLMProfile();
|
|
7429
|
-
const [usageLoading, setUsageLoading] =
|
|
7430
|
-
const [usageError, setUsageError] =
|
|
7431
|
-
const [dailySpend, setDailySpend] =
|
|
7432
|
-
const [mtdSpend, setMtdSpend] =
|
|
7568
|
+
const [usageLoading, setUsageLoading] = useState15(true);
|
|
7569
|
+
const [usageError, setUsageError] = useState15(null);
|
|
7570
|
+
const [dailySpend, setDailySpend] = useState15([]);
|
|
7571
|
+
const [mtdSpend, setMtdSpend] = useState15(0);
|
|
7433
7572
|
const user = propUserInfo !== void 0 ? propUserInfo : hookUserInfo;
|
|
7434
7573
|
const teams = propTeams !== void 0 ? propTeams : hookTeams;
|
|
7435
7574
|
const keys = propKeys !== void 0 ? propKeys : hookKeys;
|
|
7436
7575
|
const loading = propUserInfo === void 0 ? profileLoading : usageLoading;
|
|
7437
7576
|
const error = propUserInfo === void 0 ? profileError : usageError;
|
|
7438
7577
|
const isControlled = expanded !== void 0;
|
|
7439
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] =
|
|
7578
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState15(defaultExpanded);
|
|
7440
7579
|
const isExpanded = isControlled ? expanded : uncontrolledExpanded;
|
|
7441
7580
|
const toggleExpanded = useCallback5(() => {
|
|
7442
7581
|
const next = !isExpanded;
|
|
@@ -7517,20 +7656,20 @@ var LiteLLMBudgetGauges = ({
|
|
|
7517
7656
|
switch (cta.kind) {
|
|
7518
7657
|
case "new-key":
|
|
7519
7658
|
if (!onCreateKey && !moduleHref) return null;
|
|
7520
|
-
return onCreateKey ? /* @__PURE__ */
|
|
7659
|
+
return onCreateKey ? /* @__PURE__ */ jsx22(GenerateKeyButton, { size: "small", label, onClick: onCreateKey }, key) : /* @__PURE__ */ jsx22(GenerateKeyButton, { size: "small", label, to: `${moduleHref}?generate=1` }, key);
|
|
7521
7660
|
case "module":
|
|
7522
7661
|
if (!moduleHref) return null;
|
|
7523
|
-
return /* @__PURE__ */
|
|
7662
|
+
return /* @__PURE__ */ jsx22(Button9, { size: "small", variant: "text", component: Link4, to: moduleHref, children: label }, key);
|
|
7524
7663
|
case "all-limits":
|
|
7525
|
-
return /* @__PURE__ */
|
|
7526
|
-
|
|
7664
|
+
return /* @__PURE__ */ jsx22(
|
|
7665
|
+
Button9,
|
|
7527
7666
|
{
|
|
7528
7667
|
size: "small",
|
|
7529
7668
|
variant: "text",
|
|
7530
7669
|
onClick: toggleExpanded,
|
|
7531
7670
|
"aria-expanded": isExpanded,
|
|
7532
7671
|
"aria-controls": expandedRegionId,
|
|
7533
|
-
endIcon: /* @__PURE__ */
|
|
7672
|
+
endIcon: /* @__PURE__ */ jsx22(
|
|
7534
7673
|
ExpandMore4,
|
|
7535
7674
|
{
|
|
7536
7675
|
sx: (muiTheme) => ({
|
|
@@ -7549,11 +7688,11 @@ var LiteLLMBudgetGauges = ({
|
|
|
7549
7688
|
}
|
|
7550
7689
|
};
|
|
7551
7690
|
const hasFooter = resolvedCtas.length > 0 || !!action;
|
|
7552
|
-
const Wrapper = bare ?
|
|
7553
|
-
return /* @__PURE__ */
|
|
7554
|
-
/* @__PURE__ */
|
|
7555
|
-
!bare && /* @__PURE__ */
|
|
7556
|
-
!loading && !error && /* @__PURE__ */
|
|
7691
|
+
const Wrapper = bare ? Box20 : Paper11;
|
|
7692
|
+
return /* @__PURE__ */ jsxs20(Wrapper, { sx: bare ? { height: "100%" } : { p: 2, height: "100%" }, children: [
|
|
7693
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 1.5, minWidth: 0, justifyContent: bare ? "flex-end" : void 0 }, children: [
|
|
7694
|
+
!bare && /* @__PURE__ */ jsx22(Typography18, { variant: "h6", lineHeight: 1.2, sx: { minWidth: 0, flex: 1 }, children: title }),
|
|
7695
|
+
!loading && !error && /* @__PURE__ */ jsx22(
|
|
7557
7696
|
StatusPill,
|
|
7558
7697
|
{
|
|
7559
7698
|
label: summaryText,
|
|
@@ -7562,19 +7701,19 @@ var LiteLLMBudgetGauges = ({
|
|
|
7562
7701
|
}
|
|
7563
7702
|
)
|
|
7564
7703
|
] }),
|
|
7565
|
-
viewState.kind === "loading" && /* @__PURE__ */
|
|
7566
|
-
/* @__PURE__ */
|
|
7567
|
-
/* @__PURE__ */
|
|
7568
|
-
/* @__PURE__ */
|
|
7569
|
-
/* @__PURE__ */
|
|
7704
|
+
viewState.kind === "loading" && /* @__PURE__ */ jsx22(Box20, { sx: { display: "flex", flexDirection: "column", gap: 1.25, minHeight: size }, children: [0, 1, 2].map((i) => /* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "center", gap: 1.25 }, children: [
|
|
7705
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "circular", width: size, height: size }),
|
|
7706
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { flex: 1 }, children: [
|
|
7707
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: "70%", height: 12, sx: { mb: 0.25 } }),
|
|
7708
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: "45%", height: 11 })
|
|
7570
7709
|
] }),
|
|
7571
|
-
/* @__PURE__ */
|
|
7710
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: 64, height: 12 })
|
|
7572
7711
|
] }, i)) }),
|
|
7573
|
-
viewState.kind === "error" && /* @__PURE__ */
|
|
7574
|
-
viewState.kind === "unprovisioned" && /* @__PURE__ */
|
|
7575
|
-
viewState.kind === "ready" && /* @__PURE__ */
|
|
7576
|
-
/* @__PURE__ */
|
|
7577
|
-
|
|
7712
|
+
viewState.kind === "error" && /* @__PURE__ */ jsx22(Typography18, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: viewState.message }),
|
|
7713
|
+
viewState.kind === "unprovisioned" && /* @__PURE__ */ jsx22(Typography18, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: UNPROVISIONED_MSG }),
|
|
7714
|
+
viewState.kind === "ready" && /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
7715
|
+
/* @__PURE__ */ jsxs20(
|
|
7716
|
+
Box20,
|
|
7578
7717
|
{
|
|
7579
7718
|
sx: {
|
|
7580
7719
|
display: "flex",
|
|
@@ -7584,7 +7723,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7584
7723
|
minWidth: 0
|
|
7585
7724
|
},
|
|
7586
7725
|
children: [
|
|
7587
|
-
/* @__PURE__ */
|
|
7726
|
+
/* @__PURE__ */ jsx22(
|
|
7588
7727
|
InlineStat,
|
|
7589
7728
|
{
|
|
7590
7729
|
label: "Today spent",
|
|
@@ -7594,8 +7733,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7594
7733
|
title: usageLoading || viewState.usageUnavailable ? void 0 : "Spend since local midnight"
|
|
7595
7734
|
}
|
|
7596
7735
|
),
|
|
7597
|
-
/* @__PURE__ */
|
|
7598
|
-
/* @__PURE__ */
|
|
7736
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { width: "1px", bgcolor: "divider", flexShrink: 0 } }),
|
|
7737
|
+
/* @__PURE__ */ jsx22(
|
|
7599
7738
|
InlineStat,
|
|
7600
7739
|
{
|
|
7601
7740
|
label: "Month to date",
|
|
@@ -7607,15 +7746,15 @@ var LiteLLMBudgetGauges = ({
|
|
|
7607
7746
|
]
|
|
7608
7747
|
}
|
|
7609
7748
|
),
|
|
7610
|
-
/* @__PURE__ */
|
|
7611
|
-
|
|
7749
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { borderTop: "1px solid", borderColor: "divider" }, children: gauges.map((gauge, i) => /* @__PURE__ */ jsx22(
|
|
7750
|
+
Box20,
|
|
7612
7751
|
{
|
|
7613
7752
|
sx: i === 0 ? void 0 : { borderTop: "1px solid", borderColor: "divider" },
|
|
7614
|
-
children: /* @__PURE__ */
|
|
7753
|
+
children: /* @__PURE__ */ jsx22(LevelRow, { gauge, size: gaugeSize, keysHref: keysTabHref })
|
|
7615
7754
|
},
|
|
7616
7755
|
gauge.kind
|
|
7617
7756
|
)) }),
|
|
7618
|
-
/* @__PURE__ */
|
|
7757
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { mt: 1.25 }, children: /* @__PURE__ */ jsx22(
|
|
7619
7758
|
SpendStrip,
|
|
7620
7759
|
{
|
|
7621
7760
|
data: dailySpend,
|
|
@@ -7626,8 +7765,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7626
7765
|
maxBudget: user?.max_budget ?? void 0
|
|
7627
7766
|
}
|
|
7628
7767
|
) }),
|
|
7629
|
-
/* @__PURE__ */
|
|
7630
|
-
|
|
7768
|
+
/* @__PURE__ */ jsx22(Collapse4, { in: isExpanded, unmountOnExit: true, children: /* @__PURE__ */ jsx22(
|
|
7769
|
+
Box20,
|
|
7631
7770
|
{
|
|
7632
7771
|
id: expandedRegionId,
|
|
7633
7772
|
sx: {
|
|
@@ -7637,7 +7776,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7637
7776
|
maxHeight: 300,
|
|
7638
7777
|
overflowY: "auto"
|
|
7639
7778
|
},
|
|
7640
|
-
children: /* @__PURE__ */
|
|
7779
|
+
children: /* @__PURE__ */ jsx22(LimitListPanel, { children: /* @__PURE__ */ jsx22(
|
|
7641
7780
|
BudgetLimitList,
|
|
7642
7781
|
{
|
|
7643
7782
|
limits: expandedLimits,
|
|
@@ -7648,8 +7787,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7648
7787
|
}
|
|
7649
7788
|
) })
|
|
7650
7789
|
] }),
|
|
7651
|
-
hasFooter && /* @__PURE__ */
|
|
7652
|
-
|
|
7790
|
+
hasFooter && /* @__PURE__ */ jsxs20(
|
|
7791
|
+
Box20,
|
|
7653
7792
|
{
|
|
7654
7793
|
sx: (muiTheme) => ({
|
|
7655
7794
|
mt: 2,
|