@acarmisc/backstage-plugin-litellm 0.26.0 → 0.28.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/components/GenerateKeyButton.d.ts +22 -0
- package/dist/components/LiteLLMBudgetGauges.d.ts +23 -10
- package/dist/index.cjs.js +700 -516
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +566 -382
- package/dist/index.esm.js.map +4 -4
- package/package.json +1 -1
- package/dist/SearchInput.d.ts +0 -1
- package/dist/components/SearchInput.d.ts +0 -9
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The single "create a key" call-to-action used everywhere in the plugin —
|
|
4
|
+
* the plugin page (header, keys table) and the homepage budget card all
|
|
5
|
+
* render this instead of their own inline `Button`, so the copy, icon and
|
|
6
|
+
* styling stay identical.
|
|
7
|
+
*/
|
|
8
|
+
export interface GenerateKeyButtonProps {
|
|
9
|
+
/** Deep-link target (e.g. `/litellm?generate=1`). Ignored when `onClick` is set. */
|
|
10
|
+
to?: string;
|
|
11
|
+
/** Click handler. Takes precedence over `to` when both are given. */
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
/** Override the default `Generate New Key` copy (e.g. empty-state variants). */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Button size — card footers use `small`, page headers the default. */
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
/** Stretch to the container width (card-footers). Defaults to false. */
|
|
18
|
+
fullWidth?: boolean;
|
|
19
|
+
/** Disabled state (e.g. until the account data loads). A disabled `to` renders inert. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const GenerateKeyButton: React.FC<GenerateKeyButtonProps>;
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Condensed budget card for a homepage column: one ring gauge per
|
|
3
|
-
* enforcement level (key → personal → team)
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* enforcement level (key → personal → team) plus a month-to-date daily
|
|
4
|
+
* token-usage mini-chart, in a fixed four-column row. Each gauge shows the
|
|
5
|
+
* limit nearest its cap; where the full `LiteLLMBudgetWidget` lists every
|
|
6
|
+
* limit as a spend-vs-cap meter, this trades detail for density — a single
|
|
7
|
+
* row with a label and spend figure under each gauge, and the MTD token
|
|
8
|
+
* total under the chart.
|
|
7
9
|
*
|
|
8
10
|
* Gauges are always rendered in the same order, with an empty ring when the
|
|
9
11
|
* user has no cap at that level, so the card keeps a stable shape as data
|
|
10
12
|
* loads and across users. When a level holds several limits, the ring shows
|
|
11
13
|
* the one closest to its cap and a "+N more" link counts the rest.
|
|
12
14
|
*
|
|
13
|
-
* The
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* The usage period is frozen to month-to-date (no period selector): the
|
|
16
|
+
* chart always covers the 1st of the current month through today.
|
|
17
|
+
*
|
|
18
|
+
* The bottom action bar is composable: pass any subset of `ctas` — generate
|
|
19
|
+
* a new key, open the LiteLLM module, or expand the full per-limit list in
|
|
20
|
+
* place — in the order you want. `action` remains an escape hatch for a
|
|
21
|
+
* fully custom node; when either is present it renders below a divider. The
|
|
22
|
+
* `new-key` CTA renders the shared `GenerateKeyButton`, identical to the
|
|
23
|
+
* one on the plugin page.
|
|
17
24
|
*/
|
|
18
25
|
import React from 'react';
|
|
19
26
|
/** Preset action-bar buttons. `label` overrides the default copy. */
|
|
@@ -35,8 +42,9 @@ export interface LiteLLMBudgetGaugesProps {
|
|
|
35
42
|
/** Where the module CTA points. Defaults to the LiteLLM page. */
|
|
36
43
|
moduleHref?: string;
|
|
37
44
|
/**
|
|
38
|
-
* Called when the "
|
|
39
|
-
* to the module with `?generate=1`, which opens the
|
|
45
|
+
* Called when the "Generate New Key" CTA is used. When omitted, the CTA
|
|
46
|
+
* deep-links to the module with `?generate=1`, which opens the
|
|
47
|
+
* generate-key dialog.
|
|
40
48
|
*/
|
|
41
49
|
onCreateKey?: () => void;
|
|
42
50
|
/**
|
|
@@ -56,4 +64,9 @@ export interface LiteLLMBudgetGaugesProps {
|
|
|
56
64
|
/** Fully custom node pinned below the CTAs, below a divider. */
|
|
57
65
|
action?: React.ReactNode;
|
|
58
66
|
}
|
|
67
|
+
/** Month-to-date range as `YYYY-MM-DD` strings: the 1st of the current month through today. */
|
|
68
|
+
export declare function monthToDateRange(now?: Date): {
|
|
69
|
+
startDate: string;
|
|
70
|
+
endDate: string;
|
|
71
|
+
};
|
|
59
72
|
export declare const LiteLLMBudgetGauges: React.FC<LiteLLMBudgetGaugesProps>;
|