@acarmisc/backstage-plugin-litellm 0.35.0 → 0.37.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 +10 -0
- package/dist/index.cjs.js +294 -150
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.esm.js +279 -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,136 @@ 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
|
+
function initialTeams(all, have) {
|
|
6771
|
+
const missing = all.filter((id) => !have.has(id));
|
|
6772
|
+
return new Set(have.size ? missing : all);
|
|
6773
|
+
}
|
|
6774
|
+
var init_connect = __esm({
|
|
6775
|
+
"src/connect.ts"() {
|
|
6776
|
+
"use strict";
|
|
6777
|
+
}
|
|
6778
|
+
});
|
|
6779
|
+
|
|
6780
|
+
// src/components/ConnectPage.tsx
|
|
6781
|
+
var ConnectPage_exports = {};
|
|
6782
|
+
__export(ConnectPage_exports, {
|
|
6783
|
+
ConnectPage: () => ConnectPage
|
|
6784
|
+
});
|
|
6785
|
+
import { useState as useState13 } from "react";
|
|
6786
|
+
import Alert7 from "@mui/material/Alert";
|
|
6787
|
+
import Box18 from "@mui/material/Box";
|
|
6788
|
+
import Button8 from "@mui/material/Button";
|
|
6789
|
+
import Checkbox3 from "@mui/material/Checkbox";
|
|
6790
|
+
import FormControlLabel3 from "@mui/material/FormControlLabel";
|
|
6791
|
+
import FormGroup from "@mui/material/FormGroup";
|
|
6792
|
+
import Paper9 from "@mui/material/Paper";
|
|
6793
|
+
import Typography16 from "@mui/material/Typography";
|
|
6794
|
+
import { useSearchParams as useSearchParams2 } from "react-router-dom";
|
|
6795
|
+
import { useAsync as useAsync3 } from "react-use";
|
|
6796
|
+
import { useApi as useApi5 } from "@backstage/core-plugin-api";
|
|
6797
|
+
import { Content as Content2, Progress as Progress2 } from "@backstage/core-components";
|
|
6798
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6799
|
+
var ConnectPage;
|
|
6800
|
+
var init_ConnectPage = __esm({
|
|
6801
|
+
"src/components/ConnectPage.tsx"() {
|
|
6802
|
+
"use strict";
|
|
6803
|
+
init_api();
|
|
6804
|
+
init_connect();
|
|
6805
|
+
ConnectPage = () => {
|
|
6806
|
+
const api = useApi5(liteLlmApiRef);
|
|
6807
|
+
const [params] = useSearchParams2();
|
|
6808
|
+
const redirectUri = params.get("redirect_uri");
|
|
6809
|
+
const state = params.get("state") ?? "";
|
|
6810
|
+
const client = params.get("client") || "a local application";
|
|
6811
|
+
const have = new Set((params.get("have") ?? "").split(",").filter(Boolean));
|
|
6812
|
+
const teams = useAsync3(() => api.getTeams(), [api]);
|
|
6813
|
+
const [selected, setSelected] = useState13();
|
|
6814
|
+
const [busy, setBusy] = useState13(false);
|
|
6815
|
+
const [error, setError] = useState13();
|
|
6816
|
+
if (!isLoopbackCallback(redirectUri)) {
|
|
6817
|
+
return /* @__PURE__ */ jsx19(Content2, { children: /* @__PURE__ */ jsx19(Alert7, { severity: "error", children: "Invalid connection link: redirect_uri must be http://localhost:<port>/callback." }) });
|
|
6818
|
+
}
|
|
6819
|
+
if (teams.loading) return /* @__PURE__ */ jsx19(Progress2, {});
|
|
6820
|
+
const all = teams.value ?? [];
|
|
6821
|
+
const chosen = selected ?? initialTeams(all.map((t) => t.team_id), have);
|
|
6822
|
+
const toggle = (id) => {
|
|
6823
|
+
const next = new Set(chosen);
|
|
6824
|
+
if (!next.delete(id)) next.add(id);
|
|
6825
|
+
setSelected(next);
|
|
6826
|
+
};
|
|
6827
|
+
const connect = async () => {
|
|
6828
|
+
setBusy(true);
|
|
6829
|
+
setError(void 0);
|
|
6830
|
+
try {
|
|
6831
|
+
const ids = all.length ? all.filter((t) => chosen.has(t.team_id)).map((t) => t.team_id) : [void 0];
|
|
6832
|
+
const keys = [];
|
|
6833
|
+
for (const id of ids) keys.push(["key", (await api.connectLocalClient(redirectUri, id)).key]);
|
|
6834
|
+
postToLoopback(redirectUri, [["state", state], ...keys]);
|
|
6835
|
+
} catch (e) {
|
|
6836
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
6837
|
+
setBusy(false);
|
|
6838
|
+
}
|
|
6839
|
+
};
|
|
6840
|
+
return /* @__PURE__ */ jsx19(Content2, { children: /* @__PURE__ */ jsx19(Box18, { maxWidth: 520, mx: "auto", mt: 4, children: /* @__PURE__ */ jsxs18(Paper9, { sx: { p: 3 }, children: [
|
|
6841
|
+
/* @__PURE__ */ jsxs18(Typography16, { variant: "h5", gutterBottom: true, children: [
|
|
6842
|
+
"Connect ",
|
|
6843
|
+
client
|
|
6844
|
+
] }),
|
|
6845
|
+
/* @__PURE__ */ jsxs18(Typography16, { variant: "body2", color: "text.secondary", paragraph: true, children: [
|
|
6846
|
+
client,
|
|
6847
|
+
" will receive an API key for each selected team. Selecting a team that is already connected replaces its key, also on your other devices."
|
|
6848
|
+
] }),
|
|
6849
|
+
teams.error && /* @__PURE__ */ jsxs18(Alert7, { severity: "error", children: [
|
|
6850
|
+
"Could not load your teams: ",
|
|
6851
|
+
teams.error.message
|
|
6852
|
+
] }),
|
|
6853
|
+
all.length > 0 && /* @__PURE__ */ jsx19(FormGroup, { sx: { mb: 2 }, children: all.map((t) => /* @__PURE__ */ jsx19(
|
|
6854
|
+
FormControlLabel3,
|
|
6855
|
+
{
|
|
6856
|
+
control: /* @__PURE__ */ jsx19(Checkbox3, { checked: chosen.has(t.team_id), onChange: () => toggle(t.team_id) }),
|
|
6857
|
+
label: `${t.team_alias ?? t.team_id}${have.has(t.team_id) ? " (already connected)" : ""}`
|
|
6858
|
+
},
|
|
6859
|
+
t.team_id
|
|
6860
|
+
)) }),
|
|
6861
|
+
error && /* @__PURE__ */ jsx19(Alert7, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
6862
|
+
/* @__PURE__ */ jsx19(
|
|
6863
|
+
Button8,
|
|
6864
|
+
{
|
|
6865
|
+
variant: "contained",
|
|
6866
|
+
onClick: connect,
|
|
6867
|
+
disabled: busy || !!teams.error || all.length > 0 && chosen.size === 0,
|
|
6868
|
+
children: busy ? "Connecting\u2026" : "Connect"
|
|
6869
|
+
}
|
|
6870
|
+
)
|
|
6871
|
+
] }) }) });
|
|
6872
|
+
};
|
|
6873
|
+
}
|
|
6874
|
+
});
|
|
6875
|
+
|
|
6742
6876
|
// src/plugin.tsx
|
|
6743
6877
|
init_api();
|
|
6744
6878
|
init_routes();
|
|
@@ -6750,7 +6884,7 @@ import {
|
|
|
6750
6884
|
fetchApiRef,
|
|
6751
6885
|
discoveryApiRef
|
|
6752
6886
|
} from "@backstage/frontend-plugin-api";
|
|
6753
|
-
import { jsx as
|
|
6887
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
6754
6888
|
var liteLlmApi = ApiBlueprint.make({
|
|
6755
6889
|
params: (defineParams) => defineParams({
|
|
6756
6890
|
api: liteLlmApiRef,
|
|
@@ -6762,11 +6896,21 @@ var liteLlmPage = PageBlueprint.make({
|
|
|
6762
6896
|
params: {
|
|
6763
6897
|
path: "/litellm",
|
|
6764
6898
|
title: "LiteLLM",
|
|
6765
|
-
icon: /* @__PURE__ */
|
|
6899
|
+
icon: /* @__PURE__ */ jsx20(TrendingUpIcon, {}),
|
|
6766
6900
|
routeRef: rootRouteRef,
|
|
6767
6901
|
loader: async () => {
|
|
6768
6902
|
const { LiteLLMPage: LiteLLMPage2 } = await Promise.resolve().then(() => (init_LiteLLMPage(), LiteLLMPage_exports));
|
|
6769
|
-
return /* @__PURE__ */
|
|
6903
|
+
return /* @__PURE__ */ jsx20(LiteLLMPage2, {});
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
});
|
|
6907
|
+
var liteLlmConnectPage = PageBlueprint.make({
|
|
6908
|
+
name: "connect",
|
|
6909
|
+
params: {
|
|
6910
|
+
path: "/litellm/connect",
|
|
6911
|
+
loader: async () => {
|
|
6912
|
+
const { ConnectPage: ConnectPage2 } = await Promise.resolve().then(() => (init_ConnectPage(), ConnectPage_exports));
|
|
6913
|
+
return /* @__PURE__ */ jsx20(ConnectPage2, {});
|
|
6770
6914
|
}
|
|
6771
6915
|
}
|
|
6772
6916
|
});
|
|
@@ -6775,7 +6919,7 @@ var litellmPlugin = createFrontendPlugin({
|
|
|
6775
6919
|
routes: {
|
|
6776
6920
|
root: rootRouteRef
|
|
6777
6921
|
},
|
|
6778
|
-
extensions: [liteLlmApi, liteLlmPage]
|
|
6922
|
+
extensions: [liteLlmApi, liteLlmPage, liteLlmConnectPage]
|
|
6779
6923
|
});
|
|
6780
6924
|
|
|
6781
6925
|
// src/index.ts
|
|
@@ -6793,16 +6937,16 @@ init_format();
|
|
|
6793
6937
|
init_dates();
|
|
6794
6938
|
init_ui();
|
|
6795
6939
|
init_widgetState();
|
|
6796
|
-
import { useEffect as useEffect7, useMemo as useMemo10, useState as
|
|
6797
|
-
import
|
|
6798
|
-
import
|
|
6799
|
-
import
|
|
6940
|
+
import { useEffect as useEffect7, useMemo as useMemo10, useState as useState14 } from "react";
|
|
6941
|
+
import Paper10 from "@mui/material/Paper";
|
|
6942
|
+
import Box19 from "@mui/material/Box";
|
|
6943
|
+
import Typography17 from "@mui/material/Typography";
|
|
6800
6944
|
import FormControl2 from "@mui/material/FormControl";
|
|
6801
6945
|
import Select2 from "@mui/material/Select";
|
|
6802
6946
|
import MenuItem6 from "@mui/material/MenuItem";
|
|
6803
6947
|
import Skeleton7 from "@mui/material/Skeleton";
|
|
6804
6948
|
import { AreaChart as AreaChart3, Area as Area3, XAxis as XAxis3, Tooltip as Tooltip8, ResponsiveContainer as ResponsiveContainer3 } from "recharts";
|
|
6805
|
-
import { useApi as
|
|
6949
|
+
import { useApi as useApi6 } from "@backstage/core-plugin-api";
|
|
6806
6950
|
import { useRouteRef as useRouteRef2 } from "@backstage/frontend-plugin-api";
|
|
6807
6951
|
import { Link as Link3 } from "@backstage/core-components";
|
|
6808
6952
|
|
|
@@ -6849,7 +6993,7 @@ function usageSummary(usage) {
|
|
|
6849
6993
|
}
|
|
6850
6994
|
|
|
6851
6995
|
// src/components/LiteLLMHomeWidget.tsx
|
|
6852
|
-
import { Fragment as Fragment10, jsx as
|
|
6996
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6853
6997
|
function presetToDateRange(preset) {
|
|
6854
6998
|
const end = /* @__PURE__ */ new Date();
|
|
6855
6999
|
const start = /* @__PURE__ */ new Date();
|
|
@@ -6867,13 +7011,13 @@ var LiteLLMHomeWidget = ({
|
|
|
6867
7011
|
title = "LiteLLM Usage",
|
|
6868
7012
|
bare = false
|
|
6869
7013
|
}) => {
|
|
6870
|
-
const api =
|
|
7014
|
+
const api = useApi6(liteLlmApiRef);
|
|
6871
7015
|
const moduleRouteRef = useRouteRef2(rootRouteRef);
|
|
6872
7016
|
const { userInfo, keys, loading: profileLoading, error: profileError } = useLiteLLMProfile();
|
|
6873
|
-
const [period, setPeriod] =
|
|
6874
|
-
const [usageLoading, setUsageLoading] =
|
|
6875
|
-
const [usageError, setUsageError] =
|
|
6876
|
-
const [usage, setUsage] =
|
|
7017
|
+
const [period, setPeriod] = useState14(defaultPeriod);
|
|
7018
|
+
const [usageLoading, setUsageLoading] = useState14(true);
|
|
7019
|
+
const [usageError, setUsageError] = useState14(null);
|
|
7020
|
+
const [usage, setUsage] = useState14(null);
|
|
6877
7021
|
useEffect7(() => {
|
|
6878
7022
|
let cancelled = false;
|
|
6879
7023
|
setUsageLoading(true);
|
|
@@ -6906,7 +7050,7 @@ var LiteLLMHomeWidget = ({
|
|
|
6906
7050
|
}),
|
|
6907
7051
|
[profileLoading, usageLoading, profileError, userInfo, usageError, keys]
|
|
6908
7052
|
);
|
|
6909
|
-
const Wrapper = bare ?
|
|
7053
|
+
const Wrapper = bare ? Box19 : Paper10;
|
|
6910
7054
|
const partialFailure = !usageLoading && usageError && usage;
|
|
6911
7055
|
const dailyData = (usage?.daily_usage ?? []).map((d) => ({
|
|
6912
7056
|
date: d.date,
|
|
@@ -6918,10 +7062,10 @@ var LiteLLMHomeWidget = ({
|
|
|
6918
7062
|
const endDate = toLocalDay(end);
|
|
6919
7063
|
const dateRangeCaption = rangeCaption(startDate, endDate);
|
|
6920
7064
|
const sparklineAriaLabelText = sparklineAriaLabel(dailyData);
|
|
6921
|
-
return /* @__PURE__ */
|
|
6922
|
-
/* @__PURE__ */
|
|
6923
|
-
!bare && /* @__PURE__ */
|
|
6924
|
-
/* @__PURE__ */
|
|
7065
|
+
return /* @__PURE__ */ jsxs19(Wrapper, { sx: bare ? { height: "100%" } : { p: 2, height: "100%" }, children: [
|
|
7066
|
+
/* @__PURE__ */ jsxs19(Box19, { display: "flex", justifyContent: bare ? "flex-end" : "space-between", alignItems: "center", mb: 1.5, children: [
|
|
7067
|
+
!bare && /* @__PURE__ */ jsx21(Typography17, { variant: "h6", children: title }),
|
|
7068
|
+
/* @__PURE__ */ jsx21(FormControl2, { size: "small", sx: { minWidth: 90 }, children: /* @__PURE__ */ jsxs19(
|
|
6925
7069
|
Select2,
|
|
6926
7070
|
{
|
|
6927
7071
|
value: period,
|
|
@@ -6929,23 +7073,23 @@ var LiteLLMHomeWidget = ({
|
|
|
6929
7073
|
displayEmpty: true,
|
|
6930
7074
|
inputProps: { "aria-label": "Usage period" },
|
|
6931
7075
|
children: [
|
|
6932
|
-
/* @__PURE__ */
|
|
6933
|
-
/* @__PURE__ */
|
|
6934
|
-
/* @__PURE__ */
|
|
7076
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "today", children: "Today" }),
|
|
7077
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "7d", children: "7d" }),
|
|
7078
|
+
/* @__PURE__ */ jsx21(MenuItem6, { value: "30d", children: "30d" })
|
|
6935
7079
|
]
|
|
6936
7080
|
}
|
|
6937
7081
|
) })
|
|
6938
7082
|
] }),
|
|
6939
|
-
viewState.kind === "loading" && /* @__PURE__ */
|
|
6940
|
-
/* @__PURE__ */
|
|
6941
|
-
/* @__PURE__ */
|
|
7083
|
+
viewState.kind === "loading" && /* @__PURE__ */ jsxs19(Box19, { sx: { minHeight: 120 }, children: [
|
|
7084
|
+
/* @__PURE__ */ jsx21(Skeleton7, { variant: "text", width: "60%", height: 20, sx: { mb: 1 } }),
|
|
7085
|
+
/* @__PURE__ */ jsx21(Skeleton7, { variant: "rectangular", width: "100%", height: 100 })
|
|
6942
7086
|
] }),
|
|
6943
|
-
viewState.kind === "error" && /* @__PURE__ */
|
|
6944
|
-
viewState.kind === "unprovisioned" && /* @__PURE__ */
|
|
6945
|
-
viewState.kind === "ready" && partialFailure && /* @__PURE__ */
|
|
6946
|
-
viewState.kind === "ready" && /* @__PURE__ */
|
|
6947
|
-
/* @__PURE__ */
|
|
6948
|
-
|
|
7087
|
+
viewState.kind === "error" && /* @__PURE__ */ jsx21(Typography17, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: viewState.message }),
|
|
7088
|
+
viewState.kind === "unprovisioned" && /* @__PURE__ */ jsx21(Typography17, { variant: "body2", color: "text.secondary", sx: { mt: 1 }, children: UNPROVISIONED_MSG }),
|
|
7089
|
+
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 }) }),
|
|
7090
|
+
viewState.kind === "ready" && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
7091
|
+
/* @__PURE__ */ jsx21(
|
|
7092
|
+
Typography17,
|
|
6949
7093
|
{
|
|
6950
7094
|
variant: "body2",
|
|
6951
7095
|
sx: {
|
|
@@ -6956,18 +7100,18 @@ var LiteLLMHomeWidget = ({
|
|
|
6956
7100
|
children: viewState.usageUnavailable ? USAGE_UNAVAILABLE_MSG : usageSummary(usage)
|
|
6957
7101
|
}
|
|
6958
7102
|
),
|
|
6959
|
-
hasSparkline && !viewState.usageUnavailable && /* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
|
|
7103
|
+
hasSparkline && !viewState.usageUnavailable && /* @__PURE__ */ jsxs19(Fragment10, { children: [
|
|
7104
|
+
/* @__PURE__ */ jsx21(
|
|
7105
|
+
Box19,
|
|
6962
7106
|
{
|
|
6963
7107
|
height: 80,
|
|
6964
7108
|
role: "img",
|
|
6965
7109
|
"aria-label": sparklineAriaLabelText,
|
|
6966
7110
|
sx: { mb: 0.5 },
|
|
6967
|
-
children: /* @__PURE__ */
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6970
|
-
/* @__PURE__ */
|
|
7111
|
+
children: /* @__PURE__ */ jsx21(ResponsiveContainer3, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs19(AreaChart3, { data: dailyData, margin: { top: 4, right: 0, bottom: 0, left: 0 }, children: [
|
|
7112
|
+
/* @__PURE__ */ jsx21(XAxis3, { dataKey: "date", hide: true }),
|
|
7113
|
+
/* @__PURE__ */ jsx21(Tooltip8, { content: /* @__PURE__ */ jsx21(ChartTooltip, { valueFormatter: fmtUsd }) }),
|
|
7114
|
+
/* @__PURE__ */ jsx21(
|
|
6971
7115
|
Area3,
|
|
6972
7116
|
{
|
|
6973
7117
|
type: "monotone",
|
|
@@ -6983,13 +7127,13 @@ var LiteLLMHomeWidget = ({
|
|
|
6983
7127
|
] }) })
|
|
6984
7128
|
}
|
|
6985
7129
|
),
|
|
6986
|
-
/* @__PURE__ */
|
|
7130
|
+
/* @__PURE__ */ jsxs19(Typography17, { variant: "caption", color: "text.secondary", sx: { display: "block", mb: 1 }, children: [
|
|
6987
7131
|
"daily spend (",
|
|
6988
7132
|
dateRangeCaption,
|
|
6989
7133
|
")"
|
|
6990
7134
|
] })
|
|
6991
7135
|
] }),
|
|
6992
|
-
moduleRouteRef?.() && /* @__PURE__ */
|
|
7136
|
+
moduleRouteRef?.() && /* @__PURE__ */ jsx21(Typography17, { variant: "caption", sx: { mt: 1, display: "block" }, children: /* @__PURE__ */ jsx21(Link3, { to: moduleRouteRef(), color: "primary", children: "Open LiteLLM \u2192" }) })
|
|
6993
7137
|
] })
|
|
6994
7138
|
] });
|
|
6995
7139
|
};
|
|
@@ -7002,19 +7146,19 @@ init_useLiteLLMProfile();
|
|
|
7002
7146
|
init_api();
|
|
7003
7147
|
init_format();
|
|
7004
7148
|
init_dates();
|
|
7005
|
-
import { useCallback as useCallback5, useEffect as useEffect8, useId as useId2, useMemo as useMemo11, useState as
|
|
7149
|
+
import { useCallback as useCallback5, useEffect as useEffect8, useId as useId2, useMemo as useMemo11, useState as useState15 } from "react";
|
|
7006
7150
|
import { useRouteRef as useRouteRef3 } from "@backstage/frontend-plugin-api";
|
|
7007
|
-
import
|
|
7008
|
-
import
|
|
7009
|
-
import
|
|
7010
|
-
import
|
|
7151
|
+
import Paper11 from "@mui/material/Paper";
|
|
7152
|
+
import Box20 from "@mui/material/Box";
|
|
7153
|
+
import Button9 from "@mui/material/Button";
|
|
7154
|
+
import Typography18 from "@mui/material/Typography";
|
|
7011
7155
|
import Skeleton8 from "@mui/material/Skeleton";
|
|
7012
7156
|
import Collapse4 from "@mui/material/Collapse";
|
|
7013
7157
|
import { useTheme as useTheme4 } from "@mui/material/styles";
|
|
7014
7158
|
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
7015
7159
|
import { ExpandMore as ExpandMore4 } from "@mui/icons-material";
|
|
7016
7160
|
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
|
|
7161
|
+
import { useApi as useApi7 } from "@backstage/core-plugin-api";
|
|
7018
7162
|
import { Link as Link4 } from "@backstage/core-components";
|
|
7019
7163
|
|
|
7020
7164
|
// src/ctas.ts
|
|
@@ -7042,7 +7186,7 @@ init_GenerateKeyButton();
|
|
|
7042
7186
|
init_BudgetLimitList();
|
|
7043
7187
|
init_budget();
|
|
7044
7188
|
init_routes();
|
|
7045
|
-
import { Fragment as Fragment11, jsx as
|
|
7189
|
+
import { Fragment as Fragment11, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7046
7190
|
var LEVEL = {
|
|
7047
7191
|
key: { name: "Key", none: "No cap (unlimited)" },
|
|
7048
7192
|
user: { name: "User", none: "No personal budget" },
|
|
@@ -7066,8 +7210,8 @@ function resetLabel(limit) {
|
|
|
7066
7210
|
const window2 = fmtBudgetDuration(limit.budgetDuration);
|
|
7067
7211
|
return window2 ? `resets ${window2}` : "never resets";
|
|
7068
7212
|
}
|
|
7069
|
-
var Tag = ({ children, tone, title }) => /* @__PURE__ */
|
|
7070
|
-
|
|
7213
|
+
var Tag = ({ children, tone, title }) => /* @__PURE__ */ jsx22(
|
|
7214
|
+
Typography18,
|
|
7071
7215
|
{
|
|
7072
7216
|
title,
|
|
7073
7217
|
sx: (theme) => ({
|
|
@@ -7084,10 +7228,10 @@ var Tag = ({ children, tone, title }) => /* @__PURE__ */ jsx21(
|
|
|
7084
7228
|
children
|
|
7085
7229
|
}
|
|
7086
7230
|
);
|
|
7087
|
-
var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE__ */
|
|
7088
|
-
/* @__PURE__ */
|
|
7089
|
-
/* @__PURE__ */
|
|
7090
|
-
|
|
7231
|
+
var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0, flex: 1 }, children: [
|
|
7232
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "center", gap: 0.625, minWidth: 0 }, children: [
|
|
7233
|
+
/* @__PURE__ */ jsx22(
|
|
7234
|
+
Box20,
|
|
7091
7235
|
{
|
|
7092
7236
|
sx: (theme) => ({
|
|
7093
7237
|
width: 6,
|
|
@@ -7098,10 +7242,10 @@ var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE_
|
|
|
7098
7242
|
})
|
|
7099
7243
|
}
|
|
7100
7244
|
),
|
|
7101
|
-
/* @__PURE__ */
|
|
7245
|
+
/* @__PURE__ */ jsx22(Tag, { children: label })
|
|
7102
7246
|
] }),
|
|
7103
|
-
/* @__PURE__ */
|
|
7104
|
-
|
|
7247
|
+
/* @__PURE__ */ jsx22(
|
|
7248
|
+
Typography18,
|
|
7105
7249
|
{
|
|
7106
7250
|
title,
|
|
7107
7251
|
sx: {
|
|
@@ -7117,8 +7261,8 @@ var InlineStat = ({ label, value, hint, tone = "accent", title }) => /* @__PURE_
|
|
|
7117
7261
|
children: value
|
|
7118
7262
|
}
|
|
7119
7263
|
),
|
|
7120
|
-
/* @__PURE__ */
|
|
7121
|
-
|
|
7264
|
+
/* @__PURE__ */ jsx22(
|
|
7265
|
+
Typography18,
|
|
7122
7266
|
{
|
|
7123
7267
|
variant: "caption",
|
|
7124
7268
|
color: "text.secondary",
|
|
@@ -7148,8 +7292,8 @@ var LevelRow = ({
|
|
|
7148
7292
|
const subNote = () => {
|
|
7149
7293
|
if (overCap) return "Over cap";
|
|
7150
7294
|
if (extra > 0 && keysHref) {
|
|
7151
|
-
return /* @__PURE__ */
|
|
7152
|
-
|
|
7295
|
+
return /* @__PURE__ */ jsxs20(
|
|
7296
|
+
Typography18,
|
|
7153
7297
|
{
|
|
7154
7298
|
component: Link4,
|
|
7155
7299
|
to: keysHref,
|
|
@@ -7171,8 +7315,8 @@ var LevelRow = ({
|
|
|
7171
7315
|
return limit?.sublabel ?? null;
|
|
7172
7316
|
};
|
|
7173
7317
|
const gaugeAriaLabel = limit ? `${name} budget used: ${Math.round(limit.pct)}%` : `${name} \u2014 no cap`;
|
|
7174
|
-
return /* @__PURE__ */
|
|
7175
|
-
|
|
7318
|
+
return /* @__PURE__ */ jsxs20(
|
|
7319
|
+
Box20,
|
|
7176
7320
|
{
|
|
7177
7321
|
sx: {
|
|
7178
7322
|
display: "grid",
|
|
@@ -7183,7 +7327,7 @@ var LevelRow = ({
|
|
|
7183
7327
|
minWidth: 0
|
|
7184
7328
|
},
|
|
7185
7329
|
children: [
|
|
7186
|
-
/* @__PURE__ */
|
|
7330
|
+
/* @__PURE__ */ jsx22(
|
|
7187
7331
|
Gauge,
|
|
7188
7332
|
{
|
|
7189
7333
|
value: limit?.pct ?? 0,
|
|
@@ -7193,11 +7337,11 @@ var LevelRow = ({
|
|
|
7193
7337
|
ariaLabel: gaugeAriaLabel
|
|
7194
7338
|
}
|
|
7195
7339
|
),
|
|
7196
|
-
/* @__PURE__ */
|
|
7197
|
-
/* @__PURE__ */
|
|
7198
|
-
limit ? /* @__PURE__ */
|
|
7199
|
-
/* @__PURE__ */
|
|
7200
|
-
|
|
7340
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0 }, children: [
|
|
7341
|
+
/* @__PURE__ */ jsx22(Tag, { tone: tone === "warning" || tone === "danger" ? tone : void 0, children: name }),
|
|
7342
|
+
limit ? /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
7343
|
+
/* @__PURE__ */ jsx22(
|
|
7344
|
+
Typography18,
|
|
7201
7345
|
{
|
|
7202
7346
|
variant: "caption",
|
|
7203
7347
|
title: limit.sublabel ? `${limit.label} \xB7 ${limit.sublabel}` : limit.label,
|
|
@@ -7213,8 +7357,8 @@ var LevelRow = ({
|
|
|
7213
7357
|
children: limit.label
|
|
7214
7358
|
}
|
|
7215
7359
|
),
|
|
7216
|
-
/* @__PURE__ */
|
|
7217
|
-
|
|
7360
|
+
/* @__PURE__ */ jsx22(
|
|
7361
|
+
Typography18,
|
|
7218
7362
|
{
|
|
7219
7363
|
variant: "caption",
|
|
7220
7364
|
color: overCap ? "error" : "text.secondary",
|
|
@@ -7230,8 +7374,8 @@ var LevelRow = ({
|
|
|
7230
7374
|
children: subNote()
|
|
7231
7375
|
}
|
|
7232
7376
|
)
|
|
7233
|
-
] }) : /* @__PURE__ */
|
|
7234
|
-
|
|
7377
|
+
] }) : /* @__PURE__ */ jsx22(
|
|
7378
|
+
Typography18,
|
|
7235
7379
|
{
|
|
7236
7380
|
variant: "caption",
|
|
7237
7381
|
color: "text.secondary",
|
|
@@ -7247,9 +7391,9 @@ var LevelRow = ({
|
|
|
7247
7391
|
}
|
|
7248
7392
|
)
|
|
7249
7393
|
] }),
|
|
7250
|
-
/* @__PURE__ */
|
|
7251
|
-
/* @__PURE__ */
|
|
7252
|
-
|
|
7394
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { minWidth: 0, textAlign: "right" }, children: [
|
|
7395
|
+
/* @__PURE__ */ jsx22(
|
|
7396
|
+
Typography18,
|
|
7253
7397
|
{
|
|
7254
7398
|
title: limit ? `${fmtUsd(limit.spend)} of ${fmtUsd(limit.budget)}` : void 0,
|
|
7255
7399
|
sx: {
|
|
@@ -7266,8 +7410,8 @@ var LevelRow = ({
|
|
|
7266
7410
|
children: amountCaption(limit)
|
|
7267
7411
|
}
|
|
7268
7412
|
),
|
|
7269
|
-
/* @__PURE__ */
|
|
7270
|
-
|
|
7413
|
+
/* @__PURE__ */ jsx22(
|
|
7414
|
+
Typography18,
|
|
7271
7415
|
{
|
|
7272
7416
|
variant: "caption",
|
|
7273
7417
|
color: "text.secondary",
|
|
@@ -7298,11 +7442,11 @@ function amountNote(limit) {
|
|
|
7298
7442
|
var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, maxBudget }) => {
|
|
7299
7443
|
const renderPlot = () => {
|
|
7300
7444
|
if (loading) {
|
|
7301
|
-
return /* @__PURE__ */
|
|
7445
|
+
return /* @__PURE__ */ jsx22(Skeleton8, { variant: "rectangular", width: "100%", height: "100%" });
|
|
7302
7446
|
}
|
|
7303
7447
|
if (data.length === 0) {
|
|
7304
|
-
return /* @__PURE__ */
|
|
7305
|
-
|
|
7448
|
+
return /* @__PURE__ */ jsx22(
|
|
7449
|
+
Box20,
|
|
7306
7450
|
{
|
|
7307
7451
|
display: "flex",
|
|
7308
7452
|
justifyContent: "center",
|
|
@@ -7313,10 +7457,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7313
7457
|
}
|
|
7314
7458
|
);
|
|
7315
7459
|
}
|
|
7316
|
-
return /* @__PURE__ */
|
|
7317
|
-
/* @__PURE__ */
|
|
7318
|
-
/* @__PURE__ */
|
|
7319
|
-
maxBudget !== void 0 && /* @__PURE__ */
|
|
7460
|
+
return /* @__PURE__ */ jsx22(ResponsiveContainer4, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs20(AreaChart4, { data, margin: { top: 4, right: 0, bottom: 0, left: 0 }, children: [
|
|
7461
|
+
/* @__PURE__ */ jsx22(XAxis4, { dataKey: "date", hide: true }),
|
|
7462
|
+
/* @__PURE__ */ jsx22(Tooltip9, { content: /* @__PURE__ */ jsx22(ChartTooltip, { valueFormatter: fmtUsd }) }),
|
|
7463
|
+
maxBudget !== void 0 && /* @__PURE__ */ jsx22(
|
|
7320
7464
|
ReferenceLine2,
|
|
7321
7465
|
{
|
|
7322
7466
|
y: maxBudget,
|
|
@@ -7325,7 +7469,7 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7325
7469
|
strokeWidth: 1
|
|
7326
7470
|
}
|
|
7327
7471
|
),
|
|
7328
|
-
/* @__PURE__ */
|
|
7472
|
+
/* @__PURE__ */ jsx22(
|
|
7329
7473
|
Area4,
|
|
7330
7474
|
{
|
|
7331
7475
|
type: "monotone",
|
|
@@ -7347,10 +7491,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7347
7491
|
if (data.length === 0) return "No spend this month";
|
|
7348
7492
|
return mtdCaption();
|
|
7349
7493
|
})();
|
|
7350
|
-
return /* @__PURE__ */
|
|
7351
|
-
/* @__PURE__ */
|
|
7352
|
-
/* @__PURE__ */
|
|
7353
|
-
|
|
7494
|
+
return /* @__PURE__ */ jsxs20(Box20, { role: "img", "aria-label": sparklineAriaLabel(data), sx: { minWidth: 0 }, children: [
|
|
7495
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { height, width: "100%" }, children: renderPlot() }),
|
|
7496
|
+
/* @__PURE__ */ jsxs20(
|
|
7497
|
+
Box20,
|
|
7354
7498
|
{
|
|
7355
7499
|
sx: {
|
|
7356
7500
|
display: "flex",
|
|
@@ -7361,10 +7505,10 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7361
7505
|
minWidth: 0
|
|
7362
7506
|
},
|
|
7363
7507
|
children: [
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
/* @__PURE__ */
|
|
7366
|
-
/* @__PURE__ */
|
|
7367
|
-
|
|
7508
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "baseline", gap: 0.75, minWidth: 0 }, children: [
|
|
7509
|
+
/* @__PURE__ */ jsx22(Tag, { children: "Spent (mtd)" }),
|
|
7510
|
+
/* @__PURE__ */ jsx22(
|
|
7511
|
+
Typography18,
|
|
7368
7512
|
{
|
|
7369
7513
|
variant: "caption",
|
|
7370
7514
|
color: "text.secondary",
|
|
@@ -7373,8 +7517,8 @@ var SpendStrip = ({ data, mtdSpend, loading, height, usageUnavailable = false, m
|
|
|
7373
7517
|
}
|
|
7374
7518
|
)
|
|
7375
7519
|
] }),
|
|
7376
|
-
/* @__PURE__ */
|
|
7377
|
-
|
|
7520
|
+
/* @__PURE__ */ jsx22(
|
|
7521
|
+
Typography18,
|
|
7378
7522
|
{
|
|
7379
7523
|
title: loading || usageUnavailable ? void 0 : `${fmtUsd(mtdSpend)} spent month to date`,
|
|
7380
7524
|
sx: {
|
|
@@ -7418,7 +7562,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7418
7562
|
teams: propTeams,
|
|
7419
7563
|
keys: propKeys
|
|
7420
7564
|
}) => {
|
|
7421
|
-
const api =
|
|
7565
|
+
const api = useApi7(liteLlmApiRef);
|
|
7422
7566
|
const theme = useTheme4();
|
|
7423
7567
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down("sm"));
|
|
7424
7568
|
const gaugeSize = isSmallScreen ? Math.min(48, size) : size;
|
|
@@ -7426,17 +7570,17 @@ var LiteLLMBudgetGauges = ({
|
|
|
7426
7570
|
const moduleRouteRef = useRouteRef3(rootRouteRef);
|
|
7427
7571
|
const moduleHref = propModuleHref ?? moduleRouteRef?.();
|
|
7428
7572
|
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] =
|
|
7573
|
+
const [usageLoading, setUsageLoading] = useState15(true);
|
|
7574
|
+
const [usageError, setUsageError] = useState15(null);
|
|
7575
|
+
const [dailySpend, setDailySpend] = useState15([]);
|
|
7576
|
+
const [mtdSpend, setMtdSpend] = useState15(0);
|
|
7433
7577
|
const user = propUserInfo !== void 0 ? propUserInfo : hookUserInfo;
|
|
7434
7578
|
const teams = propTeams !== void 0 ? propTeams : hookTeams;
|
|
7435
7579
|
const keys = propKeys !== void 0 ? propKeys : hookKeys;
|
|
7436
7580
|
const loading = propUserInfo === void 0 ? profileLoading : usageLoading;
|
|
7437
7581
|
const error = propUserInfo === void 0 ? profileError : usageError;
|
|
7438
7582
|
const isControlled = expanded !== void 0;
|
|
7439
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] =
|
|
7583
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState15(defaultExpanded);
|
|
7440
7584
|
const isExpanded = isControlled ? expanded : uncontrolledExpanded;
|
|
7441
7585
|
const toggleExpanded = useCallback5(() => {
|
|
7442
7586
|
const next = !isExpanded;
|
|
@@ -7517,20 +7661,20 @@ var LiteLLMBudgetGauges = ({
|
|
|
7517
7661
|
switch (cta.kind) {
|
|
7518
7662
|
case "new-key":
|
|
7519
7663
|
if (!onCreateKey && !moduleHref) return null;
|
|
7520
|
-
return onCreateKey ? /* @__PURE__ */
|
|
7664
|
+
return onCreateKey ? /* @__PURE__ */ jsx22(GenerateKeyButton, { size: "small", label, onClick: onCreateKey }, key) : /* @__PURE__ */ jsx22(GenerateKeyButton, { size: "small", label, to: `${moduleHref}?generate=1` }, key);
|
|
7521
7665
|
case "module":
|
|
7522
7666
|
if (!moduleHref) return null;
|
|
7523
|
-
return /* @__PURE__ */
|
|
7667
|
+
return /* @__PURE__ */ jsx22(Button9, { size: "small", variant: "text", component: Link4, to: moduleHref, children: label }, key);
|
|
7524
7668
|
case "all-limits":
|
|
7525
|
-
return /* @__PURE__ */
|
|
7526
|
-
|
|
7669
|
+
return /* @__PURE__ */ jsx22(
|
|
7670
|
+
Button9,
|
|
7527
7671
|
{
|
|
7528
7672
|
size: "small",
|
|
7529
7673
|
variant: "text",
|
|
7530
7674
|
onClick: toggleExpanded,
|
|
7531
7675
|
"aria-expanded": isExpanded,
|
|
7532
7676
|
"aria-controls": expandedRegionId,
|
|
7533
|
-
endIcon: /* @__PURE__ */
|
|
7677
|
+
endIcon: /* @__PURE__ */ jsx22(
|
|
7534
7678
|
ExpandMore4,
|
|
7535
7679
|
{
|
|
7536
7680
|
sx: (muiTheme) => ({
|
|
@@ -7549,11 +7693,11 @@ var LiteLLMBudgetGauges = ({
|
|
|
7549
7693
|
}
|
|
7550
7694
|
};
|
|
7551
7695
|
const hasFooter = resolvedCtas.length > 0 || !!action;
|
|
7552
|
-
const Wrapper = bare ?
|
|
7553
|
-
return /* @__PURE__ */
|
|
7554
|
-
/* @__PURE__ */
|
|
7555
|
-
!bare && /* @__PURE__ */
|
|
7556
|
-
!loading && !error && /* @__PURE__ */
|
|
7696
|
+
const Wrapper = bare ? Box20 : Paper11;
|
|
7697
|
+
return /* @__PURE__ */ jsxs20(Wrapper, { sx: bare ? { height: "100%" } : { p: 2, height: "100%" }, children: [
|
|
7698
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 1.5, minWidth: 0, justifyContent: bare ? "flex-end" : void 0 }, children: [
|
|
7699
|
+
!bare && /* @__PURE__ */ jsx22(Typography18, { variant: "h6", lineHeight: 1.2, sx: { minWidth: 0, flex: 1 }, children: title }),
|
|
7700
|
+
!loading && !error && /* @__PURE__ */ jsx22(
|
|
7557
7701
|
StatusPill,
|
|
7558
7702
|
{
|
|
7559
7703
|
label: summaryText,
|
|
@@ -7562,19 +7706,19 @@ var LiteLLMBudgetGauges = ({
|
|
|
7562
7706
|
}
|
|
7563
7707
|
)
|
|
7564
7708
|
] }),
|
|
7565
|
-
viewState.kind === "loading" && /* @__PURE__ */
|
|
7566
|
-
/* @__PURE__ */
|
|
7567
|
-
/* @__PURE__ */
|
|
7568
|
-
/* @__PURE__ */
|
|
7569
|
-
/* @__PURE__ */
|
|
7709
|
+
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: [
|
|
7710
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "circular", width: size, height: size }),
|
|
7711
|
+
/* @__PURE__ */ jsxs20(Box20, { sx: { flex: 1 }, children: [
|
|
7712
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: "70%", height: 12, sx: { mb: 0.25 } }),
|
|
7713
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: "45%", height: 11 })
|
|
7570
7714
|
] }),
|
|
7571
|
-
/* @__PURE__ */
|
|
7715
|
+
/* @__PURE__ */ jsx22(Skeleton8, { variant: "text", width: 64, height: 12 })
|
|
7572
7716
|
] }, i)) }),
|
|
7573
|
-
viewState.kind === "error" && /* @__PURE__ */
|
|
7574
|
-
viewState.kind === "unprovisioned" && /* @__PURE__ */
|
|
7575
|
-
viewState.kind === "ready" && /* @__PURE__ */
|
|
7576
|
-
/* @__PURE__ */
|
|
7577
|
-
|
|
7717
|
+
viewState.kind === "error" && /* @__PURE__ */ jsx22(Typography18, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: viewState.message }),
|
|
7718
|
+
viewState.kind === "unprovisioned" && /* @__PURE__ */ jsx22(Typography18, { variant: "body2", color: "text.secondary", sx: { mt: 0.5 }, children: UNPROVISIONED_MSG }),
|
|
7719
|
+
viewState.kind === "ready" && /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
7720
|
+
/* @__PURE__ */ jsxs20(
|
|
7721
|
+
Box20,
|
|
7578
7722
|
{
|
|
7579
7723
|
sx: {
|
|
7580
7724
|
display: "flex",
|
|
@@ -7584,7 +7728,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7584
7728
|
minWidth: 0
|
|
7585
7729
|
},
|
|
7586
7730
|
children: [
|
|
7587
|
-
/* @__PURE__ */
|
|
7731
|
+
/* @__PURE__ */ jsx22(
|
|
7588
7732
|
InlineStat,
|
|
7589
7733
|
{
|
|
7590
7734
|
label: "Today spent",
|
|
@@ -7594,8 +7738,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7594
7738
|
title: usageLoading || viewState.usageUnavailable ? void 0 : "Spend since local midnight"
|
|
7595
7739
|
}
|
|
7596
7740
|
),
|
|
7597
|
-
/* @__PURE__ */
|
|
7598
|
-
/* @__PURE__ */
|
|
7741
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { width: "1px", bgcolor: "divider", flexShrink: 0 } }),
|
|
7742
|
+
/* @__PURE__ */ jsx22(
|
|
7599
7743
|
InlineStat,
|
|
7600
7744
|
{
|
|
7601
7745
|
label: "Month to date",
|
|
@@ -7607,15 +7751,15 @@ var LiteLLMBudgetGauges = ({
|
|
|
7607
7751
|
]
|
|
7608
7752
|
}
|
|
7609
7753
|
),
|
|
7610
|
-
/* @__PURE__ */
|
|
7611
|
-
|
|
7754
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { borderTop: "1px solid", borderColor: "divider" }, children: gauges.map((gauge, i) => /* @__PURE__ */ jsx22(
|
|
7755
|
+
Box20,
|
|
7612
7756
|
{
|
|
7613
7757
|
sx: i === 0 ? void 0 : { borderTop: "1px solid", borderColor: "divider" },
|
|
7614
|
-
children: /* @__PURE__ */
|
|
7758
|
+
children: /* @__PURE__ */ jsx22(LevelRow, { gauge, size: gaugeSize, keysHref: keysTabHref })
|
|
7615
7759
|
},
|
|
7616
7760
|
gauge.kind
|
|
7617
7761
|
)) }),
|
|
7618
|
-
/* @__PURE__ */
|
|
7762
|
+
/* @__PURE__ */ jsx22(Box20, { sx: { mt: 1.25 }, children: /* @__PURE__ */ jsx22(
|
|
7619
7763
|
SpendStrip,
|
|
7620
7764
|
{
|
|
7621
7765
|
data: dailySpend,
|
|
@@ -7626,8 +7770,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7626
7770
|
maxBudget: user?.max_budget ?? void 0
|
|
7627
7771
|
}
|
|
7628
7772
|
) }),
|
|
7629
|
-
/* @__PURE__ */
|
|
7630
|
-
|
|
7773
|
+
/* @__PURE__ */ jsx22(Collapse4, { in: isExpanded, unmountOnExit: true, children: /* @__PURE__ */ jsx22(
|
|
7774
|
+
Box20,
|
|
7631
7775
|
{
|
|
7632
7776
|
id: expandedRegionId,
|
|
7633
7777
|
sx: {
|
|
@@ -7637,7 +7781,7 @@ var LiteLLMBudgetGauges = ({
|
|
|
7637
7781
|
maxHeight: 300,
|
|
7638
7782
|
overflowY: "auto"
|
|
7639
7783
|
},
|
|
7640
|
-
children: /* @__PURE__ */
|
|
7784
|
+
children: /* @__PURE__ */ jsx22(LimitListPanel, { children: /* @__PURE__ */ jsx22(
|
|
7641
7785
|
BudgetLimitList,
|
|
7642
7786
|
{
|
|
7643
7787
|
limits: expandedLimits,
|
|
@@ -7648,8 +7792,8 @@ var LiteLLMBudgetGauges = ({
|
|
|
7648
7792
|
}
|
|
7649
7793
|
) })
|
|
7650
7794
|
] }),
|
|
7651
|
-
hasFooter && /* @__PURE__ */
|
|
7652
|
-
|
|
7795
|
+
hasFooter && /* @__PURE__ */ jsxs20(
|
|
7796
|
+
Box20,
|
|
7653
7797
|
{
|
|
7654
7798
|
sx: (muiTheme) => ({
|
|
7655
7799
|
mt: 2,
|